Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
FlexMeshWheel.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2013-2020 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#pragma once
23
24#include "ForwardDeclarations.h"
25#include "FlexMesh.h"
26
27#include <Ogre.h>
28#include <string>
29#include <vector>
30
31namespace RoR {
32
35
38
41{
42 friend class RoR::FlexFactory;
43
44public:
45
47
48 Ogre::Entity* GetTireEntity() { return m_tire_entity; }
49
50 Ogre::Vector3 updateVertices();
51
52 // Flexable
53 bool flexitPrepare();
54 void flexitCompute();
55 Ogre::Vector3 flexitFinal();
56
57 void setVisible(bool visible);
58
59private:
60
61 FlexMeshWheel( // Use FlexFactory
62 Ogre::Entity* rim_prop_entity,
63 Ogre::SceneNode* rim_scene_node,
64 RoR::GfxActor* gfx_actor,
65 int axis_node_1_index,
66 int axis_node_2_index,
67 int nstart,
68 int nrays,
69 std::string const& tire_mesh_name,
70 std::string const& tire_mesh_rg,
71 std::string const& tire_material_name,
72 std::string const& tire_material_rg,
73 float rimradius,
74 bool rimreverse
75 );
76
78 {
79 Ogre::Vector3 position;
80 Ogre::Vector3 normal;
81 Ogre::Vector2 texcoord;
82 };
83
84 // Wheel
85 size_t m_num_rays;
91
92 // Meshes
93 Ogre::Vector3 m_flexit_center;
94 Ogre::MeshPtr m_mesh;
95 Ogre::SubMesh* m_submesh;
97 Ogre::Entity* m_rim_entity;
98 Ogre::Entity* m_tire_entity; // Assigned by friend FlexFactory
99 Ogre::SceneNode* m_rim_scene_node;
100
101 // Vertices
102 float m_norm_y;
104 std::vector<FlexMeshWheelVertex> m_vertices;
105 Ogre::VertexDeclaration* m_vertex_format;
106 Ogre::HardwareVertexBufferSharedPtr m_hw_vbuf;
107
108 // Indices
110 std::vector<unsigned short> m_indices;
111};
112
115
116} // namespace RoR
Global forward declarations.
Consists of static mesh, representing the rim, and dynamic mesh, representing the tire.
Ogre::Vector3 flexitFinal()
Ogre::Entity * m_rim_entity
std::vector< FlexMeshWheelVertex > m_vertices
Ogre::HardwareVertexBufferSharedPtr m_hw_vbuf
Ogre::Entity * GetTireEntity()
int m_start_node_idx
First node (lowest index) belonging to this wheel.
std::vector< unsigned short > m_indices
Ogre::SceneNode * m_rim_scene_node
RoR::GfxActor * m_gfx_actor
Ogre::SubMesh * m_submesh
void setVisible(bool visible)
Ogre::MeshPtr m_mesh
Ogre::Vector3 m_flexit_center
Ogre::VertexDeclaration * m_vertex_format
Ogre::Vector3 updateVertices()
Ogre::Entity * m_tire_entity