TDME2  1.9.200
EnvironmentMappingRenderer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <vector>
5 
6 #include <tdme/tdme.h>
8 #include <tdme/engine/Camera.h>
9 #include <tdme/engine/Engine.h>
10 #include <tdme/engine/Entity.h>
11 #include <tdme/math/fwd-tdme.h>
12 #include <tdme/math/Matrix4x4.h>
13 #include <tdme/math/Vector3.h>
14 
15 using std::unique_ptr;
16 using std::vector;
17 
27 
28 /**
29  * Environment mapping
30  * @author Andreas Drewke
31  */
33 {
35 
36 private:
37  Engine* engine { nullptr };
38  unique_ptr<Camera> camera { nullptr };
39  int width { -1 };
40  int height { -1 };
41  array<Vector3, 6> forwardVectors;
42  array<Vector3, 6> sideVectors;
43  array<array<unique_ptr<FrameBuffer>, 6>, 2> frameBuffers;
44  array<int32_t, 2> cubeMapTextureIds { 0, 0 };
45  int64_t timeRenderLast { -1LL };
48  STATIC_DLL_IMPEXT static unique_ptr<GeometryBuffer> geometryBuffer;
49  int64_t timeRenderUpdateFrequency { 100LL };
52 
53  /**
54  * Init frame buffer
55  */
56  void initialize();
57 
58  /**
59  * Reshape frame buffers
60  * @param width width
61  * @param height height
62  */
63  void reshape(int32_t width, int32_t height);
64 
65  /**
66  * Disposes this shadow mapping
67  */
68  void dispose();
69 
70  /**
71  * Renders given objects in to environment cube map
72  * @param position position
73  */
74  void render(const Vector3& position);
75 
76 public:
77  // forbid class copy
79 
80  /**
81  * Public constructor
82  * @param engine engine
83  * @param width width
84  * @param height height
85  */
87 
88  /**
89  * Destructor
90  */
92 
93  /**
94  * @return width
95  */
96  inline int32_t getWidth() {
97  return width;
98  }
99 
100  /**
101  * @return height
102  */
103  inline int32_t getHeight() {
104  return height;
105  }
106 
107  /**
108  * @return render pass mask
109  */
110  inline int32_t getRenderPassMask() {
111  return renderPassMask;
112  }
113 
114  /**
115  * Set up render pass mask
116  * @param renderPassMask render pass mask
117  */
118  inline void setRenderPassMask(int32_t renderPassMask) {
119  this->renderPassMask = renderPassMask;
120  }
121 
122  /**
123  * @return render update time frequency in milliseconds
124  */
125  inline int64_t getTimeRenderUpdateFrequency() {
127  }
128 
129  /**
130  * Set up render update time frequency
131  * @param frequency frequency in milliseconds
132  */
133  inline void setTimeRenderUpdateFrequency(int64_t frequency) {
134  timeRenderUpdateFrequency = frequency;
135  }
136 
137  /**
138  * @return cube map texture id
139  */
140  inline int32_t getCubeMapTextureId() {
142  }
143 
144 };
Engine main class.
Definition: Engine.h:131
Engine entity.
Definition: Entity.h:30
static constexpr int RENDERPASS_ALL
Definition: Entity.h:84
Environment mapping entity.
Frame buffer class.
Definition: FrameBuffer.h:22
Geometry buffer class.
Light representation.
Definition: Light.h:33
Object to be used with engine class.
Definition: Object.h:60
void reshape(int32_t width, int32_t height)
Reshape frame buffers.
void setRenderPassMask(int32_t renderPassMask)
Set up render pass mask.
EnvironmentMappingRenderer(Engine *engine, int32_t width, int32_t height)
Public constructor.
void setTimeRenderUpdateFrequency(int64_t frequency)
Set up render update time frequency.
static STATIC_DLL_IMPEXT unique_ptr< GeometryBuffer > geometryBuffer
void render(const Vector3 &position)
Renders given objects in to environment cube map.
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Definition: Matrix4x4.h:23
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Definition: Vector3.h:20
#define STATIC_DLL_IMPEXT
Definition: tdme.h:15
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6