Skip to content
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

Tensor: Standardize Vector2, Vector3, Vector4, Color3, Color4, Quaternion, and Matrix #14235

Merged
merged 74 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
35af7f2
Added new types
james-pre Aug 30, 2023
0f5e219
Added Member, Flatten, and tensor
james-pre Aug 30, 2023
09ca803
Updated classes in vector.ts to use Constructor
james-pre Aug 30, 2023
bd84e4a
Removed TensorValue and fixed comments
james-pre Aug 30, 2023
dfeb3b1
Fixed wikipedia link
james-pre Aug 30, 2023
78fc212
Added Tensor to vector and color classes
james-pre Aug 31, 2023
1438578
Added IsTuple types
james-pre Aug 31, 2023
ab26305
Added public to Tensor and Vector members
james-pre Sep 1, 2023
f6fe9da
Fixed types being or not being DeepImmutable
james-pre Aug 24, 2023
1e989fd
Formatting
james-pre Sep 5, 2023
9f9e655
Added Tuple
james-pre Sep 5, 2023
9fda9b5
Updated arrayTools to use new Tuple type
james-pre Sep 11, 2023
1083709
Updated to use object.defineProperty for dimension
james-pre Sep 11, 2023
ecf9981
Fixed dimension values
james-pre Sep 12, 2023
df6d705
Added Dimension
james-pre Sep 12, 2023
94bdb99
Fixed Dimension import
james-pre Sep 12, 2023
57a238e
Fixed Tensor not working with non `number[]` types
james-pre Nov 10, 2023
1474e02
Fixed equalsToFloats not using Flatten
james-pre Nov 10, 2023
21b6534
Made Matrix Tensor-compatible
james-pre Nov 10, 2023
de01663
Updated Quaternion to be Tensor compatible
james-pre Nov 10, 2023
b4d8d06
Renamed I<Math>Like to <Math>Like
james-pre Nov 10, 2023
25769e7
Moved <Math>Like to correct files
james-pre Nov 10, 2023
539f1e6
Merge branch 'master' into tensor
james-pre Nov 10, 2023
25879aa
Fixed duplicate function implementation
james-pre Nov 10, 2023
706709f
Changed dimension to be Readonly
james-pre Nov 10, 2023
5501d33
Fixed mispelling
james-pre Nov 11, 2023
7728fe2
Updated Vector3.asArray and Matrix.asArray
james-pre Nov 11, 2023
e6d5a73
Updated test Playground
james-pre Nov 11, 2023
8094c96
Changed default Tensor value type to unknown[]
james-pre Nov 11, 2023
5e2253b
Added TensorValue
james-pre Nov 11, 2023
4c41e80
Merge branch 'master' into tensor
james-pre Nov 14, 2023
451a316
Fixed stuff from merge
james-pre Nov 14, 2023
e45c03f
Fixed JSDoc comment parameter order
james-pre Nov 14, 2023
9150d62
Added Tensor.rank
james-pre Nov 15, 2023
7ce70a9
Fixed typo
james-pre Nov 15, 2023
25d7989
Formatting
james-pre Nov 15, 2023
a8be563
Merge branch 'master' into tensor
james-pre Jan 6, 2024
ed6f9f0
Formatting
james-pre Jan 8, 2024
ec2ad1a
Merge remote-tracking branch 'upstream/master' into tensor
james-pre Jan 10, 2024
a59d834
Made Matrix.asArray zero-copy
james-pre Jan 10, 2024
3ccba05
Moved from defineProperty to defineProperties
james-pre Jan 11, 2024
2d06268
Reverted *Like changes
james-pre Feb 5, 2024
10f388f
Merge branch 'master' into tensor
james-pre Feb 5, 2024
a853276
Fixed JSDoc comments
james-pre Feb 5, 2024
2ae66a2
Formatting
james-pre Feb 5, 2024
584590e
Formatting (clean install)
james-pre Feb 5, 2024
6e95392
Fixed eslint warnings
james-pre Feb 5, 2024
934b667
Reverted IViewportLike
james-pre Feb 5, 2024
4a0c5cf
Reverted flloat -> number change in math.like
james-pre Feb 5, 2024
3edd805
Fixed imports
james-pre Feb 5, 2024
d30689d
Fixed more imports
james-pre Feb 6, 2024
75fef20
Reverted more organization changes
james-pre Feb 6, 2024
a148331
Updated directionalLightFrustumViewer._createGeometry vectors
james-pre Feb 7, 2024
d009e1a
Added Matrix.toArray backwards compatibility
james-pre Feb 12, 2024
509d5d1
Fixed RecursiveArray spelling
james-pre Feb 13, 2024
193f542
Fixed Tensor description
james-pre Feb 13, 2024
897a071
Fixed Vector description
james-pre Feb 13, 2024
4e38dc4
Comment overhaul
james-pre Feb 13, 2024
1dac6f5
Changed m.length to 16
james-pre Feb 13, 2024
f3fe026
Removed some method implementations from Color3 and Color4
james-pre Feb 13, 2024
9f20dfe
Added internal to doc comment for color methods
james-pre Feb 14, 2024
36d71d1
Removed methods from Quaternion
james-pre Feb 14, 2024
3431e55
Fixed Vector not implementing Vector
james-pre Feb 14, 2024
f1b41b5
made all Tensor instance methods abstract
james-pre Feb 14, 2024
cd2d360
Added abstract to Vector
james-pre Feb 14, 2024
038a9c9
Removed unused types
james-pre Feb 15, 2024
6d4c2ec
Removed Tensor.toString
james-pre Feb 15, 2024
24cd34a
Seperated instance and static of Tensor and Vector into interfaces
james-pre Feb 20, 2024
266017c
Added TensorStatic.prototype
james-pre Feb 20, 2024
0691ccf
Removed type parameters in Tensor and Vector methods
james-pre Feb 20, 2024
60f0496
Added Vector4 static side
james-pre Feb 20, 2024
2bd3676
Added static side to Quaternion
james-pre Feb 21, 2024
55efc41
Merge branch 'master' into tensor
james-pre Mar 2, 2024
c3764d8
Formatting
james-pre Mar 2, 2024
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
12 changes: 6 additions & 6 deletions packages/dev/core/src/Actions/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,12 @@ export class Action implements IAction {
targetType: (<Mesh>target)._isMesh
? "MeshProperties"
: (<Light>target)._isLight
? "LightProperties"
: (<Camera>target)._isCamera
? "CameraProperties"
: (<Material>target)._isMaterial
? "MaterialProperties"
: "SceneProperties",
? "LightProperties"
: (<Camera>target)._isCamera
? "CameraProperties"
: (<Material>target)._isMaterial
? "MaterialProperties"
: "SceneProperties",
value: (<Scene>target)._isScene ? "Scene" : (<Node>target).name,
};
};
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/core/src/Bones/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,8 @@ export class Skeleton implements IAnimatable {
index: bone.getIndex(),
name: bone.name,
id: bone.id,
matrix: bone.getBindMatrix().toArray(),
rest: bone.getRestMatrix().toArray(),
matrix: bone.getBindMatrix().asArray(),
rest: bone.getRestMatrix().asArray(),
linkedTransformNodeId: bone.getTransformNode()?.id,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ export class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera
<any>window.orientation !== undefined
? +(<any>window.orientation)
: (<any>window.screen).orientation && (<any>window.screen).orientation["angle"]
? (<any>window.screen).orientation.angle
: 0;
? (<any>window.screen).orientation.angle
: 0;
this._screenOrientationAngle = -Tools.ToRadians(this._screenOrientationAngle / 2);
this._screenQuaternion.copyFromFloats(0, Math.sin(this._screenOrientationAngle), 0, Math.cos(this._screenOrientationAngle));
};
Expand Down
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 @@ -1401,7 +1401,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 @@ -1423,7 +1423,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[];
james-pre marked this conversation as resolved.
Show resolved Hide resolved
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import type { IKeyboardEvent, IPointerEvent, IWheelEvent } from "../../Events/de
export type DeviceSourceEvent<T extends DeviceType> = T extends DeviceType.Keyboard
? IKeyboardEvent
: T extends DeviceType.Mouse
? IWheelEvent | IPointerEvent
: T extends DeviceType.Touch
? IPointerEvent
: never;
? IWheelEvent | IPointerEvent
: T extends DeviceType.Touch
? IPointerEvent
: never;

