WebGPURenderObject.js 849 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. export default class WebGPURenderObject {
  2. constructor( renderer, nodes, object, material, scene, camera, lightsNode ) {
  3. this.renderer = renderer;
  4. this.nodes = nodes;
  5. this.object = object;
  6. this.material = material;
  7. this.scene = scene;
  8. this.camera = camera;
  9. this.lightsNode = lightsNode;
  10. this.geometry = object.geometry;
  11. this._materialVersion = - 1;
  12. this._materialCacheKey = '';
  13. }
  14. getCacheKey() {
  15. const { material, scene, lightsNode } = this;
  16. if ( material.version !== this._materialVersion ) {
  17. this._materialVersion = material.version;
  18. this._materialCacheKey = material.customProgramCacheKey();
  19. }
  20. const cacheKey = [];
  21. cacheKey.push( 'material:' + this._materialCacheKey );
  22. cacheKey.push( 'nodes:' + this.nodes.getCacheKey( scene, lightsNode ) );
  23. return '{' + cacheKey.join( ',' ) + '}';
  24. }
  25. }