1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0027750: Visualization, V3d_View - remove unused functionality ZClipping and ZCueing

Methods V3d_View::SetZClippingType(), ::SetZClippingDepth(), ::SetZClippingWidth(),
::SetZCueingDepth(), ::SetZCueingWidth(), ::SetZCueingOn(), ::SetZCueingOff()
have been removed.
This commit is contained in:
kgv
2016-08-03 22:08:01 +03:00
committed by bugmaster
parent 4ad142d9cb
commit 89a929ea26
43 changed files with 30 additions and 1685 deletions

View File

@@ -1149,13 +1149,6 @@ void Graphic3d_CView::CopySettings (const Handle(Graphic3d_CView)& theOther)
SetShadingModel (theOther->ShadingModel());
SetBackfacingModel (theOther->BackfacingModel());
SetCamera (new Graphic3d_Camera (theOther->Camera()));
SetBackZClippingOn (theOther->BackZClippingIsOn());
SetFrontZClippingOn (theOther->FrontZClippingIsOn());
SetZClippingBackPlane (theOther->ZClippingBackPlane());
SetZClippingFrontPlane (theOther->ZClippingFrontPlane());
SetDepthCueingOn (theOther->DepthCueingIsOn());
SetDepthCueingBackPlane (theOther->DepthCueingBackPlane());
SetDepthCueingFrontPlane (theOther->DepthCueingFrontPlane());
SetGLLightEnabled (theOther->IsGLLightEnabled());
SetLights (theOther->Lights());
SetClipPlanes (theOther->ClipPlanes());

View File

@@ -456,48 +456,6 @@ public:
//! Sets camera used by the view.
virtual void SetCamera (const Handle(Graphic3d_Camera)& theCamera) = 0;
//! Returns the activity of back z-clipping plane.
virtual Standard_Boolean BackZClippingIsOn() const = 0;
//! Activates the back Z-clipping plane.
virtual void SetBackZClippingOn (const Standard_Boolean theIsOn) = 0;
//! Returns the definition of the back Z-clipping plane.
virtual Standard_Real ZClippingBackPlane() const = 0;
//! Sets the definition of the back Z-clipping plane.
virtual void SetZClippingBackPlane (const Standard_Real theValue) = 0;
//! Returns the activity of front z-clipping plane.
virtual Standard_Boolean FrontZClippingIsOn() const = 0;
//! Activates the front Z-clipping plane.
virtual void SetFrontZClippingOn (const Standard_Boolean theIsOn) = 0;
//! Returns the definition of the front Z-clipping plane.
virtual Standard_Real ZClippingFrontPlane() const = 0;
//! Sets the definition of the front Z-clipping plane.
virtual void SetZClippingFrontPlane (const Standard_Real theValue) = 0;
//! Returns the activity of depth cueing.
virtual Standard_Boolean DepthCueingIsOn() const = 0;
//! Sets the activity of depth cueing.
virtual void SetDepthCueingOn (const Standard_Boolean theIsOn) = 0;
//! Returns the back depth cueing plane.
virtual Standard_Real DepthCueingBackPlane() const = 0;
//! Set the back depth cueing plane.
virtual void SetDepthCueingBackPlane (const Standard_Real theValue) = 0;
//! Returns the front depth cueing plane.
virtual Standard_Real DepthCueingFrontPlane() const = 0;
//! Set the front depth cueing plane.
virtual void SetDepthCueingFrontPlane (const Standard_Real theValue) = 0;
//! Returns true if GL lighting is enabled.
virtual Standard_Boolean IsGLLightEnabled() const = 0;

View File