/**
* Class that handles all input for a specific device
Expand Down
20 changes: 10 additions & 10 deletions packages/dev/core/src/DeviceInput/InputDevices/deviceTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import type { DeviceType, PointerInput, DualShockInput, XboxInput, SwitchInput,
export type DeviceInput<T extends DeviceType> = T extends DeviceType.Keyboard | DeviceType.Generic
? number
: T extends DeviceType.Mouse | DeviceType.Touch
? Exclude<PointerInput, PointerInput.Move | PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ>
: T extends DeviceType.DualShock
? DualShockInput
: T extends DeviceType.Xbox
? XboxInput
: T extends DeviceType.Switch
? SwitchInput
: T extends DeviceType.DualSense
? DualSenseInput
: never;
? Exclude<PointerInput, PointerInput.Move | PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ>
: T extends DeviceType.DualShock
? DualShockInput
: T extends DeviceType.Xbox
? XboxInput
: T extends DeviceType.Switch
? SwitchInput
: T extends DeviceType.DualSense
? DualSenseInput
: never;
4 changes: 2 additions & 2 deletions packages/dev/core/src/DeviceInput/webDeviceInputSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,8 @@ export class WebDeviceInputSystem implements IDeviceInputSystem {
"onwheel" in document.createElement("div")
? "wheel" // Modern browsers support "wheel"
: (<any>document).onmousewheel !== undefined
? "mousewheel" // Webkit and IE support at least "mousewheel"
: "DOMMouseScroll"; // let's assume that remaining browsers are older Firefox
? "mousewheel" // Webkit and IE support at least "mousewheel"
: "DOMMouseScroll"; // let's assume that remaining browsers are older Firefox

// Code originally in scene.inputManager.ts
// Chrome reports warning in console if wheel listener doesn't set an explicit passive option.
Expand Down
19 changes: 10 additions & 9 deletions packages/dev/core/src/Engines/IPipelineContext.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Nullable } from "../types";
import type { Effect } from "../Materials/effect";
import type { IMatrixLike, IVector2Like, IVector3Like, IVector4Like, IColor3Like, IColor4Like, IQuaternionLike } from "../Maths/math.like";
import type { Color3Like, Color4Like } from "../Maths/math.color";
import type { MatrixLike, Vector2Like, Vector3Like, Vector4Like, QuaternionLike } from "../Maths/math.vector";

/**
* Class used to store and describe the pipeline context associated with an effect
Expand Down Expand Up @@ -206,7 +207,7 @@ export interface IPipelineContext {
* @param uniformName Name of the variable.
* @param matrix matrix to be set.
*/
setMatrix(uniformName: string, matrix: IMatrixLike): void;
setMatrix(uniformName: string, matrix: MatrixLike): void;

