Right! Damn... Thank you!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menuclass WorldModifierAssembleGameBoard {
boolean BoardAssembled = false;
boolean run = true;
float roundtrip = 1;
float roundtripStep = 0.01f;
boolean runModifier(World world, int secCounter, TextureManager tm, int DisplayHeight, int DisplayWidth) {
Logger.log("Run: AssembleGameBoard");
if(this.run) {
world.getObjectByName("top1").translate(0, roundtrip, 0);
world.getObjectByName("bottom1").translate(0, -roundtrip, 0);
this.roundtrip = this.roundtrip+roundtripStep;
Logger.log("Roundtrip = " + this.roundtrip);
if (this.roundtrip >= 1.4f) {
this.run = false;
}
}
return this.run;
}
void setRun(boolean run) {
this.run = run;
}
}
mGLView = new GLSurfaceView(getApplication());
mGLView.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser() {
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
// Ensure that we get a 16bit framebuffer. Otherwise, we'll fall
// back to Pixelflinger on some device (read: Samsung I7500)
int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };
EGLConfig[] configs = new EGLConfig[1];
int[] result = new int[1];
egl.eglChooseConfig(display, attributes, configs, 1, result);
return configs[0];
}
//----------------DER RENDERER----- EMBD KLASSE----------
class GameRenderer implements GLSurfaceView.Renderer {
// Faramecounter
private int fps = 0;
//private int lfps = 0;
private long fpsTime = System.currentTimeMillis();
private boolean stop = false;
//Voreinstellungen für den Renderer
public GameRenderer() {
Config.maxPolysVisible = 500;
Config.farPlane = 3000;
Config.glTransparencyMul = 0.1f;
Config.glTransparencyOffset = 0.1f;
Config.useVBO=true;
Texture.defaultToMipmapping(true);
Texture.defaultTo4bpp(true);
}
public void stop() {
stop = true;
}
@Override
public void onDrawFrame(GL10 arg0) {
try {
if (!stop) {
//Block für das Gesamtrendering
fb.clear(fbBackgroundColor);
if (GameWorldVisible) {
GameWorld.renderScene(fb);
GameWorld.draw(fb);
}
if (EnvBoxWorldVisible) {
EnvBoxWorld.renderScene(fb);
EnvBoxWorld.draw(fb);
}
if (OverlayWorldVisible) {
OverlayWorld.renderScene(fb);
OverlayWorld.draw(fb);
}
if (SystemMessageWorldVisible) {
SystemMessageWorld.renderScene(fb);
SystemMessageWorld.draw(fb);
}
checkConnection();
//WorldModifier.checkAndExecute();
fb.display();
//Ende Block für das Gesamtrendering
} else {
if (fb != null) {
fb.dispose();
fb = null;
}
}
} catch (Exception e) {
e.printStackTrace();
Logger.log("Drawing thread terminated!", Logger.MESSAGE);
}
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
if (fb != null) {
fb.dispose();
}
// Analyse der Displaygröße und übergabe an den Framebuffer
fb = new FrameBuffer (gl, width, height);
//fb = new FrameBuffer (gl, 800, 400);
}
...
...
...
...
import com.threed.jpct.*;
import java.io.InputStream;
import java.util.logging.Level;
import javax.swing.*;
/**
*
* @author dslawaticki
*/
public class Main {
/**
* @param args the command line arguments
*/
private World world;
private FrameBuffer buffer;
private Object3D box;
private JFrame frame;
public static void main(String[] args) {
try {
new Main().loop();
} catch (Exception ex) {
java.util.logging.Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
public Main() throws Exception {
frame=new JFrame("Hello world");
frame.setSize(800, 600);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
world = new World();
world.setAmbientLight(200, 200, 200);
TextureManager.getInstance().addTexture("box", new Texture("D:\\Privat\\3DModelle\\xprs3.jpg"));
System.out.println (TextureManager.getInstance().getTexture("box").getHeight());
System.out.println (TextureManager.getInstance().getTexture("box").getWidth());
box = loadModel("xprs3.3ds",1);
box.setTexture("box");
box.calcTextureWrap();
box.recreateTextureCoords();
box.setEnvmapped(Object3D.ENVMAP_DISABLED);
world.addObject(box);
world.getCamera().setPosition(50, -50, -5);
world.getCamera().lookAt(box.getTransformedCenter());
}
private Object3D loadModel(String filename, float scale) {
InputStream in1 = getClass().getResourceAsStream(filename);
Object3D[] model = Loader.load3DS(in1, scale);
Object3D o3d = new Object3D(0);
Object3D temp = null;
for (int i = 0; i < model.length; i++) {
temp = model[i];
temp.setCenter(SimpleVector.ORIGIN);
temp.rotateX((float)( -.5*Math.PI));
temp.rotateMesh();
temp.setRotationMatrix(new Matrix());
o3d = Object3D.mergeObjects(o3d, temp);
o3d.build();
}
return o3d;
}
private void loop() throws Exception {
buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
while (frame.isShowing()) {
//world.getCamera().setPosition(50, -50, -5);
box.rotateY(0.01f);
buffer.clear(java.awt.Color.BLUE);
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.display(frame.getGraphics());
Thread.sleep(10);
}
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.dispose();
frame.dispose();
System.exit(0);
}
}
Page created in 0.083 seconds with 12 queries.