Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  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 Smiley 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 Smiley 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.zip

Note 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);

//Set vertex world position
           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));
     
//Set vertex texture coordinates
           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));

//Set vertex color
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));
           
//Set up appearance with texture
           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);

//Add quad to new (or existing) branchgroup
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 Smiley

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
6  Java Game APIs & Engines / Java 3D / Re: ASE Loader on: 2004-11-19 12:09:56
Thanks for the input! You're right, I didn't think about that. Certainly something to consider.

-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 Smiley

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
9  Java Game APIs & Engines / Java 3D / Re: Modify texture in real time on: 2004-11-09 14:28:35
Can't you split the texture up into several smaller textures so you don't have to edit the entire landscape's texture each time?

Just a thought...

-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 Smiley

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
11  Java Game APIs & Engines / Java 3D / Re: Terrain generation/following on: 2004-11-08 20:43:50
I have an ASE Loader that will allow you to follow terrain and check line collision against geometry. If you're interested in having a look, the address is: http://home.no.net/tabusd/.

The source code is also there, so it shouldn't be too hard to get the ideas and if necessary convert/modify it to fit your needs.

-Trond
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (55 views)
2014-04-15 18:08:23

BurntPizza (53 views)
2014-04-15 03:46:01

UprightPath (66 views)
2014-04-14 17:39:50

UprightPath (49 views)
2014-04-14 17:35:47

Porlus (66 views)
2014-04-14 15:48:38

tom_mai78101 (90 views)
2014-04-10 04:04:31

BurntPizza (151 views)
2014-04-08 23:06:04

tom_mai78101 (247 views)
2014-04-05 13:34:39

trollwarrior1 (204 views)
2014-04-04 12:06:45

CJLetsGame (211 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!