TDME2  1.9.200
DecalEditorTabView.cpp
Go to the documentation of this file.
2 
3 #include <memory>
4 #include <string>
5 
6 #include <tdme/tdme.h>
9 #include <tdme/engine/Engine.h>
10 #include <tdme/engine/Timing.h>
11 #include <tdme/math/Vector3.h>
23 #include <tdme/utilities/Console.h>
25 
26 using std::make_unique;
27 using std::string;
28 using std::unique_ptr;
29 
31 
48 
49 DecalEditorTabView::DecalEditorTabView(EditorView* editorView, const string& tabId, Prototype* prototype)
50 {
51  this->editorView = editorView;
52  this->tabId = tabId;
53  this->popUps = editorView->getPopUps();
54  this->prototype = unique_ptr<Prototype>(prototype);
55  engine = unique_ptr<Engine>(Engine::createOffScreenInstance(512, 512, true, true, false));
56  engine->setShadowMapLightEyeDistanceScale(0.1f);
57  engine->setSceneColor(Color4(39.0f / 255.0f, 39.0f / 255.0f, 39.0f / 255.0f, 1.0f));
58  cameraRotationInputHandler = make_unique<CameraRotationInputHandler>(engine.get());
59  Tools::setupPrototype(prototype, engine.get(), cameraRotationInputHandler->getLookFromRotations(), 1, objectScale, cameraRotationInputHandler.get());
61 }
62 
64 }
65 
67 {
69  cameraRotationInputHandler->handleInputEvents();
70 }
71 
73 {
74  //
75  decalEditorTabController->updateInfoText(MutableString(engine->getTiming()->getAvarageFPS()).append(" FPS"));
76 
77  //
80  engine->display();
81 }
82 
84 {
85  try {
86  decalEditorTabController = make_unique<DecalEditorTabController>(this);
88  prototypeDisplayView = decalEditorTabController->getPrototypeDisplaySubController()->getView();
89  prototypePhysicsView = decalEditorTabController->getPrototypePhysicsSubController()->getView();
90  } catch (Exception& exception) {
91  Console::println("DecalEditorTabView::initialize(): An error occurred: " + string(exception.what()));
92  }
93  // TODO: load settings
95 }
96 
98 {
99  engine->reset();
100 }
101 
103 }
104 
106  return engine.get();
107 }
108 
110  decalEditorTabController->setOutlinerAddDropDownContent();
111  decalEditorTabController->setOutlinerContent();
114 }
115 
118 }
119 
121  decalEditorTabController->setOutlinerContent();
123 }
124 
125 void DecalEditorTabView::saveFile(const string& pathName, const string& fileName) {
126  PrototypeWriter::write(pathName, fileName, prototype.get());
127 }
128 
131 }
132 
135 }
Color 4 definition class.
Definition: Color4.h:18
Engine main class.
Definition: Engine.h:131
Timing class.
Definition: Timing.h:16
Prototype definition.
Definition: Prototype.h:55
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Definition: Vector3.h:20
void restoreOutlinerState(const TabView::OutlinerState &outlinerState)
Restore outliner state.
void storeOutlinerState(TabView::OutlinerState &outlinerState)
Store outliner state.
Pop ups controller accessor class.
Definition: PopUps.h:29
void saveFile(const string &pathName, const string &fileName)
Saving prototype as tempty prototype.
void onCameraRotation() override
On rotation event to be overloaded.
void handleInputEvents() override
Handle input events that have not yet been processed.
unique_ptr< CameraRotationInputHandler > cameraRotationInputHandler
unique_ptr< DecalEditorTabController > decalEditorTabController
void onCameraScale() override
On scale event to be overloaded.
void handleInputEvents(Prototype *prototype)
Handle input events.
void setObjectScale(const Vector3 &objectScale)
Set object scale.
EditorScreenController * getScreenController()
Definition: EditorView.h:69
Console class.
Definition: Console.h:29
Mutable utf8 aware string class.
Definition: MutableString.h:23
MutableString & append(char c)
Append character.
std::exception Exception
Exception base class.
Definition: Exception.h:18