【发布时间】:2014-02-10 06:51:20
【问题描述】:
我是 LibGDX 3D 工具的新手,我想知道如何合并使用 ModelBuilder#createCylinder 类创建的两个圆柱体。我有两个 ModelInstance:
- 第一个是白色圆柱体,
- 第二个具有相同属性的红色圆柱体
如何才能只渲染一个圆柱体(实例/模型/对象/可以渲染的任何东西),由白色上方的红色组成(反之亦然)。
Pixmap pixmap1 = new Pixmap(1, 1, Format.RGBA8888);
pixmap1.setColor(Color.WHITE);
pixmap1.fill();
Texture white = new Texture(pixmap1);
//...
Texture red = new Texture(pixmap2);
model1 = modelBuilder.createCylinder(4f, 6f, 4f, 16,
new Material(
TextureAttribute.createDiffuse(white),
ColorAttribute.createSpecular(1,1,1,1),
FloatAttribute.createShininess(8f))
, Usage.Position | Usage.Normal | Usage.TextureCoordinates);
model1I_white = new ModelInstance(model1, 0, 0, 0);
//...
model2I_red = new ModelInstance(model2, 0, 0, -2f);
然后我用 ModelBatch#render 渲染 ModelInstance。
【问题讨论】: