Example7.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- import javax.microedition.m3g.*;
- /**
- * Light test.
- *
- * Scene consists of three balls and two lights. One of the lights
- * rotates around the balls. Highlights etc. should be visible.
- *
- */
- public class Example7 extends ExampleBase
- {
- private static final String FILE_NAME = "pallot";
- private Light iLight0;
- private World iWorld;
- public Example7()
- {
- super(SHOW_RENDER_TIME);
- iWorld = null;
- }
- protected void render(int time)
- {
- Transform transform = new Transform();
- transform.postRotate(((float)time)/10.f,
- 0.0f, 1.0f, 0.0f); // rotate around this axis
- iLight0.setTransform(transform);
- Graphics3D.getInstance().render(iWorld);
- }
- protected void initialize()
- {
- iWorld = (World)load(FILE_NAME)[0];
- iLight0 = new Light();
- iLight0.setMode(Light.DIRECTIONAL);
- iWorld.addChild(iLight0);
- iWorld.align(null);
- }
- }