Colobot
model_mesh.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 #pragma once
21 
22 #include "graphics/model/model_triangle.h"
23 
24 #include "math/vector.h"
25 
26 #include <vector>
27 
28 namespace Gfx
29 {
30 
31 struct ModelTriangle;
32 
38 {
39 public:
41  void AddTriangle(const ModelTriangle& triangle);
43  void SetTriangles(std::vector<ModelTriangle> &&triangles);
45  const std::vector<ModelTriangle>& GetTriangles() const;
47  int GetTriangleCount() const;
48 
50  const Math::Vector& GetPosition() const;
52  void SetPosition(const Math::Vector& position);
53 
55  const Math::Vector& GetRotation() const;
57  void SetRotation(const Math::Vector& rotation);
58 
60  const Math::Vector& GetScale() const;
62  void SetScale(const Math::Vector& scale);
63 
65  const std::string& GetParent() const;
67  void SetParent(const std::string& parent);
68 
69 private:
70  std::vector<ModelTriangle> m_triangles;
71  Math::Vector m_position;
72  Math::Vector m_rotation;
73  Math::Vector m_scale;
74  std::string m_parent;
75 };
76 
77 } // namespace Gfx
void SetRotation(const Math::Vector &rotation)
Sets the mesh rotation.
Definition: model_mesh.cpp:60
void SetParent(const std::string &parent)
Sets the name of parent mesh.
Definition: model_mesh.cpp:80
void SetPosition(const Math::Vector &position)
Sets the mesh rotation.
Definition: model_mesh.cpp:50
const Math::Vector & GetScale() const
Returns the mesh scale.
Definition: model_mesh.cpp:65
void SetScale(const Math::Vector &scale)
Sets the mesh scale.
Definition: model_mesh.cpp:70
const std::string & GetParent() const
Returns the name of parent mesh.
Definition: model_mesh.cpp:75
void SetTriangles(std::vector< ModelTriangle > &&triangles)
Sets the list of triangles.
Definition: model_mesh.cpp:30
Mesh data saved in model file.
Definition: model_mesh.h:37
void AddTriangle(const ModelTriangle &triangle)
Adds a new triangle.
Definition: model_mesh.cpp:25
int GetTriangleCount() const
Returns number of triangles.
Definition: model_mesh.cpp:40
const std::vector< ModelTriangle > & GetTriangles() const
Returns the list of triangles.
Definition: model_mesh.cpp:35
Namespace for (new) graphics code.
Definition: app.h:49
const Math::Vector & GetPosition() const
Returns the mesh position.
Definition: model_mesh.cpp:45
Vector struct and related functions.
const Math::Vector & GetRotation() const
Returns the mesh rotation.
Definition: model_mesh.cpp:55
A single triangle in mesh as saved in model file.
Definition: model_triangle.h:60
3D (3x1) vector
Definition: vector.h:53