IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GLC_lib Discussion :

Créer un mesh "à la main"


Sujet :

GLC_lib

  1. #1
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut Créer un mesh "à la main"
    Salut.
    Comment procéder pour créer un mesh à la main?

    merci

  2. #2
    Membre confirmé
    Avatar de laumaya
    Homme Profil pro
    Développeur multimédia
    Inscrit en
    Août 2008
    Messages
    82
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur multimédia

    Informations forums :
    Inscription : Août 2008
    Messages : 82
    Points : 456
    Points
    456
    Par défaut
    Citation Envoyé par yan Voir le message
    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();
    }
    @+
    laumaya : Article [Introduction à GLC_lib]. Forum[GLC_lib] Projets [GLC_lib]; [GLC_Player]

  3. #3
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut
    C'est ce que j'ai fais
    J'avais oublié le GLC_Mesh::finish(); et je ne comprenais pas pourquoi cela ne marchais pas

+ Répondre à la discussion
Cette discussion est résolue.

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo