Salut.
Comment procéder pour créer un mesh à la main?
merci
Salut.
Comment procéder pour créer un mesh à la main?
merci
Comme les primitives sont des meshs, je te conseil de consulter le code source des classes GLC_Cylinder, GLC_Cone, GLC_Sphere, GLC_Rectangle...
Example provenant de GLC_Rectangle :
@+
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 void GLC_Rectangle::createMeshAndWire() { Q_ASSERT(GLC_Mesh::isEmpty()); const GLfloat lgX= static_cast<const GLfloat>(m_L1 / 2.0); const GLfloat lgY= static_cast<const GLfloat>(m_L2 / 2.0); GLfloatVector verticeVector; GLfloatVector normalsVector; GLfloatVector texelVector; // Wire data GLfloatVector wireData; // the unique face of this rectangle verticeVector << -lgX; verticeVector << -lgY; verticeVector << 0.0f; normalsVector << 0.0f; normalsVector << 0.0f; normalsVector << 1.0f; texelVector << 0.0f; texelVector << 0.0f; verticeVector << lgX; verticeVector << -lgY; verticeVector << 0.0f; normalsVector << 0.0f; normalsVector << 0.0f; normalsVector << 1.0f; texelVector << 1.0f; texelVector << 0.0f; verticeVector << lgX; verticeVector << lgY; verticeVector << 0.0f; normalsVector << 0.0f; normalsVector << 0.0f; normalsVector << 1.0f; texelVector << 1.0f; texelVector << 1.0f; verticeVector << -lgX; verticeVector << lgY; verticeVector << 0.0f; normalsVector << 0.0f; normalsVector << 0.0f; normalsVector << 1.0f; texelVector << 0.0f; texelVector << 1.0f; // Add bulk data in to the mesh GLC_Mesh::addVertice(verticeVector); GLC_Mesh::addNormals(normalsVector); GLC_Mesh::addTexels(texelVector); // Add the first point of the rectangle for wire verticeVector << -lgX; verticeVector << -lgY; verticeVector << 0.0f; GLC_Geometry::addVerticeGroup(verticeVector); // Set the material to use GLC_Material* pMaterial; if (hasMaterial()) { pMaterial= this->firstMaterial(); } else { pMaterial= new GLC_Material(); } IndexList index; // Face 1 index << 0 << 1 << 3 << 2; GLC_Mesh::addTrianglesStrip(pMaterial, index); GLC_Mesh::finish(); }
C'est ce que j'ai fais
J'avais oublié le GLC_Mesh::finish(); et je ne comprenais pas pourquoi cela ne marchais pas
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager