1, set the cubegeometry to the skin of the pure color
Because only set the color, so if the stage does not add lights can not see the corner of the stereo effect.
The code is as follows |
Copy Code |
var material:colormaterial = new Colormaterial (0XFFFFFF);
Create a square in a three-dimensional stage var Cube1:mesh = new Mesh (new cubegeometry, material); _view3d.scene.addchild (CUBE1); |
2, set the Cubegeometry to the six side of the map.
By default, if you set a texture to a cube, the picture is wrapped around the box. So if we want to set different pictures of the cubes, we can put them together in a larger picture.
(Note: This picture must be 2 of the second side, the maximum can not exceed 2048.) Long width can be different, the program will automatically split. )
The code is as follows |
Copy Code |
[Embed (source= "Assets/cubetexture2.png")] private Var Cubetextureclass:class;
var material:texturematerial = new Texturematerial (Cast.bitmaptexture (Cubetextureclass));
Create a square in a three-dimensional stage var Cube1:mesh = new Mesh (new cubegeometry, material); _view3d.scene.addchild (CUBE1); |
3, set the same texture to the cubegeometry six side.
You only need to set the last initialization parameter Tile6 to False.
code is as follows |
copy code |
[Embed (source= "assets/cubetexture3.jpg")] private Var Cubetextureclass:class; var material:texturematerial = new Texturematerial (Cast.bitmaptexture (Cubetextureclass)); //Create a square on a three-dimensional stage; var cube1:mesh = new Mesh (new Cubegeometry (1, 1, 1, false) , material); _view3d.scene.addchild (CUBE1); |