Appearance appearance = new Appearance (); // A set of component objects that define the rendering attributes of a Mesh
// 一个Appearance组件,它封装了多边形级别的特征
PolygonMode polygonMode = new PolygonMode ();
polygonMode.setPerspectiveCorrectionEnable (true);
// 通过使用CULL_NONE棱锥的所有面都会显示
polygonMode.setCulling (PolygonMode.CULL_NONE);
// 棱锥使用平滑的颜色渐变
polygonMode.setShading (PolygonMode.SHADE_SMOOTH);
appearance.setPolygonMode (polygonMode);
// 为3D对象设置外观(appearance)
mesh.setAppearance (0, appearance);
下面我们重点看一下本篇文章中建立3D对象(棱锥)的过程。
1.这一步比较简单,指定棱锥用到的五个点。
2.建立一个点序列的INDICES 数组,这个数组中包含了顶点的信息,其中0到4依次和第一步中建立的点1到点5对应,对应关系如右图。