35 #ifndef IECOREGL_PRIMITIVE_H
36 #define IECOREGL_PRIMITIVE_H
38 #include "OpenEXR/ImathBox.h"
40 #include "IECore/PrimitiveVariable.h"
41 #include "IECore/VectorTypedData.h"
43 #include "IECoreGL/Export.h"
45 #include "IECoreGL/Renderable.h"
46 #include "IECoreGL/TypedStateComponent.h"
47 #include "IECoreGL/Shader.h"
52 IE_CORE_FORWARDDECLARE( State );
74 Imath::Box3f bound()
const override = 0;
82 void render( State *currentState )
const override;
121 void addPrimitiveVariablesToShaderSetup(
Shader::Setup *shaderSetup,
const std::string &vertexPrefix =
"vertex", GLuint vertexDivisor = 0 )
const;
129 virtual void render(
const State *currentState,
IECore::TypeId style )
const;
133 virtual void renderInstances(
size_t numInstances = 1 )
const = 0;
141 typedef TypedStateComponent<bool, PrimitiveBoundTypeId> DrawBound;
142 IE_CORE_DECLAREPTR( DrawBound );
143 typedef TypedStateComponent<bool, PrimitiveWireframeTypeId> DrawWireframe;
144 IE_CORE_DECLAREPTR( DrawWireframe );
145 typedef TypedStateComponent<float, PrimitiveWireframeWidthTypeId> WireframeWidth;
146 IE_CORE_DECLAREPTR( WireframeWidth );
147 typedef TypedStateComponent<bool, PrimitiveSolidTypeId> DrawSolid;
148 IE_CORE_DECLAREPTR( DrawSolid );
149 typedef TypedStateComponent<bool, PrimitiveOutlineTypeId> DrawOutline;
150 IE_CORE_DECLAREPTR( DrawOutline );
151 typedef TypedStateComponent<float, PrimitiveOutlineWidthTypeId> OutlineWidth;
152 IE_CORE_DECLAREPTR( OutlineWidth );
153 typedef TypedStateComponent<bool, PrimitivePointsTypeId> DrawPoints;
154 IE_CORE_DECLAREPTR( DrawPoints );
155 typedef TypedStateComponent<float, PrimitivePointWidthTypeId> PointWidth;
156 IE_CORE_DECLAREPTR( PointWidth );
157 typedef TypedStateComponent<bool, PrimitiveSelectableTypeId> Selectable;
158 IE_CORE_DECLAREPTR( Selectable );
160 typedef TypedStateComponent<bool, PrimitiveTransparencySortStateComponentTypeId>
TransparencySort;
161 IE_CORE_DECLAREPTR( TransparencySort );
167 void addUniformAttribute(
const std::string &name, IECore::ConstDataPtr data );
169 void addVertexAttribute(
const std::string &name, IECore::ConstDataPtr data );
174 bool depthSortRequested(
const State *state )
const;
178 typedef std::vector<Shader::SetupPtr> ShaderSetupVector;
179 mutable ShaderSetupVector m_shaderSetups;
181 mutable Shader::SetupPtr m_boundSetup;
184 typedef std::map<std::string, IECore::ConstDataPtr> AttributeMap;
185 AttributeMap m_vertexAttributes;
186 AttributeMap m_uniformAttributes;
194 #endif // IECOREGL_PRIMITIVE_H
The namespace within which all CoreGL functionality is defined.
Definition: AlphaTexture.h:41
A class to represent GLSL shaders.
Definition: Shader.h:57
Definition: PrimitiveVariable.h:47
TypedStateComponent< bool, PrimitiveTransparencySortStateComponentTypeId > TransparencySort
Used to trigger sorting of the components of a primitive when the TransparentShadingStateComponent ha...
Definition: Primitive.h:160
Definition: Renderable.h:53
TypeId
Definition: TypeIds.h:46
Definition: Primitive.h:58