C++ questions on sharing structs from classes.
Posted: Wed Jul 06, 2016 1:38 am
Hi.
I'm trying to change the way Irrlicht deal with bone animations. Questions are 100% related to C++
If this work, then we could have each animated scene node, have it's own data for each instance of a model. Used with "useAnimationFrom" (will need a version of this command in the AnimatedSceneNode to make this work too). So users could set animations on multiple instances of the same model quite easily. I just not sure on C++ way of doing this.
Since this should only affect the bone animations, it should not interfere with Hardware skinning when it's implemented. (hopefully)
Right now:
- Loader load the animation data in the mesh (Skinnedmesh class)
- Bone animation is stored and used to playback in the mesh (Skinnedmesh class), it's currently stored in an array named AllJoints (based on the SJoint struct)
- Each instance of the mesh refer to the same data, data is referenced not copied from node to node.
- The information is stored in a struct named SJoint inside the Skinnedmesh class
The SJoint struct is defined in the include header file: ISkinnedMesh.h
What I would like to do:
- Loader load the animation data in the mesh (Skinned mesh) (no change)
- Bone animation is referenced, and playback outside the mesh (AnimatedSceneNode class)
- When the node is instanced, it copies the data from the Skinned mesh to the AnimatedSceneNode container preferably called the same (AllJoints)
- The information is stored in a struct named SJoint inside the AnimatedSceneNode class
Questions:
1. Do I have to create the same struct inside the other class (AnimatedSceneNode)? Or there is a easier method?
2. Do I have to create getter and setter to transfert(copy) the data(array) from the SkinnedMesh class to the AnimatedSceneNode class?
3. How can I tell the SkinnedMesh class to refer to the data in the AnimatedSceneNode Class. AnimatedSceneNode sending a reference to it's own data to use? The playback of the bone animation is done in the SkinnedMesh class. The playback need to refer to AllJoints in the Animated scene node class and not use the one in the skinnedmesh class.
I'm trying to change the way Irrlicht deal with bone animations. Questions are 100% related to C++
If this work, then we could have each animated scene node, have it's own data for each instance of a model. Used with "useAnimationFrom" (will need a version of this command in the AnimatedSceneNode to make this work too). So users could set animations on multiple instances of the same model quite easily. I just not sure on C++ way of doing this.
Since this should only affect the bone animations, it should not interfere with Hardware skinning when it's implemented. (hopefully)
Right now:
- Loader load the animation data in the mesh (Skinnedmesh class)
- Bone animation is stored and used to playback in the mesh (Skinnedmesh class), it's currently stored in an array named AllJoints (based on the SJoint struct)
- Each instance of the mesh refer to the same data, data is referenced not copied from node to node.
- The information is stored in a struct named SJoint inside the Skinnedmesh class
The SJoint struct is defined in the include header file: ISkinnedMesh.h
What I would like to do:
- Loader load the animation data in the mesh (Skinned mesh) (no change)
- Bone animation is referenced, and playback outside the mesh (AnimatedSceneNode class)
- When the node is instanced, it copies the data from the Skinned mesh to the AnimatedSceneNode container preferably called the same (AllJoints)
- The information is stored in a struct named SJoint inside the AnimatedSceneNode class
Questions:
1. Do I have to create the same struct inside the other class (AnimatedSceneNode)? Or there is a easier method?
2. Do I have to create getter and setter to transfert(copy) the data(array) from the SkinnedMesh class to the AnimatedSceneNode class?
3. How can I tell the SkinnedMesh class to refer to the data in the AnimatedSceneNode Class. AnimatedSceneNode sending a reference to it's own data to use? The playback of the bone animation is done in the SkinnedMesh class. The playback need to refer to AllJoints in the Animated scene node class and not use the one in the skinnedmesh class.