ThreeJS Example webgl_geometry_convex 顶点展示

218 阅读1分钟

threejs.org/examples/#w…

image.png

const loader = new THREE.TextureLoader();
const texture = loader.load( 'textures/sprites/disc.png' );
const vertices = [];
const positionAttribute = dodecahedronGeometry.getAttribute( 'position' );
const vertices = [];
const positionAttribute = dodecahedronGeometry.getAttribute( 'position' );
for ( let i = 0; i < positionAttribute.count; i ++ ) {
        const vertex = new THREE.Vector3();
        vertex.fromBufferAttribute( positionAttribute, i );
        vertices.push( vertex );
}
const pointsMaterial = new THREE.PointsMaterial( {
        color: 0x0080ff,
        map: texture,
        size: 1,
        alphaTest: 0.5
} );
const pointsGeometry = new THREE.BufferGeometry().setFromPoints( vertices );
const points = new THREE.Points( pointsGeometry, pointsMaterial );
group.add( points );