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
TerrainEditor.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 "Application.h"
25#include "RefCountingObject.h"
26
27#include <string>
28
29namespace RoR {
30
33
35class TerrainEditorObject : public RefCountingObject<TerrainEditorObject>
36{
37public:
38 // Variables are not accessible from AngelScript
39 std::string name;
40 std::string instance_name;
41 std::string type;
42 Ogre::Vector3 position = Ogre::Vector3::ZERO;
43 Ogre::Vector3 rotation = Ogre::Vector3::ZERO;
44 Ogre::Vector3 initial_position = Ogre::Vector3::ZERO;
45 Ogre::Vector3 initial_rotation = Ogre::Vector3::ZERO;
46 int tobj_cache_id = -1;
47 std::string tobj_comments;
48 // ~ only for static objects:
49 Ogre::SceneNode* static_object_node = nullptr;
50 std::vector<int> static_collision_boxes;
51 std::vector<int> static_collision_tris;
52 bool enable_collisions = true;
54 // ~ only for preloaded actors:
57
58 // Functions are exported to AngelScript
59 Ogre::Vector3 const& getPosition();
60 Ogre::Vector3 const& getRotation();
61 void setPosition(Ogre::Vector3 const& pos);
62 void setRotation(Ogre::Vector3 const& rot);
63 std::string const& getName();
64 std::string const& getInstanceName();
65 std::string const& getType();
66 // ~ only for preloaded actors:
70 void setActorInstanceId(ActorInstanceID_t instance_id);
71};
72
80{
81public:
82 void UpdateInputEvents(float dt);
89
90 static const TerrainEditorObjectPtr TERRAINEDITOROBJECTPTR_NULL; // Dummy value to be returned as const reference.
91
92private:
93
94 bool m_object_tracking = true;
96 std::string m_last_object_name;
97
98 // Use Get/Set/Clear`SelectedObject()` functions.
100};
101
103
104} // namespace RoR
Central state/object manager and communications hub.
Self reference-counting objects, as requred by AngelScript garbage collector.
Minimalist editor mode; orig.
void WriteSeparateOutputFile()
Writes 'editor_out.log' to 'config' directory - original solution, still used for zipped terrains.
void UpdateInputEvents(float dt)
TerrainEditorObjectID_t GetSelectedObjectID() const
void SetSelectedObjectByID(TerrainEditorObjectID_t id)
std::string m_last_object_name
const TerrainEditorObjectPtr & FetchSelectedObject()
TerrainEditorObjectID_t m_selected_object_id
int m_rotation_axis
0=X, 1=Y, 2=Z
static const TerrainEditorObjectPtr TERRAINEDITOROBJECTPTR_NULL
void WriteEditsToTobjFiles()
Updates existing TOBJ files - new solution, only for projects (unzipped terrains).
Represents an instance of static terrain object (.ODEF file format)
ActorInstanceID_t getActorInstanceId()
std::string const & getType()
Ogre::Vector3 const & getPosition()
std::vector< int > static_collision_tris
ActorInstanceID_t actor_instance_id
void setSpecialObjectType(TObjSpecialObject type)
Ogre::Vector3 initial_position
void setActorInstanceId(ActorInstanceID_t instance_id)
std::string const & getName()
Ogre::Vector3 initial_rotation
TObjSpecialObject special_object_type
void setPosition(Ogre::Vector3 const &pos)
std::string const & getInstanceName()
Ogre::SceneNode * static_object_node
void setRotation(Ogre::Vector3 const &rot)
std::vector< int > static_collision_boxes
TObjSpecialObject getSpecialObjectType()
std::string type
Accepts "-" as placeholder, otherwise a surveymap icon is registered.
Ogre::Vector3 const & getRotation()
int ActorInstanceID_t
Unique sequentially generated ID of an actor in session. Use ActorManager::GetActorById()
int TerrainEditorObjectID_t
Offset into RoR::TerrainObjectManager::m_editor_objects, use RoR::TERRAINEDITOROBJECTID_INVALID as em...
static const ActorInstanceID_t ACTORINSTANCEID_INVALID
TObjSpecialObject
static const TerrainEditorObjectID_t TERRAINEDITOROBJECTID_INVALID