Show Posts
|
|
Pages: [1] 2 3
|
|
1
|
Java Game APIs & Engines / Xith3D Forums / Terrain Class Info
|
on: 2005-04-04 13:30:13
|
|
Hi im looking for the theory behind the com.xith3d.terrain.Terrain class and how it works more specifically how it renders the terrain adapting the polygon density for efficient usage.
Does anybody know what kind of technique the terrain class uses and any articles or sites etc. where i can start researching this??
|
|
|
|
|
3
|
Java Game APIs & Engines / Xith3D Forums / Picking terrain
|
on: 2005-02-14 10:49:35
|
|
Hi i have a terrain that i want to be able to pick and return the coord the ray intersects the terrain shape.
As far as i know the View.pick function only returns the shape3D object but i need the actual absolute location the pickray intersected the terrain shape.
Can anybody give me an idea how to go about this??
Thanks
|
|
|
|
|
4
|
Java Game APIs & Engines / Xith3D Forums / Splitting Terrain into Shape3D's
|
on: 2005-02-14 10:41:29
|
Hi trying to sub divide the terrain shape from the terrain demo into a 2 dim array of shape3d's each of size 256 * 256. wrote a piece of code (see below) but the texturing is not mapping properly and there is large gaps between each shape3d geometry. the init method is the only major thing i changed can anyone suggest a reason why there could be gaps between the shape3d's?  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| public void rebuild(View view) {
view.getTransform().get(pTemp); terrain.update(pTemp,117); for(int row=0; row<geo.length; ++row){ for(int col=0; col<geo[0].length; ++col){ geo[row][col].drawStart(); totalIndex = totalVerts = 0; terrain.render(this); geo[row][col].drawEnd(); geo[row][col].setIndex(index);
geo[row][col].setValidIndexCount(totalIndex); geo[row][col].setValidVertexCount(totalVerts); } }
} public void start() { } public void initVert(int i, float x, float y, float z) { if (totalVerts>=MAX_VERTICES) return; int row = (int)((x) / 256); int col = (int)((z) / 256); if(row == 4)row = 3; if(col == 4)col = 3; geo[row][col].newVertex(); geo[row][col].setCoordinate(x,y,z);
float texCoordx = x / (terrain.getWidth() / textureScale); float texCoordz = z / (terrain.getWidth() / textureScale); TexCoord2f texCoords = new TexCoord2f(texCoordx, texCoordz); geo[row][col].setTextureCoordinate(0,totalVerts,texCoords);
float c = y/1500; geo[row][col].setColor(0.48f+c, 0.48f+c, 0.39f+c);
vertexMap[i] = totalVerts++; } public void tri(int a, int b, int c) { if (totalIndex+3>=MAX_INDICES) return; index[totalIndex++] = vertexMap[a]; index[totalIndex++] = vertexMap[b]; index[totalIndex++] = vertexMap[c]; } |
|
|
|
|
|
5
|
Java Game APIs & Engines / Xith3D Forums / Multible Textures On Terrain
|
on: 2005-02-07 07:49:53
|
Hi ive augmented the terrain demo for a project im doing and i need to display tiled textures on the terrain where each of the textures is different. Currently the terrain shape is a single shape3D object, is there any way of tiling multiple textures to the same shape3D object or do i need to split the terrain into multiple shpae3D objects. The reason i want this is that im creating a procedureal texture from an array which typically is between 1024 * 1024 and 2048 * 2048 in size and mapping that to the terrain, but the graphics card i have to demonstrate the program on can't handle textures over 512. Appreciate any advice 
|
|
|
|
|
6
|
Java Game APIs & Engines / JInput / Re: Null pointer in Jinput Test program
|
on: 2005-01-27 09:41:52
|
The thing is that i can get the "ControllerReadTest " up and running, but its just a blank JFrame, i presume theres supposed to be a read out of the keyboard and the mouse or something. So the DirectInputEnvironmentPlugin mustn't be loading then as the code below is not printing out when i start the ControllerReadTest 1 2 3 4 5 6 7
| Examining file : META-INF/ Examining file : META-INF/MANIFEST.MF Examining file : net/ Examining file : net/java/ Examining file : net/java/games/ Examining file : net/java/games/input/ Examining file : net/java/games/input/DirectInputAxis.class |
and just to reiterate im typing this at the command line 1 2
| C:\jinput>java -cp jutils.jar;jinput.jar -Djava.library.path=. net.java.games.in put.test.ControllerReadTest |
and my directory structure follows mk81's except that to overcome the error where the plugin loader doesn't find the DirectInputEnvironmentPlugin class i've unpacked the dxinput.jar. ./dxinput.dll ./jinput.jar ./utils.jar ./Controller/net/java/games/input/ *.class Do you have a bug fixed version of jutils.jar mk81?? as would really appretiate it if i could use it to load the plugins
|
|
|
|
|
8
|
Java Game APIs & Engines / JInput / Re: Null pointer in Jinput Test program
|
on: 2005-01-26 10:03:53
|
Ok i removed the "controller" directory and moved the dxinput.dll and dxinput.jar to my project directory. Im using netbeans (i also tried from the command line) so i set my Running Projecct Arguments to 1
| -Djava.library.path=. -Djinput.plugins=net.java.games.input.DirectInputEnvironmentPlugin |
and the jinput.jar and jutils.jar are both in the 1
| {java_home}/jre/libs/ext directory |
and im running this code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
import net.java.games.input.*;
public class InputManager { Keyboard kb = null; public static void main(String[] args){ new InputManager(); } public InputManager() { ControllerEnvironment ce = ControllerEnvironment.getDefaultEnvironment(); Controller[] cont = ce.getControllers(); System.out.println("cont: " + cont.length); for (int i = 0; i < cont.length; i++) { if (cont[i].getType() == cont[i].getType().KEYBOARD) { kb = (Keyboard) cont[i]; } } for(int i = 0; i < 100000; i++) { update(); } System.out.println("done..."); } public void update(){ kb.poll(); Axis[] ax = kb.getAxes(); for (int x = 0; x < ax.length; x++) { float num = ax[x].getPollData(); if (num != ax[x].getDeadZone()) { if (ax[x].getName().equalsIgnoreCase("key 110")) { System.out.println("up arrow"); } } } } }
|
and its not reading any controllers still and therefore throwing a null pointer when i try to poll the keyboard any idea why its still not working?? sorry about all this it's just really annoying. Think i'll write a tutorial for jiput afte all this 
|
|
|
|
|
9
|
Java Game APIs & Engines / JInput / Re: Null pointer in Jinput Test program
|
on: 2005-01-24 13:04:49
|
Hi i've tried a lot of things with the -D, without the -D just trying 1
| java -cp jinput.jar;jutils.jar net.java.games.input.test.ControllerReadTest |
gives me the same error i can get rid of the error by unpacking the dxinput.jar and deleting the dxinput.jar. There seems to be a bug with the plugin classloader when reading form jar files as i used the plugin code for a project last year and had the same problems. So with the jar unpacked the demo now runns but only a blank JFrame appears   is Jinput not finding the dll's or something i wonder??
|
|
|
|
|
10
|
Java Game APIs & Engines / JInput / Null pointer in Jinput Test program
|
on: 2005-01-18 15:07:42
|
Hi im trying my hardest to get JInput working here and its not doing any good for my mental health >: ive unzipped the core package into "jdk1.5.0_01\jre\lib\ext" with jinput.jar and jutil.jar in the ext directory and the dxinput.dll and dxinput.jar in a folder named "controller" as the intro tutorials says. i navigate to the "jdk1.5.0_01\jre\lib\ext" directory in the command window and execute the command: java -cp jinput.jar;jutils.jar net.java.games.input.test.ControllerTextTest 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| C:\Program Files\Java\jdk1.5.0_01\jre\lib\ext>java -cp jinput.jar;jutils.jar net .java.games.input.test.ControllerTextTest Controller Env = net.java.games.input.DefaultControllerEnvironment@35ce36 Scanning jar: dxinput.jar Examining file : META-INF/ Examining file : META-INF/MANIFEST.MF Examining file : net/ Examining file : net/java/ Examining file : net/java/games/ Examining file : net/java/games/input/ Examining file : net/java/games/input/DirectInputAxis.class Examining file : net/java/games/input/DirectInputDevice.class Examining file : net/java/games/input/DirectInputEnvironmentPlugin.class Found candidate class: net/java/games/input/DirectInputEnvironmentPlugin.class Exception in thread "main" java.lang.NoClassDefFoundError: IllegalName: net/java /games/input/DirectInputEnvironmentPlugin at java.lang.ClassLoader.preDefineClass(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at net.java.games.util.plugins.Plugins.processJar(Plugins.java:112) at net.java.games.util.plugins.Plugins.scanPlugins(Plugins.java:85) at net.java.games.util.plugins.Plugins.<init>(Plugins.java:73) at net.java.games.input.DefaultControllerEnvironment.scanControllersAt(D efaultControllerEnvironment.java:174) at net.java.games.input.DefaultControllerEnvironment.scanControllers(Def aultControllerEnvironment.java:164) at net.java.games.input.DefaultControllerEnvironment.access$000(DefaultC ontrollerEnvironment.java:57) at net.java.games.input.DefaultControllerEnvironment$1.run(DefaultContro llerEnvironment.java:108) at java.security.AccessController.doPrivileged(Native Method) at net.java.games.input.DefaultControllerEnvironment.getControllers(Defa ultControllerEnvironment.java:106) at net.java.games.input.test.ControllerTextTest.<init>(ControllerTextTes t.java:54) at net.java.games.input.test.ControllerTextTest.main(ControllerTextTest. java:86) |
ive tried using the -D option with the jinput.plugins option but java tells me the class doesn't exist can anyone help me with this, and can anyonne make the install for this a little less painful maybe a complete introduction to jinput not an introduction scattered over many threads, it's just messy!!
|
|
|
|
|
11
|
Java Game APIs & Engines / Xith3D Forums / Strange Loop Slow Down
|
on: 2005-01-06 12:26:36
|
Hi im having some trouble with slow down in a program im developing, below is the main driving loop. The slow down happens periodically and stalls the whole program even the awt event thread so i cant killl the program while its stalled. Im wondering if its to do with some thread issue i dont know about in xith?? As you can see below the xith rendering is done in another object (The UserInterface object ), which is a singleton e.g. 1 2 3 4 5 6 7 8 9 10 11 12 13
| public class SingletonExample{
private static SingletonExample sinEx = new SingletonExample();
private SingletonExample(){ }
public SingletonExample getReference(){ return sinEx; }
} |
Ive printed messages at key points to try and track down the stalling point and it seems to be where the loop sleeps, but the loop sleeps for way longer than its suppossed to, as in its told to sleep for 33 milliseconds and the delay can sometimes be as long as 30 seconds??? Could the fact that the rendering is being done in another object be the cause or am i just barking up the wrong tree here??? Thanks for any help 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| private EmergeAnt(){ System.out.println("EmergeAnt: Brian Heylin ITCarlow 2004"); setFramePerSecond(30); userInterface = UserInterface.getReference(); run(); System.out.println("Loop Variables"); System.out.println("Number Loops = " + numLoop); System.out.println("Number Sleeps = " + numSleep); System.out.println("Number Overworked = " + numOverWorked); System.out.println("Number Yields = " + numYield); } private void run(){ beforeTime = System.nanoTime(); running = true; while(running){ ++numLoop; userInterface.update(); afterTime = System.nanoTime(); timeDiff = afterTime - beforeTime; sleepTime = (period - timeDiff) - overSleepTime; if(sleepTime > 0){ try{ Thread.sleep(sleepTime/2000000L); }catch(InterruptedException ex){} overSleepTime = (System.nanoTime() - afterTime) - sleepTime;
}else{ excess -= sleepTime; overSleepTime = 0L; if(++numberDelays >= NUM_DELAYS_PER_YIELD){ Thread.yield(); numberDelays = 0; } } beforeTime = System.nanoTime(); } } |
|
|
|
|
|
12
|
Java Game APIs & Engines / Xith3D Forums / Pheromone Texture
|
on: 2004-12-16 14:12:54
|
|
Hi im developing an ant colony simulation and i need to map a pheromone array (int)to basic primative shapes that make up the environment, this map will have to be updated regularly and be turned on and off.
Im just starting to think about how to do this, i presume that i make some sort of texture from the pheromones array (might have a pheromone array for each primative shape) and map this to the shape every game loop.??
Does this sound ok?? Any opinions on better ways??
Thanks
|
|
|
|
|
13
|
Java Game APIs & Engines / Xith3D Forums / Quaternion Camera Class
|
on: 2004-12-14 08:34:22
|
Hi im looking for a quaternion camera class, i have a few tutorials but my maths skills are a bit dodgey :-/ I would just like to get a camera up and running as fast as possible as i have to concentrate on a big project, of which the camera is but a small part  I presume a third person quaternion camera has been done many times before by many people so i would appreciate it if someone could give a maths idiot a helping hand 
|
|
|
|
|
14
|
Java Game APIs & Engines / Xith3D Forums / Re: Snap to Grid
|
on: 2004-12-14 08:24:56
|
I just love starting a good discussion  I'll be doing the code for my snapping stuff over the christmas, but its my first time considering it in a project so it'll probably be very specfic to my problem. but i'll post it if you want. Im doing an ant colony simulation if anyones interrested, its an interesting project from an ai point of view
|
|
|
|
|
15
|
Java Game APIs & Engines / Xith3D Forums / Re: Snap to Grid
|
on: 2004-12-13 10:43:06
|
Thanks for the reply, My app needs an environment editor (making a simulation of an ant colony, want to be able to build simple table top ant farm to be used in simulation from simple primatives, nothing fancy) so want a simple snap to grid system where simple primatives, planes, wedges, cubes are used to build the environment. Do you know of any good tutorials?? just want to get it done properly the first time, as i have plenty other things to develop!! Thanks 
|
|
|
|
|
17
|
Java Game APIs & Engines / Xith3D Forums / Xith And Swing Menu
|
on: 2004-12-10 08:01:18
|
|
Hi Ive embedded a xith Canvas3D into a swing panel and frame etc.. I have a menubar on the frame, and the problem is that the Xith Canvas overdraws the menus when there expanded.
Ive tried placing a frame.repaint() in the render loop to see if it makes a difference, but it didn't :|
Any ideas on how to cure this one??
Thanks
|
|
|
|
|
19
|
Java Game APIs & Engines / Xith3D Forums / Snap to Grid
|
on: 2004-12-08 09:33:29
|
|
Hi I need to implement a grid on the zx plane which i can place objects on (for an environment editor).
Looking for a few suggestions on how to go about drawing the grid and also what square of the grid the mouse of hovering over with the pick ray (all i can come up with is using a square with a colored outline for each square of the grid, i'm sure theres a more efficient way;)) is there common way to go about this?
Thanks
|
|
|
|
|
22
|
Java Game APIs & Engines / Xith3D Forums / Re: UIWindow disappering act
|
on: 2004-04-20 16:32:50
|
heres the class for the infoWindow, as i said it worked when i brought it into one of the simple demo programs from the getting started guide but when i brought it into my project notting is being rendered. I thought i might have been a threading issue, so i created and showed it using the rendering thread but still no luck??? again any help would be great thanks 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
| public class InfoWindow extends UIWindow{ private UIWindowManager windowMgr = null; private JPanel root = null; private InfoCanvas infoCanvas = new InfoCanvas(); public InfoWindow(Canvas3D canvas){ super(210, 110, true, false); windowMgr = new UIWindowManager(canvas); root = new JPanel(true); root.setSize(210, 110); root.setOpaque(false); root.add(infoCanvas); windowMgr.addOverlay(this); setRoot(root); } public synchronized void update(){ super.update(); setRoot(root); } public synchronized void setMessage(String message){ infoCanvas.message = message; } public synchronized void setLocation(Point location){ System.out.println ("Setting info window location"); windowMgr.setPosition(this, location.x, location.y); } public synchronized void setVisible(boolean isVisible){ System.out.println ("Setting info window visible"); windowMgr.setVisible(this, isVisible); } private class InfoCanvas extends Canvas{ public String message = ""; public InfoCanvas(){ setBounds(0, 0, 200, 100); setVisible(true); } public void paint(Graphics g){ System.out.println ("Painting InfoWindow"); Graphics2D g2d = (Graphics2D)g; g2d.setPaint(new Color(0.15f, 0.0f, 0.60f)); g2d.fillRoundRect(0, 0, 200, 100, 20, 20); g2d.setPaint(new Color(0.25f, 0.0f, 0.70f)); g2d.fillRoundRect(5, 5, 190, 90, 20, 20); g2d.setPaint(new Color(0.8f, 0.6f, 0.9f)); g2d.drawString(message , 10, 50); } } } |
|
|
|
|
|
23
|
Java Game APIs & Engines / Xith3D Forums / UIWindow disappering act
|
on: 2004-04-19 09:36:32
|
|
Hi i have written a little UIWindow to act as an info panel in a game im doing. I worte it and tested it using one of the first example programs ( one displying a rotated cube) and it worked fine followed my mouse when i moved it an everything:)
I then brought it into the game im writing, and for some reason unknown to me, it will not disply itself.
I have ran a few tests of it and the point() method i'm using to diaplay the graphics is being called as expected but it's just not being rendered to the canvas???
Any suggestions would be great:)
|
|
|
|
|
24
|
Java Game APIs & Engines / Xith3D Forums / Re: Path finding camera
|
on: 2004-04-16 13:44:04
|
|
the quad.interpolate(Quad4f, Quad4f, int) was a typo, i am using the quad.interpolate(Quad4f, Quad4f, float)method im using the resulting quad to set the view.Transform().set(Quad4f) but whatever value of alpha i use the view snaps straight to the end point.
|
|
|
|
|
25
|
Java Game APIs & Engines / Xith3D Forums / Re: Path finding camera
|
on: 2004-04-14 11:25:42
|
Will give them a look pedro thanks. I want to apply the camera to a college chess project but ive only a week and a half to polish the whole thing off so it looks like i won't have the time to look into it at the moment. If anyont else has something simular done already even that would be great. was looking at the interpolate(Quad4f target, int alpha) method of the Quad4f class in the vecmath packages and was under the impression that it would interpolate between two points in increments specified by alpha. But it seems to just jump from the source point to the target point no matter what value alpha is. i know that this is usually used in-directly with a Java3d interpolator but pressumed that it could be used maually. any info on this would be good 
|
|
|
|
|
26
|
Java Game APIs & Engines / Xith3D Forums / Re: Path finding camera
|
on: 2004-04-08 11:10:22
|
Hi havent used interpolaters yet i'm just loking into them at the mo (bit of a newbie  got pointed towards quaternions for smooth rotations, apparently most top class games use tham for rotaions in place of the standard matrix. so anyway i'm just printing off stuff about quaternions now and going to give it a look over other than that i'm not much help at the mo 
|
|
|
|
|
28
|
Java Game APIs & Engines / Xith3D Forums / Path finding camera
|
on: 2004-04-02 08:41:33
|
Hi im trying to modify a currently basic camera that orbits around a center point always looking at the center point. I want to set up a camera system where i can give the camera a point in 3d space and it will smoothly orbit around to the point. at the moment i just have a basic algorithm that takes the mouse diplacement as its parameters 1 2 3 4 5 6 7 8
| float cos = (float)Math.cos(rotXDisplacement); float x = cos*(float)Math.cos(rotYDisplacement) * zoomDisplacement; float y = (float)Math.sin(rotXDisplacement) * zoomDisplacement; float z = cos*(float)Math.sin(rotYDisplacement) * zoomDisplacement; view.getTransform().lookAt(new Vector3f( x, y, z), centerVector, upVector); |
I have no idea of where to start implementing a path finding algorithm so if anyone has any good ideas links to tutorails etc. it'id be great 
|
|
|
|
|
29
|
Java Game APIs & Engines / Xith3D Forums / Re: Text in XIth3D
|
on: 2004-04-02 07:45:45
|
|
I presumed that the fact that the UI manger has to, at the end of the day call the swing code for all components in the UIWindow, e.g. resizeing code all the differnet panes etc, which i'd imagine is a lot of code compared to just displaying some texture with some text on it.
I'll give the UI system a go can i just use a canvas to display a rounded rectangle with a bit of text on it using the UIOverlay???
|
|
|
|
|
30
|
Java Game APIs & Engines / Xith3D Forums / Text in XIth3D
|
on: 2004-04-01 09:09:37
|
|
Im developing a chess game and i'm trying to make a little info window that pops up at the mouse coords when the mouse hovers over a piece.
Besides using the UIOverlay system what options do i have to display a simple info dialog, all i want is a simple radiused blue rectangle containing textual info so i feel using the UIOverlay system is a bit overkill.
I have a felling i'll have to use JOGL as i can see no text classes in the Xith3D packages, this i have very little experience with. so if anyone has any ideas it would be great:)
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|