1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024776: Visualization - inherit OpenGl_View from Graphic3d_CView

Expose interface of OpenGl_View (OpenGL graphics rendering methods) to client code
and collecting all high-level API methods of application views in V3d_View class.

1) Exposing interface of OpenGl_View:

The OpenGl_View inherits from new class Graphic3d_CView.
Graphic3d_CView is an interface class that declares abstract methods for managing displayed structures,
display properties and a base layer code that implements computation
and management of HLR (or more broadly speaking view-depended) structures.

In new implementation it takes place of eliminated Visual3d_View.
As before the instance of Graphic3d_CView is still completely managed by V3d_View classes.
It can be accessed through V3d_View interface but normally this should not be required as all its methods are completely wrapped.

In more details, a concrete specialization of Graphic3d_CView is created and returned by graphical driver on request.
Right after creation the views is directly used for setting rendering properties and adding graphical structures to be displayed.

The rendering of graphics is possible after mapping a window and activating the view.
The direct setting of properties makes obsolete usage of intermediate structures with display parameter
like Visual3d_ContextView and etc (the whole package of Visual3d become redundant).

2) Collecting all high-level API methods of application views in V3d package:

The patch includes elimination of Visual3d layer.
All of its methods that could be previously used by application are now exposed and should be accessed on the level of V3d entities.
- Introduced new class Graphic3d_CView.
  This is a base class for render views.
  Made possible to specialize concrete instances of the class by graphical driver.
- Moved all methods managing rendering views into interface of Graphic3d_CView.
  The corresponding methods were removed from interface of graphical driver.

3) Eliminated Visual3d package:

- Logic of managing display of structures was put from Visual3d_ViewManager into Graphic3d_StructureManager.
- Removed Visual3d_View class. Logic of managing computed structures was put into base layer of Graphi3d_CView.
- Removed all intermediate structures for storing view parameters e.g. Visual3d_ContextView.
  All settings are kept by instances of Graphic3d_CView
- Removed Visual3d_Light intermediate class.
  All light properties are still stored in Graphic3d_CLight structure.
  The structure is directly access by instance of V3d_Light classes.
- Moved all needed enumerations into Graphic3d package.

4) Update package D3DHost to new changes.

5) Update code of OCCT samples to new changes.
This commit is contained in:
apl
2015-09-22 11:49:33 +03:00
committed by kgv
parent 97d87ffa94
commit c357e42610
159 changed files with 9998 additions and 14088 deletions

View File

@@ -56,6 +56,7 @@ Graphic3d_CStructure.hxx
Graphic3d_CStructurePtr.hxx
Graphic3d_CTexture.hxx
Graphic3d_CUserDraw.hxx
Graphic3d_CView.cxx
Graphic3d_CView.hxx
Graphic3d_CycleError.hxx
Graphic3d_DataStructure.pxx
@@ -145,19 +146,25 @@ Graphic3d_TransformError.hxx
Graphic3d_TransformPers.hxx
Graphic3d_TransformUtils.hxx
Graphic3d_TransModeFlags.hxx
Graphic3d_TypeOfAnswer.hxx
Graphic3d_TypeOfBackfacingModel.hxx
Graphic3d_TypeOfBackground.hxx
Graphic3d_TypeOfComposition.hxx
Graphic3d_TypeOfConnection.hxx
Graphic3d_TypeOfLightSource.hxx
Graphic3d_TypeOfMaterial.hxx
Graphic3d_TypeOfPolygon.hxx
Graphic3d_TypeOfPrimitive.hxx
Graphic3d_TypeOfPrimitiveArray.hxx
Graphic3d_TypeOfReflection.hxx
Graphic3d_TypeOfShaderObject.hxx
Graphic3d_TypeOfShadingModel.hxx
Graphic3d_TypeOfStructure.hxx
Graphic3d_TypeOfSurfaceDetail.hxx
Graphic3d_TypeOfTexture.hxx
Graphic3d_TypeOfTextureFilter.hxx
Graphic3d_TypeOfTextureMode.hxx
Graphic3d_TypeOfVisualization.hxx
Graphic3d_Vec.hxx
Graphic3d_Vec2.hxx
Graphic3d_Vec3.hxx

View File

