TDME2  1.9.200
Renderer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #if defined(_MSC_VER)
4  // this suppresses a warning redefinition of APIENTRY macro
5  #define NOMINMAX
6  #include <windows.h>
7 #endif
8 #define GLFW_INCLUDE_NONE
9 #include <GLFW/glfw3.h>
10 
11 #include <array>
12 #include <map>
13 #include <string>
14 #include <vector>
15 
16 #include <tdme/tdme.h>
20 #include <tdme/engine/fwd-tdme.h>
21 #include <tdme/math/fwd-tdme.h>
22 #include <tdme/math/Matrix3x3.h>
23 #include <tdme/math/Matrix4x4.h>
25 
26 using std::array;
27 using std::map;
28 using std::string;
29 using std::vector;
30 
39 
40 /**
41  * Renderer interface
42  * @author Andreas Drewke
43  * @ersion $Id$
44  */
46 {
47 public:
48 
50 
51  /**
52  * Bean holding light properties
53  */
55  {
56  int32_t enabled { 0 };
57  array<float, 4> ambient {{ 0.0f, 0.0f, 0.0f, 1.0f }};
58  array<float, 4> diffuse {{ 1.0f, 1.0f, 1.0f, 1.0f }};
59  array<float, 4> specular {{ 1.0f, 1.0f, 1.0f, 1.0f }};
60  array<float, 4> position {{ 0.0f, 0.0f, 0.0f, 0.0f }};
61  array<float, 3> spotDirection {{ 0.0f, 0.0f, -1.0f }};
62  float spotExponent { 0.0f };
63  float spotCosCutoff { 0.0f };
64  float constantAttenuation { 1.0f };
65  float linearAttenuation { 0.0f };
66  float quadraticAttenuation { 0.0f };
67  float radius { 0.0f };
68  };
69 
70  /**
71  * Bean holding PBR material properties
72  */
74  {
75  array<float, 4> baseColorFactor {{ 1.0f, 1.0f, 1.0f, 1.0f }};
76  float metallicFactor { 1.0f };
77  float roughnessFactor { 1.0f };
78  float normalScale { 1.0f };
79  array<float, 3> emissiveFactor {{ 1.0f, 1.0f, 1.0f }};
80  float exposure { 1.0f };
83  };
84 
85  /**
86  * Bean holding specular material properties
87  */
89  {
90  array<float, 4> ambient {{ 0.2f, 0.2f, 0.2f, 1.0f }};
91  array<float, 4> diffuse {{ 0.8f, 0.8f, 0.8f, 1.0f }};
92  array<float, 4> specular {{ 0.0f, 0.0f, 0.0f, 1.0f }};
93  array<float, 4> emission {{ 0.0f, 0.0f, 0.0f, 1.0f }};
94  float shininess { 0.0f };
95  float reflection { 0.0f };
98  int textureAtlasSize { 1 };
99  array<float, 2> textureAtlasPixelDimension { 0.0f, 0.0f };
100  };
101 
103  array<float, 4> effectColorMul {{ 1.0f, 1.0f, 1.0f, 1.0f }};
104  array<float, 4> effectColorAdd {{ 0.0f, 0.0f, 0.0f, 0.0f }};
107  array<Renderer_Light, 8> lights {}; // TODO: we need this dynamically
109  float maskMaxValue { 1.0f };
110  int32_t lighting { 0 };
112  string shader;
114  };
115 
116  /**
117  * Bean holding light properties
118  */
120  {
121  int64_t time { -1LL };
122  int64_t memoryUsageGPU { -1LL };
123  int64_t memoryUsageShared { -1LL };
124  uint32_t clearCalls { 0 };
125  uint32_t renderCalls { 0 };
126  uint32_t computeCalls { 0 };
127  uint32_t instances { 0 };
128  uint32_t triangles { 0 };
129  uint32_t points { 0 };
130  uint32_t linePoints { 0 };
131  uint32_t bufferUploads { 0 };
132  uint32_t textureUploads { 0 };
133  uint32_t renderPasses { 0 };
134  uint32_t drawCommands { 0 };
135  uint32_t submits { 0 };
136  uint32_t disposedTextures { 0 };
137  uint32_t disposedBuffers { 0 };
138  };
139 
141 
143 
144  int32_t ID_NONE;
147  int32_t CULLFACE_FRONT;
148  int32_t CULLFACE_BACK;
150  int32_t PROGRAM_GUI;
152  int32_t PROGRAM_POINTS;
153  int32_t PROGRAM_LINES;
163  int32_t FRONTFACE_CW;
164  int32_t FRONTFACE_CCW;
171 
172  int32_t LIGHTING_NONE;
174  int32_t LIGHTING_PBR;
175 
179 
180 protected:
181  int32_t viewPortWidth;
182  int32_t viewPortHeight;
189  int32_t effectPass;
190  string shaderPrefix;
191 
192  vector<Renderer_Context> rendererContexts;
193 
194 public:
195  // forbid class copy
197 
198  /**
199  * Public constructor
200  */
201  Renderer();
202 
203  /**
204  * Destructor
205  */
206  virtual ~Renderer();
207 
208  /**
209  * @return renderer type
210  */
212  return rendererType;
213  }
214 
215  /**
216  * Prepare window system renderer context
217  * @param tryIdx try index
218  */
219  virtual bool prepareWindowSystemRendererContext(int tryIdx) = 0;
220 
221  /**
222  * Initialize window system renderer context
223  * @param glfwWindow GLFL window
224  */
225  virtual bool initializeWindowSystemRendererContext(GLFWwindow* glfwWindow) = 0;
226 
227  /**
228  * Initialize renderer
229  */
230  virtual void initialize() = 0;
231 
232  /**
233  * Pre Frame Initialization
234  */
235  virtual void initializeFrame() = 0;
236 
237  /**
238  * Finish frame
239  */
240  virtual void finishFrame() = 0;
241 
242  /**
243  * @return vendor
244  */
245  virtual const string getVendor() = 0;
246 
247  /**
248  * @return renderer
249  */
250  virtual const string getRenderer() = 0;
251 
252  /**
253  * @return shader version e.g. gl2, gl3 or gles2
254  */
255  virtual const string getShaderVersion() = 0;
256 
257  /**
258  * @return if renderer is supporting multi threaded rendering
259  */
261 
262  /**
263  * @return returns if texture compression is available
264  */
265  virtual bool isTextureCompressionAvailable() = 0;
266 
267  /**
268  * @return requires program attribute location
269  */
271 
272  /**
273  * @return is supporting integer program attributes
274  */
276 
277  /**
278  * @return if specular mapping is supported
279  */
280  virtual bool isSpecularMappingAvailable() = 0;
281 
282  /**
283  * @return if normal mapping is supported
284  */
285  virtual bool isNormalMappingAvailable() = 0;
286 
287  /**
288  * Checks if instanced rendering is available
289  * @return instance rendering availability
290  */
291  virtual bool isInstancedRenderingAvailable() = 0;
292 
293  /**
294  * @return if PBR lighting is supported
295  */
296  virtual bool isPBRAvailable() = 0;
297 
298  /**
299  * @return if compute shaders are available
300  */
301  virtual bool isComputeShaderAvailable() = 0;
302 
303  /**
304  * @return if OpenGL+CL is available
305  */
306  virtual bool isGLCLAvailable() = 0;
307 
308  /**
309  * @return Returns if renderer is using short indices, otherwise it uses int indices
310  */
311  virtual bool isUsingShortIndices() = 0;
312 
313  /**
314  * @return If deferred shading is available
315  */
316  virtual bool isDeferredShadingAvailable() = 0;
317 
318  /**
319  * @return number of texture units
320  */
321  virtual int32_t getTextureUnits() = 0;
322 
323  /**
324  * @return viewport width
325  */
326  inline int32_t getViewPortWidth() {
327  return viewPortWidth;
328  }
329 
330  /**
331  * @return viewport height
332  */
333  inline int32_t getViewPortHeight() {
334  return viewPortHeight;
335  }
336 
337  /**
338  * Loads a shader
339  * @param type type
340  * @param pathName path name
341  * @param fileName file name
342  * @param definitions preprocessor definitions
343  * @param functions included functions
344  * @return shader handle
345  */
346  virtual int32_t loadShader(int32_t type, const string& pathName, const string& fileName, const string& definitions = string(), const string& functions = string()) = 0;
347 
348  /**
349  * Use shader program
350  * @param contextIdx context index
351  * @param programId programId
352  */
353  virtual void useProgram(int contextIdx, int32_t programId) = 0;
354 
355  /**
356  * Creates a shader program
357  * @param type type
358  * @return int
359  */
360  virtual int32_t createProgram(int type) = 0;
361 
362  /**
363  * Attaches a shader to a program
364  * @param programId program id
365  * @param shaderId shader id
366  */
367  virtual void attachShaderToProgram(int32_t programId, int32_t shaderId) = 0;
368 
369  /**
370  * Links attached shaders to a program
371  * @param programId program id
372  * @return success
373  */
374  virtual bool linkProgram(int32_t programId) = 0;
375 
376  /**
377  * Returns location of given uniform variable
378  * @param programId program id
379  * @param name uniform name
380  * @return
381  */
382  virtual int32_t getProgramUniformLocation(int32_t programId, const string& name) = 0;
383 
384  /**
385  * Set up a integer uniform value
386  * @param contextIdx context index
387  * @param uniformId uniform id
388  * @param value value
389  */
390  virtual void setProgramUniformInteger(int contextIdx, int32_t uniformId, int32_t value) = 0;
391 
392  /**
393  * Set up a float uniform value
394  * @param contextIdx context index
395  * @param uniformId uniform id
396  * @param value value
397  */
398  virtual void setProgramUniformFloat(int contextIdx, int32_t uniformId, float value) = 0;
399 
400  /**
401  * Set up a float matrix 3x3 uniform value
402  * @param contextIdx context index
403  * @param uniformId uniform id
404  * @param value value
405  */
406  virtual void setProgramUniformFloatMatrix3x3(int contextIdx, int32_t uniformId, const array<float, 9>& value) = 0;
407 
408  /**
409  * Set up a float matrix 4x4 uniform value
410  * @param contextIdx context index
411  * @param uniformId uniform id
412  * @param value value
413  */
414  virtual void setProgramUniformFloatMatrix4x4(int contextIdx, int32_t uniformId, const array<float, 16>& value) = 0;
415 
416  /**
417  * Set up a float matrices 4x4 uniform values
418  * @param contextIdx context index
419  * @param uniformId uniform id
420  * @param count count
421  * @param data data
422  */
423  virtual void setProgramUniformFloatMatrices4x4(int contextIdx, int32_t uniformId, int32_t count, FloatBuffer* data) = 0;
424 
425  /**
426  * Set up a float vec4 uniform value
427  * @param contextIdx context index
428  * @param uniformId uniform id
429  * @param data data
430  */
431  virtual void setProgramUniformFloatVec4(int contextIdx, int32_t uniformId, const array<float, 4>& data) = 0;
432 
433  /**
434  * Set up a float vec3 uniform value
435  * @param contextIdx context index
436  * @param uniformId uniform id
437  * @param data data
438  */
439  virtual void setProgramUniformFloatVec3(int contextIdx, int32_t uniformId, const array<float, 3>& data) = 0;
440 
441  /**
442  * Set up a float vec2 uniform value
443  * @param contextIdx context index
444  * @param uniformId uniform id
445  * @param data data
446  */
447  virtual void setProgramUniformFloatVec2(int contextIdx, int32_t uniformId, const array<float, 2>& data) = 0;
448 
449  /**
450  * Bind attribute to a input location
451  * @param programId program id
452  * @param location location
453  * @param name attribute name
454  */
455  virtual void setProgramAttributeLocation(int32_t programId, int32_t location, const string& name) = 0;
456 
457  /**
458  * Get effect pass
459  * @return effect pass
460  */
461  inline int32_t getEffectPass() {
462  return effectPass;
463  }
464 
465  /**
466  * Set effect pass
467  * @param effectPass effect pass
468  */
469  inline void setEffectPass(int32_t effectPass) {
470  this->effectPass = effectPass;
471  }
472 
473  /**
474  * Get shader prefix
475  * @return shader prefix
476  */
477  inline const string& getShaderPrefix() {
478  return shaderPrefix;
479  }
480 
481  /**
482  * Set shader prefix
483  * @param shaderPrefix shader prefix
484  */
485  inline void setShaderPrefix(const string& shaderPrefix) {
486  this->shaderPrefix = shaderPrefix;
487  }
488 
489  /**
490  * Get current lighting model
491  * @param contextIdx context index
492  * @return lighting, see LIGHTING_*
493  */
494  inline int32_t getLighting(int contextIdx) {
495  auto& rendererContext = rendererContexts[contextIdx];
496  return rendererContext.lighting;
497  }
498 
499  /**
500  * Set current lighting model
501  * @param contextIdx context index
502  * @param lighting lighting, see LIGHTING_*
503  */
504  inline void setLighting(int contextIdx, int32_t lighting) {
505  auto& rendererContext = rendererContexts[contextIdx];
506  rendererContext.lighting = lighting;
507  }
508 
509  /**
510  * @return camera position
511  */
513  return cameraPosition;
514  }
515 
516  /**
517  * Set up viewport parameter
518  * @param width width
519  * @param height height
520  */
521  virtual void setViewPort(int32_t width, int32_t height) = 0;
522 
523  /**
524  * Update viewport
525  */
526  virtual void updateViewPort() = 0;
527 
528  /**
529  * @return projection matrix
530  */
532  return projectionMatrix;
533  }
534 
535  /**
536  * Update projection matrix event
537  * @param contextIdx context index
538  */
539  virtual void onUpdateProjectionMatrix(int contextIdx) = 0;
540 
541  /**
542  * @return camera matrix
543  */
545  return cameraMatrix;
546  }
547 
548  /**
549  * Update camera matrix event
550  * @param contextIdx context index
551  */
552  virtual void onUpdateCameraMatrix(int contextIdx) = 0;
553 
554  /**
555  * @return model view matrix or in some cases the model matrix
556  */
558  return modelViewMatrix;
559  }
560 
561  /**
562  * Update model view matrix event
563  * @param contextIdx context index
564  */
565  virtual void onUpdateModelViewMatrix(int contextIdx) = 0;
566 
567  /**
568  * @return view port matrix
569  */
571  return viewportMatrix;
572  }
573 
574  /**
575  * Get texture matrix
576  * @param contextIdx context index
577  * @return texture matrix
578  */
579  inline Matrix3x3& getTextureMatrix(int contextIdx) {
580  auto& rendererContext = rendererContexts[contextIdx];
581  return rendererContext.textureMatrix;
582  }
583 
584  /**
585  * Update texture matrix for active texture unit event
586  * @param contextIdx context index
587  */
588  virtual void onUpdateTextureMatrix(int contextIdx) = 0;
589 
590  /**
591  * Set up clear color
592  * @param red red
593  * @param green green
594  * @param blue blue
595  * @param alpha alpha
596  */
597  virtual void setClearColor(float red, float green, float blue, float alpha) = 0;
598 
599  /**
600  * Enable culling
601  * @param contextIdx context index
602  */
603  virtual void enableCulling(int contextIdx) = 0;
604 
605  /**
606  * Disable culling
607  * @param contextIdx context index
608  */
609  virtual void disableCulling(int contextIdx) = 0;
610 
611  /**
612  * Set up clock wise or counter clock wise faces as front face
613  * @param contextIdx context index
614  * @param frontFace frontFace
615  */
616  virtual void setFrontFace(int contextIdx, int32_t frontFace) = 0;
617 
618  /**
619  * Sets up which face will be culled
620  * @param cullFace cull face
621  */
622  virtual void setCullFace(int32_t cullFace) = 0;
623 
624  /**
625  * Enables blending
626  */
627  virtual void enableBlending() = 0;
628 
629  /**
630  * Enable blending with c = a + b
631  */
632  virtual void enableAdditionBlending() = 0;
633 
634  /**
635  * Disables blending
636  */
637  virtual void disableBlending() = 0;
638 
639  /**
640  * Enable depth buffer writing
641  */
642  virtual void enableDepthBufferWriting() = 0;
643 
644  /**
645  * Disable depth buffer writing
646  */
647  virtual void disableDepthBufferWriting() = 0;
648 
649  /**
650  * Disable depth buffer test
651  */
652  virtual void disableDepthBufferTest() = 0;
653 
654  /**
655  * Enable depth buffer test
656  */
657  virtual void enableDepthBufferTest() = 0;
658 
659  /**
660  * Set up depth function
661  * @param depthFunction depth function
662  */
663  virtual void setDepthFunction(int32_t depthFunction) = 0;
664 
665  /**
666  * Set up GL rendering colormask
667  * @param red red
668  * @param green green
669  * @param blue blue
670  * @param alpha alpha
671  */
672  virtual void setColorMask(bool red, bool green, bool blue, bool alpha) = 0;
673 
674  /**
675  * Clear render buffer with given mask
676  * @param mask mask
677  */
678  virtual void clear(int32_t mask) = 0;
679 
680  /**
681  * Creates a texture
682  * @return texture id
683  */
684  virtual int32_t createTexture() = 0;
685 
686  /**
687  * Creates a depth buffer texture
688  * @param width width
689  * @param height height
690  * @oaram cubeMapTextureId cube map texture id
691  * @param cubeMapTextureIndex cube map texture index
692  * @return depth texture id
693  */
694  virtual int32_t createDepthBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex) = 0;
695 
696  /**
697  * Creates a color buffer texture
698  * @param width width
699  * @param height height
700  * @oaram cubeMapTextureId cube map texture id
701  * @param cubeMapTextureIndex cube map texture index
702  * @return color buffer texture id
703  */
704  virtual int32_t createColorBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex) = 0;
705 
706  /**
707  * Creates a geometry buffer geometry texture
708  * @param width width
709  * @param height height
710  * @return geometry buffer geometry texture id
711  */
712  virtual int32_t createGBufferGeometryTexture(int32_t width, int32_t height) = 0;
713 
714  /**
715  * Creates a geometry buffer color RGBA texture
716  * @param width width
717  * @param height height
718  * @return geometry buffer color RGBA texture id
719  */
720  virtual int32_t createGBufferColorTexture(int32_t width, int32_t height) = 0;
721 
722  /**
723  * Uploads texture data to current bound texture
724  * @param contextIdx context index
725  * @param texture texture
726  */
727  virtual void uploadTexture(int contextIdx, Texture* texture) = 0;
728 
729  /**
730  * Uploads cube map texture data to current bound texture
731  * @param contextIdx context index
732  * @param textureLeft texture left
733  * @param textureRight texture right
734  * @param textureTop texture top
735  * @param textureBottom texture bottom
736  * @param textureFront texture front
737  * @param textureBack texture back
738  */
739  virtual void uploadCubeMapTexture(int contextIdx, Texture* textureLeft, Texture* textureRight, Texture* textureTop, Texture* textureBottom, Texture* textureFront, Texture* textureBack) = 0;
740 
741  /**
742  * Create cube map texture from frame buffers
743  * @param contextIdx context index
744  * @param width width
745  * @param height height
746  * @return texture id
747  */
748  virtual int32_t createCubeMapTexture(int contextIdx, int32_t width, int32_t height) = 0;
749 
750  /**
751  * Resizes a depth texture
752  * @param textureId texture id
753  * @param width width
754  * @param height height
755  */
756  virtual void resizeDepthBufferTexture(int32_t textureId, int32_t width, int32_t height) = 0;
757 
758  /**
759  * Resize color buffer texture
760  * @param textureId texture id
761  * @param width width
762  * @param height height
763  */
764  virtual void resizeColorBufferTexture(int32_t textureId, int32_t width, int32_t height) = 0;
765 
766  /**
767  * Resizes a geometry buffer geometry texture
768  * @param textureId texture id
769  * @param width width
770  * @param height height
771  * @return geometry buffer geometry texture id
772  */
773  virtual void resizeGBufferGeometryTexture(int32_t textureId, int32_t width, int32_t height) = 0;
774 
775  /**
776  * Resizes a geometry buffer color RGBA texture
777  * @param textureId texture id
778  * @param width width
779  * @param height height
780  * @return geometry buffer color RGBA texture id
781  */
782  virtual void resizeGBufferColorTexture(int32_t textureId, int32_t width, int32_t height) = 0;
783 
784  /**
785  * Binds a texture with given id or unbinds when using ID_NONE
786  * @param contextIdx context index
787  * @param textureId textureId
788  */
789  virtual void bindTexture(int contextIdx, int32_t textureId) = 0;
790 
791  /**
792  * Binds a cube map texture with given id or unbinds when using ID_NONE
793  * @param contextIdx context index
794  * @param textureId textureId
795  */
796  virtual void bindCubeMapTexture(int contextIdx, int32_t textureId) = 0;
797 
798  /**
799  * On bind texture event
800  * @param contextIdx context index
801  * @param textureId textureId
802  */
803  virtual void onBindTexture(int contextIdx, int32_t textureId) = 0;
804 
805  /**
806  * Dispose a texture
807  * @param textureId texture id
808  */
809  virtual void disposeTexture(int32_t textureId) = 0;
810 
811  /**
812  * Creates a frame buffer object with depth texture attached
813  * @param depthBufferTextureId depth buffer texture id
814  * @param colorBufferTextureId color buffer texture id
815  * @param cubeMapTextureId cube map texture id
816  * @param cubeMapTextureIndex cube map texture index
817  * @return frame buffer object id
818  */
819  virtual int32_t createFramebufferObject(int32_t depthBufferTextureId, int32_t colorBufferTextureId, int32_t cubeMapTextureId = 0, int32_t cubeMapTextureIndex = 0) = 0;
820 
821  /**
822  * Creates a geometry frame buffer object
823  * @param depthBufferTextureId depth buffer texture id
824  * @param geometryBufferTextureId1 geometry texture id 1
825  * @param geometryBufferTextureId2 geometry texture id 2
826  * @param geometryBufferTextureId3 geometry texture id 3
827  * @param colorBufferTextureId1 color buffer texture id 1
828  * @param colorBufferTextureId2 color buffer texture id 2
829  * @param colorBufferTextureId3 color buffer texture id 3
830  * @param colorBufferTextureId4 color buffer texture id 4
831  * @param colorBufferTextureId5 color buffer texture id 5
832  * @return frame buffer object id
833  */
834  virtual int32_t createGeometryBufferObject(
835  int32_t depthBufferTextureId,
836  int32_t geometryBufferTextureId1,
837  int32_t geometryBufferTextureId2,
838  int32_t geometryBufferTextureId3,
839  int32_t colorBufferTextureId1,
840  int32_t colorBufferTextureId2,
841  int32_t colorBufferTextureId3,
842  int32_t colorBufferTextureId4,
843  int32_t colorBufferTextureId5
844  ) = 0;
845 
846  /**
847  * Enables a framebuffer to be rendered
848  * @param frameBufferId frameBufferId
849  */
850  virtual void bindFrameBuffer(int32_t frameBufferId) = 0;
851 
852  /**
853  * Disposes a frame buffer object
854  * @param frameBufferId frame buffer id
855  */
856  virtual void disposeFrameBufferObject(int32_t frameBufferId) = 0;
857 
858  /**
859  * Generate buffer objects for vertex data and such
860  * @param buffers buffers
861  * @param useGPUMemory use GPU memory
862  * @param shared shared between different threads
863  * @return ids
864  */
865  virtual vector<int32_t> createBufferObjects(int32_t buffers, bool useGPUMemory, bool shared) = 0;
866 
867  /**
868  * Uploads buffer data to buffer object
869  * @param contextIdx context index
870  * @param bufferObjectId buffer object id
871  * @param size size
872  * @param data data
873  */
874  virtual void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, FloatBuffer* data) = 0;
875 
876  /**
877  * Uploads buffer data to buffer object
878  * @param contextIdx context index
879  * @param bufferObjectId buffer object id
880  * @param size size
881  * @param data data
882  */
883  virtual void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer* data) = 0;
884 
885  /**
886  * Uploads buffer data to buffer object
887  * @param contextIdx context index
888  * @param bufferObjectId buffer object id
889  * @param size size
890  * @param data data
891  */
892  virtual void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, ShortBuffer* data) = 0;
893 
894  /**
895  * Uploads buffer data to buffer object
896  * @param contextIdx context index
897  * @param bufferObjectId buffer object id
898  * @param size size
899  * @param data data
900  */
901  virtual void uploadIndicesBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, ShortBuffer* data) = 0;
902 
903  /**
904  * Uploads buffer data to buffer object
905  * @param contextIdx context index
906  * @param bufferObjectId buffer object id
907  * @param size size
908  * @param data data
909  */
910  virtual void uploadIndicesBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer* data) = 0;
911 
912  /**
913  * Bind indices buffer object
914  * @param contextIdx context index
915  * @param bufferObjectId buffer object id
916  */
917  virtual void bindIndicesBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
918 
919  /**
920  * Bind solid colors buffer object
921  * @param contextIdx context index
922  * @param bufferObjectId buffer object id
923  */
924  virtual void bindSolidColorsBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
925 
926  /**
927  * Bind texture coordinates buffer object
928  * @param contextIdx context index
929  * @param bufferObjectId buffer object id
930  */
931  virtual void bindTextureCoordinatesBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
932 
933  /**
934  * Bind vertices buffer object
935  * @param contextIdx context index
936  * @param bufferObjectId buffer object id
937  */
938  virtual void bindVerticesBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
939 
940  /**
941  * Bind vertices 2 buffer object
942  * @param contextIdx context index
943  * @param bufferObjectId buffer object id
944  */
945  virtual void bindVertices2BufferObject(int contextIdx, int32_t bufferObjectId) = 0;
946 
947  /**
948  * Bind normals buffer object
949  * @param contextIdx context index
950  * @param bufferObjectId buffer object id
951  */
952  virtual void bindNormalsBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
953 
954  /**
955  * Bind colors buffer object
956  * @param contextIdx context index
957  * @param bufferObjectId buffer object id
958  */
959  virtual void bindColorsBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
960 
961  /**
962  * Bind tangents buffer object
963  * @param contextIdx context index
964  * @param bufferObjectId buffer object id
965  */
966  virtual void bindTangentsBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
967 
968  /**
969  * Bind bitangents buffer object
970  * @param contextIdx context index
971  * @param bufferObjectId buffer object id
972  */
973  virtual void bindBitangentsBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
974 
975  /**
976  * Bind model matrices buffer object
977  * @param contextIdx context index
978  * @param bufferObjectId buffer object id
979  */
980  virtual void bindModelMatricesBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
981 
982  /**
983  * Bind effect color muls buffer object
984  * @param contextIdx context index
985  * @param bufferObjectId buffer object id
986  * @param divisor divisor
987  */
988  virtual void bindEffectColorMulsBufferObject(int contextIdx, int32_t bufferObjectId, int32_t divisor) = 0;
989 
990  /**
991  * Bind effect color adds buffer object
992  * @param contextIdx context index
993  * @param bufferObjectId buffer object id
994  * @param divisor divisor
995  */
996  virtual void bindEffectColorAddsBufferObject(int contextIdx, int32_t bufferObjectId, int32_t divisor) = 0;
997 
998  /**
999  * Bind origins buffer object
1000  * @param contextIdx context index
1001  * @param bufferObjectId buffer object id
1002  */
1003  virtual void bindOriginsBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1004 
1005  /**
1006  * Bind texture and sprite indices buffer object
1007  * @param contextIdx context index
1008  * @param bufferObjectId buffer object id
1009  */
1010  virtual void bindTextureSpriteIndicesBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1011 
1012  /**
1013  * Bind point sizes buffer object
1014  * @param contextIdx context index
1015  * @param bufferObjectId buffer object id
1016  */
1017  virtual void bindPointSizesBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1018 
1019  /**
1020  * Bind sprite sheet dimension buffer object
1021  * @param contextIdx context index
1022  * @param bufferObjectId buffer object id
1023  */
1024  virtual void bindSpriteSheetDimensionBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1025 
1026  /**
1027  * Draw instanced indexed triangles from buffer objects
1028  * @param contextIdx context index
1029  * @param triangles triangles
1030  * @param trianglesOffset triangles offset
1031  * @param instances instances
1032  */
1033  virtual void drawInstancedIndexedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, int32_t instances) = 0;
1034 
1035  /**
1036  * Draw indexed triangles from buffer objects
1037  * @param contextIdx context index
1038  * @param triangles triangles
1039  * @param trianglesOffset triangles offset
1040  */
1041  virtual void drawIndexedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset) = 0;
1042 
1043  /**
1044  * Draw instanced triangles from buffer objects
1045  * @param contextIdx context index
1046  * @param triangles triangles
1047  * @param trianglesOffset triangles offset
1048  * @param instances instances
1049  */
1050  virtual void drawInstancedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, int32_t instances) = 0;
1051 
1052  /**
1053  * Draw triangles from buffer objects
1054  * @param contextIdx context index
1055  * @param triangles triangles
1056  * @param trianglesOffset triangles offset
1057  */
1058  virtual void drawTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset) = 0;
1059 
1060  /**
1061  * Draw points from buffer objects
1062  * @param contextIdx context index
1063  * @param points points
1064  * @param pointsOffset points offset
1065  */
1066  virtual void drawPointsFromBufferObjects(int contextIdx, int32_t points, int32_t pointsOffset) = 0;
1067 
1068  /**
1069  * Set line width
1070  * @param lineWidth line width
1071  */
1072  virtual void setLineWidth(float lineWidth) = 0;
1073 
1074  /**
1075  * Draw lines from buffer objects
1076  * @param contextIdx context index
1077  * @param points points
1078  * @param pointsOffset points offset
1079  */
1080  virtual void drawLinesFromBufferObjects(int contextIdx, int32_t points, int32_t pointsOffset) = 0;
1081 
1082  /**
1083  * Unbind buffer objects
1084  * @param contextIdx context index
1085  */
1086  virtual void unbindBufferObjects(int contextIdx) = 0;
1087 
1088  /**
1089  * Disposes a frame buffer object
1090  * @param bufferObjectIds frame buffer id
1091  */
1092  virtual void disposeBufferObjects(vector<int32_t>& bufferObjectIds) = 0;
1093 
1094  /**
1095  * Get texture unit
1096  * @param contextIdx context index
1097  * @return active texture unit
1098  */
1099  virtual int32_t getTextureUnit(int contextIdx) = 0;
1100 
1101  /**
1102  * Sets up texture unit
1103  * @param contextIdx context index
1104  * @param textureUnit texture unit
1105  */
1106  virtual void setTextureUnit(int contextIdx, int32_t textureUnit) = 0;
1107 
1108  /**
1109  * Get light
1110  * @param contextIdx context index
1111  * @param lightId light id
1112  * @return light
1113  */
1114  inline Renderer_Light& getLight(int contextIdx, int32_t lightIdx) {
1115  auto& rendererContext = rendererContexts[contextIdx];
1116  return rendererContext.lights[lightIdx];
1117  }
1118 
1119  /**
1120  * Update light
1121  * @param contextIdx context index
1122  * @param lightId light id
1123  */
1124  virtual void onUpdateLight(int contextIdx, int32_t lightId) = 0;
1125 
1126  /**
1127  * Get effect color mul
1128  * @param context
1129  * @return effect color mul
1130  */
1131  inline array<float, 4>& getEffectColorMul(int contextIdx) {
1132  auto& rendererContext = rendererContexts[contextIdx];
1133  return rendererContext.effectColorMul;
1134  }
1135 
1136  /**
1137  * Get effect color add
1138  * @param context
1139  * @return effect color add
1140  */
1141  inline array<float, 4>& getEffectColorAdd(int contextIdx) {
1142  auto& rendererContext = rendererContexts[contextIdx];
1143  return rendererContext.effectColorAdd;
1144  }
1145 
1146  /**
1147  * Update material
1148  * @param contextIdx context index
1149  */
1150  virtual void onUpdateEffect(int contextIdx) = 0;
1151 
1152  /**
1153  * Get specular material
1154  * @param contextIdx context index
1155  * @return material
1156  */
1158  auto& rendererContext = rendererContexts[contextIdx];
1159  return rendererContext.specularMaterial;
1160  }
1161 
1162  /**
1163  * Get PBR material
1164  * @param contextIdx context index
1165  * @return material
1166  */
1167  inline Renderer_PBRMaterial& getPBRMaterial(int contextIdx) {
1168  auto& rendererContext = rendererContexts[contextIdx];
1169  return rendererContext.pbrMaterial;
1170  }
1171 
1172  /**
1173  * On update material
1174  * @param contextIdx context index
1175  */
1176  virtual void onUpdateMaterial(int contextIdx) = 0;
1177 
1178  /**
1179  * Get shader
1180  * @param contextIdx context index
1181  */
1182  inline const string& getShader(int contextIdx) {
1183  auto& rendererContext = rendererContexts[contextIdx];
1184  return rendererContext.shader;
1185  }
1186 
1187  /**
1188  * Set shader
1189  * @param contextIdx context index
1190  * @param id shader id
1191  * @param parameters parameters
1192  */
1193  inline void setShader(int contextIdx, const string& id) {
1194  auto& rendererContext = rendererContexts[contextIdx];
1195  rendererContext.shader = id;
1196  }
1197 
1198  /**
1199  * On update shader
1200  * @param contextIdx context index
1201  */
1202  virtual void onUpdateShader(int contextIdx) = 0;
1203 
1204  /**
1205  * Get shader parameters
1206  * @param contextIdx context index
1207  * @return shader parameters
1208  */
1209  inline const EntityShaderParameters& getShaderParameters(int contextIdx) {
1210  auto& rendererContext = rendererContexts[contextIdx];
1211  return rendererContext.shaderParameters;
1212  }
1213 
1214  /**
1215  * Set shader parameters
1216  * @param contextIdx context index
1217  * @param parameters shader parameters
1218  */
1219  inline void setShaderParameters(int contextIdx, const EntityShaderParameters& parameters) {
1220  auto& rendererContext = rendererContexts[contextIdx];
1221  rendererContext.shaderParameters = parameters;
1222  }
1223 
1224  /**
1225  * On update shader parameters
1226  * @param contextIdx context index
1227  */
1228  virtual void onUpdateShaderParameters(int contextIdx) = 0;
1229 
1230  /**
1231  * Reads a pixel depth
1232  * @param x x
1233  * @param y y
1234  * @return depth 0.0f..1.0f
1235  */
1236  virtual float readPixelDepth(int32_t x, int32_t y) = 0;
1237 
1238  /**
1239  * Read pixels
1240  * @param x x
1241  * @param y y
1242  * @param width width
1243  * @param height height
1244  * @return byte buffer
1245  */
1246  virtual ByteBuffer* readPixels(int32_t x, int32_t y, int32_t width, int32_t height) = 0;
1247 
1248  /**
1249  * Dispatch compute
1250  * @param contextIdx context index
1251  * @param numGroupsX num groups x
1252  * @param numGroupsY num groups y
1253  * @param numGroupsZ num groups z
1254  */
1255  virtual void dispatchCompute(int contextIdx, int32_t numGroupsX, int32_t numGroupsY, int32_t numGroupsZ) = 0;
1256 
1257  /**
1258  * Memory barrier
1259  */
1260  virtual void memoryBarrier() = 0;
1261 
1262  /**
1263  * Upload skinning buffer object
1264  * @param contextIdx context index
1265  * @param bufferObjectId buffer object id
1266  * @param size size
1267  * @param data data
1268  */
1269  virtual void uploadSkinningBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, FloatBuffer* data) = 0;
1270 
1271  /**
1272  * Upload skinning buffer object
1273  * @param contextIdx context index
1274  * @param bufferObjectId buffer object id
1275  * @param size size
1276  * @param data data
1277  */
1278  virtual void uploadSkinningBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer* data) = 0;
1279 
1280  /**
1281  * Bind skinning vertices buffer object
1282  * @param contextIdx context index
1283  * @param bufferObjectId buffer object id
1284  */
1285  virtual void bindSkinningVerticesBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1286 
1287  /**
1288  * Bind skinning normal buffer object
1289  * @param contextIdx context index
1290  * @param bufferObjectId buffer object id
1291  */
1292  virtual void bindSkinningNormalsBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1293 
1294  /**
1295  * Bind skinning vertex joints buffer object
1296  * @param contextIdx context index
1297  * @param bufferObjectId buffer object id
1298  */
1299  virtual void bindSkinningVertexJointsBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1300 
1301  /**
1302  * Bind skinning vertex joint indices buffer object
1303  * @param contextIdx context index
1304  * @param bufferObjectId buffer object id
1305  */
1306  virtual void bindSkinningVertexJointIdxsBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1307 
1308  /**
1309  * Bind skinning vertex joint weights buffer object
1310  * @param contextIdx context index
1311  * @param bufferObjectId buffer object id
1312  */
1313  virtual void bindSkinningVertexJointWeightsBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1314 
1315  /**
1316  * Bind skinning vertices result buffer object
1317  * @param contextIdx context index
1318  * @param bufferObjectId buffer object id
1319  */
1320  virtual void bindSkinningVerticesResultBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1321 
1322  /**
1323  * Bind skinning normals result buffer object
1324  * @param contextIdx context index
1325  * @param bufferObjectId buffer object id
1326  */
1327  virtual void bindSkinningNormalsResultBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1328 
1329  /**
1330  * Bind skinning matrices result buffer object
1331  * @param contextIdx context index
1332  * @param bufferObjectId buffer object id
1333  */
1334  virtual void bindSkinningMatricesBufferObject(int contextIdx, int32_t bufferObjectId) = 0;
1335 
1336  /**
1337  * Get mask max value
1338  * @return mask max value
1339  */
1340  inline float getMaskMaxValue(int contextIdx) {
1341  auto& rendererContext = rendererContexts[contextIdx];
1342  return rendererContext.maskMaxValue;
1343  }
1344 
1345  /**
1346  * Set mask max value
1347  * @param contextIdx context index
1348  * @param maskMinValue mask mask value
1349  */
1350  inline void setMaskMaxValue(int contextIdx, float maskMaxValue) {
1351  auto& rendererContext = rendererContexts[contextIdx];
1352  rendererContext.maskMaxValue = maskMaxValue;
1353  }
1354 
1355  /**
1356  * Get environment mapping cube map position
1357  * @param contextIdx context index
1358  * @return environment mapping position
1359  */
1360  inline array<float, 3>& getEnvironmentMappingCubeMapPosition(int contextIdx) {
1361  auto& rendererContext = rendererContexts[contextIdx];
1362  return rendererContext.environmentMappingCubeMapPosition;
1363  }
1364 
1365  /**
1366  * Set environment mapping cube map position
1367  * @param contextIdx context index
1368  * @param position position
1369  */
1370  inline void setEnvironmentMappingCubeMapPosition(int contextIdx, const array<float, 3>& position) {
1371  auto& rendererContext = rendererContexts[contextIdx];
1372  rendererContext.environmentMappingCubeMapPosition = position;
1373  }
1374 
1375  /**
1376  * Set up renderer for GUI rendering
1377  */
1378  virtual void initGuiMode() = 0;
1379 
1380  /**
1381  * Set up renderer for 3d rendering
1382  */
1383  virtual void doneGuiMode() = 0;
1384 
1385  /**
1386  * Enable/Disable v-sync
1387  * @param vSync V-sync enabled
1388  */
1389  virtual void setVSync(bool vSync) = 0;
1390 
1391  /**
1392  * @return renderer statistics
1393  */
1394  virtual const Renderer_Statistics getStatistics() = 0;
1395 
1396 };
TDME2 engine entity shader parameters.
Texture entity.
Definition: Texture.h:24
virtual void setTextureUnit(int contextIdx, int32_t textureUnit)=0
Sets up texture unit.
virtual void bindCubeMapTexture(int contextIdx, int32_t textureId)=0
Binds a cube map texture with given id or unbinds when using ID_NONE.
virtual void enableAdditionBlending()=0
Enable blending with c = a + b.
virtual void uploadIndicesBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer *data)=0
Uploads buffer data to buffer object.
virtual int32_t loadShader(int32_t type, const string &pathName, const string &fileName, const string &definitions=string(), const string &functions=string())=0
Loads a shader.
virtual void uploadIndicesBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, ShortBuffer *data)=0
Uploads buffer data to buffer object.
virtual void resizeDepthBufferTexture(int32_t textureId, int32_t width, int32_t height)=0
Resizes a depth texture.
virtual void onUpdateProjectionMatrix(int contextIdx)=0
Update projection matrix event.
virtual void initializeFrame()=0
Pre Frame Initialization.
void setEnvironmentMappingCubeMapPosition(int contextIdx, const array< float, 3 > &position)
Set environment mapping cube map position.
Definition: Renderer.h:1370
virtual void setViewPort(int32_t width, int32_t height)=0
Set up viewport parameter.
virtual void drawInstancedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, int32_t instances)=0
Draw instanced triangles from buffer objects.
array< float, 4 > & getEffectColorAdd(int contextIdx)
Get effect color add.
Definition: Renderer.h:1141
array< float, 3 > & getEnvironmentMappingCubeMapPosition(int contextIdx)
Get environment mapping cube map position.
Definition: Renderer.h:1360
virtual void memoryBarrier()=0
Memory barrier.
virtual void bindEffectColorMulsBufferObject(int contextIdx, int32_t bufferObjectId, int32_t divisor)=0
Bind effect color muls buffer object.
Matrix3x3 & getTextureMatrix(int contextIdx)
Get texture matrix.
Definition: Renderer.h:579
virtual void bindSkinningVertexJointIdxsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning vertex joint indices buffer object.
virtual void setProgramUniformFloatVec4(int contextIdx, int32_t uniformId, const array< float, 4 > &data)=0
Set up a float vec4 uniform value.
virtual void drawInstancedIndexedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, int32_t instances)=0
Draw instanced indexed triangles from buffer objects.
virtual void enableCulling(int contextIdx)=0
Enable culling.
virtual void enableDepthBufferTest()=0
Enable depth buffer test.
virtual void drawLinesFromBufferObjects(int contextIdx, int32_t points, int32_t pointsOffset)=0
Draw lines from buffer objects.
void setShaderPrefix(const string &shaderPrefix)
Set shader prefix.
Definition: Renderer.h:485
virtual void onUpdateCameraMatrix(int contextIdx)=0
Update camera matrix event.
virtual void uploadSkinningBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer *data)=0
Upload skinning buffer object.
virtual void bindTangentsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind tangents buffer object.
virtual void onUpdateShader(int contextIdx)=0
On update shader.
virtual void finishFrame()=0
Finish frame.
virtual void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer *data)=0
Uploads buffer data to buffer object.
array< float, 4 > & getEffectColorMul(int contextIdx)
Get effect color mul.
Definition: Renderer.h:1131
virtual void enableDepthBufferWriting()=0
Enable depth buffer writing.
virtual void resizeColorBufferTexture(int32_t textureId, int32_t width, int32_t height)=0
Resize color buffer texture.
virtual int32_t createColorBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex)=0
Creates a color buffer texture.
virtual void unbindBufferObjects(int contextIdx)=0
Unbind buffer objects.
virtual void setClearColor(float red, float green, float blue, float alpha)=0
Set up clear color.
const string & getShader(int contextIdx)
Get shader.
Definition: Renderer.h:1182
virtual vector< int32_t > createBufferObjects(int32_t buffers, bool useGPUMemory, bool shared)=0
Generate buffer objects for vertex data and such.
virtual int32_t createProgram(int type)=0
Creates a shader program.
virtual void setProgramUniformFloatVec2(int contextIdx, int32_t uniformId, const array< float, 2 > &data)=0
Set up a float vec2 uniform value.
virtual void onUpdateLight(int contextIdx, int32_t lightId)=0
Update light.
virtual void setCullFace(int32_t cullFace)=0
Sets up which face will be culled.
virtual void disposeBufferObjects(vector< int32_t > &bufferObjectIds)=0
Disposes a frame buffer object.
virtual void bindSkinningMatricesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning matrices result buffer object.
virtual void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, ShortBuffer *data)=0
Uploads buffer data to buffer object.
virtual void updateViewPort()=0
Update viewport.
virtual void bindSpriteSheetDimensionBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind sprite sheet dimension buffer object.
virtual int32_t getTextureUnit(int contextIdx)=0
Get texture unit.
virtual void setProgramAttributeLocation(int32_t programId, int32_t location, const string &name)=0
Bind attribute to a input location.
virtual void bindSkinningVerticesResultBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning vertices result buffer object.
virtual void enableBlending()=0
Enables blending.
virtual void disableBlending()=0
Disables blending.
const EntityShaderParameters & getShaderParameters(int contextIdx)
Get shader parameters.
Definition: Renderer.h:1209
virtual void drawPointsFromBufferObjects(int contextIdx, int32_t points, int32_t pointsOffset)=0
Draw points from buffer objects.
virtual void initGuiMode()=0
Set up renderer for GUI rendering.
float getMaskMaxValue(int contextIdx)
Get mask max value.
Definition: Renderer.h:1340
virtual int32_t createTexture()=0
Creates a texture.
vector< Renderer_Context > rendererContexts
Definition: Renderer.h:192
virtual void setProgramUniformInteger(int contextIdx, int32_t uniformId, int32_t value)=0
Set up a integer uniform value.
int32_t getEffectPass()
Get effect pass.
Definition: Renderer.h:461
virtual void onBindTexture(int contextIdx, int32_t textureId)=0
On bind texture event.
virtual int32_t createFramebufferObject(int32_t depthBufferTextureId, int32_t colorBufferTextureId, int32_t cubeMapTextureId=0, int32_t cubeMapTextureIndex=0)=0
Creates a frame buffer object with depth texture attached.
virtual void setColorMask(bool red, bool green, bool blue, bool alpha)=0
Set up GL rendering colormask.
virtual void onUpdateTextureMatrix(int contextIdx)=0
Update texture matrix for active texture unit event.
void setMaskMaxValue(int contextIdx, float maskMaxValue)
Set mask max value.
Definition: Renderer.h:1350
virtual bool linkProgram(int32_t programId)=0
Links attached shaders to a program.
virtual void bindTexture(int contextIdx, int32_t textureId)=0
Binds a texture with given id or unbinds when using ID_NONE.
virtual void setProgramUniformFloatMatrix3x3(int contextIdx, int32_t uniformId, const array< float, 9 > &value)=0
Set up a float matrix 3x3 uniform value.
virtual void bindSkinningNormalsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning normal buffer object.
virtual void bindModelMatricesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind model matrices buffer object.
virtual int32_t createDepthBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex)=0
Creates a depth buffer texture.
virtual void disableDepthBufferWriting()=0
Disable depth buffer writing.
virtual void bindIndicesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind indices buffer object.
Renderer_SpecularMaterial & getSpecularMaterial(int contextIdx)
Get specular material.
Definition: Renderer.h:1157
void setLighting(int contextIdx, int32_t lighting)
Set current lighting model.
Definition: Renderer.h:504
virtual void attachShaderToProgram(int32_t programId, int32_t shaderId)=0
Attaches a shader to a program.
virtual void setFrontFace(int contextIdx, int32_t frontFace)=0
Set up clock wise or counter clock wise faces as front face.
virtual void bindSkinningNormalsResultBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning normals result buffer object.
virtual bool isInstancedRenderingAvailable()=0
Checks if instanced rendering is available.
void setShader(int contextIdx, const string &id)
Set shader.
Definition: Renderer.h:1193
virtual int32_t createGBufferGeometryTexture(int32_t width, int32_t height)=0
Creates a geometry buffer geometry texture.
virtual void setProgramUniformFloatMatrix4x4(int contextIdx, int32_t uniformId, const array< float, 16 > &value)=0
Set up a float matrix 4x4 uniform value.
virtual int32_t getProgramUniformLocation(int32_t programId, const string &name)=0
Returns location of given uniform variable.
virtual void drawTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset)=0
Draw triangles from buffer objects.
virtual void onUpdateModelViewMatrix(int contextIdx)=0
Update model view matrix event.
virtual void bindBitangentsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind bitangents buffer object.
virtual void initialize()=0
Initialize renderer.
virtual void disposeTexture(int32_t textureId)=0
Dispose a texture.
virtual void onUpdateShaderParameters(int contextIdx)=0
On update shader parameters.
virtual void bindSkinningVertexJointsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning vertex joints buffer object.
virtual int32_t createCubeMapTexture(int contextIdx, int32_t width, int32_t height)=0
Create cube map texture from frame buffers.
virtual void resizeGBufferGeometryTexture(int32_t textureId, int32_t width, int32_t height)=0
Resizes a geometry buffer geometry texture.
virtual void bindFrameBuffer(int32_t frameBufferId)=0
Enables a framebuffer to be rendered.
virtual void uploadTexture(int contextIdx, Texture *texture)=0
Uploads texture data to current bound texture.
virtual ByteBuffer * readPixels(int32_t x, int32_t y, int32_t width, int32_t height)=0
Read pixels.
virtual void bindSkinningVerticesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning vertices buffer object.
virtual void uploadSkinningBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, FloatBuffer *data)=0
Upload skinning buffer object.
virtual void clear(int32_t mask)=0
Clear render buffer with given mask.
int32_t getLighting(int contextIdx)
Get current lighting model.
Definition: Renderer.h:494
virtual void disableCulling(int contextIdx)=0
Disable culling.
virtual void disposeFrameBufferObject(int32_t frameBufferId)=0
Disposes a frame buffer object.
virtual void drawIndexedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset)=0
Draw indexed triangles from buffer objects.
virtual void dispatchCompute(int contextIdx, int32_t numGroupsX, int32_t numGroupsY, int32_t numGroupsZ)=0
Dispatch compute.
virtual void bindSolidColorsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind solid colors buffer object.
virtual const Renderer_Statistics getStatistics()=0
virtual void bindSkinningVertexJointWeightsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind skinning vertex joint weights buffer object.
void setEffectPass(int32_t effectPass)
Set effect pass.
Definition: Renderer.h:469
virtual void doneGuiMode()=0
Set up renderer for 3d rendering.
virtual float readPixelDepth(int32_t x, int32_t y)=0
Reads a pixel depth.
const string & getShaderPrefix()
Get shader prefix.
Definition: Renderer.h:477
virtual void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, FloatBuffer *data)=0
Uploads buffer data to buffer object.
virtual void bindTextureCoordinatesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind texture coordinates buffer object.
virtual void setDepthFunction(int32_t depthFunction)=0
Set up depth function.
virtual void onUpdateEffect(int contextIdx)=0
Update material.
Renderer_PBRMaterial & getPBRMaterial(int contextIdx)
Get PBR material.
Definition: Renderer.h:1167
virtual void setProgramUniformFloatMatrices4x4(int contextIdx, int32_t uniformId, int32_t count, FloatBuffer *data)=0
Set up a float matrices 4x4 uniform values.
virtual void uploadCubeMapTexture(int contextIdx, Texture *textureLeft, Texture *textureRight, Texture *textureTop, Texture *textureBottom, Texture *textureFront, Texture *textureBack)=0
Uploads cube map texture data to current bound texture.
virtual void onUpdateMaterial(int contextIdx)=0
On update material.
virtual void bindPointSizesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind point sizes buffer object.
virtual int32_t createGBufferColorTexture(int32_t width, int32_t height)=0
Creates a geometry buffer color RGBA texture.
virtual void bindColorsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind colors buffer object.
virtual bool initializeWindowSystemRendererContext(GLFWwindow *glfwWindow)=0
Initialize window system renderer context.
virtual void setLineWidth(float lineWidth)=0
Set line width.
virtual void setVSync(bool vSync)=0
Enable/Disable v-sync.
virtual void bindVertices2BufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind vertices 2 buffer object.
virtual void useProgram(int contextIdx, int32_t programId)=0
Use shader program.
virtual void setProgramUniformFloatVec3(int contextIdx, int32_t uniformId, const array< float, 3 > &data)=0
Set up a float vec3 uniform value.
virtual void bindVerticesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind vertices buffer object.
void setShaderParameters(int contextIdx, const EntityShaderParameters &parameters)
Set shader parameters.
Definition: Renderer.h:1219
virtual int32_t createGeometryBufferObject(int32_t depthBufferTextureId, int32_t geometryBufferTextureId1, int32_t geometryBufferTextureId2, int32_t geometryBufferTextureId3, int32_t colorBufferTextureId1, int32_t colorBufferTextureId2, int32_t colorBufferTextureId3, int32_t colorBufferTextureId4, int32_t colorBufferTextureId5)=0
Creates a geometry frame buffer object.
virtual void bindTextureSpriteIndicesBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind texture and sprite indices buffer object.
virtual bool prepareWindowSystemRendererContext(int tryIdx)=0
Prepare window system renderer context.
virtual void disableDepthBufferTest()=0
Disable depth buffer test.
virtual void bindEffectColorAddsBufferObject(int contextIdx, int32_t bufferObjectId, int32_t divisor)=0
Bind effect color adds buffer object.
virtual void resizeGBufferColorTexture(int32_t textureId, int32_t width, int32_t height)=0
Resizes a geometry buffer color RGBA texture.
virtual void bindNormalsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind normals buffer object.
virtual void bindOriginsBufferObject(int contextIdx, int32_t bufferObjectId)=0
Bind origins buffer object.
virtual void setProgramUniformFloat(int contextIdx, int32_t uniformId, float value)=0
Set up a float uniform value.
Renderer_Light & getLight(int contextIdx, int32_t lightIdx)
Get light.
Definition: Renderer.h:1114
Matrix3x3 class representing matrix3x3 mathematical structure and operations for 2d space.
Definition: Matrix3x3.h:20
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
Byte buffer class.
Definition: ByteBuffer.h:27
Float buffer class.
Definition: FloatBuffer.h:18
Integer buffer class.
Definition: IntBuffer.h:14
Short buffer class.
Definition: ShortBuffer.h:14
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6