Show Posts

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.


Messages - athanazio

Pages: 1 2 3 [4]
46
Feedback / Free e books
« on: November 20, 2006, 05:49:42 pm »
weird very weird ... I clicked on the link, to the page
http://www.flazx.com/ebook1942.php and only found google ads links with the word download, can you please send me the url of the download link that you found ? it would be great, thanks !

47
Feedback / Free e books
« on: November 20, 2006, 03:51:30 pm »
excellent list ! but ... I'm not able to find a place to download then, aren't then supossed to be free ebooks ?  :D

anyway, thanks for the list !

48
Support / JPCT Hello World
« on: November 20, 2006, 01:44:41 pm »
Thanks !!! now it works :)
http://www.athanazio.pro.br/?p=929

49
Support / JPCT Hello World
« on: November 20, 2006, 04:39:52 am »
I'm also trying to put together my Hello World, I only get a black screen with some lights (I think...) on. here is the code:

Code: [Select]

import java.awt.Graphics;
import java.awt.Insets;
import java.awt.event.KeyEvent;

import javax.swing.JFrame;

import com.threed.jpct.Camera;
import com.threed.jpct.Config;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.IRenderer;
import com.threed.jpct.Lights;
import com.threed.jpct.Object3D;
import com.threed.jpct.Primitives;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;
import com.threed.jpct.util.KeyMapper;
import com.threed.jpct.util.KeyState;

public class HelloWorld extends JFrame {

private FrameBuffer buffer = null;

private World world = null;

private TextureManager textureManager = null;

private Camera camera = null;

private int width = 640;

private int height = 480;

private Graphics g = null;

/**
* main method
*/
private static final long serialVersionUID = 1L;

public static void main(String[] args) {
HelloWorld h = new HelloWorld();
}

private boolean exit = false;

private int titleBarHeight;

private int leftBorderWidth;

private KeyMapper keyMapper;

private void gameLoop() {
World.setDefaultThread(Thread.currentThread());

buffer = new FrameBuffer(width, height, FrameBuffer.SAMPLINGMODE_NORMAL);
buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE);

while (!exit) {
buffer.clear();
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
poll();
buffer.display(g, leftBorderWidth, titleBarHeight);
Thread.yield();

try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
}

System.exit(0);
}

/**
*/
public HelloWorld() {
setFrameStuff();
add3DStuff();
gameLoop();
}

private void setFrameStuff() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("jPCT Hello World (" + Config.getVersion() + ")");
pack();
Insets insets = getInsets();
titleBarHeight = insets.top;
leftBorderWidth = insets.left;
setSize(width + leftBorderWidth + insets.right, height + titleBarHeight
+ insets.bottom);
setResizable(false);
setLocationRelativeTo(null);
setVisible(true);
g = getGraphics();
keyMapper = new KeyMapper(this);
}

private void add3DStuff() {
world = new World();
textureManager = TextureManager.getInstance();
Object3D box = Primitives.getBox(50, 50);
box.setOrigin(new SimpleVector(0, 0, 0));
world.addObject(box);
world.buildAllObjects();
/**
* Place the camera at the starting position.
*/
setCamera(box);
setLight();
}

private void setCamera(Object3D box) {
camera = world.getCamera();
camera.setPosition(0, 0, -180);
camera.lookAt(box.getTransformedCenter());
}

private void setLight() {
Config.fadeoutLight = false;
world.getLights().setOverbrightLighting(
Lights.OVERBRIGHT_LIGHTING_DISABLED);
world.getLights().setRGBScale(Lights.RGB_SCALE_2X);
world.setAmbientLight(25, 30, 30);

/**
* Place the lightsources...
*/
world.addLight(new SimpleVector(0, -150, 0), 25, 22, 19);
world.addLight(new SimpleVector(-100, -150, 100), 22, 5, 4);
world.addLight(new SimpleVector(100, -150, -100), 4, 2, 22);

}

/**
* Use the KeyMapper to poll the keyboard
*/
private void poll() {
KeyState state = null;
do {
state = keyMapper.poll();
if (state != KeyState.NONE) {
keyAffected(state);
}
} while (state != KeyState.NONE);
}

private void keyAffected(KeyState state) {
int code = state.getKeyCode();
boolean event = state.getState();

switch (code) {
case (KeyEvent.VK_ESCAPE): {
exit = event;
break;
}
}
}
}


Pages: 1 2 3 [4]