Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Jul 2006
Offline Last Active Aug 08 2013 09:19 AM

Topics I've Started

Create Deep-Copy from dx-sdk animation Class

29 April 2013 - 12:15 AM

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 ?

project and scale 3D object to 2d screen space

11 November 2012 - 12:07 PM

I have a function that already project a 3d point into my screen whitch I want to share with you !

Public Function GetScreenCoordBy3DPoint(ByRef RetX As Single, ByRef RetY As Single, ByRef Px As Single, ByRef Py As Single, ByRef Pz As Single, ByRef RetdistZ As Single) As Object
	    Dim MatView As Matrix
	    Dim matProj As Matrix
	    Dim RetVec As Vector3
	    Dim Vec1 As Vector3
	    Vec1.X = Px
	    Vec1.Y = Py
	    Vec1.Z = Pz
	    Dim tViewPort As Direct3D.Viewport ' DxVBLibA.D3DVIEWPORT8
	    Dim IdentMat As Matrix
	    IdentMat = Matrix.Identity
	    MatView = D3DDevice9.GetTransform(Direct3D.TransformType.View)
	    matProj = D3DDevice9.GetTransform(Direct3D.TransformType.Projection)
	    'd3ddevice9.GetTransform D3DTS_WORLD, IdentMat
	    tViewPort = D3DDevice9.Viewport
	    RetVec = Vector3.Project(Vec1, tViewPort, matProj, MatView, IdentMat)
	    RetX = RetVec.X
	    RetY = RetVec.Y
	    RetdistZ = RetVec.Z
    End Function
I want to render a 3d mesh and prevent its scaling when it go far from camera
any suggestion how should I scale it ??
sorry for bad EN

simple texture filtering problem

17 April 2011 - 09:11 AM

Hi everyone
take a look at my attachs the first one is a shot form our game in a test pc the second file is in my own pc what works fine
any idea what is wrong?


24 April 2010 - 09:43 PM

hi take a look at my reflection code: Dim Mat As D3DMATRIX, mat2 As D3DMATRIX D3DDevice.GetTransform D3DTS_VIEW, Mat D3DDevice.GetTransform D3DTS_WORLD, mat2 D3DXMatrixInverse Mat, 0, Mat Mat.m41 = 0# Mat.m42 = 0# Mat.m43 = 0# Mat.m44 = 0# D3DDevice.SetTextureStageState 1, D3DTSS_COLOROP, D3DTOP_ADD D3DDevice.SetTextureStageState 1, D3DTSS_COLORARG1, D3DTA_TEXTURE D3DDevice.SetTextureStageState 1, D3DTSS_COLORARG2, D3DTA_CURRENT D3DDevice.SetTextureStageState 1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3 D3DDevice.SetTransform D3DTS_TEXTURE1, Mat D3DDevice.SetTexture 1, MeshCubeTex(FoundMeshCubeTexID) D3DDevice.SetTextureStageState 2, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE If TheMesh.AdvanceTex(PassNo).TexEffect = 4 Then D3DDevice.SetTextureStageState 1, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR Or 1 this Reflection works just fine when i do no scale or rotate on my mesh (D3DTS_WORLD is Identity) but when i transform my mesh it show a bad Reflection I also try . . . . D3DDevice.GetTransform D3DTS_WORLD, mat2 D3DXMatrixMultiply Mat, Mat, mat2 D3DXMatrixInverse Mat, 0, Mat Mat.m41 = 0# . . . . . it's not working too what i have to do!?

Sceen capture is slow using GetFrontBuffer

14 February 2010 - 04:34 AM

Hi I want to capture my Directx8 screen and do some "Image Processing" on it . i'm using pDev->GetFrontBuffer(surf) to access screen pixels but this is quite slow , any idea to make it faster?