/**
* Sets a 3x3 matrix on a uniform variable. (Specified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)
Expand Down Expand Up @@ -234,7 +235,7 @@ export interface IPipelineContext {
* @param uniformName Name of the variable.
* @param vector2 vector2 to be set.
*/
setVector2(uniformName: string, vector2: IVector2Like): void;
setVector2(uniformName: string, vector2: Vector2Like): void;

/**
* Sets a float2 on a uniform variable.
Expand All @@ -249,7 +250,7 @@ export interface IPipelineContext {
* @param uniformName Name of the variable.
* @param vector3 Value to be set.
*/
setVector3(uniformName: string, vector3: IVector3Like): void;
setVector3(uniformName: string, vector3: Vector3Like): void;

/**
* Sets a float3 on a uniform variable.
Expand All @@ -265,14 +266,14 @@ export interface IPipelineContext {
* @param uniformName Name of the variable.
* @param vector4 Value to be set.
*/
setVector4(uniformName: string, vector4: IVector4Like): void;
setVector4(uniformName: string, vector4: Vector4Like): void;

/**
* Sets a Quaternion on a uniform variable.
* @param uniformName Name of the variable.
* @param quaternion Value to be set.
*/
setQuaternion(uniformName: string, quaternion: IQuaternionLike): void;
setQuaternion(uniformName: string, quaternion: QuaternionLike): void;

