Developer Documentation

RenderObject.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42 #include <cstdio>
43 #include <iostream>
44 #include <cstdlib>
45 #include <QFile>
46 #include <QTextStream>
47
48 #include <ACG/GL/gl.hh>
49
50 #include <ACG/GL/IRenderer.hh>
51
52 #include <ACG/GL/VertexDeclaration.hh>
53
54 #include <ACG/GL/ShaderCache.hh>
55
56
57
58 namespace ACG
59 {
60
61 void RenderObject::initFromState( GLState* _glState )
62 {
63 culling = true;
64 blending = false;
65 depthTest = true;
66 depthWrite = true;
67 alphaTest = false;
68
69 programPointSize = false;
70
71 colorWriteMask[0] = colorWriteMask[1] = colorWriteMask[2] = colorWriteMask[3] = 1;
72
73 fillMode = GL_FILL;
74
75 depthRange = Vec2f(0.0f, 1.0f);
76 depthFunc = GL_LESS;
77
78 blendSrc = GL_ONE;
79 blendDest = GL_ZERO;
80
81 alpha = 1.0f;
82
83 pointSize = 0.1f;
84
85 if (_glState)
86 {
87 modelview = _glState->modelview();
88 proj = _glState->projection();
89
90 culling =_glState->isStateEnabled(GL_CULL_FACE);
91 blending = _glState->isStateEnabled(GL_BLEND);
92 depthTest = _glState->isStateEnabled(GL_DEPTH_TEST);
93
94 _glState->getBlendFunc(&blendSrc, &blendDest);
95
96 glGetFloatv(GL_DEPTH_RANGE, depthRange.data());
97
98 depthFunc = _glState->depthFunc();
99
100
101 alphaTest = _glState->isStateEnabled(GL_ALPHA_TEST);
102
103 for (int i = 0; i < 3; ++i)
104 {
105 diffuse[i] = _glState->diffuse_color()[i];
106 ambient[i] = _glState->ambient_color()[i];
107 specular[i] = _glState->specular_color()[i];
108 emissive[i] = _glState->base_color()[i];
109 }
110 shininess = _glState->shininess();
111
112
113 #ifdef GL_PROGRAM_POINT_SIZE
114 programPointSize = _glState->isStateEnabled(GL_PROGRAM_POINT_SIZE);
115 #endif
116
117 pointSize = _glState->point_size();
118 }
119
120 // get texcoord generation params
121 if (_glState->isStateEnabled(GL_TEXTURE_GEN_Q))
122 shaderDesc.texGenDim = 4;
123 else if (_glState->isStateEnabled(GL_TEXTURE_GEN_R))
124 shaderDesc.texGenDim = 3;
125 else if (_glState->isStateEnabled(GL_TEXTURE_GEN_T))
126 shaderDesc.texGenDim = 2;
127 else if (_glState->isStateEnabled(GL_TEXTURE_GEN_S))
128 shaderDesc.texGenDim = 1;
129 if (shaderDesc.texGenDim)
130 {
131 GLint genMode;
132 _glState->getTexGenMode(GL_S, GL_TEXTURE_GEN_MODE, &genMode);
133 shaderDesc.texGenMode = genMode;
134 }
135 }
136
137 void RenderObject::setupShaderGenFromDrawmode( const SceneGraph::DrawModes::DrawModeProperties* _props )
138 {
139 if (_props)
140 {
141 shaderDesc.vertexColors = _props->colored();
142 if (_props->textured())
143 shaderDesc.addTextureType(GL_TEXTURE_2D,false,0);
144 else
145 shaderDesc.clearTextures();
146 shaderDesc.numLights = _props->lighting() ? 0 : -1;
147
148 switch (_props->lightStage()) {
149 case SceneGraph::DrawModes::LIGHTSTAGE_SMOOTH:
150 shaderDesc.shadeMode = SG_SHADE_GOURAUD;
151 break;
152 case SceneGraph::DrawModes::LIGHTSTAGE_PHONG:
153 shaderDesc.shadeMode = SG_SHADE_PHONG;
154 break;
155 case SceneGraph::DrawModes::LIGHTSTAGE_UNLIT:
156 shaderDesc.shadeMode = SG_SHADE_UNLIT;
157 break;
158 default:
159 break;
160 }
161
162 if (_props->flatShaded())
163 shaderDesc.shadeMode = SG_SHADE_FLAT;
164
165 if (_props->normalSource() == SceneGraph::DrawModes::NORMAL_PER_FACE)
166 shaderDesc.vertexNormalInterpolator = "flat";
167 else
168 shaderDesc.vertexNormalInterpolator.clear();
169
170 if (_props->primitive() == SceneGraph::DrawModes::PRIMITIVE_WIREFRAME ||
171 _props->primitive() == SceneGraph::DrawModes::PRIMITIVE_HIDDENLINE ||
172 _props->primitive() == SceneGraph::DrawModes::PRIMITIVE_EDGE ||
173 _props->primitive() == SceneGraph::DrawModes::PRIMITIVE_HALFEDGE)
174 shaderDesc.shadeMode = SG_SHADE_UNLIT;
175 }
176 }
177
178 void RenderObject::setMaterial( const SceneGraph::Material* _mat )
179 {
180 for (int i = 0; i < 3; ++i)
181 {
182 diffuse[i] = _mat->diffuseColor()[i];
183 ambient[i] = _mat->ambientColor()[i];
184 specular[i] = _mat->specularColor()[i];
185 emissive[i] = _mat->baseColor()[i];
186 }
187 shininess = _mat->shininess();
188 alpha = _mat->diffuseColor()[3];
189
190 // material node sets the alpha test function to GL_GREATER
191 alphaFunc = GL_GREATER;
192 alphaTest = _mat->alphaTest();
193 alphaRef = _mat->alphaValue();
194 }
195
196
197 RenderObject::RenderObject()
198 : priority(0),
199 overlay(false),
200 modelview(GLMatrixf(ACG::Vec3f(1.0, 0.0, 0.0), ACG::Vec3f(0.0, 1.0, 0.0), ACG::Vec3f(0.0, 0.0, 1.0))),
201 proj(modelview),
202 vertexArrayObject(0),
203 vertexBuffer(0), indexBuffer(0), sysmemIndexBuffer(0),
204 primitiveMode(GL_TRIANGLES), patchVertices(0), numIndices(0), indexOffset(0), indexType(GL_UNSIGNED_INT),
205 numInstances(0),
206 vertexDecl(0),
207 culling(true), blending(false), alphaTest(false),
208 depthTest(true), depthWrite(true),
209 fillMode(GL_FILL), depthFunc(GL_LESS),
210 alphaFunc(GL_ALWAYS), alphaRef(0.0f),
211 blendSrc(GL_SRC_ALPHA), blendDest(GL_ONE_MINUS_SRC_ALPHA),
212 depthRange(0.0f, 1.0f),
213
214 clipDistanceMask(0),
215
216 programPointSize(false),
217 pointSize(0.1f),
218
219 patchDefaultInnerLevel(1.0f, 1.0f),
220 patchDefaultOuterLevel(1.0f, 1.0f, 1.0f, 1.0f),
221
222 diffuse(0.6f, 0.6f, 0.6f), ambient(0.1f, 0.1f, 0.1f),
223 specular(0.0f, 0.0f, 0.0f), emissive(0.05f, 0.05f, 0.05f),
224 alpha(1.0f), shininess(100.0f),
225
226 inZPrePass(true),
227 depthMapUniformName(0),
228
229 debugID(0),
230 internalFlags_(0)
231 {
232 colorWriteMask[0] = colorWriteMask[1] = colorWriteMask[2] = colorWriteMask[3] = 1;
233 }
234
235 RenderObject::~RenderObject() {
236 uniformPool_.clear();
237 }
238
239 QString RenderObject::toString() const
240 {
241 // several mappings: (int)GLEnum -> string
242
243 const char* primitiveString[] =
244 {
245 "GL_POINTS",
246 "GL_LINES",
247 "GL_LINE_LOOP",
248 "GL_LINE_STRIP",
249 "GL_TRIANGLES",
250 "GL_TRIANGLE_STRIP",
251 "GL_TRIANGLE_FAN",
252 "GL_QUADS",
253 "GL_QUAD_STRIP",
254 "GL_POLYGON",
255 "GL_LINES_ADJACENCY",
256 "GL_LINE_STRIP_ADJACENCY",
257 "GL_TRIANGLES_ADJACENCY",
258 "GL_TRIANGLE_STRIP_ADJACENCY",
259 "GL_PATCHES"
260 };
261
262 const char* fillModeString[] =
263 {
264 "GL_POINT",
265 "GL_LINE",
266 "GL_FILL"
267 };
268
269 const char* depthFunString[] =
270 {
271 "GL_NEVER",
272 "GL_LESS",
273 "GL_EQUAL",
274 "GL_LEQUAL",
275 "GL_GREATER",
276 "GL_NOTEQUAL",
277 "GL_GEQUAL",
278 "GL_ALWAYS"
279 };
280
281 QString result;
282 QTextStream resultStrm(&result);
283
284
285 #if !defined(GL_VERSION_3_2)
286 const GLenum maxSupportedPrimitiveMode = GL_POLYGON;
287 #elif !defined(GL_ARB_tessellation_shader)
288 const GLenum maxSupportedPrimitiveMode = GL_TRIANGLE_STRIP_ADJACENCY;
289 #else
290 const GLenum maxSupportedPrimitiveMode = GL_PATCHES;
291 #endif
292
293 resultStrm << "name: " << QString::fromStdString(debugName)
294 << "\ndebugID: " << debugID
295 << "\npriority: " << priority
296 << "\nprimitiveMode: " << (primitiveMode <= maxSupportedPrimitiveMode ? primitiveString[primitiveMode] : "undefined")
297 << "\nfillMode: " << fillModeString[fillMode - GL_POINT]
298 << "\nnumIndices: " << numIndices
299 << "\nindexOffset: " << indexOffset;
300
301
302 #ifdef GL_ARB_tessellation_shader
303 if (primitiveMode == GL_PATCHES)
304 resultStrm << "\npatchVertices: " << patchVertices;
305 #endif
306
307 resultStrm << "\nvao-id: " << vertexArrayObject
308 << "\nvbo-id: " << vertexBuffer
309 << "\nibo-id: " << indexBuffer
310 << "\nsysmemIndexBuffer: " << sysmemIndexBuffer;
311
312
313
314 resultStrm << "\n" << shaderDesc.toString();
315
316
317 resultStrm << "\nmodelview: "
318 << "{" << modelview(0, 0) << ", " << modelview(0, 1) << ", " << modelview(0, 2) << ", " << modelview(0, 3) << "} "
319 << "{" << modelview(1, 0) << ", " << modelview(1, 1) << ", " << modelview(1, 2) << ", " << modelview(1, 3) << "} "
320 << "{" << modelview(2, 0) << ", " << modelview(2, 1) << ", " << modelview(2, 2) << ", " << modelview(2, 3) << "} "
321 << "{" << modelview(3, 0) << ", " << modelview(3, 1) << ", " << modelview(3, 2) << ", " << modelview(3, 3) << "} ";
322
323 resultStrm << "\nproj: "
324 << "{" << proj(0, 0) << ", " << proj(0, 1) << ", " << proj(0, 2) << ", " << proj(0, 3) << "} "
325 << "{" << proj(1, 0) << ", " << proj(1, 1) << ", " << proj(1, 2) << ", " << proj(1, 3) << "} "
326 << "{" << proj(2, 0) << ", " << proj(2, 1) << ", " << proj(2, 2) << ", " << proj(2, 3) << "} "
327 << "{" << proj(3, 0) << ", " << proj(3, 1) << ", " << proj(3, 2) << ", " << proj(3, 3) << "} ";
328
329
330 resultStrm << "\nculling: " << culling
331 << "\nblending: " << blending
332 << "\nalphaTest: " << alphaTest;
333
334
335 resultStrm << "\ndepthTest: " << depthTest
336 << "\ndepthWrite: " << depthWrite
337 << "\ndepthFunc: " << depthFunString[depthFunc - GL_NEVER]
338 << "\ndepthRange: [" << depthRange[0] << ", " << depthRange[1] << "]"
339 << "\ncolorWriteMask: " << colorWriteMask[0] << ", " << colorWriteMask[1] << ", "<< colorWriteMask[2] << ", "<< colorWriteMask[2];
340
341 resultStrm << "\nalphaFunc: " << depthFunString[alphaFunc - GL_NEVER]
342 << "\nalphaRef: " << alphaRef;
343
344 resultStrm << "\nclipDistanceMask: " << QString::number(clipDistanceMask, 2);
345 resultStrm << "\nprogramPointSize: " << programPointSize;
346 resultStrm << "\npointSize: " << pointSize;
347
348 resultStrm << "\ndiffuse: [" << diffuse[0] << ", " << diffuse[1] << ", " << diffuse[2] << "]";
349 resultStrm << "\nambient: [" << ambient[0] << ", " << ambient[1] << ", " << ambient[2] << "]";
350 resultStrm << "\nspecular: [" << specular[0] << ", " << specular[1] << ", " << specular[2] << "]";
351 resultStrm << "\nemissive: [" << emissive[0] << ", " << emissive[1] << ", " << emissive[2] << "]";
352
353 resultStrm << "\nshininess: " << shininess;
354 resultStrm << "\nalpha: " << alpha;
355
356
357 resultStrm << "\ninZPrePass: " << inZPrePass;
358 resultStrm << "\ndepthMapUniformName: " << depthMapUniformName;
359
360
361 resultStrm << "\ninternalFlags: " << internalFlags_;
362
363 // textures
364 for (std::map<size_t, Texture>::const_iterator it = textures_.begin(); it != textures_.end(); ++it)
365 {
366 resultStrm << "\ntexture unit " << it->first << ": ";
367
368 switch (it->second.type)
369 {
370 case GL_TEXTURE_1D: resultStrm << "GL_TEXTURE_1D"; break;
371 case GL_TEXTURE_2D: resultStrm << "GL_TEXTURE_2D"; break;
372 case GL_TEXTURE_3D: resultStrm << "GL_TEXTURE_3D"; break;
373 #ifdef GL_TEXTURE_RECTANGLE
374 case GL_TEXTURE_RECTANGLE: resultStrm << "GL_TEXTURE_RECTANGLE"; break;
375 #endif
376 #ifdef GL_TEXTURE_CUBE_MAP
377 case GL_TEXTURE_CUBE_MAP: resultStrm << "GL_TEXTURE_CUBE_MAP"; break;
378 #endif
379 #ifdef GL_TEXTURE_1D_ARRAY
380 case GL_TEXTURE_1D_ARRAY: resultStrm << "GL_TEXTURE_1D_ARRAY"; break;
381 #endif
382 #ifdef GL_TEXTURE_2D_ARRAY
383 case GL_TEXTURE_2D_ARRAY: resultStrm << "GL_TEXTURE_2D_ARRAY"; break;
384 #endif
385 #ifdef GL_TEXTURE_CUBE_MAP_ARRAY
386 case GL_TEXTURE_CUBE_MAP_ARRAY: resultStrm << "GL_TEXTURE_CUBE_MAP_ARRAY"; break;
387 #endif
388 #ifdef GL_TEXTURE_BUFFER
389 case GL_TEXTURE_BUFFER: resultStrm << "GL_TEXTURE_BUFFER"; break;
390 #endif
391 #ifdef GL_TEXTURE_2D_MULTISAMPLE
392 case GL_TEXTURE_2D_MULTISAMPLE: resultStrm << "GL_TEXTURE_2D_MULTISAMPLE"; break;
393 #endif
394 #ifdef GL_TEXTURE_2D_MULTISAMPLE_ARRAY
395 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: resultStrm << "GL_TEXTURE_2D_MULTISAMPLE_ARRAY"; break;
396 #endif
397 default: resultStrm << "unknown_type"; break;
398 }
399
400 resultStrm << " - id " << it->second.id;
401 }
402
403 if (vertexDecl)
404 resultStrm << "\n" << vertexDecl->toString();
405
406 if (!uniformPool_.empty())
407 resultStrm << "\n" << uniformPool_.toString();
408
409 return result;
410 }
411
412
413 void RenderObject::setUniform( const char *_name, GLint _value )
414 {
415 uniformPool_.setUniform(_name, _value);
416 }
417
418 void RenderObject::setUniform( const char *_name, GLfloat _value )
419 {
420 uniformPool_.setUniform(_name, _value);
421 }
422
423 void RenderObject::setUniform( const char *_name, const ACG::Vec2f &_value )
424 {
425 uniformPool_.setUniform(_name, _value);
426 }
427
428 void RenderObject::setUniform( const char *_name, const ACG::Vec3f &_value )
429 {
430 uniformPool_.setUniform(_name, _value);
431 }
432
433 void RenderObject::setUniform( const char *_name, const ACG::Vec4f &_value )
434 {
435 uniformPool_.setUniform(_name, _value);
436 }
437
438 void RenderObject::setUniform( const char *_name, const ACG::GLMatrixf &_value, bool _transposed /*= false*/ )
439 {
440 uniformPool_.setUniform(_name, _value, _transposed);
441 }
442
443 void RenderObject::setUniformMat3( const char *_name, const ACG::GLMatrixf &_value, bool _transposed /*= false*/ )
444 {
445 uniformPool_.setUniform(_name, _value, _transposed);
446 }
447
448 void RenderObject::setUniform( const char *_name, GLint *_values, int _count )
449 {
450 uniformPool_.setUniform(_name, _values, _count);
451 }
452
453 void RenderObject::setUniform( const char *_name, GLfloat *_values, int _count )
454 {
455 uniformPool_.setUniform(_name, _values, _count);
456 }
457
458 void RenderObject::addUniformPool( const GLSL::UniformPool& _pool )
459 {
460 uniformPool_.addPool(_pool);
461 }
462
463
464 void RenderObject::setupLineRendering( float _lineWidth, const Vec2f& _screenSize )
465 {
466 shaderDesc.geometryTemplateFile = "Wireframe/geom_line2quad.tpl";
467
468 setUniform("lineWidth", _lineWidth);
469 setUniform("screenSize", _screenSize);
470 }
471
472 bool RenderObject::isDefaultLineObject() const
473 {
474 return shaderDesc.geometryTemplateFile == "Wireframe/geom_line2quad.tpl" ||
475 (shaderDesc.geometryTemplateFile == "Wireframe/gl42/geometry.tpl" &&
476 shaderDesc.fragmentTemplateFile == "Wireframe/gl42/fragment.tpl");
477 }
478
479 void RenderObject::resetLineRendering()
480 {
481 shaderDesc.geometryTemplateFile.clear();
482 }
483
484 void RenderObject::setupPointRendering( float _pointSize, const Vec2f& _screenSize )
485 {
486 shaderDesc.geometryTemplateFile = "PointSize/geometry.tpl";
487 shaderDesc.fragmentTemplateFile = "PointSize/fragment.tpl";
488
489 setUniform("pointSize", _pointSize);
490 setUniform("screenSize", _screenSize);
491 }
492
493 bool RenderObject::isDefaultPointObject() const
494 {
495 return shaderDesc.geometryTemplateFile == "PointSize/geometry.tpl" &&
496 shaderDesc.fragmentTemplateFile == "PointSize/fragment.tpl";
497 }
498
499 void RenderObject::resetPointRendering()
500 {
501 shaderDesc.geometryTemplateFile.clear();
502 shaderDesc.fragmentTemplateFile.clear();
503 }
504
505
506
507 } // namespace ACG end
508
ACG::GLState::specular_color
const Vec4f & specular_color() const
get specular color
Definition: GLState.hh:941
ACG::SceneGraph::DrawModes::DrawModeProperties::textured
bool textured() const
Is texturing enabled?
Definition: DrawModes.hh:219
ACG
Namespace providing different geometric functions concerning angles.
Definition: BaseObjectData.hh:68
ACG::ShaderGenDesc::clearTextures
void clearTextures()
disables texture support and removes all texture types
Definition: ShaderGenerator.hh:223
ACG::RenderObject::proj
GLMatrixd proj
Projection transform.
Definition: RenderObject.hh:141
ACG::RenderObject::setupShaderGenFromDrawmode
void setupShaderGenFromDrawmode(const SceneGraph::DrawModes::DrawModeProperties *_props)
Fills out ShaderGenDesc parameters based on Drawmode properties.
Definition: RenderObject.cc:137
GLSL::UniformPool::clear
void clear()
Clear the pool.
Definition: UniformPool.cc:86
ACG::RenderObject::inZPrePass
bool inZPrePass
Specify whether this object should be rendered in a z-prepass.
Definition: RenderObject.hh:291
GLSL::UniformPool::setUniform
void setUniform(const char *_name, GLint _value)
Set int uniform to specified value.
Definition: UniformPool.cc:614
ACG::SceneGraph::Material::ambientColor
void ambientColor(const Vec4f &_a)
set the ambient color.
Definition: MaterialNode.hh:175
ACG::RenderObject::RenderObject
RenderObject()
Definition: RenderObject.cc:197
ACG::RenderObject::primitiveMode
GLenum primitiveMode
Primitive type.
Definition: RenderObject.hh:182
ACG::SceneGraph::Material::alphaValue
float alphaValue() const
get current alpha value for alpha_test
Definition: MaterialNode.hh:275
ACG::RenderObject::depthMapUniformName
const char * depthMapUniformName
Uniform name of the depth map in the used shader.
Definition: RenderObject.hh:302
ACG::GLState::depthFunc
const GLenum & depthFunc() const
get glDepthFunc() that is supposed to be active
Definition: GLState.cc:941
ACG::RenderObject::patchVertices
unsigned int patchVertices
patch size if primitiveMode is GL_PATCHES for rendering with tessellation shaders ...
Definition: RenderObject.hh:185
ACG::SceneGraph::DrawModes::LIGHTSTAGE_PHONG
Definition: DrawModes.hh:111
ACG::GLState::getBlendFunc
static void getBlendFunc(GLenum *_sfactor, GLenum *_dfactor)
get blend function, null-ptr safe
Definition: GLState.hh:310
ACG::GLState::projection
const GLMatrixd & projection() const
get projection matrix
Definition: GLState.hh:786
ACG::RenderObject::initFromState
void initFromState(GLState *_glState)
Initializes a RenderObject instance.
Definition: RenderObject.cc:61
ACG::SceneGraph::DrawModes::LIGHTSTAGE_SMOOTH
Definition: DrawModes.hh:110
ACG::RenderObject::modelview
GLMatrixd modelview
Modelview transform.
Definition: RenderObject.hh:138
ACG::GLState::point_size
float point_size() const
get point size
Definition: GLState.hh:970
ACG::SceneGraph::Material::specularColor
void specularColor(const Vec4f &_s)
set the specular color
Definition: MaterialNode.hh:185
GLSL::UniformPool::empty
bool empty() const
returns if the pool is empty
Definition: UniformPool.cc:95
OpenMesh::VectorT::data
Scalar * data()
access to Scalar array
Definition: Vector11T.hh:195
ACG::RenderObject::depthRange
Vec2f depthRange
glDepthRange: (znear, zmax)
Definition: RenderObject.hh:249
ACG::SceneGraph::Material::diffuseColor
void diffuseColor(const Vec4f &_d)
set the diffuse color.
Definition: MaterialNode.hh:180
ACG::SceneGraph::DrawModes::LIGHTSTAGE_UNLIT
Definition: DrawModes.hh:109
ACG::RenderObject::isDefaultLineObject
bool isDefaultLineObject() const
Test if the object is rendered with one of the default line thickness methods.
Definition: RenderObject.cc:472
ACG::RenderObject::diffuse
Vec3f diffuse
material definitions
Definition: RenderObject.hh:274
ACG::RenderObject::addUniformPool
void addUniformPool(const GLSL::UniformPool &_pool)
add all uniforms from a pool
Definition: RenderObject.cc:458
ACG::GLState
Definition: GLState.hh:213
ACG::RenderObject::depthFunc
GLenum depthFunc
GL_LESS, GL_LEQUAL, GL_GREATER ..
Definition: RenderObject.hh:240
ACG::RenderObject::numInstances
GLsizei numInstances
Definition: RenderObject.hh:204
ACG::SceneGraph::DrawModes::DrawModeProperties::flatShaded
bool flatShaded() const
Is flat shading used (Normals per face)?
Definition: DrawModes.hh:225
ACG::SceneGraph::DrawModes::DrawModeProperties::lighting
bool lighting() const
Is lighting enabled?
Definition: DrawModes.hh:216
ACG::Vec2f
VectorT< float, 2 > Vec2f
Definition: VectorT.hh:102
ACG::RenderObject::indexOffset
unsigned int indexOffset
Offset to first index in the index buffer or vertex buffer respectively.
Definition: RenderObject.hh:191
ACG::RenderObject::setupPointRendering
void setupPointRendering(float _pointSize, const Vec2f &_screenSize)
Setup rendering of circle points.
Definition: RenderObject.cc:484
ACG::RenderObject::internalFlags_
unsigned int internalFlags_
may be used internally by the renderer
Definition: RenderObject.hh:364
ACG::SceneGraph::Material::baseColor
void baseColor(const Vec4f &_c)
set the base color (Sets the baseColor which is the same as the emission(const Vec4f& _c) ) ...
Definition: MaterialNode.hh:165
ACG::VertexDeclaration::toString
QString toString() const
Definition: VertexDeclaration.cc:580
ACG::SceneGraph::DrawModes::DrawModeProperties::colored
bool colored() const
Are colors used?
Definition: DrawModes.hh:222
ACG::SceneGraph::DrawModes::NORMAL_PER_FACE
Definition: DrawModes.hh:164
ACG::GLMatrixT< float >
ACG::GLState::base_color
const Vec4f & base_color() const
get base color (used when lighting is off)
Definition: GLState.hh:926
ACG::RenderObject::vertexBuffer
GLuint vertexBuffer
VBO, IBO ids, ignored if VAO is provided.
Definition: RenderObject.hh:162
ACG::RenderObject::resetPointRendering
void resetPointRendering()
Reset shader template names blocked by point rendering.
Definition: RenderObject.cc:499
ACG::RenderObject::setUniform
void setUniform(const char *_name, GLint _value)
set values for int uniforms
Definition: RenderObject.cc:413
ACG::GLState::shininess
float shininess() const
get specular shininess (must be in [0, 128])
Definition: GLState.hh:960
ACG::RenderObject::vertexArrayObject
GLuint vertexArrayObject
Use vertex array object.
Definition: RenderObject.hh:158
ACG::RenderObject::textures_
std::map< size_t, Texture > textures_
holds the textures (second) and the stage id (first)
Definition: RenderObject.hh:355
ACG::RenderObject::resetLineRendering
void resetLineRendering()
Reset shader template names blocked by line rendering.
Definition: RenderObject.cc:479
GLSL::UniformPool::addPool
void addPool(const UniformPool &_src)
Add all uniforms of a pool to this pool.
Definition: UniformPool.cc:149
ACG::RenderObject::overlay
bool overlay
Layer based rendering.
Definition: RenderObject.hh:135
ACG::ShaderGenDesc::addTextureType
void addTextureType(GLenum _type, bool _shadow, size_t _stage)
adds a texture type to the shader and enables texturing.
Definition: ShaderGenerator.hh:214
ACG::SceneGraph::Material
Definition: MaterialNode.hh:79
ACG::RenderObject::alphaFunc
GLenum alphaFunc
GL_LESS, GL_LEQUAL, GL_GREATER ..
Definition: RenderObject.hh:243
ACG::RenderObject::numIndices
unsigned int numIndices
Number indices to render.
Definition: RenderObject.hh:188
ACG::RenderObject::setupLineRendering
void setupLineRendering(float _lineWidth, const Vec2f &_screenSize)
Setup rendering of thick lines.
Definition: RenderObject.cc:464
ACG::SceneGraph::Material::alphaTest
bool alphaTest() const
Return state of Alpha test.
Definition: MaterialNode.hh:252
ACG::GLState::modelview
const GLMatrixd & modelview() const
get modelview matrix
Definition: GLState.hh:791
ACG::RenderObject::shaderDesc
ShaderGenDesc shaderDesc
Drawmode and other shader params.
Definition: RenderObject.hh:225
ACG::GLState::isStateEnabled
static bool isStateEnabled(GLenum _cap)
returns true, if a cpa state is enabled
Definition: GLState.cc:1562
ACG::RenderObject::indexBuffer
GLuint indexBuffer
Use vertex array object.
Definition: RenderObject.hh:162
OpenMesh::VectorT
Definition: Vector11T.hh:83
ACG::GLState::getTexGenMode
static void getTexGenMode(GLenum _coord, GLenum _name, GLint *_param)
replaces glVertexPointer, supports locking
Definition: GLState.cc:2018
ACG::RenderObject::indexType
GLenum indexType
Index element type.
Definition: RenderObject.hh:197
GLSL::UniformPool
GLSL uniform pool.
Definition: UniformPool.hh:64
ACG::ShaderGenDesc::toString
QString toString() const
convert ShaderGenDesc to string format for debugging
Definition: ShaderGenerator.cc:2733
ACG::RenderObject::toString
QString toString() const
Definition: RenderObject.cc:239
ACG::RenderObject::debugID
int debugID
used internally for renderer debugging
Definition: RenderObject.hh:360
GLSL::UniformPool::toString
QString toString() const
print to string for debugging
Definition: UniformPool.cc:100
ACG::RenderObject::isDefaultPointObject
bool isDefaultPointObject() const
Test if the object is rendered with one of the default point extension methods.
Definition: RenderObject.cc:493
ACG::ShaderGenDesc::vertexNormalInterpolator
QString vertexNormalInterpolator
interpolation qualifier for vertex shader normal outputs: "flat", "smooth", "noperspective" ...
Definition: ShaderGenerator.hh:186
ACG::GLState::diffuse_color
const Vec4f & diffuse_color() const
get diffuse color
Definition: GLState.hh:936
ACG::RenderObject::sysmemIndexBuffer
const void * sysmemIndexBuffer
Use system memory index buffer.
Definition: RenderObject.hh:173
ACG::RenderObject::blendDest
GLenum blendDest
glBlendFunc: GL_SRC_ALPHA, GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA ...
Definition: RenderObject.hh:247
ACG::SceneGraph::Material::shininess
void shininess(float _s)
set shininess
Definition: MaterialNode.hh:204
ACG::RenderObject::vertexDecl
const VertexDeclaration * vertexDecl
Defines the vertex buffer layout, ignored if VAO is provided.
Definition: RenderObject.hh:208
ACG::GLState::ambient_color
const Vec4f & ambient_color() const
get ambient color
Definition: GLState.hh:931
ACG::SceneGraph::DrawModes::DrawModeProperties
DrawModeProperties stores a set of properties that defines, how to render an object.
Definition: DrawModes.hh:177
ACG::RenderObject::priority
int priority
Priority to allow sorting of objects.
Definition: RenderObject.hh:116