Pontok kinyerése mesh-ből

Pontok kinyerése mesh-ből
2009-05-27T20:34:27+02:00
2009-06-02T21:22:11+02:00
2022-11-13T20:20:38+01:00
Bojti14
Hali
Nemrég kezdtem el a Physx-et és találtam hozzá egy jó tutoriált is, de amikor másik fájlt használtam akkor nagyon bug-os lett. mint rájöttem minden pontját -5 -nek olvasta be én nem tudom hogy miért.

ez a kód:
vector<float> GetVertices(LPD3DXMESH *g_pMesh ) { vector<float> vertices; DWORD stride = D3DXGetFVFVertexSize((*g_pMesh)->GetFVF()); BYTE* vbptr = NULL; (*g_pMesh)->LockVertexBuffer(0, (LPVOID*)&vbptr); int ii = -1; for(int i = 0; i < (*g_pMesh)->GetNumVertices(); i++) { ii++; D3DXVECTOR3* pos = (D3DXVECTOR3*)vbptr; vertices.push_back(pos->x); vertices.push_back(pos->y); vertices.push_back(pos->z); vbptr += stride; } (*g_pMesh)->UnlockVertexBuffer(); return vertices; }

Ez működött:
xof 0303txt 0032 template XSkinMeshHeader { <3cf169ce-ff7c-44ab-93c0-f78f62d172e2> WORD nMaxSkinWeightsPerVertex; WORD nMaxSkinWeightsPerFace; WORD nBones; } template VertexDuplicationIndices { <b8d65549-d7c9-4995-89cf-53a9a8b031e3> DWORD nIndices; DWORD nOriginalVertices; array DWORD indices[nIndices]; } template SkinWeights { <6f0d123b-bad2-4167-a0d0-80224f25fabb> STRING transformNodeName; DWORD nWeights; array DWORD vertexIndices[nWeights]; array FLOAT weights[nWeights]; Matrix4x4 matrixOffset; } Frame SCENE_ROOT { FrameTransformMatrix { 1.000000,0.000000,0.000000,0.000000, 0.000000,1.000000,0.000000,0.000000, 0.000000,0.000000,1.000000,0.000000, 0.000000,0.000000,0.000000,1.000000;; } Frame pCube1 { FrameTransformMatrix { 1.000000,0.000000,0.000000,0.000000, 0.000000,1.000000,0.000000,0.000000, 0.000000,0.000000,1.000000,0.000000, 0.000000,0.000000,0.000000,1.000000;; } Mesh { 24; -5.000000;-5.000000;5.000000;, 5.000000;-5.000000;5.000000;, -5.000000;5.000000;5.000000;, 5.000000;5.000000;5.000000;, -5.000000;5.000000;-5.000000;, 5.000000;5.000000;-5.000000;, -5.000000;-5.000000;-5.000000;, 5.000000;-5.000000;-5.000000;, -5.000000;5.000000;5.000000;, 5.000000;5.000000;5.000000;, -5.000000;5.000000;-5.000000;, 5.000000;5.000000;-5.000000;, -5.000000;-5.000000;-5.000000;, 5.000000;-5.000000;-5.000000;, 5.000000;-5.000000;5.000000;, -5.000000;-5.000000;5.000000;, 5.000000;-5.000000;5.000000;, 5.000000;-5.000000;-5.000000;, 5.000000;5.000000;-5.000000;, 5.000000;5.000000;5.000000;, -5.000000;-5.000000;-5.000000;, -5.000000;-5.000000;5.000000;, -5.000000;5.000000;5.000000;, -5.000000;5.000000;-5.000000;; 6; 4;0,1,3,2;, 4;8,9,5,4;, 4;10,11,7,6;, 4;12,13,14,15;, 4;16,17,18,19;, 4;20,21,22,23;; MeshNormals { 24; 0.000000;0.000000;1.000000;, 0.000000;0.000000;1.000000;, 0.000000;0.000000;1.000000;, 0.000000;0.000000;1.000000;, 0.000000;1.000000;0.000000;, 0.000000;1.000000;0.000000;, 0.000000;0.000000;-1.000000;, 0.000000;0.000000;-1.000000;, 0.000000;1.000000;0.000000;, 0.000000;1.000000;0.000000;, 0.000000;0.000000;-1.000000;, 0.000000;0.000000;-1.000000;, 0.000000;-1.000000;0.000000;, 0.000000;-1.000000;0.000000;, 0.000000;-1.000000;0.000000;, 0.000000;-1.000000;0.000000;, 1.000000;0.000000;0.000000;, 1.000000;0.000000;0.000000;, 1.000000;0.000000;0.000000;, 1.000000;0.000000;0.000000;, -1.000000;0.000000;0.000000;, -1.000000;0.000000;0.000000;, -1.000000;0.000000;0.000000;, -1.000000;0.000000;0.000000;; 6; 4;0,1,3,2;, 4;8,9,5,4;, 4;10,11,7,6;, 4;12,13,14,15;, 4;16,17,18,19;, 4;20,21,22,23;; } MeshTextureCoords { 24; 0.000000;0.000000;, 1.000000;0.000000;, 0.000000;-1.000000;, 1.000000;-1.000000;, 0.000000;-2.000000;, 1.000000;-2.000000;, 0.000000;-3.000000;, 1.000000;-3.000000;, 0.000000;-1.000000;, 1.000000;-1.000000;, 0.000000;-2.000000;, 1.000000;-2.000000;, 0.000000;-3.000000;, 1.000000;-3.000000;, 1.000000;-4.000000;, 0.000000;-4.000000;, 1.000000;0.000000;, 2.000000;0.000000;, 2.000000;-1.000000;, 1.000000;-1.000000;, -1.000000;0.000000;, 0.000000;0.000000;, 0.000000;-1.000000;, -1.000000;-1.000000;; } MeshMaterialList { 1; 6; 0, 0, 0, 0, 0, 0; Material obj_diff_no_texture { 0.400000;0.400000;0.400000;1.000000;; 0.000000; 0.000000;0.000000;0.000000;; 0.000000;0.000000;0.000000;; } } VertexDuplicationIndices { 24; 8; 0, 1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 1, 0, 1, 7, 5, 3, 6, 0, 2, 4; } } } }

