I'm using microsoft .x animation class:
Sub LoadAnim(ByVal fileName As String, ByVal .....) Dim alloc As New MyAllocateHierarchy RootFrame = Direct3D.Mesh.LoadHierarchyFromFile(fileName, Direct3D.MeshFlags.Managed, device, alloc, Nothing) .....
There is a robot animation artists created and I want to have 10 of them in my game so I use:
Public robot1AnimCLS As MySkinanim= New SkinMeshCLS.MySkinanim .... robot1AnimCLS.LoadAnim(CharPaths & "\Robot.X") robot2AnimCLS.LoadAnim(CharPaths & "\Robot.X") robot3AnimCLS.LoadAnim(CharPaths & "\Robot.X") . . . robot10AnimCLS.LoadAnim(CharPaths & "\Robot.X")
This works fine , But this is so time consuming( 10 sec for each of them).
you know robot2AnimCLS=robot1AnimCLS doesn't work beacuse they point to the same part of memory.
I also try shallow copy using:
robot2AnimCLS = DirectCast(robot1AnimCLS.ShallowCopy, MySkinanim)
where in my anim class :
Public Function ShallowCopy() As MySkinanim Return DirectCast(Me.MemberwiseClone(), MySkinanim) End Function
This Works Fine for some of my class peroperties but the BIG problem is:
Dim RootFrame As Direct3D.AnimationRootFrame
which I can't have a seperate copy of it
So it seems I need a deep copy of my class And I don't know how to do that without using:
Direct3D.Mesh.LoadHierarchyFromFile (which is time consuming...)
Any ideas how to create seperate copy of my robot animation?
Or am I wrong using deep copy ?