Bonjour,

J'ai un petit soucis, je souhaite positionner un ou plusieurs objets dans une scène en choisissant leurs positions et leurs rotations le problème est que la rotation s'applique sur tout ce qu'il y a dans la scène (axe x,y,z et objet )je voudrais que ce ne soit que sur l'objet mais je ne sais pas comment faire . Voici mon code:

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
 for(int k=0;k<DirP.size();k++)
    {
        glMatrixMode(GL_MODELVIEW);
        glPushMatrix();
        float PosX= Object[k][0];
        float PosY= Object[k][1];
        float PosZ= Object[k][2];
         qDebug()<<PosX<<PosY<<PosZ;
        glTranslatef(PosX,PosY,PosZ);
 
        float RotationX= Object[k][3];
        float RotationY=Object[k][4];
        float RotationZ=Object[k][5];
 
        if(RotationX!=0)
        {
            glRotatef(RotationX,1,0,0);
        }
        if(RotationY!=0)
        {
            glRotatef(RotationY,0,1,0);
        }
        if(RotationZ!=0)
        {
            glRotatef(RotationZ,0,0,1);
        }
        qDebug()<<RotationX<<RotationY<<RotationZ;
         StlLoader Mesh1;
         //Mesh1.stlOpen(DirPath);
         Mesh1.stlOpen(DirP[k]);
         QVector<float> objet1 = Mesh1.getVerticesMesh();
         glBegin(GL_TRIANGLES);
         for(int i=0;i<objet1.size();i++)
                  {
                      int ResteTriangle=i%12;
                      int NumerosPoint=ResteTriangle/3;
                      if(NumerosPoint==3)
                      {//Ajout Normale
                      }
                      else
                      {
                       glVertex3f(objet1[i],objet1[i+1],objet1[i+2]);
                       i=i+2;
                      }
                  }
         glPopMatrix();
         glEnd();
 
    }
DirP est un vecteur qui contient les objets à créer. Mesh1.stlOpen permet de récupérer les vertex de chaque objet

Merci pour vos réponses