Flex Away3d Set Cube cubegeometry skin (solid color, texturing)

Source: Internet
Author: User
Tags addchild

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);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.