我正在学习webGL和three.js.因此,出于测试原因,我尝试创建平面几何体和两个立方体几何体以及一个点光源:
function initLights () {
var c = context;
var pointLight = new THREE.PointLight( 0xffffff, 1, 100 );
pointLight.position.set( 10, 10, 10 );
c.scene.add(pointLight);
}
function initObjects () {
var c = context;
/**
* Defining the materials
*/
var lambertRedMaterial = new THREE.MeshLambertMaterial({
color : 0xff0000
, side : THREE.DoubleSide
});
var lambertWhiteMaterial = new THREE.MeshLambertMaterial({
color : 0xffffff
, side : THREE.DoubleSide
});
/**
* Defining the floor
*/
var floorGeometry = new THREE.Geometry();
floorGeometry.vertices.push(new THREE.Vector3(-5.0, 0.0, -5.0)); …
Run Code Online (Sandbox Code Playgroud)