Skip to content

Commit

Permalink
TSL: Introduce modelWorldMatrixInverse (#28433)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunag committed May 20, 2024
1 parent 6ac1398 commit 79e7f87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/jsm/nodes/Nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export { default as MaterialReferenceNode, materialReference } from './accessors
export { default as RendererReferenceNode, rendererReference } from './accessors/RendererReferenceNode.js';
export { default as MorphNode, morphReference } from './accessors/MorphNode.js';
export { default as TextureBicubicNode, textureBicubic } from './accessors/TextureBicubicNode.js';
export { default as ModelNode, modelDirection, modelViewMatrix, modelNormalMatrix, modelWorldMatrix, modelPosition, modelViewPosition, modelScale } from './accessors/ModelNode.js';
export { default as ModelNode, modelDirection, modelViewMatrix, modelNormalMatrix, modelWorldMatrix, modelPosition, modelViewPosition, modelScale, modelWorldMatrixInverse } from './accessors/ModelNode.js';
export { default as ModelViewProjectionNode, modelViewProjection } from './accessors/ModelViewProjectionNode.js';
export * from './accessors/NormalNode.js';
export { default as Object3DNode, objectDirection, objectViewMatrix, objectNormalMatrix, objectWorldMatrix, objectPosition, objectScale, objectViewPosition } from './accessors/Object3DNode.js';
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/nodes/accessors/ModelNode.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Object3DNode from './Object3DNode.js';
import { addNodeClass } from '../core/Node.js';
import { nodeImmutable } from '../shadernode/ShaderNode.js';
import { uniform } from '../core/UniformNode.js';
import { Matrix4 } from 'three';

class ModelNode extends Object3DNode {

Expand Down Expand Up @@ -29,5 +31,6 @@ export const modelWorldMatrix = nodeImmutable( ModelNode, ModelNode.WORLD_MATRIX
export const modelPosition = nodeImmutable( ModelNode, ModelNode.POSITION );
export const modelScale = nodeImmutable( ModelNode, ModelNode.SCALE );
export const modelViewPosition = nodeImmutable( ModelNode, ModelNode.VIEW_POSITION );
export const modelWorldMatrixInverse = uniform( new Matrix4() ).onObjectUpdate( ( { object }, self ) => self.value.copy( object.matrixWorld ).invert() );

addNodeClass( 'ModelNode', ModelNode );

0 comments on commit 79e7f87

Please sign in to comment.