Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Convert Xith TriangleArray to Odejava Trimesh  (Read 2692 times)
0 Members and 1 Guest are viewing this topic.
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Posted 2005-04-14 16:50:34 »

Has anyone a function to do that ?

I tried to write my own function, but it seems not to treat all the vertices...

Or has anyone detailed informations on how TriangleArrayS are working ?

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline ewills

Junior Member




Java skeletal animation systems rock!


« Reply #1 - Posted 2005-04-14 22:25:25 »

For an IndexedTriangleArray with normals, I just do:
 geomMesh = new GeomTriMesh("floor", ga.getCoordRefFloat(),
                              ga.getNormalRefFloat(),
                              ((IndexedGeometryArray)ga).getIndex());

Edit:
You sould also grab the newest Odejava from CVS.  It resolves a GeomTriMesh issue.
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #2 - Posted 2005-04-15 13:02:56 »

Quote
For an IndexedTriangleArray with normals, I just do:
 geomMesh = new GeomTriMesh("floor", ga.getCoordRefFloat(),
                              ga.getNormalRefFloat(),
                              ((IndexedGeometryArray)ga).getIndex());

Edit:
You sould also grab the newest Odejava from CVS.  It resolves a GeomTriMesh issue.

Thank you very much.
I will try it as soon as possible.
I think "ga" mean GeometryArray and is a TriangleArray ?
Are the "getCoordRefFloat()" and "getNormalRefFloat()" new functions in Xith3D ? ( I will upgrade to last binaries, but for instance I'm using an old version ).
What is the bug that is resolved about TriMeshS in Odejava ?
I've seen a bug with negative Z values in an Odejava forum thread, but this isn't what I've experienced.
The bug I have is that my terrain ( a GeomTriMesh ) generate collisions only on a part of it.
When I move my character on the terrain, at the half of the terrain, my character fall through it...

But I will try your solution and update to the latest versions of Xith and Odejava, and I will see what happen !

Thanks !

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ewills

Junior Member




Java skeletal animation systems rock!


« Reply #3 - Posted 2005-04-15 15:56:24 »

ga is a GeometryArray.  I don't think getCoordRefFloat() and getNormalRefFloat() are new (not in the last 9 months or so).  The GeomTriMesh bug in OdeJava had to do the vertexString and triangleStride used for the vertex and index arrays and was causing the ODE TriMesh to be interpreted differently than the specified OdeJava GeomTriMesh (this at least partially explains the holes in your mesh).
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #4 - Posted 2005-04-15 16:59:11 »

Thanks ewills...

Also I have another "problem".
I've grabbed the latest Odejava from cvs, but I can't compile it...
I have an "evil" (Grin) error message :
bluesky@dhcppc1:/mnt/hda6/Programmation/Java/latest-odejava/odejava/odejava/compile $ ./make-gcc.sh
[Testing env variable. The next line should print the location of your java installation (eg. /usr/java/j2sdk1.4.2/)]
/usr/lib/sun-j2sdk1.5.0/
[registering JAVA_INCLUDE path]
/usr/lib/sun-j2sdk1.5.0//include
[removing old files]
[Compiling Odejava swig]

[creating ODE-lib]
(... all right)
[creating libodejava.so]
../odejava/odejava_wrap.cxx: Dans function « void
  Java_org_odejava_ode_OdeJNI_dGeomGetQuaternion(JNIEnv*, _jclass*, long long
  int, long long int) »:
../odejava/odejava_wrap.cxx:769: error: cannot convert `float*' to `dReal*' in
  assignment
(...a lot of others convertions errors)
g++: ../odejava/odejava_wrap.o : Aucun fichier ou répertoire de ce type


Can you help me ?

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline ewills

Junior Member




Java skeletal animation systems rock!


« Reply #5 - Posted 2005-04-15 19:12:54 »

ooo... I've never tried to compile the binaries.  Do you need to?  You should be able to use the latest OdeJava from CVS (compile with ant) with the most recent binaries.
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #6 - Posted 2005-04-23 07:23:01 »

Okay, I used the latest binaries.
But there is a problem anymore : the collision detection seems to work well, but it don't seems to act properly. Maybe should I try dContactApprox1 ?

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline ewills

Junior Member




Java skeletal animation systems rock!


« Reply #7 - Posted 2005-04-23 17:58:07 »

Yes. I use dContactApprox1.
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #8 - Posted 2005-04-25 09:18:32 »

I have a lot of problems with terrain interaction...

Aaahhh.... maybe I won't use anymore Odejava because of that...

It's really irritating : I move some cubes (~50) on a surface ( TriMesh ). They slide normally, but sometimes, there's one that fall through the terrain. And one minute after the beginning, well there's no more cube on the surface !

I will try to prepare a .jar file so you can see the problem yourself.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #9 - Posted 2005-05-01 01:38:31 »

the good news is that ODE has an UNSTABLE branch now which seems to be getting weekly patches.  Most of them seem to be related to tri-mesh stuff so let's hope they make it a bit more stable.

I agree with you, it can be annoying.

There are some tricks, like making sure your terrain has positive Y values.

Will.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ewills

Junior Member




Java skeletal animation systems rock!


« Reply #10 - Posted 2005-05-01 18:37:51 »

Try grabbing the latest odejava from CVS.  I just now committed a change that improves TriMesh performance.
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #11 - Posted 2005-05-02 16:42:29 »

Yes, I've seen on the Odejava board that both TriStride and VertexCount were wrong. Okay, so I'll grab it and try.

However, my terrain work a bit well since I changed from dContactApprox1 to dContactApprox0.

The unstable branch of ode is really a good thing.

Here I would just thank all Linux, Java, OpenGL, JOGL, Xith3d, ODE, Odejava... developers to make so many things in the open-source world possible !

Personally I'm doing a little improvement by "merging" ( unofficially ) Xith3D and Odejava.

I think it's an interesting stuff.. Just think the power of creating an object like this :
1  
Immobile ground = new Immobile("Herb", new Point3f(0f,0f,0f), new Point3f(0f,0f,0f), "Data/Herb.obj", Immobile.TriMesh );

You define the name, the position, the rotation, the graphic data, and the physic representation of an object just in the constructor.
And here's a little enemy example :
1  
Mobile robot = new Mobile("Robot", new Point3f(5f,8f,2f), new Point3f(0f,0f,90f), "Data/Robot.3ds", Mobile.Cube, "Robot", "100" );

Here you define the name, the position, the rotation, the graphic data, the physic representation, the behavior, and the behavior parameter of the object. And there is a Robot class ( child of Behavior ), of course.

And now think you can load all these datas from a file.
And think you have a World editor to edit all this graphically and user-friendly. What's more, you can edit the World separetely from the game code, because we don't need to instance the behaviors classes to place objects. So it's easy separe task to organize projects.

And think you have a ton of other stuff to manage graphics, IA, sound, UI... And you have thinked of Gamma.

Your feedback would be appreciated.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline arne

Senior Member




money is the worst drug- we should not let it rule


« Reply #12 - Posted 2005-05-02 17:48:48 »

yup nice one Smiley But I think it's a bit limited. As an example how do you want to animate your robot? There has to be interaction between the class controlling the objects and the mesh itself.

:: JOODE :: Xith3d :: OdeJava ::
Offline ewills

Junior Member




Java skeletal animation systems rock!


« Reply #13 - Posted 2005-05-02 19:37:06 »

What are the semantics of dContactApprox0?  I don't see it in the ODE user's guide...
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #14 - Posted 2005-05-03 12:06:57 »

By the way, you can use this method that I created:

org.odejava.xith3d.Xith3DToOdejava

1  
public static GeomTriMesh createTriMesh(com.xith3d.scenegraph.TriangleArray array, String name);


I use it in conjunction with a heightmap generator.  Works great, my vehicles stay on the trimesh no worries.

ewills, thanks for the bugfix btw  Grin

Cheers,

Will.

Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #15 - Posted 2005-05-03 16:27:20 »

Quote
By the way, you can use this method that I created:

org.odejava.xith3d.Xith3DToOdejava

1  
public static GeomTriMesh createTriMesh(com.xith3d.scenegraph.TriangleArray array, String name);


I use it in conjunction with a heightmap generator.  Works great, my vehicles stay on the trimesh no worries.

Will.


Yes, in fact I inspired me from that code and I integrated it in Gamma, just adding a splitter for large terrains ( < 10 000 triangle ).

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #16 - Posted 2005-05-03 16:45:58 »

Arne, you can do something like that in Gamma :
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
MD2Model md = null;

public void init ( Mobile m, String s ) {
  md = (MD2Model) findObject( m.bg, "MD2Model" );
}

public void step () {
  if( isWalking ) {
    md.setAnim("walk");
    m.advance(); // Gamma function
 }
}


So it's not limited as you thinked. Note that the findObject(Group g, String type ) method look for an object in the group g of the class type.

And something I've forgotten to say : Behavior can send messages from one to another. It's really useful :
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  
class Door extends Behavior {
  public static final int OPEN = 0;
  public static final int CLOSE = 1;
  public boolean opened = false;
 
  public void sendMessage( int m, string s ) {
    if( m == OPEN ) {
      opened = true;
      m.setPos( initialPos.x, initialPos.y, initialPos.z+2 );
    }
    if( m == CLOSE ) {
      opened = false;
      m.setPos( initialPos.x, initialPos.y, initialPos.z );
    }
  }

}

class Player extends Behavior {
  step() {
    for( Object o : uni.lCollision ) {
      if( o instanceof CollisionMM ) {
        CollisionMM cmm = (CollisionsMM) o;
        if( cmm.mobile1 == this && cmm.mobile2.getName().startsWith("Door") {
          cmm.mobile2.sendMessage( Door.OPEN, "" );
        }
      }
    }
  }
}


So what do you think of that ?

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline arne

Senior Member




money is the worst drug- we should not let it rule


« Reply #17 - Posted 2005-05-03 17:18:54 »

Ok so you manage animations and movents outside the Behaviors. The Behaviors so merely handle communications and other not geometry applying stuff. I thought you were doing this stuff also inside the Behavior classes.

Quote

So what do you think of that ?

Nice  Cheesy Cheesy

:: JOODE :: Xith3d :: OdeJava ::
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #18 - Posted 2005-05-04 17:54:00 »

I think it would be good to use it for SpaceBomber but there is one main problem : SpaceBomber is precisely an example on how to use Odejava and Xith3D...

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline arne

Senior Member




money is the worst drug- we should not let it rule


« Reply #19 - Posted 2005-05-04 20:01:44 »

... and not an example of how to use gamma. In the case of Spacebomber things should be also simple enough, so gamma won't be needed anyways.

:: JOODE :: Xith3d :: OdeJava ::
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #20 - Posted 2005-05-07 09:09:02 »

Quote
... and not an example of how to use gamma.

Yes.
Quote
In the case of Spacebomber things should be also simple enough, so gamma won't be needed anyways.

You're right.

All the roles arne, picked_up_a_gun and willdeniss have requested are now approved.

I have problems with CVS, but I will fix it soon.

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline DonCrudelis

Junior Member





« Reply #21 - Posted 2005-05-07 17:00:46 »

Hi all!  Smiley
Sorry for my inactivity.. I have been away for a while now.
It seems like I can't join spacebomber.java.net  Huh
How do I do?

Thanks in advance.

Alonzo
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #22 - Posted 2005-05-09 16:09:55 »

You should wait until the projet is approved.

SpaceBomber's-related discussions shouldn't be here, but there : http://www.magicspark.org/~willadv/xith/

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (23 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
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!