rifter1818 Posted May 25, 2004 Posted May 25, 2004 Ok i finnally got my skinning mesh to render, and now when i move on to the next stage (enter a battle in this case) all my other meshs, disapear, however if i rem out the Tiny.drawmesh 'tiny is my skinning mesh test case, the meshs render fine, however i cant find whats being changed, ive tried reseting everything i notice on the device being changed (transforms,renderstate) but this is to no avail. Public Sub drawMesh() DrawFrame(RootFrame.FrameHierarchy) End Sub Private Sub DrawFrame(ByRef frame As hFrame) Dim mesh As hMeshContainer = frame.MeshContainer While Not (mesh Is Nothing) DrawMeshContainer(mesh, frame) mesh = mesh.NextContainer End While If Not (frame.FrameSibling Is Nothing) Then DrawFrame(frame.FrameSibling) End If If Not (frame.FrameFirstChild Is Nothing) Then DrawFrame(frame.FrameFirstChild) End If End Sub Protected Overridable Sub DrawMeshContainer(ByRef mesh As hMeshContainer, ByRef frame As hFrame) Dim i As Integer If Not (mesh.SkinInformation Is Nothing) Then Dim attribIdPrev As Integer = -1 Dim iattrib As Integer For iattrib = 0 To mesh.numAttr - 1 Dim numBlend As Integer = 0 Dim bones() As BoneCombination = mesh.bones For i = 0 To mesh.numInfl - 1 If (bones(iattrib).BoneId(i) <> -1) Then numBlend = i End If Next If (iDev.DeviceCaps.MaxVertexBlendMatrices >= numBlend + 1) Then iDev.RenderState.VertexBlend = numBlend Dim offsetMatrices As Matrix() = mesh.offsetMatrices Dim frameMatrices() As hFrame = mesh.frameMatrices For i = 0 To mesh.numInfl - 1 Dim matrixIndex As Integer matrixIndex = bones(iattrib).BoneId(i) If (matrixIndex <> -1) Then Dim tempMatrix As Matrix = Matrix.Multiply(offsetMatrices(matrixIndex), frameMatrices(matrixIndex).cMat) iDev.Transform.SetWorldMatrixByIndex(i, tempMatrix) End If Next If ((attribIdPrev <> bones(iattrib).AttribId) Or attribIdPrev = -1) Then iDev.Material = mesh.GetMaterials()(bones(iattrib).AttribId).Material3D iDev.SetTexture(0, mesh.meshTextures(bones(iattrib).AttribId)) attribIdPrev = bones(iattrib).AttribId End If mesh.MeshData.Mesh.DrawSubset(iattrib) End If Next Else iDev.Transform.World = frame.cMat Dim mtrl() As ExtendedMaterial = mesh.GetMaterials Dim iMaterial As Integer For iMaterial = 0 To mtrl.Length - 1 iDev.Material = mtrl(iMaterial).Material3D iDev.SetTexture(0, mesh.meshTextures(iMaterial)) mesh.MeshData.Mesh.DrawSubset(iMaterial) Next End If End Sub Any Ideas whats getting changed (iDev is the device). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.