Horde3D
http://horde3d.org/forums/

Horde3D and ODE
http://horde3d.org/forums/viewtopic.php?f=2&t=581
Page 1 of 1

Author:  Booomy [ 14.12.2008, 13:46 ]
Post subject:  Horde3D and ODE

Hello everyone!
I have the following question:
I want to use ODE for simulating my physics. Since there is a possibility to load mesh data into ODE, I want to access the my resource data from Horde3D and pass it to ODE so that it can do its magic with it.
I don't know if a lot of people have experiencein doing that but would that be the right approach of doing this?
My other question is:
If I use the functions

Code:
const void* data = Horde3D::getResourceData(modelRes, GeometryResParams::VertexData);


and

Code:
int size = Horde3D::getResourceParami(modelRes, GeometryResParams::VertexCount);


the returned values are always 0. I debugged into the library and found that I always reach this point in the Horde lib:

Code:
int Resource::getParami( int /*param*/ )
{
   return 0;
}


Before doing that I loaded the resources properly and if I query whether it's been loaded true is being returned. I can also use it with Horde and display everything just fine. Only accessing the resource data and it's properties seems to go wrong.

Does anybody have a suggestion what I'm doing wrong?

Thanks in advance

Author:  Volker [ 14.12.2008, 19:17 ]
Post subject:  Re: Horde3D and ODE

The model does not have geometry data itself. So you have to call getResourceData on the geometry resource handle not on the model resource (what I guess is the scene graph resource in your case).

Author:  marciano [ 14.12.2008, 23:08 ]
Post subject:  Re: Horde3D and ODE

Please check also Voker's Bullet integration sample that is linked on the downloads site.

Author:  Booomy [ 15.12.2008, 11:34 ]
Post subject:  Re: Horde3D and ODE

Wicked!
Thanks, it works now

Author:  SpOOky [ 19.03.2009, 13:44 ]
Post subject:  Re: Horde3D and ODE

Volker wrote:
The model does not have geometry data itself. So you have to call getResourceData on the geometry resource handle not on the model resource (what I guess is the scene graph resource in your case).


how do you acces the geometry resource handle for a given scene graph resource?

Author:  Volker [ 19.03.2009, 14:20 ]
Post subject:  Re: Horde3D and ODE

Did you tried
Code:
Horde3D::getResourceParami( sceneGraphHandle, ModelNodeParams::GeometryRes );
?

Author:  SpOOky [ 19.03.2009, 15:36 ]
Post subject:  Re: Horde3D and ODE

yes... but it returns 0

this the code
Code:
ResHandle podRes = Horde3D::addResource(ResourceTypes::SceneGraph, "models/pod/pod.scene.xml", 0 );
Horde3DUtils::loadResourcesFromDisk( _contentDir.c_str() );
NodeHandle pod = Horde3D::addNodes(RootNode, podRes);

int v = Horde3D::getResourceParami(Horde3D::getResourceParami( pod, ModelNodeParams::GeometryRes ) , GeometryResParams::VertexCount);

i've tryed with both the node and the res handle, but still it yields 0. the actual piece of geometry draws fine.

Author:  Volker [ 19.03.2009, 15:41 ]
Post subject:  Re: Horde3D and ODE

pod is not a resource. You have to use podRes. Did you tried to debug into it? Could the resouce be loaded? Are there any errors in the log?

Author:  SpOOky [ 19.03.2009, 15:54 ]
Post subject:  Re: Horde3D and ODE

i have tryed with both of them (pod and podRes), thinking i understood it wrong. in both cases v = 0

i know v's value by placing a breakpoint after the code i've posted earlyer and placed the variable in watch. the resource is loaded (podRes is not null and there aren't any errors in the log. plus i know it is loaded because i can see the model when i run the app without debugging)

Author:  Volker [ 19.03.2009, 17:02 ]
Post subject:  Re: Horde3D and ODE

Does
Code:
Horde3D::getResourceParami( podRes, ModelNodeParams::GeometryRes )

return a valid resource handle?
If not the problem must be somewhere in the geometry data resolving code. If yes, the problem must be in the vertex count.

Do you use LODs? Maybe there is still a bug somewhere. I currently don't have a running example on this computer so I can't digg into it further.

Author:  SpOOky [ 19.03.2009, 17:11 ]
Post subject:  Re: Horde3D and ODE

The returned ResHandle is equal to 0. This is werid as podRes is not null.

The code is added to the chicago sample. I haven't added LODs.

Author:  Volker [ 19.03.2009, 17:15 ]
Post subject:  Re: Horde3D and ODE

Well podRes is only the scene graph resource, that does not mean necessarily, that the scene graph has also a valid geometry resource, although it should have one, if you can see your model. I will have a look at it this evening.

Author:  SpOOky [ 19.03.2009, 17:22 ]
Post subject:  Re: Horde3D and ODE

thanks for the assistance. i'm looking forward for your next reply

Author:  Volker [ 19.03.2009, 18:43 ]
Post subject:  Re: Horde3D and ODE

well I should have think about it before answering.
ModelNodeParam is a param that can be requested only for nodes (that's why it is called ModelNode and not ModelRes). Therefore the correct solution should be

Code:
   ResHandle geoRes = Horde3D::getNodeParami( pod, ModelNodeParams::GeometryRes );
   int v = Horde3D::getResourceParami( geoRes, GeometryResParams::VertexCount );

Author:  SpOOky [ 20.03.2009, 00:04 ]
Post subject:  Re: Horde3D and ODE

thanks for the solution :)

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/