at the moment I try to port the FacialAnimation-Demo to ogre4j. The behaviour is that I first have to load the mesh and then
create a manual vertex-animation. Problem is, to create the vertex-anim I have to access the mesh but the load-method of MeshManager
only returns a MeshPtr. I searched the other samples about handling Pointers and did analogous.
I create a Mesh with the InstancePointer and this seems to work (or let's say it does not crash)
. e.g. I can create an IAnimation. At least there is a ref-id. Nevertheless if I use getNumSubMeshes()
it puts out an unrealstic number (which does not change if I change the mesh-file). Well, if I use
getName() it crashes. For sure the StringMapping is not working as I am at the wrong memory-location
or something like this!?
Here a part of the error-log(I post the complete log in a reply to this Topic):
My problem was that I used IMeshPtr for _mHeadMesh _ which don't have the magical :D .get() Method. So switching
to MeshPtr instead solved the problem for me. Now everything works as it should be.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
MeshPtr is in fact a C++ Ogre::SharedPtr<Mesh>. Mapping these to Java is not that easy.
To map C++ multiple inheritance to Java ogre4j generates a Java Interface for each C++ class. Usually that interfaces declare all the methods of their correspondig C++ class. But ogre4j does not do this for templates because it causes problems when type parameters are used as parameters or return types of methods.
So what you did is just right. Cast IMeshPtr to MeshPtr and use it's get() method.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hola,
at the moment I try to port the FacialAnimation-Demo to ogre4j. The behaviour is that I first have to load the mesh and then
create a manual vertex-animation. Problem is, to create the vertex-anim I have to access the mesh but the load-method of MeshManager
only returns a MeshPtr. I searched the other samples about handling Pointers and did analogous.
Here my try:
I create a Mesh with the InstancePointer and this seems to work (or let's say it does not crash)
. e.g. I can create an IAnimation. At least there is a ref-id. Nevertheless if I use getNumSubMeshes()
it puts out an unrealstic number (which does not change if I change the mesh-file). Well, if I use
getName() it crashes. For sure the StringMapping is not working as I am at the wrong memory-location
or something like this!?
Here a part of the error-log(I post the complete log in a reply to this Topic):
My question is how I access Instances for that I only have a pointer
and MeshPtr in particular.
cu, ToM
Ah, ok! I finally got it work.
My problem was that I used IMeshPtr for _mHeadMesh _ which don't have the magical :D .get() Method. So switching
to MeshPtr instead solved the problem for me. Now everything works as it should be.
MeshPtr is in fact a C++ Ogre::SharedPtr<Mesh>. Mapping these to Java is not that easy.
To map C++ multiple inheritance to Java ogre4j generates a Java Interface for each C++ class. Usually that interfaces declare all the methods of their correspondig C++ class. But ogre4j does not do this for templates because it causes problems when type parameters are used as parameters or return types of methods.
So what you did is just right. Cast IMeshPtr to MeshPtr and use it's get() method.