Page 2 of 2

Posted: Mon Nov 06, 2006 1:26 pm
by needforhint
yes, but I consider a pointer to an object as the object itself 8) I know there is only one instance of mesh and its buffers but all scene nodes with a mesh has a NULL or not NULL pointer to IMesh no?

Posted: Mon Nov 06, 2006 5:20 pm
by hybrid
But we also have to consider those scene nodes which do not have a mesh. And thus it is only added to the meshSceneNode types.

Posted: Mon Nov 06, 2006 8:40 pm
by rogerborg
FYI, IMeshSceneNode::getMesh() and IAnimatedMeshSceneNode::getMesh() have been added in svn 277, huzzah.

Posted: Tue Nov 07, 2006 7:29 pm
by Paradigm^
It seems that what I'm trying to do is the same as the original poster - namely, get collision data from a .irr file. However, most of the explanations in this thread have gone over my head - could someone explain to me what I need to do?

Basically, the things I don't understand are:
1. What is userdata and how do I add it to the .irr file? Is it just an extra XML attribute for each node, e.g. <bool name="GouraudShading" value="true" />?
2. When I'm subclassing scene::ISceneUserDataSerializer, am I right in thinking I need to use findAttribute on the userdata to get the attribute index I want, then look it up using getAttributeAsBool?
3. How do I access the IMeshSceneNode from the ISceneNode to be able to use getMesh() and add it to the metaSelector? (I believe this is the original poster's question, which, if it's been answered, I've completely missed.)
4. Any suggestions on how to get the metaSelector from my subclass into the scene manager - should I just pass (a pointer to!) the scene manager in as a parameter in the constructor?

A general whinge: why is the API on the Irrlicht website still at v1.0? It's taken me until today to find the v1.1 API, and I only found it now because someone in this topic mentioned looking at the 1.1 help file. Until then I'd been wondering why loadScene was mentioned in tutorial 15 but not documented!

And finally, apologies to rogerborg and JP for randomly adding them to my MSN contacts, I was hoping they'd take pity and give me a hand :p

Cheers,
-Paradigm^

Posted: Wed Nov 08, 2006 2:49 am
by BernieRoehl
Paradigm^ wrote: 1. What is userdata and how do I add it to the .irr file? Is it just an extra XML attribute for each node, e.g. <bool name="GouraudShading" value="true" />?
Yes, that's all it is.
Paradigm^ wrote: 2. When I'm subclassing scene::ISceneUserDataSerializer, am I right in thinking I need to use findAttribute on the userdata to get the attribute index I want, then look it up using getAttributeAsBool?
There are methods on attributes objects (like the userData parameter) that let you look up the attribute by name. Caution, though -- the documentation is not always correct. For example, getAttributeAsString(attrname) does not return NULL if the named attribute is absent. Instead, it returns a string of zero length. I understand why they do that, but the documentation needs to be updated.
Paradigm^ wrote: 3. How do I access the IMeshSceneNode from the ISceneNode to be able to use getMesh() and add it to the metaSelector? (I believe this is the original poster's question, which, if it's been answered, I've completely missed.)
I believe you can case the ISceneNode to an IMeshSceneNode, and then (in svn version, though not in the 1.1 version) use the newly-added getMesh() method.
Paradigm^ wrote: 4. Any suggestions on how to get the metaSelector from my subclass into the scene manager - should I just pass (a pointer to!) the scene manager in as a parameter in the constructor?
Not familiar with metaSelector, sorry. I've only been using Irrlicht a couple of weeks, for a specific project.

Posted: Sat Nov 11, 2006 7:59 pm
by Paradigm^
Thanks, it feels like I'm 90% of the way there now. However...

My OnReadUserData function doesn't seem to be being called! I've created a class which extends ISceneUserDataSerializer and the first thing in it is a cout (just to test it's working). No luck! I've added

Code: Select all

<bool name="IsWall" value="true" />
just after:

Code: Select all

<bool name="IsDebugObject" value="false" />
in the .irr file, but it doesn't seem to be taking any notice of the fact that there's some userdata there. Or do I have to do something like

Code: Select all

<userData>
<bool name="IsWall" value="true" />
</userData>
- if so, where? I've done a little fiddling and found that it doesn't seem to mind the userData tags, but it's still not paying attention to stuff between them. What is it I'm doing wrong?

Posted: Sat Nov 11, 2006 8:54 pm
by vitek
I can think of three ways you could have answered this yourself...
  1. look at the example.irr file that comes with the LoadIrrFile example.
  2. used your serializer to write out a scene file and look at what it created.
  3. use the debugger or just look at the code.
All three methods would work just fine. Asking the question on the forums is a bit...

Posted: Thu Nov 29, 2007 6:05 pm
by Vsk
Why don't just add a "isMeshNode" or something like that for solve this problem?

Posted: Thu Nov 29, 2007 6:20 pm
by rogerborg
I think you may need access to a time machine to go back and solve Paradigm's problem in 2006. ;)