53 #include <ACG/GL/gl.hh> 54 #include <ACG/Math/GLMatrixT.hh> 55 #include <ACG/GL/ShaderGenerator.hh> 56 #include <ACG/ShaderUtils/UniformPool.hh> 69 class VertexDeclaration;
74 class DrawModeProperties;
244 GLboolean colorWriteMask[4];
262 GLuint clipDistanceMask;
268 Vec2f patchDefaultInnerLevel;
269 Vec4f patchDefaultOuterLevel;
317 Texture(GLuint _id = 0, GLenum _type = GL_TEXTURE_2D,
bool _shadow =
false):
327 addTexture(_t,numTextures());
335 if (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS < numTextures())
337 std::cerr <<
"Texturestage " << _stage <<
" is too big. Allowed stages: "<< GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS << std::endl;
340 textures_[_stage] = _t;
348 const std::map<size_t,Texture>& textures(){
return textures_;}
350 size_t numTextures() {
return textures_.size();}
360 const char* debugName;
369 inline void glBindBuffer(GLenum target, GLuint buffer)
373 case GL_ARRAY_BUFFER: vertexBuffer = buffer;
break;
374 case GL_ELEMENT_ARRAY_BUFFER: indexBuffer = buffer;
break;
378 inline void glDrawArrays(GLenum mode, GLint first, GLsizei count)
380 this->glDrawInstancedArrays(mode, first, count, 0);
383 inline void glDrawInstancedArrays(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
386 sysmemIndexBuffer = 0;
388 primitiveMode = mode;
391 numInstances = primcount;
394 inline void glDrawElements(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices)
396 this->glDrawElementsInstanced(mode, count, type, indices, 0);
399 inline void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLsizei primcount)
401 primitiveMode = mode;
405 sysmemIndexBuffer = indices;
407 numInstances = primcount;
410 inline void glColorMask(GLboolean r, GLboolean g, GLboolean b, GLboolean a)
412 colorWriteMask[0] = r; colorWriteMask[1] = g; colorWriteMask[2] = b; colorWriteMask[3] = a;
415 inline void glAlphaFunc(GLenum func,
float ref)
425 void initFromState(
GLState* _glState);
444 void setupLineRendering(
float _lineWidth,
const Vec2f& _screenSize);
447 bool isDefaultLineObject()
const;
450 void resetLineRendering();
458 void setupPointRendering(
float _pointSize,
const Vec2f& _screenSize);
461 bool isDefaultPointObject()
const;
464 void resetPointRendering();
470 QString toString()
const;
478 void setUniform(
const char *_name, GLint _value);
486 void setUniform(
const char *_name, GLfloat _value);
494 void setUniform(
const char *_name,
const ACG::Vec2f &_value);
502 void setUniform(
const char *_name,
const ACG::Vec3f &_value);
510 void setUniform(
const char *_name,
const ACG::Vec4f &_value);
512 void setUniform(
const char *_name,
const ACG::GLMatrixf &_value,
bool _transposed =
false);
513 void setUniformMat3(
const char *_name,
const ACG::GLMatrixf &_value,
bool _transposed =
false);
516 void setUniform(
const char *_name, GLint *_values,
int _count);
517 void setUniform(
const char *_name, GLfloat *_values,
int _count);
553 const std::string&
name()
const {
return name_; }
Vec3f diffuse
material definitions
void clearTextures()
disables texture support and removes all texture types
int debugID
used internally for renderer debugging
void addTexture(const Texture &_t)
adds a texture to stage RenderObjects::numTextures()
DrawModeProperties stores a set of properties that defines, how to render an object.
bool overlay
Layer based rendering.
void addTexture(const Texture &_t, const size_t _stage, bool _addToShaderGen=true)
GLenum primitiveMode
Primitive type.
void addTextureType(GLenum _type, bool _shadow, size_t _stage)
adds a texture type to the shader and enables texturing.
void clearTextures()
clear all textures. Also affected on shaderDesc
int priority
Priority to allow sorting of objects.
std::map< size_t, Texture > textures_
holds the textures (second) and the stage id (first)
Class to define the vertex input layout.
unsigned int internalFlags_
may be used internally by the renderer
const VertexDeclaration * vertexDecl
Defines the vertex buffer layout, ignored if VAO is provided.
const void * sysmemIndexBuffer
Use system memory index buffer.
Interface for modifying render objects.
GLuint vertexArrayObject
Use vertex array object.
GLenum indexType
Index element type.
unsigned int patchVertices
patch size if primitiveMode is GL_PATCHES for rendering with tessellation shaders ...
unsigned int numIndices
Number indices to render.
GLMatrixd modelview
Modelview transform.
GLenum blendDest
glBlendFunc: GL_SRC_ALPHA, GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA ...
unsigned int indexOffset
Offset to first index in the index buffer or vertex buffer respectively.
std::string name
Name for logging.
const std::string & name() const
Get name of the modifier.
Namespace providing different geometric functions concerning angles.
GLenum depthFunc
GL_LESS, GL_LEQUAL, GL_GREATER ..
const char * depthMapUniformName
Uniform name of the depth map in the used shader.
GLenum alphaFunc
GL_LESS, GL_LEQUAL, GL_GREATER ..
This namespace contains all the classes and functions for handling GLSL shader and program objects...
bool inZPrePass
Specify whether this object should be rendered in a z-prepass.
GLMatrixd proj
Projection transform.
Interface class between scenegraph and renderer.
GLuint vertexBuffer
VBO, IBO ids, ignored if VAO is provided.
ShaderGenDesc shaderDesc
Drawmode and other shader params.
Vec2f depthRange
glDepthRange: (znear, zmax)