Getting mesh from node

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
needforhint
Posts: 322
Joined: Tue Aug 30, 2005 10:34 am
Location: slovakia

Post 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?
what is this thing...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

FYI, IMeshSceneNode::getMesh() and IAnimatedMeshSceneNode::getMesh() have been added in svn 277, huzzah.
Paradigm^
Posts: 6
Joined: Tue Oct 17, 2006 2:53 pm

Post 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^
BernieRoehl
Posts: 6
Joined: Fri Oct 27, 2006 9:39 pm

Post 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.
Paradigm^
Posts: 6
Joined: Tue Oct 17, 2006 2:53 pm

Post 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?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post 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...
Vsk
Posts: 343
Joined: Thu Sep 27, 2007 4:43 pm

Post by Vsk »

Why don't just add a "isMeshNode" or something like that for solve this problem?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

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
Post Reply