Three.js立方体

2021/5/17 18:25:28

本文主要是介绍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立方体的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程