SDFormat Editor
Loading...
Searching...
No Matches
model_viewer_interface.h
1/*
2* sdformat-editor
3* Copyright 2025 sdformat-editor
4*
5* Licensed under the Apache License, Version 2.0 (the "License");
6* you may not use this file except in compliance with the License.
7* You may obtain a copy of the License at
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS,
13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14* See the License for the specific language governing permissions and
15* limitations under the License.
16*
17* Developer: Zaid Duraid, Ean Wheeler, Evan Vokey
18*/
19
20#ifndef SDFORMAT_EDITOR_MODEL_VIEWER_INTERFACE_HH_
21#define SDFORMAT_EDITOR_MODEL_VIEWER_INTERFACE_HH_
22
23#include <iostream>
24#include <vector>
25#include <memory>
26#include <string>
27#include <mutex>
28
29#include <glm/glm.hpp>
30#include <glm/gtc/quaternion.hpp>
31
34{
36 public: typedef struct {
37 std::string model_absolute_path;
38 glm::dvec3 position;
39 glm::dquat orientation;
40 glm::dvec3 scale = {1,1,1};
41 double opacity = 1.0f;
42 } ModelInfo;
43
45 public: enum PresetType {
46 BOX,
47 CYLINDER,
48 SPHERE
49 };
50
52 public: typedef struct {
53 PresetType preset_type;
54 glm::dvec3 position;
55 glm::dquat orientation;
56 glm::dvec3 scale = {1,1,1};
57 double opacity = 1.0f;
59
62 public: virtual void Initialize() = 0;
63
66 public: virtual void RenderFrame() = 0;
67
70 public: virtual void Quit() = 0;
71
75 public: virtual void AddModel(ModelInfo model_info) = 0;
76
80 public: virtual void AddModel(PresetModelInfo model_info) = 0;
81
84 public: virtual void ResetModels() = 0;
85
89 public: virtual bool IsRunning() = 0;
90
93 public: virtual std::mutex& GetMutex() = 0;
94};
95
96#endif
Interface for the SDFormat Editor's 3D Model Vewer.
Definition model_viewer_interface.h:34
virtual void Initialize()=0
Initialization of the Model Viewer.
virtual void ResetModels()=0
Sets a flag in the model viewer to remove the models in the scene.
virtual void AddModel(ModelInfo model_info)=0
Add a model to the model viewer, the model will be rendered on the next frame.
virtual std::mutex & GetMutex()=0
Method to get the model viewer's mutex.
virtual void AddModel(PresetModelInfo model_info)=0
Add a model to the model viewer, the model will be rendered on the next frame.
virtual void Quit()=0
Tells the model viewer to quit on its next iteration.
PresetType
Preset shapes which do not require a mesh to be provided in the sdf.
Definition model_viewer_interface.h:45
virtual bool IsRunning()=0
Indicates if the model viewer is running.
virtual void RenderFrame()=0
Rander a single frame.
Struct representing information of a model's visual information.
Definition model_viewer_interface.h:36
Struct representing information of a model's visual information for pre-defined shapes.
Definition model_viewer_interface.h:52