@@ -54,32 +54,20 @@ void OpenGl_Clipping::Init (const Standard_Integer theMaxPlanes)
// purpose :
// =======================================================================
void OpenGl_Clipping::add (const Handle(OpenGl_Context)& theGlCtx,
const EquationCoords& theCoordSpace,
Graphic3d_SequenceOfHClipPlane& thePlanes)
{
const bool toUseFfp = theGlCtx->core11 != NULL
&& theGlCtx->caps->ffpEnable;
if (!toUseFfp)
{
addLazy (theGlCtx, theCoordSpace, thePlanes);
addLazy (theGlCtx, thePlanes);
return;
}
if (EquationCoords_View == theCoordSpace)
{
theGlCtx->WorldViewState.Push();
theGlCtx->WorldViewState.SetIdentity();
}
// Set either identity or pure view matrix.
theGlCtx->ApplyWorldViewMatrix();
addLazy (theGlCtx, theCoordSpace, thePlanes);
if (EquationCoords_View == theCoordSpace)
{
theGlCtx->WorldViewState.Pop();
}
addLazy (theGlCtx, thePlanes);
// Restore combined model-view matrix.
theGlCtx->ApplyModelViewMatrix();
@@ -90,7 +78,6 @@ void OpenGl_Clipping::add (const Handle(OpenGl_Context)& theGlCtx,
// purpose :
// =======================================================================
void OpenGl_Clipping::addLazy (const Handle(OpenGl_Context)& theGlCtx,
const EquationCoords& theCoordSpace,
Graphic3d_SequenceOfHClipPlane& thePlanes)
{
#if !defined(GL_ES_VERSION_2_0)
@@ -112,7 +99,7 @@ void OpenGl_Clipping::addLazy (const Handle(OpenGl_Context)& theGlCtx,
Standard_Integer anID = myEmptyPlaneIds->Next();
myPlanes.Append (aPlane);
myPlaneStates.Bind (aPlane, PlaneProps (theCoordSpace, anID, Standard_True));
myPlaneStates.Bind (aPlane, PlaneProps (anID, Standard_True));
#if !defined(GL_ES_VERSION_2_0)
if (toUseFfp)

View File

@@ -34,15 +34,6 @@ class OpenGl_Workspace;
//! class.
class OpenGl_Clipping
{
public:
//! Enumerates supported equation coordinate spaces.
enum EquationCoords
{
EquationCoords_View,
EquationCoords_World
};
public: //! @name general methods
//! Default constructor.
@@ -69,12 +60,6 @@ public: //! @name non-modifying getters
return myPlanes;
}
//! @return kind of equation coordinate space used for the clip plane.
inline EquationCoords GetEquationSpace (const Handle(Graphic3d_ClipPlane)& thePlane) const
{
return myPlaneStates.Find (thePlane).CoordSpace;
}
//! Check whether the clipping plane has been set and enabled for the current context state.
//! @param thePlane [in] the plane to check.
//! @return True if plane is enabled.
@@ -113,12 +98,10 @@ public: //! @name clipping state modification commands
//! Otherwise the method just redirects to addLazy().
//!
//! @param theGlCtx [in] context to access the matrices
//! @param theCoordSpace [in] the equation definition space
//! @param thePlanes [in/out] the list of planes to be added
//! The list then provides information on which planes were really added to clipping state.
//! This list then can be used to fall back to previous state.
Standard_EXPORT void add (const Handle(OpenGl_Context)& theGlCtx,
const EquationCoords& theCoordSpace,
Graphic3d_SequenceOfHClipPlane& thePlanes);
//! Add planes to the context clipping at the specified system of coordinates.
@@ -128,9 +111,7 @@ public: //! @name clipping state modification commands
//! @param thePlanes [in/out] the list of planes to be added.
//! The list then provides information on which planes were really added to clipping state.
//! This list then can be used to fall back to previous state.
//! @param theCoordSpace [in] the equation definition space.
Standard_EXPORT void addLazy (const Handle(OpenGl_Context)& theGlCtx,
const EquationCoords& theCoordSpace,
Graphic3d_SequenceOfHClipPlane& thePlanes);
//! Remove the passed set of clipping planes from the context state.
@@ -147,19 +128,6 @@ public: //! @name clipping state modification commands
public: //! @name Short-cuts
//! Add planes to the context clipping at the view system of coordinates.
//! If the number of the passed planes exceeds capabilities of OpenGl, the last planes
//! are simply ignored.
//! @param theGlCtx [in] context to access the matrices
//! @param thePlanes [in/out] the list of planes to be added
//! The list then provides information on which planes were really added to clipping state.
//! This list then can be used to fall back to previous state.
inline void AddView (const Handle(OpenGl_Context)& theGlCtx,
Graphic3d_SequenceOfHClipPlane& thePlanes)
{
add (theGlCtx, EquationCoords_View, thePlanes);
}
//! Add planes to the context clipping at the world system of coordinates.
//! If the number of the passed planes exceeds capabilities of OpenGl, the last planes
//! are simply ignored.
@@ -170,7 +138,7 @@ public: //! @name Short-cuts
inline void AddWorld (const Handle(OpenGl_Context)& theGlCtx,
Graphic3d_SequenceOfHClipPlane& thePlanes)
{
add (theGlCtx, EquationCoords_World, thePlanes);
add (theGlCtx, thePlanes);
}
//! Remove all of the planes from context state.
@@ -186,16 +154,13 @@ private:
// declare default constructor
// to allow compilation of template collections
PlaneProps() {}
PlaneProps (const EquationCoords theCoords,
const Standard_Integer theID,
PlaneProps (const Standard_Integer theID,
const Standard_Boolean theIsEnabled)
{
CoordSpace = theCoords;
ContextID = theID;
IsEnabled = theIsEnabled;
}
EquationCoords CoordSpace;
Standard_Integer ContextID;
Standard_Boolean IsEnabled;
};

View File

@@ -386,9 +386,8 @@ Standard_Integer OpenGl_GraphicDriver::InquireViewLimit()
// =======================================================================
Standard_Integer OpenGl_GraphicDriver::InquirePlaneLimit()
{
// NOTE the 2 first planes are reserved for ZClipping
const Handle(OpenGl_Context)& aCtx = GetSharedContext();
return aCtx.IsNull() ? 0 : Max (aCtx->MaxClipPlanes() - 2, 0);
return aCtx.IsNull() ? aCtx->MaxClipPlanes() : 0;
}
// =======================================================================

View File

@@ -28,14 +28,14 @@
#include <TCollection_ExtendedString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderManager,Standard_Transient)
namespace
{
//! Clipping planes limit (see the same definition in Declarations.glsl).
static const Standard_Size THE_MAX_CLIP_PLANES = 8;
#define EOL "\n"
//! Definition of TexCoord varying.
@@ -225,20 +225,9 @@ const char THE_FRAG_CLIP_PLANES[] =
EOL" for (int aPlaneIter = 0; aPlaneIter < occClipPlaneCount; ++aPlaneIter)"
EOL" {"
EOL" vec4 aClipEquation = occClipPlaneEquations[aPlaneIter];"
EOL" int aClipSpace = occClipPlaneSpaces[aPlaneIter];"
EOL" if (aClipSpace == OccEquationCoords_World)"
EOL" if (dot (aClipEquation.xyz, PositionWorld.xyz / PositionWorld.w) + aClipEquation.w < 0.0)"
EOL" {"
EOL" if (dot (aClipEquation.xyz, PositionWorld.xyz / PositionWorld.w) + aClipEquation.w < 0.0)"
EOL" {"
EOL" discard;"
EOL" }"
EOL" }"
EOL" else if (aClipSpace == OccEquationCoords_View)"
EOL" {"
EOL" if (dot (aClipEquation.xyz, Position.xyz) + aClipEquation.w < 0.0)"
EOL" {"
EOL" discard;"
EOL" }"
EOL" discard;"
EOL" }"
EOL" }";
@@ -755,9 +744,7 @@ void OpenGl_ShaderManager::PushClippingState (const Handle(OpenGl_ShaderProgram)
theProgram->UpdateState (OpenGl_CLIP_PLANES_STATE, myClippingState.Index());
const GLint aLocEquations = theProgram->GetStateLocation (OpenGl_OCC_CLIP_PLANE_EQUATIONS);
const GLint aLocSpaces = theProgram->GetStateLocation (OpenGl_OCC_CLIP_PLANE_SPACES);
if (aLocEquations == OpenGl_ShaderProgram::INVALID_LOCATION
&& aLocSpaces == OpenGl_ShaderProgram::INVALID_LOCATION)
if (aLocEquations == OpenGl_ShaderProgram::INVALID_LOCATION)
{
return;
}
@@ -779,9 +766,7 @@ void OpenGl_ShaderManager::PushClippingState (const Handle(OpenGl_ShaderProgram)
return;
}
const Standard_Size MAX_CLIP_PLANES = 8;
OpenGl_Vec4* anEquations = new OpenGl_Vec4[MAX_CLIP_PLANES];
GLint* aSpaces = new GLint [MAX_CLIP_PLANES];
OpenGl_Vec4 anEquations[THE_MAX_CLIP_PLANES];
GLuint aPlaneId = 0;
for (Graphic3d_SequenceOfHClipPlane::Iterator anIter (myContext->Clipping().Planes());
anIter.More(); anIter.Next())
@@ -791,24 +776,26 @@ void OpenGl_ShaderManager::PushClippingState (const Handle(OpenGl_ShaderProgram)
{
continue;
}
else if (aPlaneId >= THE_MAX_CLIP_PLANES)
{
myContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_MEDIUM,
"Warning: clipping planes limit (8) has been exceeded.");
break;
}
const Graphic3d_ClipPlane::Equation& anEquation = aPlane->GetEquation();
anEquations[aPlaneId] = OpenGl_Vec4 ((float) anEquation.x(),
(float) anEquation.y(),
(float) anEquation.z(),
(float) anEquation.w());
aSpaces[aPlaneId] = myContext->Clipping().GetEquationSpace (aPlane);
++aPlaneId;
}
theProgram->SetUniform (myContext,
theProgram->GetStateLocation (OpenGl_OCC_CLIP_PLANE_COUNT),
aPlanesNb);
theProgram->SetUniform (myContext, aLocEquations, MAX_CLIP_PLANES, anEquations);
theProgram->SetUniform (myContext, aLocSpaces, MAX_CLIP_PLANES, aSpaces);
delete[] anEquations;
delete[] aSpaces;
theProgram->SetUniform (myContext, aLocEquations, THE_MAX_CLIP_PLANES, anEquations);
}
// =======================================================================

View File

@@ -53,7 +53,6 @@ Standard_CString OpenGl_ShaderProgram::PredefinedKeywords[] =
"occProjectionMatrixInverseTranspose", // OpenGl_OCC_PROJECTION_MATRIX_INVERSE_TRANSPOSE
"occClipPlaneEquations", // OpenGl_OCC_CLIP_PLANE_EQUATIONS
"occClipPlaneSpaces", // OpenGl_OCC_CLIP_PLANE_SPACES
"occClipPlaneCount", // OpenGl_OCC_CLIP_PLANE_COUNT
"occLightSourcesCount", // OpenGl_OCC_LIGHT_SOURCE_COUNT

View File

@@ -49,7 +49,6 @@ enum OpenGl_StateVariable
// OpenGL clip planes state
OpenGl_OCC_CLIP_PLANE_EQUATIONS,
OpenGl_OCC_CLIP_PLANE_SPACES,
OpenGl_OCC_CLIP_PLANE_COUNT,
// OpenGL light state

View File

@@ -40,14 +40,6 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_View,Graphic3d_CView)
#include <gl2ps.h>
#endif
/*----------------------------------------------------------------------*/
namespace
{
static const OPENGL_ZCLIP myDefaultZClip = { { Standard_False, 0.F }, { Standard_False, 1.F } };
static const OPENGL_FOG myDefaultFog = { Standard_False, 0.F, 1.F, OpenGl_Vec4 (0.0f, 0.0f, 0.0f, 1.0f) };
}
// =======================================================================
// function : Constructor
// purpose :
@@ -66,8 +58,6 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
myShadingModel (Graphic3d_TOSM_FACET),
myBackfacing (Graphic3d_TOBM_AUTOMATIC),
myBgColor (Quantity_NOC_BLACK),
myFog (myDefaultFog),
myZClip (myDefaultZClip),
myCamera (new Graphic3d_Camera()),
myUseGLLight (Standard_True),
myToShowTrihedron (false),
@@ -401,7 +391,6 @@ Aspect_Background OpenGl_View::Background() const
void OpenGl_View::SetBackground (const Aspect_Background& theBackground)
{
myBgColor.SetRGB (theBackground.Color());
myFog.Color = myBgColor;
}
// =======================================================================

View File

@@ -53,26 +53,6 @@
#include <map>
#include <set>
struct OPENGL_ZCLIP
{
struct {
Standard_Boolean IsOn;
Standard_ShortReal Limit; /* in the range [0., 1.] */
} Back;
struct {
Standard_Boolean IsOn;
Standard_ShortReal Limit; /* in the range [0., 1.] */
} Front;
};
struct OPENGL_FOG
{
Standard_Boolean IsOn;
Standard_ShortReal Front; /* in the range [0., 1.] */
Standard_ShortReal Back; /* in the range [0., 1.] */
OpenGl_Vec4 Color;
};
struct OpenGl_Matrix;
class Graphic3d_StructureManager;
@@ -327,60 +307,6 @@ public:
//! Sets camera used by the view.
virtual void SetCamera (const Handle(Graphic3d_Camera)& theCamera) Standard_OVERRIDE { myCamera = theCamera; }
//! Returns the activity of back z-clipping plane.
virtual Standard_Boolean BackZClippingIsOn() const Standard_OVERRIDE { return myZClip.Back.IsOn; }
//! Activates the back Z-clipping plane.
virtual void SetBackZClippingOn (const Standard_Boolean theIsOn) Standard_OVERRIDE { myZClip.Back.IsOn = theIsOn; }
//! Returns the definition of the back Z-clipping plane.
virtual Standard_Real ZClippingBackPlane() const Standard_OVERRIDE { return myZClip.Back.Limit; }
//! Sets the definition of the back Z-clipping plane.
virtual void SetZClippingBackPlane (const Standard_Real theValue) Standard_OVERRIDE
{
myZClip.Back.Limit = static_cast<Standard_ShortReal> (theValue);
}
//! Returns the activity of front z-clipping plane.
virtual Standard_Boolean FrontZClippingIsOn() const Standard_OVERRIDE { return myZClip.Front.IsOn; }
//! Activates the front Z-clipping plane.
virtual void SetFrontZClippingOn (const Standard_Boolean theIsOn) Standard_OVERRIDE{ myZClip.Front.IsOn = theIsOn; }
//! Returns the definition of the front Z-clipping plane.
virtual Standard_Real ZClippingFrontPlane() const Standard_OVERRIDE { return myZClip.Front.Limit; }
//! Sets the definition of the front Z-clipping plane.
virtual void SetZClippingFrontPlane (const Standard_Real theValue) Standard_OVERRIDE
{
myZClip.Front.Limit = static_cast<Standard_ShortReal> (theValue);
}
//! Returns the activity of depth cueing.
virtual Standard_Boolean DepthCueingIsOn() const Standard_OVERRIDE { return myFog.IsOn; }
//! Sets the activity of depth cueing.
virtual void SetDepthCueingOn (const Standard_Boolean theIsOn) Standard_OVERRIDE { myFog.IsOn = theIsOn; }
//! Returns the back depth cueing plane.
virtual Standard_Real DepthCueingBackPlane() const Standard_OVERRIDE { return myFog.Back; }
//! Set the back depth cueing plane.
virtual void SetDepthCueingBackPlane (const Standard_Real theValue) Standard_OVERRIDE
{
myFog.Back = static_cast<Standard_ShortReal> (theValue);
}
//! Returns the front depth cueing plane.
virtual Standard_Real DepthCueingFrontPlane() const Standard_OVERRIDE { return myFog.Front; }
//! Set the front depth cueing plane.
virtual void SetDepthCueingFrontPlane (const Standard_Real theValue) Standard_OVERRIDE
{
myFog.Front = static_cast<Standard_ShortReal> (theValue);
}
//! Returns true if GL lighting is enabled.
virtual Standard_Boolean IsGLLightEnabled() const Standard_OVERRIDE { return myUseGLLight; }
@@ -561,8 +487,6 @@ protected:
Graphic3d_TypeOfShadingModel myShadingModel;
Graphic3d_TypeOfBackfacingModel myBackfacing;
Quantity_ColorRGBA myBgColor;
OPENGL_FOG myFog;
OPENGL_ZCLIP myZClip;
Graphic3d_SequenceOfHClipPlane myClipPlanes;
Handle(Graphic3d_Camera) myCamera;
Handle(OpenGl_FrameBuffer) myFBO;

View File

@@ -893,41 +893,6 @@ void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
aContext->SetGlNormalizeEnabled (Standard_False);
}
// Apply Fog
if (myFog.IsOn
&& aContext->core11 != NULL)
{
Standard_Real aFogFrontConverted = (Standard_Real )myFog.Front + myCamera->Distance();
if (myCamera->ZFar() < aFogFrontConverted)
{
aFogFrontConverted = myCamera->ZFar();
myFog.Front = (Standard_ShortReal )(aFogFrontConverted - myCamera->Distance());
}
Standard_Real aFogBackConverted = (Standard_Real )myFog.Back + myCamera->Distance();
if (myCamera->ZFar() < aFogFrontConverted)
{
aFogBackConverted = myCamera->ZFar();
myFog.Back = (Standard_ShortReal )(aFogBackConverted - myCamera->Distance());
}
if (aFogFrontConverted > aFogBackConverted)
{
myFog.Front = (Standard_ShortReal )(aFogFrontConverted - myCamera->Distance());
myFog.Back = (Standard_ShortReal )(aFogBackConverted - myCamera->Distance());
}
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogf(GL_FOG_START, (Standard_ShortReal )aFogFrontConverted);
glFogf(GL_FOG_END, (Standard_ShortReal )aFogBackConverted);
glFogfv(GL_FOG_COLOR, myFog.Color.GetData());
glEnable(GL_FOG);
}
else if (aContext->core11 != NULL)
{
glDisable (GL_FOG);
}
// Apply InteriorShadingMethod
if (aContext->core11 != NULL)
{
@@ -1151,56 +1116,6 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
{
const Handle(OpenGl_Context)& aContext = myWorkspace->GetGlContext();
if (myZClip.Back.IsOn || myZClip.Front.IsOn)
{
Handle(Graphic3d_ClipPlane) aPlaneBack;
Handle(Graphic3d_ClipPlane) aPlaneFront;
if (myZClip.Back.IsOn)
{
Standard_Real aClipBackConverted = (Standard_Real )myZClip.Front.Limit + myCamera->Distance();
if (myCamera->ZFar() < aClipBackConverted)
{
aClipBackConverted = myCamera->ZFar();
myZClip.Back.Limit = (Standard_ShortReal )(aClipBackConverted - myCamera->Distance());
}
const Graphic3d_ClipPlane::Equation aBackEquation (0.0, 0.0, 1.0, (Standard_ShortReal )aClipBackConverted);
aPlaneBack = new Graphic3d_ClipPlane (aBackEquation);
}
if (myZClip.Front.IsOn)
{
Standard_Real aClipFrontConverted = (Standard_Real )myZClip.Front.Limit + myCamera->Distance();
if (myCamera->ZNear() > aClipFrontConverted)
{
aClipFrontConverted = myCamera->ZNear();
myZClip.Front.Limit = (Standard_ShortReal )(aClipFrontConverted - myCamera->Distance());
}
const Graphic3d_ClipPlane::Equation aFrontEquation (0.0, 0.0, -1.0, (Standard_ShortReal )-aClipFrontConverted);
aPlaneFront = new Graphic3d_ClipPlane (aFrontEquation);
}
// Specify slicing planes with identity transformation
if (!aPlaneBack.IsNull() || !aPlaneFront.IsNull())
{
Graphic3d_SequenceOfHClipPlane aSlicingPlanes;
if (!aPlaneBack.IsNull())
{
aSlicingPlanes.Append (aPlaneBack);
}
if (!aPlaneFront.IsNull())
{
aSlicingPlanes.Append (aPlaneFront);
}
// add planes at loaded view matrix state
aContext->ChangeClipping().AddView (aContext, aSlicingPlanes);
}
aContext->ShaderManager()->UpdateClippingState();
}
#ifdef _WIN32
// set printing scale/tiling transformation
Handle(OpenGl_PrinterContext) aPrintContext = myWorkspace->PrinterContext();
@@ -1213,6 +1128,7 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
#endif
// Specify clipping planes in view transformation space
aContext->ChangeClipping().RemoveAll (aContext);
if (!myClipPlanes.IsEmpty())
{
Graphic3d_SequenceOfHClipPlane aUserPlanes;
@@ -1323,10 +1239,6 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
{
aContext->ShaderManager()->RevertClippingState();
}
if (myZClip.Back.IsOn || myZClip.Front.IsOn)
{
aContext->ShaderManager()->RevertClippingState();
}
#ifdef _WIN32
// set printing scale/tiling transformation

View File

@@ -110,11 +110,6 @@ uniform sampler2D occActiveSampler; //!< Current active sampl
uniform vec4 occTexTrsf2d[2]; //!< 2D texture transformation parameters
uniform float occPointSize; //!< point size
// clipping planes state
const int OccEquationCoords_View = 0; //!< view-space clipping plane
const int OccEquationCoords_World = 1; //!< world-space clipping plane
//! Parameters of clipping planes
uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];
uniform THE_PREC_ENUM int occClipPlaneSpaces [THE_MAX_CLIP_PLANES];
uniform THE_PREC_ENUM int occClipPlaneCount; //!< Total number of clip planes

View File

@@ -179,20 +179,9 @@ void main()
for (int anIndex = 0; anIndex < occClipPlaneCount; ++anIndex)
{
vec4 aClipEquation = occClipPlaneEquations[anIndex];
int aClipSpace = occClipPlaneSpaces[anIndex];
if (aClipSpace == OccEquationCoords_World)
if (dot (aClipEquation.xyz, PositionWorld.xyz / PositionWorld.w) + aClipEquation.w < 0.0)
{
if (dot (aClipEquation.xyz, PositionWorld.xyz / PositionWorld.w) + aClipEquation.w < 0.0)
{
discard;
}
}
else if (aClipSpace == OccEquationCoords_View)
{
if (dot (aClipEquation.xyz, Position.xyz) + aClipEquation.w < 0.0)
{
discard;
}
discard;
}
}

View File

@@ -34,11 +34,9 @@ V3d_TypeOfShadingModel.hxx
V3d_TypeOfUpdate.hxx
V3d_TypeOfView.hxx
V3d_TypeOfVisualization.hxx
V3d_TypeOfZclipping.hxx
V3d_UnMapped.hxx
V3d_View.cxx
V3d_View.hxx
V3d_View_1.cxx
V3d_View_2.cxx
V3d_View_3.cxx
V3d_View_4.cxx

View File

@@ -1,34 +0,0 @@
// Created on: 1992-11-13
// Created by: GG
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _V3d_TypeOfZclipping_HeaderFile
#define _V3d_TypeOfZclipping_HeaderFile
//! The available options are
//! - V3d_OFF: Zclipping (clipping executed in the
//! depth of the view) is deactivated,
//! - V3d_BACK: back Zclipping is activated,
//! - V3d_FRONT: front Zclipping is activated,
//! - V3d_SLICE: both front and back Zclippings are activated.
enum V3d_TypeOfZclipping
{
V3d_OFF,
V3d_BACK,
V3d_FRONT,
V3d_SLICE
};
#endif // _V3d_TypeOfZclipping_HeaderFile

View File

@@ -165,12 +165,6 @@ V3d_View::V3d_View (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfView th
SetSize (theViewer->DefaultViewSize());
Standard_Real zsize = theViewer->DefaultViewSize();
SetZSize (2.*zsize);
SetZClippingType (V3d_OFF);
SetZClippingDepth (0.);
SetZClippingWidth (zsize);
SetZCueingOff();
SetZCueingDepth (0.);
SetZCueingWidth (zsize);
SetDepth (theViewer->DefaultViewSize() / 2.0);
SetViewMappingDefault();
SetViewOrientationDefault();

View File

@@ -77,7 +77,6 @@
#include <V3d_TypeOfShadingModel.hxx>
#include <V3d_TypeOfView.hxx>
#include <V3d_TypeOfVisualization.hxx>
#include <V3d_TypeOfZclipping.hxx>
#include <V3d_Viewer.hxx>
#include <V3d_ViewerPointer.hxx>
@@ -263,27 +262,6 @@ public:
//! Defines the visualization type in the view.
Standard_EXPORT void SetVisualization (const V3d_TypeOfVisualization theType);
//! Defines the depth of the medium clipping plane.
Standard_EXPORT void SetZClippingDepth (const Quantity_Length theDepth);
//! Defines the thickness around the medium clipping plane.
Standard_EXPORT void SetZClippingWidth (const Quantity_Length theWidth);
//! Defines the type of ZClipping.
Standard_EXPORT void SetZClippingType (const V3d_TypeOfZclipping theType);
//! Defines the depth of the medium plane.
Standard_EXPORT void SetZCueingDepth (const Quantity_Length theDepth);
//! Defines the thickness around the medium plane.
Standard_EXPORT void SetZCueingWidth (const Quantity_Length theWidth);
//! Activates ZCueing in the view.
Standard_EXPORT void SetZCueingOn();
//! Deactivates ZCueing in the view.
Standard_EXPORT void SetZCueingOff();
//! Activates theLight in the view.
Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& theLight);
@@ -714,20 +692,6 @@ public:
//! Returns the current visualisation mode.
Standard_EXPORT V3d_TypeOfVisualization Visualization() const;
//! Returns activity and information on the Zcueing.
//! <Depth> : Depth of plane.
//! <Width> : Thickness around the plane.
Standard_EXPORT Standard_Boolean ZCueing (Quantity_Length& theDepth, Quantity_Length& theWidth) const;
//! Returns current information on the ZClipping.
//! <Depth> : Depth of plane.
//! <Width> : Thickness around the plane.
//! <TypeOfZclipping> : "BACK"
//! "FRONT"
//! "SLICE"
//! "OFF"
Standard_EXPORT V3d_TypeOfZclipping ZClipping (Quantity_Length& theDepth, Quantity_Length& theWidth) const;
//! Returns True if One light more can be
//! activated in this View.
Standard_EXPORT Standard_Boolean IfMoreLights() const;

View File

@@ -1,205 +0,0 @@
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
/***********************************************************************/
/* FUNCTION :
----------
File V3d_View_1.cxx : */
/*----------------------------------------------------------------------*/
/*
* Includes
*/
#include <Aspect_GradientBackground.hxx>
#include <Aspect_Grid.hxx>
#include <Aspect_Window.hxx>
#include <Bnd_Box.hxx>
#include <gp_Ax3.hxx>
#include <gp_Dir.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_TextureEnv.hxx>
#include <Graphic3d_Vector.hxx>
#include <Quantity_Color.hxx>
#include <Standard_MultiplyDefined.hxx>
#include <Standard_TypeMismatch.hxx>
#include <V3d_BadValue.hxx>
#include <V3d_Light.hxx>
#include <V3d_UnMapped.hxx>
#include <V3d_View.hxx>
#include <V3d_Viewer.hxx>
//=============================================================================
//function : SetZClippingDepth
//purpose :
//=============================================================================
void V3d_View::SetZClippingDepth (const Standard_Real theDepth)
{
Standard_Real aFront = 0., aBack = 0., aWidth = 0.;
aFront = myView->ZClippingFrontPlane();
aBack = myView->ZClippingBackPlane();
aWidth = aFront - aBack;
aFront = theDepth + aWidth / 2.;
aBack = theDepth - aWidth / 2.;
myView->SetZClippingBackPlane (aBack);
myView->SetZClippingFrontPlane (aFront);
}
//=============================================================================
//function : SetZClippingWidth
//purpose :
//=============================================================================
void V3d_View::SetZClippingWidth (const Standard_Real theWidth)
{
Standard_Real aFront = 0., aBack = 0., aDepth = 0.;
V3d_BadValue_Raise_if (theWidth <= 0., "V3d_View::SetZClippingWidth, bad width");
aFront = myView->ZClippingFrontPlane();
aBack = myView->ZClippingBackPlane();
aDepth = (aFront + aBack) / 2.;
aFront = aDepth + theWidth / 2.;
aBack = aDepth - theWidth / 2.;
myView->SetZClippingBackPlane (aBack);
myView->SetZClippingFrontPlane (aFront);
}
//=============================================================================
//function : SetZClippingType
//purpose :
//=============================================================================
void V3d_View::SetZClippingType (const V3d_TypeOfZclipping theType)
{
switch (theType)
{
case V3d_OFF :
myView->SetFrontZClippingOn (Standard_False);
myView->SetBackZClippingOn (Standard_False);
break;
case V3d_BACK :
myView->SetBackZClippingOn (Standard_True);
myView->SetFrontZClippingOn (Standard_False);
break;
case V3d_FRONT :
myView->SetFrontZClippingOn (Standard_True);
myView->SetBackZClippingOn (Standard_False);
break;
case V3d_SLICE :
myView->SetFrontZClippingOn (Standard_False);
myView->SetBackZClippingOn (Standard_False);
break;
}
}
//=============================================================================
//function : ZClipping
//purpose :
//=============================================================================
V3d_TypeOfZclipping V3d_View::ZClipping (Standard_Real& theDepth, Standard_Real& theWidth) const
{
V3d_TypeOfZclipping aType = V3d_OFF;
Standard_Real aBack = myView->ZClippingBackPlane();
Standard_Real aFront = myView->ZClippingFrontPlane();
Standard_Boolean isBackOn = myView->BackZClippingIsOn();
Standard_Boolean isFrontOn = myView->FrontZClippingIsOn();
theWidth = aFront - aBack ;
theDepth = (aFront + aBack) / 2.0;
if (isBackOn)
{
if (isFrontOn)
{
aType = V3d_SLICE;
}
else
{
aType = V3d_BACK;
}
}
else if (isFrontOn)
{
aType = V3d_FRONT;
}
return aType;
}
//=============================================================================
//function : SetZCueingDepth
//purpose :
//=============================================================================
void V3d_View::SetZCueingDepth (const Standard_Real theDepth)
{
Standard_Real aFront = myView->DepthCueingFrontPlane();
Standard_Real aBack = myView->DepthCueingBackPlane();
Standard_Real aWidth = aFront - aBack;
aFront = theDepth + aWidth / 2.;
aBack = theDepth - aWidth / 2.;
myView->SetDepthCueingBackPlane (aBack);
myView->SetDepthCueingFrontPlane (aFront);
}
//=============================================================================
//function : SetZCueingWidth
//purpose :
//=============================================================================
void V3d_View::SetZCueingWidth (const Standard_Real theWidth)
{
V3d_BadValue_Raise_if (theWidth <= 0., "V3d_View::SetZCueingWidth, bad width");
Standard_Real aFront = myView->DepthCueingFrontPlane();
Standard_Real aBack = myView->DepthCueingBackPlane();
Standard_Real aDepth = (aFront + aBack) / 2.0;
aFront = aDepth + theWidth / 2.0;
aBack = aDepth - theWidth / 2.0;
myView->SetDepthCueingBackPlane (aBack);
myView->SetDepthCueingFrontPlane (aFront);
}
//=============================================================================
//function : SetZCueingOn
//purpose :
//=============================================================================
void V3d_View::SetZCueingOn()
{
myView->SetDepthCueingOn (Standard_True);
}
//=============================================================================
//function : SetZCueingOff
//purpose :
//=============================================================================
void V3d_View::SetZCueingOff()
{
myView->SetDepthCueingOn (Standard_False);
}
//=============================================================================
//function : ZCueing
//purpose :
//=============================================================================
Standard_Boolean V3d_View::ZCueing (Standard_Real& theDepth, Standard_Real& theWidth) const
{
Standard_Boolean isOn = myView->DepthCueingIsOn();
Standard_Real aFront = myView->DepthCueingFrontPlane();
Standard_Real aBack = myView->DepthCueingBackPlane();
theWidth = aFront - aBack ;
theDepth = (aFront + aBack) / 2.;
return isOn;
}

View File

@@ -172,8 +172,6 @@ static NCollection_DoubleMap <TCollection_AsciiString, Handle(AIS_InteractiveCon
static NCollection_DoubleMap <TCollection_AsciiString, Handle(Graphic3d_GraphicDriver)> ViewerTest_myDrivers;
static OpenGl_Caps ViewerTest_myDefaultCaps;
#define ZCLIPWIDTH 1.
static void OSWindowSetup();
static struct
@@ -189,7 +187,6 @@ static struct
//==============================================================================
static int Start_Rot = 0;
static int ZClipIsOn = 0;
int X_Motion = 0; // Current cursor position
int Y_Motion = 0;
int X_ButtonPress = 0; // Last ButtonPress position
@@ -713,8 +710,6 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft
const Handle (V3d_View) aV3dView = ViewerTest::CurrentView();
aV3dView->SetComputedMode(Standard_False);
MyHLRIsOn = aV3dView->ComputedMode();
aV3dView->SetZClippingDepth(0.5);
aV3dView->SetZClippingWidth(ZCLIPWIDTH/2.);
a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
if (toCreateViewer)
@@ -1487,24 +1482,6 @@ void VT_ProcessKeyPress (const char* buf_ret)
Ctx->UpdateCurrentViewer();
}
}
else if (!strcasecmp (buf_ret, "Z"))
{
// ZCLIP
if ( ZClipIsOn ) {
cout << "ZClipping OFF" << endl;
ZClipIsOn = 0;
aView->SetZClippingType(V3d_OFF);
aView->Redraw();
}
else {
cout << "ZClipping ON" << endl;
ZClipIsOn = 1;
aView->SetZClippingType(V3d_FRONT);
aView->Redraw();
}
}
else if (!strcasecmp (buf_ret, ","))
{
ViewerTest::GetAISContext()->HilightNextDetected(ViewerTest::CurrentView());
@@ -1663,41 +1640,6 @@ void VT_ProcessButton3Release()
}
}
//==============================================================================
//function : ProcessZClipMotion
//purpose : Zoom
//==============================================================================
void ProcessZClipMotion()
{
Handle(V3d_View) a3DView = ViewerTest::CurrentView();
if ( Abs(X_Motion - X_ButtonPress) > 2 ) {
//Quantity_Length VDX, VDY;
//a3DView->Size(VDX,VDY);
//Standard_Real VDZ = a3DView->ZSize();
//printf("View size (%lf,%lf,%lf)\n", VDX, VDY, VDZ);
Quantity_Length aDx = a3DView->Convert(X_Motion - X_ButtonPress);
// Front = Depth + width/2.
Standard_Real aDepth = 0.5;
Standard_Real aWidth = 0.1;
a3DView->ZClipping(aDepth,aWidth);
aDepth += aDx;
//printf("dx %lf Depth %lf Width %lf\n", dx, D, W);
a3DView->SetZClippingDepth(aDepth);
a3DView->Redraw();
X_ButtonPress = X_Motion;
Y_ButtonPress = Y_Motion;
}
}
//==============================================================================
//function : ProcessControlButton1Motion
//purpose : Zoom
@@ -2205,27 +2147,9 @@ static LRESULT WINAPI ViewerWindowProc( HWND hwnd,
VT_ProcessControlButton3Motion();
}
}
#ifdef BUG
else if ( fwKeys & MK_SHIFT ) {
if ( fwKeys & MK_MBUTTON ||
((fwKeys&MK_LBUTTON) &&
(fwKeys&MK_RBUTTON) ) ) {
cout << "ProcessZClipMotion()" << endl;
ProcessZClipMotion();
}
}
#endif
else if (GetWindowHandle (VT_GetWindow()) == hwnd)
{
if ((fwKeys & MK_MBUTTON
|| ((fwKeys & MK_LBUTTON) && (fwKeys & MK_RBUTTON))))
{
ProcessZClipMotion();
}
else
{
VT_ProcessMotion();
}
VT_ProcessMotion();
}
}
break;
@@ -2463,30 +2387,6 @@ int ViewerMainLoop(Standard_Integer argc, const char** argv)
// remove all the ButtonMotionMaskr
while( XCheckMaskEvent( aDisplay, ButtonMotionMask, &aReport) ) ;
if ( ZClipIsOn && aReport.xmotion.state & ShiftMask ) {
if ( Abs(X_Motion - X_ButtonPress) > 2 ) {
Quantity_Length VDX, VDY;
ViewerTest::CurrentView()->Size(VDX,VDY);
Standard_Real VDZ =0 ;
VDZ = ViewerTest::CurrentView()->ZSize();
printf("%f,%f,%f\n", VDX, VDY, VDZ);
Quantity_Length dx = 0 ;
dx = ViewerTest::CurrentView()->Convert(X_Motion - X_ButtonPress);
cout << dx << endl;
dx = dx / VDX * VDZ;
cout << dx << endl;
ViewerTest::CurrentView()->Redraw();
}
}
if ( aReport.xmotion.state & ControlMask ) {
if ( aReport.xmotion.state & Button1Mask ) {
ProcessControlButton1Motion();
@@ -6203,119 +6103,6 @@ static Standard_Integer VChangeSelected (Draw_Interpretor& di,
return 0;
}
//=======================================================================
//function : VZClipping
//purpose : Gets or sets ZClipping mode, width and depth
//=======================================================================
static Standard_Integer VZClipping (Draw_Interpretor& di,
Standard_Integer argc,
const char ** argv)
{
if(argc>4)
{
di << "Usage : " << argv[0] << " [mode] [depth width]\n"
<<"mode = OFF|BACK|FRONT|SLICE depth = [0..1] width = [0..1]\n";
return -1;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if(aContext.IsNull())
{
di << "use 'vinit' command before " << argv[0] << "\n";
return 1;
}
Handle(V3d_View) aView = ViewerTest::CurrentView();
V3d_TypeOfZclipping aZClippingMode = V3d_OFF;
if(argc==1)
{
TCollection_AsciiString aZClippingModeString;
Quantity_Length aDepth, aWidth;
aZClippingMode = aView->ZClipping(aDepth, aWidth);
switch (aZClippingMode)
{
case V3d_OFF:
aZClippingModeString.Copy("OFF");
break;
case V3d_BACK:
aZClippingModeString.Copy("BACK");
break;
case V3d_FRONT:
aZClippingModeString.Copy("FRONT");
break;
case V3d_SLICE:
aZClippingModeString.Copy("SLICE");
break;
default:
aZClippingModeString.Copy(TCollection_AsciiString(aZClippingMode));
break;
}
di << "ZClippingMode = " << aZClippingModeString.ToCString() << "\n"
<< "ZClipping depth = " << aDepth << "\n"
<< "ZClipping width = " << aWidth << "\n";
}
else
{
if(argc !=3)
{
Standard_Integer aStatus = 0;
if ( strcmp (argv [1], "OFF") == 0 ) {
aStatus = 1;
aZClippingMode = V3d_OFF;
}
if ( strcmp (argv [1], "BACK") == 0 ) {
aStatus = 1;
aZClippingMode = V3d_BACK;
}
if ( strcmp (argv [1], "FRONT") == 0 ) {
aStatus = 1;
aZClippingMode = V3d_FRONT;
}
if ( strcmp (argv [1], "SLICE") == 0 ) {
aStatus = 1;
aZClippingMode = V3d_SLICE;
}
if (aStatus != 1)
{
di << "Bad mode; Usage : " << argv[0] << " [mode] [depth width]\n"
<< "mode = OFF|BACK|FRONT|SLICE depth = [0..1] width = [0..1]\n";
return 1;
}
aView->SetZClippingType(aZClippingMode);
}
if(argc >2)
{
Quantity_Length aDepth = 0., aWidth = 1.;
if(argc == 3)
{
aDepth = Draw::Atof (argv[1]);
aWidth = Draw::Atof (argv[2]);
}
else if(argc == 4)
{
aDepth = Draw::Atof (argv[2]);
aWidth = Draw::Atof (argv[3]);
}
if(aDepth<0. || aDepth>1.)
{
di << "Bad depth; Usage : " << argv[0] << " [mode] [depth width]\n"
<< "mode = OFF|BACK|FRONT|SLICE depth = [0..1] width = [0..1]\n";
return 1;
}
if(aWidth<0. || aWidth>1.)
{
di << "Bad width; Usage : " << argv[0] << " [mode] [depth width]\n"
<< "mode = OFF|BACK|FRONT|SLICE depth = [0..1] width = [0..1]\n";
return 1;
}
aView->SetZClippingDepth(aDepth);
aView->SetZClippingWidth(aWidth);
}
aView->Redraw();
}
return 0;
}
//=======================================================================
//function : VNbSelected
//purpose : Returns number of selected objects
@@ -9472,11 +9259,6 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"vchangeselected shape"
"- adds to shape to selection or remove one from it",
__FILE__, VChangeSelected, group);
theCommands.Add("vzclipping",
"vzclipping [mode] [depth width]\n"
"- mode = OFF|BACK|FRONT|SLICE depth = [0..1] width = [0..1]\n"
"- gets or sets ZClipping mode, width and depth",
__FILE__,VZClipping,group);
theCommands.Add ("vnbselected",
"vnbselected"
"\n\t\t: Returns number of selected objects", __FILE__, VNbSelected, group);