- Cal3D 0.11 API Reference -

coresubmesh.h
1//****************************************************************************//
2// coresubmesh.h //
3// Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger //
4//****************************************************************************//
5// This library is free software; you can redistribute it and/or modify it //
6// under the terms of the GNU Lesser General Public License as published by //
7// the Free Software Foundation; either version 2.1 of the License, or (at //
8// your option) any later version. //
9//****************************************************************************//
10
11#ifndef CAL_CORESUBMESH_H
12#define CAL_CORESUBMESH_H
13
14
15#include "cal3d/global.h"
16#include "cal3d/vector.h"
17
18
19 class CalCoreSubMorphTarget;
20
21
22 class CAL3D_API CalCoreSubmesh
23{
24 public:
25 struct TextureCoordinate
26 {
27 float u, v;
28 };
29
30 struct TangentSpace
31 {
32 CalVector tangent;
33 float crossFactor; // To get the binormal, use ((N x T) * crossFactor)
34 };
35
36 struct Influence
37 {
38 int boneId;
39 float weight;
40 };
41
42 struct PhysicalProperty
43 {
44 float weight;
45 };
46
47 struct Vertex
48 {
49 CalVector position;
50 CalVector normal;
51 std::vector<Influence> vectorInfluence;
52 int collapseId;
53 int faceCollapseCount;
54 };
55
56 struct Face
57 {
58 CalIndex vertexId[3];
59 };
60
62 struct Spring
63 {
64 int vertexId[2];
65 float springCoefficient;
66 float idleLength;
67 };
68
69 public:
70 CalCoreSubmesh();
71 ~CalCoreSubmesh();
72
73 int getCoreMaterialThreadId();
74 int getFaceCount();
75 int getLodCount();
76 int getSpringCount();
77 std::vector<Face>& getVectorFace();
78 std::vector<PhysicalProperty>& getVectorPhysicalProperty();
79 std::vector<Spring>& getVectorSpring();
80 std::vector<std::vector<TangentSpace> >& getVectorVectorTangentSpace();
81 std::vector<std::vector<TextureCoordinate> >& getVectorVectorTextureCoordinate();
82 std::vector<Vertex>& getVectorVertex();
83 int getVertexCount();
84 bool isTangentsEnabled(int mapId);
85 bool enableTangents(int mapId, bool enabled);
86 bool reserve(int vertexCount, int textureCoordinateCount, int faceCount, int springCount);
87 void setCoreMaterialThreadId(int coreMaterialThreadId);
88 bool setFace(int faceId, const Face& face);
89 void setLodCount(int lodCount);
90 bool setPhysicalProperty(int vertexId, const PhysicalProperty& physicalProperty);
91 bool setSpring(int springId, const Spring& spring);
92 bool setTangentSpace(int vertexId, int textureCoordinateId, const CalVector& tangent, float crossFactor);
93 bool setTextureCoordinate(int vertexId, int textureCoordinateId, const TextureCoordinate& textureCoordinate);
94 bool setVertex(int vertexId, const Vertex& vertex);
95 int addCoreSubMorphTarget(CalCoreSubMorphTarget *pCoreSubMorphTarget);
96 CalCoreSubMorphTarget *getCoreSubMorphTarget(int id);
97 int getCoreSubMorphTargetCount();
98 std::vector<CalCoreSubMorphTarget *>& getVectorCoreSubMorphTarget();
99 void scale(float factor);
100
101 private:
102 void UpdateTangentVector(int v0, int v1, int v2, int channel);
103
104 private:
105 std::vector<Vertex> m_vectorVertex;
106 std::vector<bool> m_vectorTangentsEnabled;
107 std::vector<std::vector<TangentSpace> > m_vectorvectorTangentSpace;
108 std::vector<std::vector<TextureCoordinate> > m_vectorvectorTextureCoordinate;
109 std::vector<PhysicalProperty> m_vectorPhysicalProperty;
110 std::vector<Face> m_vectorFace;
111 std::vector<Spring> m_vectorSpring;
112 std::vector<CalCoreSubMorphTarget *> m_vectorCoreSubMorphTarget;
113 int m_coreMaterialThreadId;
114 int m_lodCount;
115};
116
117#endif
118
119//****************************************************************************//
CalCoreSubMorphTarget
Definition coresubmorphtarget.h:20
CalCoreSubmesh::setSpring
bool setSpring(int springId, const Spring &spring)
Sets a specified spring.
Definition coresubmesh.cpp:496
CalCoreSubmesh::reserve
bool reserve(int vertexCount, int textureCoordinateCount, int faceCount, int springCount)
Reserves memory for the vertices, faces and texture coordinates.
Definition coresubmesh.cpp:334
CalCoreSubmesh::getCoreMaterialThreadId
int getCoreMaterialThreadId()
Returns the ID of the core material thread.
Definition coresubmesh.cpp:67
CalCoreSubmesh::addCoreSubMorphTarget
int addCoreSubMorphTarget(CalCoreSubMorphTarget *pCoreSubMorphTarget)
Adds a core sub morph target.
Definition coresubmesh.cpp:564
CalCoreSubmesh::enableTangents
bool enableTangents(int mapId, bool enabled)
Enables (and calculates) or disables the storage of tangent spaces.
Definition coresubmesh.cpp:173
CalCoreSubmesh::setTextureCoordinate
bool setTextureCoordinate(int vertexId, int textureCoordinateId, const TextureCoordinate &textureCoordinate)
Sets a specified texture coordinate.
Definition coresubmesh.cpp:520
CalCoreSubmesh::getLodCount
int getLodCount()
Returns the number of LOD steps.
Definition coresubmesh.cpp:93
CalCoreSubmesh::getVectorVertex
std::vector< Vertex > & getVectorVertex()
Returns the vertex vector.
Definition coresubmesh.cpp:296
CalCoreSubmesh::CalCoreSubmesh
CalCoreSubmesh()
Constructs the core submesh instance.
Definition coresubmesh.cpp:28
CalCoreSubmesh::setLodCount
void setLodCount(int lodCount)
Sets the number of LOD steps.
Definition coresubmesh.cpp:427
CalCoreSubmesh::scale
void scale(float factor)
Scale the Submesh.
Definition coresubmesh.cpp:635
CalCoreSubmesh::setPhysicalProperty
bool setPhysicalProperty(int vertexId, const PhysicalProperty &physicalProperty)
Sets a specified physical property.
Definition coresubmesh.cpp:474
CalCoreSubmesh::getCoreSubMorphTarget
CalCoreSubMorphTarget * getCoreSubMorphTarget(int id)
Provides access to a core sub morph target.
Definition coresubmesh.cpp:587
CalCoreSubmesh::getVectorSpring
std::vector< Spring > & getVectorSpring()
Returns the spring vector.
Definition coresubmesh.cpp:251
CalCoreSubmesh::setTangentSpace
bool setTangentSpace(int vertexId, int textureCoordinateId, const CalVector &tangent, float crossFactor)
Sets the tangent vector associated with a specified texture coordinate pair.
Definition coresubmesh.cpp:448
CalCoreSubmesh::getVertexCount
int getVertexCount()
Returns the number of vertices.
Definition coresubmesh.cpp:309
CalCoreSubmesh::getVectorCoreSubMorphTarget
std::vector< CalCoreSubMorphTarget * > & getVectorCoreSubMorphTarget()
Returns the core sub morph target vector.
Definition coresubmesh.cpp:620
CalCoreSubmesh::getFaceCount
int getFaceCount()
Returns the number of faces.
Definition coresubmesh.cpp:80
CalCoreSubmesh::getVectorVectorTextureCoordinate
std::vector< std::vector< TextureCoordinate > > & getVectorVectorTextureCoordinate()
Returns the texture coordinate vector-vector.
Definition coresubmesh.cpp:266
CalCoreSubmesh::getCoreSubMorphTargetCount
int getCoreSubMorphTargetCount()
Returns the number of core sub morph targets.
Definition coresubmesh.cpp:606
CalCoreSubmesh::setCoreMaterialThreadId
void setCoreMaterialThreadId(int coreMaterialThreadId)
Sets the ID of the core material thread.
Definition coresubmesh.cpp:392
CalCoreSubmesh::getVectorPhysicalProperty
std::vector< PhysicalProperty > & getVectorPhysicalProperty()
Returns the physical property vector.
Definition coresubmesh.cpp:237
CalCoreSubmesh::getVectorVectorTangentSpace
std::vector< std::vector< TangentSpace > > & getVectorVectorTangentSpace()
Returns the tangent space vector-vector.
Definition coresubmesh.cpp:281
CalCoreSubmesh::setVertex
bool setVertex(int vertexId, const Vertex &vertex)
Sets a specified vertex.
Definition coresubmesh.cpp:543
CalCoreSubmesh::isTangentsEnabled
bool isTangentsEnabled(int mapId)
Returns true if tangent vectors are enabled.
Definition coresubmesh.cpp:119
CalCoreSubmesh::setFace
bool setFace(int faceId, const Face &face)
Sets a specified face.
Definition coresubmesh.cpp:410
CalCoreSubmesh::getVectorFace
std::vector< Face > & getVectorFace()
Returns the face vector.
Definition coresubmesh.cpp:223
CalCoreSubmesh::getSpringCount
int getSpringCount()
Returns the number of springs.
Definition coresubmesh.cpp:106
CalVector
The vector class.
Definition vector.h:37
CalCoreSubmesh::Face
Definition coresubmesh.h:57
CalCoreSubmesh::Influence
Definition coresubmesh.h:37
CalCoreSubmesh::PhysicalProperty
Definition coresubmesh.h:43
CalCoreSubmesh::Spring
The core submesh Spring.
Definition coresubmesh.h:63
CalCoreSubmesh::TangentSpace
Definition coresubmesh.h:31
CalCoreSubmesh::TextureCoordinate
Definition coresubmesh.h:26
CalCoreSubmesh::Vertex
Definition coresubmesh.h:48

Generated by The Cal3D Team with Doxygen 1.15.0