/**
* Sets a float4 on a uniform variable.
Expand All @@ -289,20 +290,20 @@ export interface IPipelineContext {
* @param uniformName Name of the variable.
* @param color3 Value to be set.
*/
setColor3(uniformName: string, color3: IColor3Like): void;
setColor3(uniformName: string, color3: Color3Like): void;

/**
* Sets a Color4 on a uniform variable.
* @param uniformName Name of the variable.
* @param color3 Value to be set.
* @param alpha Alpha value to be set.
*/
setColor4(uniformName: string, color3: IColor3Like, alpha: number): void;
setColor4(uniformName: string, color3: Color3Like, alpha: number): void;

/**
* Sets a Color4 on a uniform variable
* @param uniformName defines the name of the variable
* @param color4 defines the value to be set
*/
setDirectColor4(uniformName: string, color4: IColor4Like): void;
setDirectColor4(uniformName: string, color4: Color4Like): void;
}
23 changes: 12 additions & 11 deletions packages/dev/core/src/Engines/Native/nativePipelineContext.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Nullable } from "../../types";
import type { Effect } from "../../Materials/effect";
import type { IMatrixLike, IVector2Like, IVector3Like, IVector4Like, IColor3Like, IColor4Like, IQuaternionLike } from "../../Maths/math.like";
import type { MatrixLike, Vector2Like, Vector3Like, Vector4Like, QuaternionLike } from "../../Maths/math.vector";
import type { Color3Like, Color4Like } from "../../Maths/math.color";
import type { IPipelineContext } from "../IPipelineContext";
import type { NativeEngine } from "../nativeEngine";

