So what kind of ASC files does JPCT support?
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 Menu
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import com.threed.jpct.*;
import javax.naming.Context;
import javax.swing.*;
public class prova {
private World world;
private FrameBuffer buffer;
private Object3D map;
private JFrame frame;
public static void main(String[] args) throws Exception {
new prova().loop();
}
public prova() throws Exception {
frame=new JFrame("Hello world");
frame.setSize(1024, 860);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
world = new World();
world.setAmbientLight(0, 255, 0);
TextureManager texMan=TextureManager.getInstance();
Texture rocks=new Texture("rocks.jpg");
texMan.addTexture("rocks", rocks);
map=Loader.loadASC("411140_20_WGS.ASC", 400, false);
map.setTexture("rocks");
world.addObject(map);
map.enableLazyTransformations();
map.build();
SimpleVector pos=map.getCenter();
pos.scalarMul(-1f);
map.translate(pos);
map.rotateX((float)-Math.PI/2f);
map.translateMesh();
map.rotateMesh();
map.setTranslationMatrix(new Matrix());
map.setRotationMatrix(new Matrix());
map.createTriangleStrips(2);
world.getCamera().setPosition(50, -50, -5);
world.getCamera().lookAt(map.getTransformedCenter());
}
public void loop() throws Exception
{
buffer = new FrameBuffer(1024, 860, FrameBuffer.SAMPLINGMODE_NORMAL);
while (frame.isShowing()) {
map.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.034 seconds with 13 queries.