1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2006 The OGRE Team |
---|
8 | Also see acknowledgements in Readme.html |
---|
9 | |
---|
10 | This program is free software; you can redistribute it and/or modify it under |
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
13 | version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
23 | ----------------------------------------------------------------------------- |
---|
24 | */ |
---|
25 | |
---|
26 | #if !defined(__OGREMAX_VERTEX_H__) |
---|
27 | #define __OGREMAX_VERTEX_H__ |
---|
28 | |
---|
29 | #include "OgreColourValue.h" |
---|
30 | #include "OgreVector3.h" |
---|
31 | |
---|
32 | namespace OgreMax { |
---|
33 | |
---|
34 | typedef std::map<int, Ogre::Vector3> TexCoordMap; |
---|
35 | |
---|
36 | class Vertex { |
---|
37 | public: |
---|
38 | |
---|
39 | Vertex(float x, float y, float z); |
---|
40 | |
---|
41 | void setNormal(float x, float y, float z); |
---|
42 | void setColour(float r, float g, float b, float a = 1.0); |
---|
43 | void addTexCoord(int mapIndex, float u, float v, float w = 0.0); |
---|
44 | |
---|
45 | bool operator==(Vertex& other); |
---|
46 | |
---|
47 | const Ogre::Vector3& getPosition() const { return m_position; } |
---|
48 | const Ogre::Vector3& getNormal() const { return m_normal; } |
---|
49 | const Ogre::ColourValue& getColour() const { return m_colour; } |
---|
50 | const Ogre::Vector3& getUVW(int mapIndex) const { return m_uvwMap.find(mapIndex)->second; } |
---|
51 | |
---|
52 | private: |
---|
53 | bool hasSameTexCoords(std::map<int, Ogre::Vector3>& uvwMap) ; |
---|
54 | Ogre::Vector3 m_position; |
---|
55 | Ogre::Vector3 m_normal; |
---|
56 | Ogre::ColourValue m_colour; |
---|
57 | TexCoordMap m_uvwMap; |
---|
58 | }; |
---|
59 | |
---|
60 | class VertexList { |
---|
61 | public: |
---|
62 | // returns the index into the list for the inserted element |
---|
63 | unsigned int add(Vertex& v); |
---|
64 | size_t size() { return m_vertexList.size(); } |
---|
65 | const Vertex& front() { return m_vertexList.front(); } |
---|
66 | void pop() { m_vertexList.pop_front(); } |
---|
67 | |
---|
68 | private: |
---|
69 | std::list<Vertex> m_vertexList; |
---|
70 | |
---|
71 | }; |
---|
72 | |
---|
73 | } |
---|
74 | |
---|
75 | |
---|
76 | #endif |
---|