6

Is it any way possible to show vertices of a mesh as ie. colored dots?

Thanks.

Ejnaren
  • 63
  • 1
  • 5

1 Answers1

5

I'm going to answer part A here, I recommend splitting your question up into two questions makes the site more useful for when other people are searching for the same solutions.

A Mesh has a Geometry and a Geometry has an array of Vertices.

From Mesh documentation.

Properties

.geometry

An instance of Geometry, defining the object's structure.

From Geometry documentation.

Properties

.vertices

Array of vertices. The array of vertices holds every position of points in the model. To signal an update in this array, Geometry.verticesNeedUpdate needs to be set to true.

To draw the vertices you can create a billboard particle at each one. Below is a slight altered version of the billboard particle example.

//editGeometry = the geometry who's vertices we want to show

geometry = new THREE.Geometry();

sprite = THREE.ImageUtils.loadTexture( "textures/sprites/disc.png" );

for ( i = 0; i < editGeometry.vertices.length; i ++ ) {

    geometry.vertices.push(editGeometry.vertices[i]);

}

material = new THREE.PointCloudMaterial( { size: 35, sizeAttenuation: false, map: sprite, transparent: true } );
material.color.setHSL( 1.0, 0.3, 0.7 );

particles = new THREE.PointCloud( geometry, material );
particles.sortParticles = true;
scene.add( particles );
Maciej Ciemięga
  • 10,125
  • 1
  • 41
  • 48
ClassicThunder
  • 1,896
  • 16
  • 25
  • I see. It makes sense. Maybe this would also solve the second problem (I will post about this in a seperate question then). Three.js would be able to register i I clicked on this billboard and "dragged" it somewhere on the screen. – Ejnaren Sep 23 '14 at 12:41