|
@@ -62,6 +62,7 @@ class Renderer {
|
|
|
this._attributes = null;
|
|
|
this._geometries = null;
|
|
|
this._nodes = null;
|
|
|
+ this._animation = null;
|
|
|
this._bindings = null;
|
|
|
this._objects = null;
|
|
|
this._pipelines = null;
|
|
@@ -70,8 +71,6 @@ class Renderer {
|
|
|
this._textures = null;
|
|
|
this._background = null;
|
|
|
|
|
|
- this._animation = new Animation();
|
|
|
-
|
|
|
this._currentRenderContext = null;
|
|
|
this._lastRenderContext = null;
|
|
|
|
|
@@ -136,6 +135,7 @@ class Renderer {
|
|
|
}
|
|
|
|
|
|
this._nodes = new Nodes( this, backend );
|
|
|
+ this._animation = new Animation( this._nodes, this.info );
|
|
|
this._attributes = new Attributes( backend );
|
|
|
this._background = new Background( this, this._nodes );
|
|
|
this._geometries = new Geometries( this._attributes, this.info );
|
|
@@ -148,9 +148,6 @@ class Renderer {
|
|
|
|
|
|
//
|
|
|
|
|
|
- this._animation.setNodes( this._nodes );
|
|
|
- this._animation.start();
|
|
|
-
|
|
|
this._initialized = true;
|
|
|
|
|
|
resolve();
|
|
@@ -197,8 +194,13 @@ class Renderer {
|
|
|
this._currentRenderContext = renderContext;
|
|
|
this._currentRenderObjectFunction = this._renderObjectFunction || this.renderObject;
|
|
|
|
|
|
+ //
|
|
|
+
|
|
|
nodeFrame.renderId ++;
|
|
|
|
|
|
+ this.info.calls ++;
|
|
|
+ this.info.render.calls ++;
|
|
|
+
|
|
|
//
|
|
|
|
|
|
const coordinateSystem = this.coordinateSystem;
|
|
@@ -213,16 +215,12 @@ class Renderer {
|
|
|
|
|
|
//
|
|
|
|
|
|
- if ( this._animation.isAnimating === false ) nodeFrame.update();
|
|
|
-
|
|
|
if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();
|
|
|
|
|
|
if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();
|
|
|
|
|
|
if ( this.info.autoReset === true ) this.info.reset();
|
|
|
|
|
|
- this.info.render.frame ++;
|
|
|
-
|
|
|
//
|
|
|
|
|
|
let viewport = this._viewport;
|
|
@@ -361,15 +359,11 @@ class Renderer {
|
|
|
|
|
|
}
|
|
|
|
|
|
- setAnimationLoop( callback ) {
|
|
|
-
|
|
|
- if ( this._initialized === false ) this.init();
|
|
|
+ async setAnimationLoop( callback ) {
|
|
|
|
|
|
- const animation = this._animation;
|
|
|
-
|
|
|
- animation.setAnimationLoop( callback );
|
|
|
+ if ( this._initialized === false ) await this.init();
|
|
|
|
|
|
- ( callback === null ) ? animation.stop() : animation.start();
|
|
|
+ this._animation.setAnimationLoop( callback );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -621,6 +615,7 @@ class Renderer {
|
|
|
|
|
|
this.info.dispose();
|
|
|
|
|
|
+ this._animation.dispose();
|
|
|
this._objects.dispose();
|
|
|
this._properties.dispose();
|
|
|
this._pipelines.dispose();
|
|
@@ -665,12 +660,25 @@ class Renderer {
|
|
|
|
|
|
if ( this._initialized === false ) await this.init();
|
|
|
|
|
|
+ //
|
|
|
+
|
|
|
+ this.info.calls ++;
|
|
|
+ this.info.compute.calls ++;
|
|
|
+
|
|
|
+ //
|
|
|
+
|
|
|
const backend = this.backend;
|
|
|
const pipelines = this._pipelines;
|
|
|
const bindings = this._bindings;
|
|
|
const nodes = this._nodes;
|
|
|
const computeList = Array.isArray( computeNodes ) ? computeNodes : [ computeNodes ];
|
|
|
|
|
|
+ if ( computeList[ 0 ] === undefined || computeList[ 0 ].isComputeNode !== true ) {
|
|
|
+
|
|
|
+ throw new Error( 'THREE.Renderer: .compute() expects a ComputeNode.' );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
backend.beginCompute( computeNodes );
|
|
|
|
|
|
for ( const computeNode of computeList ) {
|