@@ -15,9 +15,9 @@
#ifndef _Graphic3d_CAspectFillArea_HeaderFile
#define _Graphic3d_CAspectFillArea_HeaderFile
#include <InterfaceGraphic_Visual3d.hxx>
#include <Graphic3d_CTexture.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class Graphic3d_CAspectFillArea
{

View File

@@ -15,9 +15,9 @@
#ifndef _Graphic3d_CAspectLine_HeaderFile
#define _Graphic3d_CAspectLine_HeaderFile
#include <InterfaceGraphic_Visual3d.hxx>
#include <Graphic3d_CTexture.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class Graphic3d_CAspectLine
{

View File

@@ -16,10 +16,10 @@
#define _Graphic3d_CAspectMarker_HeaderFile
#include <Aspect_TypeOfMarker.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
#include <Graphic3d_CTexture.hxx>
#include <Graphic3d_MarkerImage.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class Graphic3d_CAspectMarker
{

View File

@@ -15,9 +15,9 @@
#ifndef _Graphic3d_CAspectText_HeaderFile
#define _Graphic3d_CAspectText_HeaderFile
#include <InterfaceGraphic_Visual3d.hxx>
#include <Graphic3d_CTexture.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class Graphic3d_CAspectText
{

View File

@@ -14,9 +14,10 @@
#ifndef _Graphic3d_CLight_HeaderFile
#define _Graphic3d_CLight_HeaderFile
#include <InterfaceGraphic_Graphic3d.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
#include <Graphic3d_TypeOfLightSource.hxx>
#include <Graphic3d_Vec.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
#include <NCollection_List.hxx>
//! Light definition
struct Graphic3d_CLight
@@ -24,14 +25,14 @@ struct Graphic3d_CLight
public:
Graphic3d_Vec4 Color; //!< light color
Graphic3d_Vec4 Position; //!< light position
Graphic3d_Vec4 Direction; //!< direction of directional/spot light
Graphic3d_Vec4 Params; //!< packed light parameters
Standard_Integer Type; //!< Visual3d_TypeOfLightSource enumeration
Standard_Boolean IsHeadlight; //!< flag to mark head light
Standard_ShortReal Smoothness; //!< radius (cone angle) for point (directional) light
Standard_ShortReal Intensity; //!< intensity multiplier for light
Graphic3d_Vec4 Color; //!< light color
Graphic3d_Vec4 Position; //!< light position
Graphic3d_Vec4 Direction; //!< direction of directional/spot light
Graphic3d_Vec4 Params; //!< packed light parameters
Graphic3d_TypeOfLightSource Type; //!< Graphic3d_TypeOfLightSource enumeration
Standard_Boolean IsHeadlight; //!< flag to mark head light
Standard_ShortReal Smoothness; //!< radius (cone angle) for point (directional) light
Standard_ShortReal Intensity; //!< intensity multiplier for light
//! Const attenuation factor of positional light source
Standard_ShortReal ConstAttenuation() const { return Params.x(); }
@@ -62,7 +63,7 @@ public:
Position (0.0f, 0.0f, 0.0f, 1.0f),
Direction (0.0f, 0.0f, 0.0f, 0.0f),
Params (0.0f, 0.0f, 0.0f, 0.0f),
Type (0),
Type (Graphic3d_TOLS_AMBIENT),
IsHeadlight (Standard_False),
Smoothness (0.0f),
Intensity (1.0f)
@@ -76,4 +77,6 @@ public:
};
typedef NCollection_List<Graphic3d_CLight> Graphic3d_ListOfCLight;
#endif // Graphic3d_CLight_HeaderFile

View File

@@ -24,6 +24,7 @@
#include <Graphic3d_TransformPers.hxx>
#include <Graphic3d_Vec3.hxx>
#include <Graphic3d_ZLayerId.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
class Graphic3d_GraphicDriver;
class Graphic3d_StructureManager;

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
// Copyright (c) 1999-2014 OPEN CASCADE SAS
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -14,128 +14,578 @@
#ifndef _Graphic3d_CView_HeaderFile
#define _Graphic3d_CView_HeaderFile
#include <InterfaceGraphic_Graphic3d.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
#include <Graphic3d_RenderingParams.hxx>
#include <Graphic3d_TextureEnv.hxx>
#include <Aspect_GraphicCallbackProc.hxx>
#include <Aspect_Handle.hxx>
#include <Aspect_PrintAlgo.hxx>
#include <Aspect_RenderingContext.hxx>
#include <Aspect_TypeOfTriedronEcho.hxx>
#include <Aspect_TypeOfTriedronPosition.hxx>
#include <Aspect_TypeOfUpdate.hxx>
#include <Aspect_Window.hxx>
#include <Graphic3d_BufferType.hxx>
#include <Graphic3d_Camera.hxx>
#include <Graphic3d_CLight.hxx>
#include <Graphic3d_CStructure.hxx>
#include <Graphic3d_DataStructureManager.hxx>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_GraduatedTrihedron.hxx>
#include <Graphic3d_MapOfStructure.hxx>
#include <Graphic3d_NMapOfTransient.hxx>
#include <Graphic3d_PtrFrameBuffer.hxx>
#include <Graphic3d_RenderingParams.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <Graphic3d_SequenceOfStructure.hxx>
#include <Graphic3d_SortType.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_StructureManagerPtr.hxx>
#include <Graphic3d_TextureEnv.hxx>
#include <Graphic3d_TypeOfAnswer.hxx>
#include <Graphic3d_TypeOfBackfacingModel.hxx>
#include <Graphic3d_TypeOfShadingModel.hxx>
#include <Graphic3d_TypeOfSurfaceDetail.hxx>
#include <Graphic3d_TypeOfVisualization.hxx>
#include <Graphic3d_Vec3.hxx>
#include <Graphic3d_ZLayerId.hxx>
#include <Graphic3d_ZLayerSettings.hxx>
#include <Image_PixMap.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Standard_Address.hxx>
#include <Standard_Transient.hxx>
class CALL_DEF_VIEWCONTEXT
class Graphic3d_CView;
class Graphic3d_GraphicDriver;
class Graphic3d_StructureManager;
DEFINE_STANDARD_HANDLE (Graphic3d_CView, Graphic3d_DataStructureManager)
//! Base class of a graphical view that carries out rendering process for a concrete
//! implementation of graphical driver. Provides virtual interfaces for redrawing its
//! contents, management of displayed structures and render settings. The source code
//! of the class itself implements functionality related to management of
//! computed (HLR or "view-dependent") structures.
class Graphic3d_CView : public Graphic3d_DataStructureManager
{
public:
//! Constructor.
Standard_EXPORT Graphic3d_CView (const Handle(Graphic3d_StructureManager)& theMgr);
//! Destructor.
Standard_EXPORT virtual ~Graphic3d_CView();
//! Returns the identification number of the view.
Standard_Integer Identification() const { return myId; }
//! Activates the view. Map the associated window on the screen and post the view in this window.
//! Warning: Raises ViewDefinitionError if the associated window isn't defined.
Standard_EXPORT virtual void Activate();
//! Deactivates the view. Unmap the associated window on the screen and unpost the view in this window.
//! Warning: Raises ViewDefinitionError if the associated window isn't defined.
Standard_EXPORT virtual void Deactivate();
//! Returns the activity flag of the view.
Standard_Boolean IsActive() const { return myIsActive; }
//! Erases the view and removes from graphic driver.
//! No more graphic operations are allowed in this view after the call.
Standard_EXPORT virtual void Remove();
//! Returns true if the view was removed.
Standard_Boolean IsRemoved() const { return myIsRemoved; }
public:
CALL_DEF_VIEWCONTEXT()
: Aliasing (0),
BackZClipping (0),
FrontZClipping (0),
DepthCueing (0),
ZClipFrontPlane (0.0f),
ZClipBackPlane (0.0f),
DepthFrontPlane (0.0f),
DepthBackPlane (0.0f),
Model (0),
Visualization (0),
NbActiveLight (0),
ActiveLight (NULL),
SurfaceDetail (0),
ClipPlanes()
//! Returns visualization type of the view.
Graphic3d_TypeOfVisualization VisualizationType() const { return myVisualization; }
//! Sets visualization type of the view.
void SetVisualizationType (const Graphic3d_TypeOfVisualization theType) { myVisualization = theType; }
//! Switches computed HLR mode in the view
Standard_EXPORT void SetComputedMode (const Standard_Boolean theMode);
//! Returns the computed HLR mode state
Standard_Boolean ComputedMode() const { return myIsInComputedMode; }
//! Computes the new presentation of the structure displayed in this view with the type Graphic3d_TOS_COMPUTED.
Standard_EXPORT void ReCompute (const Handle(Graphic3d_Structure)& theStructure);
//! Updates screen in function of modifications of the structures.
Standard_EXPORT void Update (const Aspect_TypeOfUpdate theUpdateMode);
//! Returns Standard_True if one of the structures displayed in the view contains Polygons, Triangles or Quadrangles.
Standard_EXPORT Standard_Boolean ContainsFacet() const;
//! Returns Standard_True if one of the structures in the set contains Polygons, Triangles or Quadrangles.
Standard_EXPORT Standard_Boolean ContainsFacet (const Graphic3d_MapOfStructure& theSet) const;
//! Returns the set of structures displayed in this view.
Standard_EXPORT void DisplayedStructures (Graphic3d_MapOfStructure& theStructures) const;
//! Returns number of displayed structures in the view.
Standard_Integer NumberOfDisplayedStructures() const { return myStructsDisplayed.Extent(); }
//! Returns map of objects hidden within this specific view (not viewer-wise).
const Handle(Graphic3d_NMapOfTransient)& HiddenObjects() const { return myHiddenObjects; }
//! Returns map of objects hidden within this specific view (not viewer-wise).
Handle(Graphic3d_NMapOfTransient)& ChangeHiddenObjects() { return myHiddenObjects; }
//! Returns Standard_True in case if the structure with the given <theStructId> is
//! in list of structures to be computed and stores computed struct to <theComputedStruct>.
Standard_EXPORT Standard_Boolean IsComputed (const Standard_Integer theStructId,
Handle(Graphic3d_Structure)& theComputedStruct) const;
//! Returns the coordinates of the boundary box of all
//! structures displayed in the view.
//! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box
//! also includes minimum and maximum limits of graphical elements
//! forming parts of infinite structures.
Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
//! Returns the coordinates of the boundary box of all structures in the set <theSet>.
//! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box
//! also includes minimum and maximum limits of graphical elements
//! forming parts of infinite structures.
Standard_EXPORT Bnd_Box MinMaxValues (const Graphic3d_MapOfStructure& theSet,
const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
//! Returns the structure manager handle which manage structures associated with this view.
const Handle(Graphic3d_StructureManager)& StructureManager() const { return myStructureManager; }
private:
friend class Graphic3d_StructureManager;
//! Is it possible to display the structure in the view?
Standard_EXPORT Graphic3d_TypeOfAnswer acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const;
//! Computes the new presentation of the structures displayed in this view with the type Graphic3d_TOS_COMPUTED.
Standard_EXPORT void Compute();
//! Clears the structure in this view.
Standard_EXPORT void Clear (const Handle(Graphic3d_Structure)& theStructure, const Standard_Boolean theWithDestruction);
//! Connects the structures.
Standard_EXPORT void Connect (const Handle(Graphic3d_Structure)& theMother,
const Handle(Graphic3d_Structure)& theDaughter);
//! Disconnects the structures.
Standard_EXPORT void Disconnect (const Handle(Graphic3d_Structure)& theMother,
const Handle(Graphic3d_Structure)& theDaughter);
//! Displays the structure in the view.
Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& theStructure);
//! Display the structure in the view.
Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& theStructure,
const Aspect_TypeOfUpdate theUpdateMode);
//! Erases the structure from the view.
Standard_EXPORT void Erase (const Handle(Graphic3d_Structure)& theStructure);
//! Erases the structure from the view.
Standard_EXPORT void Erase (const Handle(Graphic3d_Structure)& theStructure,
const Aspect_TypeOfUpdate theUpdateMode);
//! Highlights the structure in the view.
Standard_EXPORT void Highlight (const Handle(Graphic3d_Structure)& theStructure,
const Aspect_TypeOfHighlightMethod theMethod);
//! Transforms the structure in the view.
Standard_EXPORT void SetTransform (const Handle(Graphic3d_Structure)& theStructure,
const TColStd_Array2OfReal& theTrsf);
//! Suppress the highlighting on the structure <AStructure>
//! in the view <me>.
Standard_EXPORT void UnHighlight (const Handle(Graphic3d_Structure)& theStructure);
//! Returns an index != 0 if the structure have another structure computed for the view <me>.
Standard_EXPORT Standard_Integer IsComputed (const Handle(Graphic3d_Structure)& theStructure) const;
//! Returns true if the structure is displayed in the view.
Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(Graphic3d_Structure)& theStructure) const;
//! Changes the display priority of the structure.
Standard_EXPORT void ChangePriority (const Handle(Graphic3d_Structure)& theStructure,
const Standard_Integer theOldPriority,
const Standard_Integer theNewPriority);
//! Change Z layer of already displayed structure in the view.
Standard_EXPORT void ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure,
const Graphic3d_ZLayerId theLayerId);
//! Returns an index != 0 if the structure have the same owner than another structure
//! in the sequence of the computed structures.
Standard_EXPORT Standard_Integer HaveTheSameOwner (const Handle(Graphic3d_Structure)& theStructure) const;
public:
//! Redraw content of the view.
virtual void Redraw() = 0;
//! Redraw immediate content of the view.
virtual void RedrawImmediate() = 0;
//! Invalidates content of the view but does not redraw it.
virtual void Invalidate() = 0;
//! Return true if view content cache has been invalidated.
virtual Standard_Boolean IsInvalidated() = 0;
//! Handle changing size of the rendering window.
virtual void Resized() = 0;
//! @param theDrawToFrontBuffer Advanced option to modify rendering mode:
//! 1. TRUE. Drawing immediate mode structures directly to the front buffer over the scene image.
//! Fast, so preferred for interactive work (used by default).
//! However these extra drawings will be missed in image dump since it is performed from back buffer.
//! Notice that since no pre-buffering used the V-Sync will be ignored and rendering could be seen
//! in run-time (in case of slow hardware) and/or tearing may appear.
//! So this is strongly recommended to draw only simple (fast) structures.
//! 2. FALSE. Drawing immediate mode structures to the back buffer.
//! The complete scene is redrawn first, so this mode is slower if scene contains complex data and/or V-Sync
//! is turned on. But it works in any case and is especially useful for view dump because the dump image is read
//! from the back buffer.
//! @return previous mode.
virtual Standard_Boolean SetImmediateModeDrawToFront (const Standard_Boolean theDrawToFrontBuffer) = 0;
//! Creates and maps rendering window to the view.
//! @param theView [in] the view to associate with the window.
//! @param theWindow [in] the window.
//! @param theContext [in] the rendering context. If NULL the context will be created internally.
//! @param theDisplayCB [in] the display callback function. If is not a NULL value, then the callback will be
//! invoked at the end of the OCC graphic traversal and just before the swap of buffers.
//! @param theClientData [in] the client data for the callback.
virtual void SetWindow (const Handle(Aspect_Window)& theWindow,
const Aspect_RenderingContext theContext = NULL,
const Aspect_GraphicCallbackProc& theDisplayCB = NULL,
const Standard_Address theClientData = NULL) = 0;
//! Returns the window associated to the view.
virtual Handle(Aspect_Window) Window() const = 0;
//! Returns True if the window associated to the view is defined.
virtual Standard_Boolean IsDefined() const = 0;
//! Displays z-buffer trihedron.
virtual void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition = Aspect_TOTP_CENTER,
const Quantity_NameOfColor theColor = Quantity_NOC_WHITE,
const Standard_Real theScale = 0.02,
const Standard_Boolean theAsWireframe = Standard_True) = 0;
//! Erases z-buffer trihedron.
virtual void TriedronErase() = 0;
//! Setup parameters of z-buffer trihedron.
virtual void ZBufferTriedronSetup (const Quantity_NameOfColor theXColor = Quantity_NOC_RED,
const Quantity_NameOfColor theYColor = Quantity_NOC_GREEN,
const Quantity_NameOfColor theZColor = Quantity_NOC_BLUE1,
const Standard_Real theSizeRatio = 0.8,
const Standard_Real theAxisDiametr = 0.05,
const Standard_Integer theNbFacettes = 12) = 0;
//! Displays trihedron echo.
virtual void TriedronEcho (const Aspect_TypeOfTriedronEcho theType = Aspect_TOTE_NONE) = 0;
//! Returns data of a graduated trihedron
virtual const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() = 0;
//! Displays Graduated Trihedron.
virtual void GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrihedronData) = 0;
//! Erases Graduated Trihedron.
virtual void GraduatedTrihedronErase() = 0;
//! Sets minimum and maximum points of scene bounding box for Graduated Trihedron stored in graphic view object.
//! @param theMin [in] the minimum point of scene.
//! @param theMax [in] the maximum point of scene.
virtual void GraduatedTrihedronMinMaxValues (const Graphic3d_Vec3 theMin, const Graphic3d_Vec3 theMax) = 0;
//! Reads depths of shown pixels of the given rectangle.
virtual void ReadDepths (const Standard_Integer theX,
const Standard_Integer theY,
const Standard_Integer theWidth,
const Standard_Integer theHeight,
const Standard_Address theBuffer) const = 0;
//! Dump active rendering buffer into specified memory buffer.
virtual Standard_Boolean BufferDump (Image_PixMap& theImage, const Graphic3d_BufferType& theBufferType) = 0;
//! Print the contents of the view to the printer.
//! @param thePrinterDC pass the PrinterDeviceContext (HDC)
//! @param theToShowBackground when set to FALSE then print the view without background
//! color (background is white) else set to TRUE for printing
//! with current background color
//! @param theFileName if != NULL, then the view will be printed to a file
//! @param thePrintAlgorithm select print algorithm: stretch, tile
//! @param theScaleFactor scaling coefficient, used internally to scale the printings
//! accordingly to the scale factor selected in the printer properties dialog
//! @return Standard_True if the data is passed to the printer, otherwise Standard_False if
//! the print operation failed due to the printer errors, or lack of system memory. This might be related
//! to insufficient memory or some internal errors.
//! All this errors are indicated by the message boxes (on level of OpenGl_GraphicDriver).
//! Warning: This function can reuse FBO assigned to the view, please take it into account
//! if you use it for your purposes.
virtual Standard_Boolean Print (const Aspect_Handle thePrinterDC,
const Standard_Boolean theToShowBackground,
const Standard_CString theFileName,
const Aspect_PrintAlgo thePrintAlgorithm = Aspect_PA_STRETCH,
const Standard_Real theScaleFactor = 1.0) = 0;
//! Export scene into the one of the Vector graphics formats (SVG, PS, PDF...).
//! In contrast to Bitmaps, Vector graphics is scalable (so you may got quality benefits
//! on printing to laser printer). Notice however that results may differ a lot and
//! do not contain some elements.
virtual Standard_Boolean Export (const Standard_CString theFileName,
const Graphic3d_ExportFormat theFormat,
const Graphic3d_SortType theSortType = Graphic3d_ST_BSP_Tree) = 0;
//! Marks BVH tree and the set of BVH primitives of correspondent priority list with id theLayerId as outdated.
virtual void InvalidateBVHData (const Standard_Integer theLayerId) = 0;
//! Add a new top-level z layer with ID <theLayerId> for
//! the view. Z layers allow drawing structures in higher layers
//! in foreground of structures in lower layers. To add a structure
//! to desired layer on display it is necessary to set the layer
//! ID for the structure.
virtual void AddZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
//! Remove Z layer from the specified view. All structures
//! displayed at the moment in layer will be displayed in default layer
//! ( the bottom-level z layer ). To unset layer ID from associated
//! structures use method UnsetZLayer (...).
virtual void RemoveZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
//! Sets the settings for a single Z layer of specified view.
virtual void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId,
const Graphic3d_ZLayerSettings& theSettings) = 0;
//! Returns pointer to an assigned framebuffer object.
virtual Graphic3d_PtrFrameBuffer FBO() const = 0;
//! Sets framebuffer object for offscreen rendering.
virtual void SetFBO (const Graphic3d_PtrFrameBuffer theFBO) = 0;
//! Generate offscreen FBO in the graphic library.
//! If not supported on hardware returns NULL.
virtual Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth,
const Standard_Integer theHeight) = 0;
//! Remove offscreen FBO from the graphic library
virtual void FBORelease (Graphic3d_PtrFrameBuffer& theFBOPtr) = 0;
//! Read offscreen FBO configuration.
virtual void FBOGetDimensions (const Graphic3d_PtrFrameBuffer theFBOPtr,
Standard_Integer& theWidth,
Standard_Integer& theHeight,
Standard_Integer& theWidthMax,
Standard_Integer& theHeightMax) = 0;
//! Change offscreen FBO viewport.
virtual void FBOChangeViewport (Graphic3d_PtrFrameBuffer& theFBOPtr,
const Standard_Integer theWidth,
const Standard_Integer theHeight) = 0;
public:
//! Copy visualization settings from another view.
//! Method is used for cloning views in viewer when its required to create view
//! with same view properties.
Standard_EXPORT virtual void CopySettings (const Handle(Graphic3d_CView)& theOther);
//! Returns current rendering parameters and effect settings.
const Graphic3d_RenderingParams& RenderingParams() const { return myRenderParams; }
//! Returns reference to current rendering parameters and effect settings.
Graphic3d_RenderingParams& ChangeRenderingParams() { return myRenderParams; }
//! Returns true if anti-aliasing is enabled for the view.
virtual Standard_Boolean IsAntialiasingEnabled() const = 0;
//! Enable or disable anti-aliasing in the view.
virtual void SetAntialiasingEnabled (const Standard_Boolean theIsEnabled) = 0;
//! Returns background fill color.
virtual Aspect_Background Background() const = 0;
//! Sets background fill color.
virtual void SetBackground (const Aspect_Background& theBackground) = 0;
//! Returns gradient background fill colors.
virtual Aspect_GradientBackground GradientBackground() const = 0;
//! Sets gradient background fill colors.
virtual void SetGradientBackground (const Aspect_GradientBackground& theBackground) = 0;
//! Returns background image texture file path.
virtual TCollection_AsciiString BackgroundImage() = 0;
//! Sets background image texture file path.
virtual void SetBackgroundImage (const TCollection_AsciiString& theFilePath) = 0;
//! Returns background image fill style.
virtual Aspect_FillMethod BackgroundImageStyle() const = 0;
//! Sets background image fill style.
virtual void SetBackgroundImageStyle (const Aspect_FillMethod theFillStyle) = 0;
//! Returns environment texture set for the view.
virtual Handle(Graphic3d_TextureEnv) TextureEnv() const = 0;
//! Sets environment texture for the view.
virtual void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTextureEnv) = 0;
//! Returns the state of frustum culling optimization.
virtual Standard_Boolean IsCullingEnabled() const = 0;
//! Enables or disables frustum culling optimization.
virtual void SetCullingEnabled (const Standard_Boolean theIsEnabled) = 0;
//! Returns shading model of the view.
virtual Graphic3d_TypeOfShadingModel ShadingModel() const = 0;
//! Sets shading model of the view.
virtual void SetShadingModel (const Graphic3d_TypeOfShadingModel theModel) = 0;
//! Returns surface detail type of the view.
virtual Graphic3d_TypeOfSurfaceDetail SurfaceDetailType() const = 0;
//! Sets surface detail type of the view.
virtual void SetSurfaceDetailType (const Graphic3d_TypeOfSurfaceDetail theType) = 0;
//! Return backfacing model used for the view.
virtual Graphic3d_TypeOfBackfacingModel BackfacingModel() const = 0;
//! Sets backfacing model for the view.
virtual void SetBackfacingModel (const Graphic3d_TypeOfBackfacingModel theModel) = 0;
//! Returns camera object of the view.
virtual const Handle(Graphic3d_Camera)& Camera() const = 0;
//! 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;
//! Sets GL lighting enabled or disable state.
virtual void SetGLLightEnabled (const Standard_Boolean theIsEnabled) = 0;
//! Returns list of lights of the view.
virtual const Graphic3d_ListOfCLight& Lights() const = 0;
//! Sets list of lights for the view.
virtual void SetLights (const Graphic3d_ListOfCLight& theLights) = 0;
//! Returns list of clip planes set for the view.
virtual const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const = 0;
//! Sets list of clip planes for the view.
virtual void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) = 0;
private:
//! Adds the structure to display lists of the view.
virtual void displayStructure (const Handle(Graphic3d_CStructure)& theStructure,
const Standard_Integer thePriority) = 0;
//! Erases the structure from display lists of the view.
virtual void eraseStructure (const Handle(Graphic3d_CStructure)& theStructure) = 0;
//! Change Z layer of a structure already presented in view.
virtual void changeZLayer (const Handle(Graphic3d_CStructure)& theCStructure,
const Graphic3d_ZLayerId theNewLayerId) = 0;
//! Changes the priority of a structure within its Z layer in the specified view.
virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure,
const Standard_Integer theNewPriority) = 0;
protected:
struct CachedMinMax
{
//
}
CachedMinMax() { Invalidate(); }
public:
Bnd_Box& BoundingBox (const Standard_Boolean theToIgnoreInfiniteFlag)
{
return !theToIgnoreInfiniteFlag ? myBoundingBox[0] : myBoundingBox[1];
}
Standard_Boolean& IsOutdated (const Standard_Boolean theToIgnoreInfiniteFlag)
{
return !theToIgnoreInfiniteFlag ? myIsOutdated[0] : myIsOutdated[1];
}
void Invalidate()
{
myIsOutdated[0] = Standard_True;
myIsOutdated[1] = Standard_True;
}
int Aliasing;
Standard_Boolean myIsOutdated [2];
Bnd_Box myBoundingBox[2];
};
int BackZClipping;
int FrontZClipping;
protected:
int DepthCueing;
Standard_Integer myId;
Graphic3d_RenderingParams myRenderParams;
Handle(Graphic3d_StructureManager) myStructureManager;
Graphic3d_SequenceOfStructure myStructsToCompute;
Graphic3d_SequenceOfStructure myStructsComputed;
Graphic3d_MapOfStructure myStructsDisplayed;
Handle(Graphic3d_NMapOfTransient) myHiddenObjects;
Standard_Boolean myIsInComputedMode;
Standard_Boolean myIsActive;
Standard_Boolean myIsRemoved;
Graphic3d_TypeOfVisualization myVisualization;
mutable CachedMinMax myMinMax;
float ZClipFrontPlane;
float ZClipBackPlane;
private:
float DepthFrontPlane;
float DepthBackPlane;
int Model;
int Visualization;
int NbActiveLight;
Graphic3d_CLight* ActiveLight;
Handle(Graphic3d_TextureEnv) TextureEnv;
int SurfaceDetail;
Graphic3d_SequenceOfHClipPlane ClipPlanes;
Handle(Graphic3d_Camera) Camera;
DEFINE_STANDARD_RTTI (Graphic3d_CView, Graphic3d_DataStructureManager)
};
class Graphic3d_CView
{
public:
Graphic3d_CView()
: WsId (-1),
ViewId (0),
ptrView (NULL),
IsDeleted (0),
IsOpen (0),
Active (0),
ptrUnderLayer (NULL),
ptrOverLayer (NULL),
Backfacing (0),
GContext (NULL),
GDisplayCB (NULL),
GClientData (NULL),
ptrFBO (NULL),
WasRedrawnGL (0),
IsCullingEnabled (Standard_True)
{
memset (&DefWindow, 0, sizeof(DefWindow));
}
public:
int WsId;
int ViewId;
void* ptrView;
int IsDeleted;
int IsOpen;
int Active;
CALL_DEF_VIEWCONTEXT Context;
CALL_DEF_WINDOW DefWindow;
void* ptrUnderLayer;
void* ptrOverLayer;
int Backfacing;
Aspect_RenderingContext GContext;
Aspect_GraphicCallbackProc GDisplayCB;
void* GClientData;
void* ptrFBO;
//! Was the window redrawn by standard OpenGL?
mutable int WasRedrawnGL;
//! Specifies rendering parameters and effects.
Graphic3d_RenderingParams RenderParams;
//! Enables/disables frustum culling.
Standard_Boolean IsCullingEnabled;
};
#endif // Graphic3d_CView_HeaderFile
#endif // _Graphic3d_CView_HeaderFile

