API Documentation
Loading...
Searching...
No Matches
GLESMaterialManager.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Graphics
28File: VulkanMaterialManager
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include "GLBuffer.h"
35#include "GLESShader.h"
36#include "GLESGraphicsDevice.h"
39namespace NDEVR
40{
41 class GraphicsUpdateArguments;
42 class QOpenGLTexture;
43 /**--------------------------------------------------------------------------------------------------
44 \brief Stores items to send to the OpenGL Vertex Shader
45 **/
53 static_assert(sizeof(GLESVertexUniformObject) == 16, "Bad VertexUniformSize");
54#pragma pack(push, 1)
55 /**--------------------------------------------------------------------------------------------------
56 \brief Items to send to the OpenGL Fragmentation shader
57 **/
59 {
79
83
85
86 public:
91 FragUniformObject(const Material& m_material);
93 {
94 texture_coord_mode = mat_mode;
95 }
96 };
97#pragma pack(pop)
98 /**--------------------------------------------------------------------------------------------------
99 \brief Structure responsible for handling the OpenGL data surrounding a particular Material object.
100 **/
102 {
103 public:
105 GLESMaterialManager(const GLESMaterialManager& m_pipeline) = delete;
107
108 void cleanup();
109 bool hasGrid() const { return m_has_grid; }
114
118 bool hasOpacity() const { return m_has_opacity; }
119 bool ignoreDepth() const { return m_ignore_depth; }
120 bool writeToDepth() const { return m_write_to_depth; }
121 bool isDynamic() const { return m_is_dynamic; }
122 bool usesModelColor() const { return m_use_model_color; }
123 bool usesLayerColor() const { return m_use_layer_color; }
125 fltp04 depthBias() const { return m_depth_bias; }
126 bool hasImage() const;
127 void commit();
132 DynamicPointer<GLESShader> getShader(PrimitiveMode property, bool is_integer) const;
133
136 UUID material() const;
137 bool isTwoSided() const { return m_is_two_sided; }
138 bool isWireframe() const { return m_is_wireframe; }
139 bool overrideCamera() const { return m_override_camera; }
141 bool useLighting() const;
142 bool smoothNormals() const;
143 UUID id() const;
145 protected:
150 protected:
158
160
162
165
169 QOpenGLTexture* m_texture = nullptr;
170
171 mutable bool m_needs_to_commit_frag_buffer = true;
172 mutable bool m_needs_to_commit_vert_buffer = true;
174 bool m_has_opacity = false;
175 bool m_has_image = false;
177 bool m_is_two_sided = false;
178 bool m_override_camera = false;
179 bool m_smooth_normals = false;
180 bool m_is_wireframe = false;
181 bool m_is_dynamic = false;
182 bool m_has_grid = false;
184 bool m_use_model_color = false;
185 bool m_use_layer_color = false;
186 bool m_ignore_depth = false;
187 bool m_write_to_depth = true;
190 };
191}
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
Structure responsible for handling the OpenGL data surrounding a particular Material object.
Definition GLESMaterialManager.h:102
bool m_is_wireframe
Definition GLESMaterialManager.h:180
bool m_has_image_opacity
Definition GLESMaterialManager.h:176
void addMaterial(const Material &material)
bool hasOpacity() const
Definition GLESMaterialManager.h:118
bool m_use_model_color
Definition GLESMaterialManager.h:184
const GLESVertexUniformObject & vertexUniform() const
Definition GLESMaterialManager.h:112
bool m_needs_to_commit_vert_buffer
Definition GLESMaterialManager.h:172
GLESVertexUniformObject m_vert_uniform
Definition GLESMaterialManager.h:155
Time lastDependencyUpdate() const
Definition GLESMaterialManager.h:135
void updateShader(const Material &mat, const GraphicsUpdateArguments &args, DynamicPointer< GLESShaderManager > &shader_manager)
String getColorByChannel(GraphicsUpdateArguments &args) const
bool useNormalForTexture() const
Definition GLESMaterialManager.h:140
String getExtraPropertyChannel() const
Definition GLESMaterialManager.h:131
bool m_write_to_depth
Definition GLESMaterialManager.h:187
bool usesLayerColor() const
Definition GLESMaterialManager.h:123
static UUID MaterialID(const Material &material)
bool usesModelColor() const
Definition GLESMaterialManager.h:122
fltp04 fadeDistance() const
void setUniformVariables(const DynamicPointer< GLESShader > &shader)
Time m_last_push_update_time
Definition GLESMaterialManager.h:159
bool m_smooth_normals
Definition GLESMaterialManager.h:179
UUID m_id
Definition GLESMaterialManager.h:189
bool m_has_grid
Definition GLESMaterialManager.h:182
String m_image_address[cast< uint04 >(UVType::e_uv_size)]
Definition GLESMaterialManager.h:161
bool m_needs_to_commit_frag_buffer
Definition GLESMaterialManager.h:171
bool m_ignore_depth
Definition GLESMaterialManager.h:186
uint04 m_layer_number
Definition GLESMaterialManager.h:188
Vector< 3, Material::TileTextureMode > m_texture_tile_mode
Definition GLESMaterialManager.h:164
Buffer< Material > m_materials
Definition GLESMaterialManager.h:151
GLESVertexUniformObject getVertexUniformObject(const Material &material, const GraphicsUpdateArguments &args) const
bool m_needs_pipeline_update
Definition GLESMaterialManager.h:173
bool isDynamic() const
Definition GLESMaterialManager.h:121
Time m_last_updated_time
Definition GLESMaterialManager.h:157
bool needsToUpdateShader(const Material &material)
QOpenGLTexture * m_texture
Definition GLESMaterialManager.h:169
void updateUniformBuffer(GraphicsUpdateArguments &args)
GLESMaterialManager(const GLESMaterialManager &m_pipeline)=delete
uint04 getNumberOfImages(const GraphicsUpdateArguments &args) const
bool hasGrid() const
Definition GLESMaterialManager.h:109
bool m_has_opacity
Definition GLESMaterialManager.h:174
String m_extra_channel
Definition GLESMaterialManager.h:163
fltp04 m_depth_bias
Definition GLESMaterialManager.h:168
bool m_use_layer_color
Definition GLESMaterialManager.h:185
bool ignoreDepth() const
Definition GLESMaterialManager.h:119
bool m_is_dynamic
Definition GLESMaterialManager.h:181
bool isWireframe() const
Definition GLESMaterialManager.h:138
fltp04 depthBias() const
Definition GLESMaterialManager.h:125
bool needsToUpdateImage(const Material &material)
bool overrideCamera() const
Definition GLESMaterialManager.h:139
ConstPointer< GLESGraphicsDevice > m_device
Definition GLESMaterialManager.h:152
DynamicPointer< GLESShaderManager > m_shader_manager
Definition GLESMaterialManager.h:166
DynamicPointer< OpenGLBuffer > m_frag_uniform_buffer
Definition GLESMaterialManager.h:154
bool writeToDepth() const
Definition GLESMaterialManager.h:120
bool m_use_normal_for_texture
Definition GLESMaterialManager.h:183
FragUniformObject getFragUniformObject(const Material &material) const
bool m_is_two_sided
Definition GLESMaterialManager.h:177
DynamicPointer< GLESShader > getShader(PrimitiveMode property, bool is_integer) const
DynamicPointer< OpenGLBuffer > m_vertex_uniform_buffer
Definition GLESMaterialManager.h:153
void createPipeline(GraphicsUpdateArguments &args, DynamicPointer< GLESShaderManager > &shader_manager)
Material::ShadingModel m_shade_model
Definition GLESMaterialManager.h:167
bool m_override_camera
Definition GLESMaterialManager.h:178
bool m_has_image
Definition GLESMaterialManager.h:175
GLESMaterialManager(const DynamicPointer< GLESGraphicsDevice > &device)
FragUniformObject m_frag_uniform
Definition GLESMaterialManager.h:156
bool isTwoSided() const
Definition GLESMaterialManager.h:137
uint04 getLayerNumber(const Material &material) const
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
ShadingModel
Definition Material.h:54
TextureCoordMode
Definition Material.h:104
Definition Matrix.hpp:176
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:54
The core String class for the NDEVR API.
Definition String.h:69
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
Definition ACIColor.h:37
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
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
Items to send to the OpenGL Fragmentation shader.
Definition VulkanMaterialManager.h:67
FloatPosition
Definition GLESMaterialManager.h:68
@ e_max_value_frag_pos
Definition GLESMaterialManager.h:71
@ e_min_value_frag_pos
Definition GLESMaterialManager.h:69
@ e_mid_value_frag_pos
Definition GLESMaterialManager.h:70
fltp04 shininess
Definition GLESMaterialManager.h:80
fltp04 opacity
Definition GLESMaterialManager.h:81
fltp04 fade_distance
Definition GLESMaterialManager.h:77
FragUniformObject()
Definition GLESMaterialManager.h:87
fltp04 max_distance
Definition GLESMaterialManager.h:78
Vector< 4, sint04 > m_grid_lines_desc
Definition GLESMaterialManager.h:76
Vector< 12, RGBColor > palette_colors
Definition GLESMaterialManager.h:74
void setMode(Material::TextureCoordMode mat_mode)
Definition GLESMaterialManager.h:92
Matrix< fltp04 > float_values
Definition GLESMaterialManager.h:73
FragUniformObject(const Material &m_material)
uint04 texture_coord_mode
Definition GLESMaterialManager.h:84
Vector< 4, sint04 > m_grid_lines
Definition GLESMaterialManager.h:75
uint04 render_mode
Definition GLESMaterialManager.h:82
ColorPosition
Definition GLESMaterialManager.h:61
@ e_ks_frag_pos
Definition GLESMaterialManager.h:64
@ e_ka_frag_pos
Definition GLESMaterialManager.h:63
@ e_kd_frag_pos
Definition GLESMaterialManager.h:62
@ e_kr_frag_pos
Definition GLESMaterialManager.h:65
Stores items to send to the OpenGL Vertex Shader.
Definition GLESMaterialManager.h:47
fltp04 pixel_thickness
Definition GLESMaterialManager.h:48
fltp04 reserved2
Definition GLESMaterialManager.h:51
fltp04 reserved0
Definition GLESMaterialManager.h:49
fltp04 reserved1
Definition GLESMaterialManager.h:50