Custom scene node class?

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!
Post Reply
danielmccarthy
Posts: 51
Joined: Fri May 30, 2014 12:55 am

Custom scene node class?

Post by danielmccarthy »

I am trying to extend the IMeshSceneNode class but their are virtual functions such as setMesh and stuff.
I tried calling the base class from my class within the setMesh method so it would create the mesh but it had an undefined reference.

Can anyone tell me how to extend the IMeshSceneNode successfully.

The thing is I made a Map class which extends this and I want to be able to use all the methods I can use in the IMeshSceneNode as well as custom ones which I will make such as addObject(x, y, z).

Many Thanks,
Dan
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Custom scene node class?

Post by Seven »

if there is an interface called IMeshSceneNode, then there is probably a CMeshSceneNode class as well. It will implement the functions that you are talking about......
danielmccarthy
Posts: 51
Joined: Fri May 30, 2014 12:55 am

Re: Custom scene node class?

Post by danielmccarthy »

I did try to extend that but it was not found at least I think. It said something like class ... and some other stuff and the last time that happened it was because their was no reference for it I think. Their is how ever that file in the source of irrlicht so I will take it from their and put it in my project.

Thanks
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Custom scene node class?

Post by Seven »

you can add that folder to your include / source directories and then you can derive directly from those classes
lumirion
Posts: 79
Joined: Tue Sep 13, 2011 7:35 am

Re: Custom scene node class?

Post by lumirion »

Make a copy of IMeshSceneNode.h and rename it as your custom nodes name. Rename its refrences to IMeshSceneNode to your custom name. Derive from the IMeshSceneNode with
class CustomSceneNode : public IMeshSceneNode
but copy the implementations from CMeshSceneNode and paste them into the stubs of your CustomSceneNode.h or in a CustomSceneNode.cpp .
All functions provided in IMeshSceneNode must be implemented in your derived version. The function names and parameters must be the same but you can customize the implementations or add your own additional functions.
danielmccarthy
Posts: 51
Joined: Fri May 30, 2014 12:55 am

Re: Custom scene node class?

Post by danielmccarthy »

Hi guys I am getting an undefined reference to a printer class thing when extending that class. All the includes are put in that folder
Destructavator
Posts: 40
Joined: Sat Feb 06, 2010 9:00 pm
Location: Ohio, USA

Re: Custom scene node class?

Post by Destructavator »

Perhaps I can help, as for my own project I extend scene nodes of different types and create my own all the time.

Can you please:

- Copy and paste the exact error(s) from your compiler / linker here (If there are many, most likely only the first few lines would probably be relevant, the ones where it mentions the undefined reference)?

- Also, if you could copy and paste the header file for your custom scene node class here, or at least the parts you think it is complaining about, it could really help. (I'm not really concerned with the .cpp source file, just your header, especially the functions in the header and your exact syntax for them.)

BTW, make sure you are not just having the right files in available folders in the compiler or IDE's search path, but also that you #include the proper source headers as needed (Note that to #include "irrlicht.h" alone might not be enough in this specific case, as the main irrlicht header won't necessarily give you all the "C" prefixed classes and such, it mostly gives you just the ones from the files that start with "I" or "S", etc.).
- - - -
"Destructavator" Dave: Developer of OS GPL VST "ScorchCrafter" Audio Plug-ins, contributer to UFO AI, Day Job: Guitar Luthier (Customize musical instruments, repainting w/ custom artwork, graphics, logos, decals, etc.)
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Custom scene node class?

Post by mongoose7 »

He's probably referring to os::Printer::log, which requires a header. "A printer class thing" is just lazy - I guess he really doesn't want help?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Custom scene node class?

Post by CuteAlien »

There are very few reasons to copy the code of the implementations. Nearly always when you make custom scenenodes you will only need meshes and driver functions inside. Both of which are available as public interfaces.

Can't help more without knowing more details about what you are trying to do.

Also one general hint - give us as much information as you can when asking for help. When you got an error don't say I got an error that's like that and that - instead _always_ copy&paste the exact error. Preferably showing as well some code. Compiler and linker errors are already as minimal as they can be, so when you don't paste them completely you remove information which others need to help you.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
lumirion
Posts: 79
Joined: Tue Sep 13, 2011 7:35 am

Re: Custom scene node class?

Post by lumirion »

In my custom node I commented out the os::Printer::log bit. It only acted up in debug mode. I copied and pasted the implementations initially because I couldn't figure out how to get them to inherit. The linker kept erroring out, probably because I'm using irrlicht as a dll.
Post Reply