API Documentation
Loading...
Searching...
No Matches
GLESRenderObject.h
Go to the documentation of this file.
1#pragma once
10class QOpenGLVertexArrayObject;
11namespace NDEVR
12{
13 class Camera;
14 class GLESVertexManager;
15 class GLESMaterialManager;
16 /**--------------------------------------------------------------------------------------------------
17 \brief A root render Object for OpenGL, which consists of a set Material, Model, and Geometry that
18 is used together to optimally create a 3D render.
19 **/
21 {
22 private:
23 struct ModelProperties
24 {
25 ModelProperties(const Model& model, const Material& material)
26 : model(model)
27 , material(material)
28 {}
29 Model model;
30 Material material;
31 bool should_render = false;
32 };
33 struct GeoProperties
34 {
35 Buffer<ModelProperties> model_parents;
36 Geometry geometry;
37 fltp04 pixel_thickness = Constant<fltp04>::Invalid;
38 uint04 vertex_start = 0;
39 uint04 vertex_size = 0;
40 uint04 index_start = 0;
41 uint04 index_size = 0;
42 bool is_visible = false;
43 };
44
45 public:
49 void cleanup();
50 bool shouldRender(const GraphicsUpdateArguments& args, const Model& model) const;
54 bool hasOpacity() const;
55 bool hasImage() const;
57 uint01 parity() const { return m_parity; }
58 static GLint RenderType(PrimitiveMode mode);
60 bool hasCommand() const;
62 bool isFilledShape() const;
63
64 void setPrimitiveMode(const PrimitiveMode& type) { m_index_mode = type; }
65 void setIndexProperty(const PrimitiveProperty& property) { m_index_property = property; }
69 const ConstPointer<GLESVertexManager>& vertexManager() const { return m_vertex_manager; }
70 PrimitiveMode indexMode() const { return m_index_mode; };
71 PrimitiveProperty indexProperty() const { return m_index_property; };
72 void addInstance(const Geometry& geo, const Model& parent, const Material& material);
74 private:
75 void processGeoUniformUpdates(GeoProperties& properties, GraphicsUpdateArguments& args, uint04& matrix_index, const Time& geo_mod_time);
76 void getMatrixUniformObject(Buffer<Matrix<fltp04>>& matrix, Buffer<Vector<3, sint04>>& offset, Buffer<Vector<2, uint04>>& flags) const;
77 void getMatrixUniformObject(const Geometry& mesh, const Model& model, Matrix<fltp04>& matrix, Vector<3, sint04>& offset, Vector<2, uint04>& flag) const;
78 private:
79 PrimitiveProperty m_index_property;
81 GeoProperties m_geometry;
82 DynamicPointer<GLESVertexManager> m_vertex_manager;
83 DynamicPointer<GLESMaterialManager> m_material_manager;
84 Buffer<Matrix<fltp04>> m_model_matrix_uniforms;
85 Buffer<Vector<3, sint04>> m_model_offset_uniforms;
86 Buffer<Vector<2, uint04>> m_model_flag_uniforms;
87 DynamicPointer<OpenGLBuffer> m_matrix_instance_buffer;
88 DynamicPointer<OpenGLBuffer> m_offset_instance_buffer;
89 DynamicPointer<OpenGLBuffer> m_flags_instance_buffer;
92 Time m_last_updated_time = Time(0);
93 volatile mutable bool m_needs_matrix_commit = false;
95 bool m_is_integer_shader = false;
96 };
97}
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition GraphicsPipeline.h:42
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
A root render Object for OpenGL, which consists of a set Material, Model, and Geometry that is used t...
Definition GLESRenderObject.h:21
void setVertexManager(const DynamicPointer< GLESVertexManager > &vertex_manager)
const ConstPointer< GLESVertexManager > & vertexManager() const
Definition GLESRenderObject.h:69
PrimitiveMode indexMode() const
Definition GLESRenderObject.h:70
uint01 parity() const
Definition GLESRenderObject.h:57
bool isFilledShape() const
GLESRenderObject(const GLESRenderObject &instance)
GLESRenderObject(const DynamicPointer< GLESGraphicsDevice > &pipeline)
fltp04 fadeDistance() const
void commit(GraphicsUpdateArguments &args)
void setDevice(const DynamicPointer< GLESGraphicsDevice > &instance)
void setPrimitiveMode(const PrimitiveMode &type)
Definition GLESRenderObject.h:64
void addInstance(const Geometry &geo, const Model &parent, const Material &material)
PrimitiveProperty indexProperty() const
Definition GLESRenderObject.h:71
void setMaterialManager(const DynamicPointer< GLESMaterialManager > &material_manager)
bool runCommand(GraphicsUpdateArguments &args)
void updateUniformBuffer(GraphicsUpdateArguments &args)
bool shouldRender(const GraphicsUpdateArguments &args, const Model &model) const
bool createPipeline(GraphicsUpdateArguments &args)
void setIndexProperty(const PrimitiveProperty &property)
Definition GLESRenderObject.h:65
static GLint RenderType(PrimitiveMode mode)
void setParity(uint01 parity)
A core class within the model heirarchy containing vertex-based data (Usually 3D data) within a set c...
Definition Geometry.h:64
Options that are used for performing an update on a Graphics Engine call.
Definition GraphicsUpdateArguments.h:43
Container responsible for storing and setting the appearance of a Model or Geometry within the NDEVR ...
Definition Material.h:51
Definition Matrix.hpp:176
A core class that represents a node on model heirarchy. This node may contain a Geometry or one or mo...
Definition Model.h:58
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
Definition ACIColor.h:37
PrimitiveProperty
Definition DesignObjectBase.h:44
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
Definition BaseValues.hpp:127
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
PrimitiveMode
Used with Geometry to describe how vertices and indices are used to form shapes.
Definition DesignObjectBase.h:116
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233