diff --git a/docs/_model_8hpp_source.html b/docs/_model_8hpp_source.html index 26129fae..13548070 100644 --- a/docs/_model_8hpp_source.html +++ b/docs/_model_8hpp_source.html @@ -267,7 +267,7 @@
small3d::Model::indexData
std::vector< uint32_t > indexData
3 column table. Each element refers to a "row" in the vertex data table. Each "row" in the index data...
Definition: Model.hpp:155
Image.hpp
Image loading and manipulation.
small3d::Model::vertexDataByteSize
uint32_t vertexDataByteSize
Size of the vertex data, in bytes.
Definition: Model.hpp:148
-
small3d::Renderer
Renderer class (OpenGL 3.3 / OpenGL ES 3.0)
Definition: Renderer.hpp:54
+
small3d::Renderer
Renderer class (OpenGL 3.3 / OpenGL ES 3.0)
Definition: Renderer.hpp:58
small3d::Model::scale
glm::vec3 scale
Use this to scale the model and not origScale.
Definition: Model.hpp:124
small3d::Model::defaultTextureImage
std::shared_ptr< Image > defaultTextureImage
Image found in the file the model was loaded from (empty image if not - check the size)....
Definition: Model.hpp:136
small3d::Model::vertexData
std::vector< float > vertexData
The vertex data. This is an array, which is to be treated as a 4 column table, holding the x,...
Definition: Model.hpp:143
diff --git a/docs/_renderer_8hpp_source.html b/docs/_renderer_8hpp_source.html index 0624a7d6..ea660e14 100644 --- a/docs/_renderer_8hpp_source.html +++ b/docs/_renderer_8hpp_source.html @@ -78,321 +78,334 @@
14 #define GLEW_NO_GLU
15 #include <GL/glew.h>
16 #include <GLFW/glfw3.h>
-
17 #else
-
18 #ifdef __ANDROID__
-
19 #include <EGL/egl.h>
-
20 #include <GLES2/gl2.h>
-
21 #include <GLES2/gl2ext.h>
-
22 #else
-
23 #include <OpenGLES/ES2/gl.h>
-
24 #include <OpenGLES/ES2/glext.h>
-
25 #endif
-
26 #endif
-
27 
-
28 #ifdef __ANDROID__
-
29 #include "small3d_android.h"
-
30 
-
31 #endif
-
32 
-
33 #include "Logger.hpp"
-
34 #include "Image.hpp"
-
35 #include "Model.hpp"
-
36 #include "SceneObject.hpp"
-
37 
-
38 #include <unordered_map>
-
39 
-
40 
-
41 #define GLM_FORCE_RADIANS
-
42 #include <glm/glm.hpp>
-
43 #include <ft2build.h>
-
44 #include FT_FREETYPE_H
-
45 
-
46 namespace small3d
-
47 {
-
48 
-
53  class Renderer
-
54  {
-
55 
-
56  private:
-
57 
-
58 #ifndef SMALL3D_OPENGLES
-
59  GLFWwindow* window;
-
60 #else
-
61 #ifdef __ANDROID__
-
62  EGLContext eglContext;
-
63  EGLConfig eglConfig;
-
64  EGLint format;
-
65  const EGLint* config = NULL ;
-
66  int numConfigs;
-
67  int windowFormat;
-
68 
-
69  EGLDisplay eglDisplay;
-
70  EGLSurface eglSurface;
-
71 
-
72  bool eglContextValid = false;
-
73 
-
74 
-
75  void createEGLSurface(int& width, int& height);
-
76  void initEGLContext();
-
77  void terminateEGL();
-
78 #endif
-
79 #endif
-
80 
-
81 #ifdef __ANDROID__
-
82  NativeWindowType window;
-
83  std::vector<AAsset*> fontAssets;
-
84 #endif
-
85 
-
86  static int realScreenWidth, realScreenHeight;
-
87 
-
88  uint32_t shaderProgram = 0;
-
89 
-
90  uint32_t vao = 0;
+
17 #ifdef _WIN32
+
18 #define GLFW_EXPOSE_NATIVE_WIN32
+
19 #include <GLFW/glfw3native.h>
+
20 #endif
+
21 #else
+
22 #ifdef __ANDROID__
+
23 #include <EGL/egl.h>
+
24 #include <GLES2/gl2.h>
+
25 #include <GLES2/gl2ext.h>
+
26 #else
+
27 #include <OpenGLES/ES2/gl.h>
+
28 #include <OpenGLES/ES2/glext.h>
+
29 #endif
+
30 #endif
+
31 
+
32 #ifdef __ANDROID__
+
33 #include "small3d_android.h"
+
34 
+
35 #endif
+
36 
+
37 #include "Logger.hpp"
+
38 #include "Image.hpp"
+
39 #include "Model.hpp"
+
40 #include "SceneObject.hpp"
+
41 
+
42 #include <unordered_map>
+
43 
+
44 
+
45 #define GLM_FORCE_RADIANS
+
46 #include <glm/glm.hpp>
+
47 #include <ft2build.h>
+
48 #include FT_FREETYPE_H
+
49 
+
50 namespace small3d
+
51 {
+
52 
+
57  class Renderer
+
58  {
+
59 
+
60  private:
+
61 
+
62 #ifndef SMALL3D_OPENGLES
+
63  GLFWwindow* window;
+
64 #else
+
65 #ifdef __ANDROID__
+
66  EGLContext eglContext;
+
67  EGLConfig eglConfig;
+
68  EGLint format;
+
69  const EGLint* config = NULL;
+
70  int numConfigs;
+
71  int windowFormat;
+
72 
+
73  EGLDisplay eglDisplay;
+
74  EGLSurface eglSurface;
+
75 
+
76  bool eglContextValid = false;
+
77 
+
78 
+
79  void createEGLSurface(int& width, int& height);
+
80  void initEGLContext();
+
81  void terminateEGL();
+
82 #endif
+
83 #endif
+
84 
+
85 #ifdef __ANDROID__
+
86  NativeWindowType window;
+
87  std::vector<AAsset*> fontAssets;
+
88 #endif
+
89 
+
90  static int realScreenWidth, realScreenHeight;
91 
-
92  uint32_t renderOrientation = 0;
-
93  uint32_t cameraOrientation = 0;
-
94  uint32_t worldDetails = 0;
-
95  uint32_t lightUboId = 0;
-
96  uint32_t perspColourUboId = 0;
-
97  uint32_t orthoColourUboId = 0;
-
98 
-
99  bool noShaders;
-
100 
-
101  float fieldOfView = 0.0f;
-
102  float zNear = 0.0f;
-
103  float zFar = 0.0f;
+
92  uint32_t shaderProgram = 0;
+
93 
+
94  uint32_t vao = 0;
+
95 
+
96  uint32_t renderOrientation = 0;
+
97  uint32_t cameraOrientation = 0;
+
98  uint32_t worldDetails = 0;
+
99  uint32_t lightUboId = 0;
+
100  uint32_t perspColourUboId = 0;
+
101  uint32_t orthoColourUboId = 0;
+
102 
+
103  bool noShaders;
104 
-
105  glm::vec4 clearColour = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
-
106 
-
107  std::unordered_map<std::string, uint32_t> textures;
+
105  float fieldOfView = 0.0f;
+
106  float zNear = 0.0f;
+
107  float zFar = 0.0f;
108 
-
109  FT_Library library = 0;
-
110  std::vector<uint8_t> textMemory;
-
111  std::unordered_map<std::string, FT_Face> fontFaces;
+
109  glm::vec4 clearColour = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+
110 
+
111  std::unordered_map<std::string, uint32_t> textures;
112 
-
113  glm::mat4x4 cameraTransformation = glm::mat4x4(1.0f);
-
114  glm::vec3 cameraRotationXYZ = glm::vec3(0.0f);
-
115  bool cameraRotationByMatrix = false;
-
116 #ifndef SMALL3D_OPENGLES
-
117  static void framebufferSizeCallback(GLFWwindow* window, int width,
-
118  int height);
-
119 #endif
-
120  std::string loadShaderFromFile(const std::string& fileLocation) const;
-
121  uint32_t compileShader(const std::string& shaderSourceFile,
-
122  const uint32_t shaderType) const;
-
123  std::string getProgramInfoLog(const uint32_t linkedProgram) const;
-
124  std::string getShaderInfoLog(const uint32_t shader) const;
-
125  void initOpenGL();
-
126  void checkForOpenGLErrors(const std::string& when, const bool abort) const;
-
127 
-
128  void transform(Model& model, const glm::vec3& offset,
-
129  const glm::mat4x4& rotation, uint64_t currentPose) const;
-
130 
-
131  uint32_t getTextureHandle(const std::string& name) const;
-
132  uint32_t generateTexture(const std::string& name, const uint8_t* data,
-
133  const unsigned long width,
-
134  const unsigned long height,
-
135  const bool replace);
-
136 
-
137  void init(const int width, const int height, const std::string& windowTitle,
-
138  const std::string& shadersPath);
-
139  void initWindow(int& width, int& height,
-
140  const std::string& windowTitle = "");
-
141 
-
142  void setWorldDetails(bool perspective);
-
143 
-
144  void bindTexture(const std::string& name);
+
113  FT_Library library = 0;
+
114  std::vector<uint8_t> textMemory;
+
115  std::unordered_map<std::string, FT_Face> fontFaces;
+
116 
+
117  glm::mat4x4 cameraTransformation = glm::mat4x4(1.0f);
+
118  glm::vec3 cameraRotationXYZ = glm::vec3(0.0f);
+
119  bool cameraRotationByMatrix = false;
+
120 #ifndef SMALL3D_OPENGLES
+
121  static void framebufferSizeCallback(GLFWwindow* window, int width,
+
122  int height);
+
123 #endif
+
124  std::string loadShaderFromFile(const std::string& fileLocation) const;
+
125  uint32_t compileShader(const std::string& shaderSourceFile,
+
126  const uint32_t shaderType) const;
+
127  std::string getProgramInfoLog(const uint32_t linkedProgram) const;
+
128  std::string getShaderInfoLog(const uint32_t shader) const;
+
129  void initOpenGL();
+
130  void checkForOpenGLErrors(const std::string& when, const bool abort) const;
+
131 
+
132  void transform(Model& model, const glm::vec3& offset,
+
133  const glm::mat4x4& rotation, uint64_t currentPose) const;
+
134 
+
135  uint32_t getTextureHandle(const std::string& name) const;
+
136  uint32_t generateTexture(const std::string& name, const uint8_t* data,
+
137  const unsigned long width,
+
138  const unsigned long height,
+
139  const bool replace);
+
140 
+
141  void init(const int width, const int height, const std::string& windowTitle,
+
142  const std::string& shadersPath);
+
143  void initWindow(int& width, int& height,
+
144  const std::string& windowTitle = "");
145 
-
146  void clearScreen() const;
+
146  void setWorldDetails(bool perspective);
147 
-
148  Renderer(const std::string& windowTitle, const int width, const int height,
-
149  const float fieldOfView, const float zNear, const float zFar,
-
150  const std::string& shadersPath,
-
151  const uint32_t objectsPerFrame,
-
152  const uint32_t objectsPerFrameInc);
-
153 
-
154  Renderer();
-
155 
-
156  std::vector<std::tuple< Model*, glm::vec3, glm::mat4x4, glm::vec4, std::string, bool, uint64_t>> renderList;
+
148  void bindTexture(const std::string& name);
+
149 
+
150  void clearScreen() const;
+
151 
+
152  Renderer(const std::string& windowTitle, const int width, const int height,
+
153  const float fieldOfView, const float zNear, const float zFar,
+
154  const std::string& shadersPath,
+
155  const uint32_t objectsPerFrame,
+
156  const uint32_t objectsPerFrameInc);
157 
-
158  void renderTuple(std::tuple< Model*, glm::vec3, glm::mat4x4, glm::vec4, std::string, bool, uint64_t> tuple);
+
158  Renderer();
159 
-
160  GLuint depthMapFramebuffer = 0;
-
161  GLuint depthMapTexture = 0;
-
162 #ifdef SMALL3D_OPENGLES
-
163  GLuint depthRenderColourTexture = 0;
-
164 #endif
-
165  const uint32_t depthMapTextureWidth = 2048;
-
166  const uint32_t depthMapTextureHeight = 2048;
-
167  glm::mat4x4 lightSpaceMatrix = glm::mat4x4(0);
-
168  bool renderingDepthMap = false;
-
169 #ifdef SMALL3D_OPENGLES
-
170  GLuint depthRenderBuffer;
-
171 #endif
-
172 
-
173  public:
-
179  GLint origRenderbuffer = 0;
-
180 
-
186  GLint origFramebuffer = 0;
-
187 
-
191  bool shadowsActive = false;
-
192 
-
197  void start(const std::string& windowTitle, const int width, const int height,
-
198  const float fieldOfView, const float zNear, const float zFar,
-
199  const std::string& shadersPath,
-
200  const uint32_t objectsPerFrame,
-
201  const uint32_t objectsPerFrameInc);
-
202 
-
207  void stop();
-
208 
-
213  glm::vec3 lightDirection = glm::vec3(0.0f, 0.7f, 0.3f);
+
160  std::vector<std::tuple< Model*, glm::vec3, glm::mat4x4, glm::vec4, std::string, bool, uint64_t>> renderList;
+
161 
+
162  void renderTuple(std::tuple< Model*, glm::vec3, glm::mat4x4, glm::vec4, std::string, bool, uint64_t> tuple);
+
163 
+
164  GLuint depthMapFramebuffer = 0;
+
165  GLuint depthMapTexture = 0;
+
166 #ifdef SMALL3D_OPENGLES
+
167  GLuint depthRenderColourTexture = 0;
+
168 #endif
+
169  const uint32_t depthMapTextureWidth = 2048;
+
170  const uint32_t depthMapTextureHeight = 2048;
+
171  glm::mat4x4 lightSpaceMatrix = glm::mat4x4(0);
+
172  bool renderingDepthMap = false;
+
173 #ifdef SMALL3D_OPENGLES
+
174  GLuint depthRenderBuffer;
+
175 #endif
+
176 
+
177 #ifdef _WIN32
+
178  void captureScreen();
+
179 #endif
+
180 
+
181  public:
+
186  GLint origRenderbuffer = 0;
+
187 
+
192  GLint origFramebuffer = 0;
+
193 
+
197  bool shadowsActive = false;
+
198 
+
203  void start(const std::string& windowTitle, const int width, const int height,
+
204  const float fieldOfView, const float zNear, const float zFar,
+
205  const std::string& shadersPath,
+
206  const uint32_t objectsPerFrame,
+
207  const uint32_t objectsPerFrameInc);
+
208 
+
213  void stop();
214 
-
219  float shadowSpaceSize = 20.0f;
+
219  glm::vec3 lightDirection = glm::vec3(0.0f, 0.7f, 0.3f);
220 
-
224  glm::mat4x4 shadowCamTransformation =
-
225  glm::rotate(glm::mat4x4(1.0f), 1.57f, glm::vec3(1.0f, 0.0f, 0.0f)) *
-
226  glm::translate(glm::mat4x4(1.0f), glm::vec3(0.0f, -10.0f, 0.0f));
-
227 
-
232  glm::vec3 cameraPosition = glm::vec3(0, 0, 0);
+
225  float shadowSpaceSize = 20.0f;
+
226 
+
230  glm::mat4x4 shadowCamTransformation =
+
231  glm::rotate(glm::mat4x4(1.0f), 1.57f, glm::vec3(1.0f, 0.0f, 0.0f)) *
+
232  glm::translate(glm::mat4x4(1.0f), glm::vec3(0.0f, -10.0f, 0.0f));
233 
-
239  void setCameraRotation(const glm::vec3& rotation);
-
240 
-
246  void rotateCamera(const glm::vec3& rotation);
-
247 
-
253  void setCameraTransformation(const glm::mat4x4& transformation);
-
254 
-
260  const glm::vec3 getCameraOrientation() const;
-
261 
-
269  const glm::mat4x4 getCameraRotation() const;
-
270 
-
279  const glm::vec3 getCameraRotationXYZ() const;
-
280 
-
285  int getScreenWidth();
+
238  glm::vec3 cameraPosition = glm::vec3(0, 0, 0);
+
239 
+
245  void setCameraRotation(const glm::vec3& rotation);
+
246 
+
252  void rotateCamera(const glm::vec3& rotation);
+
253 
+
259  void setCameraTransformation(const glm::mat4x4& transformation);
+
260 
+
266  const glm::vec3 getCameraOrientation() const;
+
267 
+
275  const glm::mat4x4 getCameraRotation() const;
+
276 
+
285  const glm::vec3 getCameraRotationXYZ() const;
286 
-
291  int getScreenHeight();
+
291  int getScreenWidth();
292 
-
296  float lightIntensity = 1.0f;
-
297 
-
332  static Renderer& getInstance(const std::string& windowTitle = "",
-
333  const int width = 0,
-
334  const int height = 0,
-
335  const float fieldOfView = 0.785,
-
336  const float zNear = 1.0f,
-
337  const float zFar = 24.0f,
-
338  const std::string& shadersPath =
-
339 #if defined(SMALL3D_OPENGLES) && defined(__APPLE__)
-
340  "resources1/shaders/",
-
341 #else
-
342  "resources/shaders/",
-
343 #endif
-
344  const uint32_t objectsPerFrame = 200,
-
345  const uint32_t objectsPerFrameInc = 1000);
-
346 
-
350  ~Renderer();
-
351 
-
352 #ifndef SMALL3D_OPENGLES
-
353 
-
356  GLFWwindow* getWindow() const;
-
357 #endif
-
358 
-
364  void generateTexture(const std::string& name, const Image& image);
-
365 
-
377  void generateTexture(const std::string& name, const std::string& text,
-
378  const glm::vec3& colour,
-
379  const int fontSize = 48,
-
380  const std::string& fontPath =
-
381 #if defined(SMALL3D_OPENGLES) && defined(__APPLE__)
-
382  "resources1/fonts/CrusoeText/CrusoeText-Regular.ttf",
-
383 #else
-
384  "resources/fonts/CrusoeText/CrusoeText-Regular.ttf",
-
385 #endif
-
386  const bool replace = true);
-
387 
-
393  void deleteTexture(const std::string& name);
-
394 
-
402  void createRectangle(Model& rect,
-
403  const glm::vec3& topLeft,
-
404  const glm::vec3& bottomRight);
-
405 
-
423  void render(Model& model, const glm::vec3& position, const glm::vec3& rotation,
-
424  const glm::vec4& colour, const std::string& textureName = "",
-
425  const uint64_t currentPose = 0,
-
426  const bool perspective = true);
-
427 
-
437  void render(Model& model, const glm::vec3& position, const glm::vec3& rotation,
-
438  const std::string& textureName, const uint64_t currentPose = 0);
-
439 
-
457  void render(Model& model, const glm::vec3& position, const glm::mat4x4& rotation,
-
458  const glm::vec4& colour, const std::string& textureName = "",
-
459  const uint64_t currentPose = 0,
-
460  const bool perspective = true);
-
461 
-
471  void render(Model& model, const glm::vec3& position, const glm::mat4x4& rotation,
-
472  const std::string& textureName, const uint64_t currentPose = 0);
-
473 
-
486  void render(Model& model, const std::string& textureName, const uint64_t currentPose = 0,
-
487  const bool perspective = true);
-
488 
-
500  void render(Model& model, const glm::vec4& colour, const uint64_t currentPose = 0,
-
501  const bool perspective = true);
-
502 
-
508  void render(SceneObject& sceneObject, const glm::vec4& colour);
-
509 
-
516  void render(SceneObject& sceneObject, const std::string& textureName);
-
517 
-
523  void clearBuffers(Model& model) const;
-
524 
-
530  void clearBuffers(SceneObject& sceneObject) const;
-
531 
-
536  void setBackgroundColour(const glm::vec4& colour);
+
297  int getScreenHeight();
+
298 
+
302  float lightIntensity = 1.0f;
+
303 
+
338  static Renderer& getInstance(const std::string& windowTitle = "",
+
339  const int width = 0,
+
340  const int height = 0,
+
341  const float fieldOfView = 0.785,
+
342  const float zNear = 1.0f,
+
343  const float zFar = 24.0f,
+
344  const std::string& shadersPath =
+
345 #if defined(SMALL3D_OPENGLES) && defined(__APPLE__)
+
346  "resources1/shaders/",
+
347 #else
+
348  "resources/shaders/",
+
349 #endif
+
350  const uint32_t objectsPerFrame = 200,
+
351  const uint32_t objectsPerFrameInc = 1000);
+
352 
+
356  ~Renderer();
+
357 
+
358 #ifndef SMALL3D_OPENGLES
+
359 
+
362  GLFWwindow* getWindow() const;
+
363 #endif
+
364 
+
370  void generateTexture(const std::string& name, const Image& image);
+
371 
+
383  void generateTexture(const std::string& name, const std::string& text,
+
384  const glm::vec3& colour,
+
385  const int fontSize = 48,
+
386  const std::string& fontPath =
+
387 #if defined(SMALL3D_OPENGLES) && defined(__APPLE__)
+
388  "resources1/fonts/CrusoeText/CrusoeText-Regular.ttf",
+
389 #else
+
390  "resources/fonts/CrusoeText/CrusoeText-Regular.ttf",
+
391 #endif
+
392  const bool replace = true);
+
393 
+
399  void deleteTexture(const std::string& name);
+
400 
+
408  void createRectangle(Model& rect,
+
409  const glm::vec3& topLeft,
+
410  const glm::vec3& bottomRight);
+
411 
+
429  void render(Model& model, const glm::vec3& position, const glm::vec3& rotation,
+
430  const glm::vec4& colour, const std::string& textureName = "",
+
431  const uint64_t currentPose = 0,
+
432  const bool perspective = true);
+
433 
+
443  void render(Model& model, const glm::vec3& position, const glm::vec3& rotation,
+
444  const std::string& textureName, const uint64_t currentPose = 0);
+
445 
+
463  void render(Model& model, const glm::vec3& position, const glm::mat4x4& rotation,
+
464  const glm::vec4& colour, const std::string& textureName = "",
+
465  const uint64_t currentPose = 0,
+
466  const bool perspective = true);
+
467 
+
477  void render(Model& model, const glm::vec3& position, const glm::mat4x4& rotation,
+
478  const std::string& textureName, const uint64_t currentPose = 0);
+
479 
+
492  void render(Model& model, const std::string& textureName, const uint64_t currentPose = 0,
+
493  const bool perspective = true);
+
494 
+
506  void render(Model& model, const glm::vec4& colour, const uint64_t currentPose = 0,
+
507  const bool perspective = true);
+
508 
+
514  void render(SceneObject& sceneObject, const glm::vec4& colour);
+
515 
+
522  void render(SceneObject& sceneObject, const std::string& textureName);
+
523 
+
529  void clearBuffers(Model& model) const;
+
530 
+
536  void clearBuffers(SceneObject& sceneObject) const;
537 
-
542  void swapBuffers();
+
542  void setBackgroundColour(const glm::vec4& colour);
543 
-
544  Renderer(Renderer const&) = delete;
-
545  void operator=(Renderer const&) = delete;
-
546  Renderer(Renderer&&) = delete;
-
547  void operator=(Renderer&&) = delete;
-
548 
-
549  };
-
550 
-
551 }
+
548  void swapBuffers();
+
549 
+
550 #ifdef _WIN32
+
551 
+
559  bool screenCapture = false;
+
560 #endif
+
561 
+
562  Renderer(Renderer const&) = delete;
+
563  void operator=(Renderer const&) = delete;
+
564  Renderer(Renderer&&) = delete;
+
565  void operator=(Renderer&&) = delete;
+
566 
+
567  };
+
568 
+
569 }
-
small3d::Renderer::~Renderer
~Renderer()
Destructor.
Definition: Renderer.cpp:895
-
small3d::Renderer::setCameraTransformation
void setCameraTransformation(const glm::mat4x4 &transformation)
: Set the camera by transformation matrix
Definition: Renderer.cpp:858
-
small3d::Renderer::swapBuffers
void swapBuffers()
This is a double buffered system and this command swaps the buffers.
Definition: Renderer.cpp:1406
-
small3d::Renderer::getCameraRotation
const glm::mat4x4 getCameraRotation() const
: Get the rotation of the camera by transformation matrix
Definition: Renderer.cpp:869
-
small3d::Renderer::shadowSpaceSize
float shadowSpaceSize
Size of the shadows space (half-edge of the orthographic projection cube)
Definition: Renderer.hpp:219
-
small3d::Renderer::lightDirection
glm::vec3 lightDirection
Vector, indicating the direction of the light in the scene. It points towards a directional light sou...
Definition: Renderer.hpp:213
+
small3d::Renderer::~Renderer
~Renderer()
Destructor.
Definition: Renderer.cpp:908
+
small3d::Renderer::setCameraTransformation
void setCameraTransformation(const glm::mat4x4 &transformation)
: Set the camera by transformation matrix
Definition: Renderer.cpp:871
+
small3d::Renderer::swapBuffers
void swapBuffers()
This is a double buffered system and this command swaps the buffers.
Definition: Renderer.cpp:1421
+
small3d::Renderer::getCameraRotation
const glm::mat4x4 getCameraRotation() const
: Get the rotation of the camera by transformation matrix
Definition: Renderer.cpp:882
+
small3d::Renderer::shadowSpaceSize
float shadowSpaceSize
Size of the shadows space (half-edge of the orthographic projection cube)
Definition: Renderer.hpp:225
+
small3d::Renderer::lightDirection
glm::vec3 lightDirection
Vector, indicating the direction of the light in the scene. It points towards a directional light sou...
Definition: Renderer.hpp:219
Model.hpp
A 3D model class.
-
small3d::Renderer::start
void start(const std::string &windowTitle, const int width, const int height, const float fieldOfView, const float zNear, const float zFar, const std::string &shadersPath, const uint32_t objectsPerFrame, const uint32_t objectsPerFrameInc)
: Used to re-initialise the Renderer, for example in Android apps after they come back into focus.
Definition: Renderer.cpp:804
-
small3d::Renderer::createRectangle
void createRectangle(Model &rect, const glm::vec3 &topLeft, const glm::vec3 &bottomRight)
Populates a Model object with a rectangle stretching between the given coordinates.
Definition: Renderer.cpp:1097
-
small3d::Renderer::getScreenHeight
int getScreenHeight()
Get the real screen height.
Definition: Renderer.cpp:110
-
small3d::Renderer::shadowsActive
bool shadowsActive
: Render shadows?
Definition: Renderer.hpp:191
-
small3d::Renderer::stop
void stop()
: Used to shutdown the renderer, for example in Android apps when they lose focus.
Definition: Renderer.cpp:917
-
small3d::Renderer::cameraPosition
glm::vec3 cameraPosition
The camera position in world space. Ignored for orthographic rendering.
Definition: Renderer.hpp:232
+
small3d::Renderer::start
void start(const std::string &windowTitle, const int width, const int height, const float fieldOfView, const float zNear, const float zFar, const std::string &shadersPath, const uint32_t objectsPerFrame, const uint32_t objectsPerFrameInc)
: Used to re-initialise the Renderer, for example in Android apps after they come back into focus.
Definition: Renderer.cpp:817
+
small3d::Renderer::createRectangle
void createRectangle(Model &rect, const glm::vec3 &topLeft, const glm::vec3 &bottomRight)
Populates a Model object with a rectangle stretching between the given coordinates.
Definition: Renderer.cpp:1110
+
small3d::Renderer::getScreenHeight
int getScreenHeight()
Get the real screen height.
Definition: Renderer.cpp:114
+
small3d::Renderer::shadowsActive
bool shadowsActive
: Render shadows?
Definition: Renderer.hpp:197
+
small3d::Renderer::stop
void stop()
: Used to shutdown the renderer, for example in Android apps when they lose focus.
Definition: Renderer.cpp:930
+
small3d::Renderer::cameraPosition
glm::vec3 cameraPosition
The camera position in world space. Ignored for orthographic rendering.
Definition: Renderer.hpp:238
small3d::Model
A 3D model. It can be loaded from a WavefrontFile or GlbFile. It can also be constructed procedurally...
Definition: Model.hpp:38
-
small3d::Renderer::deleteTexture
void deleteTexture(const std::string &name)
Deletes the texture indicated by the given name.
Definition: Renderer.cpp:1087
-
small3d::Renderer::getCameraRotationXYZ
const glm::vec3 getCameraRotationXYZ() const
: Get the rotation of the camera in x, y, z representation. This will NOT work if the rotation was se...
Definition: Renderer.cpp:873
-
small3d::Renderer::origRenderbuffer
GLint origRenderbuffer
: Set to the id of the original renderbuffer, in case it is temporarily replaced during shadow mappin...
Definition: Renderer.hpp:179
-
small3d::Renderer::getCameraOrientation
const glm::vec3 getCameraOrientation() const
: Get the orientation of the camera
Definition: Renderer.cpp:864
+
small3d::Renderer::deleteTexture
void deleteTexture(const std::string &name)
Deletes the texture indicated by the given name.
Definition: Renderer.cpp:1100
+
small3d::Renderer::getCameraRotationXYZ
const glm::vec3 getCameraRotationXYZ() const
: Get the rotation of the camera in x, y, z representation. This will NOT work if the rotation was se...
Definition: Renderer.cpp:886
+
small3d::Renderer::origRenderbuffer
GLint origRenderbuffer
: Set to the id of the original renderbuffer, in case it is temporarily replaced during shadow mappin...
Definition: Renderer.hpp:186
+
small3d::Renderer::getCameraOrientation
const glm::vec3 getCameraOrientation() const
: Get the orientation of the camera
Definition: Renderer.cpp:877
Image.hpp
Image loading and manipulation.
-
small3d::Renderer::lightIntensity
float lightIntensity
The light intensity (set to -1.0f if no lighting is to be used).
Definition: Renderer.hpp:296
-
small3d::Renderer::clearBuffers
void clearBuffers(Model &model) const
Clear a Model from the GPU buffers (the Model itself remains intact).
Definition: Renderer.cpp:1373
-
small3d::Renderer::shadowCamTransformation
glm::mat4x4 shadowCamTransformation
Shadow camera transformation.
Definition: Renderer.hpp:224
-
small3d::Renderer
Renderer class (OpenGL 3.3 / OpenGL ES 3.0)
Definition: Renderer.hpp:54
+
small3d::Renderer::lightIntensity
float lightIntensity
The light intensity (set to -1.0f if no lighting is to be used).
Definition: Renderer.hpp:302
+
small3d::Renderer::clearBuffers
void clearBuffers(Model &model) const
Clear a Model from the GPU buffers (the Model itself remains intact).
Definition: Renderer.cpp:1388
+
small3d::Renderer::shadowCamTransformation
glm::mat4x4 shadowCamTransformation
Shadow camera transformation.
Definition: Renderer.hpp:230
+
small3d::Renderer
Renderer class (OpenGL 3.3 / OpenGL ES 3.0)
Definition: Renderer.hpp:58
small3d_android.h
Include file for Android builds.
-
small3d::Renderer::getWindow
GLFWwindow * getWindow() const
Get the GLFW window object, associated with the Renderer.
Definition: Renderer.cpp:967
-
small3d::Renderer::getInstance
static Renderer & getInstance(const std::string &windowTitle="", const int width=0, const int height=0, const float fieldOfView=0.785, const float zNear=1.0f, const float zFar=24.0f, const std::string &shadersPath="resources/shaders/", const uint32_t objectsPerFrame=200, const uint32_t objectsPerFrameInc=1000)
Get the instance of the Renderer (the Renderer is a singleton).
Definition: Renderer.cpp:880
+
small3d::Renderer::getWindow
GLFWwindow * getWindow() const
Get the GLFW window object, associated with the Renderer.
Definition: Renderer.cpp:980
+
small3d::Renderer::getInstance
static Renderer & getInstance(const std::string &windowTitle="", const int width=0, const int height=0, const float fieldOfView=0.785, const float zNear=1.0f, const float zFar=24.0f, const std::string &shadersPath="resources/shaders/", const uint32_t objectsPerFrame=200, const uint32_t objectsPerFrameInc=1000)
Get the instance of the Renderer (the Renderer is a singleton).
Definition: Renderer.cpp:893
small3d
Definition: BinaryFile.hpp:15
-
small3d::Renderer::rotateCamera
void rotateCamera(const glm::vec3 &rotation)
: Modify the rotation of the camera
Definition: Renderer.cpp:846
-
small3d::Renderer::origFramebuffer
GLint origFramebuffer
: Set to the id of the original framebuffer, in case it is temporarily replaced during shadow mapping...
Definition: Renderer.hpp:186
+
small3d::Renderer::rotateCamera
void rotateCamera(const glm::vec3 &rotation)
: Modify the rotation of the camera
Definition: Renderer.cpp:859
+
small3d::Renderer::origFramebuffer
GLint origFramebuffer
: Set to the id of the original framebuffer, in case it is temporarily replaced during shadow mapping...
Definition: Renderer.hpp:192
small3d::Image
An image, loaded from a .png file, which can be used for generating textures.
Definition: Image.hpp:29
-
small3d::Renderer::render
void render(Model &model, const glm::vec3 &position, const glm::vec3 &rotation, const glm::vec4 &colour, const std::string &textureName="", const uint64_t currentPose=0, const bool perspective=true)
Render a Model.
Definition: Renderer.cpp:1129
+
small3d::Renderer::render
void render(Model &model, const glm::vec3 &position, const glm::vec3 &rotation, const glm::vec4 &colour, const std::string &textureName="", const uint64_t currentPose=0, const bool perspective=true)
Render a Model.
Definition: Renderer.cpp:1142
SceneObject.hpp
An object on the small3d scene.
-
small3d::Renderer::getScreenWidth
int getScreenWidth()
Get the real screen width.
Definition: Renderer.cpp:106
+
small3d::Renderer::getScreenWidth
int getScreenWidth()
Get the real screen width.
Definition: Renderer.cpp:110
small3d::SceneObject
An object that appears on the 3D scene. It is made up of a Model, together with information for posit...
Definition: SceneObject.hpp:39
-
small3d::Renderer::setCameraRotation
void setCameraRotation(const glm::vec3 &rotation)
: Set the rotation of the camera
Definition: Renderer.cpp:838
-
small3d::Renderer::setBackgroundColour
void setBackgroundColour(const glm::vec4 &colour)
Set the background colour of the screen.
Definition: Renderer.cpp:1400
+
small3d::Renderer::setCameraRotation
void setCameraRotation(const glm::vec3 &rotation)
: Set the rotation of the camera
Definition: Renderer.cpp:851
+
small3d::Renderer::setBackgroundColour
void setBackgroundColour(const glm::vec4 &colour)
Set the background colour of the screen.
Definition: Renderer.cpp:1415
Logger.hpp
Logger used in small3d.