Capítulo 754 de 859

Chapter 754: NodeMaterialObserver

Core Idea

This class is used by WebGPURenderer as management component. It's primary purpose is to determine whether render objects require a refresh right before they are going to be rendered or not.

Key Concepts

  • hasAnimation : boolean: Whether the node builder's 3D object is animated or not.
  • hasNode : boolean: Whether the material uses node objects or not.
  • refreshUniforms : Array.<string>: A list of all possible material uniforms
  • renderId : number: Holds the current render ID from the node frame.
  • renderObjects : WeakMap.<RenderObject, Object>: A node material can be used by more than one render object so the monitor must maintain a list of render objects.

Reference Tables

Constructor

Signature
new NodeMaterialObserver( builder : NodeBuilder )

Properties

PropertyDescription
.hasAnimation : booleanWhether the node builder's 3D object is animated or not.
.hasNode : booleanWhether the material uses node objects or not.
.refreshUniforms : Array.<string>A list of all possible material uniforms
.renderId : numberHolds the current render ID from the node frame.
.renderObjects : WeakMap.<RenderObject, Object>A node material can be used by more than one render object so the monitor must maintain a list of render objects.

Methods

MethodDescription
.containsNode( builder : NodeBuilder ) : booleanReturns true if the node builder's material uses node properties.
.equals( renderObject : RenderObject, lightsData : Array.<Light>, renderId : number ) : booleanReturns true if the given render object has not changed its state.
.firstInitialization( renderObject : RenderObject ) : booleanReturns true if the given render object is verified for the first time of this observer.
.getAttributesData( attributes : Object ) : ObjectReturns an attribute data structure holding the attributes versions for monitoring.
.getGeometryData( geometry : BufferGeometry ) : ObjectReturns a geometry data structure holding the geometry property values for monitoring.
.getLights( lightsNode : LightsNode, renderId : number ) : Array.<Object>Returns the lights for the given lights node and render ID.
.getLightsData( materialLights : Array.<Light> ) : Array.<Object>Returns the lights data for the given material lights.
.getMaterialData( material : Material ) : ObjectReturns a material data structure holding the material property values for monitoring.
.getRenderObjectData( renderObject : RenderObject ) : ObjectReturns monitoring data for the given render object.
.needsRefresh( renderObject : RenderObject, nodeFrame : NodeFrame ) : booleanChecks if the given render object requires a refresh.
.needsVelocity( renderer : Renderer ) : booleanReturns true if the current rendering produces motion vectors.

Key Takeaways

  1. Most relevant properties: hasAnimation, hasNode, refreshUniforms, renderId.
  2. Key methods: containsNode, equals, firstInitialization, getAttributesData.

Connects To