Jump to content

  • Log In with Google      Sign In   
  • Create Account


Create Deep-Copy from dx-sdk animation Class


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 hserver   Members   -  Reputation: 142

Like
0Likes
Like

Posted 29 April 2013 - 12:15 AM

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 ?
 



Sponsor:

#2 hserver   Members   -  Reputation: 142

Like
0Likes
Like

Posted 29 April 2013 - 11:17 AM

Any idea?

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



#3 ankhd   Members   -  Reputation: 1104

Like
0Likes
Like

Posted 29 April 2013 - 09:21 PM

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.

#4 hserver   Members   -  Reputation: 142

Like
0Likes
Like

Posted 30 April 2013 - 12:51 AM

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 .



#5 ankhd   Members   -  Reputation: 1104

Like
0Likes
Like

Posted 30 April 2013 - 02:36 AM

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.



#6 unbird   Crossbones+   -  Reputation: 4829

Like
1Likes
Like

Posted 30 April 2013 - 03:09 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS