提交 85383d42 编写于 作者: L looeee

Updated ShaderMaterial, PointsMaterial, MultiMaterial

上级 d97b0033
......@@ -39,25 +39,25 @@
</div>
<code>
//The following will create a cube with a different material applied to each side
var materials = [
//The following will create a cube with a different material applied to each side
var materials = [
new THREE.MeshBasicMaterial( { color: 0xff0000 ) } ), // right
new THREE.MeshBasicMaterial( { color: 0x0000ff ) } ), // left
new THREE.MeshBasicMaterial( { color: 0x00ff00 ) } ), // top
new THREE.MeshBasicMaterial( { color: 0xffff00 ) } ), // bottom
new THREE.MeshBasicMaterial( { color: 0x00ffff ) } ), // back
new THREE.MeshBasicMaterial( { color: 0xff00ff ) } ) // front
new THREE.MeshBasicMaterial( { color: 0xff0000 ) } ), // right
new THREE.MeshBasicMaterial( { color: 0x0000ff ) } ), // left
new THREE.MeshBasicMaterial( { color: 0x00ff00 ) } ), // top
new THREE.MeshBasicMaterial( { color: 0xffff00 ) } ), // bottom
new THREE.MeshBasicMaterial( { color: 0x00ffff ) } ), // back
new THREE.MeshBasicMaterial( { color: 0xff00ff ) } ) // front
];
];
var cubeSidesMaterial = new THREE.MultiMaterial( materials );
var cubeSidesMaterial = new THREE.MultiMaterial( materials );
var cubeGeometry = new THREE.BoxBufferGeometry( 100, 100, 100, 1, 1, 1 );
var cubeGeometry = new THREE.BoxBufferGeometry( 100, 100, 100, 1, 1, 1 );
var cubeMesh = new THREE.Mesh( cubeGeometry, cubeSidesMaterial );
var cubeMesh = new THREE.Mesh( cubeGeometry, cubeSidesMaterial );
scene.add( cubeMesh );
scene.add( cubeMesh );
</code>
<h2>Constructor</h2>
......
......@@ -33,6 +33,28 @@
[example:webgl_trails WebGL / trails]
</div>
<code>
//This will add a starfield to the background of a scene
var starsGeometry = new THREE.Geometry();
for ( var i = 0; i < 10000; i ++ ) {
var star = new THREE.Vector3();
star.x = THREE.Math.randFloatSpread( 2000 );
star.y = THREE.Math.randFloatSpread( 2000 );
star.z = THREE.Math.randFloatSpread( 2000 );
geometry.vertices.push( star );
}
var starsMaterial = new THREE.PointsMaterial( { color: 0x888888 } )
var starField = new THREE.Points( geometry, starsMaterial );
scene.add( starField );
</code>
<h3>[name]( [page:Object parameters] )</h3>
<div>
[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册