Three.js: ¿Cómo crear una malla personalizada?

Creado en 12 feb. 2012  ·  3Comentarios  ·  Fuente: mrdoob/three.js

Esto no funcionó:

var geom = new THREE.Geometry(); 
var v1 = new THREE.Vector3(0,0,10);
var v2 = new THREE.Vector3(0,500,10);
var v3 = new THREE.Vector3(500,500,10);

geom.vertices.push(new THREE.Vertex(v1));
geom.vertices.push(new THREE.Vertex(v2));
geom.vertices.push(new THREE.Vertex(v3));
geom.faces.push( new THREE.Face3( 0, 1, 2 ) );

var object = new THREE.Mesh( geom, new THREE.MeshNormalMaterial() );
scene.addObject(object);
Question

Comentario más útil

var geom = new THREE.Geometry(); 
var v1 = new THREE.Vector3(0,0,10);
var v2 = new THREE.Vector3(0,500,10);
var v3 = new THREE.Vector3(500,500,10);

geom.vertices.push(new THREE.Vertex(v1));
geom.vertices.push(new THREE.Vertex(v2));
geom.vertices.push(new THREE.Vertex(v3));
geom.faces.push( new THREE.Face3( 0, 1, 2 ) );
geom.computeFaceNormals(); // your geometry needs normals if you want to use MeshNormalMaterial

var object = new THREE.Mesh( geom, new THREE.MeshNormalMaterial() );
scene.add(object); // scene.addObject is supposed to be used internally only, sorry about that.

Todos 3 comentarios

var geom = new THREE.Geometry(); 
var v1 = new THREE.Vector3(0,0,10);
var v2 = new THREE.Vector3(0,500,10);
var v3 = new THREE.Vector3(500,500,10);

geom.vertices.push(new THREE.Vertex(v1));
geom.vertices.push(new THREE.Vertex(v2));
geom.vertices.push(new THREE.Vertex(v3));
geom.faces.push( new THREE.Face3( 0, 1, 2 ) );
geom.computeFaceNormals(); // your geometry needs normals if you want to use MeshNormalMaterial

var object = new THREE.Mesh( geom, new THREE.MeshNormalMaterial() );
scene.add(object); // scene.addObject is supposed to be used internally only, sorry about that.

Qué respuesta más rápida. ¡Muchas gracias! ¿Sigues trabajando en el proyecto? ¿Necesitas algo?

¡Sí!

https://github.com/mrdoob/three.js/commits/dev

No estoy seguro de lo que se necesita para ser honesto ... Creo que solo necesitamos tiempo: D

¿Fue útil esta página
0 / 5 - 0 calificaciones