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)
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
/**
@ -13730,25 +13730,21 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
* Setup mesh vertices positions
* @type {Float32Array}
*/
var vertices = new Float32Array(
this.faces.reduce(
function(result, face){
result.push(this.vertices[face.v0index].position.x);
result.push(this.vertices[face.v0index].position.y);
result.push(this.vertices[face.v0index].position.z);
result.push(this.vertices[face.v1index].position.x);
result.push(this.vertices[face.v1index].position.y);
result.push(this.vertices[face.v1index].position.z);
result.push(this.vertices[face.v2index].position.x);
result.push(this.vertices[face.v2index].position.y);
result.push(this.vertices[face.v2index].position.z);
return result;
}.bind(this),
[]
)
);
var vertices = this.faces.reduce(
function(result, face){
result.push(this.vertices[face.v0index].position.x);
result.push(this.vertices[face.v0index].position.y);
result.push(this.vertices[face.v0index].position.z);
result.push(this.vertices[face.v1index].position.x);
result.push(this.vertices[face.v1index].position.y);
result.push(this.vertices[face.v1index].position.z);
result.push(this.vertices[face.v2index].position.x);
result.push(this.vertices[face.v2index].position.y);
result.push(this.vertices[face.v2index].position.z);
return result;
}.bind(this),
[]
);
var geometry = null;
@ -13762,71 +13758,66 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
/**
* Setyp mesh vertices colors
*/
var colors = Float32Array.from(
this.faces.reduce(
function(result, face){
result.push(1,1,1,1,1,1,1,1,1);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
return result;
}.bind(this),
[]
)
);
var colors = this.faces.reduce(
function(result, face){
result.push(1,1,1,1,1,1,1,1,1);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
return result;
}.bind(this),
[]
);
geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3, true));
/**
* Setup face UVs
*/
var uvs = Float32Array.from(
this.faces.reduce(
function(result, face) {
var uvs = this.faces.reduce(
function(result, face) {
face.uvs[0].map(
function(uv) {
result.push(uv.x);
result.push(uv.y);
}
);
face.uvs[0].map(
function(uv) {
result.push(uv.x);
result.push(uv.y);
}
);
return result;
},
[]
)
);
return result;
},
[]
);
geometry.addAttribute('uv', new THREE.BufferAttribute(uvs, 2));
var normals = Float32Array.from(
this.faces.reduce(
function(result, face) {
var normals = this.faces.reduce(
function(result, face) {
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
return result;
},
[]
)
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
return result;
},
[]
);
geometry.addAttribute('normal', new THREE.BufferAttribute( normals, 3 ));
geometry.computeVertexNormals();

View File

@ -249,25 +249,21 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
* Setup mesh vertices positions
* @type {Float32Array}
*/
var vertices = new Float32Array(
this.faces.reduce(
function(result, face){
result.push(this.vertices[face.v0index].position.x);
result.push(this.vertices[face.v0index].position.y);
result.push(this.vertices[face.v0index].position.z);
result.push(this.vertices[face.v1index].position.x);
result.push(this.vertices[face.v1index].position.y);
result.push(this.vertices[face.v1index].position.z);
result.push(this.vertices[face.v2index].position.x);
result.push(this.vertices[face.v2index].position.y);
result.push(this.vertices[face.v2index].position.z);
return result;
}.bind(this),
[]
)
);
var vertices = this.faces.reduce(
function(result, face){
result.push(this.vertices[face.v0index].position.x);
result.push(this.vertices[face.v0index].position.y);
result.push(this.vertices[face.v0index].position.z);
result.push(this.vertices[face.v1index].position.x);
result.push(this.vertices[face.v1index].position.y);
result.push(this.vertices[face.v1index].position.z);
result.push(this.vertices[face.v2index].position.x);
result.push(this.vertices[face.v2index].position.y);
result.push(this.vertices[face.v2index].position.z);
return result;
}.bind(this),
[]
);
var geometry = null;
@ -281,71 +277,66 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
/**
* Setyp mesh vertices colors
*/
var colors = Float32Array.from(
this.faces.reduce(
function(result, face){
result.push(1,1,1,1,1,1,1,1,1);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
return result;
}.bind(this),
[]
)
);
var colors = this.faces.reduce(
function(result, face){
result.push(1,1,1,1,1,1,1,1,1);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
// result.push(face.color.r);
// result.push(face.color.g);
// result.push(face.color.b);
return result;
}.bind(this),
[]
);
geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3, true));
/**
* Setup face UVs
*/
var uvs = Float32Array.from(
this.faces.reduce(
function(result, face) {
var uvs = this.faces.reduce(
function(result, face) {
face.uvs[0].map(
function(uv) {
result.push(uv.x);
result.push(uv.y);
}
);
face.uvs[0].map(
function(uv) {
result.push(uv.x);
result.push(uv.y);
}
);
return result;
},
[]
)
);
return result;
},
[]
);
geometry.addAttribute('uv', new THREE.BufferAttribute(uvs, 2));
var normals = Float32Array.from(
this.faces.reduce(
function(result, face) {
var normals = this.faces.reduce(
function(result, face) {
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
return result;
},
[]
)
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
result.push(
face.normal.x,
face.normal.y,
face.normal.z
);
return result;
},
[]
);
geometry.addAttribute('normal', new THREE.BufferAttribute( normals, 3 ));
geometry.computeVertexNormals();