View File

@@ -235,6 +235,11 @@ gp_Dir Graphic3d_Camera::Direction() const
// =======================================================================
void Graphic3d_Camera::SetScale (const Standard_Real theScale)
{
if (Scale() == theScale)
{
return;
}
myScale = theScale;
switch (myProjType)
@@ -281,7 +286,7 @@ Standard_Real Graphic3d_Camera::Scale() const
// =======================================================================
void Graphic3d_Camera::SetProjectionType (const Projection theProjectionType)
{
Projection anOldType = myProjType;
Projection anOldType = ProjectionType();
if (anOldType == theProjectionType)
{
@@ -311,7 +316,13 @@ void Graphic3d_Camera::SetProjectionType (const Projection theProjectionType)
// =======================================================================
void Graphic3d_Camera::SetFOVy (const Standard_Real theFOVy)
{
if (FOVy() == theFOVy)
{
return;
}
myFOVy = theFOVy;
InvalidateProjection();
}
@@ -329,6 +340,12 @@ void Graphic3d_Camera::SetZRange (const Standard_Real theZNear,
Standard_ASSERT_RAISE (theZFar > 0.0, "Only positive Z-Far is allowed for perspective camera");
}
if (ZNear() == theZNear
&& ZFar () == theZFar)
{
return;
}
myZNear = theZNear;
myZFar = theZFar;
@@ -341,7 +358,13 @@ void Graphic3d_Camera::SetZRange (const Standard_Real theZNear,
// =======================================================================
void Graphic3d_Camera::SetAspect (const Standard_Real theAspect)
{
if (Aspect() == theAspect)
{
return;
}
myAspect = theAspect;
InvalidateProjection();
}
@@ -351,8 +374,15 @@ void Graphic3d_Camera::SetAspect (const Standard_Real theAspect)
// =======================================================================
void Graphic3d_Camera::SetZFocus(const FocusType theType, const Standard_Real theZFocus)
{
if (ZFocusType() == theType
&& ZFocus () == theZFocus)
{
return;
}
myZFocusType = theType;
myZFocus = theZFocus;
myZFocus = theZFocus;
InvalidateProjection();
}
@@ -362,8 +392,15 @@ void Graphic3d_Camera::SetZFocus(const FocusType theType, const Standard_Real th
// =======================================================================
void Graphic3d_Camera::SetIOD (const IODType theType, const Standard_Real theIOD)
{
if (IODType() == theType
&& IOD () == theIOD)
{
return;
}
myIODType = theType;
myIOD = theIOD;
myIOD = theIOD;
InvalidateProjection();
}

View File

@@ -24,7 +24,7 @@
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
class Visual3d_View;
class Graphic3d_CView;
//! Class that stores style for one graduated trihedron axis such as colors, lengths and customization flags.
//! It is used in Graphic3d_GraduatedTrihedron.
@@ -111,7 +111,7 @@ class Graphic3d_GraduatedTrihedron
{
public:
typedef void (*MinMaxValuesCallback) (Visual3d_View*);
typedef void (*MinMaxValuesCallback) (Graphic3d_CView*);
public:
@@ -138,7 +138,7 @@ public:
myAxes (0) = Graphic3d_AxisAspect ("X", Quantity_NOC_RED, Quantity_NOC_RED);
myAxes (1) = Graphic3d_AxisAspect ("Y", Quantity_NOC_GREEN, Quantity_NOC_GREEN);
myAxes (2) = Graphic3d_AxisAspect ("Z", Quantity_NOC_BLUE1, Quantity_NOC_BLUE1);
PtrVisual3dView = NULL;
PtrView = NULL;
}
public:
@@ -196,7 +196,7 @@ public:
public:
MinMaxValuesCallback CubicAxesCallback; //!< Callback function to define boundary box of displayed objects
Visual3d_View* PtrVisual3dView;
Graphic3d_CView* PtrView;
protected:

View File

@@ -14,7 +14,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_StructureManager.hxx>
@@ -79,10 +78,9 @@ void Graphic3d_GraphicDriver::PrintCStructure (const Graphic3d_CStructure& ACStr
void Graphic3d_GraphicDriver::PrintCView (const Graphic3d_CView& ACView, const Standard_Integer AField) const {
if (AField) {
cout << "\tws id " << ACView.WsId << ", "
<< "view id " << ACView.ViewId << "\n";
cout << "\tXwindow id " << ACView.DefWindow.XWindow << ", "
<< "activity " << ACView.Active << "\n";
cout << "view id " << ACView.Identification() << "\n";
cout << "\tXwindow id " << (ACView.Window().IsNull() ? 0 : ACView.Window()->NativeHandle()) << ", "
<< "activity " << ACView.IsActive() << "\n";
cout << flush;
}

View File

@@ -49,14 +49,17 @@
#include <Graphic3d_ZLayerSettings.hxx>
#include <Graphic3d_CLight.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <TColStd_SequenceOfInteger.hxx>
class Graphic3d_CView;
class Graphic3d_GraphicDriver;
class Graphic3d_TransformError;
class Graphic3d_Structure;
class Graphic3d_StructureManager;
class Graphic3d_ViewManager;
class Quantity_Color;
class TCollection_AsciiString;
class Graphic3d_GraphicDriver;
DEFINE_STANDARD_HANDLE(Graphic3d_GraphicDriver, MMgt_TShared)
//! This class allows the definition of a graphic driver
@@ -68,218 +71,63 @@ public:
//! call_togl_inquirelight
Standard_EXPORT virtual Standard_Integer InquireLightLimit() = 0;
virtual Standard_Integer InquireLightLimit() = 0;
//! call_togl_inquireplane
Standard_EXPORT virtual Standard_Integer InquirePlaneLimit() = 0;
virtual Standard_Integer InquirePlaneLimit() = 0;
//! call_togl_inquireview
Standard_EXPORT virtual Standard_Integer InquireViewLimit() = 0;
//! call_togl_displaystructure
Standard_EXPORT virtual void DisplayStructure (const Graphic3d_CView& theCView, const Handle(Graphic3d_Structure)& theStructure, const Standard_Integer thePriority) = 0;
//! call_togl_erasestructure
Standard_EXPORT virtual void EraseStructure (const Graphic3d_CView& theCView, const Handle(Graphic3d_Structure)& theStructure) = 0;
//! call_togl_removestructure
Standard_EXPORT virtual void RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure) = 0;
virtual Standard_Integer InquireViewLimit() = 0;
//! Creates new empty graphic structure
Standard_EXPORT virtual Handle(Graphic3d_CStructure) Structure (const Handle(Graphic3d_StructureManager)& theManager) = 0;
virtual Handle(Graphic3d_CStructure) CreateStructure (const Handle(Graphic3d_StructureManager)& theManager) = 0;
//! call_togl_activateview
Standard_EXPORT virtual void ActivateView (const Graphic3d_CView& ACView) = 0;
//! Removes structure from graphic driver and releases its resources.
virtual void RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure) = 0;
//! call_togl_antialiasing
Standard_EXPORT virtual void AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) = 0;
//! Creates new view for this graphic driver.
virtual Handle(Graphic3d_CView) CreateView (const Handle(Graphic3d_StructureManager)& theMgr) = 0;
//! call_togl_background
Standard_EXPORT virtual void Background (const Graphic3d_CView& ACView) = 0;
//! call_togl_gradient_background
Standard_EXPORT virtual void GradientBackground (const Graphic3d_CView& ACView, const Quantity_Color& AColor1, const Quantity_Color& AColor2, const Aspect_GradientFillMethod FillStyle) = 0;
Standard_EXPORT virtual void BackgroundImage (const Standard_CString FileName, const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle) = 0;
Standard_EXPORT virtual void SetBgImageStyle (const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle) = 0;
Standard_EXPORT virtual void SetBgGradientStyle (const Graphic3d_CView& ACView, const Aspect_GradientFillMethod FillStyle) = 0;
//! call_togl_cliplimit
Standard_EXPORT virtual void ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait) = 0;
//! call_togl_deactivateview
Standard_EXPORT virtual void DeactivateView (const Graphic3d_CView& ACView) = 0;
//! call_togl_cliplimit
Standard_EXPORT virtual void DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) = 0;
//! call_togl_ratio_window
Standard_EXPORT virtual void RatioWindow (const Graphic3d_CView& ACView) = 0;
//! Redraw content of the view
Standard_EXPORT virtual void Redraw (const Graphic3d_CView& theCView, const Standard_Integer theX = 0, const Standard_Integer theY = 0, const Standard_Integer theWidth = 0, const Standard_Integer theHeight = 0) = 0;
//! Redraw layer of immediate presentations
Standard_EXPORT virtual void RedrawImmediate (const Graphic3d_CView& theCView) = 0;
//! Invalidates content of the view but does not redraw it
Standard_EXPORT virtual void Invalidate (const Graphic3d_CView& theCView) = 0;
//! Removes view from graphic driver and releases its resources.
virtual void RemoveView (const Handle(Graphic3d_CView)& theView) = 0;
//! Returns true if cached view content has been invalidated.
Standard_EXPORT virtual Standard_Boolean IsInvalidated (const Graphic3d_CView& theCView) const = 0;
//! call_togl_removeview
Standard_EXPORT virtual void RemoveView (const Graphic3d_CView& ACView) = 0;
//! call_togl_setlight
Standard_EXPORT virtual void SetLight (const Graphic3d_CView& ACView) = 0;
//! Pass clip planes to the associated graphic driver view.
Standard_EXPORT virtual void SetClipPlanes (const Graphic3d_CView& theCView) = 0;
//! Inform graphic driver if camera assigned to view changes.
Standard_EXPORT virtual void SetCamera (const Graphic3d_CView& theCView) = 0;
//! call_togl_setvisualisation
Standard_EXPORT virtual void SetVisualisation (const Graphic3d_CView& ACView) = 0;
//! call_togl_view
Standard_EXPORT virtual Standard_Boolean View (Graphic3d_CView& ACView) = 0;
Standard_EXPORT virtual void Environment (const Graphic3d_CView& ACView) = 0;
//! enables/disables usage of OpenGL vertex buffer arrays while drawing primitiev arrays
Standard_EXPORT virtual void EnableVBO (const Standard_Boolean status) = 0;
virtual void EnableVBO (const Standard_Boolean status) = 0;
//! Returns information about GPU memory usage.
Standard_EXPORT virtual Standard_Boolean MemoryInfo (Standard_Size& theFreeBytes, TCollection_AsciiString& theInfo) const = 0;
virtual Standard_Boolean MemoryInfo (Standard_Size& theFreeBytes, TCollection_AsciiString& theInfo) const = 0;
//! call_togl_ztriedron_setup
Standard_EXPORT virtual void ZBufferTriedronSetup (const Graphic3d_CView& theCView, const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12) = 0;
//! call_togl_triedron_display
Standard_EXPORT virtual void TriedronDisplay (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronPosition APosition = Aspect_TOTP_CENTER, const Quantity_NameOfColor AColor = Quantity_NOC_WHITE, const Standard_Real AScale = 0.02, const Standard_Boolean AsWireframe = Standard_True) = 0;
//! call_togl_triedron_erase
Standard_EXPORT virtual void TriedronErase (const Graphic3d_CView& ACView) = 0;
//! call_togl_triedron_echo
Standard_EXPORT virtual void TriedronEcho (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE) = 0;
//! call_togl_graduatedtrihedron_display
Standard_EXPORT virtual void GraduatedTrihedronDisplay (const Graphic3d_CView& theView, const Graphic3d_GraduatedTrihedron& theCubic) = 0;
//! call_togl_graduatedtrihedron_erase
Standard_EXPORT virtual void GraduatedTrihedronErase (const Graphic3d_CView& theView) = 0;
//! Sets minimum and maximum points of scene bounding box for Graduated Trihedron
//! stored in graphic view object.
//! @param theView [in] current graphic view
//! @param theMin [in] the minimum point of scene.
//! @param theMax [in] the maximum point of scene.
Standard_EXPORT virtual void GraduatedTrihedronMinMaxValues (const Graphic3d_CView& theView, const Graphic3d_Vec3 theMin, const Graphic3d_Vec3 theMax) = 0;
//! @param theDrawToFrontBuffer Advanced option to modify rendering mode:
//! 1. TRUE. Drawing immediate mode structures directly to the front buffer over the scene image.
//! Fast, so preferred for interactive work (used by default).
//! However these extra drawings will be missed in image dump since it is performed from back buffer.
//! Notice that since no pre-buffering used the V-Sync will be ignored and rendering could be seen
//! in run-time (in case of slow hardware) and/or tearing may appear.
//! So this is strongly recommended to draw only simple (fast) structures.
//! 2. FALSE. Drawing immediate mode structures to the back buffer.
//! The complete scene is redrawn first, so this mode is slower if scene contains complex data and/or V-Sync is turned on.
//! But it works in any case and is especially useful for view dump because the dump image is read from the back buffer.
//! @return previous mode.
Standard_EXPORT virtual Standard_Boolean SetImmediateModeDrawToFront (const Graphic3d_CView& theCView, const Standard_Boolean theDrawToFrontBuffer) = 0;
Standard_EXPORT virtual Standard_ShortReal DefaultTextHeight() const = 0;
virtual Standard_ShortReal DefaultTextHeight() const = 0;
//! call_togl_textsize2d
Standard_EXPORT virtual void TextSize (const Standard_CString AText, const Standard_ShortReal AHeight, Standard_ShortReal& AWidth, Standard_ShortReal& AnAscent, Standard_ShortReal& ADescent) const = 0;
//! call_togl_backfacing
Standard_EXPORT virtual void SetBackFacingModel (const Graphic3d_CView& aView) = 0;
//! Reads depths of shown pixels of the given
//! rectangle (glReadPixels with GL_DEPTH_COMPONENT)
Standard_EXPORT virtual void ReadDepths (const Graphic3d_CView& view, const Standard_Integer x, const Standard_Integer y, const Standard_Integer width, const Standard_Integer height, const Standard_Address buffer) const = 0;
//! Generate offscreen FBO in the graphic library.
//! If not supported on hardware returns NULL.
Standard_EXPORT virtual Graphic3d_PtrFrameBuffer FBOCreate (const Graphic3d_CView& view, const Standard_Integer width, const Standard_Integer height) = 0;
//! Remove offscreen FBO from the graphic library
Standard_EXPORT virtual void FBORelease (const Graphic3d_CView& view, Graphic3d_PtrFrameBuffer& fboPtr) = 0;
//! Read offscreen FBO configuration.
Standard_EXPORT virtual void FBOGetDimensions (const Graphic3d_CView& view, const Graphic3d_PtrFrameBuffer fboPtr, Standard_Integer& width, Standard_Integer& height, Standard_Integer& widthMax, Standard_Integer& heightMax) = 0;
//! Change offscreen FBO viewport.
Standard_EXPORT virtual void FBOChangeViewport (const Graphic3d_CView& view, Graphic3d_PtrFrameBuffer& fboPtr, const Standard_Integer width, const Standard_Integer height) = 0;
//! Dump active rendering buffer into specified memory buffer.
Standard_EXPORT virtual Standard_Boolean BufferDump (const Graphic3d_CView& theCView, Image_PixMap& theImage, const Graphic3d_BufferType& theBufferType) = 0;
//! call_togl_gllight
Standard_EXPORT virtual void SetGLLightEnabled (const Graphic3d_CView& view, const Standard_Boolean isEnabled) const = 0;
//! call_togl_isgllight
Standard_EXPORT virtual Standard_Boolean IsGLLightEnabled (const Graphic3d_CView& view) const = 0;
//! print the contents of all layers of the view to the printer.
//! <hPrnDC> : Pass the PrinterDeviceContext (HDC),
//! <showBackground> : When set to FALSE then print the view without background color
//! (background is white)
//! else set to TRUE for printing with current background color.
//! <filename>: If != NULL, then the view will be printed to a file.
//! <printAlgorithm>: Select print algorithm: stretch, tile.
//! <theScaleFactor>: Scaling coefficient, used internally to scale the
//! printings accordingly to the scale factor selected in the printer
//! properties dialog.
//! Returns Standard_True if the data is passed to the printer, otherwise
//! Standard_False if the print operation failed due to the printer errors,
//! or insufficient system memory available.
Standard_EXPORT virtual Standard_Boolean Print (const Graphic3d_CView& ACView, const Aspect_Handle hPrnDC, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm = Aspect_PA_STRETCH, const Standard_Real theScaleFactor = 1.0) const = 0;
virtual void TextSize (const Standard_CString AText, const Standard_ShortReal AHeight, Standard_ShortReal& AWidth, Standard_ShortReal& AnAscent, Standard_ShortReal& ADescent) const = 0;
//! Export scene into the one of the Vector graphics formats (SVG, PS, PDF...).
//! In contrast to Bitmaps, Vector graphics is scalable (so you may got quality benefits on printing to laser printer).
//! Notice however that results may differ a lot and do not contain some elements.
Standard_EXPORT virtual Standard_Boolean Export (const Standard_CString theFileName, const Graphic3d_ExportFormat theFormat, const Graphic3d_SortType theSortType, const Standard_Integer theWidth, const Standard_Integer theHeight, const Graphic3d_CView& theView, const Standard_Real thePrecision = 0.005, const Standard_Address theProgressBarFunc = NULL, const Standard_Address theProgressObject = NULL) = 0;
//! Marks BVH tree and the set of BVH primitives of correspondent priority list with id theLayerId as outdated.
Standard_EXPORT virtual void InvalidateBVHData (Graphic3d_CView& theCView, const Standard_Integer theLayerId) = 0;
//! Add a new top-level z layer with ID <theLayerId> for
//! the view. Z layers allow drawing structures in higher layers
//! in foreground of structures in lower layers. To add a structure
//! to desired layer on display it is necessary to set the layer
//! ID for the structure.
Standard_EXPORT virtual void AddZLayer (const Graphic3d_CView& theCView, const Graphic3d_ZLayerId theLayerId) = 0;
//! Remove Z layer from the specified view. All structures
//! displayed at the moment in layer will be displayed in default layer
//! ( the bottom-level z layer ). To unset layer ID from associated
//! structures use method UnsetZLayer (...).
Standard_EXPORT virtual void RemoveZLayer (const Graphic3d_CView& theCView, const Graphic3d_ZLayerId theLayerId) = 0;
//! Unset Z layer ID for all structures. The structure
//! indexes will be set to default layer ( the bottom-level z layer
//! with ID = 0 ).
Standard_EXPORT virtual void UnsetZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
virtual void AddZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
//! Change Z layer of a structure already presented in view.
Standard_EXPORT virtual void ChangeZLayer (const Graphic3d_CStructure& theCStructure, const Graphic3d_CView& theCView, const Graphic3d_ZLayerId theNewLayerId) = 0;
//! Sets the settings for a single Z layer of specified view.
Standard_EXPORT virtual void SetZLayerSettings (const Graphic3d_CView& theCView, const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerSettings& theSettings) = 0;
//! Removes Z layer. All structures displayed at the moment in layer will be displayed in
//! default layer (the bottom-level z layer). By default, there are always default
//! bottom-level layer that can't be removed. The passed theLayerId should be not less than 0
//! (reserved for default layers that can not be removed).
virtual void RemoveZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
//! Returns list of Z layers defined for the graphical driver.
virtual void ZLayers (TColStd_SequenceOfInteger& theLayerSeq) const = 0;
//! Sets the settings for a single Z layer.
virtual void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerSettings& theSettings) = 0;
//! Returns the settings of a single Z layer.
virtual Graphic3d_ZLayerSettings ZLayerSettings (const Graphic3d_ZLayerId theLayerId) = 0;
//! Returns view associated with the window if it is exists and is activated.
//! Returns Standard_True if the view associated to the window exists.
virtual Standard_Boolean ViewExists (const Handle(Aspect_Window)& theWindow, Handle(Graphic3d_CView)& theView) = 0;
//! Changes the priority of a structure within its Z layer in the specified view.
Standard_EXPORT virtual void ChangePriority (const Graphic3d_CStructure& theCStructure, const Graphic3d_CView& theCView, const Standard_Integer theNewPriority) = 0;
Standard_EXPORT void PrintBoolean (const Standard_CString AComment, const Standard_Boolean AValue) const;
Standard_EXPORT void PrintCLight (const Graphic3d_CLight& ACLight, const Standard_Integer AField) const;
@@ -311,15 +159,12 @@ public:
Standard_EXPORT void ResetDeviceLostFlag();
DEFINE_STANDARD_RTTI(Graphic3d_GraphicDriver,MMgt_TShared)
protected:
//! Initialises the Driver
//! Initializes the Driver
Standard_EXPORT Graphic3d_GraphicDriver(const Handle(Aspect_DisplayConnection)& theDisp);
Standard_Integer MyTraceLevel;

View File

@@ -259,10 +259,7 @@ void Graphic3d_Group::Update() const
return;
}
if (myStructure->StructureManager()->UpdateMode() == Aspect_TOU_ASAP)
{
myStructure->StructureManager()->Update();
}
myStructure->StructureManager()->Update (myStructure->StructureManager()->UpdateMode());
}
// =======================================================================

