keep float arrays - have to find another solution
parent
f185e8b1ef
commit
1b2af2fba8
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
||||
var __DATE__ = "Wed Nov 29 2017 22:17:53 GMT+0100 (CET)";
|
||||
var __DATE__ = "Wed Nov 29 2017 22:24:30 GMT+0100 (CET)";
|
||||
// END COMPILE TIME DEFINITIONS
|
||||
|
||||
/**
|
||||
|
@ -13730,21 +13730,25 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
|
|||
* Setup mesh vertices positions
|
||||
* @type {Float32Array}
|
||||
*/
|
||||
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 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 geometry = null;
|
||||
|
||||
|
@ -13753,74 +13757,79 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
|
|||
|
||||
geometry = new THREE.BufferGeometry();
|
||||
|
||||
geometry.addAttribute('position', new THREE.Float32BufferAttribute(vertices, 3));
|
||||
geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
||||
|
||||
/**
|
||||
* Setyp mesh vertices colors
|
||||
*/
|
||||
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.Float32BufferAttribute(colors, 3, true));
|
||||
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),
|
||||
[]
|
||||
)
|
||||
);
|
||||
geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3, true));
|
||||
|
||||
/**
|
||||
* Setup face UVs
|
||||
*/
|
||||
var uvs = this.faces.reduce(
|
||||
function(result, face) {
|
||||
var uvs = Float32Array.from(
|
||||
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) {
|
||||
|
||||
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('uv', new THREE.Float32BufferAttribute(uvs, 2));
|
||||
geometry.addAttribute('normal', new THREE.BufferAttribute( normals, 3 ));
|
||||
|
||||
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;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
geometry.addAttribute('normal', new THREE.Float32BufferAttribute( normals, 3 ));
|
||||
|
||||
geometry.computeVertexNormals();
|
||||
geometry.computeFaceNormals();
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -249,21 +249,25 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
|
|||
* Setup mesh vertices positions
|
||||
* @type {Float32Array}
|
||||
*/
|
||||
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 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 geometry = null;
|
||||
|
||||
|
@ -272,74 +276,79 @@ GameLib.D3.Mesh.prototype.createInstanceGeometry = function(instanceGeometry) {
|
|||
|
||||
geometry = new THREE.BufferGeometry();
|
||||
|
||||
geometry.addAttribute('position', new THREE.Float32BufferAttribute(vertices, 3));
|
||||
geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
||||
|
||||
/**
|
||||
* Setyp mesh vertices colors
|
||||
*/
|
||||
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.Float32BufferAttribute(colors, 3, true));
|
||||
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),
|
||||
[]
|
||||
)
|
||||
);
|
||||
geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3, true));
|
||||
|
||||
/**
|
||||
* Setup face UVs
|
||||
*/
|
||||
var uvs = this.faces.reduce(
|
||||
function(result, face) {
|
||||
var uvs = Float32Array.from(
|
||||
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) {
|
||||
|
||||
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('uv', new THREE.Float32BufferAttribute(uvs, 2));
|
||||
geometry.addAttribute('normal', new THREE.BufferAttribute( normals, 3 ));
|
||||
|
||||
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;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
geometry.addAttribute('normal', new THREE.Float32BufferAttribute( normals, 3 ));
|
||||
|
||||
geometry.computeVertexNormals();
|
||||
geometry.computeFaceNormals();
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue