novousmihi

Member
  • Content count

    12
  • Joined

  • Last visited

Community Reputation

108 Neutral

About novousmihi

  • Rank
    Member
  1. [help] GetTickCount() problem

    Yay! It works! Thanks alot Kalten and Shaolinspin!
  2. [help] GetTickCount() problem

    Quote:Original post by shaolinspin Don't use GetTickCount(). It has low resolution, and will not give you accurate enough results. Use timeGetTime() instead. I was using GetTickCount() in my game to measure deltat between frames, and as a result the game used to stutter and jerk. I thought I was getting low frame rates and spent ages trying to work out what was wrong with my frame-rate timing code, and optimising my code. When I switched to timeGetTime() the game ran as smooth as I could ever wish for. Alright, You've all convinced me to switching to timeGetTime() ;D I'll let you know if I have the same problem there. If I do, I'll restart my computer and try again, but if that doesn't work and it too returns 0, then I'm out of ideas.
  3. [help] GetTickCount() problem

    But doesn't that mean that when it hits the maximum, it just resets to zero and continues like nothing happened? like, if 10 is the maximum it would wrap around like this: 6,7,8,9,10,0,1,2,3,4, 5,6,7,8,9,10,0,1,2,3, 4,5,... and not GetTickCount()==0 when it hits its maximum? I have put my computer into hybernation everyday, but I seldom do a restart. So I'll try that, but any other suggestions what might be wrong?
  4. [help] GetTickCount() problem

    I've never had this problem before and it makes no sense. When I call GetTickCount() it returns 0. Always. //General inclusdes..... void main() { Sleep(5000); printf("NrOfMilliseconds: %i", GetTickCount()); } It should print out the time in milliseconds since the computer was started, but it returns 0. Any suggestions what could be wrong? I'm trying to code a StopWatch-class and it isn't working when GetTickCount() return 0 all by itself :/ And no, it's not when i'm doing anything like: int diffTick = GetTickCout() - startTick; // diffTick == 0 because the computer is too fast, high-resolution timer is needed. like I've seen many have a problem with. My problem is that a call to GetTickCoun() all by itself returns 0. Always. Any suggestions?
  5. found the problem, after 2 days excessibe programming. The problem was I used the pos[..] information from the ms3D spec. I should have used the floats 41 to 43 in the mFinal matrix for each joint as the coordinate information.
  6. [help] problem rendering bones in Dx9

    found the problem, after 2 days excessibe programming. The problem was I used the pos[..] information from the ms3D spec. I should have used the floats 41 to 43 in the mFinal matrix for each joint as the coordinate information.
  7. MS3D - Problem displaying the Bones

    Quote:Original post by Caste I didn't look into MS3D recently, but from what you get it seems as if the child bone positions are relative to the parent's position (and probably orientation). Thus you might want to apply the transformation matrix of the parent node to it's children too. Just my thoughts :) Thanks man, I just found the problem. I might as well type it here if more people have this kind of problem. I had to use the pos and rotation information from the joint and create a rotational matrix and a translational matrix and then multiply them into one to get mFinal: CreateRotationXYZ(&rots, pitch,yaw,roll); CreateTranslation(&trans, x,y,z); mFinal = rots * trans; Though my programming book did not state this as well as it should have...
  8. MS3D - Problem displaying the Bones

    I found the problem, after 2 days excessibe programming. The problem was I used the pos[..] information from the ms3D spec. I should have used the floats 41 to 43 in the mFinal matrix for each joint as the coordinate information.
  9. Hi, I have a pretty decent 3D engine. I can draw models, sprites, load textures without a problem, and I can fly around with my cam, use lights and all the basic stuff. I have been putting this off for way too long - but I've finally taken the step to actually make the models do something. The problem is, I can't display my bones correctly. If I draw them like points, they appear like they should, assuming that bones[...].position[...] in the ms3d spec file is the joints absolute x-,y-,z- coordinates and not anything relative to a given position - like its parent-joint. I try to connect the joints positions with a line for every joint that has a parent, that is I push two vertices at a time into a vertexbuffer in the order: parent, child, parent, child, parent, child,... and then render the buffer like a list of separate lines with D3DPT_LINELIST. My problem is that I get these failed bones: The Failed Bones Compared to how they should be: The bones in Milkshape 3D Below is the linkage between all the joints in psuedo-code. (A correct text-dump of the actual MS3D-file) Each valid joint is linked with the indexes of the parent- and child- joints. Much the same as how the triangles are linked through the indexes of the vertexbuffer. So the syntax in the bone-list below is: bone( index ) = ( parent-joint, child-joint ) I can't see where the problem is... Everything seems fine in the dump file. Tey seem correctly linked. And I have loaded the file correctly, that much I know for sure. I've double-checked with an MS3D text-dump of the same file. Any help would be appreciated, and if you can't see a problem in my logic or how I've linked the bones or how I've rendered them, then that would also be appreciated so I atleast know that much. Is the problem with the rendering of the bones or the linking of them? Model(...) { Vertices( 839 ) Triangles( 1007 ) Mesh Groups( 2 ) Materials( 5 ) Textures( 5 ) Joints( 28 ) Bones( 27 ) Frames( 300 ) FPS( 25.00 ) Bonelist { Bone(0) = { 0, 1 } Bone(1) = { 1, 2 } Bone(2) = { 1, 18 } Bone(3) = { 1, 23 } Bone(4) = { 2, 3 } Bone(5) = { 3, 4 } Bone(6) = { 4, 5 } Bone(7) = { 5, 6 } Bone(8) = { 5, 8 } Bone(9) = { 5, 14 } Bone(10) = { 6, 7 } Bone(11) = { 8, 9 } Bone(12) = { 9, 10 } Bone(13) = { 10, 11 } Bone(14) = { 11, 12 } Bone(15) = { 12, 13 } Bone(16) = { 14, 15 } Bone(17) = { 15, 16 } Bone(18) = { 16, 17 } Bone(19) = { 18, 19 } Bone(20) = { 19, 20 } Bone(21) = { 20, 21 } Bone(22) = { 21, 22 } Bone(23) = { 23, 24 } Bone(24) = { 24, 25 } Bone(25) = { 25, 26 } Bone(26) = { 26, 27 } } Jointlist { Joint(Joint1).Index: 0 { ParentName: ParentIndex: -1 } Joint(Joint2).Index: 1 { ParentName: Joint1 ParentIndex: 0 } Joint(Joint3).Index: 2 { ParentName: Joint2 ParentIndex: 1 } Joint(Joint4).Index: 3 { ParentName: Joint3 ParentIndex: 2 } Joint(Joint5).Index: 4 { ParentName: Joint4 ParentIndex: 3 } Joint(Joint6).Index: 5 { ParentName: Joint5 ParentIndex: 4 } Joint(Joint7).Index: 6 { ParentName: Joint6 ParentIndex: 5 } Joint(Joint8).Index: 7 { ParentName: Joint7 ParentIndex: 6 } Joint(Joint9).Index: 8 { ParentName: Joint6 ParentIndex: 5 } Joint(Joint10).Index: 9 { ParentName: Joint9 ParentIndex: 8 } Joint(Joint11).Index: 10 { ParentName: Joint10 ParentIndex: 9 } Joint(Joint12).Index: 11 { ParentName: Joint11 ParentIndex: 10 } Joint(Joint13).Index: 12 { ParentName: Joint12 ParentIndex: 11 } Joint(Joint29).Index: 13 { ParentName: Joint13 ParentIndex: 12 } Joint(Joint14).Index: 14 { ParentName: Joint6 ParentIndex: 5 } Joint(Joint15).Index: 15 { ParentName: Joint14 ParentIndex: 14 } Joint(Joint16).Index: 16 { ParentName: Joint15 ParentIndex: 15 } Joint(Joint17).Index: 17 { ParentName: Joint16 ParentIndex: 16 } Joint(Joint18).Index: 18 { ParentName: Joint2 ParentIndex: 1 } Joint(Joint19).Index: 19 { ParentName: Joint18 ParentIndex: 18 } Joint(Joint20).Index: 20 { ParentName: Joint19 ParentIndex: 19 } Joint(Joint21).Index: 21 { ParentName: Joint20 ParentIndex: 20 } Joint(Joint22).Index: 22 { ParentName: Joint21 ParentIndex: 21 } Joint(Joint23).Index: 23 { ParentName: Joint2 ParentIndex: 1 } Joint(Joint24).Index: 24 { ParentName: Joint23 ParentIndex: 23 } Joint(Joint25).Index: 25 { ParentName: Joint24 ParentIndex: 24 } Joint(Joint26).Index: 26 { ParentName: Joint25 ParentIndex: 25 } Joint(Joint27).Index: 27 { ParentName: Joint26 ParentIndex: 26 } } struct Bone{ unsigned short parentIndex; unsigned short childIndex; } void CModelMS3D::DrawBones(CDirect3DDevice &dev, CDirect3DVertexBuffer &vb) { int vertcount=0; CPPVertex3DNormal *p; for(int i=0; i < modelInfo.numBones; i++) { vb.Lock((void**)&p,0,0,D3DLOCK_DISCARD); CModelMS3DBone &currBone = modelInfo.bones[i]; CModelMS3DJoint &joint_1 = modelInfo.joints[currBone.parentIndex]; CModelMS3DJoint &joint_2 = modelInfo.joints[currBone.childIndex]; p[vertcount++] = CPPVertex3DNormal(joint_1.position[0], joint_1.position[1], joint_1.position[2], 1,1,1, 255,0,255,255, 1,1); p[vertcount++] = CPPVertex3DNormal(joint_2.position[0], joint_2.position[1], joint_2.position[2], 1,1,1, 255,0,255,255, 1,1); } vb.Unlock(); vb.SetStreamSource(dev,0); dev.DrawPrimitive(D3DPT_LINELIST,0,modelInfo.numBones); }
  10. Hi, I have a pretty decent 3D engine. I can draw models, sprites, load textures without a problem, and I can fly around with my cam, use lights and all the basic stuff. I have been putting this off for way too long - but I've finally taken the step to actually make the models do something. The problem is, I can't display my bones correctly. If I draw them like points, they appear like they should, assuming that bones[...].position[...] in the ms3d spec file is the joints absolute x-,y-,z- coordinates and not anything relative to a given position - like its parent-joint. I try to connect the joints positions with a line for every joint that has a parent, that is I push two vertices at a time into a vertexbuffer in the order: parent, child, parent, child, parent, child,... and then render the buffer like a list of separate lines with D3DPT_LINELIST. My problem is that I get these failed bones: The Failed Bones Compared to how they should be: The bones in Milkshape 3D Below is the linkage between all the joints in psuedo-code. (A correct text-dump of the actual MS3D-file) Each valid joint is linked with the indexes of the parent- and child- joints. Much the same as how the triangles are linked through the indexes of the vertexbuffer. So the syntax in the bone-list below is: bone( index ) = ( parent-joint, child-joint ) I can't see where the problem is... Everything seems fine in the dump file. Tey seem correctly linked. And I have loaded the file correctly, that much I know for sure. I've double-checked with an MS3D text-dump of the same file. Any help would be appreciated, and if you can't see a problem in my logic or how I've linked the bones or how I've rendered them, then that would also be appreciated so I atleast know that much. Is the problem with the rendering of the bones or the linking of them? Model(...) { Vertices( 839 ) Triangles( 1007 ) Mesh Groups( 2 ) Materials( 5 ) Textures( 5 ) Joints( 28 ) Bones( 27 ) Frames( 300 ) FPS( 25.00 ) Bonelist { Bone(0) = { 0, 1 } Bone(1) = { 1, 2 } Bone(2) = { 1, 18 } Bone(3) = { 1, 23 } Bone(4) = { 2, 3 } Bone(5) = { 3, 4 } Bone(6) = { 4, 5 } Bone(7) = { 5, 6 } Bone(8) = { 5, 8 } Bone(9) = { 5, 14 } Bone(10) = { 6, 7 } Bone(11) = { 8, 9 } Bone(12) = { 9, 10 } Bone(13) = { 10, 11 } Bone(14) = { 11, 12 } Bone(15) = { 12, 13 } Bone(16) = { 14, 15 } Bone(17) = { 15, 16 } Bone(18) = { 16, 17 } Bone(19) = { 18, 19 } Bone(20) = { 19, 20 } Bone(21) = { 20, 21 } Bone(22) = { 21, 22 } Bone(23) = { 23, 24 } Bone(24) = { 24, 25 } Bone(25) = { 25, 26 } Bone(26) = { 26, 27 } } Jointlist { Joint(Joint1).Index: 0 { ParentName: ParentIndex: -1 } Joint(Joint2).Index: 1 { ParentName: Joint1 ParentIndex: 0 } Joint(Joint3).Index: 2 { ParentName: Joint2 ParentIndex: 1 } Joint(Joint4).Index: 3 { ParentName: Joint3 ParentIndex: 2 } Joint(Joint5).Index: 4 { ParentName: Joint4 ParentIndex: 3 } Joint(Joint6).Index: 5 { ParentName: Joint5 ParentIndex: 4 } Joint(Joint7).Index: 6 { ParentName: Joint6 ParentIndex: 5 } Joint(Joint8).Index: 7 { ParentName: Joint7 ParentIndex: 6 } Joint(Joint9).Index: 8 { ParentName: Joint6 ParentIndex: 5 } Joint(Joint10).Index: 9 { ParentName: Joint9 ParentIndex: 8 } Joint(Joint11).Index: 10 { ParentName: Joint10 ParentIndex: 9 } Joint(Joint12).Index: 11 { ParentName: Joint11 ParentIndex: 10 } Joint(Joint13).Index: 12 { ParentName: Joint12 ParentIndex: 11 } Joint(Joint29).Index: 13 { ParentName: Joint13 ParentIndex: 12 } Joint(Joint14).Index: 14 { ParentName: Joint6 ParentIndex: 5 } Joint(Joint15).Index: 15 { ParentName: Joint14 ParentIndex: 14 } Joint(Joint16).Index: 16 { ParentName: Joint15 ParentIndex: 15 } Joint(Joint17).Index: 17 { ParentName: Joint16 ParentIndex: 16 } Joint(Joint18).Index: 18 { ParentName: Joint2 ParentIndex: 1 } Joint(Joint19).Index: 19 { ParentName: Joint18 ParentIndex: 18 } Joint(Joint20).Index: 20 { ParentName: Joint19 ParentIndex: 19 } Joint(Joint21).Index: 21 { ParentName: Joint20 ParentIndex: 20 } Joint(Joint22).Index: 22 { ParentName: Joint21 ParentIndex: 21 } Joint(Joint23).Index: 23 { ParentName: Joint2 ParentIndex: 1 } Joint(Joint24).Index: 24 { ParentName: Joint23 ParentIndex: 23 } Joint(Joint25).Index: 25 { ParentName: Joint24 ParentIndex: 24 } Joint(Joint26).Index: 26 { ParentName: Joint25 ParentIndex: 25 } Joint(Joint27).Index: 27 { ParentName: Joint26 ParentIndex: 26 } } struct Bone{ unsigned short parentIndex; unsigned short childIndex; } void CModelMS3D::DrawBones(CDirect3DDevice &dev, CDirect3DVertexBuffer &vb) { int vertcount=0; CPPVertex3DNormal *p; for(int i=0; i < modelInfo.numBones; i++) { vb.Lock((void**)&p,0,0,D3DLOCK_DISCARD); CModelMS3DBone &currBone = modelInfo.bones[i]; CModelMS3DJoint &joint_1 = modelInfo.joints[currBone.parentIndex]; CModelMS3DJoint &joint_2 = modelInfo.joints[currBone.childIndex]; p[vertcount++] = CPPVertex3DNormal(joint_1.position[0], joint_1.position[1], joint_1.position[2], 1,1,1, 255,0,255,255, 1,1); p[vertcount++] = CPPVertex3DNormal(joint_2.position[0], joint_2.position[1], joint_2.position[2], 1,1,1, 255,0,255,255, 1,1); } vb.Unlock(); vb.SetStreamSource(dev,0); dev.DrawPrimitive(D3DPT_LINELIST,0,modelInfo.numBones); } [Edited by - novousmihi on July 3, 2009 8:25:37 AM]
  11. Hi, I have a pretty decent 3D engine. I can draw models, sprites, load textures without a problem, and I can fly around with my cam, use lights and all the basic stuff. I have been putting this off for way too long - but I've finally taken the step to actually make the models do something. The problem is, I can't display my bones correctly. If I draw them like points, they appear like they should, assuming that bones[...].position[...] in the ms3d spec file is the joints absolute x-,y-,z- coordinates and not anything relative to a given position - like its parent-joint. I try to connect the joints positions with a line for every joint that has a parent, that is I push two vertices at a time into a vertexbuffer in the order: parent, child, parent, child, parent, child,... and then render the buffer like a list of separate lines with D3DPT_LINELIST. My problem is that I get these failed bones: The Failed Bones Compared to how they should be: The bones in Milkshape 3D Below is the linkage between all the joints in psuedo-code. (A correct text-dump of the actual MS3D-file) Each valid joint is linked with the indexes of the parent- and child- joints. Much the same as how the triangles are linked through the indexes of the vertexbuffer. So the syntax in the bone-list below is: bone( index ) = ( parent-joint, child-joint ) I can't see where the problem is... Everything seems fine in the dump file. Tey seem correctly linked. And I have loaded the file correctly, that much I know for sure. I've double-checked with an MS3D text-dump of the same file. Any help would be appreciated, and if you can't see a problem in my logic or how I've linked the bones or how I've rendered them, then that would also be appreciated so I atleast know that much. Is the problem with the rendering of the bones or the linking of them? Model(...) { Vertices( 839 ) Triangles( 1007 ) Mesh Groups( 2 ) Materials( 5 ) Textures( 5 ) Joints( 28 ) Bones( 27 ) Frames( 300 ) FPS( 25.00 ) Bonelist { Bone(0) = { 0, 1 } Bone(1) = { 1, 2 } Bone(2) = { 1, 18 } Bone(3) = { 1, 23 } Bone(4) = { 2, 3 } Bone(5) = { 3, 4 } Bone(6) = { 4, 5 } Bone(7) = { 5, 6 } Bone(8) = { 5, 8 } Bone(9) = { 5, 14 } Bone(10) = { 6, 7 } Bone(11) = { 8, 9 } Bone(12) = { 9, 10 } Bone(13) = { 10, 11 } Bone(14) = { 11, 12 } Bone(15) = { 12, 13 } Bone(16) = { 14, 15 } Bone(17) = { 15, 16 } Bone(18) = { 16, 17 } Bone(19) = { 18, 19 } Bone(20) = { 19, 20 } Bone(21) = { 20, 21 } Bone(22) = { 21, 22 } Bone(23) = { 23, 24 } Bone(24) = { 24, 25 } Bone(25) = { 25, 26 } Bone(26) = { 26, 27 } } Jointlist { Joint(Joint1).Index: 0 { ParentName: ParentIndex: -1 } Joint(Joint2).Index: 1 { ParentName: Joint1 ParentIndex: 0 } Joint(Joint3).Index: 2 { ParentName: Joint2 ParentIndex: 1 } Joint(Joint4).Index: 3 { ParentName: Joint3 ParentIndex: 2 } Joint(Joint5).Index: 4 { ParentName: Joint4 ParentIndex: 3 } Joint(Joint6).Index: 5 { ParentName: Joint5 ParentIndex: 4 } Joint(Joint7).Index: 6 { ParentName: Joint6 ParentIndex: 5 } Joint(Joint8).Index: 7 { ParentName: Joint7 ParentIndex: 6 } Joint(Joint9).Index: 8 { ParentName: Joint6 ParentIndex: 5 } Joint(Joint10).Index: 9 { ParentName: Joint9 ParentIndex: 8 } Joint(Joint11).Index: 10 { ParentName: Joint10 ParentIndex: 9 } Joint(Joint12).Index: 11 { ParentName: Joint11 ParentIndex: 10 } Joint(Joint13).Index: 12 { ParentName: Joint12 ParentIndex: 11 } Joint(Joint29).Index: 13 { ParentName: Joint13 ParentIndex: 12 } Joint(Joint14).Index: 14 { ParentName: Joint6 ParentIndex: 5 } Joint(Joint15).Index: 15 { ParentName: Joint14 ParentIndex: 14 } Joint(Joint16).Index: 16 { ParentName: Joint15 ParentIndex: 15 } Joint(Joint17).Index: 17 { ParentName: Joint16 ParentIndex: 16 } Joint(Joint18).Index: 18 { ParentName: Joint2 ParentIndex: 1 } Joint(Joint19).Index: 19 { ParentName: Joint18 ParentIndex: 18 } Joint(Joint20).Index: 20 { ParentName: Joint19 ParentIndex: 19 } Joint(Joint21).Index: 21 { ParentName: Joint20 ParentIndex: 20 } Joint(Joint22).Index: 22 { ParentName: Joint21 ParentIndex: 21 } Joint(Joint23).Index: 23 { ParentName: Joint2 ParentIndex: 1 } Joint(Joint24).Index: 24 { ParentName: Joint23 ParentIndex: 23 } Joint(Joint25).Index: 25 { ParentName: Joint24 ParentIndex: 24 } Joint(Joint26).Index: 26 { ParentName: Joint25 ParentIndex: 25 } Joint(Joint27).Index: 27 { ParentName: Joint26 ParentIndex: 26 } } struct Bone{ unsigned short parentIndex; unsigned short childIndex; } [Edited by - novousmihi on July 3, 2009 8:28:17 AM]