Create Deep-Copy from dx-sdk animation Class

Started by
4 comments, last by unbird 10 years, 11 months ago

Hi
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 ?

Advertisement

Any idea?

I hope someone else already used this class and face this problem.

If you render your mesh to a vertex buffer first, with the animation applied . You only need 1 mesh of that type of object for all the same meshes. This way the skinned mesh is rendered using the vertex buffer all ready transformed. I'm at work now I'll get back when I get home.
Look up instancing to vertex buffers.

If you render your mesh to a vertex buffer first...

Thanks for your answer .

I don't want to use that technology for this project.

don't forget that each robot may playing different position of track .

I already know what is instancing of a mesh , my problem is create a seperate copy of my animation class .

sorry got it wrong. need Dx 10 or above.

you use stream out. and yes each buffer has its own track being played.

anyway if your looping through the list of meshes when you render. All you would need to do is call each objects GetcurrentanimationSet(if you have this)then animate that mesh and then render.

but if they only have on track and you want to play the animations at a different time stamp.

Looking at the MultiAnimation sample from the SDK: It's using CloneAnimationController, maybe that's what you're looking for.

This topic is closed to new replies.

Advertisement