2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file RAS_TexVert.h
32 #ifndef __RAS_TEXVERT_H__
33 #define __RAS_TEXVERT_H__
36 #include "MT_Point3.h"
37 #include "MT_Point2.h"
38 #include "MT_Transform.h"
40 #ifdef WITH_CXX_GUARDEDALLOC
41 #include "MEM_guardedalloc.h"
44 static MT_Point3 g_pt3;
45 static MT_Point2 g_pt2;
50 float m_localxyz[3]; // 3*4 = 12
51 float m_uv1[2]; // 2*4 = 8
52 float m_uv2[2]; // 2*4 = 8
53 unsigned int m_rgba; // 4
54 float m_tangent[4]; // 4*4 = 16
55 float m_normal[3]; // 3*4 = 12
57 short m_softBodyIndex; //2
58 unsigned int m_unit; // 4
59 unsigned int m_origindex; // 4
62 // 32 bytes total size, fits nice = 56 = not fit nice.
71 short getFlag() const;
72 unsigned int getUnit() const;
74 RAS_TexVert()// :m_xyz(0,0,0),m_uv(0,0),m_rgba(0)
76 RAS_TexVert(const MT_Point3& xyz,
79 const MT_Vector4& tangent,
80 const unsigned int rgba,
81 const MT_Vector3& normal,
83 const unsigned int origindex);
86 const float* getUV1 () const {
90 const float* getUV2 () const {
94 const float* getXYZ() const {
98 const float* getNormal() const {
102 short int getSoftBodyIndex() const
104 return m_softBodyIndex;
107 void setSoftBodyIndex(short int sbIndex)
109 m_softBodyIndex = sbIndex;
112 const float* getTangent() const {
116 const unsigned char* getRGBA() const {
117 return (unsigned char *) &m_rgba;
120 unsigned int getOrigIndex() const {
124 void SetXYZ(const MT_Point3& xyz);
125 void SetXYZ(const float *xyz);
126 void SetUV(const MT_Point2& uv);
127 void SetUV2(const MT_Point2& uv);
129 void SetRGBA(const unsigned int rgba);
130 void SetNormal(const MT_Vector3& normal);
131 void SetTangent(const MT_Vector3& tangent);
132 void SetFlag(const short flag);
133 void SetUnit(const unsigned u);
135 void SetRGBA(const MT_Vector4& rgba);
136 const MT_Point3& xyz();
138 void Transform(const class MT_Matrix4x4& mat,
139 const class MT_Matrix4x4& nmat);
140 void TransformUV(const MT_Matrix4x4& mat);
141 void TransformUV2(const MT_Matrix4x4& mat);
143 // compare two vertices, to test if they can be shared, used for
144 // splitting up based on uv's, colors, etc
145 bool closeTo(const RAS_TexVert* other);
148 #ifdef WITH_CXX_GUARDEDALLOC
149 MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_TexVert")
153 #endif /* __RAS_TEXVERT_H__ */