Ez pedig nem:
xof 0303txt 0032 template KeyValuePair { <26e6b1c3-3d4d-4a1d-a437-b33668ffa1c2> STRING key; STRING value; } template Frame { <3d82ab46-62da-11cf-ab39-0020af71e433> [...] } template Matrix4x4 { <f6f23f45-7686-11cf-8f52-0040333594a3> array FLOAT matrix[16]; } template FrameTransformMatrix { <f6f23f41-7686-11cf-8f52-0040333594a3> Matrix4x4 frameMatrix; } template ObjectMatrixComment { <95a48e28-7ef4-4419-a16a-ba9dbdf0d2bc> Matrix4x4 objectMatrix; } template Vector { <3d82ab5e-62da-11cf-ab39-0020af71e433> FLOAT x; FLOAT y; FLOAT z; } template MeshFace { <3d82ab5f-62da-11cf-ab39-0020af71e433> DWORD nFaceVertexIndices; array DWORD faceVertexIndices[nFaceVertexIndices]; } template Mesh { <3d82ab44-62da-11cf-ab39-0020af71e433> DWORD nVertices; array Vector vertices[nVertices]; DWORD nFaces; array MeshFace faces[nFaces]; [...] } template MeshNormals { <f6f23f43-7686-11cf-8f52-0040333594a3> DWORD nNormals; array Vector normals[nNormals]; DWORD nFaceNormals; array MeshFace faceNormals[nFaceNormals]; } template Coords2d { <f6f23f44-7686-11cf-8f52-0040333594a3> FLOAT u; FLOAT v; } template MeshTextureCoords { <f6f23f40-7686-11cf-8f52-0040333594a3> DWORD nTextureCoords; array Coords2d textureCoords[nTextureCoords]; } template VertexElement { <f752461c-1e23-48f6-b9f8-8350850f336f> DWORD Type; DWORD Method; DWORD Usage; DWORD UsageIndex; } template DeclData { <bf22e553-292c-4781-9fea-62bd554bdd93> DWORD nElements; array VertexElement Elements[nElements]; DWORD nDWords; array DWORD data[nDWords]; } template ColorRGBA { <35ff44e0-6c7c-11cf-8f52-0040333594a3> FLOAT red; FLOAT green; FLOAT blue; FLOAT alpha; } template ColorRGB { <d3e16e81-7835-11cf-8f52-0040333594a3> FLOAT red; FLOAT green; FLOAT blue; } template Material { <3d82ab4d-62da-11cf-ab39-0020af71e433> ColorRGBA faceColor; FLOAT power; ColorRGB specularColor; ColorRGB emissiveColor; [...] } template MeshMaterialList { <f6f23f42-7686-11cf-8f52-0040333594a3> DWORD nMaterials; DWORD nFaceIndexes; array DWORD faceIndexes[nFaceIndexes]; [Material <3d82ab4d-62da-11cf-ab39-0020af71e433>] } KeyValuePair { "Date"; "2009-05-27 17:26:10"; } KeyValuePair { "File"; ""; } KeyValuePair { "User"; "Tomi"; } KeyValuePair { "CoreTime"; "0"; } Frame Box01 { FrameTransformMatrix relative { 1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000;; } ObjectMatrixComment object { 1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,-5.000000,0.000000,1.000000;; } Mesh mesh_Box01 { 24; -5.000000;-5.000000;-5.000000;, -5.000000;-5.000000;5.000000;, 5.000000;-5.000000;5.000000;, 5.000000;-5.000000;-5.000000;, -5.000000;5.000000;-5.000000;, 5.000000;5.000000;-5.000000;, 5.000000;5.000000;5.000000;, -5.000000;5.000000;5.000000;, -5.000000;-5.000000;-5.000000;, 5.000000;-5.000000;-5.000000;, 5.000000;5.000000;-5.000000;, -5.000000;5.000000;-5.000000;, 5.000000;-5.000000;-5.000000;, 5.000000;-5.000000;5.000000;, 5.000000;5.000000;5.000000;, 5.000000;5.000000;-5.000000;, 5.000000;-5.000000;5.000000;, -5.000000;-5.000000;5.000000;, -5.000000;5.000000;5.000000;, 5.000000;5.000000;5.000000;, -5.000000;-5.000000;5.000000;, -5.000000;-5.000000;-5.000000;, -5.000000;5.000000;-5.000000;, -5.000000;5.000000;5.000000;; 12; 3;0,2,1;, 3;2,0,3;, 3;4,6,5;, 3;6,4,7;, 3;8,10,9;, 3;10,8,11;, 3;12,14,13;, 3;14,12,15;, 3;16,18,17;, 3;18,16,19;, 3;20,22,21;, 3;22,20,23;; MeshNormals normals { 24; 0.000000;-1.000000;0.000000;, 0.000000;-1.000000;0.000000;, 0.000000;-1.000000;0.000000;, 0.000000;-1.000000;0.000000;, 0.000000;1.000000;0.000000;, 0.000000;1.000000;0.000000;, 0.000000;1.000000;0.000000;, 0.000000;1.000000;0.000000;, 0.000000;0.000000;-1.000000;, 0.000000;0.000000;-1.000000;, 0.000000;0.000000;-1.000000;, 0.000000;0.000000;-1.000000;, 1.000000;0.000000;0.000000;, 1.000000;0.000000;0.000000;, 1.000000;0.000000;0.000000;, 1.000000;0.000000;0.000000;, 0.000000;0.000000;1.000000;, 0.000000;0.000000;1.000000;, 0.000000;0.000000;1.000000;, 0.000000;0.000000;1.000000;, -1.000000;0.000000;0.000000;, -1.000000;0.000000;0.000000;, -1.000000;0.000000;0.000000;, -1.000000;0.000000;0.000000;; 12; 3;0,2,1;, 3;2,0,3;, 3;4,6,5;, 3;6,4,7;, 3;8,10,9;, 3;10,8,11;, 3;12,14,13;, 3;14,12,15;, 3;16,18,17;, 3;18,16,19;, 3;20,22,21;, 3;22,20,23;; } MeshTextureCoords tc0 { 24; 1.000000;1.000000;, 1.000000;0.000000;, 0.000000;0.000000;, 0.000000;1.000000;, 0.000000;1.000000;, 1.000000;1.000000;, 1.000000;0.000000;, 0.000000;0.000000;, 0.000000;1.000000;, 1.000000;1.000000;, 1.000000;0.000000;, 0.000000;0.000000;, 0.000000;1.000000;, 1.000000;1.000000;, 1.000000;0.000000;, 0.000000;0.000000;, 0.000000;1.000000;, 1.000000;1.000000;, 1.000000;0.000000;, 0.000000;0.000000;, 0.000000;1.000000;, 1.000000;1.000000;, 1.000000;0.000000;, 0.000000;0.000000;; } DeclData { 2; 2;0;7;0;, 2;0;6;0;; 144; 0, 0, 1065353216, 3212836864, 0, 0, 0, 1065353216, 0, 1065353216, 0, 0, 0, 1065353216, 0, 0, 0, 3212836864, 0, 0, 1065353216, 3212836864, 0, 0, 0, 1065353216, 0, 1065353216, 0, 0, 0, 1065353216, 0, 0, 0, 1065353216, 0, 0, 1065353216, 3212836864, 0, 0, 0, 1065353216, 0, 3212836864, 0, 0, 0, 1065353216, 0, 0, 0, 3212836864, 0, 0, 1065353216, 3212836864, 0, 0, 0, 1065353216, 0, 0, 0, 1065353216, 0, 1065353216, 0, 3212836864, 0, 0, 0, 0, 1065353216, 1065353216, 0, 0, 0, 1065353216, 0, 1065353216, 0, 0, 0, 1065353216, 0, 0, 0, 3212836864, 0, 0, 1065353216, 1065353216, 0, 0, 0, 1065353216, 0, 1065353216, 0, 0, 0, 1065353216, 0, 0, 0, 1065353216, 0, 0, 1065353216, 1065353216, 0, 0, 0, 1065353216, 0, 3212836864, 0, 0, 0, 1065353216, 0, 0, 0, 3212836864, 0, 0, 1065353216, 1065353216, 0, 0, 0, 1065353216, 0, 0, 0, 1065353216, 0, 1065353216, 0, 3212836864, 0, 0; } MeshMaterialList mtls { 1; 12; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; Material Dflt_Material { 0.560784;0.882353;0.341176;1.000000;; 16.000000; 1.000000;1.000000;1.000000;; 0.000000;0.000000;0.000000;; } } } }

tud valaki segíteni?
Mutasd a teljes hozzászólást!

Tetszett amit olvastál? Szeretnél a jövőben is értesülni a hasonló érdekességekről?
abcd