Commit 8f2b7605 authored by Michele Bosi's avatar Michele Bosi

Issue #4641: added vl::Vivid enums

parent 9cfa64e9
......@@ -67,7 +67,7 @@ VividRenderer::VividRenderer(VividRendering* vivid_rendering)
mVividRendering = vivid_rendering;
setEnableMask( VividEnableMask );
setEnableMask( Vivid::VividEnableMask );
// Depth peeling settings
mNumPasses = 4;
......@@ -321,7 +321,7 @@ void VividRenderer::drawFullScreenQuad()
//-------------------------------------------------------------------------------------------------
void VividRenderer::bindTexture( GLSLProgram* glsl, GLenum target, std::string texname, GLuint texid, int texunit )
{
VL_CHECK( texunit <= VividRendering::TextureUnit3 );
VL_CHECK( texunit <= Vivid::TextureUnit3 );
glActiveTexture(GL_TEXTURE0 + texunit);
glBindTexture(target, texid);
......@@ -504,14 +504,14 @@ void VividRenderer::renderFrontToBackPeeling(const RenderQueue* render_queue, Ca
// Fill
mShaderFrontPeel->useProgram();
bindTexture( mShaderFrontPeel.get(), GL_TEXTURE_RECTANGLE, "DepthTex", mFrontDepthTexId[prevId], VividRendering::TextureUnit0 );
bindTexture( mShaderFrontPeel.get(), GL_TEXTURE_RECTANGLE, "DepthTex", mFrontDepthTexId[prevId], Vivid::TextureUnit0 );
mShaderFrontPeel->applyUniformSet();
renderQueue( render_queue, mShaderFrontPeel.get(), camera, frame_clock, true, false );
/*
// Outline 3D
mShaderFrontPeel_S->useProgram();
bindTexture( mShaderFrontPeel_S.get(), GL_TEXTURE_RECTANGLE, "DepthTex", mFrontDepthTexId[prevId], VividRendering::TextureUnit0 );
bindTexture( mShaderFrontPeel_S.get(), GL_TEXTURE_RECTANGLE, "DepthTex", mFrontDepthTexId[prevId], Vivid::TextureUnit0 );
mShaderFrontPeel_S->applyUniformSet();
renderQueue( render_queue, mShaderFrontPeel_S.get(), camera, frame_clock, true, true );
*/
......@@ -534,7 +534,7 @@ void VividRenderer::renderFrontToBackPeeling(const RenderQueue* render_queue, Ca
glBlendFuncSeparate( GL_DST_ALPHA, GL_ONE, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA );
mShaderFrontBlend->useProgram();
bindTexture( mShaderFrontBlend.get(), GL_TEXTURE_RECTANGLE, "TempTex", mFrontColorTexId[currId], VividRendering::TextureUnit0 );
bindTexture( mShaderFrontBlend.get(), GL_TEXTURE_RECTANGLE, "TempTex", mFrontColorTexId[currId], Vivid::TextureUnit0 );
mShaderFrontBlend->applyUniformSet();
drawFullScreenQuad();
......@@ -579,8 +579,8 @@ void VividRenderer::renderFrontToBackPeeling(const RenderQueue* render_queue, Ca
mShaderFrontFinal->useProgram();
bindTexture( mShaderFrontFinal.get(), GL_TEXTURE_RECTANGLE, "ColorTex", mFrontColorBlenderTexId, VividRendering::TextureUnit0 );
bindTexture( mShaderFrontFinal.get(), GL_TEXTURE_RECTANGLE, "vl_Vivid.stencil.texture", mStencilTexture->handle(), VividRendering::TextureUnit1 );
bindTexture( mShaderFrontFinal.get(), GL_TEXTURE_RECTANGLE, "ColorTex", mFrontColorBlenderTexId, Vivid::TextureUnit0 );
bindTexture( mShaderFrontFinal.get(), GL_TEXTURE_RECTANGLE, "vl_Vivid.stencil.texture", mStencilTexture->handle(), Vivid::TextureUnit1 );
mShaderFrontFinal->applyUniformSet(); VL_CHECK_OGL();
drawFullScreenQuad();
......@@ -631,11 +631,11 @@ void VividRenderer::renderFrontToBackPeeling(const RenderQueue* render_queue, Ca
}
//-------------------------------------------------------------------------------------------------
void VividRenderer::renderStandard(const RenderQueue* render_queue, Camera* camera, real frame_clock) {
setEnableMask( StandardEnableMask );
setEnableMask( Vivid::StandardEnableMask );
Renderer::renderRaw( render_queue, camera, frame_clock );
setEnableMask( VividEnableMask );
setEnableMask( Vivid::VividEnableMask );
}
//-------------------------------------------------------------------------------------------------
void VividRenderer::render2DOutlines(const RenderQueue* render_queue, Camera* camera, real frame_clock) {
......@@ -735,7 +735,7 @@ void VividRenderer::render2DOutlines(const RenderQueue* render_queue, Camera* ca
// draw quad using outline.glsl
glEnable( GL_BLEND );
mShaderOutline2D->useProgram();
bindTexture( mShaderOutline2D.get(), GL_TEXTURE_RECTANGLE, "vl_Vivid.stencil.texture", mStencilTexture->handle(), VividRendering::TextureUnit0 );
bindTexture( mShaderOutline2D.get(), GL_TEXTURE_RECTANGLE, "vl_Vivid.stencil.texture", mStencilTexture->handle(), Vivid::TextureUnit0 );
mShaderOutline2D->applyUniformSet(); VL_CHECK_OGL();
mShaderOutline2D->applyUniformSet( shader->getUniformSet() );
VL_CHECK( shader->getUniform( "vl_Vivid.outline.color" ) );
......@@ -828,10 +828,10 @@ void VividRenderer::renderQueue(const RenderQueue* render_queue, GLSLProgram* cu
// texture mapping
if( shader->getUniform("vl_Vivid.enableTextureMapping")->getUniformI() == 1 ) {
shader->getTextureSampler( vl::VividRendering::UserTexture )->apply(vl::VividRendering::UserTexture, NULL, opengl_context);
shader->getTextureSampler( Vivid::UserTexture )->apply( Vivid::UserTexture, NULL, opengl_context );
VL_CHECK_OGL();
} else {
TextureSampler::reset(vl::VividRendering::UserTexture, opengl_context);
TextureSampler::reset( Vivid::UserTexture, opengl_context );
}
shader->getPointSize()->apply(0, NULL, opengl_context); VL_CHECK_OGL()
......@@ -891,7 +891,7 @@ void VividRenderer::renderQueue(const RenderQueue* render_queue, GLSLProgram* cu
VL_CHECK_OGL()
}
TextureSampler::reset(vl::VividRendering::UserTexture, opengl_context);
TextureSampler::reset(Vivid::UserTexture, opengl_context);
glDisable( GL_POINT_SPRITE );
if ( outline_on ) {
......@@ -1000,13 +1000,13 @@ const RenderQueue* VividRenderer::render(const RenderQueue* render_queue, Camera
switch ( mVividRendering->renderingMode() )
{
case VividRendering::FastRender:
case Vivid::FastRender:
renderControl( render_queue, camera, frame_clock );
break;
case VividRendering::StencilRender:
case Vivid::StencilRender:
renderStencil( camera );
break;
case VividRendering::DepthPeeling:
case Vivid::DepthPeeling:
if ( mVividRendering->stencilEnabled() ) {
renderStencil( camera );
}
......@@ -1173,7 +1173,7 @@ void VividRenderer::renderBackgroundImage( Camera* camera ) {
// vertex color
glColor4d( 1.0, 1.0, 1.0, 1.0 );
// enable texture 0
mVividRendering->backgroundTexSampler()->apply( VividRendering::TextureUnit0, camera, framebuffer()->openglContext() );
mVividRendering->backgroundTexSampler()->apply( Vivid::TextureUnit0, camera, framebuffer()->openglContext() );
// render the quad
mBackgroundQuad->render( NULL, NULL, NULL, framebuffer()->openglContext() );
// disable texture 0
......
......@@ -51,12 +51,6 @@ namespace vl
{
VL_INSTRUMENT_CLASS(vl::VividRenderer, Renderer)
public:
// This will use the Vivid depth peeling rendering path
static const int VividEnableMask = 1;
// This will use the standard VL Renderer rendering path. Used for volumes, text, etc.
static const int StandardEnableMask = 2;
public:
VividRenderer(VividRendering* vivid_rendering);
......
......@@ -53,7 +53,7 @@ VividRendering::VividRendering() {
// Settings
mRenderingMode = DepthPeeling;
mRenderingMode = Vivid::DepthPeeling;
mOpacity = 1.0f;
......@@ -137,8 +137,8 @@ ref<Effect> VividRendering::makeVividEffect(Effect* effect) {
texture->getTexParameter()->setMinFilter( vl::TPF_LINEAR );
texture->getTexParameter()->setMagFilter( vl::TPF_LINEAR );
texture->getTexParameter()->setWrap( vl::TPW_CLAMP_TO_EDGE );
fx->shader()->gocTextureSampler( vl::VividRendering::UserTexture )->setTexture( texture.get() );
fx->shader()->gocUniform( "vl_UserTexture" )->setUniformI( vl::VividRendering::UserTexture );
fx->shader()->gocTextureSampler( vl::Vivid::UserTexture )->setTexture( texture.get() );
fx->shader()->gocUniform( "vl_UserTexture" )->setUniformI( vl::Vivid::UserTexture );
fx->shader()->gocUniform( "vl_Vivid.enableTextureMapping" )->setUniformI( 0 );
// Used by the fast renderer - ignored by depth peeling
......
......@@ -42,21 +42,20 @@
namespace vl
{
//-----------------------------------------------------------------------------
// VividRendering
//-----------------------------------------------------------------------------
/** Experimental class. */
class VLVIVID_EXPORT VividRendering: public Rendering
{
VL_INSTRUMENT_CLASS(vl::VividRendering, Rendering)
public:
namespace Vivid {
typedef enum {
DepthPeeling,
FastRender,
StencilRender
} ERenderingMode;
typedef enum {
//! This will use the Vivid depth peeling rendering path
VividEnableMask = 1,
//! This will use the standard VL Renderer rendering path. Used for volumes, text, etc.
StandardEnableMask = 2
} EEnableMask;
typedef enum {
TextureUnit0 = 0,
TextureUnit1 = 1,
......@@ -65,6 +64,56 @@ namespace vl
UserTexture = 4
} ETextureUnits;
typedef enum {
Direct,
Isosurface,
MIP
} EVolumeMode;
typedef enum {
Point3D,
Point2D
} EPointMode;
typedef enum {
Color,
Alpha,
Saturation
} ESmartTarget;
typedef enum {
FogOff,
FogLinear,
FogExp,
FogExp2
} EFogMode;
typedef enum {
ClipOff,
ClipSphere,
ClipBox,
ClipPlane
} EClipMode;
typedef enum {
Polys,
Outline3D,
PolysAndOutline3D,
Slice,
Outline2D,
PolysAndOutline2D,
} ESurfaceMode;
}
//-----------------------------------------------------------------------------
// VividRendering
//-----------------------------------------------------------------------------
/** Experimental class. */
class VLVIVID_EXPORT VividRendering: public Rendering
{
VL_INSTRUMENT_CLASS(vl::VividRendering, Rendering)
public:
VividRendering();
......@@ -81,8 +130,8 @@ namespace vl
// Settings
void setRenderingMode(ERenderingMode mode) { mRenderingMode = mode; }
ERenderingMode renderingMode() const { return mRenderingMode; }
void setRenderingMode(Vivid::ERenderingMode mode) { mRenderingMode = mode; }
Vivid::ERenderingMode renderingMode() const { return mRenderingMode; }
/** The opacity of the 3D rendering on top of the background. */
void setOpacity( float a ) { mOpacity = a; }
......@@ -164,7 +213,7 @@ namespace vl
// Settings
ERenderingMode mRenderingMode;
Vivid::ERenderingMode mRenderingMode;
float mOpacity;
......
......@@ -126,7 +126,7 @@ VividVolume::VividVolume(VividRendering* vivid_rendering)
mVolumeGLSLProgram->attachShader( new GLSLFragmentShader("/vivid/glsl/volume/raycast.fs") );
mVolumeGLSLProgram->linkProgram();
mVolumeActor->setEnableMask( VividRenderer::StandardEnableMask );
mVolumeActor->setEnableMask( Vivid::StandardEnableMask );
mVolumeActor->setObjectName( "Volume Actor" );
bindActor( mVolumeActor.get() );
......
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