Skip to content

Standardize Vectors and Colors #13699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fb0909b
tmp
james-pre Aug 17, 2023
ec9166a
Added dynamic vector/declar class
james-pre Aug 18, 2023
24877bf
Moved Constructor type to types
james-pre Aug 18, 2023
e39c2be
Removed ClassConstructor types
james-pre Aug 18, 2023
8248ea9
Added Vector3 and almost finished Vector4
james-pre Aug 18, 2023
e225e37
Finished standardizing Vector4
james-pre Aug 18, 2023
82f6656
Finished adding Vector to other Vectors
james-pre Aug 21, 2023
a0f9dfb
Updated existing Color3 for Vector
james-pre Aug 21, 2023
9bf1d1b
Added new methods needed to Color3
james-pre Aug 21, 2023
a46b98f
Added Vector to Color4
james-pre Aug 21, 2023
5eb807c
Formatting
james-pre Aug 21, 2023
1ce8dd5
Updated Vector2.length to use lengthSquared
james-pre Aug 21, 2023
772cba5
Added DynamicVector to registered classes
james-pre Aug 21, 2023
6af82e2
Merge branch 'BabylonJS:master' into master
Aug 22, 2023
8ec3c9c
Added VectorLike
james-pre Aug 22, 2023
5cef8d2
Partly removed usage
james-pre Aug 22, 2023
e793450
Fixed ...toRef usage
james-pre Aug 23, 2023
6e4451c
Fixed VectorLike.addInPlaceFromFloats arg type
james-pre Aug 23, 2023
21389a2
Fixed Vector3.addInPlace
james-pre Aug 23, 2023
d500851
Updated dimension and fixed types
james-pre Aug 23, 2023
f335abf
Merge
james-pre Aug 23, 2023
157fc18
Removed DynamicVector
james-pre Aug 24, 2023
a5fa884
Fixed Color4 minimizeInPlace and maximizeInPlace
james-pre Aug 24, 2023
10563bc
Fixed Vector3.floorToRef, fractToRef
james-pre Aug 24, 2023
37f85e9
Fixed types being or not being DeepImmutable
james-pre Aug 24, 2023
5e648c7
Fixed Vector2.normalize
james-pre Aug 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/dev/core/src/Cameras/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { serialize, SerializationHelper, serializeAsVector3 } from "../Misc/deco
import { SmartArray } from "../Misc/smartArray";
import { Tools } from "../Misc/tools";
import { Observable } from "../Misc/observable";
import type { Nullable } from "../types";
import type { DeepImmutable, Nullable } from "../types";
import type { CameraInputsManager } from "./cameraInputsManager";
import type { Scene } from "../scene";
import { Matrix, Vector3, Quaternion } from "../Maths/math.vector";
Expand Down Expand Up @@ -1361,7 +1361,7 @@ export class Camera extends Node {
* @param localAxis Defines the reference axis to provide a relative direction.
* @returns the direction
*/
public getDirection(localAxis: Vector3): Vector3 {
public getDirection(localAxis: DeepImmutable<Vector3>): Vector3 {
const result = Vector3.Zero();

this.getDirectionToRef(localAxis, result);
Expand All @@ -1383,7 +1383,7 @@ export class Camera extends Node {
* @param localAxis Defines the reference axis to provide a relative direction.
* @param result Defines the vector to store the result in
*/
public getDirectionToRef(localAxis: Vector3, result: Vector3): void {
public getDirectionToRef(localAxis: DeepImmutable<Vector3>, result: Vector3): void {
Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
}

Expand Down
12 changes: 6 additions & 6 deletions packages/dev/core/src/Debug/directionalLightFrustumViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,32 +247,32 @@ export class DirectionalLightFrustumViewer {
this._rootNode = new TransformNode("directionalLightHelperRoot_" + this._light.name, this._scene);
this._rootNode.parent = this._light.parent;

this._nearLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly];
this._nearLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly] as Vector3[];
const nearLines = CreateLines("nearlines", { updatable: true, points: this._nearLinesPoints }, this._scene);
nearLines.parent = this._rootNode;
nearLines.alwaysSelectAsActiveMesh = true;

this._farLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly];
this._farLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly, Vector3.ZeroReadOnly] as Vector3[];
const farLines = CreateLines("farlines", { updatable: true, points: this._farLinesPoints }, this._scene);
farLines.parent = this._rootNode;
farLines.alwaysSelectAsActiveMesh = true;

this._trLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly];
this._trLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly] as Vector3[];
const trLines = CreateLines("trlines", { updatable: true, points: this._trLinesPoints }, this._scene);
trLines.parent = this._rootNode;
trLines.alwaysSelectAsActiveMesh = true;

this._brLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly];
this._brLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly] as Vector3[];
const brLines = CreateLines("brlines", { updatable: true, points: this._brLinesPoints }, this._scene);
brLines.parent = this._rootNode;
brLines.alwaysSelectAsActiveMesh = true;

this._tlLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly];
this._tlLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly] as Vector3[];
const tlLines = CreateLines("tllines", { updatable: true, points: this._tlLinesPoints }, this._scene);
tlLines.parent = this._rootNode;
tlLines.alwaysSelectAsActiveMesh = true;

this._blLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly];
this._blLinesPoints = [Vector3.ZeroReadOnly, Vector3.ZeroReadOnly] as Vector3[];
const blLines = CreateLines("bllines", { updatable: true, points: this._blLinesPoints }, this._scene);
blLines.parent = this._rootNode;
blLines.alwaysSelectAsActiveMesh = true;
Expand Down
Loading