//顶点集合
VertexArray vertexArray = new VertexArray(Util.vertices.length / 3, 3, 2);
vertexArray.set(0, Util.vertices.length / 3, Util.vertices);
//顶点法线集合
//法线为顶点所在平面的垂直方向,有正负之分
VertexArray normalArray = new VertexArray(Util.normals.length / 3, 3, 1);
normalArray.set(0, Util.normals.length / 3, Util.normals);
//顶点颜色集合
VertexArray colorArray = new VertexArray(Util.colors.length / 3, 3, 1);
colorArray.set(0, Util.colors.length / 3, Util.colors);
VertexBuffer cubeVertices = new VertexBuffer();
cubeVertices.setPositions(vertexArray, 1.0F, null);
cubeVertices.setNormals(normalArray);
cubeVertices.setColors(colorArray);
//三角形带
TriangleStripArray cubeIndices = new TriangleStripArray(0, Util.stripLengths);
Appearance appearance = new Appearance ();
PolygonMode polygonMode = new PolygonMode ();
polygonMode.setPerspectiveCorrectionEnable (true);
polygonMode.setCulling (PolygonMode.CULL_NONE);
polygonMode.setShading (PolygonMode.SHADE_SMOOTH);
appearance.setPolygonMode (polygonMode);
mesh = new Mesh (cubeVertices, cubeIndices, appearance);
world.addChild(mesh);
cam = new Camera();
//相机距离
cam.setTranslation(di,0,100);
world.addChild(cam);
world.setActiveCamera(cam);
//相机角度,及渲染的最近和最远距离
cam.setPerspective(60F,
(float) width / (float) height,
1.0F,
300.0F);
//旋转物体
mesh.postRotate( Util.degree, 1.0F, 0F, 0F);
分享到:
相关推荐
《J2me手机游戏编程入门》书带源码帮子你学习J2ME手机游戏编程
J2ME手机游戏编程入门,源码
主要是J2ME手机编程中的先进技术,如无线通信,游戏开发,电子地图浏览.播放器, 持久化应用,移动商务应用,XML模型应用
J2ME 无线设备编程J2ME 无线设备编程J2ME 无线设备编程J2ME 无线设备编程
J2ME蓝牙编程J2ME蓝牙编程J2ME蓝牙编程J2ME蓝牙编程J2ME蓝牙编程J2ME蓝牙编程
《J2ME手机游戏编程入门》全书实例源码,学习Java 手机游戏编程的入门书籍,其中附带了大量的J2me游戏源码实例,通过这些实例源码你将对Java手机游戏编程的基础技巧有一定的掌握,游戏的种类也比较多,而且很多都是...
J2ME无线设备编程 ,J2ME无线设备编程
j2me 手机短信编程(sms),经典 适合编程各个阶段的人学习,一定很有帮助
J2ME手机游戏编程入门.iso J2ME手机游戏编程入门.iso
《J2ME游戏编程》书中的源代码《J2ME游戏编程》书中的源代码《J2ME游戏编程》书中的源代码《J2ME游戏编程》书中的源代码
J2ME手机游戏编程入门与提高 代码 J2ME手机游戏编程入门与提高 代码
j2ME 无线设备编程 电子版 中文版 非常清晰的PDF
J2ME编程基础 配置 MyEclipse 中进行J2ME开发 J2ME 数据库开发 WAP 基础开发
j2me无线设备编程是关于J2ME的一个方面的编程的书