-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [0.8.3](v0.8.2...v0.8.3) (2024-08-28) ### Bug Fixes * fix frameRate and camera resize ([c4b8626](c4b8626)) * fix InstanceDraw destroy error ([4529594](4529594)) * **GUI:** add option to receive post effects ([#426](#426)) ([af74bb1](af74bb1)) * **inputsystem:** capture pointer on pointerdown ([#432](#432)) ([cc90b82](cc90b82)) * **shadow:** fix acceptShadow ([4d6a838](4d6a838)) * **transform:** fix lookAt at vertical angle ([#431](#431)) ([1922f18](1922f18)) ### Features * add GridObject ([#436](#436)) ([a939ce6](a939ce6)) * **geometry:** add extra geometry package, extrude geometry and text geometry ([#442](#442)) ([069e6d4](069e6d4)) * **graphic:** move graphic3D to @orillusion/graphic ([#427](#427)) ([a1d1b2a](a1d1b2a)) * **physics:** add RopeSoftBody, rigidbody dragger, and enhance collisionShapeUtil ([#448](#448)) ([452d730](452d730)) * **physics:** Refactor physics plugin with extensive enhancements and new features ([#440](#440)) ([7c18db5](7c18db5))
- Loading branch information
Showing
327 changed files
with
23,926 additions
and
3,528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,7 @@ class _GUIHelp { | |
} | ||
} | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
packages/geometry/ExtrudeGeometry/Curve/CubicBezierCurve2D.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Vector2 } from "@orillusion/core"; | ||
import { Curve2D } from "./Curve2D"; | ||
|
||
export class CubicBezierCurve2D extends Curve2D { | ||
public v0: Vector2; | ||
public v1: Vector2; | ||
public v2: Vector2; | ||
public v3: Vector2; | ||
|
||
constructor(v0: Vector2, v1: Vector2, v2: Vector2, v3: Vector2) { | ||
super(); | ||
this.v0 = v0; | ||
this.v1 = v1; | ||
this.v2 = v2; | ||
this.v3 = v3; | ||
} | ||
|
||
public get points(): Vector2[] { | ||
return [this.v0, this.v1, this.v2, this.v3]; | ||
} | ||
|
||
public getPoint(t: number, result: Vector2 = new Vector2()): Vector2 { | ||
result.set( | ||
this.cubicBezier(t, this.v0.x, this.v1.x, this.v2.x, this.v3.x), | ||
this.cubicBezier(t, this.v0.y, this.v1.y, this.v2.y, this.v3.y) | ||
); | ||
return result; | ||
} | ||
|
||
public copyFrom(other: CubicBezierCurve2D) { | ||
this.v0.copyFrom(other.v0); | ||
this.v1.copyFrom(other.v1); | ||
this.v2.copyFrom(other.v2); | ||
this.v3.copyFrom(other.v3); | ||
} | ||
|
||
protected cubicBezierP0(t: number, p: number) { | ||
const k = 1 - t; | ||
return k * k * k * p; | ||
} | ||
|
||
protected cubicBezierP1(t: number, p: number) { | ||
const k = 1 - t; | ||
return 3 * k * k * t * p; | ||
} | ||
|
||
protected cubicBezierP2(t: number, p: number) { | ||
return 3 * (1 - t) * t * t * p; | ||
} | ||
|
||
protected cubicBezierP3(t: number, p: number) { | ||
return t * t * t * p; | ||
} | ||
|
||
protected cubicBezier(t: number, p0: number, p1: number, p2: number, p3: number) { | ||
return this.cubicBezierP0(t, p0) + this.cubicBezierP1(t, p1) + this.cubicBezierP2(t, p2) + this.cubicBezierP3(t, p3); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Vector2 } from "@orillusion/core"; | ||
|
||
export enum CurveType { | ||
LineCurve, | ||
SplineCurve, | ||
EllipseCurve, | ||
QuadraticBezierCurve, | ||
} | ||
|
||
export class Curve2D { | ||
public curveType: CurveType; | ||
|
||
public get points(): Vector2[] { | ||
console.warn("points not implementation!"); | ||
return []; | ||
} | ||
|
||
public getPoint(t: number, result: Vector2 = new Vector2()): Vector2 { | ||
console.warn("getPoint not implementation!"); | ||
return result; | ||
} | ||
|
||
public getPoints(divisions = 5): Vector2[] { | ||
let points: Vector2[] = []; | ||
for (let d = 0; d <= divisions; d++) { | ||
points.push(this.getPoint(d / divisions)); | ||
} | ||
return points; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Vector2 } from "@orillusion/core"; | ||
import { Curve2D, CurveType } from "./Curve2D"; | ||
|
||
export class LineCurve2D extends Curve2D { | ||
public v0: Vector2; | ||
public v1: Vector2; | ||
|
||
constructor(v0: Vector2, v1: Vector2) { | ||
super(); | ||
this.v0 = v0; | ||
this.v1 = v1; | ||
this.curveType = CurveType.LineCurve; | ||
} | ||
|
||
public get points(): Vector2[] { | ||
return [this.v0, this.v1]; | ||
} | ||
|
||
public getPoint(t: number, result: Vector2 = new Vector2()): Vector2 { | ||
if (t >= 1) { | ||
result.copyFrom(this.v1); | ||
} else { | ||
this.v1.sub(this.v0, result); | ||
result.multiplyScaler(t).add(this.v0, result); | ||
} | ||
return result; | ||
} | ||
|
||
public getPointAt(u: number, result: Vector2 = new Vector2()): Vector2 { | ||
return this.getPoint(u, result); | ||
} | ||
|
||
public getTangent(t: number, result: Vector2 = new Vector2()): Vector2 { | ||
this.v1.sub(this.v0, result); | ||
result.normalize(); | ||
return result; | ||
} | ||
|
||
public getTangentAt(u: number, result: Vector2 = new Vector2()): Vector2 { | ||
return this.getTangent(u, result); | ||
} | ||
|
||
public copyFrom(other: LineCurve2D) { | ||
this.v0.copyFrom(other.v0); | ||
this.v1.copyFrom(other.v1); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
packages/geometry/ExtrudeGeometry/Curve/QuadraticBezierCurve2D.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Vector2 } from "@orillusion/core"; | ||
import { Curve2D, CurveType } from "./Curve2D"; | ||
|
||
export class QuadraticBezierCurve2D extends Curve2D { | ||
public v0: Vector2; | ||
public v1: Vector2; | ||
public v2: Vector2; | ||
|
||
constructor(v0: Vector2, v1: Vector2, v2: Vector2) { | ||
super(); | ||
this.v0 = v0; | ||
this.v1 = v1; | ||
this.v2 = v2; | ||
this.curveType = CurveType.QuadraticBezierCurve; | ||
} | ||
|
||
public get points(): Vector2[] { | ||
return [this.v0, this.v1, this.v2]; | ||
} | ||
|
||
public getPoint(t: number, result: Vector2 = new Vector2()): Vector2 { | ||
result.set( | ||
this.quadraticBezier(t, this.v0.x, this.v1.x, this.v2.x), | ||
this.quadraticBezier(t, this.v0.y, this.v1.y, this.v2.y) | ||
); | ||
return result; | ||
} | ||
|
||
public copyFrom(other: QuadraticBezierCurve2D) { | ||
this.v0.copyFrom(other.v0); | ||
this.v1.copyFrom(other.v1); | ||
this.v2.copyFrom(other.v2); | ||
} | ||
|
||
protected quadraticBezierP0(t: number, p: number) { | ||
const k = 1 - t; | ||
return k * k * p; | ||
} | ||
|
||
protected quadraticBezierP1(t: number, p: number) { | ||
return 2 * (1 - t) * t * p; | ||
} | ||
|
||
protected quadraticBezierP2(t: number, p: number) { | ||
return t * t * p; | ||
} | ||
|
||
protected quadraticBezier(t: number, p0: number, p1: number, p2: number): number { | ||
return this.quadraticBezierP0(t, p0) + this.quadraticBezierP1(t, p1) + this.quadraticBezierP2(t, p2); | ||
} | ||
} |
Oops, something went wrong.