Starting from the DynamicGeometry sample I am trying to make a class that will add even more geometry to the scene. As far as I see everthing (except for the camera which looks like instantiated on the “context”) all new nodes must be added to the “scene_” object. Unfortunately all samples create the entire scene in the CreateScene() function. I would like to add a bit more structure to this for my project and separate objects groups into their own classes.
My own class should have a “parent” Node* to which I add the new objects. However none of my approaches succeeds.
Attempt #1: Pass “scene_” as the parent node argument fails due to scene being a the shared_ptr. (Incomplete type…). Maybe my mistake since my experience with shared_ptrs is … little. Same happens upon dereferencing the scene_ shared_ptr and passing this as a “normal” pointer.
Attempt #2: Add an empty Node* to the scene_ and pass this to my class as the parent: Upon calling "m_parent->CreateChild(“MyOwnObject”); does nothing and simply crashes the application without any error message.
Can someone point out what I am doing wrong here? Am I mixing up Node and Component somehow?
Bonus question (before I have to start a new thread for this): Is it possible to manually create a Material in code using an arbitrary jpg/png anywhere on my harddisk? If so: How would I do this?