no float32 array

beta.r3js.org
-=yb4f310 2017-11-29 22:13:27 +01:00
parent 1cdc2dd76c
commit 742614777e
3 changed files with 139 additions and 157 deletions

20
build/game-lib-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
// COMPILE TIME DEFINITIONS (Generated via gulp) // COMPILE TIME DEFINITIONS (Generated via gulp)
var __DATE__ = "Wed Nov 29 2017 22:00:45 GMT+0100 (CET)"; var __DATE__ = "Wed Nov 29 2017 22:13:03 GMT+0100 (CET)";
// END COMPILE TIME DEFINITIONS // END COMPILE TIME DEFINITIONS
/** /**
@ -13730,9 +13730,7 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
* Setup mesh vertices positions * Setup mesh vertices positions
* @type {Float32Array} * @type {Float32Array}
*/ */
var vertices = new Float32Array( var vertices = this.faces.reduce(
this.faces.reduce(
function(result, face){ function(result, face){
result.push(this.vertices[face.v0index].position.x); result.push(this.vertices[face.v0index].position.x);
result.push(this.vertices[face.v0index].position.y); result.push(this.vertices[face.v0index].position.y);
@ -13746,8 +13744,6 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
return result; return result;
}.bind(this), }.bind(this),
[] []
)
); );
var geometry = null; var geometry = null;
@ -13762,8 +13758,7 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
/** /**
* Setyp mesh vertices colors * Setyp mesh vertices colors
*/ */
var colors = Float32Array.from( var colors = this.faces.reduce(
this.faces.reduce(
function(result, face){ function(result, face){
result.push(1,1,1,1,1,1,1,1,1); result.push(1,1,1,1,1,1,1,1,1);
// result.push(face.color.r); // result.push(face.color.r);
@ -13778,15 +13773,13 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
return result; return result;
}.bind(this), }.bind(this),
[] []
)
); );
geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3, true)); geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3, true));
/** /**
* Setup face UVs * Setup face UVs
*/ */
var uvs = Float32Array.from( var uvs = this.faces.reduce(
this.faces.reduce(
function(result, face) { function(result, face) {
face.uvs[0].map( face.uvs[0].map(
@ -13799,12 +13792,10 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
return result; return result;
}, },
[] []
)
); );
geometry.addAttribute('uv', new THREE.BufferAttribute(uvs, 2)); geometry.addAttribute('uv', new THREE.BufferAttribute(uvs, 2));
var normals = Float32Array.from( var normals = this.faces.reduce(
this.faces.reduce(
function(result, face) { function(result, face) {
result.push( result.push(
@ -13825,8 +13816,8 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
return result; return result;
}, },
[] []
)
); );
geometry.addAttribute('normal', new THREE.BufferAttribute( normals, 3 )); geometry.addAttribute('normal', new THREE.BufferAttribute( normals, 3 ));
geometry.computeVertexNormals(); geometry.computeVertexNormals();

View File

@ -249,9 +249,7 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
* Setup mesh vertices positions * Setup mesh vertices positions
* @type {Float32Array} * @type {Float32Array}
*/ */
var vertices = new Float32Array( var vertices = this.faces.reduce(
this.faces.reduce(
function(result, face){ function(result, face){
result.push(this.vertices[face.v0index].position.x); result.push(this.vertices[face.v0index].position.x);
result.push(this.vertices[face.v0index].position.y); result.push(this.vertices[face.v0index].position.y);
@ -265,8 +263,6 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
return result; return result;
}.bind(this), }.bind(this),
[] []
)
); );
var geometry = null; var geometry = null;
@ -281,8 +277,7 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
/** /**
* Setyp mesh vertices colors * Setyp mesh vertices colors
*/ */
var colors = Float32Array.from( var colors = this.faces.reduce(
this.faces.reduce(
function(result, face){ function(result, face){
result.push(1,1,1,1,1,1,1,1,1); result.push(1,1,1,1,1,1,1,1,1);
// result.push(face.color.r); // result.push(face.color.r);
@ -297,15 +292,13 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
return result; return result;
}.bind(this), }.bind(this),
[] []
)
); );
geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3, true)); geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3, true));
/** /**
* Setup face UVs * Setup face UVs
*/ */
var uvs = Float32Array.from( var uvs = this.faces.reduce(
this.faces.reduce(
function(result, face) { function(result, face) {
face.uvs[0].map( face.uvs[0].map(
@ -318,12 +311,10 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
return result; return result;
}, },
[] []
)
); );
geometry.addAttribute('uv', new THREE.BufferAttribute(uvs, 2)); geometry.addAttribute('uv', new THREE.BufferAttribute(uvs, 2));
var normals = Float32Array.from( var normals = this.faces.reduce(
this.faces.reduce(
function(result, face) { function(result, face) {
result.push( result.push(
@ -344,8 +335,8 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
return result; return result;
}, },
[] []
)
); );
geometry.addAttribute('normal', new THREE.BufferAttribute( normals, 3 )); geometry.addAttribute('normal', new THREE.BufferAttribute( normals, 3 ));
geometry.computeVertexNormals(); geometry.computeVertexNormals();