WorldSim - 1.2.3
Utilities
Configuration
GA
NNFW
WorldSim
Total 99%
Experiments
Main Page
Modules
Classes
Files
File List
worldsim
include
wmesh.h
1
/********************************************************************************
2
* WorldSim -- library for robot simulations *
3
* Copyright (C) 2008-2011 Gianluca Massera <emmegian@yahoo.it> *
4
* *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
9
* *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
14
* *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the Free Software *
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
18
********************************************************************************/
19
20
#ifndef WMESH_H
21
#define WMESH_H
22
23
#include "worldsimconfig.h"
24
#include "world.h"
25
26
namespace
farsa {
27
41
class
FARSA_WSIM_API
WMesh
:
public
WObject
{
42
Q_OBJECT
43
public
:
48
WMesh
(
World
* world, QString name=
"unamed"
,
const
wMatrix
& tm =
wMatrix::identity
() );
50
virtual
~
WMesh
();
52
bool
loadMS3DModel( QString filename );
56
void
attachTo(
WObject
* obj );
58
WObject
*
attachedTo
() {
59
return
attacho;
60
};
62
struct
Mesh
{
63
int
m_materialIndex;
64
int
m_numTriangles;
65
int
*m_pTriangleIndices;
66
};
68
struct
Material
{
69
float
m_ambient[4], m_diffuse[4], m_specular[4], m_emissive[4];
70
float
m_shininess;
71
QString m_pTextureFilename;
72
};
74
struct
Triangle
{
75
float
m_vertexNormals[3][3];
76
float
m_s[3], m_t[3];
77
int
m_vertexIndices[3];
78
};
80
struct
Vertex
{
81
char
m_boneID;
82
float
m_location[3];
83
};
84
86
Mesh
*
meshes
() {
87
return
m_pMeshes;
88
};
90
int
meshesCount
() {
91
return
m_numMeshes;
92
};
94
Material
*
materials
() {
95
return
m_pMaterials;
96
};
98
int
materialsCount
() {
99
return
m_numMaterials;
100
};
102
Triangle
*
triangles
() {
103
return
m_pTriangles;
104
};
106
int
trianglesCount
() {
107
return
m_numTriangles;
108
};
110
Vertex
*
vertices
() {
111
return
m_pVertices;
112
};
114
int
verticesCount
() {
115
return
m_numVertices;
116
};
117
private
:
119
WObject
* attacho;
120
//--- Data representing the mesh
121
int
m_numMeshes;
122
Mesh *m_pMeshes;
123
int
m_numMaterials;
124
Material *m_pMaterials;
125
int
m_numTriangles;
126
Triangle *m_pTriangles;
127
int
m_numVertices;
128
Vertex *m_pVertices;
129
};
130
131
}
// end namespace farsa
132
133
#endif