Getting mesh from node
-
- Posts: 322
- Joined: Tue Aug 30, 2005 10:34 am
- Location: slovakia
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^
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^
-
- Posts: 6
- Joined: Fri Oct 27, 2006 9:39 pm
Yes, that's all it is.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" />?
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: 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?
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: 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.)
Not familiar with metaSelector, sorry. I've only been using Irrlicht a couple of weeks, for a specific project.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?
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
just after:
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
- 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?
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" />
Code: Select all
<bool name="IsDebugObject" value="false" />
Code: Select all
<userData>
<bool name="IsWall" value="true" />
</userData>
I can think of three ways you could have answered this yourself...
- look at the example.irr file that comes with the LoadIrrFile example.
- used your serializer to write out a scene file and look at what it created.
- use the debugger or just look at the code.
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
I think you may need access to a time machine to go back and solve Paradigm's problem in 2006.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way