首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Rajawali中渲染线框对象

在Rajawali中渲染线框对象
EN

Stack Overflow用户
提问于 2013-07-21 05:58:08
回答 2查看 798关注 0票数 0
代码语言:javascript
复制
        public void initScene() {
            ALight light = new DirectionalLight(-1, 0, -1);
            light.setPower(2);
            getCurrentCamera().setPosition(0, 0, 7);
            getCurrentCamera().setLookAt(0, 0, 0);



            try {
                Cube cube = new Cube(1);
                DiffuseMaterial material = new DiffuseMaterial();
                material.addTexture(new Texture(R.drawable.rajawali_tex));
                cube.setMaterial(material);
                cube.addLight(light);
                addChild(cube);

                Vector3 axis = new Vector3(3, 1, 6);
                axis.normalize();

                RotateAnimation3D anim = new RotateAnimation3D(axis, 360);
                anim.setDuration(8000);
                anim.setRepeatMode(RepeatMode.INFINITE);
                anim.setInterpolator(new AccelerateDecelerateInterpolator());
                anim.setTransformable3D(cube);
                registerAnimation(anim);
                anim.play();    
            } 
            catch (TextureException e) {
                e.printStackTrace();
            }
        }

我看到,从立方体中移除纹理和光线实际上会导致Rajawali下降。在这种情况下,我想知道如何将立方体渲染为线框,而不是纹理对象。有人知道线框是如何渲染的吗?

先谢谢你...

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-07-22 22:54:04

cube.setDrawingMode(1);

cube.setDrawingMode(2);

这应该就行了

票数 1
EN

Stack Overflow用户

发布于 2014-01-30 22:59:30

您需要使用默认材质,并将绘制模式设置为线条,例如:

代码语言:javascript
复制
mSphere = new Sphere(1, 24, 24);

Material material = new Material();

mSphere.setMaterial(material);      
mSphere.setDrawingMode(GLES20.GL_LINES);

getCurrentScene().addChild(mSphere);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17767103

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档