Show Posts
|
|
Pages: [1]
|
|
1
|
Java Game APIs & Engines / Java 3D / Re: ASE Loader
|
on: 2005-04-13 22:14:31
|
ASE does support animation, keyframe animation that is. The ASE exporter can be set to export animations in the export-options-panel. I didn't use that though. The way I did it is that I have exported one .ASE-file per frame. If you have downloaded the gordon-demo, you'll see that it has a lot of .ASE files in the gordon-folder. Quite simple, and a complete diskspace-eater  To make the animation look somewhat smooth and to cut down on required .ASE files, I use a simple linear interpolation between the frames. If you need your own file-format, I'd recommend taking a quick look at MAXscript, as it was surprisingly easy to export a scene using it. That way you can export animations etc just the way you want without all the unneeded info you don't need. In fact, if I had taken a look at MAXscript before I started doing the .ASE loader, I probably never would have made it using ASE, but rather a custom format. I have uploaded a Managed DirectX-test I've been playing around with in case you want a look. In the debug-folder you'll find the maxscript I used to export the program's content, and I think it's fairly well commented to be easily understood. The files MAX export is in an easily-parsable text-format. I'm not saying this is a good exporter, but it works  Please have a forgiving mind looking over the C#-code that parses it, as it's not commented (however the parsing part should be pretty self-explanatory) and the rest of the code is... well. Messy. It's a test-app i'm playing around in... http://home.no.net/tabusd/files/mdxtest.zipNote that the script only exports selected objects in the scene, and they must be textured in some way or else the script might fail. -Trond
|
|
|
|
|
2
|
Java Game APIs & Engines / Java 3D / Re: simple texturing help
|
on: 2004-12-13 23:21:53
|
Something along the lines of this: 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
| QuadArray l_quad = new QuadArray(8, QuadArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_2 | QuadArray.COLOR_4);
l_quad.setCoordinate(0, new Point3f(0.0f, 0.0f, -3.0f)); l_quad.setCoordinate(1, new Point3f(2.0f, 0.0f, -3.0f)); l_quad.setCoordinate(2, new Point3f(2.0f, 3.0f, -3.0f)); l_quad.setCoordinate(3, new Point3f(0.0f, 3.0f, -3.0f)); l_quad.setTextureCoordinate(0, 0, new TexCoord2f(0, 0)); l_quad.setTextureCoordinate(0, 1, new TexCoord2f(1, 0)); l_quad.setTextureCoordinate(0, 2, new TexCoord2f(1, 1)); l_quad.setTextureCoordinate(0, 3, new TexCoord2f(0, 1));
l_quad.setColor(0, new Color4f(1, 1, 1, 1)); l_quad.setColor(1, new Color4f(1, 0, 0, 1)); l_quad.setColor(2, new Color4f(1, 1, 1, 1)); l_quad.setColor(3, new Color4f(1, 1, 1, 1)); Appearance l_quadappearance = new Appearance(); Texture l_quadtex = new TextureLoader("texture.jpg", this).getTexture(); l_quadappearance.setTexture(l_quadtex); TextureAttributes l_texatt = new TextureAttributes(); l_texatt.setTextureMode(TextureAttributes.MODULATE); l_quadappearance.setTextureAttributes(l_texatt);
BranchGroup l_group = new BranchGroup(); l_group.addChild(new Shape3D(l_quad, l_quadappearance)); |
This code should work, if it doesn't let me know. I copy/pasted it from a prog I had here, so I might have missed something in the rush. Hope this helps! -Trond
|
|
|
|
|
3
|
Java Game APIs & Engines / Java 3D / Re: Using KeyListener to modify a transform
|
on: 2004-12-04 10:33:20
|
You need to apply the transformations to a transformgroup, and a transformgroup may contain geometry or it may have other transformgroups as children. If you want to apply a transform after a transformgroup is added to the branchgraph, you need to set write-capability for the transformgroup, something like this (before adding to branchgroup): 1 2 3
| tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
bg.addChild(tg); |
Then, assuming your 'tg' is a class variable, you can set transforms from the keylistener functions, something like this: 1 2 3 4 5 6 7
| if (event.getKeyCode() == KeyEvent.VK_RETURN) { angle+= 0.1; Transform3D t3d = new Transform3D(); t3d.rotZ(angle); tg.setTransform(t3d); } |
This should be sufficient to transform an object. -Trond
|
|
|
|
|
4
|
Java Game APIs & Engines / Java 3D / Re: ASE Loader
|
on: 2004-11-29 16:29:46
|
You may use it however you like, there is no license  Think I mentioned it in some readme.txt or in the .java source files. Nice to hear if someone finds it useful! -Trond
|
|
|
|
|
5
|
Java Game APIs & Engines / Java 3D / Re: Problem with loading 3D model!
|
on: 2004-11-19 12:14:30
|
|
Maybe you should try to add a Java3D built-in primitive to your scene to make sure Java3D is not set up wrong. Also, in addition to the reasons Herkules mentioned, make sure the camera is not inside the model, in other words, either the model or the camera should be moved out of origo.
-Trond
|
|
|
|
|
7
|
Java Game APIs & Engines / Java 3D / Re: Create smooth curve with interpolation (Vecmat
|
on: 2004-11-11 12:00:45
|
To draw a (cubic) bezier curve you'll need at least four control points, since each section will make use of four of them to approximate the curve. (EDIT: bad sentence) In the following code, we're inside a loop calculating each curvepoint based on the controlpoints. First controlpoint is p_start, and the last is p_start+3. The variable l_t is the interpolator from the bezier curve section start and the bezier curve section end. The interpolator must be increased by the delta distance per curvesegment, which will be 1/sectionsegments. The next bezier section (not to be confused with a curve-section here) will start at p_start+3 and end at p_start+6, four points. (EDIT: I wrote +7...) To understand the bezier equation completely, you should make a google search on it. 1 2 3 4 5 6 7 8
| m_curvepoints[l_curpoint].x = (int)(m_controlpoints[p_start+0].x*(1-l_t)*(1-l_t)*(1-l_t) + m_controlpoints[p_start+1].x*3.0*l_t*(1-l_t)*(1-l_t) + m_controlpoints[p_start+2].x*3.0*l_t*l_t*(1-l_t) + m_controlpoints[p_start+3].x*l_t*l_t*l_t); m_curvepoints[l_curpoint].y = (int)(m_controlpoints[p_start+0].y*(1-l_t)*(1-l_t)*(1-l_t) + m_controlpoints[p_start+1].y*3.0*l_t*(1-l_t)*(1-l_t) + m_controlpoints[p_start+2].y*3.0*l_t*l_t*(1-l_t) + m_controlpoints[p_start+3].y*l_t*l_t*l_t); |
If this doesn't help, or doesn't make any sense, I can upload the entire source so you can read through it yourself  Was this even close to what you were thinking of? -Trond
|
|
|
|
|
8
|
Java Game APIs & Engines / Java 3D / Java3D - Z-buffer clearing and frame drawing
|
on: 2004-11-10 09:38:56
|
|
I was wondering if it is possible to clear the z-buffer in Java3D, to make use of i.e. skyboxes...
Also, I have not figured out how to completely redraw a scene in one frame, in other words: is it possible to redraw the scene manually, without Java3D having to do it in a separate thread? Java3D's way of redrawing the scenegraph often makes animations look choppy as it doesn't seem to update all vertex positions each frame. And I understand that, because how should it know that the frame is done? I saw someone mentioning the use of behaviours...?
-Trond
|
|
|
|
|
10
|
Java Game APIs & Engines / Java 3D / ASE Loader
|
on: 2004-11-08 20:53:49
|
I have an ASE Loader that I would like to see if anyone found useful. It has a few built-in features such as basic collision detection and interpolated animation support. It would be nice if anyone would give me some feedback  If you're interested in checking the thing out, its located at http://home.no.net/tabusd/. The complete source code is available for download as well. Thanks for your time, -Trond
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|