K
kevlin
Unregistered / Unconfirmed
GUEST, unregistred user!
package loor11;
import javax.microedition.lcdui.game.*;
import javax.microedition.lcdui.*;
import javax.microedition.m3g.*;
import javax.microedition.m3g.Camera;
import javax.microedition.m3g.Graphics3D;
import javax.microedition.m3g.Graphics3D;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class M3gCanvas
extends GameCanvas implements Runnable {
private World world=null;
private Camera cam=null;
private Graphics3D g3d=null;
protected M3gCanvas() {
super(true);
setFullScreenMode(true);
createWorld();
createCamera();
start();
}
public void createWorld()
{
try{
Object3D[] buffer=Loader.load("/res/aaa.m3g") ;
for(int i=0;i<buffer.length ;i++)
{
if (buffer instanceof World){
world=(World )buffer;
break;
}
buffer=null;
}
}catch(Exception e)
{e.printStackTrace() ;}
}
public void createCamera(){
cam=world.getActiveCamera() ;
Light l=new Light() ;
l.setMode(Light.AMBIENT) ;
l.setIntensity(3.0f) ;
world.addChild(l) ;
}
public void drawscreen(Graphics g){
try{
cam.setOrientation(260.0f,0.0f,1.0f,0.0f) ;
g3d=Graphics3D.getInstance() ;
g3d.bindTarget(g,true,Graphics3D.ANTIALIAS |Graphics3D.TRUE_COLOR |Graphics.HCENTER) ;
g3d.render(world) ;}
catch(Exception e){
e.printStackTrace() ;
}
finally{
g3d.releaseTarget();
}
}
public void run(){
while(true)
{
try{
Thread.sleep(30) ;
drawscreen(getGraphics());
flushGraphics();
}
catch(Exception e)
{e.printStackTrace() ;
}
}
}
public void start(){
Thread thread=new Thread() ;
thread.start() ;
}
}
import javax.microedition.lcdui.game.*;
import javax.microedition.lcdui.*;
import javax.microedition.m3g.*;
import javax.microedition.m3g.Camera;
import javax.microedition.m3g.Graphics3D;
import javax.microedition.m3g.Graphics3D;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class M3gCanvas
extends GameCanvas implements Runnable {
private World world=null;
private Camera cam=null;
private Graphics3D g3d=null;
protected M3gCanvas() {
super(true);
setFullScreenMode(true);
createWorld();
createCamera();
start();
}
public void createWorld()
{
try{
Object3D[] buffer=Loader.load("/res/aaa.m3g") ;
for(int i=0;i<buffer.length ;i++)
{
if (buffer instanceof World){
world=(World )buffer;
break;
}
buffer=null;
}
}catch(Exception e)
{e.printStackTrace() ;}
}
public void createCamera(){
cam=world.getActiveCamera() ;
Light l=new Light() ;
l.setMode(Light.AMBIENT) ;
l.setIntensity(3.0f) ;
world.addChild(l) ;
}
public void drawscreen(Graphics g){
try{
cam.setOrientation(260.0f,0.0f,1.0f,0.0f) ;
g3d=Graphics3D.getInstance() ;
g3d.bindTarget(g,true,Graphics3D.ANTIALIAS |Graphics3D.TRUE_COLOR |Graphics.HCENTER) ;
g3d.render(world) ;}
catch(Exception e){
e.printStackTrace() ;
}
finally{
g3d.releaseTarget();
}
}
public void run(){
while(true)
{
try{
Thread.sleep(30) ;
drawscreen(getGraphics());
flushGraphics();
}
catch(Exception e)
{e.printStackTrace() ;
}
}
}
public void start(){
Thread thread=new Thread() ;
thread.start() ;
}
}