| 1 | //////////////////////////////////////////////////////////////////////////////// |
|---|
| 2 | // vertex.h |
|---|
| 3 | // Author : Francesco Giordana |
|---|
| 4 | // Start Date : January 13, 2005 |
|---|
| 5 | // Copyright : (C) 2006 by Francesco Giordana |
|---|
| 6 | // Email : fra.giordana@tiscali.it |
|---|
| 7 | //////////////////////////////////////////////////////////////////////////////// |
|---|
| 8 | |
|---|
| 9 | /********************************************************************************* |
|---|
| 10 | * * |
|---|
| 11 | * This program is free software; you can redistribute it and/or modify * |
|---|
| 12 | * it under the terms of the GNU Lesser General Public License as published by * |
|---|
| 13 | * the Free Software Foundation; either version 2 of the License, or * |
|---|
| 14 | * (at your option) any later version. * |
|---|
| 15 | * * |
|---|
| 16 | **********************************************************************************/ |
|---|
| 17 | |
|---|
| 18 | #ifndef _VERTEX_H |
|---|
| 19 | #define _VERTEX_H |
|---|
| 20 | |
|---|
| 21 | /***** structure for uvsets info *****/ |
|---|
| 22 | typedef struct uvsettag |
|---|
| 23 | { |
|---|
| 24 | short size; //number of coordinates (between 1 and 3) |
|---|
| 25 | } uvset; |
|---|
| 26 | /***** structure for texture coordinates *****/ |
|---|
| 27 | typedef struct texcoordstag |
|---|
| 28 | { |
|---|
| 29 | float u, v, w; //texture coordinates |
|---|
| 30 | } texcoords; |
|---|
| 31 | |
|---|
| 32 | /***** structure for vertex bone assignements *****/ |
|---|
| 33 | typedef struct vbatag |
|---|
| 34 | { |
|---|
| 35 | float weight; //weight |
|---|
| 36 | int jointIdx; //index of associated joint |
|---|
| 37 | } vba; |
|---|
| 38 | |
|---|
| 39 | /***** structure for vertex data *****/ |
|---|
| 40 | typedef struct vertextag |
|---|
| 41 | { |
|---|
| 42 | double x, y, z; //vertex coordinates |
|---|
| 43 | MVector n; //vertex normal |
|---|
| 44 | float r,g,b,a; //vertex colour |
|---|
| 45 | std::vector<texcoords> texcoords; //vertex texture coordinates |
|---|
| 46 | std::vector<vba> vbas; //vertex bone assignements |
|---|
| 47 | long index; //vertex index in the maya mesh to which this vertex refers |
|---|
| 48 | } vertex; |
|---|
| 49 | |
|---|
| 50 | /***** structure for vertex info *****/ |
|---|
| 51 | // used to hold indices to access MFnMesh data |
|---|
| 52 | typedef struct vertexInfotag |
|---|
| 53 | { |
|---|
| 54 | int pointIdx; //index to points list (position) |
|---|
| 55 | int normalIdx; //index to normals list |
|---|
| 56 | float r,g,b,a; //colour |
|---|
| 57 | std::vector<float> u; //u texture coordinates |
|---|
| 58 | std::vector<float> v; //v texture coordinates |
|---|
| 59 | std::vector<float> vba; //vertex bone assignements |
|---|
| 60 | std::vector<int> jointIds; //ids of joints affecting this vertex |
|---|
| 61 | int next; //index of next vertex with same position |
|---|
| 62 | } vertexInfo; |
|---|
| 63 | |
|---|
| 64 | /***** structure for face info *****/ |
|---|
| 65 | typedef struct facetag |
|---|
| 66 | { |
|---|
| 67 | long v[3]; //vertex indices |
|---|
| 68 | } face; |
|---|
| 69 | |
|---|
| 70 | /***** array of face infos *****/ |
|---|
| 71 | typedef std::vector<face> faceArray; |
|---|
| 72 | |
|---|
| 73 | #endif |
|---|