Jump to content
  • Advertisement
Sign in to follow this  

Create Deep-Copy from dx-sdk animation Class

This topic is 2058 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ?

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites

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 .

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!