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 struct VertexUniformObject
44 {
49 };
50 static_assert(sizeof(VertexUniformObject) == 16, "Bad VertexUniformSize");
51#pragma pack(push, 1)
53 {
73
77
79
80 public:
85 FragUniformObject(const Material& m_material);
87 {
88 texture_coord_mode = mat_mode;
89 }
90 };
91#pragma pack(pop)
93 {
94 public:
96 GLESMaterialManager(const GLESMaterialManager& m_pipeline) = delete;
98
99 void cleanup();
100 bool hasGrid() const { return m_has_grid; }
101 void checkImages();
105
107 void addMaterial(const Material& material);
108 void clearMaterials();
109 bool hasOpacity() const { return m_has_opacity; }
110 bool ignoreDepth() const { return m_ignore_depth; }
111 bool writeToDepth() const { return m_write_to_depth; }
112 bool isDynamic() const { return m_is_dynamic; }
113 bool usesModelColor() const { return m_use_model_color; }
114 bool usesLayerColor() const { return m_use_layer_color; }
115 fltp04 fadeDistance() const;
116 fltp04 depthBias() const { return m_depth_bias; }
117 bool hasImage() const;
118 void commit();
120 //void createPipeline(GraphicsUpdateArguments& args, DynamicPointer<VulkanShaderManager>& shader_manager, DynamicPointer<VulkanImageManager>& image_manager, VkDescriptorPool pool);
121
123
125
127
128 //void setFragmentShader(const Pointer<Shader>& shader) { m_fragment_shader = shader; }
129 DynamicPointer<GLESShader> getShader(PrimitiveMode property, bool is_integer) const;
130
133 UUID material() const;
134 bool isTwoSided() const { return m_is_two_sided; }
135 bool isWireframe() const { return m_is_wireframe; }
136 bool overrideCamera() const { return m_override_camera; }
138 bool useLighting() const;
139 bool smoothNormals() const;
140 UUID id() const;
141 static UUID MaterialID(const Material& material);
142 protected:
143 void updateShader(const Material& mat, const GraphicsUpdateArguments& args, DynamicPointer<GLESShaderManager>& shader_manager);
147 protected:
155
157
159
162
166 QOpenGLTexture* m_texture = nullptr;
167
168 mutable bool m_needs_to_commit_frag_buffer = true;
169 mutable bool m_needs_to_commit_vert_buffer = true;
171 bool m_has_opacity = false;
172 bool m_has_image = false;
174 bool m_is_two_sided = false;
175 bool m_override_camera = false;
176 bool m_smooth_normals = false;
177 bool m_is_wireframe = false;
178 bool m_is_dynamic = false;
179 bool m_has_grid = false;
181 bool m_use_model_color = false;
182 bool m_use_layer_color = false;
183 bool m_ignore_depth = false;
184 bool m_write_to_depth = true;
187 };
188}
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition GraphicsPipeline.h:42
Definition Pointer.hpp:303
Definition GLESMaterialManager.h:93
bool m_is_wireframe
Definition GLESMaterialManager.h:177
bool m_has_image_opacity
Definition GLESMaterialManager.h:173
VertexUniformObject getVertexUniformObject(const Material &material, const GraphicsUpdateArguments &args) const
Definition GLESMaterialManager.cpp:163
void addMaterial(const Material &material)
Definition GLESMaterialManager.cpp:349
bool hasOpacity() const
Definition GLESMaterialManager.h:109
bool hasImage() const
Definition GLESMaterialManager.cpp:388
bool m_use_model_color
Definition GLESMaterialManager.h:181
bool m_needs_to_commit_vert_buffer
Definition GLESMaterialManager.h:169
Time lastDependencyUpdate() const
Definition GLESMaterialManager.h:132
void updateShader(const Material &mat, const GraphicsUpdateArguments &args, DynamicPointer< GLESShaderManager > &shader_manager)
Definition GLESMaterialManager.cpp:372
String getColorByChannel(GraphicsUpdateArguments &args) const
Definition GLESMaterialManager.cpp:451
bool useNormalForTexture() const
Definition GLESMaterialManager.h:137
String getExtraPropertyChannel() const
Definition GLESMaterialManager.h:126
bool m_write_to_depth
Definition GLESMaterialManager.h:184
bool usesLayerColor() const
Definition GLESMaterialManager.h:114
~GLESMaterialManager()
Definition GLESMaterialManager.cpp:148
bool usesModelColor() const
Definition GLESMaterialManager.h:113
VertexUniformObject m_vert_uniform
Definition GLESMaterialManager.h:152
void cleanup()
Definition GLESMaterialManager.cpp:152
UUID id() const
Definition GLESMaterialManager.cpp:501
bool useLighting() const
Definition GLESMaterialManager.cpp:572
fltp04 fadeDistance() const
Definition GLESMaterialManager.cpp:384
void setUniformVariables(const DynamicPointer< GLESShader > &shader)
Definition GLESMaterialManager.cpp:414
Time m_last_push_update_time
Definition GLESMaterialManager.h:156
bool m_smooth_normals
Definition GLESMaterialManager.h:176
UUID m_id
Definition GLESMaterialManager.h:186
bool m_has_grid
Definition GLESMaterialManager.h:179
String m_image_address[cast< uint04 >(UVType::e_uv_size)]
Definition GLESMaterialManager.h:158
bool m_needs_to_commit_frag_buffer
Definition GLESMaterialManager.h:168
bool m_ignore_depth
Definition GLESMaterialManager.h:183
uint04 m_layer_number
Definition GLESMaterialManager.h:185
Vector< 3, Material::TileTextureMode > m_texture_tile_mode
Definition GLESMaterialManager.h:161
Buffer< Material > m_materials
Definition GLESMaterialManager.h:148
bool m_needs_pipeline_update
Definition GLESMaterialManager.h:170
bool isDynamic() const
Definition GLESMaterialManager.h:112
UUID material() const
Definition GLESMaterialManager.cpp:558
void clearMaterials()
Definition GLESMaterialManager.cpp:368
Time m_last_updated_time
Definition GLESMaterialManager.h:154
bool needsToUpdateShader(const Material &material)
Definition GLESMaterialManager.cpp:567
QOpenGLTexture * m_texture
Definition GLESMaterialManager.h:166
void updateUniformBuffer(GraphicsUpdateArguments &args)
Definition GLESMaterialManager.cpp:181
GLESMaterialManager(const GLESMaterialManager &m_pipeline)=delete
uint04 getNumberOfImages(const GraphicsUpdateArguments &args) const
Definition GLESMaterialManager.cpp:434
bool hasGrid() const
Definition GLESMaterialManager.h:100
bool m_has_opacity
Definition GLESMaterialManager.h:171
String m_extra_channel
Definition GLESMaterialManager.h:160
fltp04 m_depth_bias
Definition GLESMaterialManager.h:165
bool m_use_layer_color
Definition GLESMaterialManager.h:182
bool ignoreDepth() const
Definition GLESMaterialManager.h:110
bool m_is_dynamic
Definition GLESMaterialManager.h:178
bool isWireframe() const
Definition GLESMaterialManager.h:135
fltp04 depthBias() const
Definition GLESMaterialManager.h:116
bool needsToUpdateImage(const Material &material)
Definition GLESMaterialManager.cpp:380
bool overrideCamera() const
Definition GLESMaterialManager.h:136
ConstPointer< GLESGraphicsDevice > m_device
Definition GLESMaterialManager.h:149
DynamicPointer< GLESShaderManager > m_shader_manager
Definition GLESMaterialManager.h:163
DynamicPointer< OpenGLBuffer > m_frag_uniform_buffer
Definition GLESMaterialManager.h:151
bool writeToDepth() const
Definition GLESMaterialManager.h:111
bool m_use_normal_for_texture
Definition GLESMaterialManager.h:180
void commit()
Definition GLESMaterialManager.cpp:397
FragUniformObject getFragUniformObject(const Material &material) const
Definition GLESMaterialManager.cpp:170
bool m_is_two_sided
Definition GLESMaterialManager.h:174
DynamicPointer< GLESShader > getShader(PrimitiveMode property, bool is_integer) const
Definition GLESMaterialManager.cpp:467
void checkImages()
Definition GLESMaterialManager.cpp:158
DynamicPointer< OpenGLBuffer > m_vertex_uniform_buffer
Definition GLESMaterialManager.h:150
const VertexUniformObject & vertexUniform() const
Definition GLESMaterialManager.h:103
void createPipeline(GraphicsUpdateArguments &args, DynamicPointer< GLESShaderManager > &shader_manager)
Definition GLESMaterialManager.cpp:422
bool smoothNormals() const
Definition GLESMaterialManager.cpp:582
Material::ShadingModel m_shade_model
Definition GLESMaterialManager.h:164
bool m_override_camera
Definition GLESMaterialManager.h:175
bool m_has_image
Definition GLESMaterialManager.h:172
GLESMaterialManager(const DynamicPointer< GLESGraphicsDevice > &device)
Definition GLESMaterialManager.cpp:128
FragUniformObject m_frag_uniform
Definition GLESMaterialManager.h:153
bool isTwoSided() const
Definition GLESMaterialManager.h:134
static UUID MaterialID(const Material &material)
Definition GLESMaterialManager.cpp:505
uint04 getLayerNumber(const Material &material) const
Definition GLESMaterialManager.cpp:587
Definition GraphicsUpdateArguments.h:40
Definition Material.h:45
ShadingModel
Definition Material.h:48
TextureCoordMode
Definition Material.h:98
Definition Matrix.hpp:173
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
Definition String.h:40
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Definition UUID.h:66
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
Definition ACIColor.h:37
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:157
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
PrimitiveMode
Definition DesignObjectBase.h:113
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:514
Definition BaseValues.hpp:272
Definition VulkanMaterialManager.h:62
FloatPosition
Definition GLESMaterialManager.h:62
@ e_max_value_frag_pos
Definition GLESMaterialManager.h:65
@ e_min_value_frag_pos
Definition GLESMaterialManager.h:63
@ e_mid_value_frag_pos
Definition GLESMaterialManager.h:64
fltp04 shininess
Definition GLESMaterialManager.h:74
fltp04 opacity
Definition GLESMaterialManager.h:75
fltp04 fade_distance
Definition GLESMaterialManager.h:71
FragUniformObject()
Definition GLESMaterialManager.h:81
fltp04 max_distance
Definition GLESMaterialManager.h:72
Vector< 4, sint04 > m_grid_lines_desc
Definition GLESMaterialManager.h:70
Vector< 12, RGBColor > palette_colors
Definition GLESMaterialManager.h:68
void setMode(Material::TextureCoordMode mat_mode)
Definition GLESMaterialManager.h:86
Matrix< fltp04 > float_values
Definition GLESMaterialManager.h:67
uint04 texture_coord_mode
Definition GLESMaterialManager.h:78
Vector< 4, sint04 > m_grid_lines
Definition GLESMaterialManager.h:69
uint04 render_mode
Definition GLESMaterialManager.h:76
ColorPosition
Definition GLESMaterialManager.h:55
@ e_ks_frag_pos
Definition GLESMaterialManager.h:58
@ e_ka_frag_pos
Definition GLESMaterialManager.h:57
@ e_kd_frag_pos
Definition GLESMaterialManager.h:56
@ e_kr_frag_pos
Definition GLESMaterialManager.h:59
Definition VulkanMaterialManager.h:53
fltp04 pixel_thickness
Definition GLESMaterialManager.h:45
fltp04 reserved2
Definition GLESMaterialManager.h:48
fltp04 reserved0
Definition GLESMaterialManager.h:46
fltp04 reserved1
Definition GLESMaterialManager.h:47