Browse Source

add GPUComputationRenderer to modularize and update corresponding jsm

Guillaume Fradin 5 years ago
parent
commit
bd71e8c0d5
2 changed files with 5 additions and 8 deletions
  1. 4 8
      examples/jsm/misc/GPUComputationRenderer.js
  2. 1 0
      utils/modularize.js

+ 4 - 8
examples/jsm/misc/GPUComputationRenderer.js

@@ -163,8 +163,8 @@ var GPUComputationRenderer = function ( sizeX, sizeY, renderer ) {
 
 
 	this.init = function () {
 	this.init = function () {
 
 
-		if ( ! renderer.extensions.get( "OES_texture_float" ) &&
-			 ! renderer.capabilities.isWebGL2 ) {
+		if ( ! renderer.capabilities.isWebGL2 &&
+			 ! renderer.extensions.get( "OES_texture_float" ) ) {
 
 
 			return "No OES_texture_float support for float textures.";
 			return "No OES_texture_float support for float textures.";
 
 
@@ -209,7 +209,6 @@ var GPUComputationRenderer = function ( sizeX, sizeY, renderer ) {
 							}
 							}
 
 
 						}
 						}
-
 						if ( ! found ) {
 						if ( ! found ) {
 
 
 							return "Variable dependency not found. Variable=" + variable.name + ", dependency=" + depVar.name;
 							return "Variable dependency not found. Variable=" + variable.name + ", dependency=" + depVar.name;
@@ -334,11 +333,8 @@ var GPUComputationRenderer = function ( sizeX, sizeY, renderer ) {
 
 
 	this.createTexture = function () {
 	this.createTexture = function () {
 
 
-		var a = new Float32Array( sizeX * sizeY * 4 );
-		var texture = new DataTexture( a, sizeX, sizeY, RGBAFormat, FloatType );
-		texture.needsUpdate = true;
-
-		return texture;
+		var data = new Float32Array( sizeX * sizeY * 4 );
+		return new DataTexture( data, sizeX, sizeY, RGBAFormat, FloatType );
 
 
 	};
 	};
 
 

+ 1 - 0
utils/modularize.js

@@ -114,6 +114,7 @@ var files = [
 	{ path: 'math/SimplexNoise.js', dependencies: [], ignoreList: [] },
 	{ path: 'math/SimplexNoise.js', dependencies: [], ignoreList: [] },
 
 
 	{ path: 'misc/ConvexObjectBreaker.js', dependencies: [ { name: 'ConvexBufferGeometry', path: 'geometries/ConvexGeometry.js' } ], ignoreList: [ 'Matrix4' ] },
 	{ path: 'misc/ConvexObjectBreaker.js', dependencies: [ { name: 'ConvexBufferGeometry', path: 'geometries/ConvexGeometry.js' } ], ignoreList: [ 'Matrix4' ] },
+	{ path: 'misc/GPUComputationRenderer.js', dependencies: [], ignoreList: [] },
 	{ path: 'misc/Gyroscope.js', dependencies: [], ignoreList: [] },
 	{ path: 'misc/Gyroscope.js', dependencies: [], ignoreList: [] },
 	{ path: 'misc/MD2Character.js', dependencies: [ { name: 'MD2Loader', path: 'loaders/MD2Loader.js' } ], ignoreList: [] },
 	{ path: 'misc/MD2Character.js', dependencies: [ { name: 'MD2Loader', path: 'loaders/MD2Loader.js' } ], ignoreList: [] },
 	{ path: 'misc/MD2CharacterComplex.js', dependencies: [ { name: 'MD2Loader', path: 'loaders/MD2Loader.js' }, { name: 'MorphBlendMesh', path: 'misc/MorphBlendMesh.js' } ], ignoreList: [] },
 	{ path: 'misc/MD2CharacterComplex.js', dependencies: [ { name: 'MD2Loader', path: 'loaders/MD2Loader.js' }, { name: 'MorphBlendMesh', path: 'misc/MorphBlendMesh.js' } ], ignoreList: [] },