外观 立方体 沙质

发布于 2024-08-05 16:07:09 字数 154 浏览 9 评论 0原文

我是 sandy 和动作脚本 3 的新手。我按照 sandy 网站上的教程创建了一个立方体。

但我没有成功创建每个立方体面上具有不同纹理的立方体。我的第一个纹理在每个面上都重复。

那么,如何才能在每张脸上拥有不同的纹理呢?我还没有在桑迪网站上找到如何做到这一点。

I'm a newbie with sandy and action script 3. I have followed a tutorial on the sandy web site and I created a cube.

But I wasn't successful in creating a cube with a different textures on each cube face. My first texture is duplicated on each face.

So, how can I have a different texture on each face? I haven't found how to do that on the sandy web site.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

面犯桃花 2024-08-12 16:07:09

好的,伙计们,这是代码:

var materialFace1:BitmapMaterial = new BitmapMaterial( bitmap1.bitmapData );
materialFace1.lightingEnable = true;
var appFace1:Appearance = new Appearance( materialFace1 );

var materialFace2:BitmapMaterial = new BitmapMaterial( bitmap2.bitmapData );
materialFace2.lightingEnable = true;
var appFace2:Appearance = new Appearance( materialFace2 );

var materialFace3:BitmapMaterial = new BitmapMaterial( bitmap3.bitmapData );
materialFace3.lightingEnable = true;
var appFace3:Appearance = new Appearance( materialFace3 );

var materialFace4:BitmapMaterial = new BitmapMaterial( bitmap4.bitmapData );
materialFace4.lightingEnable = true;
var appFace4:Appearance = new Appearance( materialFace4 );

var materialFace5:BitmapMaterial = new BitmapMaterial( bitmap5.bitmapData );
materialFace5.lightingEnable = true;
var appFace5:Appearance = new Appearance( materialFace5 );

var materialFace6:BitmapMaterial = new BitmapMaterial( bitmap6.bitmapData );
materialFace6.lightingEnable = true;
var appFace6:Appearance = new Appearance( materialFace6 );



var box:Box = new Box( "box",100,100,100);


    var face:PrimitiveFace = box.getFace(Box.FACE_LEFT);
    face.appearance = appFace1;

    face = box.getFace(Box.FACE_BOTTOM);
    face.appearance = appFace2;

    face = box.getFace(Box.FACE_FRONT);
    face.appearance = appFace3;

    face = box.getFace(Box.FACE_BACK);
    face.appearance = appFace4;

    face = box.getFace(Box.FACE_RIGHT);
    face.appearance = appFace5;

    face = box.getFace(Box.FACE_TOP);
    face.appearance = appFace6;

该代码允许立方体的面具有不同的纹理。

Ok guys, here is the code:

var materialFace1:BitmapMaterial = new BitmapMaterial( bitmap1.bitmapData );
materialFace1.lightingEnable = true;
var appFace1:Appearance = new Appearance( materialFace1 );

var materialFace2:BitmapMaterial = new BitmapMaterial( bitmap2.bitmapData );
materialFace2.lightingEnable = true;
var appFace2:Appearance = new Appearance( materialFace2 );

var materialFace3:BitmapMaterial = new BitmapMaterial( bitmap3.bitmapData );
materialFace3.lightingEnable = true;
var appFace3:Appearance = new Appearance( materialFace3 );

var materialFace4:BitmapMaterial = new BitmapMaterial( bitmap4.bitmapData );
materialFace4.lightingEnable = true;
var appFace4:Appearance = new Appearance( materialFace4 );

var materialFace5:BitmapMaterial = new BitmapMaterial( bitmap5.bitmapData );
materialFace5.lightingEnable = true;
var appFace5:Appearance = new Appearance( materialFace5 );

var materialFace6:BitmapMaterial = new BitmapMaterial( bitmap6.bitmapData );
materialFace6.lightingEnable = true;
var appFace6:Appearance = new Appearance( materialFace6 );



var box:Box = new Box( "box",100,100,100);


    var face:PrimitiveFace = box.getFace(Box.FACE_LEFT);
    face.appearance = appFace1;

    face = box.getFace(Box.FACE_BOTTOM);
    face.appearance = appFace2;

    face = box.getFace(Box.FACE_FRONT);
    face.appearance = appFace3;

    face = box.getFace(Box.FACE_BACK);
    face.appearance = appFace4;

    face = box.getFace(Box.FACE_RIGHT);
    face.appearance = appFace5;

    face = box.getFace(Box.FACE_TOP);
    face.appearance = appFace6;

This code allows to have a cube with a different texture by face.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文