Expand Down Expand Up @@ -95,7 +96,7 @@ export class NativePipelineContext implements IPipelineContext {
/**
* @internal
*/
public _cacheMatrix(uniformName: string, matrix: IMatrixLike): boolean {
public _cacheMatrix(uniformName: string, matrix: MatrixLike): boolean {
const cache = this._valueCache[uniformName];
const flag = matrix.updateFlag;
if (cache !== undefined && cache === flag) {
Expand Down Expand Up @@ -493,9 +494,9 @@ export class NativePipelineContext implements IPipelineContext {
* @param uniformName Name of the variable.
* @param matrix matrix to be set.
*/
public setMatrix(uniformName: string, matrix: IMatrixLike): void {
public setMatrix(uniformName: string, matrix: MatrixLike): void {
if (this._cacheMatrix(uniformName, matrix)) {
if (!this._engine.setMatrices(this._uniforms[uniformName]!, matrix.toArray() as Float32Array)) {
if (!this._engine.setMatrices(this._uniforms[uniformName]!, matrix.asArray() as Float32Array)) {
this._valueCache[uniformName] = null;
}
}
Expand Down Expand Up @@ -559,7 +560,7 @@ export class NativePipelineContext implements IPipelineContext {
* @param uniformName Name of the variable.
* @param vector2 vector2 to be set.
*/
public setVector2(uniformName: string, vector2: IVector2Like): void {
public setVector2(uniformName: string, vector2: Vector2Like): void {
if (this._cacheFloat2(uniformName, vector2.x, vector2.y)) {
if (!this._engine.setFloat2(this._uniforms[uniformName]!, vector2.x, vector2.y)) {
this._valueCache[uniformName] = null;
Expand All @@ -586,7 +587,7 @@ export class NativePipelineContext implements IPipelineContext {
* @param uniformName Name of the variable.
* @param vector3 Value to be set.
*/
public setVector3(uniformName: string, vector3: IVector3Like): void {
public setVector3(uniformName: string, vector3: Vector3Like): void {
if (this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z)) {
if (!this._engine.setFloat3(this._uniforms[uniformName]!, vector3.x, vector3.y, vector3.z)) {
this._valueCache[uniformName] = null;
Expand Down Expand Up @@ -614,7 +615,7 @@ export class NativePipelineContext implements IPipelineContext {
* @param uniformName Name of the variable.
* @param vector4 Value to be set.
*/
public setVector4(uniformName: string, vector4: IVector4Like): void {
public setVector4(uniformName: string, vector4: Vector4Like): void {
if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {
if (!this._engine.setFloat4(this._uniforms[uniformName]!, vector4.x, vector4.y, vector4.z, vector4.w)) {
this._valueCache[uniformName] = null;
Expand All @@ -627,7 +628,7 @@ export class NativePipelineContext implements IPipelineContext {
* @param uniformName Name of the variable.
* @param quaternion Value to be set.
*/
public setQuaternion(uniformName: string, quaternion: IQuaternionLike): void {
public setQuaternion(uniformName: string, quaternion: QuaternionLike): void {
if (this._cacheFloat4(uniformName, quaternion.x, quaternion.y, quaternion.z, quaternion.w)) {
if (!this._engine.setFloat4(this._uniforms[uniformName]!, quaternion.x, quaternion.y, quaternion.z, quaternion.w)) {
this._valueCache[uniformName] = null;
Expand Down Expand Up @@ -657,7 +658,7 @@ export class NativePipelineContext implements IPipelineContext {
* @param uniformName Name of the variable.
* @param color3 Value to be set.
*/
public setColor3(uniformName: string, color3: IColor3Like): void {
public setColor3(uniformName: string, color3: Color3Like): void {
if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {
if (!this._engine.setFloat3(this._uniforms[uniformName]!, color3.r, color3.g, color3.b)) {
this._valueCache[uniformName] = null;
Expand All @@ -671,7 +672,7 @@ export class NativePipelineContext implements IPipelineContext {
* @param color3 Value to be set.
* @param alpha Alpha value to be set.
*/
public setColor4(uniformName: string, color3: IColor3Like, alpha: number): void {
public setColor4(uniformName: string, color3: Color3Like, alpha: number): void {
if (this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {
if (!this._engine.setFloat4(this._uniforms[uniformName]!, color3.r, color3.g, color3.b, alpha)) {
this._valueCache[uniformName] = null;
Expand All @@ -684,7 +685,7 @@ export class NativePipelineContext implements IPipelineContext {
* @param uniformName defines the name of the variable
* @param color4 defines the value to be set
*/
public setDirectColor4(uniformName: string, color4: IColor4Like): void {
public setDirectColor4(uniformName: string, color4: Color4Like): void {
if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {
if (!this._engine.setFloat4(this._uniforms[uniformName]!, color4.r, color4.g, color4.b, color4.a)) {
this._valueCache[uniformName] = null;
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/core/src/Engines/Processors/shaderCodeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export class ShaderCodeNode {
options.isFragment && options.processor?.varyingFragmentKeywordName
? options.processor?.varyingFragmentKeywordName
: !options.isFragment && options.processor?.varyingVertexKeywordName
? options.processor?.varyingVertexKeywordName
: defaultVaryingKeywordName;
? options.processor?.varyingVertexKeywordName
: defaultVaryingKeywordName;

if (!options.isFragment && processor.attributeProcessor && this.line.startsWith(attributeKeyword)) {
value = processor.attributeProcessor(this.line, preprocessors, options.processingContext);
Expand Down
Loading
Loading