PeriDyno 1.0.0
Loading...
Searching...
No Matches
RenderEngine.h
Go to the documentation of this file.
1
16
17#pragma once
18
19#include <memory>
20#include <string>
21#include <vector>
22#include <glm/glm.hpp>
23
24#include "RenderParams.h"
25
26namespace dyno
27{
28 class SceneGraph;
29 class Node;
30 class Camera;
31 struct RenderParams;
32
34 {
37 };
38
39 // data structure for mouse selection
40 struct Selection {
41
42 struct Item {
43 std::shared_ptr<Node> node = 0;
44 int instance = -1;
45 int primitive = -1;
46 };
47
48 int x = -1;
49 int y = -1;
50 int w = -1;
51 int h = -1;
52 std::vector<Item> items;
53 };
54
55 // RenderEngine interface
57 {
58 public:
59 virtual void initialize() = 0;
60 virtual void terminate() = 0;
61
62 virtual void draw(SceneGraph* scene, const RenderParams& rparams) = 0;
63
64
65 virtual Selection select(int x, int y, int w, int h) = 0;
66
67 virtual std::string name() const = 0;
68
69 virtual void setDefaultEnvmap() {};
70
71 void setUseEnvmapBackground(bool flag) { bDrawEnvmap = flag; }
72 void setEnvmapScale(float scale) { enmapScale = scale; }
73
74 virtual void setEnvStyle(EEnvStyle style) { envStyle = style; }
75
76 public:
77
78 // Backcolor gray scale
79 glm::vec3 bgColor0 = glm::vec3(0.2f);
80 glm::vec3 bgColor1 = glm::vec3(0.8f);
81
82 // some render options...
83 bool showGround = true;
84 float planeScale = 3.f;
85 float rulerScale = 1.f;
86 glm::vec4 planeColor = { 0.3, 0.3, 0.3, 0.5 };
87 glm::vec4 rulerColor = { 0.0, 0.0, 0.0, 0.5 };
88
89 bool bDrawEnvmap = false;
90 float enmapScale = 0.0f;
91
92 bool showSceneBounds = false;
93
94 int envStyle = 0;
95 };
96};
97
virtual Selection select(int x, int y, int w, int h)=0
void setUseEnvmapBackground(bool flag)
virtual void initialize()=0
virtual void setDefaultEnvmap()
void setEnvmapScale(float scale)
virtual std::string name() const =0
virtual void terminate()=0
virtual void setEnvStyle(EEnvStyle style)
virtual void draw(SceneGraph *scene, const RenderParams &rparams)=0
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
@ Standard
int scene
Definition GltfFunc.h:20
std::shared_ptr< Node > node
std::vector< Item > items