6#ifndef MATERIALX_GLSLPROGRAM_H
7#define MATERIALX_GLSLPROGRAM_H
25using GlslProgramPtr = std::shared_ptr<class GlslProgram>;
55 void addStage(
const string& stage,
const string& sourcCode);
59 const string& getStageSourceCode(
const string& stage)
const;
80 static int INVALID_OPENGL_TYPE;
101 Input(
int inputLocation,
int inputType,
int inputSize,
string inputPath)
102 : location(inputLocation)
112 using InputMap = std::unordered_map<std::string, InputPtr>;
124 const InputMap& getAttributesList();
131 void findInputs(
const std::string& variable,
154 bool hasActiveAttributes()
const;
157 bool hasUniform(
const string& name);
160 void bindUniform(
const string& name,
ConstValuePtr value,
bool errorIfMissing =
true);
176 void unbindGeometry();
188 void bindTimeAndFrame();
198 void printUniforms(std::ostream& outputStream);
201 void printAttributes(std::ostream& outputStream);
206 static unsigned int UNDEFINED_OPENGL_RESOURCE_ID;
207 static int UNDEFINED_OPENGL_PROGRAM_LOCATION;
213 const InputMap& updateUniformsList();
216 const InputMap& updateAttributesList();
219 void clearInputLists();
226 ImagePtr bindTexture(
unsigned int uniformType,
int uniformLocation,
const FilePath& filePath,
230 void deleteProgram();
233 static int mapTypeToOpenGLType(
const TypeDesc* type);
244 unsigned int _programId;
256 std::unordered_map<std::string, unsigned int> _attributeBufferIds;
259 std::map<MeshPartitionPtr, unsigned int> _indexBufferIds;
262 unsigned int _vertexArray;
265 std::unordered_map<std::string, unsigned int> _programTextures;
268 std::set<int> _enabledStreamLocations;
270 std::string _lastGeometryName;
Geometry loader interfaces.
std::shared_ptr< class GeometryHandler > GeometryHandlerPtr
Shared pointer to an GeometryHandler.
Definition: GeometryHandler.h:55
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition: Image.h:24
Image handler interfaces.
std::shared_ptr< ImageHandler > ImageHandlerPtr
Shared pointer to an ImageHandler.
Definition: ImageHandler.h:33
Handler for hardware lights.
std::shared_ptr< class LightHandler > LightHandlerPtr
Shared pointer to a LightHandler.
Definition: LightHandler.h:23
std::unordered_map< string, string > StringMap
An unordered map with strings as both keys and values.
Definition: Library.h:58
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:138
shared_ptr< class Mesh > MeshPtr
Shared pointer to a mesh.
Definition: Mesh.h:207
Shader instance class created during shader generation.
shared_ptr< const Value > ConstValuePtr
A shared pointer to a const Value.
Definition: Value.h:32
shared_ptr< Value > ValuePtr
A shared pointer to a Value.
Definition: Value.h:30
Utility for providing view data.
std::shared_ptr< class ViewHandler > ViewHandlerPtr
Shared pointer to a ViewHandler.
Definition: ViewHandler.h:20
A generic file path, supporting both syntactic and file system operations.
Definition: File.h:28
A class representing an executable GLSL program.
Definition: GlslProgram.h:33
std::shared_ptr< Input > InputPtr
Program input structure shared pointer type.
Definition: GlslProgram.h:110
static GlslProgramPtr create()
Create a GLSL program instance.
Definition: GlslProgram.h:36
std::unordered_map< std::string, InputPtr > InputMap
Program input shaded pointer map type.
Definition: GlslProgram.h:112
Interface to describe sampling properties for images.
Definition: ImageHandler.h:44
A type descriptor for MaterialX data types.
Definition: TypeDesc.h:29