View File

@@ -95,14 +95,6 @@ public:
//! one of reflection modes (ambient, diffuse, specular or emissive)
//! enabled. See also SetReflectionModeOn() and SetReflectionModeOff() methods.
//!
//! NOTE: In order for transparency specified through this method to
//! take effect, it is necessary to enable transparency
//! in the viewer. This can be done either directly -
//! see Visual3d_ViewManager::SetTransparency(Standard_Boolean),
//! or indirectly - by calling AIS_InteractiveObject::SetTransparency()
//! before an object is added to an interactive context, or by
//! calling AIS_InteractiveContext::SetTransparency() for a given
//! interactive object already displayed.
//! Category: Methods to modify the class definition
//! Warning: Raises MaterialDefinitionError if <AValue> is a
//! negative value or greater than 1.0.

View File

@@ -53,7 +53,7 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
myOwner (NULL),
myVisual (Graphic3d_TOS_ALL)
{
myCStructure = theManager->GraphicDriver()->Structure (theManager);
myCStructure = theManager->GraphicDriver()->CreateStructure (theManager);
// default aspects
Handle(Graphic3d_AspectLine3d) aAspectLine3d = new Graphic3d_AspectLine3d();
@@ -2033,10 +2033,7 @@ void Graphic3d_Structure::Update() const
return;
}
if (myStructureManager->UpdateMode() == Aspect_TOU_ASAP)
{
myStructureManager->Update();
}
myStructureManager->Update (myStructureManager->UpdateMode());
}
//=============================================================================

