46 #include <ACG/GL/gl.hh> 47 #include <ACG/Math/GLMatrixT.hh> 48 #include <ACG/GL/ShaderGenerator.hh> 49 #include <ACG/ShaderUtils/UniformPool.hh> 62 class VertexDeclaration;
67 class DrawModeProperties;
237 GLboolean colorWriteMask[4];
255 GLuint clipDistanceMask;
260 bool programPointSize;
269 Vec2f patchDefaultInnerLevel;
270 Vec4f patchDefaultOuterLevel;
318 Texture(GLuint _id = 0, GLenum _type = GL_TEXTURE_2D,
bool _shadow =
false):
328 addTexture(_t,numTextures());
336 if (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS < numTextures())
338 std::cerr <<
"Texturestage " << _stage <<
" is too big. Allowed stages: "<< GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS << std::endl;
341 textures_[_stage] = _t;
349 const std::map<size_t,Texture>& textures(){
return textures_;}
351 size_t numTextures() {
return textures_.size();}
361 std::string debugName;
370 inline void glBindBuffer(GLenum target, GLuint buffer)
374 case GL_ARRAY_BUFFER: vertexBuffer = buffer;
break;
375 case GL_ELEMENT_ARRAY_BUFFER: indexBuffer = buffer;
break;
379 inline void glDrawArrays(GLenum mode, GLint first, GLsizei count)
381 this->glDrawInstancedArrays(mode, first, count, 0);
384 inline void glDrawInstancedArrays(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
387 sysmemIndexBuffer = 0;
389 primitiveMode = mode;
392 numInstances = primcount;
395 inline void glDrawElements(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices)
397 this->glDrawElementsInstanced(mode, count, type, indices, 0);
400 inline void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLsizei primcount)
402 primitiveMode = mode;
406 sysmemIndexBuffer = indices;
408 numInstances = primcount;
411 inline void glColorMask(GLboolean r, GLboolean g, GLboolean b, GLboolean a)
413 colorWriteMask[0] = r; colorWriteMask[1] = g; colorWriteMask[2] = b; colorWriteMask[3] = a;
416 inline void glAlphaFunc(GLenum func,
float ref)
426 void initFromState(
GLState* _glState);
445 void setupLineRendering(
float _lineWidth,
const Vec2f& _screenSize);
448 bool isDefaultLineObject()
const;
451 void resetLineRendering();
459 void setupPointRendering(
float _pointSize,
const Vec2f& _screenSize);
462 bool isDefaultPointObject()
const;
465 void resetPointRendering();
471 QString toString()
const;
479 void setUniform(
const char *_name, GLint _value);
487 void setUniform(
const char *_name, GLfloat _value);
495 void setUniform(
const char *_name,
const ACG::Vec2f &_value);
503 void setUniform(
const char *_name,
const ACG::Vec3f &_value);
511 void setUniform(
const char *_name,
const ACG::Vec4f &_value);
513 void setUniform(
const char *_name,
const ACG::GLMatrixf &_value,
bool _transposed =
false);
514 void setUniformMat3(
const char *_name,
const ACG::GLMatrixf &_value,
bool _transposed =
false);
517 void setUniform(
const char *_name, GLint *_values,
int _count);
518 void setUniform(
const char *_name, GLfloat *_values,
int _count);
554 const std::string&
name()
const {
return name_; }
This namespace contains all the classes and functions for handling GLSL shader and program objects...
void clearTextures()
clear all textures. Also affected on shaderDesc
Namespace providing different geometric functions concerning angles.
void clearTextures()
disables texture support and removes all texture types
GLMatrixd proj
Projection transform.
Class to define the vertex input layout.
void addTexture(const Texture &_t)
adds a texture to stage RenderObjects::numTextures()
bool inZPrePass
Specify whether this object should be rendered in a z-prepass.
const std::string & name() const
Get name of the modifier.
GLenum primitiveMode
Primitive type.
const char * depthMapUniformName
Uniform name of the depth map in the used shader.
unsigned int patchVertices
patch size if primitiveMode is GL_PATCHES for rendering with tessellation shaders ...
GLMatrixd modelview
Modelview transform.
Vec2f depthRange
glDepthRange: (znear, zmax)
Interface class between scenegraph and renderer.
Vec3f diffuse
material definitions
GLenum depthFunc
GL_LESS, GL_LEQUAL, GL_GREATER ..
Interface for modifying render objects.
unsigned int indexOffset
Offset to first index in the index buffer or vertex buffer respectively.
unsigned int internalFlags_
may be used internally by the renderer
void addTexture(const Texture &_t, const size_t _stage, bool _addToShaderGen=true)
GLuint vertexBuffer
VBO, IBO ids, ignored if VAO is provided.
GLuint vertexArrayObject
Use vertex array object.
std::map< size_t, Texture > textures_
holds the textures (second) and the stage id (first)
bool overlay
Layer based rendering.
void addTextureType(GLenum _type, bool _shadow, size_t _stage)
adds a texture type to the shader and enables texturing.
GLenum alphaFunc
GL_LESS, GL_LEQUAL, GL_GREATER ..
unsigned int numIndices
Number indices to render.
ShaderGenDesc shaderDesc
Drawmode and other shader params.
std::string name
Name for logging.
GLenum indexType
Index element type.
int debugID
used internally for renderer debugging
const void * sysmemIndexBuffer
Use system memory index buffer.
GLenum blendDest
glBlendFunc: GL_SRC_ALPHA, GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA ...
const VertexDeclaration * vertexDecl
Defines the vertex buffer layout, ignored if VAO is provided.
DrawModeProperties stores a set of properties that defines, how to render an object.
int priority
Priority to allow sorting of objects.