6#ifndef MATERIALX_GLSLPROGRAM_H
7#define MATERIALX_GLSLPROGRAM_H
14#include <MaterialXRender/Camera.h>
21MATERIALX_NAMESPACE_BEGIN
24using GlslProgramPtr = std::shared_ptr<class GlslProgram>;
54 void addStage(
const string& stage,
const string& sourceCode);
58 const string& getStageSourceCode(
const string& stage)
const;
81 void clearBuiltData();
93 static int INVALID_OPENGL_TYPE;
116 Input(
int inputLocation,
int inputType,
int inputSize,
const string& inputPath) :
117 location(inputLocation),
127 using InputMap = std::unordered_map<string, InputPtr>;
139 const InputMap& getAttributesList();
146 void findInputs(
const string& variable,
160 bool hasActiveAttributes()
const;
163 bool hasUniform(
const string& name);
166 void bindUniform(
const string& name,
ConstValuePtr value,
bool errorIfMissing =
true);
182 void unbindGeometry();
191 void bindViewInformation(CameraPtr camera);
194 void bindTimeAndFrame(
float time = 1.0f,
float frame = 1.0f);
204 void printUniforms(std::ostream& outputStream);
207 void printAttributes(std::ostream& outputStream);
212 static unsigned int UNDEFINED_OPENGL_RESOURCE_ID;
213 static int UNDEFINED_OPENGL_PROGRAM_LOCATION;
219 const InputMap& updateUniformsList();
222 const InputMap& updateAttributesList();
226 ValuePtr findUniformValue(
const string& uniformName,
const InputMap& uniformList);
229 ImagePtr bindTexture(
unsigned int uniformType,
int uniformLocation,
const FilePath& filePath,
233 static int mapTypeToOpenGLType(
const TypeDesc* type);
244 unsigned int _programId;
256 std::unordered_map<string, unsigned int> _attributeBufferIds;
259 std::map<MeshPartitionPtr, unsigned int> _indexBufferIds;
262 unsigned int _vertexArray;
268 std::unordered_map<string, unsigned int> _programTextures;
271 std::set<int> _enabledStreamLocations;
274MATERIALX_NAMESPACE_END
Geometry loader interfaces.
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition: Image.h:23
Image handler interfaces.
std::shared_ptr< ImageHandler > ImageHandlerPtr
Shared pointer to an ImageHandler.
Definition: ImageHandler.h:32
Handler for hardware lights.
std::shared_ptr< class LightHandler > LightHandlerPtr
Shared pointer to a LightHandler.
Definition: LightHandler.h:25
std::unordered_map< string, string > StringMap
An unordered map with strings as both keys and values.
Definition: Library.h:59
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition: Library.h:34
Macros for declaring imported and exported symbols.
shared_ptr< class MeshPartition > MeshPartitionPtr
Shared pointer to a mesh partition.
Definition: Mesh.h:146
shared_ptr< class Mesh > MeshPtr
Shared pointer to a mesh.
Definition: Mesh.h:230
Shader instance class created during shader generation.
shared_ptr< const Value > ConstValuePtr
A shared pointer to a const Value.
Definition: Value.h:31
shared_ptr< Value > ValuePtr
A shared pointer to a Value.
Definition: Value.h:29
A generic file path, supporting both syntactic and file system operations.
Definition: File.h:27
A class representing an executable GLSL program.
Definition: GlslProgram.h:32
std::shared_ptr< Input > InputPtr
Program input structure shared pointer type.
Definition: GlslProgram.h:125
std::unordered_map< string, InputPtr > InputMap
Program input shaded pointer map type.
Definition: GlslProgram.h:127
static GlslProgramPtr create()
Create a GLSL program instance.
Definition: GlslProgram.h:35
ShaderPtr getShader() const
Return the shader, if any, used to generate this program.
Definition: GlslProgram.h:61
Interface to describe sampling properties for images.
Definition: ImageHandler.h:43
A type descriptor for MaterialX data types.
Definition: TypeDesc.h:28