浏览代码

WebGPURenderer: Add renderer parameter in Textures

sunag 1 年之前
父节点
当前提交
24b8c20174
共有 2 个文件被更改,包括 4 次插入3 次删除
  1. 1 1
      examples/jsm/renderers/common/Renderer.js
  2. 3 2
      examples/jsm/renderers/common/Textures.js

+ 1 - 1
examples/jsm/renderers/common/Renderer.js

@@ -151,7 +151,7 @@ class Renderer {
 			this._attributes = new Attributes( backend );
 			this._attributes = new Attributes( backend );
 			this._background = new Background( this, this._nodes );
 			this._background = new Background( this, this._nodes );
 			this._geometries = new Geometries( this._attributes, this.info );
 			this._geometries = new Geometries( this._attributes, this.info );
-			this._textures = new Textures( backend, this.info );
+			this._textures = new Textures( this, backend, this.info );
 			this._pipelines = new Pipelines( backend, this._nodes );
 			this._pipelines = new Pipelines( backend, this._nodes );
 			this._bindings = new Bindings( backend, this._nodes, this._textures, this._attributes, this._pipelines, this.info );
 			this._bindings = new Bindings( backend, this._nodes, this._textures, this._attributes, this._pipelines, this.info );
 			this._objects = new RenderObjects( this, this._nodes, this._geometries, this._pipelines, this._bindings, this.info );
 			this._objects = new RenderObjects( this, this._nodes, this._geometries, this._pipelines, this._bindings, this.info );

+ 3 - 2
examples/jsm/renderers/common/Textures.js

@@ -6,10 +6,11 @@ const _size = new Vector3();
 
 
 class Textures extends DataMap {
 class Textures extends DataMap {
 
 
-	constructor( backend, info ) {
+	constructor( renderer, backend, info ) {
 
 
 		super();
 		super();
 
 
+		this.renderer = renderer;
 		this.backend = backend;
 		this.backend = backend;
 		this.info = info;
 		this.info = info;
 
 
@@ -155,7 +156,7 @@ class Textures extends DataMap {
 
 
 		if ( texture.isFramebufferTexture ) {
 		if ( texture.isFramebufferTexture ) {
 
 
-			const renderer = this.backend.renderer;
+			const renderer = this.renderer;
 			const renderTarget = renderer.getRenderTarget();
 			const renderTarget = renderer.getRenderTarget();
 
 
 			if ( renderTarget ) {
 			if ( renderTarget ) {