mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024070: OpenGL capped object-level clipping planes
Graphical clipping: - Use "Graphic3d_ClipPlane" to defined clipping for PrsMgr_PresentableObject (local clipping), for V3d_View (global clipping). Get rid of old implementations: - Remove Visual3d_ClipPlane. - Port V3d_Plane to Graphic3d_ClipPlane core. Selection Sensitives: - Port "Matches" method to add full set of arguments (SelectBasics_PickArgs), including min-max depth coming from selector. - Get rid of transient data for pair Matches -> ComputeDepth. - Extend SelectMgr_ViewerSelector::LoadResult to work with local clipping, add virtual callbacks to compute globa/local depth clipping for picking. Capping rendering algorithm: - Recursive rendering algorithm for OpenGl_Groups. - Introduced Rendering filter for groups. Clipping plane management in TKOpenGl: - Added OpenGl_ClippingState to OpenGl_Context. DRAWEXE commands: - Ported "vclipplane" command for new approach. - Added "vsettexturemode" command for changing texture details in views (enable / disable textures). Correct DownCast syntax (compilation error) Fix new compiler warnings tests/bugs/vis/bug22906 migrated to the new vclipplane syntax
This commit is contained in:
@@ -16,8 +16,6 @@ Graphic3d_CLight.cxx
|
||||
Graphic3d_CLight.hxx
|
||||
Graphic3d_CPick.cxx
|
||||
Graphic3d_CPick.hxx
|
||||
Graphic3d_CPlane.cxx
|
||||
Graphic3d_CPlane.hxx
|
||||
Graphic3d_CBounds.cxx
|
||||
Graphic3d_CBounds.hxx
|
||||
Graphic3d_CUserDraw.cxx
|
||||
@@ -54,4 +52,8 @@ Graphic3d_Vertex.hxx
|
||||
Graphic3d_Vertex.cxx
|
||||
Graphic3d_MarkerImage.hxx
|
||||
Graphic3d_MarkerImage.cxx
|
||||
Graphic3d_MarkerImage_Handle.hxx
|
||||
Graphic3d_MarkerImage_Handle.hxx
|
||||
Graphic3d_ClipPlane.hxx
|
||||
Graphic3d_ClipPlane.cxx
|
||||
Graphic3d_ClipPlane_Handle.hxx
|
||||
Graphic3d_SetOfHClipPlane.hxx
|
||||
|
@@ -399,6 +399,15 @@ is
|
||||
---Purpose: Defines the C structure of a graduated trihedron.
|
||||
---Category: Imported types
|
||||
|
||||
imported ClipPlane;
|
||||
---Purpose: Describes geometrical and auxiliary properties of clipping
|
||||
-- planes applied on rendering by graphical driver.
|
||||
---Category: Imported types
|
||||
|
||||
imported ClipPlane_Handle;
|
||||
---Purpose: CDL-compatibility handle type definition for
|
||||
-- clip plane objects.
|
||||
|
||||
imported CTexture;
|
||||
|
||||
imported CTransPersStruct;
|
||||
@@ -575,6 +584,10 @@ is
|
||||
imported NListOfHAsciiString;
|
||||
---Category: Instantiated classes
|
||||
|
||||
imported SetOfHClipPlane;
|
||||
---Category: Instantiated classes
|
||||
-- Set of handles on clip planes
|
||||
|
||||
deferred class TextureRoot from Graphic3d;
|
||||
deferred class TextureMap from Graphic3d;
|
||||
deferred class Texture1D from Graphic3d;
|
||||
|
@@ -1,26 +0,0 @@
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#include <Graphic3d_CPlane.hxx>
|
||||
|
||||
const Handle(Standard_Type)& TYPE(Graphic3d_CPlane)
|
||||
{
|
||||
static Handle(Standard_Type) _atype =
|
||||
new Standard_Type ("Graphic3d_CPlane", sizeof (Graphic3d_CPlane));
|
||||
return _atype;
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Graphic3d_CPlane.hxx */
|
||||
/*==== Role : The header file of primitive type "CPlane" from Graphic3d */
|
||||
/*==== */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
/*============================================================================*/
|
||||
|
||||
#ifndef _Graphic3d_CPlane_HeaderFile
|
||||
#define _Graphic3d_CPlane_HeaderFile
|
||||
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
typedef CALL_DEF_PLANE Graphic3d_CPlane;
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
/*==== Definition de Type ====================================================*/
|
||||
#include <Standard_Type.hxx>
|
||||
const Handle(Standard_Type)& TYPE(Graphic3d_CPlane) ;
|
||||
/*============================================================================*/
|
||||
|
||||
#endif
|
||||
#endif /*Graphic3d_CPlane_HeaderFile*/
|
@@ -20,6 +20,7 @@
|
||||
#define _Graphic3d_CStructure_HeaderFile
|
||||
|
||||
#include <Graphic3d_CGroup.hxx>
|
||||
#include <Graphic3d_SetOfHClipPlane.hxx>
|
||||
|
||||
class Graphic3d_CStructure
|
||||
{
|
||||
@@ -55,6 +56,7 @@ public:
|
||||
|
||||
CALL_DEF_TRANSFORM_PERSISTENCE TransformPersistence;
|
||||
|
||||
Graphic3d_SetOfHClipPlane ClipPlanes;
|
||||
};
|
||||
|
||||
///typedef Graphic3d_CStructure CALL_DEF_STRUCTURE;
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
#include <Handle_Graphic3d_TextureEnv.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Graphic3d_SetOfHClipPlane.hxx>
|
||||
|
||||
class CALL_DEF_VIEWCONTEXT
|
||||
{
|
||||
@@ -42,9 +43,8 @@ public:
|
||||
Visualization (0),
|
||||
NbActiveLight (0),
|
||||
ActiveLight (NULL),
|
||||
NbActivePlane (0),
|
||||
ActivePlane (NULL),
|
||||
SurfaceDetail (0)
|
||||
SurfaceDetail (0),
|
||||
ClipPlanes()
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -71,12 +71,10 @@ public:
|
||||
int NbActiveLight;
|
||||
CALL_DEF_LIGHT* ActiveLight;
|
||||
|
||||
int NbActivePlane;
|
||||
CALL_DEF_PLANE* ActivePlane;
|
||||
|
||||
Handle(Graphic3d_TextureEnv) TextureEnv;
|
||||
int SurfaceDetail;
|
||||
|
||||
Graphic3d_SetOfHClipPlane ClipPlanes;
|
||||
};
|
||||
|
||||
class Graphic3d_CView
|
||||
|
251
src/Graphic3d/Graphic3d_ClipPlane.cxx
Normal file
251
src/Graphic3d/Graphic3d_ClipPlane.cxx
Normal file
@@ -0,0 +1,251 @@
|
||||
// Created on: 2013-07-12
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 65 (the "License") You may not use the content of this file
|
||||
// except in compliance with the License Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE SAS, having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License
|
||||
|
||||
#include <Graphic3d_ClipPlane.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <Standard_Atomic.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(Graphic3d_ClipPlane, Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ClipPlane, Standard_Transient)
|
||||
|
||||
namespace
|
||||
{
|
||||
static volatile Standard_Integer THE_CLIP_PLANE_COUNTER = 0;
|
||||
};
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane()
|
||||
: myEquation (0.0, 0.0, 1.0, 0.0),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False),
|
||||
myMaterial (Graphic3d_NOM_DEFAULT),
|
||||
myTexture (NULL),
|
||||
myHatch (Aspect_HS_HORIZONTAL),
|
||||
myHatchOn (Standard_False),
|
||||
myId(),
|
||||
myEquationMod(0),
|
||||
myAspectMod(0)
|
||||
{
|
||||
MakeId();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const Equation& theEquation)
|
||||
: myEquation (theEquation),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False),
|
||||
myMaterial (Graphic3d_NOM_DEFAULT),
|
||||
myTexture (NULL),
|
||||
myHatch (Aspect_HS_HORIZONTAL),
|
||||
myHatchOn (Standard_False),
|
||||
myId(),
|
||||
myEquationMod(0),
|
||||
myAspectMod(0)
|
||||
{
|
||||
MakeId();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const Graphic3d_ClipPlane& theOther)
|
||||
: myEquation (theOther.myEquation),
|
||||
myIsOn (theOther.myIsOn),
|
||||
myIsCapping (theOther.myIsCapping),
|
||||
myMaterial (theOther.myMaterial),
|
||||
myTexture (theOther.myTexture),
|
||||
myHatch (theOther.myHatch),
|
||||
myHatchOn (theOther.myHatchOn),
|
||||
myId(),
|
||||
myEquationMod (0),
|
||||
myAspectMod (0)
|
||||
{
|
||||
MakeId();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const gp_Pln& thePlane)
|
||||
: myEquation (),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False),
|
||||
myMaterial (Graphic3d_NOM_DEFAULT),
|
||||
myTexture (NULL),
|
||||
myHatch (Aspect_HS_HORIZONTAL),
|
||||
myHatchOn (Standard_False),
|
||||
myId(),
|
||||
myEquationMod(0),
|
||||
myAspectMod(0)
|
||||
{
|
||||
MakeId();
|
||||
SetEquation (thePlane);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetEquation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetEquation (const Equation& theEquation)
|
||||
{
|
||||
myEquation = theEquation;
|
||||
myEquationMod++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetEquation (const gp_Pln& thePlane)
|
||||
{
|
||||
thePlane.Coefficients (myEquation[0],
|
||||
myEquation[1],
|
||||
myEquation[2],
|
||||
myEquation[3]);
|
||||
myEquationMod++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetOn
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetOn (const Standard_Boolean theIsOn)
|
||||
{
|
||||
myIsOn = theIsOn;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCapping
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCapping (const Standard_Boolean theIsOn)
|
||||
{
|
||||
myIsCapping = theIsOn;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ToPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
gp_Pln Graphic3d_ClipPlane::ToPlane() const
|
||||
{
|
||||
return gp_Pln (myEquation[0],
|
||||
myEquation[1],
|
||||
myEquation[2],
|
||||
myEquation[3]);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Clone
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Graphic3d_ClipPlane) Graphic3d_ClipPlane::Clone() const
|
||||
{
|
||||
return new Graphic3d_ClipPlane(*this);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingMaterial
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
{
|
||||
myMaterial = theMat;
|
||||
myAspectMod++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingTexture
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingTexture (const Handle(Graphic3d_TextureMap)& theTexture)
|
||||
{
|
||||
myTexture = theTexture;
|
||||
myAspectMod++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingHatch
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingHatch (const Aspect_HatchStyle theStyle)
|
||||
{
|
||||
myHatch = theStyle;
|
||||
myAspectMod++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingHatchOn
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingHatchOn()
|
||||
{
|
||||
myHatchOn = Standard_True;
|
||||
myAspectMod++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingHatchOff
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingHatchOff()
|
||||
{
|
||||
myHatchOn = Standard_False;
|
||||
myAspectMod++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : MakeId
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::MakeId()
|
||||
{
|
||||
myId = TCollection_AsciiString ("Graphic3d_ClipPlane_") //DynamicType()->Name()
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_CLIP_PLANE_COUNTER));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CappingAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Graphic3d_AspectFillArea3d) Graphic3d_ClipPlane::CappingAspect() const
|
||||
{
|
||||
Handle(Graphic3d_AspectFillArea3d) anAspect = new Graphic3d_AspectFillArea3d();
|
||||
anAspect->SetDistinguishOff();
|
||||
anAspect->SetFrontMaterial (myMaterial);
|
||||
anAspect->SetTextureMap (myTexture);
|
||||
anAspect->SetHatchStyle (myHatch);
|
||||
anAspect->SetInteriorStyle (myHatchOn ? Aspect_IS_HATCH : Aspect_IS_SOLID);
|
||||
anAspect->SetInteriorColor (myMaterial.Color());
|
||||
if (!myTexture.IsNull())
|
||||
anAspect->SetTextureMapOn();
|
||||
else
|
||||
anAspect->SetTextureMapOff();
|
||||
|
||||
return anAspect;
|
||||
}
|
228
src/Graphic3d/Graphic3d_ClipPlane.hxx
Normal file
228
src/Graphic3d/Graphic3d_ClipPlane.hxx
Normal file
@@ -0,0 +1,228 @@
|
||||
// Created on: 2013-07-12
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 65 (the "License") You may not use the content of this file
|
||||
// except in compliance with the License Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE SAS, having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License
|
||||
|
||||
#ifndef _Graphic3d_ClipPlane_HeaderFile
|
||||
#define _Graphic3d_ClipPlane_HeaderFile
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_TypeDef.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <NCollection_Vec4.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Graphic3d_TextureMap.hxx>
|
||||
#include <Aspect_HatchStyle.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE (Graphic3d_ClipPlane, Standard_Transient)
|
||||
|
||||
class gp_Pln;
|
||||
class Graphic3d_AspectFillArea3d;
|
||||
class Handle(Graphic3d_AspectFillArea3d);
|
||||
|
||||
//! Container for properties describing graphic driver clipping planes.
|
||||
//! It is up to application to create instances of this class and specify its
|
||||
//! properties. The instances are passed into graphic driver or other facilities
|
||||
//! that implement clipping features (e.g. selection).
|
||||
//! Depending on usage context the class can be used to specify:
|
||||
//! - Global clipping applied over the whole scene.
|
||||
//! - Object-level clipping applied for each particular object.
|
||||
//! Please note that the set of planes can define convex clipping volume.
|
||||
//! Be aware that number of clip planes supported by OpenGl is implementation
|
||||
//! dependant: at least 6 planes are available. Thus, take into account
|
||||
//! number of clipping planes passed for rendering: the object planes plus
|
||||
//! the view defined ones.
|
||||
class Graphic3d_ClipPlane : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
typedef NCollection_Vec4<Standard_Real> Equation;
|
||||
|
||||
//! Default constructor.
|
||||
//! Initializes clip plane container with the following properties:
|
||||
//! - Equation (0.0, 0.0, 1.0, 0)
|
||||
//! - IsOn (True),
|
||||
//! - IsCapping (False),
|
||||
//! - Material (Graphic3d_NOM_DEFAULT),
|
||||
//! - Texture (NULL),
|
||||
//! - HatchStyle (Aspect_HS_HORIZONTAL),
|
||||
//! - IsHatchOn (False)
|
||||
Standard_EXPORT Graphic3d_ClipPlane();
|
||||
|
||||
//! Copy constructor.
|
||||
//! @param theOther [in] the copied plane.
|
||||
Standard_EXPORT Graphic3d_ClipPlane(const Graphic3d_ClipPlane& theOther);
|
||||
|
||||
//! Construct clip plane for the passed equation.
|
||||
//! By default the plane is on, capping is turned off.
|
||||
//! @param theEquation [in] the plane equation.
|
||||
Standard_EXPORT Graphic3d_ClipPlane (const Equation& theEquation);
|
||||
|
||||
//! Construct clip plane from the passed geomertical definition.
|
||||
//! By default the plane is on, capping is turned off.
|
||||
//! @param thePlane [in] the plane.
|
||||
Standard_EXPORT Graphic3d_ClipPlane (const gp_Pln& thePlane);
|
||||
|
||||
//! Set plane equation by its geometrical definition.
|
||||
//! @param thePlane [in] the plane.
|
||||
Standard_EXPORT void SetEquation (const gp_Pln& thePlane);
|
||||
|
||||
//! Set 4-component equation vector for clipping plane.
|
||||
//! @param theEquation [in] the XYZW (or "ABCD") equation vector.
|
||||
Standard_EXPORT void SetEquation (const Equation& theEquation);
|
||||
|
||||
//! Get 4-component equation vector for clipping plane.
|
||||
//! @return clipping plane equation vector.
|
||||
const Equation& GetEquation() const
|
||||
{
|
||||
return myEquation;
|
||||
}
|
||||
|
||||
//! Check that the clipping plane is turned on.
|
||||
//! @return boolean flag indicating whether the plane is in on or off state.
|
||||
Standard_Boolean IsOn() const
|
||||
{
|
||||
return myIsOn;
|
||||
}
|
||||
|
||||
//! Change state of the clipping plane.
|
||||
//! @param theIsOn [in] the flag specifying whether the graphic driver
|
||||
//! clipping by this plane should be turned on or off.
|
||||
Standard_EXPORT void SetOn(const Standard_Boolean theIsOn);
|
||||
|
||||
//! Change state of capping surface rendering.
|
||||
//! @param theIsOn [in] the flag specifying whether the graphic driver should
|
||||
//! perform rendering of capping surface produced by this plane. The graphic
|
||||
//! driver produces this surface for convex graphics by means of stencil-test
|
||||
//! and multipass rendering.
|
||||
Standard_EXPORT void SetCapping(const Standard_Boolean theIsOn);
|
||||
|
||||
//! Check state of capping surface rendering.
|
||||
//! @return true (turned on) or false depending on the state.
|
||||
Standard_Boolean IsCapping() const
|
||||
{
|
||||
return myIsCapping;
|
||||
}
|
||||
|
||||
//! Get geomertical definition. The plane is built up
|
||||
//! from the equation clipping plane equation vector.
|
||||
//! @return geometrical definition of clipping plane.
|
||||
Standard_EXPORT gp_Pln ToPlane() const;
|
||||
|
||||
//! Clone plane. Virtual method to simplify copying procedure if plane
|
||||
//! class is redefined at application level to add specific fields to it
|
||||
//! e.g. id, name, etc.
|
||||
//! @return new instance of clipping plane with same properties and attributes.
|
||||
Standard_EXPORT virtual Handle(Graphic3d_ClipPlane) Clone() const;
|
||||
|
||||
public: // @name user-defined graphical attributes
|
||||
|
||||
//! Set material for rendering capping surface.
|
||||
//! @param theMat [in] the material.
|
||||
Standard_EXPORT void SetCappingMaterial (const Graphic3d_MaterialAspect& theMat);
|
||||
|
||||
//! @return capping material.
|
||||
const Graphic3d_MaterialAspect& CappingMaterial() const
|
||||
{
|
||||
return myMaterial;
|
||||
}
|
||||
|
||||
//! Set texture to be applied on capping surface.
|
||||
//! @param theTexture [in] the texture.
|
||||
Standard_EXPORT void SetCappingTexture (const Handle(Graphic3d_TextureMap)& theTexture);
|
||||
|
||||
//! @return capping texture map.
|
||||
const Handle(Graphic3d_TextureMap)& CappingTexture() const
|
||||
{
|
||||
return myTexture;
|
||||
}
|
||||
|
||||
//! Set hatch style (stipple) and turn hatching on.
|
||||
//! @param theStyle [in] the hatch style.
|
||||
Standard_EXPORT void SetCappingHatch (const Aspect_HatchStyle theStyle);
|
||||
|
||||
//! @return hatching style.
|
||||
Aspect_HatchStyle CappingHatch() const
|
||||
{
|
||||
return myHatch;
|
||||
}
|
||||
|
||||
//! Turn on hatching.
|
||||
Standard_EXPORT void SetCappingHatchOn();
|
||||
|
||||
//! Turn off hatching.
|
||||
Standard_EXPORT void SetCappingHatchOff();
|
||||
|
||||
//! @return True if hatching mask is turned on.
|
||||
Standard_Boolean IsHatchOn() const
|
||||
{
|
||||
return myHatchOn;
|
||||
}
|
||||
|
||||
//! This ID is used for managing associated resources in graphical driver.
|
||||
//! The clip plane can be assigned within a range of IO which can be
|
||||
//! displayed in separate OpenGl contexts. For each of the context an associated
|
||||
//! OpenGl resource for graphical aspects should be created and kept.
|
||||
//! The resources are stored in graphical driver for each of individual groups
|
||||
//! of shared context under the clip plane identifier.
|
||||
//! @return clip plane resource identifier string.
|
||||
const TCollection_AsciiString& GetId() const
|
||||
{
|
||||
return myId;
|
||||
}
|
||||
|
||||
//! Compute and return capping apsect from the graphical attributes.
|
||||
//! @return capping surface rendering aspect.
|
||||
Standard_EXPORT Handle(Graphic3d_AspectFillArea3d) CappingAspect() const;
|
||||
|
||||
public: // @name modificaton counters
|
||||
|
||||
//! @return modification counter for equation.
|
||||
unsigned int MCountEquation() const
|
||||
{
|
||||
return myEquationMod;
|
||||
}
|
||||
|
||||
//! @return modification counter for aspect.
|
||||
unsigned int MCountAspect() const
|
||||
{
|
||||
return myAspectMod;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void MakeId();
|
||||
|
||||
private:
|
||||
|
||||
Equation myEquation; //!< Plane equation vector.
|
||||
Standard_Boolean myIsOn; //!< State of the clipping plane.
|
||||
Standard_Boolean myIsCapping; //!< State of graphic driver capping.
|
||||
Graphic3d_MaterialAspect myMaterial; //!< Capping surface material.
|
||||
Handle(Graphic3d_TextureMap) myTexture; //!< Capping surface texture.
|
||||
Aspect_HatchStyle myHatch; //!< Capping surface hatch mask.
|
||||
Standard_Boolean myHatchOn; //!< Capping surface hatching flag.
|
||||
TCollection_AsciiString myId; //!< Resource id.
|
||||
unsigned int myEquationMod; //!< Modification counter for equation.
|
||||
unsigned int myAspectMod; //!< Modification counter of aspect.
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(Graphic3d_ClipPlane);
|
||||
};
|
||||
|
||||
#endif
|
26
src/Graphic3d/Graphic3d_ClipPlane_Handle.hxx
Normal file
26
src/Graphic3d/Graphic3d_ClipPlane_Handle.hxx
Normal file
@@ -0,0 +1,26 @@
|
||||
// Created on: 2013-07-12
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 65 (the "License") You may not use the content of this file
|
||||
// except in compliance with the License Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE SAS, having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License
|
||||
|
||||
#ifndef _Graphic3d_ClipPlane_Handle_HeaderFile
|
||||
#define _Graphic3d_ClipPlane_Handle_HeaderFile
|
||||
|
||||
#include <Graphic3d_ClipPlane.hxx>
|
||||
typedef Handle(Graphic3d_ClipPlane) Graphic3d_ClipPlane_Handle;
|
||||
|
||||
#endif
|
@@ -90,7 +90,8 @@ uses
|
||||
CUserDraw from Graphic3d,
|
||||
NListOfHAsciiString from Graphic3d,
|
||||
FontAspect from Font,
|
||||
CGraduatedTrihedron from Graphic3d
|
||||
CGraduatedTrihedron from Graphic3d,
|
||||
ClipPlane from Graphic3d
|
||||
|
||||
raises
|
||||
|
||||
@@ -407,10 +408,11 @@ is
|
||||
is deferred;
|
||||
---Purpose: call_togl_setlight
|
||||
|
||||
SetPlane ( me : mutable;
|
||||
ACView : CView from Graphic3d )
|
||||
is deferred;
|
||||
---Purpose: call_togl_setplane
|
||||
SetClipPlanes (me : mutable; theCView : CView from Graphic3d) is deferred;
|
||||
---Purpose: Pass clip planes to the associated graphic driver view.
|
||||
|
||||
SetClipPlanes (me : mutable; theCStructure : CStructure from Graphic3d) is deferred;
|
||||
---Purpose: Pass clip planes to the associated graphic driver structure.
|
||||
|
||||
SetVisualisation ( me : mutable;
|
||||
ACView : CView from Graphic3d )
|
||||
@@ -952,12 +954,6 @@ is
|
||||
returns Integer from Standard;
|
||||
---Purpose: call_togl_light
|
||||
|
||||
Plane ( myclass;
|
||||
ACPlane : CPlane from Graphic3d;
|
||||
Update : Boolean from Standard )
|
||||
returns Integer from Standard;
|
||||
---Purpose: call_togl_plane
|
||||
|
||||
-----------------------------
|
||||
-- Category: Internal methods
|
||||
-----------------------------
|
||||
@@ -978,10 +974,6 @@ is
|
||||
ACPick : CPick from Graphic3d;
|
||||
AField : Integer from Standard );
|
||||
|
||||
PrintCPlane ( me;
|
||||
ACPlane : CPlane from Graphic3d;
|
||||
AField : Integer from Standard );
|
||||
|
||||
PrintCStructure ( me;
|
||||
ACStructure : CStructure from Graphic3d;
|
||||
AField : Integer from Standard );
|
||||
|
@@ -66,16 +66,6 @@ Standard_Integer Graphic3d_GraphicDriver::Light (const Graphic3d_CLight& ACLight
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Graphic3d_GraphicDriver::Plane (const Graphic3d_CPlane& ACPlane, const Standard_Boolean Update) {
|
||||
|
||||
static Standard_Integer NbPlanes = 1;
|
||||
Standard_Boolean Result;
|
||||
|
||||
Result = Update ? ACPlane.PlaneId : NbPlanes++;
|
||||
return Result;
|
||||
|
||||
}
|
||||
|
||||
//-Internal methods, in order
|
||||
|
||||
void Graphic3d_GraphicDriver::PrintBoolean (const Standard_CString AComment, const Standard_Boolean AValue) const {
|
||||
@@ -135,16 +125,6 @@ void Graphic3d_GraphicDriver::PrintCPick (const Graphic3d_CPick& ACPick, const S
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_GraphicDriver::PrintCPlane (const Graphic3d_CPlane& ACPlane, const Standard_Integer AField) const {
|
||||
|
||||
if (AField) {
|
||||
cout << "\tws id " << ACPlane.WsId << ", "
|
||||
<< "view id " << ACPlane.ViewId << "\n";
|
||||
cout << flush;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_GraphicDriver::PrintCStructure (const Graphic3d_CStructure& ACStructure, const Standard_Integer AField) const {
|
||||
|
||||
if (AField) {
|
||||
|
@@ -186,7 +186,7 @@ const Handle(Image_PixMap)& Graphic3d_MarkerImage::GetImageAlpha()
|
||||
Standard_Byte* anImageRow = myImageAlpha->ChangeRow (aRowIter);
|
||||
for (Standard_Size aColumnIter = 0; aColumnIter < myImage->Width(); aColumnIter++)
|
||||
{
|
||||
myImage->PixelColor (aColumnIter, aRowIter, anAlpha);
|
||||
myImage->PixelColor ((Standard_Integer )aColumnIter, (Standard_Integer )aRowIter, anAlpha);
|
||||
anImageRow[aColumnIter] = Standard_Byte (255.0 * anAlpha);
|
||||
}
|
||||
}
|
||||
|
30
src/Graphic3d/Graphic3d_SetOfHClipPlane.hxx
Normal file
30
src/Graphic3d/Graphic3d_SetOfHClipPlane.hxx
Normal file
@@ -0,0 +1,30 @@
|
||||
// Created on: 2013-07-15
|
||||
// Created by: Anton POLETAEV
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 65 (the "License") You may not use the content of this file
|
||||
// except in compliance with the License Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE SAS, having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License
|
||||
|
||||
#ifndef _Graphic3d_SetOfHClipPlane_HeaderFile
|
||||
#define _Graphic3d_SetOfHClipPlane_HeaderFile
|
||||
|
||||
#include <NCollection_Set.hxx>
|
||||
#include <Graphic3d_ClipPlane.hxx>
|
||||
|
||||
// CDL-header shortcut for set of graphical clipping planes. This is a compact
|
||||
// way (compared to list) to store clippings, with mandatory uniqueness check.
|
||||
typedef NCollection_Set<Handle(Graphic3d_ClipPlane)> Graphic3d_SetOfHClipPlane;
|
||||
|
||||
#endif
|
@@ -74,7 +74,8 @@ uses
|
||||
Vector from Graphic3d,
|
||||
Vertex from Graphic3d,
|
||||
TransModeFlags from Graphic3d,
|
||||
Pnt from gp
|
||||
Pnt from gp,
|
||||
SetOfHClipPlane from Graphic3d
|
||||
|
||||
raises
|
||||
|
||||
@@ -270,6 +271,15 @@ is
|
||||
---Purpose: Get Z layer ID of displayed structure. The method
|
||||
-- returns -1 if the structure has no ID (deleted from graphic driver).
|
||||
|
||||
SetClipPlanes (me : mutable; thePlanes : SetOfHClipPlane from Graphic3d) is static;
|
||||
---Purpose: Changes a set of clip planes slicing the structure on rendering.
|
||||
-- @param thePlanes [in] the set of clip planes.
|
||||
|
||||
GetClipPlanes (me) returns SetOfHClipPlane from Graphic3d;
|
||||
---C++: return const&
|
||||
---Purpose: Get clip planes slicing the structure on rendering.
|
||||
-- @return set of clip planes.
|
||||
|
||||
SetPick ( me : mutable;
|
||||
AValue : Boolean from Standard )
|
||||
is static;
|
||||
|
@@ -2460,7 +2460,6 @@ Standard_Boolean Graphic3d_Structure::HLRValidation () const {
|
||||
//function : CStructure
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Graphic3d_CStructure* Graphic3d_Structure::CStructure()
|
||||
{
|
||||
return &MyCStructure;
|
||||
@@ -2470,7 +2469,6 @@ Graphic3d_CStructure* Graphic3d_Structure::CStructure()
|
||||
//function : SetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Graphic3d_Structure::SetZLayer (const Standard_Integer theLayerId)
|
||||
{
|
||||
// if the structure is not displayed, unable to change its display layer
|
||||
@@ -2484,8 +2482,26 @@ void Graphic3d_Structure::SetZLayer (const Standard_Integer theLayerId)
|
||||
//function : GetZLayer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Graphic3d_Structure::GetZLayer () const
|
||||
{
|
||||
return MyStructureManager->GetZLayer (this);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetClipPlanes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Graphic3d_Structure::SetClipPlanes (const Graphic3d_SetOfHClipPlane& thePlanes)
|
||||
{
|
||||
MyCStructure.ClipPlanes = thePlanes;
|
||||
MyGraphicDriver->SetClipPlanes (MyCStructure);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetClipPlanes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Graphic3d_SetOfHClipPlane& Graphic3d_Structure::GetClipPlanes() const
|
||||
{
|
||||
return MyCStructure.ClipPlanes;
|
||||
}
|
||||
|
Reference in New Issue
Block a user