View File

@@ -42,6 +42,7 @@ static Standard_Integer StructureManager_CurrentId = 0;
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver)
: myViewGenId (0, 31)
{
Standard_Real Coef;
@@ -81,17 +82,17 @@ Standard_Integer Limit = Graphic3d_StructureManager::Limit ();
Aspect_GenId theGenId(
Standard_Integer (Structure_IDMIN+Coef*(StructureManager_CurrentId)),
Standard_Integer (Structure_IDMIN+Coef*(StructureManager_CurrentId+1)-1));
MyStructGenId = theGenId;
myStructGenId = theGenId;
MyId = StructureManager_CurrentId;
myId = StructureManager_CurrentId;
MyAspectLine3d = new Graphic3d_AspectLine3d ();
MyAspectText3d = new Graphic3d_AspectText3d ();
MyAspectMarker3d = new Graphic3d_AspectMarker3d ();
MyAspectFillArea3d = new Graphic3d_AspectFillArea3d ();
myAspectLine3d = new Graphic3d_AspectLine3d ();
myAspectText3d = new Graphic3d_AspectText3d ();
myAspectMarker3d = new Graphic3d_AspectMarker3d ();
myAspectFillArea3d = new Graphic3d_AspectFillArea3d ();
MyUpdateMode = Aspect_TOU_WAIT;
MyGraphicDriver = theDriver;
myUpdateMode = Aspect_TOU_WAIT;
myGraphicDriver = theDriver;
}
@@ -99,103 +100,150 @@ Standard_Integer Limit = Graphic3d_StructureManager::Limit ();
void Graphic3d_StructureManager::Destroy () {
MyDisplayedStructure.Clear ();
MyHighlightedStructure.Clear ();
StructureManager_ArrayId[MyId] = 0;
myDisplayedStructure.Clear ();
myHighlightedStructure.Clear ();
myDefinedViews.Clear();
StructureManager_ArrayId[myId] = 0;
}
//-Methods, in order
void Graphic3d_StructureManager::SetUpdateMode (const Aspect_TypeOfUpdate AType) {
MyUpdateMode = AType;
// ========================================================================
// function : SetUpdateMode
// purpose :
// ========================================================================
void Graphic3d_StructureManager::SetUpdateMode (const Aspect_TypeOfUpdate theType)
{
myUpdateMode = theType;
}
Aspect_TypeOfUpdate Graphic3d_StructureManager::UpdateMode () const {
return (MyUpdateMode);
// ========================================================================
// function : UpdateMode
// purpose :
// ========================================================================
Aspect_TypeOfUpdate Graphic3d_StructureManager::UpdateMode() const
{
return myUpdateMode;
}
// ========================================================================
// function : Update
// purpose :
// ========================================================================
void Graphic3d_StructureManager::Update (const Aspect_TypeOfUpdate theMode) const
{
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->Update (theMode);
}
}
// ========================================================================
// function : Remove
// purpose :
// ========================================================================
void Graphic3d_StructureManager::Remove()
{
// clear all structures whilst views are alive for correct GPU memory management
myDisplayedStructure.Clear();
myHighlightedStructure.Clear();
// clear list of managed views
myDefinedViews.Clear();
}
// ========================================================================
// function : Erase
// purpose :
// ========================================================================
void Graphic3d_StructureManager::Erase()
{
for (Graphic3d_MapIteratorOfMapOfStructure anIt (myDisplayedStructure); anIt.More(); anIt.Next())
{
anIt.Key()->Erase();
}
}
void Graphic3d_StructureManager::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX) {
MyAspectLine3d = CTX;
myAspectLine3d = CTX;
}
void Graphic3d_StructureManager::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX) {
MyAspectFillArea3d = CTX;
myAspectFillArea3d = CTX;
}
void Graphic3d_StructureManager::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX) {
MyAspectText3d = CTX;
myAspectText3d = CTX;
}
void Graphic3d_StructureManager::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX) {
MyAspectMarker3d = CTX;
myAspectMarker3d = CTX;
}
void Graphic3d_StructureManager::PrimitivesAspect (Handle(Graphic3d_AspectLine3d)& CTXL, Handle(Graphic3d_AspectText3d)& CTXT, Handle(Graphic3d_AspectMarker3d)& CTXM, Handle(Graphic3d_AspectFillArea3d)& CTXF) const {
CTXL = MyAspectLine3d;
CTXT = MyAspectText3d;
CTXM = MyAspectMarker3d;
CTXF = MyAspectFillArea3d;
CTXL = myAspectLine3d;
CTXT = myAspectText3d;
CTXM = myAspectMarker3d;
CTXF = myAspectFillArea3d;
}
Handle(Graphic3d_AspectLine3d) Graphic3d_StructureManager::Line3dAspect () const {
return (MyAspectLine3d);
return (myAspectLine3d);
}
Handle(Graphic3d_AspectText3d) Graphic3d_StructureManager::Text3dAspect () const {
return (MyAspectText3d);
return (myAspectText3d);
}
Handle(Graphic3d_AspectMarker3d) Graphic3d_StructureManager::Marker3dAspect () const {
return (MyAspectMarker3d);
return (myAspectMarker3d);
}
Handle(Graphic3d_AspectFillArea3d) Graphic3d_StructureManager::FillArea3dAspect () const {
return (MyAspectFillArea3d);
return (myAspectFillArea3d);
}
void Graphic3d_StructureManager::Remove (const Standard_Integer AnId) {
void Graphic3d_StructureManager::Remove (const Standard_Integer theId) {
MyStructGenId.Free (AnId);
myStructGenId.Free (theId);
}
void Graphic3d_StructureManager::DisplayedStructures (Graphic3d_MapOfStructure& SG) const {
SG.Assign(MyDisplayedStructure);
SG.Assign(myDisplayedStructure);
//JMBStandard_Integer Length = MyDisplayedStructure.Length ();
//JMBStandard_Integer Length = myDisplayedStructure.Length ();
//JMBfor (Standard_Integer i=1; i<=Length; i++)
//JMB SG.Add (MyDisplayedStructure.Value (i));
//JMB SG.Add (myDisplayedStructure.Value (i));
}
Standard_Integer Graphic3d_StructureManager::NumberOfDisplayedStructures () const {
Standard_Integer Length = MyDisplayedStructure.Extent ();
Standard_Integer Length = myDisplayedStructure.Extent ();
return (Length);
@@ -203,19 +251,19 @@ Standard_Integer Length = MyDisplayedStructure.Extent ();
//Handle(Graphic3d_Structure) Graphic3d_StructureManager::DisplayedStructure (const Standard_Integer AnIndex) const {
//return (MyDisplayedStructure.Value (AnIndex));
//return (myDisplayedStructure.Value (AnIndex));
//}
void Graphic3d_StructureManager::HighlightedStructures (Graphic3d_MapOfStructure& SG) const {
SG.Assign(MyHighlightedStructure);
SG.Assign(myHighlightedStructure);
}
Standard_Integer Graphic3d_StructureManager::NewIdentification () {
Standard_Integer Id = MyStructGenId.Next ();
Standard_Integer Id = myStructGenId.Next ();
return Id;
@@ -228,7 +276,7 @@ Handle(Graphic3d_Structure) Graphic3d_StructureManager::Identification (const St
Handle(Graphic3d_Structure) StructNull;
Graphic3d_MapIteratorOfMapOfStructure it( MyDisplayedStructure);
Graphic3d_MapIteratorOfMapOfStructure it( myDisplayedStructure);
Handle(Graphic3d_Structure) SGfound;
@@ -250,7 +298,7 @@ Handle(Graphic3d_Structure) Graphic3d_StructureManager::Identification (const St
Standard_Integer Graphic3d_StructureManager::Identification () const {
return (MyId);
return (myId);
}
@@ -268,7 +316,7 @@ Standard_Integer Graphic3d_StructureManager::CurrentId () {
const Handle(Graphic3d_GraphicDriver)& Graphic3d_StructureManager::GraphicDriver () const {
return (MyGraphicDriver);
return (myGraphicDriver);
}
@@ -277,7 +325,7 @@ void Graphic3d_StructureManager::RecomputeStructures()
// Go through all unique structures including child (connected) ones and ensure that they are computed.
Graphic3d_MapOfStructure aStructNetwork;
for (Graphic3d_MapIteratorOfMapOfStructure anIter(MyDisplayedStructure); anIter.More(); anIter.Next())
for (Graphic3d_MapIteratorOfMapOfStructure anIter(myDisplayedStructure); anIter.More(); anIter.Next())
{
Handle(Graphic3d_Structure) aStructure = anIter.Key();
anIter.Key()->Network (anIter.Key(), Graphic3d_TOC_DESCENDANT, aStructNetwork);
@@ -320,3 +368,244 @@ Handle(Graphic3d_ViewAffinity) Graphic3d_StructureManager::ObjectAffinity (const
myRegisteredObjects.Find (theObject.operator->(), aResult);
return aResult;
}
// ========================================================================
// function : Identification
// purpose :
// ========================================================================
Standard_Integer Graphic3d_StructureManager::Identification (Graphic3d_CView* theView)
{
if (myDefinedViews.Contains (theView))
{
return theView->Identification();
}
myDefinedViews.Add (theView);
return myViewGenId.Next();
}
// ========================================================================
// function : UnIdentification
// purpose :
// ========================================================================
void Graphic3d_StructureManager::UnIdentification (Graphic3d_CView* theView)
{
if (myDefinedViews.Contains (theView))
{
myDefinedViews.Swap (myDefinedViews.FindIndex (theView), myDefinedViews.Size());
myDefinedViews.RemoveLast();
myViewGenId.Free (theView->Identification());
}
}
// ========================================================================
// function : DefinedViews
// purpose :
// ========================================================================
const Graphic3d_IndexedMapOfView& Graphic3d_StructureManager::DefinedViews() const
{
return myDefinedViews;
}
// ========================================================================
// function : MaxNumOfViews
// purpose :
// ========================================================================
Standard_Integer Graphic3d_StructureManager::MaxNumOfViews() const
{
return myViewGenId.Upper() - myViewGenId.Lower() + 1;
}
// ========================================================================
// function : ReCompute
// purpose :
// ========================================================================
void Graphic3d_StructureManager::ReCompute (const Handle(Graphic3d_Structure)& theStructure)
{
if (!myDisplayedStructure.Contains (theStructure))
{
return;
}
// Recompute structure for all defined views
for (Standard_Integer aViewIt = 1; aViewIt <= myDefinedViews.Extent(); ++aViewIt)
{
ReCompute (theStructure, myDefinedViews (aViewIt));
}
}
// ========================================================================
// function : ReCompute
// purpose :
// ========================================================================
void Graphic3d_StructureManager::ReCompute (const Handle(Graphic3d_Structure)& theStructure,
const Handle(Graphic3d_DataStructureManager)& theProjector)
{
Handle(Graphic3d_CView) aView = Handle(Graphic3d_CView)::DownCast (theProjector);
if (aView.IsNull()
|| !myDefinedViews.Contains (aView.operator->())
|| !myDisplayedStructure.Contains (theStructure))
{
return;
}
aView->ReCompute (theStructure);
}
// ========================================================================
// function : Clear
// purpose :
// ========================================================================
void Graphic3d_StructureManager::Clear (const Handle(Graphic3d_Structure)& theStructure,
const Standard_Boolean theWithDestruction)
{
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->Clear (theStructure, theWithDestruction);
}
}
// ========================================================================
// function : Connect
// purpose :
// ========================================================================
void Graphic3d_StructureManager::Connect (const Handle(Graphic3d_Structure)& theMother,
const Handle(Graphic3d_Structure)& theDaughter)
{
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->Connect (theMother, theDaughter);
}
}
// ========================================================================
// function : Disconnect
// purpose :
// ========================================================================
void Graphic3d_StructureManager::Disconnect (const Handle(Graphic3d_Structure)& theMother,
const Handle(Graphic3d_Structure)& theDaughter)
{
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->Disconnect (theMother, theDaughter);
}
}
// ========================================================================
// function : Display
// purpose :
// ========================================================================
void Graphic3d_StructureManager::Display (const Handle(Graphic3d_Structure)& theStructure)
{
myDisplayedStructure.Add (theStructure);
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->Display (theStructure);
}
}
// ========================================================================
// function : Erase
// purpose :
// ========================================================================
void Graphic3d_StructureManager::Erase (const Handle(Graphic3d_Structure)& theStructure)
{
myDisplayedStructure .Remove(theStructure);
myHighlightedStructure.Remove (theStructure);
// Erase structure in all defined views
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->Erase (theStructure);
}
}
// ========================================================================
// function : Erase
// purpose :
// ========================================================================
void Graphic3d_StructureManager::Highlight (const Handle(Graphic3d_Structure)& theStructure,
const Aspect_TypeOfHighlightMethod theMethod)
{
myHighlightedStructure.Add (theStructure);
// Highlight in all defined views
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->Highlight (theStructure, theMethod);
}
}
// ========================================================================
// function : UnHighlight
// purpose :
// ========================================================================
void Graphic3d_StructureManager::UnHighlight (const Handle(Graphic3d_Structure)& theStructure)
{
myHighlightedStructure.Remove (theStructure);
// UnHighlight in all defined views
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->UnHighlight (theStructure);
}
}
// ========================================================================
// function : UnHighlight
// purpose :
// ========================================================================
void Graphic3d_StructureManager::UnHighlight()
{
for (Graphic3d_MapIteratorOfMapOfStructure anIt (myHighlightedStructure); anIt.More(); anIt.Next())
{
anIt.Key()->UnHighlight();
}
}
// ========================================================================
// function : SetTransform
// purpose :
// ========================================================================
void Graphic3d_StructureManager::SetTransform (const Handle(Graphic3d_Structure)& theStructure,
const TColStd_Array2OfReal& theTrsf)
{
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->SetTransform (theStructure, theTrsf);
}
}
// ========================================================================
// function : ChangeDisplayPriority
// purpose :
// ========================================================================
void Graphic3d_StructureManager::ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure,
const Standard_Integer theOldPriority,
const Standard_Integer theNewPriority)
{
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->ChangePriority (theStructure, theOldPriority, theNewPriority);
}
}
//=======================================================================
//function : ChangeZLayer
//purpose :
//=======================================================================
void Graphic3d_StructureManager::ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure,
const Graphic3d_ZLayerId theLayerId)
{
if (!myDisplayedStructure.Contains (theStructure))
{
return;
}
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->ChangeZLayer (theStructure, theLayerId);
}
}

