Commit 8df0e672 authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'master' into splatcloud_rendering

parent 01d53354
...@@ -132,6 +132,12 @@ void IRenderer::addRenderObject(ACG::RenderObject* _renderObject) ...@@ -132,6 +132,12 @@ void IRenderer::addRenderObject(ACG::RenderObject* _renderObject)
!_renderObject->colorWriteMask[2] && !_renderObject->colorWriteMask[3]) !_renderObject->colorWriteMask[2] && !_renderObject->colorWriteMask[3])
std::cout << "warning: depth write and color write disabled in renderobject: " << _renderObject->debugName << std::endl; std::cout << "warning: depth write and color write disabled in renderobject: " << _renderObject->debugName << std::endl;
// Why is gl_PointSize not working in shader?
#ifndef GL_PROGRAM_POINT_SIZE
if (_renderObject->programPointSize)
std::cout << "warning: GL_PROGRAM_POINT_SIZE requested but missing in opengl headers!" << std::endl;
#endif
if (errorDetectionLevel_ > 1 && _renderObject->shaderDesc.shadeMode == SG_SHADE_UNLIT) if (errorDetectionLevel_ > 1 && _renderObject->shaderDesc.shadeMode == SG_SHADE_UNLIT)
{ {
if (_renderObject->emissive.max() < 1e-3f) if (_renderObject->emissive.max() < 1e-3f)
...@@ -719,6 +725,8 @@ void IRenderer::finishRenderingPipeline(bool _drawOverlay) ...@@ -719,6 +725,8 @@ void IRenderer::finishRenderingPipeline(bool _drawOverlay)
for (int i = 0; i < maxClipDistances_; ++i) for (int i = 0; i < maxClipDistances_; ++i)
glDisable(GL_CLIP_DISTANCE0 + i); glDisable(GL_CLIP_DISTANCE0 + i);
glDisable(GL_PROGRAM_POINT_SIZE);
glDepthMask(1); glDepthMask(1);
glColorMask(1,1,1,1); glColorMask(1,1,1,1);
...@@ -1048,6 +1056,15 @@ void IRenderer::bindObjectRenderStates(ACG::RenderObject* _obj) ...@@ -1048,6 +1056,15 @@ void IRenderer::bindObjectRenderStates(ACG::RenderObject* _obj)
else else
glDisable(GL_CLIP_DISTANCE0 + i); glDisable(GL_CLIP_DISTANCE0 + i);
} }
#ifdef GL_PROGRAM_POINT_SIZE
if (_obj->programPointSize)
glEnable(GL_PROGRAM_POINT_SIZE);
else
glDisable(GL_PROGRAM_POINT_SIZE);
#endif
glPointSize(_obj->pointSize);
} }
void IRenderer::drawObject(ACG::RenderObject* _obj) void IRenderer::drawObject(ACG::RenderObject* _obj)
......
...@@ -74,6 +74,8 @@ void RenderObject::initFromState( GLState* _glState ) ...@@ -74,6 +74,8 @@ void RenderObject::initFromState( GLState* _glState )
depthWrite = true; depthWrite = true;
alphaTest = false; alphaTest = false;
programPointSize = false;
colorWriteMask[0] = colorWriteMask[1] = colorWriteMask[2] = colorWriteMask[3] = 1; colorWriteMask[0] = colorWriteMask[1] = colorWriteMask[2] = colorWriteMask[3] = 1;
fillMode = GL_FILL; fillMode = GL_FILL;
...@@ -86,6 +88,7 @@ void RenderObject::initFromState( GLState* _glState ) ...@@ -86,6 +88,7 @@ void RenderObject::initFromState( GLState* _glState )
alpha = 1.0f; alpha = 1.0f;
pointSize = 0.1f;
if (_glState) if (_glState)
{ {
...@@ -113,6 +116,13 @@ void RenderObject::initFromState( GLState* _glState ) ...@@ -113,6 +116,13 @@ void RenderObject::initFromState( GLState* _glState )
emissive[i] = _glState->base_color()[i]; emissive[i] = _glState->base_color()[i];
} }
shininess = _glState->shininess(); shininess = _glState->shininess();
#ifdef GL_PROGRAM_POINT_SIZE
programPointSize = _glState->isStateEnabled(GL_PROGRAM_POINT_SIZE);
#endif
pointSize = _glState->point_size();
} }
...@@ -194,24 +204,27 @@ void RenderObject::setMaterial( const SceneGraph::Material* _mat ) ...@@ -194,24 +204,27 @@ void RenderObject::setMaterial( const SceneGraph::Material* _mat )
RenderObject::RenderObject() RenderObject::RenderObject()
: priority(0), : priority(0),
overlay(false), overlay(false),
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))), 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))),
proj(modelview), proj(modelview),
vertexArrayObject(0), vertexArrayObject(0),
vertexBuffer(0), indexBuffer(0), sysmemIndexBuffer(0), vertexBuffer(0), indexBuffer(0), sysmemIndexBuffer(0),
primitiveMode(GL_TRIANGLES), patchVertices(0), numIndices(0), indexOffset(0), indexType(GL_UNSIGNED_INT), primitiveMode(GL_TRIANGLES), patchVertices(0), numIndices(0), indexOffset(0), indexType(GL_UNSIGNED_INT),
numInstances(0), numInstances(0),
vertexDecl(0), vertexDecl(0),
culling(true), blending(false), alphaTest(false), culling(true), blending(false), alphaTest(false),
depthTest(true), depthWrite(true), depthTest(true), depthWrite(true),
fillMode(GL_FILL), depthFunc(GL_LESS), fillMode(GL_FILL), depthFunc(GL_LESS),
alphaFunc(GL_ALWAYS), alphaRef(0.0f), alphaFunc(GL_ALWAYS), alphaRef(0.0f),
blendSrc(GL_SRC_ALPHA), blendDest(GL_ONE_MINUS_SRC_ALPHA), blendSrc(GL_SRC_ALPHA), blendDest(GL_ONE_MINUS_SRC_ALPHA),
depthRange(0.0f, 1.0f), depthRange(0.0f, 1.0f),
clipDistanceMask(0), clipDistanceMask(0),
programPointSize(false),
pointSize(0.1f),
patchDefaultInnerLevel(1.0f, 1.0f), patchDefaultInnerLevel(1.0f, 1.0f),
patchDefaultOuterLevel(1.0f, 1.0f, 1.0f, 1.0f), patchDefaultOuterLevel(1.0f, 1.0f, 1.0f, 1.0f),
......
...@@ -261,6 +261,14 @@ struct ACGDLLEXPORT RenderObject ...@@ -261,6 +261,14 @@ struct ACGDLLEXPORT RenderObject
// default: all zero (disabled) // default: all zero (disabled)
GLuint clipDistanceMask; GLuint clipDistanceMask;
// GL_PROGRAM_POINT_SIZE : default false
// if true, use gl_PointSize from shader
// otherwise, use pointSize from render object
bool programPointSize;
// glPointSize(), default: 0.1
float pointSize;
// --------------------------- // ---------------------------
// default tessellation lod, if only a tess-eval, but no tess-control shader is specified // default tessellation lod, if only a tess-eval, but no tess-control shader is specified
// this is ignored otherwise // this is ignored otherwise
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment