Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Anonymous
unregistriert
Anonymous
unregistriert
Anonymous
unregistriert
![]() |
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
D3DXATTRIBUTERANGE* at = new D3DXATTRIBUTERANGE[2]; at[0].AttribId = 0; at[0].FaceStart = 1; at[0].FaceCount = 6; at[0].VertexStart = 1; at[0].VertexCount = 9; at[1].AttribId = 1; at[1].FaceStart = 7; at[1].FaceCount = 12; at[1].VertexStart = 10; at[1].VertexCount = 18; pMesh->SetAttributeTable(at, 2); |
Also eindeutig auch für die Materialzuweisung.
Zitat
An attribute table is used to identify areas of the mesh that need to be drawn with different textures, render states, materials, and so on. In addition, the application can use the attribute table to hide portions of a mesh by not drawing a given attribute identifier when drawing the frame.
Anonymous
unregistriert
![]() |
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
Defining a Simple Cube -------------------------------------------------------------------------------- The following file defines a simple cube that has four red sides and two green sides. In this file, optional information is used to add information to the data object defined by the Mesh template. Material RedMaterial { 1.000000;0.000000;0.000000;1.000000;; // R = 1.0, G = 0.0, B = 0.0 0.000000; 0.000000;0.000000;0.000000;; 0.000000;0.000000;0.000000;; } Material GreenMaterial { 0.000000;1.000000;0.000000;1.000000;; // R = 0.0, G = 1.0, B = 0.0 0.000000; 0.000000;0.000000;0.000000;; 0.000000;0.000000;0.000000;; } // Define a mesh with 8 vertices and 12 faces (triangles). Use // optional data objects in the mesh to specify materials, normals, // and texture coordinates. Mesh CubeMesh { 8; // 8 vertices. 1.000000;1.000000;-1.000000;, // Vertex 0. -1.000000;1.000000;-1.000000;, // Vertex 1. -1.000000;1.000000;1.000000;, // And so on. 1.000000;1.000000;1.000000;, 1.000000;-1.000000;-1.000000;, -1.000000;-1.000000;-1.000000;, -1.000000;-1.000000;1.000000;, 1.000000;-1.000000;1.000000;; 12; // 12 faces. 3;0,1,2;, // Face 0 has three vertices. 3;0,2,3;, // And so on. 3;0,4,5;, 3;0,5,1;, 3;1,5,6;, 3;1,6,2;, 3;2,6,7;, 3;2,7,3;, 3;3,7,4;, 3;3,4,0;, 3;4,7,6;, 3;4,6,5;; // All required data has been defined. Now define optional data // using the hierarchical nature of the file format. MeshMaterialList { 2; // Number of materials used. 12; // A material for each face. 0, // Face 0 uses the first material. 0, 0, 0, 0, 0, 0, 0, 1, // Face 8 uses the second material. 1, 1, 1;; {RedMaterial} // References to the definitions {GreenMaterial} // of material 0 and 1. } MeshNormals { 8; // Define 8 normals. 0.333333;0.666667;-0.666667;, -0.816497;0.408248;-0.408248;, -0.333333;0.666667;0.666667;, 0.816497;0.408248;0.408248;, 0.666667;-0.666667;-0.333333;, -0.408248;-0.408248;-0.816497;, -0.666667;-0.666667;0.333333;, 0.408248;-0.408248;0.816497;; 12; // For the 12 faces, define the normals. 3;0,1,2;, 3;0,2,3;, 3;0,4,5;, 3;0,5,1;, 3;1,5,6;, 3;1,6,2;, 3;2,6,7;, 3;2,7,3;, 3;3,7,4;, 3;3,4,0;, 3;4,7,6;, 3;4,6,5;; } MeshTextureCoords { 8; // Define texture coords for each vertex. 0.000000;1.000000; 1.000000;1.000000; 0.000000;1.000000; 1.000000;1.000000; 0.000000;0.000000; 1.000000;0.000000; 0.000000;0.000000; 1.000000;0.000000;; } |
Werbeanzeige