View File

@@ -17,22 +17,26 @@
#ifndef _Graphic3d_StructureManager_HeaderFile
#define _Graphic3d_StructureManager_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <Aspect_TypeOfUpdate.hxx>
#include <Graphic3d_MapOfStructure.hxx>
#include <Graphic3d_MapOfObject.hxx>
#include <Aspect_GenId.hxx>
#include <MMgt_TShared.hxx>
#include <Aspect_TypeOfHighlightMethod.hxx>
#include <Aspect_TypeOfUpdate.hxx>
#include <Graphic3d_CView.hxx>
#include <Graphic3d_MapOfObject.hxx>
#include <Graphic3d_MapOfStructure.hxx>
#include <Graphic3d_ViewAffinity.hxx>
#include <Graphic3d_ZLayerId.hxx>
#include <Graphic3d_ZLayerSettings.hxx>
#include <MMgt_TShared.hxx>
#include <NCollection_IndexedMap.hxx>
#include <Standard.hxx>
#include <Standard_Boolean.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <Aspect_TypeOfHighlightMethod.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Type.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <Graphic3d_ViewAffinity.hxx>
#include <TColStd_SequenceOfInteger.hxx>
typedef NCollection_IndexedMap<Graphic3d_CView*> Graphic3d_IndexedMapOfView;
class Graphic3d_AspectLine3d;
class Graphic3d_AspectText3d;
class Graphic3d_AspectMarker3d;
@@ -43,7 +47,6 @@ class Graphic3d_Structure;
class Graphic3d_DataStructureManager;
class Standard_Transient;
class Graphic3d_StructureManager;
DEFINE_STANDARD_HANDLE(Graphic3d_StructureManager, MMgt_TShared)
@@ -55,226 +58,209 @@ DEFINE_STANDARD_HANDLE(Graphic3d_StructureManager, MMgt_TShared)
//! Destroy, Highlight, Visible
class Graphic3d_StructureManager : public MMgt_TShared
{
public:
//! Initializes the ViewManager.
//! Currently creating of more than 100 viewer instances
//! is not supported and leads to InitializationError and
//! initialization failure.
//! This limitation might be addressed in some future OCCT releases.
//! Warning: Raises InitialisationError if the initialization
//! of the ViewManager failed.
Standard_EXPORT Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver);
//! Deletes the manager <me>.
Standard_EXPORT virtual void Destroy();
~Graphic3d_StructureManager()
{
Destroy();
}
//! Modifies the default attributes for lines
//! in the visualiser.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX);
//! Modifies the default attributes for faces
//! in the visualiser.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX);
//! Modifies the default attributes for text
//! in the visualiser.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX);
//! Modifies the default attributes for markers
//! in the visualiser.
Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX);
//! Modifies the screen update mode.
//!
//! TOU_ASAP as soon as possible
//! TOU_WAIT on demand (with the Update function)
//! TOU_ASAP - as soon as possible
//! TOU_WAIT - on demand (with the Update function)
//! Note : Dynamic Operations and Update Mode
//! Use SetUpdateMode to control when changes to
//! the display are made. Use one of the following
//! functions to update one or more views:
//! - Update all views of the viewer: Visual3d_ViewManager::Update ()
//! - Update one view of the viewer: Visual3d_View::Update () Use one of
//! the following functions to update the entire display:
//! - Redraw all structures in all views: Visual3d_ViewManager::Redraw ()
//! - Redraw all structures in one view: Visual3d_View::Redraw () Update)
Standard_EXPORT void SetUpdateMode (const Aspect_TypeOfUpdate AType);
//! Updates screen in function of modifications of
//! the structures.
//! Warning: Not necessary if the update mode is TOU_ASAP.
Standard_EXPORT virtual void Update() const = 0;
//! Returns the set of structures displayed in
//! visualiser <me>.
Standard_EXPORT void DisplayedStructures (Graphic3d_MapOfStructure& SG) const;
//! Returns the set of highlighted structures
//! in a visualiser <me>.
Standard_EXPORT void HighlightedStructures (Graphic3d_MapOfStructure& SG) const;
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectFillArea3d) FillArea3dAspect() const;
//! Returns maximum number of managers defineable.
Standard_EXPORT static Standard_Integer Limit();
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectLine3d) Line3dAspect() const;
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectMarker3d) Marker3dAspect() const;
//! Returns the values of the current default attributes.
Standard_EXPORT void PrimitivesAspect (Handle(Graphic3d_AspectLine3d)& CTXL, Handle(Graphic3d_AspectText3d)& CTXT, Handle(Graphic3d_AspectMarker3d)& CTXM, Handle(Graphic3d_AspectFillArea3d)& CTXF) const;
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectText3d) Text3dAspect() const;
//! - Update all views of the viewer: Graphic3d_StructureManager::Update()
//! - Update one view of the viewer: Graphic3d_View::Update()
//! Use one of the following functions to update the entire display:
//! - Redraw all structures in all views: Graphic3d_StructureManager::Redraw()
//! - Redraw all structures in one view: Graphic3d_View::Redraw()
Standard_EXPORT void SetUpdateMode (const Aspect_TypeOfUpdate theType);
//! Returns the screen update mode.
//!
//! TOU_ASAP as soon as possible
//! TOU_WAIT on demand (Update)
Standard_EXPORT Aspect_TypeOfUpdate UpdateMode() const;
//! Changes the display priority of the structure <AStructure>.
Standard_EXPORT virtual void ChangeDisplayPriority (const Handle(Graphic3d_Structure)& AStructure, const Standard_Integer OldPriority, const Standard_Integer NewPriority) = 0;
//! Change Z layer for structure. The z layer mechanism allows
//! to display structures in higher layers in overlay of structures in
//! lower layers.
Standard_EXPORT virtual void ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure, const Graphic3d_ZLayerId theLayerId) = 0;
//! Sets the settings for a single Z layer for all managed views.
Standard_EXPORT virtual void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerSettings& theSettings) = 0;
//! Returns the settings of a single Z layer.
Standard_EXPORT virtual Graphic3d_ZLayerSettings ZLayerSettings (const Graphic3d_ZLayerId theLayerId) = 0;
//! Add a new top-level Z layer and get its ID as
//! <theLayerId> value. The method returns Standard_False if the layer
//! can not be created. The z layer mechanism allows to display
//! structures in higher layers in overlay of structures in lower layers.
Standard_EXPORT virtual Standard_Boolean AddZLayer (Graphic3d_ZLayerId& theLayerId) = 0;
//! Remove Z layer with ID <theLayerId>. Method returns
//! Standard_False if the layer can not be removed or doesn't exists.
//! By default, there is always a default bottom-level layer that can't
//! be removed.
Standard_EXPORT virtual Standard_Boolean RemoveZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
//! Return all Z layer ids in sequence ordered by level
//! from lowest layer to highest. The first layer ID in sequence is
//! the default layer that can't be removed.
Standard_EXPORT virtual void GetAllZLayers (TColStd_SequenceOfInteger& theLayerSeq) const = 0;
//! Updates screen in function of modifications of the structures.
Standard_EXPORT virtual void Update (const Aspect_TypeOfUpdate theMode = Aspect_TOU_ASAP) const;
//! Deletes and erases the 3D structure manager.
Standard_EXPORT virtual void Remove();
//! Erases all the structures.
Standard_EXPORT virtual void Erase();
//! Returns the set of structures displayed in
//! visualiser <me>.
Standard_EXPORT void DisplayedStructures (Graphic3d_MapOfStructure& SG) const;
//! Returns the set of highlighted structures
//! in a visualiser <me>.
Standard_EXPORT void HighlightedStructures (Graphic3d_MapOfStructure& SG) const;
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectFillArea3d) FillArea3dAspect() const;
//! Returns maximum number of managers defineable.
Standard_EXPORT static Standard_Integer Limit();
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectLine3d) Line3dAspect() const;
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectMarker3d) Marker3dAspect() const;
//! Returns the values of the current default attributes.
Standard_EXPORT void PrimitivesAspect (Handle(Graphic3d_AspectLine3d)& CTXL, Handle(Graphic3d_AspectText3d)& CTXT, Handle(Graphic3d_AspectMarker3d)& CTXM, Handle(Graphic3d_AspectFillArea3d)& CTXF) const;
//! Returns the values of the current default attributes.
Standard_EXPORT Handle(Graphic3d_AspectText3d) Text3dAspect() const;
//! Returns a current identifier available.
Standard_EXPORT static Standard_Integer CurrentId();
//! Forces a new construction of the structure <AStructure>
//! if <AStructure> is displayed and TOS_COMPUTED.
Standard_EXPORT virtual void ReCompute (const Handle(Graphic3d_Structure)& AStructure) = 0;
//! Forces a new construction of the structure <AStructure>
//! if <AStructure> is displayed in <AProjector> and TOS_COMPUTED.
Standard_EXPORT virtual void ReCompute (const Handle(Graphic3d_Structure)& AStructure, const Handle(Graphic3d_DataStructureManager)& AProjector) = 0;
//! Clears the structure <AStructure>.
Standard_EXPORT virtual void Clear (const Handle(Graphic3d_Structure)& AStructure, const Standard_Boolean WithDestruction) = 0;
//! Connects the structures <AMother> and <ADaughter>.
Standard_EXPORT virtual void Connect (const Handle(Graphic3d_Structure)& AMother, const Handle(Graphic3d_Structure)& ADaughter) = 0;
//! Disconnects the structures <AMother> and <ADaughter>.
Standard_EXPORT virtual void Disconnect (const Handle(Graphic3d_Structure)& AMother, const Handle(Graphic3d_Structure)& ADaughter) = 0;
//! Display the structure <AStructure>.
Standard_EXPORT virtual void Display (const Handle(Graphic3d_Structure)& AStructure) = 0;
//! Erases the structure <AStructure>.
Standard_EXPORT virtual void Erase (const Handle(Graphic3d_Structure)& AStructure) = 0;
//! Highlights the structure <AStructure>.
Standard_EXPORT virtual void Highlight (const Handle(Graphic3d_Structure)& AStructure, const Aspect_TypeOfHighlightMethod AMethod) = 0;
//! Transforms the structure <AStructure>.
Standard_EXPORT virtual void SetTransform (const Handle(Graphic3d_Structure)& AStructure, const TColStd_Array2OfReal& ATrsf) = 0;
//! Forces a new construction of the structure.
//! if <theStructure> is displayed and TOS_COMPUTED.
Standard_EXPORT virtual void ReCompute (const Handle(Graphic3d_Structure)& theStructure);
//! Forces a new construction of the structure.
//! if <theStructure> is displayed in <theProjector> and TOS_COMPUTED.
Standard_EXPORT virtual void ReCompute (const Handle(Graphic3d_Structure)& theStructure, const Handle(Graphic3d_DataStructureManager)& theProjector);
//! Clears the structure.
Standard_EXPORT virtual void Clear (const Handle(Graphic3d_Structure)& theStructure, const Standard_Boolean theWithDestruction);
//! Connects the structures.
Standard_EXPORT virtual void Connect (const Handle(Graphic3d_Structure)& theMother, const Handle(Graphic3d_Structure)& theDaughter);
//! Disconnects the structures.
Standard_EXPORT virtual void Disconnect (const Handle(Graphic3d_Structure)& theMother, const Handle(Graphic3d_Structure)& theDaughter);
//! Display the structure.
Standard_EXPORT virtual void Display (const Handle(Graphic3d_Structure)& theStructure);
//! Erases the structure.
Standard_EXPORT virtual void Erase (const Handle(Graphic3d_Structure)& theStructure);
//! Highlights the structure.
Standard_EXPORT virtual void Highlight (const Handle(Graphic3d_Structure)& theStructure, const Aspect_TypeOfHighlightMethod theMethod);
//! Transforms the structure.
Standard_EXPORT virtual void SetTransform (const Handle(Graphic3d_Structure)& theStructure, const TColStd_Array2OfReal& theTrsf);
//! Changes the display priority of the structure <AStructure>.
Standard_EXPORT virtual void ChangeDisplayPriority (const Handle(Graphic3d_Structure)& theStructure, const Standard_Integer theOldPriority, const Standard_Integer theNewPriority);
//! Change Z layer for structure. The Z layer mechanism allows to display structures in higher
//! layers in overlay of structures in lower layers.
Standard_EXPORT virtual void ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure, const Graphic3d_ZLayerId theLayerId);
//! Returns the graphic driver of <me>.
Standard_EXPORT const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const;
//! Attaches the view to this structure manager and sets its identification number within the manager.
Standard_EXPORT Standard_Integer Identification (Graphic3d_CView* theView);
//! Detach the view from this structure manager and release its identification.
Standard_EXPORT void UnIdentification (Graphic3d_CView* theView);
//! Returns the group of views defined in the structure manager.
Standard_EXPORT const Graphic3d_IndexedMapOfView& DefinedViews() const;
//! Returns the theoretical maximum number of definable views in the manager.
//! Warning: It's not possible to accept an infinite number of definable views because each
//! view must have an identification and we have different managers.
Standard_EXPORT Standard_Integer MaxNumOfViews() const;
//! Returns the identification number of the manager.
Standard_EXPORT virtual Standard_Integer Identification() const;
//! Returns the structure with the identification number <AId>.
Standard_EXPORT virtual Handle(Graphic3d_Structure) Identification (const Standard_Integer AId) const;
//! Returns a new identification number for a new structure in the manager.
Standard_EXPORT Standard_Integer NewIdentification();
//! Suppresses the highlighting on all the structures in <me>.
Standard_EXPORT virtual void UnHighlight() = 0;
//! Suppress the highlighting on the structure <AStructure>.
Standard_EXPORT virtual void UnHighlight (const Handle(Graphic3d_Structure)& AStructure) = 0;
Standard_EXPORT virtual void UnHighlight (const Handle(Graphic3d_Structure)& AStructure);
//! Suppresses the highlighting on all the structures in <me>.
Standard_EXPORT virtual void UnHighlight();
Standard_EXPORT void RecomputeStructures();
//! Recomputes all structures from theStructures.
Standard_EXPORT void RecomputeStructures (const Graphic3d_MapOfStructure& theStructures);
Standard_EXPORT Handle(Graphic3d_ViewAffinity) RegisterObject (const Handle(Standard_Transient)& theObject);
Standard_EXPORT void UnregisterObject (const Handle(Standard_Transient)& theObject);
Standard_EXPORT Handle(Graphic3d_ViewAffinity) ObjectAffinity (const Handle(Standard_Transient)& theObject) const;
friend class Graphic3d_Structure;
friend class Graphic3d_Structure;
DEFINE_STANDARD_RTTI(Graphic3d_StructureManager,MMgt_TShared)
protected:
//! Initialises the ViewManager.
//! Currently creating of more than 100 viewer instances
//! is not supported and leads to InitializationError and
//! initialisation failure.
//! This limitation might be addressed in some future OCCT releases.
//! Warning: Raises InitialisationError if the initialisation
//! of the ViewManager failed.
Standard_EXPORT Graphic3d_StructureManager(const Handle(Graphic3d_GraphicDriver)& theDriver);
//! Returns the number of structures displayed in
//! visualiser <me>.
//! Returns the structure displayed in visualiser <me>.
//! visualizer <me>.
//! Returns the structure displayed in visualizer <me>.
Standard_EXPORT Standard_Integer NumberOfDisplayedStructures() const;
Standard_Integer MyId;
Aspect_TypeOfUpdate MyUpdateMode;
Handle(Graphic3d_AspectLine3d) MyAspectLine3d;
Handle(Graphic3d_AspectText3d) MyAspectText3d;
Handle(Graphic3d_AspectMarker3d) MyAspectMarker3d;
Handle(Graphic3d_AspectFillArea3d) MyAspectFillArea3d;
Graphic3d_MapOfStructure MyDisplayedStructure;
Graphic3d_MapOfObject myRegisteredObjects;
Graphic3d_MapOfStructure MyHighlightedStructure;
Aspect_GenId MyStructGenId;
Handle(Graphic3d_GraphicDriver) MyGraphicDriver;
private:
//! Frees the identifieur <AnId>.
Standard_EXPORT void Remove (const Standard_Integer AnId);
//! Frees the identifier of a structure.
void Remove (const Standard_Integer theId);
protected:
Standard_Integer myId;
Aspect_GenId myStructGenId;
Aspect_GenId myViewGenId;
Aspect_TypeOfUpdate myUpdateMode;
Handle(Graphic3d_AspectLine3d) myAspectLine3d;
Handle(Graphic3d_AspectText3d) myAspectText3d;
Handle(Graphic3d_AspectMarker3d) myAspectMarker3d;
Handle(Graphic3d_AspectFillArea3d) myAspectFillArea3d;
Graphic3d_MapOfStructure myDisplayedStructure;
Graphic3d_MapOfStructure myHighlightedStructure;
Graphic3d_MapOfObject myRegisteredObjects;
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
Graphic3d_IndexedMapOfView myDefinedViews;
};
#endif // _Graphic3d_StructureManager_HeaderFile

