Three.js立方体

Posted _Lawrence

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Three.js立方体相关的知识,希望对你有一定的参考价值。

平面和缓冲平面:

        var geometry = new Three.PlaneBufferGeometry( 10, 10, 1,1 );
        var material = new Three.MeshBasicMaterial( { color: 0xffff00 } );
        var mesh= new Three.Mesh( geometry, material );
        this.scene.add( mesh);

        var geometry = new Three.PlaneGeometry( 10, 10, 1,1 );
        var material = new Three.MeshBasicMaterial( { color: 0xffff00 } );
        var mesh= new Three.Mesh( geometry, material );
        this.scene.add( mesh);

球体和缓冲球体

        var geometry = new Three.SphereGeometry(1.6,40,40);
        var material = new Three.MeshLambertMaterial({
            color:0x0000FF,
            wireframe:false});
        this.mesh = new Three.Mesh( geometry, material );
        this.mesh.position.set(0,0,0)
        this.scene.add( this.mesh );

        var geometry = new Three.SphereBufferGeometry(1.6,40,40);
        var material = new Three.MeshLambertMaterial({
            color:0x0000FF,
            wireframe:false});
        this.mesh = new Three.Mesh( geometry, material );
        this.mesh.position.set(0,0,0)
        this.scene.add( this.mesh );

 

立方体和缓冲立方体:

        var geometry = new Three.BoxGeometry( 1, 1, 1 );
        var material = new Three.MeshBasicMaterial( {color: 0x00ff00} );
        var cube = new Three.Mesh( geometry, material );
        this.scene.add(cube)

        var geometry = new Three.BoxBufferGeometry( 1, 1, 1 );
        var material = new Three.MeshBasicMaterial( {color: 0x00ff00} );
        var cube = new Three.Mesh( geometry, material );
        this.scene.add(cube)

圆形几何体和圆形缓冲几何体:

        var geometry = new Three.CircleGeometry( 5, 32 );
        var material = new Three.MeshBasicMaterial( { color: 0xffff00 } );
        var circle = new Three.Mesh( geometry, material );
        this.scene.add( circle );

var geometry = new Three.CircleBufferGeometry( 5, 32 ); var material = new Three.MeshBasicMaterial( { color: 0xffff00 } ); var circle = new Three.Mesh( geometry, material ); this.scene.add( circle );

圆锥几何体和圆锥缓冲几何体:

        var geometry = new Three.ConeGeometry( 5, 32 );
        var material = new Three.MeshBasicMaterial( { color: 0xffff00 } );
        var cone= new Three.Mesh( geometry, material );
        this.scene.add( cone);
        var geometry = new Three.ConeBufferGeometry( 5, 32 );
        var material = new Three.MeshBasicMaterial( { color: 0xffff00 } );
        var cone= new Three.Mesh( geometry, material );
        this.scene.add( cone);

圆柱和圆柱缓冲几何体:

        var geometry = new Three.CylinderGeometry(5, 5, 20, 32);
        var material = new Three.MeshBasicMaterial( { color: 0xffff00 } );
        var cylinder= new Three.Mesh( geometry, material );
        this.scene.add( cylinder)
        var geometry = new Three.CylinderBufferGeometry(5, 5, 20, 32);
        var material = new Three.MeshBasicMaterial( { color: 0xffff00 } );
        var cylinder= new Three.Mesh( geometry, material );
        this.scene.add( cylinder)

十二面几何体和缓冲十二面几何体

        var geometry = new Three.DodecahedronBufferGeometry(5, 5, 20, 32);
var material = new Three.MeshBasicMaterial( { color: 0xffff00 } );
var mesh= new Three.Mesh( geometry, material );
this.scene.add( mesh)
        var geometry = new Three.DodecahedronBufferGeometry(5, 5, 20, 32);
var material = new Three.MeshBasicMaterial( { color: 0xffff00 } );
var mesh= new Three.Mesh( geometry, material );
this.scene.add( mesh)

以上是关于Three.js立方体的主要内容,如果未能解决你的问题,请参考以下文章

three.js - 相机变化的非常奇怪的行为

Three.js 运行时纹理/图像更新

Three.js r111 THREE.ShaderLib.cube 统一 tCube 到 envMap 问题

02 初识Three.js

three.js入门——画一个3D正方体

Three.js教程:第一个3D场景