Colobot
model_mesh.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, 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 
36 {
37 public:
39  void AddTriangle(const ModelTriangle& triangle);
41  void SetTriangles(std::vector<ModelTriangle> &&triangles);
43  const std::vector<ModelTriangle>& GetTriangles() const;
45  int GetTriangleCount() const;
46 
48  const Math::Vector& GetPosition() const;
50  void SetPosition(const Math::Vector& position);
51 
53  const Math::Vector& GetRotation() const;
55  void SetRotation(const Math::Vector& rotation);
56 
58  const Math::Vector& GetScale() const;
60  void SetScale(const Math::Vector& scale);
61 
63  const std::string& GetParent() const;
65  void SetParent(const std::string& parent);
66 
67 private:
68  std::vector<ModelTriangle> m_triangles;
69  Math::Vector m_position;
70  Math::Vector m_rotation;
71  Math::Vector m_scale;
72  std::string m_parent;
73 };
74 
75 } // 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:35
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