View File

@@ -31,7 +31,7 @@ class TCollection_AsciiString;
class Graphic3d_TextureEnv;
DEFINE_STANDARD_HANDLE(Graphic3d_TextureEnv, Graphic3d_TextureRoot)
//! This class provides environment texture usable only in Visual3d_ContextView
//! This class provides environment texture.
class Graphic3d_TextureEnv : public Graphic3d_TextureRoot
{

View File

@@ -0,0 +1,33 @@
// Created on: 1991-10-07
// Created by: NW,JPB,CAL
// Copyright (c) 1991-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 _Graphic3d_TypeOfAnswer_HeaderFile
#define _Graphic3d_TypeOfAnswer_HeaderFile
//! The answer of the method AcceptDisplay
//! AcceptDisplay means is it possible to display the
//! specified structure in the specified view ?
//! TOA_YES yes
//! TOA_NO no
//! TOA_COMPUTE yes but we have to compute the representation
enum Graphic3d_TypeOfAnswer
{
Graphic3d_TOA_YES,
Graphic3d_TOA_NO,
Graphic3d_TOA_COMPUTE
};
#endif // _Graphic3d_TypeOfAnswer_HeaderFile

View File

@@ -0,0 +1,32 @@
// Created on: 1991-10-07
// Created by: NW,JPB,CAL
// Copyright (c) 1991-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 _Graphic3d_TypeOfBackfacingModel_HeaderFile
#define _Graphic3d_TypeOfBackfacingModel_HeaderFile
//! Modes of display of back faces in the view
//!
//! TOBM_AUTOMATIC graphic's structure setting is in use
//! TOBM_FORCE force display of back faces
//! TOBM_DISABLE disable display of back faces
enum Graphic3d_TypeOfBackfacingModel
{
Graphic3d_TOBM_AUTOMATIC,
Graphic3d_TOBM_FORCE,
Graphic3d_TOBM_DISABLE
};
#endif // _Graphic3d_TypeOfBackfacingModel_HeaderFile

View File

@@ -0,0 +1,34 @@
// Created on: 1991-10-07
// Created by: NW,JPB,CAL
// Copyright (c) 1991-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 _Graphic3d_TypeOfLightSource_HeaderFile
#define _Graphic3d_TypeOfLightSource_HeaderFile
//! Definition of all the type of light sources
//!
//! TOLS_AMBIENT ambient light
//! TOLS_DIRECTIONAL directional light
//! TOLS_POSITIONAL positional light
//! TOLS_SPOT spot light
enum Graphic3d_TypeOfLightSource
{
Graphic3d_TOLS_AMBIENT,
Graphic3d_TOLS_DIRECTIONAL,
Graphic3d_TOLS_POSITIONAL,
Graphic3d_TOLS_SPOT
};
#endif // _Graphic3d_TypeOfLightSource_HeaderFile

View File

@@ -0,0 +1,33 @@
// Created on: 1991-10-07
// Created by: NW,JPB,CAL
// Copyright (c) 1991-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 _Graphic3d_TypeOfShadingModel_HeaderFile
#define _Graphic3d_TypeOfShadingModel_HeaderFile
//! Definition of the rendering (colour shading) model
//! Graphic3d_TOSM_NONE No lighting, only white ambient light
//! Graphic3d_TOSM_FACET No interpolation, constant shading (Flat Shading)
//! Graphic3d_TOSM_VERTEX Interpolation of color based on normals (Gouraud Shading)
//! Graphic3d_TOSM_FRAGMENT Interpolation of color based on normals (Phong Shading)
enum Graphic3d_TypeOfShadingModel
{
Graphic3d_TOSM_NONE,
Graphic3d_TOSM_FACET,
Graphic3d_TOSM_VERTEX,
Graphic3d_TOSM_FRAGMENT
};
#endif // _Graphic3d_TypeOfShadingModel_HeaderFile

View File

@@ -0,0 +1,32 @@
// Created on: 1991-10-07
// Created by: NW,JPB,CAL
// Copyright (c) 1991-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 _Graphic3d_TypeOfSurfaceDetail_HeaderFile
#define _Graphic3d_TypeOfSurfaceDetail_HeaderFile
//! Modes of visualisation of objects in a view
//!
//! TOD_NONE no texture mapping
//! TOD_ENVIRONMENT only environnement mapping
//! TOD_ALL environnement + texture mapping
enum Graphic3d_TypeOfSurfaceDetail
{
Graphic3d_TOD_NONE,
Graphic3d_TOD_ENVIRONMENT,
Graphic3d_TOD_ALL
};
#endif // _Graphic3d_TypeOfSurfaceDetail_HeaderFile

View File

@@ -0,0 +1,30 @@
// Created on: 1991-10-07
// Created by: NW,JPB,CAL
// Copyright (c) 1991-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 _Graphic3d_TypeOfVisualization_HeaderFile
#define _Graphic3d_TypeOfVisualization_HeaderFile
//! Modes of visualisation of objects in a view
//!
//! TOV_WIREFRAME wireframe visualisation
//! TOV_SHADING shaded visualisation
enum Graphic3d_TypeOfVisualization
{
Graphic3d_TOV_WIREFRAME,
Graphic3d_TOV_SHADING
};
#endif // _Graphic3d_TypeOfVisualization_HeaderFile