Graphic3d_CView.hxx
Graphic3d_CGraduatedTrihedron.cxx
Graphic3d_CGraduatedTrihedron.hxx
-Graphic3d_GraphicDriver_1.cxx
-Graphic3d_GraphicDriver_2.cxx
-Graphic3d_GraphicDriver_3.cxx
-Graphic3d_GraphicDriver_4.cxx
-Graphic3d_GraphicDriver_5.cxx
-Graphic3d_GraphicDriver_6.cxx
-Graphic3d_GraphicDriver_7.cxx
-Graphic3d_GraphicDriver_703.cxx
-Graphic3d_GraphicDriver_705.cxx
-Graphic3d_GraphicDriver_707.cxx
-Graphic3d_GraphicDriver_709.cxx
-Graphic3d_GraphicDriver_710.cxx
-Graphic3d_GraphicDriver_711.cxx
-Graphic3d_GraphicDriver_712.cxx
-Graphic3d_GraphicDriver_8.cxx
-Graphic3d_GraphicDriver_9.cxx
-Graphic3d_GraphicDriver_Layer.cxx
-Graphic3d_GraphicDriver_Print.cxx
Graphic3d_Structure.pxx
Graphic3d_Group.pxx
Graphic3d_Group_1.cxx
Graphic3d_Group_9.cxx
Graphic3d_Group_10.cxx
Graphic3d_Group_11.cxx
-Graphic3d_Group_12.cxx
Graphic3d_Structure.pxx
Graphic3d_DataStructure.pxx
Graphic3d_StructureManager.pxx
Graphic3d_WOKSteps.edl
Graphic3d_PrimitiveArray.hxx
Graphic3d_Group_13.cxx
-Graphic3d_GraphicDriver_713.cxx
Graphic3d_TransModeFlags.hxx
Graphic3d_CTransPersStruct.hxx
Graphic3d_CTransPersStruct.cxx
-Graphic3d_GraphicDriver_Export.cxx
Graphic3d_NListOfHAsciiString.hxx
Graphic3d_AspectText3d.cxx
Graphic3d_WNTGraphicDevice.cxx
---Version:
- ---Purpose: This class allows the definition of a graphic
- -- driver and encapsulates the Pex driver, the
- -- OpenGl driver, the Optimizer driver and the Phigs driver.
+ ---Purpose: This class allows the definition of a graphic driver
+ -- (currently only OpenGl driver is used).
- ---Keywords: Pex, OpenGl, Optimizer, Phigs
+ ---Keywords: OpenGl
---Warning:
---References:
AColor2: Color from Quantity;
FillStyle : GradientFillMethod from Aspect
)
- is virtual;
+ is deferred;
---Purpose: call_togl_gradient_background
SetBgGradientStyle( me : mutable;
ACView : CView from Graphic3d;
FillStyle : GradientFillMethod from Aspect )
- is virtual;
+ is deferred;
ClipLimit ( me : mutable;
ACView : CView from Graphic3d;
is deferred;
---Purpose: call_togl_quadrangle
- QuadrangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is deferred;
- ---Purpose: call_togl_polygon_indices
-
- QuadrangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexN from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is deferred;
- ---Purpose: call_togl_polygon_indices
-
- QuadrangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexNT from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is deferred;
- ---Purpose: call_togl_polygon_indices
-
- QuadrangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexC from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is deferred;
- ---Purpose: call_togl_polygon_indices
-
- QuadrangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexNC from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is deferred;
- ---Purpose: call_togl_polygon_indices
-
----------------------------------------
-- Category: Methods to create Text
-- for Purpose : see Graphic3d_Group.cdl
EnableVBO( me : mutable;
status : Boolean from Standard )
- is virtual;
+ is deferred;
---Purpose: enables/disables usage of OpenGL vertex buffer arrays while drawing primitiev arrays
----------------------------------------
---Purpose: call_togl_graduatedtrihedron_minmaxvalues
is deferred;
- ----------------------------------------
- -- Category: Internal methods
- -- for Purpose : see Graphic3d_Group.cdl
- ----------------------------------------
-
- Bezier ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is deferred;
- ---Purpose: call_togl_bezier
-
- Bezier ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- ListWeight : Array1OfReal from TColStd;
- EvalMinMax : Boolean from Standard = Standard_True )
- is deferred;
- ---Purpose: call_togl_bezier_weight
-
---------------------------
-- Category: Animation mode
---------------------------
R : ShortReal from Standard;
G : ShortReal from Standard;
B : ShortReal from Standard )
- is virtual;
+ is deferred;
---Purpose: call_togl_set_text_attributes
Text ( me : mutable;
+++ /dev/null
-// File Graphic3d_GraphicDriver_1.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// Modified 02.15.100 : JR : Clutter
-// GG 27/12/02 IMP120302 Add new method Begin(Aspect_Display)
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-
-Standard_Boolean Graphic3d_GraphicDriver::Begin (const Standard_CString ) {
- return Standard_True;
-}
-
-//RIC120302
-Standard_Boolean Graphic3d_GraphicDriver::Begin (const Aspect_Display)
-{
- return Standard_True;
-}
-//RIC120302
-
-void Graphic3d_GraphicDriver::End () {
-}
-
-void Graphic3d_GraphicDriver::BeginAnimation (const Graphic3d_CView&
- )
-{
-}
-
-void Graphic3d_GraphicDriver::EndAnimation (const Graphic3d_CView&
- )
-{
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_2.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// 15/09/97 ; PCT : ajout InquireTextureAvailable() pour les textures
-// 11/97 ; CAL : retrait de la dependance avec math
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <TColStd_Array2OfReal.hxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-Standard_Integer Graphic3d_GraphicDriver::InquireLightLimit () {
- return Standard_False;
-}
-
-void Graphic3d_GraphicDriver::InquireMat (const Graphic3d_CView&
- , TColStd_Array2OfReal&
- , TColStd_Array2OfReal&
- )
-{
-}
-
-Standard_Integer Graphic3d_GraphicDriver::InquirePlaneLimit ()
-{
- return Standard_False;
-}
-
-Standard_Integer Graphic3d_GraphicDriver::InquireViewLimit ()
-{
- return Standard_False;
-}
-
-
-
-Standard_Boolean Graphic3d_GraphicDriver::InquireTextureAvailable ()
-{
- return Standard_False;
-}
-
+++ /dev/null
-// File Graphic3d_GraphicDriver_3.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void Graphic3d_GraphicDriver::ClearGroup (const Graphic3d_CGroup& ) {
-}
-
-void Graphic3d_GraphicDriver::CloseGroup (const Graphic3d_CGroup& ) {
-}
-
-
-void Graphic3d_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& , const Standard_Integer NoInsert) {
-}
-
-
-void Graphic3d_GraphicDriver::Group (Graphic3d_CGroup& ) {
-}
-
-
-void Graphic3d_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& , const Standard_Integer ) {
-}
-
-void Graphic3d_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& , const Standard_Integer ) {
-}
-
-void Graphic3d_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& , const Standard_Integer, const Standard_Integer, const Standard_Integer, const Handle(TColStd_HArray1OfByte)& ) {
-}
-
-
-
-void Graphic3d_GraphicDriver::OpenGroup (const Graphic3d_CGroup& ) {
-}
-
-
-void Graphic3d_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& ) {
-}
-
-void Graphic3d_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& , const Standard_Integer ) {
-
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_4.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-
-void Graphic3d_GraphicDriver::ClearStructure (const Graphic3d_CStructure& ) {
-}
-
-void Graphic3d_GraphicDriver::Connect (const Graphic3d_CStructure& , const Graphic3d_CStructure& ) {
-}
-
-void Graphic3d_GraphicDriver::ContextStructure (const Graphic3d_CStructure& ) {
-}
-
-void Graphic3d_GraphicDriver::Disconnect (const Graphic3d_CStructure& , const Graphic3d_CStructure& ) {
-}
-
-void Graphic3d_GraphicDriver::DisplayStructure (const Graphic3d_CView& , const Graphic3d_CStructure& , const Standard_Integer ) {
-}
-
-void Graphic3d_GraphicDriver::EraseStructure (const Graphic3d_CView& , const Graphic3d_CStructure& ) {
-}
-
-void Graphic3d_GraphicDriver::RemoveStructure (const Graphic3d_CStructure& ) {
-}
-
-void Graphic3d_GraphicDriver::Structure (Graphic3d_CStructure& ) {
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_5.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-
-void Graphic3d_GraphicDriver::DumpGroup (const Graphic3d_CGroup& ) {
-}
-
-
-void Graphic3d_GraphicDriver::DumpStructure (const Graphic3d_CStructure& ) {
-}
-
-
-void Graphic3d_GraphicDriver::DumpView (const Graphic3d_CView& ) {
-}
-
-
-Standard_Boolean Graphic3d_GraphicDriver::ElementExploration (const Graphic3d_CStructure & , const Standard_Integer , Graphic3d_VertexNC& , Graphic3d_Vector& ) {
- return Standard_False;
-}
-
-
-Graphic3d_TypeOfPrimitive Graphic3d_GraphicDriver::ElementType (const Graphic3d_CStructure & , const Standard_Integer ) {
- return Graphic3d_TOP_UNDEFINED;
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_6.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void Graphic3d_GraphicDriver::InitPick () {
-}
-
-
-void Graphic3d_GraphicDriver::Pick (Graphic3d_CPick& ) {
-}
-
-void Graphic3d_GraphicDriver::PickId (const Graphic3d_CGroup& ) {
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_7.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// Modified GG 10/11/99 PRO19603 Change the Redraw method (add redraw area capabillity)
-// EUG 07/10/99 G003 Add DegenerateStructure() and
-// SetBackFacingModel() methods.
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void Graphic3d_GraphicDriver::ActivateView (const Graphic3d_CView& ) {
-}
-
-void Graphic3d_GraphicDriver::AntiAliasing (const Graphic3d_CView& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::Background (const Graphic3d_CView& ) {
-}
-
-void Graphic3d_GraphicDriver::GradientBackground( const Graphic3d_CView& ACView,
- const Quantity_Color& AColor1, const Quantity_Color& AColor2,
- const Aspect_GradientFillMethod AType ){
-}
-
-void Graphic3d_GraphicDriver::Blink (const Graphic3d_CStructure& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::BoundaryBox (const Graphic3d_CStructure& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::HighlightColor (const Graphic3d_CStructure& , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::NameSetStructure (const Graphic3d_CStructure& ) {
-}
-
-void Graphic3d_GraphicDriver::ClipLimit (const Graphic3d_CView& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::DeactivateView (const Graphic3d_CView& ) {
-}
-
-void Graphic3d_GraphicDriver::DepthCueing (const Graphic3d_CView& , const Standard_Boolean ) {
-}
-
-Standard_Boolean Graphic3d_GraphicDriver::ProjectRaster (const Graphic3d_CView& , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , Standard_Integer& , Standard_Integer& ) {
- return Standard_False;
-}
-
-Standard_Boolean Graphic3d_GraphicDriver::UnProjectRaster (const Graphic3d_CView& , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& ) {
- return Standard_False;
-}
-
-Standard_Boolean Graphic3d_GraphicDriver::UnProjectRasterWithRay (const Graphic3d_CView& , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& ) {
- return Standard_False;
-}
-
-void Graphic3d_GraphicDriver::RatioWindow (const Graphic3d_CView& ) {
-}
-
-void Graphic3d_GraphicDriver::Redraw (const Graphic3d_CView& , const Aspect_CLayer2d& , const Aspect_CLayer2d& , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer ) {
-}
-
-void Graphic3d_GraphicDriver::RemoveView (const Graphic3d_CView& ) {
-}
-
-void Graphic3d_GraphicDriver::SetLight (const Graphic3d_CView& ) {
-}
-
-void Graphic3d_GraphicDriver::SetPlane (const Graphic3d_CView& ) {
-}
-
-void Graphic3d_GraphicDriver::SetVisualisation (const Graphic3d_CView& ) {
-}
-
-void Graphic3d_GraphicDriver::TransformStructure (const Graphic3d_CStructure& ) {
-}
-
-void Graphic3d_GraphicDriver :: DegenerateStructure ( const Graphic3d_CStructure& ) {
-}
-
-
-void Graphic3d_GraphicDriver::Transparency (const Graphic3d_CView& , const Standard_Boolean ) {
-}
-
-
-void Graphic3d_GraphicDriver::Update (const Graphic3d_CView& , const Aspect_CLayer2d& , const Aspect_CLayer2d& ) {
-}
-
-
-Standard_Boolean Graphic3d_GraphicDriver::View (Graphic3d_CView& ) {
- return Standard_True;
-}
-
-void Graphic3d_GraphicDriver::ViewMapping (const Graphic3d_CView& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::ViewOrientation (const Graphic3d_CView& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver :: SetBackFacingModel ( const Graphic3d_CView& ) {
-} // end Graphic3d_GraphicDriver :: SetBackFacingModel
+++ /dev/null
-// File Graphic3d_GraphicDriver_703.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-#include <Aspect_TypeOfMarker.hxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void Graphic3d_GraphicDriver::Marker (const Graphic3d_CGroup& , const Graphic3d_Vertex& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::MarkerSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) {
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_705.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// Modified
-// 27/07/97 ; PCT : ajout coordonnee texture
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void Graphic3d_GraphicDriver::Polygon (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Graphic3d_TypeOfPolygon , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::Polygon (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Graphic3d_Vector& , const Graphic3d_TypeOfPolygon , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::Polygon (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexN& , const Graphic3d_TypeOfPolygon , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::Polygon (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexN& , const Graphic3d_Vector& , const Graphic3d_TypeOfPolygon , const Standard_Boolean ) {
-}
-
-
-void Graphic3d_GraphicDriver::Polygon(const Graphic3d_CGroup& ,const Graphic3d_Array1OfVertexNT& ,const Graphic3d_TypeOfPolygon ,const Standard_Boolean )
-{
-}
-
-
-void Graphic3d_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , const TColStd_Array1OfInteger& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , const TColStd_Array1OfInteger& , const Graphic3d_Array1OfVertex& , const Graphic3d_Vector& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , const TColStd_Array1OfInteger& , const Graphic3d_Array1OfVertexN& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , const TColStd_Array1OfInteger& , const Graphic3d_Array1OfVertexN& , const Graphic3d_Vector& , const Standard_Boolean ) {
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_707.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// 11/97 ; CAL : ajout polyline par 2 points
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void Graphic3d_GraphicDriver::Polyline (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::Polyline (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexC& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::Polyline (const Graphic3d_CGroup& , const Standard_Real , const Standard_Real , const Standard_Real , const Standard_Real , const Standard_Real , const Standard_Real , const Standard_Boolean ) {
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_709.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// Modified
-// 27/08/97 ; PCT : ajout coordonnee texture
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void Graphic3d_GraphicDriver::QuadrangleMesh (const Graphic3d_CGroup& , const Graphic3d_Array2OfVertex& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::QuadrangleMesh (const Graphic3d_CGroup& , const Graphic3d_Array2OfVertexN& , const Standard_Boolean ) {
-}
-
-
-void Graphic3d_GraphicDriver::QuadrangleMesh(const Graphic3d_CGroup& ,const Graphic3d_Array2OfVertexNT& ,const Standard_Boolean )
-{
-}
-
-
-void Graphic3d_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Aspect_Array1OfEdge& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexN& , const Aspect_Array1OfEdge& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexC& , const Aspect_Array1OfEdge& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexNC& , const Aspect_Array1OfEdge& , const Standard_Boolean ) {
-}
-
-
-void Graphic3d_GraphicDriver::QuadrangleSet(const Graphic3d_CGroup& ,const Graphic3d_Array1OfVertexNT& ,const Aspect_Array1OfEdge& ,const Standard_Boolean )
-{
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_710.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void Graphic3d_GraphicDriver::Text (
- const Graphic3d_CGroup& ,
- const Standard_CString ,
- const Graphic3d_Vertex& ,
- const Standard_Real ,
- const Quantity_PlaneAngle ,
- const Graphic3d_TextPath ,
- const Graphic3d_HorizontalTextAlignment ,
- const Graphic3d_VerticalTextAlignment ,
- const Standard_Boolean
- )
-{
-}
-
-void Graphic3d_GraphicDriver::Text (
- const Graphic3d_CGroup& ,
- const Standard_CString ,
- const Graphic3d_Vertex& ,
- const Standard_Real ,
- const Standard_Boolean
- )
-{
-}
-
-void Graphic3d_GraphicDriver::Text (
- const Graphic3d_CGroup& ,
- const TCollection_ExtendedString& ,
- const Graphic3d_Vertex& ,
- const Standard_Real ,
- const Quantity_PlaneAngle ,
- const Graphic3d_TextPath ,
- const Graphic3d_HorizontalTextAlignment ,
- const Graphic3d_VerticalTextAlignment ,
- const Standard_Boolean
- )
-{
-}
-
-void Graphic3d_GraphicDriver::Text (
- const Graphic3d_CGroup& ,
- const TCollection_ExtendedString& ,
- const Graphic3d_Vertex& ,
- const Standard_Real ,
- const Standard_Boolean
- )
-{
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_711.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-//
-// Modified
-// 27/08/97 ; PCT : ajout coordonne texture
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void Graphic3d_GraphicDriver::TriangleMesh (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::TriangleMesh (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexN& , const Standard_Boolean ) {
-}
-
-
-void Graphic3d_GraphicDriver::TriangleMesh(const Graphic3d_CGroup& ,const Graphic3d_Array1OfVertexNT& ,const Standard_Boolean )
-{
-}
-
-
-void Graphic3d_GraphicDriver::TriangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Aspect_Array1OfEdge& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::TriangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexN& , const Aspect_Array1OfEdge& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::TriangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexC& , const Aspect_Array1OfEdge& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::TriangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexNC& , const Aspect_Array1OfEdge& , const Standard_Boolean ) {
-}
-
-
-
-void Graphic3d_GraphicDriver::TriangleSet(const Graphic3d_CGroup& ,const Graphic3d_Array1OfVertexNT& ,const Aspect_Array1OfEdge& ,const Standard_Boolean )
-{
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_712.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-
-void Graphic3d_GraphicDriver::Bezier (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::Bezier (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const TColStd_Array1OfReal& , const Standard_Boolean ) {
-}
+++ /dev/null
-// File OpenGl_GraphicDriver_713.cxx
-// Created 22-10-01
-// Author SAV
-
-
-// 09/07/02 SAV - merged with file Graphic3d_GraphicDriver_713.cxx created 16/06/2000 by ATS for G005 study.
-//Following routines are entry points for creation of PARRAY primitives for (used for presentation).
-
-#include <Graphic3d_GraphicDriver.jxx>
-#include <Aspect_DriverDefinitionError.hxx>
-
-#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
-from higher API */
-#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
-from higher API */
-
-
-void Graphic3d_GraphicDriver::SetDepthTestEnabled( const Graphic3d_CView&, const Standard_Boolean ) const {
-}
-
-Standard_Boolean Graphic3d_GraphicDriver::IsDepthTestEnabled( const Graphic3d_CView& ) const {
- return Standard_True;
-}
-
-void Graphic3d_GraphicDriver::ReadDepths( const Graphic3d_CView&,
- const Standard_Integer,
- const Standard_Integer,
- const Standard_Integer,
- const Standard_Integer,
- const Standard_Address ) const
-{
-}
-
-void Graphic3d_GraphicDriver::SetGLLightEnabled( const Graphic3d_CView&, const Standard_Boolean ) const {
-}
-
-Standard_Boolean Graphic3d_GraphicDriver::IsGLLightEnabled( const Graphic3d_CView& ) const {
- return Standard_True;
-}
-
-
-void Graphic3d_GraphicDriver :: PrimitiveArray ( const Graphic3d_CGroup&,const Graphic3d_PrimitiveArray&,const Standard_Boolean) {
-}
-
-
-void Graphic3d_GraphicDriver :: UserDraw ( const Graphic3d_CGroup&,
- const Graphic3d_CUserDraw& )
-{
-}
-
-void Graphic3d_GraphicDriver::EnableVBO( const Standard_Boolean )
-{
-}
\ No newline at end of file
+++ /dev/null
-// File Graphic3d_GraphicDriver_8.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-
-Standard_Boolean Graphic3d_GraphicDriver::BeginAddMode (const Graphic3d_CView& ) {
- return Standard_True;
-}
-
-void Graphic3d_GraphicDriver::EndAddMode (void) {
-}
-
-Standard_Boolean Graphic3d_GraphicDriver::BeginImmediatMode (const Graphic3d_CView& , const Aspect_CLayer2d& , const Aspect_CLayer2d& , const Standard_Boolean , const Standard_Boolean ) {
- return Standard_True;
-}
-
-void Graphic3d_GraphicDriver::BeginPolyline () {
-}
-
-void Graphic3d_GraphicDriver::ClearImmediatMode (const Graphic3d_CView&, const Standard_Boolean ) {
-}
-
-void Graphic3d_GraphicDriver::Draw (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::DrawStructure (const Graphic3d_CStructure& ) {
-}
-
-void Graphic3d_GraphicDriver::EndImmediatMode (const Standard_Integer ) {
-}
-
-void Graphic3d_GraphicDriver::EndPolyline () {
-}
-
-void Graphic3d_GraphicDriver::Move (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::SetLineColor (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::SetLineType (const Standard_Integer ) {
-}
-
-void Graphic3d_GraphicDriver::SetLineWidth (const Standard_ShortReal ) {
-}
-
-
-void Graphic3d_GraphicDriver::SetMinMax (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::Transform (const TColStd_Array2OfReal& , const Graphic3d_TypeOfComposition ) {
-
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_8.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// modified: 1/07/97 ; PCT : ajout texture mapping
-// 16-09-98 ; BGN : Points d'entree du Triedre (S3819, Phase 1)
-// 22-09-98 ; BGN : S3989 (anciennement S3819)
-// TypeOfTriedron* from Aspect (pas Graphic3d)
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-
-//SAV 23/12/02 : Added methods to set background image.
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <stdlib.h>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-Standard_Integer Graphic3d_GraphicDriver::CreateTexture(const Graphic3d_TypeOfTexture ,const Handle_AlienImage_AlienImage &,const Standard_CString,const Handle(TColStd_HArray1OfReal)& TexUpperBounds ) const
-{
- return -1;
-
-}
-
-void Graphic3d_GraphicDriver::DestroyTexture(const Standard_Integer ) const
-{
-}
-
-
-void Graphic3d_GraphicDriver::ModifyTexture(const Standard_Integer ,const Graphic3d_CInitTexture& ) const
-{
-}
-
-void Graphic3d_GraphicDriver::Environment(const Graphic3d_CView& )
-{
-}
-
-
-//
-// Triedron methods : the Triedron is a non-zoomable object.
-//
-
-
-void Graphic3d_GraphicDriver::ZBufferTriedronSetup (
- const Quantity_NameOfColor,
- const Quantity_NameOfColor,
- const Quantity_NameOfColor,
- const Standard_Real,
- const Standard_Real,
- const Standard_Integer)
-{
-}
-
-void Graphic3d_GraphicDriver::TriedronDisplay (
- const Graphic3d_CView& ,
- const Aspect_TypeOfTriedronPosition ,
- const Quantity_NameOfColor ,
- const Standard_Real,
- const Standard_Boolean )
-{
-}
-
-void Graphic3d_GraphicDriver::TriedronErase (const Graphic3d_CView& )
-{
-}
-
-
-void Graphic3d_GraphicDriver::TriedronEcho (const Graphic3d_CView& ,const Aspect_TypeOfTriedronEcho )
-{
-}
-
-
-void Graphic3d_GraphicDriver::BackgroundImage( const Standard_CString /*FileName*/,
- const Graphic3d_CView& /*ACView*/,
- const Aspect_FillMethod /*FillStyle*/)
-{
-}
-
-void Graphic3d_GraphicDriver::SetBgImageStyle( const Graphic3d_CView& /*ACView*/,
- const Aspect_FillMethod /*FillStyle*/)
-{
-}
-
-void Graphic3d_GraphicDriver::SetBgGradientStyle( const Graphic3d_CView& /*ACView*/,
- const Aspect_GradientFillMethod /*FillStyle*/)
-{
-}
-
-void Graphic3d_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView&,
- const Graphic3d_CGraduatedTrihedron&)
-{
-}
-
-void Graphic3d_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView&)
-{
-}
-
-void Graphic3d_GraphicDriver::GraduatedTrihedronMinMaxValues(const Standard_ShortReal,
- const Standard_ShortReal,
- const Standard_ShortReal,
- const Standard_ShortReal,
- const Standard_ShortReal,
- const Standard_ShortReal)
-{
-}
+++ /dev/null
-/************************************************************************/
-/* Includes */
-/************************************************************************/
-
-#include <Graphic3d_GraphicDriver.jxx>
-
-/************************************************************************/
-/* Print Methods */
-/************************************************************************/
-
-
-Standard_Boolean Graphic3d_GraphicDriver::Export (const Standard_CString theFileName,
- const Graphic3d_ExportFormat theFormat,
- const Graphic3d_SortType theSortType,
- const Standard_Integer theW,
- const Standard_Integer theH,
- const Graphic3d_CView& theView,
- const Aspect_CLayer2d& theLayerUnder,
- const Aspect_CLayer2d& theLayerOver,
- const Standard_Real thePrecision,
- const Standard_Address theProgressBarFunc,
- const Standard_Address theProgressObject)
-{
- return Standard_False;
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_Layer.cxx
-// Created Mardi 3 novembre 1998
-// Author CAL
-// 02.15.100 : JR : Clutter
-
-//-Copyright MatraDatavision 1998
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void Graphic3d_GraphicDriver::Layer (Aspect_CLayer2d& ) {
-}
-
-void Graphic3d_GraphicDriver::RemoveLayer (const Aspect_CLayer2d& ) {
-}
-
-void Graphic3d_GraphicDriver::BeginLayer (const Aspect_CLayer2d& ) {
-}
-
-void Graphic3d_GraphicDriver::BeginPolygon2d () {
-}
-
-void Graphic3d_GraphicDriver::BeginPolyline2d () {
-}
-
-void Graphic3d_GraphicDriver::ClearLayer (const Aspect_CLayer2d& ) {
-}
-
-void Graphic3d_GraphicDriver::Draw (const Standard_ShortReal , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::Edge (const Standard_ShortReal , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::EndLayer () {
-}
-
-void Graphic3d_GraphicDriver::EndPolygon2d () {
-}
-
-void Graphic3d_GraphicDriver::EndPolyline2d () {
-}
-
-void Graphic3d_GraphicDriver::Move (const Standard_ShortReal , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::Rectangle (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::SetColor (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::SetTransparency (const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::UnsetTransparency () {
-}
-
-void Graphic3d_GraphicDriver::SetLineAttributes (const Standard_Integer , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::SetTextAttributes (const Standard_CString Font, const Standard_Integer AType, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) {
-}
-
-void Graphic3d_GraphicDriver::Text (const Standard_CString , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) {
-}
-
-void Graphic3d_GraphicDriver::TextSize (const Standard_CString , const Standard_ShortReal , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& ) const {
-}
+++ /dev/null
-// File Graphic3d_GraphicDriver_Print.c
-// Created March 2000
-// Author THA
-// e-mail t-hartl@muenchen.matra-dtv.fr
-
-/************************************************************************/
-/* Includes */
-/************************************************************************/
-
-#include <Graphic3d_GraphicDriver.jxx>
-#include <Aspect_DriverDefinitionError.hxx>
-
-/************************************************************************/
-/* Print Methods */
-/************************************************************************/
-
-Standard_Boolean Graphic3d_GraphicDriver::Print (const Graphic3d_CView& ,
- const Aspect_CLayer2d& ,
- const Aspect_CLayer2d& ,
- const Aspect_Handle ,
- const Standard_Boolean ,
- const Standard_CString ,
- const Aspect_PrintAlgo ,
- const Standard_Real ) const
-{
- return Standard_False;
-}
-- Warning: Raises GroupDefinitionError if <ListVertex> contains
-- less than four points.
raises GroupDefinitionError from Graphic3d is static;
-
- QuadrangleSet ( me : mutable;
- ListVertex : Array1OfVertex from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- ---Level: Public
- ---Purpose: Creates a group of quadrangles defined by a table of
- -- vertices and a table of edges, visible or not.
- -- Category: Methods to create Quadrangle
- -- Warning: Raises GroupDefinitionError if <ListVertex> contains
- -- less than four points or if <ListEdge> contains
- -- less than four edges.
- raises GroupDefinitionError from Graphic3d is static;
-
- QuadrangleSet ( me : mutable;
- ListVertex : Array1OfVertexN from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- ---Level: Public
- ---Purpose: Creates a group of quadrangles defined by a table of
- -- vertices and a table of edges, visible or not.
- -- For each vertex the normal is given.
- -- Category: Methods to create Quadrangle
- -- Warning: Raises GroupDefinitionError if <ListVertex> contains
- -- less than four points or if <ListEdge> contains
- -- less than four edges.
- raises GroupDefinitionError from Graphic3d is static;
-
- QuadrangleSet ( me : mutable;
- ListVertex : Array1OfVertexNT from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- ---Level: Public
- ---Purpose: Creates a group of quadrangles defined by a table of
- -- vertices and a table of edges, visible or not.
- -- For each vertex the normal is given.
- -- For each vertex a texture coordinate is given.
- -- Category: Methods to create Quadrangle
- -- Warning: Raises GroupDefinitionError if <ListVertex> contains
- -- less than four points or if <ListEdge> contains
- -- less than four edges.
- raises GroupDefinitionError from Graphic3d is static;
-
- QuadrangleSet ( me : mutable;
- ListVertex : Array1OfVertexC from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- ---Level: Public
- ---Purpose: Creates a group of quadrangles defined by a table of
- -- vertices and a table of edges, visible or not.
- -- For each vertex the color is given.
- -- Category: Methods to create Quadrangle
- -- Warning: Raises GroupDefinitionError if <ListVertex> contains
- -- less than four points or if <ListEdge> contains
- -- less than four edges.
- raises GroupDefinitionError from Graphic3d is static;
-
- QuadrangleSet ( me : mutable;
- ListVertex : Array1OfVertexNC from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- ---Level: Public
- ---Purpose: Creates a group of quadrangles defined by a table of
- -- vertices and a table of edges, visible or not.
- -- For each vertex the normal and the color are given.
- -- Category: Methods to create Quadrangle
- -- Warning: Raises GroupDefinitionError if <ListVertex> contains
- -- less than four points or if <ListEdge> contains
- -- less than four edges.
- raises GroupDefinitionError from Graphic3d is static;
-
+
-----------------------------------
-- Category: Methods to create Text
-----------------------------------
+++ /dev/null
-
-// File Graphic3d_Group_12.cxx (Curve)
-// Created Aout 1994
-// Author NW,JPB,CAL
-
-//-Copyright MatraDatavision 1994
-
-//-Version
-
-//-Design Declaration des variables specifiques aux groupes
-// de primitives
-
-//-Warning Un groupe est defini dans une structure
-// Il s'agit de la plus petite entite editable
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_Group.jxx>
-#include <Graphic3d_Group.pxx>
-
-//-Methods, in order
-
-void Graphic3d_Group::Bezier (const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax) {
-
- if (IsDeleted ()) return;
-
- MyIsEmpty = Standard_False;
-
-Standard_Integer i, j;
-
- i = ListVertex.Length ();
-
- if (i <= 2)
- Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices");
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
-Standard_Integer Lower = ListVertex.Lower ();
-Standard_Integer Upper = ListVertex.Upper ();
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
- }
-
- MyGraphicDriver->Bezier (MyCGroup, ListVertex, EvalMinMax);
-
- Update ();
-
-}
-
-void Graphic3d_Group::Bezier (const Graphic3d_Array1OfVertex& ListVertex, const TColStd_Array1OfReal& ListWeight, const Standard_Boolean EvalMinMax) {
-
- if (IsDeleted ()) return;
-
- MyIsEmpty = Standard_False;
-
-Standard_Integer i, j;
-
- i = ListVertex.Length ();
- j = ListWeight.Length ();
-
- if ((i <= 2) || (i != j))
- Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices");
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
-Standard_Integer Lower = ListVertex.Lower ();
-Standard_Integer Upper = ListVertex.Upper ();
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
- }
-
- MyGraphicDriver->Bezier
- (MyCGroup, ListVertex, ListWeight, EvalMinMax);
-
- Update ();
-
-}
//-Declarations
-// for the class
#include <Graphic3d_Group.jxx>
#include <Graphic3d_Group.pxx>
-#include <Graphic3d_VertexN.hxx>
-#include <Graphic3d_VertexC.hxx>
-#include <Graphic3d_VertexNT.hxx>
-
-//-Methods, in order
-
void Graphic3d_Group::QuadrangleMesh (const Graphic3d_Array2OfVertex& ListVertex, const Standard_Boolean EvalMinMax) {
if (IsDeleted ()) return;
Update ();
}
-
-
-void Graphic3d_Group::QuadrangleSet (const Graphic3d_Array1OfVertex& ListVertex, const Aspect_Array1OfEdge& ListEdge, const Standard_Boolean EvalMinMax) {
-
- if (IsDeleted ()) return;
-
- if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
- MyContainsFacet = Standard_True;
- MyIsEmpty = Standard_False;
-
-Standard_Integer i, j;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
-
- if ((i <= 3) || (j <= 3))
- Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices");
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
-Standard_Integer Lower = ListVertex.Lower ();
-Standard_Integer Upper = ListVertex.Upper ();
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
- }
-
- MyGraphicDriver->QuadrangleSet
- (MyCGroup, ListVertex, ListEdge, EvalMinMax);
-
- Update ();
-
-}
-
-void Graphic3d_Group::QuadrangleSet (const Graphic3d_Array1OfVertexN& ListVertex, const Aspect_Array1OfEdge& ListEdge, const Standard_Boolean EvalMinMax) {
-
- if (IsDeleted ()) return;
-
- if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
- MyContainsFacet = Standard_True;
- MyIsEmpty = Standard_False;
-
-Standard_Integer i, j;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
-
- if ((i <= 3) || (j <= 3))
- Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices");
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
-Standard_Integer Lower = ListVertex.Lower ();
-Standard_Integer Upper = ListVertex.Upper ();
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
- }
-
- MyGraphicDriver->QuadrangleSet
- (MyCGroup, ListVertex, ListEdge, EvalMinMax);
-
- Update ();
-
-}
-
-void Graphic3d_Group::QuadrangleSet (const Graphic3d_Array1OfVertexC& ListVertex, const Aspect_Array1OfEdge& ListEdge, const Standard_Boolean EvalMinMax) {
-
- if (IsDeleted ()) return;
-
- if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
- MyContainsFacet = Standard_True;
- MyIsEmpty = Standard_False;
-
-Standard_Integer i, j;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
-
- if ((i <= 3) || (j <= 3))
- Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices");
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
-Standard_Integer Lower = ListVertex.Lower ();
-Standard_Integer Upper = ListVertex.Upper ();
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
- }
-
- MyGraphicDriver->QuadrangleSet
- (MyCGroup, ListVertex, ListEdge, EvalMinMax);
-
- Update ();
-
-}
-
-void Graphic3d_Group::QuadrangleSet (const Graphic3d_Array1OfVertexNC& ListVertex, const Aspect_Array1OfEdge& ListEdge, const Standard_Boolean EvalMinMax) {
-
- if (IsDeleted ()) return;
-
- if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
- MyContainsFacet = Standard_True;
- MyIsEmpty = Standard_False;
-
-Standard_Integer i, j;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
-
- if ((i <= 3) || (j <= 3))
- Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices");
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
-Standard_Integer Lower = ListVertex.Lower ();
-Standard_Integer Upper = ListVertex.Upper ();
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
- }
-
- MyGraphicDriver->QuadrangleSet
- (MyCGroup, ListVertex, ListEdge, EvalMinMax);
-
- Update ();
-
-}
-
-
-
-void Graphic3d_Group::QuadrangleSet(const Graphic3d_Array1OfVertexNT& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax)
-{
-
- if (IsDeleted ()) return;
-
- if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
- MyContainsFacet = Standard_True;
- MyIsEmpty = Standard_False;
-
-Standard_Integer i, j;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
-
- if ((i <= 3) || (j <= 3))
- Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices");
-
- // Min-Max Update
- if (EvalMinMax) {
-Standard_Real X, Y, Z;
-Standard_Integer Lower = ListVertex.Lower ();
-Standard_Integer Upper = ListVertex.Upper ();
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
- }
-
- MyGraphicDriver->QuadrangleSet
- (MyCGroup, ListVertex, ListEdge, EvalMinMax);
-
- Update ();
-
-}
EXTERNLIB
-OpenGl_triedron.cxx
OpenGl_CMPLRS.edl
-OpenGl_FontMgr.hxx
-OpenGl_FontMgr.cxx
-OpenGl_AVIWriter.hxx
-OpenGl_AVIWriter.cxx
+Handle_OpenGl_GraphicDriver.hxx
+OpenGl_GraphicDriver.hxx
+OpenGl_GraphicDriver.cxx
OpenGl_GraphicDriver_1.cxx
OpenGl_GraphicDriver_2.cxx
OpenGl_GraphicDriver_3.cxx
OpenGl_GraphicDriver_5.cxx
OpenGl_GraphicDriver_6.cxx
OpenGl_GraphicDriver_7.cxx
+OpenGl_GraphicDriver_8.cxx
+OpenGl_GraphicDriver_9.cxx
OpenGl_GraphicDriver_703.cxx
OpenGl_GraphicDriver_705.cxx
OpenGl_GraphicDriver_707.cxx
OpenGl_GraphicDriver_709.cxx
OpenGl_GraphicDriver_710.cxx
OpenGl_GraphicDriver_711.cxx
-OpenGl_GraphicDriver_712.cxx
-OpenGl_GraphicDriver_8.cxx
-OpenGl_GraphicDriver_9.cxx
-OpenGl_GraphicDriver_print.cxx
+OpenGl_GraphicDriver_713.cxx
OpenGl_GraphicDriver_Layer.cxx
-OpenGl.cdl
-OpenGl_addnames.cxx
-OpenGl_animation.hxx
-OpenGl_antialias.cxx
-OpenGl_applid.cxx
-OpenGl_attri.cxx
-OpenGl_bintcol.cxx
-OpenGl_bintrefl.cxx
-OpenGl_bsurfprop.cxx
-OpenGl_charexpan.cxx
-OpenGl_charspace.cxx
-OpenGl_cmn_varargs.hxx
-OpenGl_context.hxx
-OpenGl_curve.cxx
-OpenGl_degeneration.hxx
-OpenGl_degmodel.cxx
-OpenGl_depthcue.cxx
-OpenGl_dind.cxx
-OpenGl_edgecol.cxx
-OpenGl_edgeflag.cxx
-OpenGl_edgetyp.cxx
-OpenGl_edgewid.cxx
-OpenGl_execstruct.cxx
-OpenGl_Extension.hxx
-OpenGl_Extension.cxx
-OpenGl_facecull.cxx
-OpenGl_facedmode.cxx
-OpenGl_filters.cxx
-OpenGl_funcs.cxx
-OpenGl_highlight.cxx
-OpenGl_hlind.cxx
-OpenGl_ImageBox.hxx
-OpenGl_ImageBox.cxx
-OpenGl_indexpolygons.cxx
-OpenGl_initelem.cxx
-OpenGl_inquire.cxx
-OpenGl_inquire.hxx
-OpenGl_intcol.cxx
-OpenGl_intrefl.cxx
-OpenGl_intshademtd.cxx
-OpenGl_intstyle.cxx
-OpenGl_intstyleind.cxx
-OpenGl_label.cxx
-OpenGl_lightstate.cxx
-OpenGl_localtran3.cxx
-OpenGl_LightBox.cxx
-OpenGl_LightBox.hxx
-OpenGl_mrkr.cxx
-OpenGl_mrkrcol.cxx
-OpenGl_mrkrset.cxx
-OpenGl_mrkrsize.cxx
-OpenGl_mrkrtype.cxx
-OpenGl_pick.cxx
-OpenGl_pickid.cxx
-OpenGl_polygon.cxx
-OpenGl_polygonholes.cxx
-OpenGl_polygonoffset.cxx
-OpenGl_polyl.cxx
-OpenGl_polylcol.cxx
-OpenGl_polyltyp.cxx
-OpenGl_polylwid.cxx
-OpenGl_qstrip.cxx
-OpenGl_remnames.cxx
-OpenGl_subrs.cxx
-OpenGl_subrvis.cxx
-OpenGl_surfprop.cxx
-OpenGl_telem.hxx
-OpenGl_telem_attri.hxx
-OpenGl_telem_depthcue.hxx
-OpenGl_telem_filters.hxx
-OpenGl_telem_highlight.hxx
-OpenGl_telem_inquire.hxx
-OpenGl_telem_pick.hxx
-OpenGl_telem_util.cxx
-OpenGl_telem_util.hxx
+OpenGl_GraphicDriver_print.cxx
+OpenGl_GraphicDriver_Export.cxx
+OpenGl_AspectLine.hxx
+OpenGl_AspectLine.cxx
+OpenGl_AspectFace.hxx
+OpenGl_AspectFace.cxx
+OpenGl_AspectMarker.hxx
+OpenGl_AspectMarker.cxx
+OpenGl_AspectText.hxx
+OpenGl_AspectText.cxx
+OpenGl_Group.hxx
+OpenGl_Group.cxx
+OpenGl_Structure.hxx
+OpenGl_Structure.cxx
+OpenGl_Element.hxx
+OpenGl_Text.hxx
+OpenGl_Text.cxx
+OpenGl_Polyline.hxx
+OpenGl_Polyline.cxx
+OpenGl_Marker.hxx
+OpenGl_Marker.cxx
+OpenGl_MarkerSet.hxx
+OpenGl_MarkerSet.cxx
+OpenGl_Polygon.hxx
+OpenGl_Polygon.cxx
+OpenGl_QuadrangleStrip.hxx
+OpenGl_QuadrangleStrip.cxx
+OpenGl_TriangleStrip.hxx
+OpenGl_TriangleStrip.cxx
+OpenGl_Mesh.hxx
+OpenGl_Mesh.cxx
+OpenGl_PrimitiveArray.hxx
+OpenGl_PrimitiveArray.cxx
+Handle_OpenGl_Workspace.hxx
+OpenGl_Workspace.hxx
+OpenGl_Workspace.cxx
+OpenGl_Workspace_1.cxx
+OpenGl_Workspace_2.cxx
+OpenGl_Workspace_3.cxx
+OpenGl_Workspace_4.cxx
+OpenGl_Workspace_5.cxx
+Handle_OpenGl_View.hxx
+OpenGl_View.hxx
+OpenGl_View.cxx
+OpenGl_View_1.cxx
+OpenGl_View_2.cxx
+OpenGl_Light.hxx
+Handle_OpenGl_Trihedron.hxx
+OpenGl_Trihedron.hxx
+OpenGl_Trihedron.cxx
+Handle_OpenGl_GraduatedTrihedron.hxx
+OpenGl_GraduatedTrihedron.hxx
+OpenGl_GraduatedTrihedron.cxx
+OpenGl_Matrix.hxx
+OpenGl_Matrix.cxx
+OpenGl_CView.hxx
+OpenGl_NamedStatus.hxx
+OpenGl_TextParam.hxx
+OpenGl_Callback.hxx
+OpenGl_PrinterContext.hxx
+OpenGl_PrinterContext.cxx
+Handle_OpenGl_Display.hxx
+OpenGl_Display.hxx
+OpenGl_Display.cxx
+OpenGl_Display_1.cxx
+OpenGl_Display_2.cxx
+Handle_OpenGl_Window.hxx
+OpenGl_Window.hxx
+OpenGl_Window.cxx
+OpenGl_PriorityList.hxx
+OpenGl_PriorityList.cxx
+OpenGl_AVIWriter.hxx
+OpenGl_AVIWriter.cxx
+OpenGl_tsm.hxx
+OpenGl_telem_view.cxx
OpenGl_telem_view.hxx
-OpenGl_text.cxx
-OpenGl_textcol.cxx
-OpenGl_textcolsubtitle.cxx
-OpenGl_textdisplaytype.cxx
-OpenGl_textfont.cxx
-OpenGl_textheight.cxx
-OpenGl_textstyle.cxx
-OpenGl_TextureBox.hxx
-OpenGl_TextureBox.cxx
-OpenGl_tgl.hxx
OpenGl_tgl_all.hxx
-OpenGl_tgl_elems.hxx
-OpenGl_tgl_funcs.hxx
-OpenGl_tgl_pick.hxx
-OpenGl_tgl_subrs.hxx
-OpenGl_tgl_subrvis.hxx
-OpenGl_tgl_tox.hxx
-OpenGl_tgl_util.cxx
-OpenGl_tgl_util.hxx
-OpenGl_tgl_utilgr.cxx
-OpenGl_tgl_utilgr.hxx
-OpenGl_tgl_vis.hxx
-OpenGl_tmesh.cxx
-OpenGl_tox.cxx
-OpenGl_trsf_stack.hxx
-OpenGl_tsm.cxx
-OpenGl_tsm.hxx
-OpenGl_tsm_ws.hxx
-OpenGl_txgl.cxx
-OpenGl_txgl.hxx
-OpenGl_undefined.cxx
-OpenGl_view.cxx
-OpenGl_vind.cxx
-OpenGl_ws.cxx
-OpenGl_togl_activateview.cxx
-OpenGl_togl_antialiasing.cxx
-OpenGl_togl_backfacing.cxx
-OpenGl_togl_background.cxx
-OpenGl_togl_begin.cxx
-OpenGl_togl_begin_animation.cxx
-OpenGl_togl_begin_immediat_mode.cxx
-OpenGl_togl_begin_layer_mode.cxx
-OpenGl_togl_bezier.cxx
-OpenGl_togl_bezier_weight.cxx
-OpenGl_togl_blink.cxx
-OpenGl_togl_boundarybox.cxx
-OpenGl_togl_cleargroup.cxx
-OpenGl_togl_clearstructure.cxx
-OpenGl_togl_cliplimit.cxx
-OpenGl_togl_closegroup.cxx
-OpenGl_togl_connect.cxx
-OpenGl_togl_contextstructure.cxx
-OpenGl_togl_curve.cxx
-OpenGl_togl_deactivateview.cxx
-OpenGl_togl_degeneratestructure.cxx
-OpenGl_togl_depthcueing.cxx
-OpenGl_togl_disconnect.cxx
-OpenGl_togl_displaystructure.cxx
-OpenGl_togl_element_exploration.cxx
-OpenGl_togl_end.cxx
-OpenGl_togl_erasestructure.cxx
-OpenGl_togl_facecontextgroup.cxx
-OpenGl_togl_group.cxx
-OpenGl_togl_highlightcolor.cxx
-OpenGl_togl_init_pick.cxx
-OpenGl_togl_inquirefacilities.cxx
-OpenGl_togl_inquirelight.cxx
-OpenGl_togl_inquireplane.cxx
-OpenGl_togl_inquireview.cxx
-OpenGl_togl_light.cxx
-OpenGl_togl_light_exploration.cxx
-OpenGl_togl_linecontextgroup.cxx
-OpenGl_togl_marker.cxx
-OpenGl_togl_marker_set.cxx
-OpenGl_togl_markercontextgroup.cxx
-OpenGl_togl_namesetstructure.cxx
-OpenGl_togl_opengroup.cxx
-OpenGl_togl_pick.cxx
-OpenGl_togl_pickid.cxx
-OpenGl_togl_plane.cxx
-OpenGl_togl_polygon.cxx
-OpenGl_togl_polygon_holes.cxx
-OpenGl_togl_polygon_indices.cxx
-OpenGl_togl_polygon_set.cxx
-OpenGl_togl_polyline.cxx
-OpenGl_togl_print.cxx
-OpenGl_togl_project_raster.cxx
-OpenGl_togl_quadrangle.cxx
-OpenGl_togl_ratio_window.cxx
-OpenGl_togl_redraw.cxx
-OpenGl_togl_removegroup.cxx
-OpenGl_togl_removestructure.cxx
-OpenGl_togl_removeview.cxx
-OpenGl_togl_set_environment.cxx
-OpenGl_togl_setlight.cxx
-OpenGl_togl_setplane.cxx
-OpenGl_togl_setvisualisation.cxx
-OpenGl_togl_structure.cxx
-OpenGl_togl_structure_exploration.cxx
-OpenGl_togl_text.cxx
-OpenGl_togl_textcontextgroup.cxx
-OpenGl_togl_texture.cxx
-OpenGl_togl_transformstructure.cxx
-OpenGl_togl_transparency.cxx
-OpenGl_togl_triangle.cxx
-OpenGl_togl_triedron.cxx
-OpenGl_togl_unproject_raster.cxx
-OpenGl_togl_update.cxx
-OpenGl_togl_view.cxx
-OpenGl_togl_view_exploration.cxx
-OpenGl_togl_viewmapping.cxx
-OpenGl_togl_vieworientation.cxx
-OpenGl_dotexturemap.cxx
-OpenGl_texture.cxx
-OpenGl_triedron.cxx
-OpenGl_triedron.hxx
-OpenGl_traces.hxx
-OpenGl_togl_parray.cxx
-OpenGl_PrimitiveArray.cxx
-OpenGl_togl_depthtest.cxx
-OpenGl_GraphicDriver_713.cxx
-OpenGl_transform_persistence.cxx
-OpenGl_transform_persistence.hxx
-OpenGl_GraphicDriver_Export.cxx
-OpenGl_textalignment.cxx
-OpenGl_togl_userdraw.cxx
-OpenGl_userdraw.cxx
-OpenGl_callback.hxx
-OpenGl_Memory.hxx
-OpenGl_Memory.cxx
-OpenGl_TextRender.hxx
-OpenGl_TextRender.cxx
-OpenGl_textzoomable.cxx
-OpenGl_textangle.cxx
-OpenGl_textfontaspect.cxx
-OpenGl_togl_gradient_background.cxx
-OpenGl_graduatedtrihedron.cxx
-OpenGl_graduatedtrihedron.hxx
-OpenGl_togl_graduatedtrihedron.cxx
OpenGl_FrameBuffer.hxx
OpenGl_FrameBuffer.cxx
+OpenGl_TextureBox.cxx
+OpenGl_TextureBox.hxx
+OpenGl_ImageBox.cxx
+OpenGl_ImageBox.hxx
+OpenGl_Memory.hxx
OpenGl_Resource.hxx
-OpenGl_ResourceCleaner.cxx
-OpenGl_ResourceCleaner.hxx
-OpenGl_ResourceVBO.cxx
OpenGl_ResourceVBO.hxx
-OpenGl_ResourceTexture.cxx
+OpenGl_ResourceVBO.cxx
OpenGl_ResourceTexture.hxx
-OpenGl_PrinterContext.cxx
-OpenGl_PrinterContext.hxx
+OpenGl_ResourceTexture.cxx
+OpenGl_ResourceCleaner.hxx
+OpenGl_ResourceCleaner.cxx
+OpenGl_telem_util.hxx
+OpenGl_telem_util.cxx
+OpenGl_transform_persistence.hxx
+OpenGl_FontMgr.hxx
+OpenGl_FontMgr.cxx
+OpenGl_tgl_funcs.hxx
+OpenGl_togl_texture.cxx
+OpenGl_togl_inquireplane.cxx
+Handle_OpenGl_Context.hxx
+OpenGl_Context.hxx
+OpenGl_Context.cxx
+OpenGl_ArbVBO.hxx
+OpenGl_ExtFBO.hxx
\ No newline at end of file
--- /dev/null
+// File: Handle_OpenGl_Context.hxx
+// Created: 26 January 2012
+// Author: Kirill GAVRILOV
+// Copyright: OPEN CASCADE 2012
+
+#ifndef _Handle_OpenGl_Context_Header
+#define _Handle_OpenGl_Context_Header
+
+#include <Standard_DefineHandle.hxx>
+#include <Handle_Standard_Transient.hxx>
+
+class OpenGl_Context;
+DEFINE_STANDARD_HANDLE(OpenGl_Context, Standard_Transient)
+
+#endif // _Handle_OpenGl_Context_Header
--- /dev/null
+// File: Handle_OpenGl_Display.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _Handle_OpenGl_Display_Header
+#define _Handle_OpenGl_Display_Header
+
+#include <Standard_DefineHandle.hxx>
+#include <Handle_MMgt_TShared.hxx>
+
+class OpenGl_Display;
+
+// Handle definition
+//
+DEFINE_STANDARD_HANDLE(OpenGl_Display,MMgt_TShared)
+
+
+#endif //_Handle_OpenGl_Display_Header
--- /dev/null
+// File: Handle_OpenGl_GraduatedTrihedron.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _Handle_OpenGl_GraduatedTrihedron_Header
+#define _Handle_OpenGl_GraduatedTrihedron_Header
+
+#include <Standard_DefineHandle.hxx>
+#include <Handle_MMgt_TShared.hxx>
+
+class OpenGl_GraduatedTrihedron;
+
+// Handle definition
+//
+DEFINE_STANDARD_HANDLE(OpenGl_GraduatedTrihedron,MMgt_TShared)
+
+
+#endif //_Handle_OpenGl_GraduatedTrihedron_Header
--- /dev/null
+// File: Handle_OpenGl_GraphicDriver.hxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _Handle_OpenGl_GraphicDriver_Header
+#define _Handle_OpenGl_GraphicDriver_Header
+
+#include <Standard_DefineHandle.hxx>
+#include <Handle_Graphic3d_GraphicDriver.hxx>
+
+class OpenGl_GraphicDriver;
+
+// Handle definition
+//
+DEFINE_STANDARD_HANDLE(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
+
+#endif //_Handle_OpenGl_GraphicDriver_Header
--- /dev/null
+// File: Handle_OpenGl_Trihedron.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _Handle_OpenGl_Trihedron_Header
+#define _Handle_OpenGl_Trihedron_Header
+
+#include <Standard_DefineHandle.hxx>
+#include <Handle_MMgt_TShared.hxx>
+
+class OpenGl_Trihedron;
+
+// Handle definition
+//
+DEFINE_STANDARD_HANDLE(OpenGl_Trihedron,MMgt_TShared)
+
+
+#endif //_Handle_OpenGl_Trihedron_Header
--- /dev/null
+// File: Handle_OpenGl_View.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _Handle_OpenGl_View_Header
+#define _Handle_OpenGl_View_Header
+
+#include <Standard_DefineHandle.hxx>
+#include <Handle_MMgt_TShared.hxx>
+
+class OpenGl_View;
+
+// Handle definition
+//
+DEFINE_STANDARD_HANDLE(OpenGl_View,MMgt_TShared)
+
+
+#endif //_Handle_OpenGl_View_Header
--- /dev/null
+// File: Handle_OpenGl_Window.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _Handle_OpenGl_Window_Header
+#define _Handle_OpenGl_Window_Header
+
+#include <Standard_DefineHandle.hxx>
+#include <Handle_MMgt_TShared.hxx>
+
+class OpenGl_Window;
+
+// Handle definition
+//
+DEFINE_STANDARD_HANDLE(OpenGl_Window,MMgt_TShared)
+
+
+#endif //_Handle_OpenGl_Window_Header
--- /dev/null
+// File: Handle_OpenGl_Workspace.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _Handle_OpenGl_Workspace_Header
+#define _Handle_OpenGl_Workspace_Header
+
+#include <Standard_DefineHandle.hxx>
+#include <Handle_OpenGl_Window.hxx>
+
+class OpenGl_Workspace;
+
+// Handle definition
+//
+DEFINE_STANDARD_HANDLE(OpenGl_Workspace,OpenGl_Window)
+
+
+#endif //_Handle_OpenGl_Workspace_Header
+++ /dev/null
---
--- Package: OpenGl
--- Author: CAL
--- Created: Mercredi 4 Janvier 1995
--- Updated: 20/08/97 ; PCT : ajout texture mapping
--- 27/01/98 ; FMN : Delete GEOMLITE
---
--- Copyright: MatraDatavision 1995
---
--- Purpose: Specifications definitives
---
-
-package OpenGl
-
- ---Version:
-
- ---Purpose: This package contains the common OpenGl graphic interface.
-
- ---Keywords: OpenGl, CInterface
-
- ---Warning: No class in this package. It is used only to archive
- -- all the objects files in a library.
- ---References:
-
-uses
-
- OSD,
- TColStd,
- TCollection,
- Aspect,
- Quantity,
- Graphic3d,
- Image,
- AlienImage
-
-is
-
- exception Error inherits NumericError from Standard;
-
- class GraphicDriver;
- ---Purpose: Defines a graphic driver for the opengl interface
-
-end OpenGl;
--- /dev/null
+// File: OpenGl_ArbVBO.hxx
+// Created: 26 January 2012
+// Author: Kirill GAVRILOV
+// Copyright: OPEN CASCADE 2012
+
+#ifndef _OpenGl_ArbVBO_H__
+#define _OpenGl_ArbVBO_H__
+
+#if (defined(_WIN32) || defined(__WIN32__))
+ #include <windows.h>
+#endif
+#include <GL/gl.h>
+
+typedef ptrdiff_t GLsizeiptr;
+
+//! VBO is part of OpenGL since 1.5
+struct OpenGl_ArbVBO
+{
+ #ifndef GL_ARRAY_BUFFER_ARB
+ #define GL_ARRAY_BUFFER_ARB 0x8892
+ #endif
+ #ifndef GL_STATIC_DRAW_ARB
+ #define GL_STATIC_DRAW_ARB 0x88E4
+ #endif
+ #ifndef GL_ELEMENTS_ARRAY_BUFFER_ARB
+ #define GL_ELEMENTS_ARRAY_BUFFER_ARB 0x8893
+ #endif
+
+public:
+
+ typedef void (APIENTRY *glBindBuffer_t) (GLenum target, GLuint buffer);
+ typedef void (APIENTRY *glDeleteBuffers_t) (GLsizei n, const GLuint* buffers);
+ typedef void (APIENTRY *glGenBuffers_t) (GLsizei n, GLuint* buffers);
+ typedef void (APIENTRY *glBufferData_t) (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
+
+public:
+
+ glGenBuffers_t glGenBuffersARB;
+ glBindBuffer_t glBindBufferARB;
+ glBufferData_t glBufferDataARB;
+ glDeleteBuffers_t glDeleteBuffersARB;
+
+};
+
+#endif // _OpenGl_ArbVBO_H__
--- /dev/null
+// File: OpenGl_AspectFace.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_AspectFace.hxx>
+
+#include <InterfaceGraphic_Graphic3d.hxx>
+#include <Aspect_PolygonOffsetMode.hxx>
+
+/*----------------------------------------------------------------------*/
+
+static const TEL_CONTEXT_FACE myDefaultAspectFace =
+{
+ Aspect_IS_SOLID,
+ TOn, TEL_HS_SOLID, TOn, TelCullNone,
+ { 0.2F, 0.8F, 0.1F, 0.0F, /* amb, diff, spec, emsv */
+ 1.0F, 10.0F, 0.0F, /* trans, shine, env_reflexion */
+ 0, /* isphysic */
+ (OPENGL_AMBIENT_MASK | OPENGL_DIFFUSE_MASK | OPENGL_SPECULAR_MASK), /* color_mask */
+ {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* ambient color */
+ {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* diffuse color */
+ {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* specular color */
+ {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* emissive color */
+ {{ 1.0F, 1.0F, 1.0F, 1.0F }} /* material color */
+ },
+ { 0.2F, 0.8F, 0.1F, 0.0F, /* amb, diff, spec, emsv */
+ 1.0F, 10.0F, 0.0F, /* trans, shine, env_reflexion */
+ 0, /* isphysic */
+ (OPENGL_AMBIENT_MASK | OPENGL_DIFFUSE_MASK | OPENGL_SPECULAR_MASK), /* color_mask */
+ {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* ambient color */
+ {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* diffuse color */
+ {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* specular color */
+ {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* emissive color */
+ {{ 1.0F, 1.0F, 1.0F, 1.0F }} /* material color */
+ },
+ 0, -1, { Aspect_POM_Fill, 1.0F, 0.0F }
+};
+
+/*----------------------------------------------------------------------*/
+
+static void ConvertMaterial (const CALL_DEF_MATERIAL &material, OPENGL_SURF_PROP &surface)
+{
+ /* Cas par cas pour l evaluation */
+ surface.amb = material.IsAmbient? material.Ambient : 0.F;
+ surface.diff = material.IsDiffuse? material.Diffuse : 0.F;
+ surface.spec = material.IsSpecular? material.Specular : 0.F;
+ surface.emsv = material.IsEmission? material.Emission : 0.F;
+
+ /* type de materiel */
+ surface.isphysic = material.IsPhysic? 1 : 0;
+
+ /* Couleur du materiel */
+ surface.color_mask = 0;
+ if ( material.IsAmbient )
+ surface.color_mask |= OPENGL_AMBIENT_MASK;
+ if ( material.IsDiffuse )
+ surface.color_mask |= OPENGL_DIFFUSE_MASK;
+ if ( material.IsSpecular )
+ surface.color_mask |= OPENGL_SPECULAR_MASK;
+ if ( material.IsEmission )
+ surface.color_mask |= OPENGL_EMISSIVE_MASK;
+
+ /* Couleur eclairage ambient */
+ surface.ambcol.rgb[0] = material.ColorAmb.r;
+ surface.ambcol.rgb[1] = material.ColorAmb.g;
+ surface.ambcol.rgb[2] = material.ColorAmb.b;
+ surface.ambcol.rgb[3] = 1.F;
+
+ /* Couleur eclairage diffus */
+ surface.difcol.rgb[0] = material.ColorDif.r;
+ surface.difcol.rgb[1] = material.ColorDif.g;
+ surface.difcol.rgb[2] = material.ColorDif.b;
+ surface.difcol.rgb[3] = 1.F;
+
+ /* Couleur eclairage speculaire */
+ surface.speccol.rgb[0] = material.ColorSpec.r;
+ surface.speccol.rgb[1] = material.ColorSpec.g;
+ surface.speccol.rgb[2] = material.ColorSpec.b;
+ surface.speccol.rgb[3] = 1.F;
+
+ /* Couleur d emission */
+ surface.emscol.rgb[0] = material.ColorEms.r;
+ surface.emscol.rgb[1] = material.ColorEms.g;
+ surface.emscol.rgb[2] = material.ColorEms.b;
+ surface.emscol.rgb[3] = 1.F;
+
+ surface.shine = ( float )128 * material.Shininess;
+ surface.env_reflexion = material.EnvReflexion;
+
+ /* Dans la couche C++ :
+ * prop->trans = 0. => opaque
+ * prop->trans = 1. => transparent
+ * in OpenGl it is opposite.
+ */
+ surface.trans = 1.0F - material.Transparency;
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_AspectFace::OpenGl_AspectFace ()
+ : myContext(myDefaultAspectFace)
+{}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_AspectFace::SetContext (const CALL_DEF_CONTEXTFILLAREA &AContext)
+{
+ //TelInteriorStyle
+ myContext.InteriorStyle = (Aspect_InteriorStyle) AContext.Style;
+
+ //TelEdgeFlag
+ myContext.Edge = AContext.Edge ? TOn : TOff;
+
+ //TelInteriorStyleIndex
+ switch( AContext.Hatch )
+ {
+ case 0 : /* Aspect_HS_HORIZONTAL */
+ myContext.Hatch = TEL_HS_HORIZONTAL;
+ break;
+ case 1 : /* Aspect_HS_HORIZONTAL_WIDE */
+ myContext.Hatch = TEL_HS_HORIZONTAL_SPARSE;
+ break;
+ case 2 : /* Aspect_HS_VERTICAL */
+ myContext.Hatch = TEL_HS_VERTICAL;
+ break;
+ case 3 : /* Aspect_HS_VERTICAL_WIDE */
+ myContext.Hatch = TEL_HS_VERTICAL_SPARSE;
+ break;
+ case 4 : /* Aspect_HS_DIAGONAL_45 */
+ myContext.Hatch = TEL_HS_DIAG_45;
+ break;
+ case 5 : /* Aspect_HS_DIAGONAL_45_WIDE */
+ myContext.Hatch = TEL_HS_DIAG_45_SPARSE;
+ break;
+ case 6 : /* Aspect_HS_DIAGONAL_135 */
+ myContext.Hatch = TEL_HS_DIAG_135;
+ break;
+ case 7 : /* Aspect_HS_DIAGONAL_135_WIDE */
+ myContext.Hatch = TEL_HS_DIAG_135_SPARSE;
+ break;
+ case 8 : /* Aspect_HS_GRID */
+ myContext.Hatch = TEL_HS_GRID;
+ break;
+ case 9 : /* Aspect_HS_GRID_WIDE */
+ myContext.Hatch = TEL_HS_GRID_SPARSE;
+ break;
+ case 10 : /* Aspect_HS_GRID_DIAGONAL */
+ myContext.Hatch = TEL_HS_CROSS;
+ break;
+ case 11 : /* Aspect_HS_GRID_DIAGONAL_WIDE */
+ myContext.Hatch = TEL_HS_CROSS_SPARSE;
+ break;
+ default :
+ myContext.Hatch = 0;
+ break;
+ }
+
+ //TelFaceDistinguishingMode
+ myContext.DistinguishingMode = AContext.Distinguish ? TOn : TOff;
+
+ //TelFaceCullingMode
+ myContext.CullingMode = AContext.BackFace ? TelCullBack : TelCullNone;
+
+ //TelSurfaceAreaProperties
+ ConvertMaterial(AContext.Front,myContext.IntFront);
+
+ //TelBackSurfaceAreaProperties
+ ConvertMaterial(AContext.Back,myContext.IntBack);
+
+ //TelInteriorColour
+ myContext.IntFront.matcol.rgb[0] = (float) AContext.IntColor.r;
+ myContext.IntFront.matcol.rgb[1] = (float) AContext.IntColor.g;
+ myContext.IntFront.matcol.rgb[2] = (float) AContext.IntColor.b;
+ myContext.IntFront.matcol.rgb[3] = 1.f;
+
+ //TelBackInteriorColour
+ myContext.IntBack.matcol.rgb[0] = (float) AContext.BackIntColor.r;
+ myContext.IntBack.matcol.rgb[1] = (float) AContext.BackIntColor.g;
+ myContext.IntBack.matcol.rgb[2] = (float) AContext.BackIntColor.b;
+ myContext.IntBack.matcol.rgb[3] = 1.f;
+
+ //TelDoTextureMap
+ myContext.doTextureMap = AContext.Texture.doTextureMap;
+
+ //TelTextureId
+ myContext.TexId = AContext.Texture.TexId;
+
+ //TelPolygonOffset
+ myContext.PolygonOffset.mode = (Aspect_PolygonOffsetMode) AContext.PolygonOffsetMode;
+ myContext.PolygonOffset.factor = AContext.PolygonOffsetFactor;
+ myContext.PolygonOffset.units = AContext.PolygonOffsetUnits;
+
+ CALL_DEF_CONTEXTLINE anEdgeContext;
+
+ //TelEdgeColour
+ anEdgeContext.Color.r = (float) AContext.EdgeColor.r;
+ anEdgeContext.Color.g = (float) AContext.EdgeColor.g;
+ anEdgeContext.Color.b = (float) AContext.EdgeColor.b;
+
+ //TelEdgeType
+ anEdgeContext.LineType = (Aspect_TypeOfLine) AContext.LineType;
+
+ //TelEdgeWidth
+ anEdgeContext.Width = (float) AContext.Width;
+
+ myAspectEdge.SetContext(anEdgeContext);
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_AspectFace::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ AWorkspace->SetAspectFace(this);
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_AspectFace.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_AspectFace_Header
+#define _OpenGl_AspectFace_Header
+
+#include <InterfaceGraphic_telem.hxx>
+#include <Aspect_InteriorStyle.hxx>
+
+#include <OpenGl_AspectLine.hxx>
+
+#define OPENGL_AMBIENT_MASK (1<<0)
+#define OPENGL_DIFFUSE_MASK (1<<1)
+#define OPENGL_SPECULAR_MASK (1<<2)
+#define OPENGL_EMISSIVE_MASK (1<<3)
+
+struct OPENGL_SURF_PROP
+{
+ float amb, diff, spec, emsv;
+ float trans, shine;
+ float env_reflexion;
+ int isphysic;
+ unsigned int color_mask;
+ TEL_COLOUR speccol, difcol, ambcol, emscol, matcol;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+struct TEL_CONTEXT_FACE
+{
+ Aspect_InteriorStyle InteriorStyle;
+ int Edge;
+ int Hatch;
+ int DistinguishingMode;
+ int CullingMode;
+ OPENGL_SURF_PROP IntFront;
+ OPENGL_SURF_PROP IntBack;
+ int doTextureMap;
+ int TexId;
+ TEL_POFFSET_PARAM PolygonOffset;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#include <OpenGl_Element.hxx>
+
+class OpenGl_AspectFace : public OpenGl_Element
+{
+ public:
+
+ OpenGl_AspectFace ();
+ virtual ~OpenGl_AspectFace () {}
+
+ void SetContext (const CALL_DEF_CONTEXTFILLAREA &AContext);
+
+ void SetContext (const TEL_CONTEXT_FACE &AContext) { myContext = AContext; }
+ void SetAspectEdge (const OpenGl_AspectLine * AnAspectEdge) { myAspectEdge = *AnAspectEdge; }
+
+ const TEL_CONTEXT_FACE & Context() const { return myContext; }
+ const OpenGl_AspectLine * AspectEdge() const { return &myAspectEdge; }
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ TEL_CONTEXT_FACE myContext;
+ OpenGl_AspectLine myAspectEdge;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //_OpenGl_AspectFace_Header
--- /dev/null
+// File: OpenGl_AspectLine.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_AspectLine.hxx>
+
+static const TEL_COLOUR myDefaultColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }};
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_AspectLine::OpenGl_AspectLine ()
+ : myColor(myDefaultColor),
+ myType(Aspect_TOL_SOLID),
+ myWidth(1.0F)
+{}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_AspectLine::OpenGl_AspectLine (const OpenGl_AspectLine &AnOther)
+ : myColor(AnOther.myColor),
+ myType(AnOther.myType),
+ myWidth(AnOther.myWidth)
+{}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_AspectLine::SetContext (const CALL_DEF_CONTEXTLINE &AContext)
+{
+ myColor.rgb[0] = (float) AContext.Color.r;
+ myColor.rgb[1] = (float) AContext.Color.g;
+ myColor.rgb[2] = (float) AContext.Color.b;
+ myColor.rgb[3] = 1.0f;
+ myType = (Aspect_TypeOfLine) AContext.LineType;
+ myWidth = (float) AContext.Width;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_AspectLine::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ AWorkspace->SetAspectLine(this);
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_AspectLine.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_AspectLine_Header
+#define _OpenGl_AspectLine_Header
+
+#include <InterfaceGraphic_telem.hxx>
+#include <Aspect_TypeOfLine.hxx>
+
+#include <OpenGl_Element.hxx>
+
+class OpenGl_AspectLine : public OpenGl_Element
+{
+ public:
+
+ OpenGl_AspectLine ();
+ OpenGl_AspectLine (const OpenGl_AspectLine &AnOther);
+ virtual ~OpenGl_AspectLine () {}
+
+ void SetContext (const CALL_DEF_CONTEXTLINE &AContext);
+
+ const TEL_COLOUR & Color() const { return myColor; }
+ Aspect_TypeOfLine Type() const { return myType; }
+ float Width() const { return myWidth; }
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ TEL_COLOUR myColor;
+ Aspect_TypeOfLine myType;
+ float myWidth;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //_OpenGl_AspectLine_Header
--- /dev/null
+// File: OpenGl_AspectMarker.cxx
+// Created: 14 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_AspectMarker.hxx>
+
+static const TEL_COLOUR myDefaultColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }};
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_AspectMarker::OpenGl_AspectMarker ()
+ : myColor(myDefaultColor),
+ myType(Aspect_TOM_PLUS),
+ myScale(1.0F)
+{}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_AspectMarker::SetContext (const CALL_DEF_CONTEXTMARKER &AContext)
+{
+ myColor.rgb[0] = (float) AContext.Color.r;
+ myColor.rgb[1] = (float) AContext.Color.g;
+ myColor.rgb[2] = (float) AContext.Color.b;
+ myColor.rgb[3] = 1.0f;
+ myType = (Aspect_TypeOfMarker) AContext.MarkerType;
+ myScale = (float) AContext.Scale;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_AspectMarker::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ AWorkspace->SetAspectMarker(this);
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_AspectMarker.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_AspectMarker_Header
+#define OpenGl_AspectMarker_Header
+
+#include <InterfaceGraphic_telem.hxx>
+#include <Aspect_TypeOfMarker.hxx>
+
+#include <OpenGl_Element.hxx>
+
+class OpenGl_AspectMarker : public OpenGl_Element
+{
+ public:
+
+ OpenGl_AspectMarker ();
+ virtual ~OpenGl_AspectMarker () {}
+
+ void SetContext (const CALL_DEF_CONTEXTMARKER &AContext);
+
+ const TEL_COLOUR & Color() const { return myColor; }
+ Aspect_TypeOfMarker Type() const { return myType; }
+ float Scale() const { return myScale; }
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ TEL_COLOUR myColor;
+ Aspect_TypeOfMarker myType;
+ float myScale;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_AspectMarker_Header
--- /dev/null
+// File: OpenGl_AspectText.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_AspectText.hxx>
+
+static const TEL_COLOUR myDefaultColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }};
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_AspectText::OpenGl_AspectText ()
+ : myZoomable(0),
+ myAngle(0.0F),
+ myFontAspect(OSD_FA_Regular),
+ myFont(NULL),
+ //mySpace(0.3F),
+ //myExpan(1.0F),
+ myColor(myDefaultColor),
+ myStyleType(Aspect_TOST_NORMAL),
+ myDisplayType(Aspect_TODT_NORMAL),
+ mySubtitleColor(myDefaultColor)
+{
+ SetFontName( (const char *) "Courier" );
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_AspectText::~OpenGl_AspectText ()
+{
+ if (myFont)
+ delete[] myFont;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_AspectText::SetContext (const CALL_DEF_CONTEXTTEXT &AContext)
+{
+ myZoomable = (int) AContext.TextZoomable;
+ myAngle = (float) AContext.TextAngle;
+ myFontAspect = (OSD_FontAspect) AContext.TextFontAspect;
+ //mySpace = (float) AContext.Space;
+ //myExpan = (float) AContext.Expan;
+ myColor.rgb[0] = (float) AContext.Color.r;
+ myColor.rgb[1] = (float) AContext.Color.g;
+ myColor.rgb[2] = (float) AContext.Color.b;
+ myColor.rgb[3] = 1.0f;
+ myStyleType = (Aspect_TypeOfStyleText) AContext.Style;
+ myDisplayType = (Aspect_TypeOfDisplayText) AContext.DisplayType;
+ mySubtitleColor.rgb[0] = (float) AContext.ColorSubTitle.r;
+ mySubtitleColor.rgb[1] = (float) AContext.ColorSubTitle.g;
+ mySubtitleColor.rgb[2] = (float) AContext.ColorSubTitle.b;
+ mySubtitleColor.rgb[3] = 1.0f;
+
+ SetFontName( (const char *) AContext.Font );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_AspectText::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ AWorkspace->SetAspectText(this);
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_AspectText::SetFontName (const char *AFont)
+{
+ if (myFont)
+ delete[] myFont;
+ char *fontname = new char[ strlen( AFont ) + 1 ];
+ strcpy( fontname, AFont );
+ myFont = fontname;
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_AspectText.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_AspectText_Header
+#define OpenGl_AspectText_Header
+
+#include <InterfaceGraphic_telem.hxx>
+#include <OSD_FontAspect.hxx>
+#include <Aspect_TypeOfStyleText.hxx>
+#include <Aspect_TypeOfDisplayText.hxx>
+
+#include <OpenGl_Element.hxx>
+
+class OpenGl_AspectText : public OpenGl_Element
+{
+ public:
+
+ OpenGl_AspectText ();
+ virtual ~OpenGl_AspectText ();
+
+ void SetContext (const CALL_DEF_CONTEXTTEXT &AContext);
+
+ int IsZoomable() const { return myZoomable; }
+ float Angle() const { return myAngle; }
+ OSD_FontAspect FontAspect() const { return myFontAspect; }
+ const char * Font() const { return myFont; }
+ const TEL_COLOUR & Color() const { return myColor; }
+ Aspect_TypeOfStyleText StyleType() const { return myStyleType; }
+ Aspect_TypeOfDisplayText DisplayType() const { return myDisplayType; }
+ const TEL_COLOUR & SubtitleColor() const { return mySubtitleColor; }
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ void SetFontName (const char *AFont);
+
+ int myZoomable;
+ float myAngle;
+ OSD_FontAspect myFontAspect;
+ const char *myFont;
+ //float mySpace;
+ //float myExpan;
+ TEL_COLOUR myColor;
+ Aspect_TypeOfStyleText myStyleType;
+ Aspect_TypeOfDisplayText myDisplayType;
+ TEL_COLOUR mySubtitleColor;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_AspectText_Header
--
--- File: OpenGl_CMPLRS.edl
--- Author: Stephane Callegari
--- History: 13-12-96 : CAL : Creation
--- 01-11-97 : BGN : Portage HP/OpenGL
--- (avec option +a1 pour C++, et -Aa pour C)
--- Copyright: Matra Datavision 1996
+-- File: OpenGl_CMPLRS.edl
+-- Author: Stephane Callegari
+-- History: 13-12-96 : CAL : Creation
+-- Copyright: Matra Datavision 1996
--
@ifnotdefined ( %OpenGl_CMPLRS_EDL) then
@string %CMPLRS_CXX_Options += %CSF_X11_INCLUDE " " %CSF_OPENGL_INCLUDE " " %CSF_FTGL_INCLUDES " " %CSF_FREETYPE_INCLUDES " " %CSF_GL2PS_INCLUDES " ";
@string %CMPLRS_C_Options += %CSF_X11_INCLUDE " " %CSF_OPENGL_INCLUDE " " %CSF_FTGL_INCLUDES " " %CSF_FREETYPE_INCLUDES " " %CSF_GL2PS_INCLUDES " ";
- @if ( %Station == "hp" ) then
-
- @string %CMPLRS_C_Options += " -D_HPUX_SOURCE";
-
- @if ( %DebugMode == "False" ) then
- @set %CMPLRS_C_ModeOpt = "+O1 -DNo_Exception ";
- @set %CMPLRS_F77_ModeOpt = "+O1";
- @endif;
-
- @endif;
-
- @if ( %Station == "ao1" ) then
-
- @string %CMPLRS_C_Options += " -DJWR_DEC_TRIFAN_BUG";
- @string %CMPLRS_C_Options += " -std1";
-
- @endif;
-
- -- FMN @string %CMPLRS_C_Options += " -DLMC_COLOR";
- @string %CMPLRS_C_Options += " -DSILGL -DSILGL_VRS=50";
-
-
-
@endif;
-
--- /dev/null
+// File: OpenGl_CView.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_CView_Header
+#define OpenGl_CView_Header
+
+#include <InterfaceGraphic_telem.hxx>
+
+#include <OpenGl_Workspace.hxx>
+#include <OpenGl_View.hxx>
+
+struct OpenGl_CView
+{
+ Handle_OpenGl_Workspace WS;
+ Handle_OpenGl_View View;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_CView_Header
--- /dev/null
+// File: OpenGl_Callback.hxx
+// Created: 25 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_Callback_HeaderFile
+#define _OpenGl_Callback_HeaderFile
+
+#include <InterfaceGraphic_Graphic3d.hxx>
+
+#include <OpenGl_Element.hxx>
+
+typedef OpenGl_Element * (*OpenGl_UserDrawCallback)(const CALL_DEF_USERDRAW *);
+
+Standard_EXPORT OpenGl_UserDrawCallback & UserDrawCallback ();
+
+#endif //_OpenGl_Callback_HeaderFile
--- /dev/null
+// File: OpenGl_Context.cxx
+// Created: 26 January 2012
+// Author: Kirill GAVRILOV
+// Copyright: OPEN CASCADE 2012
+
+#include <OpenGl_Context.hxx>
+
+IMPLEMENT_STANDARD_HANDLE (OpenGl_Context, Standard_Transient)
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Context, Standard_Transient)
+
+#if (!defined(_WIN32) && !defined(__WIN32__))
+ #include <GL/glx.h>
+#endif
+
+// =======================================================================
+// function : OpenGl_Context
+// purpose :
+// =======================================================================
+OpenGl_Context::OpenGl_Context()
+: arbVBO (NULL),
+ extFBO (NULL)
+{
+ //
+}
+
+// =======================================================================
+// function : ~OpenGl_Context
+// purpose :
+// =======================================================================
+OpenGl_Context::~OpenGl_Context()
+{
+ //
+}
+
+// =======================================================================
+// function : CheckExtension
+// purpose :
+// =======================================================================
+Standard_Boolean OpenGl_Context::CheckExtension (const char* theExtName,
+ const char* theExtString)
+{
+ if (theExtName == NULL
+ || theExtString == NULL) {
+ std::cerr << "CheckExtension called with NULL string! No GL context?\n";
+ return Standard_False;
+ }
+
+ // Search for theExtName in the extensions string.
+ // Use of strstr() is not sufficient because extension names can be prefixes of other extension names.
+ char* aPtrIter = (char* )theExtString;
+ int anExtNameLen = strlen(theExtName);
+ const char* aPtrEnd = aPtrIter + strlen(theExtString);
+
+ while (aPtrIter < aPtrEnd)
+ {
+ int n = strcspn (aPtrIter, " ");
+ if ((n == anExtNameLen) && (strncmp (theExtName, aPtrIter, n) == 0))
+ return Standard_True;
+
+ aPtrIter += (n + 1);
+ }
+ return Standard_False;
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void OpenGl_Context::Init()
+{
+ const char* anExtString = (const char* )glGetString (GL_EXTENSIONS);
+ if (CheckExtension ("GL_ARB_vertex_buffer_object", anExtString))
+ {
+ arbVBO = new OpenGl_ArbVBO();
+ memset(arbVBO, 0, sizeof(OpenGl_ArbVBO)); // nullify whole structure for safety
+ if (!FindProc ("glGenBuffersARB", arbVBO->glGenBuffersARB)
+ || !FindProc ("glBindBufferARB", arbVBO->glBindBufferARB)
+ || !FindProc ("glBufferDataARB", arbVBO->glBufferDataARB)
+ || !FindProc ("glDeleteBuffersARB", arbVBO->glDeleteBuffersARB))
+ {
+ delete arbVBO;
+ arbVBO = NULL;
+ }
+ }
+
+ if (CheckExtension ("GL_EXT_framebuffer_object", anExtString))
+ {
+ extFBO = new OpenGl_ExtFBO();
+ memset(extFBO, 0, sizeof(OpenGl_ExtFBO)); // nullify whole structure for safety
+ if (!FindProc ("glGenFramebuffersEXT", extFBO->glGenFramebuffersEXT)
+ || !FindProc ("glDeleteFramebuffersEXT", extFBO->glDeleteFramebuffersEXT)
+ || !FindProc ("glBindFramebufferEXT", extFBO->glBindFramebufferEXT)
+ || !FindProc ("glFramebufferTexture2DEXT", extFBO->glFramebufferTexture2DEXT)
+ || !FindProc ("glCheckFramebufferStatusEXT", extFBO->glCheckFramebufferStatusEXT)
+ || !FindProc ("glGenRenderbuffersEXT", extFBO->glGenRenderbuffersEXT)
+ || !FindProc ("glDeleteRenderbuffersEXT", extFBO->glDeleteRenderbuffersEXT)
+ || !FindProc ("glBindRenderbufferEXT", extFBO->glBindRenderbufferEXT)
+ || !FindProc ("glRenderbufferStorageEXT", extFBO->glRenderbufferStorageEXT)
+ || !FindProc ("glFramebufferRenderbufferEXT", extFBO->glFramebufferRenderbufferEXT))
+ {
+ delete extFBO;
+ extFBO = NULL;
+ }
+ }
+}
--- /dev/null
+// File: OpenGl_Context.hxx
+// Created: 26 January 2012
+// Author: Kirill GAVRILOV
+// Copyright: OPEN CASCADE 2012
+
+#ifndef _OpenGl_Context_H__
+#define _OpenGl_Context_H__
+
+#include <OpenGl_ArbVBO.hxx>
+#include <OpenGl_ExtFBO.hxx>
+#include <Standard_Transient.hxx>
+#include <Handle_OpenGl_Context.hxx>
+
+#if (!defined(_WIN32) && !defined(__WIN32__))
+ extern "C" {
+ extern void (*glXGetProcAddress (const GLubyte* theProcName))();
+ }
+#endif
+
+//! This class provide access to the GL context and available extensions.
+class OpenGl_Context : public Standard_Transient
+{
+public:
+
+ OpenGl_Context();
+ virtual ~OpenGl_Context();
+
+ //! Initialize available extensions.
+ //! GL context should be active!
+ void Init();
+
+ //! Parse theExtString string for presence of theExtName extension.
+ static Standard_Boolean CheckExtension (const char* theExtName,
+ const char* theExtString);
+
+ //! Auxiliary template to retrieve GL function pointer.
+ //! The context should be bound before call.
+ template <typename FuncType_t>
+ bool FindProc (const char* theFuncName,
+ FuncType_t& theFuncPtr)
+ {
+ #if (defined(_WIN32) || defined(__WIN32__))
+ theFuncPtr = (FuncType_t )wglGetProcAddress (theFuncName);
+ #else
+ theFuncPtr = (FuncType_t )glXGetProcAddress ((const GLubyte* )theFuncName);
+ #endif
+ return (theFuncPtr != NULL);
+ }
+
+public:
+
+ OpenGl_ArbVBO* arbVBO;
+ OpenGl_ExtFBO* extFBO;
+
+public:
+
+ DEFINE_STANDARD_RTTI(OpenGl_Window) // Type definition
+
+};
+
+#endif // _OpenGl_Context_H__
--- /dev/null
+// File: OpenGl_Display.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Display.hxx>
+
+#include <OSD_Environment.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <Aspect_GraphicDeviceDefinitionError.hxx>
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <OpenGl_Light.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(OpenGl_Display,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Display,MMgt_TShared)
+
+Handle(OpenGl_Display) openglDisplay;
+
+namespace
+{
+ #if (defined(_WIN32) || defined(__WIN32__))
+ static char* TheDummyDisplay = "DISPLAY";
+ #endif
+
+ static const OpenGl_Facilities myDefaultFacilities = { 1, 1, 1, 1, OpenGLMaxLights, 10000 };
+};
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Display::OpenGl_Display (const Standard_CString theDisplay)
+: myDisplay(NULL),
+ myFacilities(myDefaultFacilities),
+ myDBuffer(Standard_True),
+ myDither(Standard_True),
+ myBackDither(Standard_False),
+ myWalkthrough(Standard_False),
+ mySymPerspective(Standard_False),
+ myOffsetFactor(1.F),
+ myOffsetUnits(0.F),
+ myAntiAliasingMode(3),
+ myLinestyleBase(0),
+ myPatternBase(0),
+ myMarkerBase(0),
+ myFont(-1),
+ myFontSize(-1)
+{
+#if (defined(_WIN32) || defined(__WIN32__))
+ myDisplay = TheDummyDisplay;
+#else
+ if (theDisplay != NULL && *theDisplay != '\0')
+ {
+ OSD_Environment aDispEnv ("DISPLAY", theDisplay);
+ aDispEnv.Build();
+ }
+
+ // Specifies the hardware display name, which determines the
+ // display and communications domain to be used.
+ // On a POSIX system, if the display_name is NULL, it defaults
+ // to the value of the DISPLAY environment variable.
+ myDisplay = XOpenDisplay (NULL);
+#endif
+
+ Init();
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Display::OpenGl_Display (const Aspect_Display theDisplay)
+: myDisplay(NULL),
+ myFacilities(myDefaultFacilities),
+ myDBuffer(Standard_True),
+ myDither(Standard_True),
+ myBackDither(Standard_False),
+ myWalkthrough(Standard_False),
+ mySymPerspective(Standard_False),
+ myOffsetFactor(1.F),
+ myOffsetUnits(0.F),
+ myAntiAliasingMode(3),
+ myLinestyleBase(0),
+ myPatternBase(0),
+ myMarkerBase(0),
+ myFont(-1),
+ myFontSize(-1)
+{
+#if (defined(_WIN32) || defined(__WIN32__))
+ myDisplay = TheDummyDisplay;
+#else
+ myDisplay = theDisplay;
+#endif
+
+ Init();
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Display::~OpenGl_Display ()
+{
+ // Delete line styles
+ if (myLinestyleBase)
+ {
+ glDeleteLists((GLuint)myLinestyleBase,5);
+ myLinestyleBase = 0;
+ }
+ // Delete surface patterns
+ if (myPatternBase)
+ {
+ glDeleteLists((GLuint)myPatternBase,TEL_HS_USER_DEF_START);
+ myPatternBase = 0;
+ }
+ // Delete markers
+ if (myMarkerBase)
+ {
+ glDeleteLists((GLuint)myMarkerBase,60);
+ myMarkerBase = 0;
+ }
+ // Delete user markers
+ OpenGl_MapOfUserMarker::Iterator itm(myMapOfUM);
+ for (; itm.More(); itm.Next())
+ {
+ const OPENGL_MARKER_DATA &aData = itm.Value();
+ if (aData.Array)
+ {
+ delete[] aData.Array;
+ }
+ else if (aData.ListId != 0)
+ {
+ glDeleteLists ( aData.ListId, 1 );
+ }
+ }
+ myDisplay = NULL;
+}
+
+/*----------------------------------------------------------------------*/
+
+Handle(OpenGl_Window) OpenGl_Display::GetWindow (const Aspect_Drawable AParent) const
+{
+ Handle(OpenGl_Window) aWindow;
+ if ( myMapOfWindows.IsBound( AParent ) )
+ {
+ aWindow = myMapOfWindows.Find( AParent );
+ }
+ return aWindow;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Display::SetWindow (const Aspect_Drawable AParent, const Handle(OpenGl_Window) &AWindow)
+{
+ if ( !myMapOfWindows.IsBound( AParent ) )
+ {
+ myMapOfWindows.Bind( AParent, AWindow );
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//GenerateMarkerBitmap
+void OpenGl_Display::AddUserMarker (const Standard_Integer AIndex,
+ const Standard_Integer AMarkWidth,
+ const Standard_Integer AMarkHeight,
+ const Handle(TColStd_HArray1OfByte)& ATexture)
+{
+ if (!myMapOfUM.IsBound(AIndex))
+ {
+ const OPENGL_MARKER_DATA anEmptyData = { 0, 0, 0, NULL };
+ myMapOfUM.Bind(AIndex,anEmptyData);
+ }
+
+ OPENGL_MARKER_DATA &aData = myMapOfUM.ChangeFind(AIndex);
+
+ if (aData.Array)
+ {
+ delete[] aData.Array;
+ aData.Array = NULL;
+ }
+
+ unsigned char *anArray = new unsigned char[ATexture->Length()];
+
+ const int aByteWidth = AMarkWidth / 8;
+ int i, anIndex = ATexture->Upper() - ATexture->Lower() - aByteWidth + 1;
+ for ( ; anIndex >= 0; anIndex -= aByteWidth )
+ for ( i = 0; i < aByteWidth; i++ )
+ anArray[ATexture->Upper() - ATexture->Lower() - aByteWidth + 1 - anIndex + i ] = ATexture->Value( anIndex + i + 1 );
+
+ aData.Width = AMarkWidth;
+ aData.Height = AMarkHeight;
+ aData.Array = anArray;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Display::UpdateUserMarkers ()
+{
+ OpenGl_MapOfUserMarker::Iterator itm(myMapOfUM);
+ for (; itm.More(); itm.Next())
+ {
+ OPENGL_MARKER_DATA &aData = itm.ChangeValue();
+ if (aData.Array)
+ {
+ if (aData.ListId == 0)
+ aData.ListId = glGenLists(1);
+
+ glNewList( (GLuint)aData.ListId, GL_COMPILE );
+
+ GLint w = ( GLsizei ) aData.Width;
+ GLint h = ( GLsizei ) aData.Height;
+ glBitmap( w, h,
+ 0.5F * ( float )aData.Width, 0.5F * ( float )aData.Height,
+ ( float )30.0, ( float )30.0,
+ ( GLubyte* )aData.Array );
+
+ glEndList();
+
+ delete[] aData.Array;
+ aData.Array = NULL;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+Standard_Integer OpenGl_Display::GetUserMarkerListIndex (const Standard_Integer AIndex) const
+{
+ if (myMapOfUM.IsBound(AIndex))
+ {
+ const OPENGL_MARKER_DATA &aData = myMapOfUM.Find(AIndex);
+ if (!aData.Array)
+ return aData.ListId;
+ }
+ return -1;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Display::Init()
+{
+ if (myDisplay != NULL)
+ {
+ #if (!defined(_WIN32) && !defined(__WIN32__))
+ XSynchronize ((Display* )myDisplay, (getenv("CALL_SYNCHRO_X") != NULL) ? 1 : 0);
+
+ if (getenv("CSF_GraphicSync") != NULL)
+ XSynchronize ((Display* )myDisplay, 1);
+
+ // does the server know about OpenGL & GLX?
+ int aDummy;
+ if (!XQueryExtension ((Display* )myDisplay, "GLX", &aDummy, &aDummy, &aDummy))
+ {
+ #ifdef DEBUG
+ std::cerr << "This system doesn't appear to support OpenGL\n";
+ #endif
+ }
+ #endif
+ }
+ else
+ {
+ TCollection_AsciiString msg("OpenGl_Display::Init");
+ #if (!defined(_WIN32) && !defined(__WIN32__))
+ msg += " : Cannot connect to X server ";
+ msg += XDisplayName ((char*) NULL);
+ #endif
+ Aspect_GraphicDeviceDefinitionError::Raise(msg.ToCString());
+ }
+
+ if (getenv("CALL_OPENGL_NO_DBF") != NULL)
+ myDBuffer = Standard_False;
+
+ if (getenv("CALL_OPENGL_NO_DITHER") != NULL)
+ myDither = Standard_False;
+
+ if (getenv("CALL_OPENGL_NO_BACKDITHER") != NULL)
+ myBackDither = Standard_False;
+
+ if (getenv("CSF_WALKTHROUGH") != NULL)
+ myWalkthrough = Standard_True;
+
+ /* OCC18942: Test if symmetric perspective projection should be turned on */
+ if (getenv("CSF_SYM_PERSPECTIVE") != NULL)
+ mySymPerspective = Standard_True;
+
+ const char* pvalue = getenv("CALL_OPENGL_POLYGON_OFFSET");
+ if (pvalue)
+ {
+ float v1, v2;
+ const int n = sscanf(pvalue, "%f %f", &v1, &v2);
+ if (n > 0) myOffsetFactor = v1;
+ if (n > 1) myOffsetUnits = v2;
+ }
+
+ pvalue = getenv("CALL_OPENGL_ANTIALIASING_MODE");
+ if (pvalue)
+ {
+ int v;
+ if ( sscanf(pvalue,"%d",&v) > 0 ) myAntiAliasingMode = v;
+ }
+}
--- /dev/null
+// File: OpenGl_Display.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_Display_Header
+#define _OpenGl_Display_Header
+
+#include <Handle_OpenGl_Display.hxx>
+#include <MMgt_TShared.hxx>
+
+#include <Standard_CString.hxx>
+#include <TColStd_HArray1OfByte.hxx>
+#include <NCollection_DataMap.hxx>
+
+#include <Aspect_Display.hxx>
+#include <Aspect_Drawable.hxx>
+#include <Aspect_TypeOfLine.hxx>
+#include <Aspect_TypeOfMarker.hxx>
+
+#include <OSD_FontAspect.hxx>
+
+#include <InterfaceGraphic_telem.hxx>
+
+#include <Handle_OpenGl_Window.hxx>
+
+struct OpenGl_Facilities
+{
+ int AntiAliasing;
+ int DepthCueing;
+ int DoubleBuffer;
+ int ZBuffer;
+ int MaxLights;
+ int MaxViews;
+};
+
+struct OPENGL_MARKER_DATA
+{
+ unsigned int ListId;
+ unsigned int Width;
+ unsigned int Height;
+ unsigned char* Array;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+typedef NCollection_DataMap<int,OPENGL_MARKER_DATA> OpenGl_MapOfUserMarker;
+
+class OpenGl_AspectText;
+struct OpenGl_TextParam;
+
+class OpenGl_Display : public MMgt_TShared
+{
+ public:
+ OpenGl_Display (const Standard_CString ADisplay);
+ OpenGl_Display (const Aspect_Display ADisplay);
+ virtual ~OpenGl_Display ();
+
+ Aspect_Display GetDisplay () const { return myDisplay; }
+
+ Handle(OpenGl_Window) GetWindow (const Aspect_Drawable AParent) const;
+ void SetWindow (const Aspect_Drawable AParent, const Handle(OpenGl_Window) &AWindow);
+
+ const OpenGl_Facilities & Facilities () const { return myFacilities; }
+
+ Standard_Boolean DBuffer () const { return myDBuffer; }
+ Standard_Boolean Dither () const { return myDither; }
+ Standard_Boolean BackDither () const { return myBackDither; }
+ Standard_Boolean Walkthrough () const { return myWalkthrough; }
+ Standard_Boolean SymPerspective() const { return mySymPerspective; }
+ Standard_Boolean PolygonOffset (Standard_ShortReal &AFactor, Standard_ShortReal &AUnits) const
+ {
+ AFactor = myOffsetFactor;
+ AUnits = myOffsetUnits;
+ return Standard_True;
+ }
+ Standard_Integer AntiAliasingMode () const { return myAntiAliasingMode; }
+
+ // System attributes
+
+ void InitAttributes ();
+
+ const char * GetStringForMarker (const Aspect_TypeOfMarker AType, const Tfloat AVal) const;
+
+ void SetBaseForMarker () const;
+
+ void SetTypeOfLine (const Aspect_TypeOfLine AType) const;
+
+ void SetTypeOfHatch (const int AType) const;
+
+ // User markers
+
+ void AddUserMarker (const Standard_Integer AIndex,
+ const Standard_Integer AMarkWidth,
+ const Standard_Integer AMarkHeight,
+ const Handle(TColStd_HArray1OfByte)& ATexture);
+
+ void UpdateUserMarkers ();
+
+ Standard_Integer GetUserMarkerListIndex (const Standard_Integer AIndex) const;
+
+ // Fonts
+
+ int FindFont (const char* AFontName, const OSD_FontAspect AFontAspect, const int ABestSize = -1, const float AXScale = 1.F, const float AYScale = 1.F);
+
+ void StringSize (const wchar_t *text, int &width, int &ascent, int &descent);
+
+ void RenderText (const wchar_t *text, const int is2d, const float x, const float y, const float z, const OpenGl_AspectText *aspect, const OpenGl_TextParam *param);
+
+ friend class OpenGl_Window;
+
+ // Type definition
+ //
+ DEFINE_STANDARD_RTTI(OpenGl_Display)
+
+ protected:
+
+ void Init ();
+
+ void ExportText (const wchar_t *text, const int is2d, const float x, const float y, const float z, const OpenGl_AspectText *aspect, const OpenGl_TextParam *param, const float height);
+
+#ifdef HAVE_GL2PS
+ static void getGL2PSFontName(const char *src_font, char *ps_font);
+#endif
+
+ Aspect_Display myDisplay;
+ OpenGl_Facilities myFacilities;
+
+ Standard_Boolean myDBuffer;
+ Standard_Boolean myDither;
+ Standard_Boolean myBackDither;
+ Standard_Boolean myWalkthrough;
+ Standard_Boolean mySymPerspective;
+ Standard_ShortReal myOffsetFactor;
+ Standard_ShortReal myOffsetUnits;
+ Standard_Integer myAntiAliasingMode;
+
+#if (defined(_WIN32) || defined(__WIN32__))
+ NCollection_DataMap<Aspect_Drawable, Handle(OpenGl_Window)> myMapOfWindows;
+#else
+ NCollection_DataMap<Standard_Integer, Handle(OpenGl_Window)> myMapOfWindows;
+#endif
+
+ unsigned int myLinestyleBase;
+ unsigned int myPatternBase;
+ unsigned int myMarkerBase;
+
+ OpenGl_MapOfUserMarker myMapOfUM;
+
+ Standard_Integer myFont;
+ Standard_Integer myFontSize;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+extern Handle(OpenGl_Display) openglDisplay;
+
+#endif //OpenGl_Workspace_Header
--- /dev/null
+// File: OpenGl_Display_1.cxx
+// Created: 25 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Display.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+#include <OpenGl_FontMgr.hxx>
+
+#include <OpenGl_AspectText.hxx>
+
+#ifdef HAVE_GL2PS
+#include <gl2ps.h>
+#endif
+
+/*-----------------------------------------------------------------------------*/
+/*
+* Prototypes variables statiques
+*/
+
+struct FontMapNode
+{
+ const char * EnumName;
+ const char * FontName;
+ OSD_FontAspect FontAspect;
+};
+
+static const FontMapNode myFontMap[] =
+{
+
+#ifdef WNT
+
+ { "Courier" , "Courier New" , OSD_FA_Regular },
+ { "Times-Roman" , "Times New Roman", OSD_FA_Regular },
+ { "Times-Bold" , "Times New Roman", OSD_FA_Bold },
+ { "Times-Italic" , "Times New Roman", OSD_FA_Italic },
+ { "Times-BoldItalic" , "Times New Roman", OSD_FA_BoldItalic },
+ { "ZapfChancery-MediumItalic", "Script" , OSD_FA_Regular },
+ { "Symbol" , "Symbol" , OSD_FA_Regular },
+ { "ZapfDingbats" , "WingDings" , OSD_FA_Regular },
+ { "Rock" , "Arial" , OSD_FA_Regular },
+ { "Iris" , "Lucida Console" , OSD_FA_Regular }
+
+#else //X11
+
+ { "Courier" , "Courier" , OSD_FA_Regular },
+ { "Times-Roman" , "Times" , OSD_FA_Regular },
+ { "Times-Bold" , "Times" , OSD_FA_Bold },
+ { "Times-Italic" , "Times" , OSD_FA_Italic },
+ { "Times-BoldItalic" , "Times" , OSD_FA_BoldItalic },
+ { "Arial" , "Helvetica" , OSD_FA_Regular },
+ { "ZapfChancery-MediumItalic", "-adobe-itc zapf chancery-medium-i-normal--*-*-*-*-*-*-iso8859-1" , OSD_FA_Regular },
+ { "Symbol" , "-adobe-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , OSD_FA_Regular },
+ { "ZapfDingbats" , "-adobe-itc zapf dingbats-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , OSD_FA_Regular },
+ { "Rock" , "-sgi-rock-medium-r-normal--*-*-*-*-p-*-iso8859-1" , OSD_FA_Regular },
+ { "Iris" , "--iris-medium-r-normal--*-*-*-*-m-*-iso8859-1" , OSD_FA_Regular }
+#endif
+
+};
+
+#define NUM_FONT_ENTRIES (sizeof(myFontMap)/sizeof(FontMapNode))
+
+/*-----------------------------------------------------------------------------*/
+
+/*
+* Constants
+*/
+
+#ifdef HAVE_GL2PS
+void OpenGl_Display::getGL2PSFontName (const char *src_font, char *ps_font)
+{
+ /*
+ Convert font name used for rendering to some "good" font names
+ that produce good vector text
+ */
+ static char const *family[] = {"Helvetica", "Courier", "Times"};
+ static char const *italic[] = {"Oblique", "Oblique", "Italic"};
+ static char const *base[] = {"", "", "-Roman"};
+
+ int font = 0;
+ int isBold = 0;
+ int isItalic = 0;
+
+ if( strstr( src_font, "Symbol" ) ){
+ sprintf( ps_font, "%s", "Symbol" );
+ return;
+ }
+
+ if( strstr( src_font, "ZapfDingbats" ) ){
+ sprintf( ps_font, "%s", "WingDings" );
+ return;
+ }
+
+ if ( strstr( src_font, "Courier" ) ){
+ font = 1;
+ }
+ else if ( strstr( src_font, "Times" ) ){
+ font = 2;
+ }
+
+ if ( strstr( src_font, "Bold" ) ){
+ isBold = 1;
+ }
+
+ if ( strstr( src_font, "Italic" ) || strstr( src_font, "Oblique" ) ){
+ isItalic = 1;
+ }
+
+ if ( isBold ){
+ sprintf( ps_font, "%s-%s", family[font], "Bold");
+ if ( isItalic ){
+ sprintf(ps_font, "%s%s", ps_font, italic[font]);
+ }
+ }
+ else if ( isItalic )
+ {
+ sprintf( ps_font, "%s-%s", family[font], italic[font] );
+ }
+ else
+ {
+ sprintf( ps_font, "%s%s", family[font], base[font] );
+ }
+}
+#endif
+
+/*-----------------------------------------------------------------------------*/
+
+/*
+* Fonctions publiques
+*/
+
+/*-----------------------------------------------------------------------------*/
+
+int OpenGl_Display::FindFont (const char* AFontName, const OSD_FontAspect AFontAspect,
+ const int ABestSize, const float AXScale, const float AYScale)
+{
+ if (!AFontName)
+ return -1;
+
+ if (ABestSize != -1)
+ myFontSize = ABestSize;
+
+ OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance();
+
+ Handle(TCollection_HAsciiString) family_name = new TCollection_HAsciiString(AFontName);
+ myFont = mgr->request_font( family_name, AFontAspect, myFontSize );
+
+ if( myFont == -1 )
+ {
+ //try to use font names mapping
+ FontMapNode newTempFont = myFontMap[0];
+ for ( int i = 0; i < NUM_FONT_ENTRIES; ++i )
+ {
+ if ( TCollection_AsciiString(myFontMap[i].EnumName).IsEqual( family_name->ToCString() ) )
+ {
+ newTempFont = myFontMap[i];
+ break;
+ }
+ }
+ family_name = new TCollection_HAsciiString(newTempFont.FontName);
+ myFont = mgr->request_font( family_name, newTempFont.FontAspect, myFontSize );
+ }
+
+ // Requested family name not found -> serach for any font family with given aspect and height
+ if ( myFont == -1 )
+ {
+ family_name = new TCollection_HAsciiString( "" );
+ myFont = mgr->request_font( family_name, AFontAspect, myFontSize );
+ }
+
+ // The last resort: trying to use ANY font available in the system
+ if ( myFont == -1 )
+ {
+ myFont = mgr->request_font( family_name, OSD_FA_Undefined, -1 );
+ }
+
+ if ( myFont != -1 )
+ mgr->setCurrentScale( AXScale, AYScale );
+
+ return myFont;
+}
+
+/*-----------------------------------------------------------------------------*/
+
+void OpenGl_Display::StringSize (const wchar_t *str, int &width, int &ascent, int &descent)
+{
+ ascent = 0;
+ descent = 0;
+ width = 0;
+ if (myFont != -1) {
+ OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance();
+ const FTFont* font = mgr->fontById( myFont );
+ if ( font ) {
+ width = int( mgr->computeWidth( myFont, str ) );
+ ascent = int( font->Ascender() );
+ descent = int( font->Descender() );
+ }
+ }
+}
+
+/*-----------------------------------------------------------------------------*/
+
+void OpenGl_Display::RenderText (const wchar_t* str, const int is2d, const float x, const float y, const float z,
+ const OpenGl_AspectText *aspect, const OpenGl_TextParam *param)
+{
+ OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance();
+ const FTFont* fnt = mgr->fontById( myFont );
+ if ( !fnt )
+ return;
+
+ // FTFont changes texture state when it renders and computes size for the text
+ glPushAttrib(GL_TEXTURE_BIT);
+
+ int widthFont, ascentFont, descentFont;
+ StringSize( str, widthFont, ascentFont, descentFont );
+
+ GLdouble xdis = 0.;
+ switch (param->HAlign)
+ {
+ case Graphic3d_HTA_CENTER:
+ xdis = -0.5 * (GLdouble)widthFont;
+ break;
+ case Graphic3d_HTA_RIGHT:
+ xdis = -(GLdouble)widthFont;
+ break;
+ //case Graphic3d_HTA_LEFT:
+ //default: break;
+ }
+ GLdouble ydis = 0.;
+ switch (param->VAlign)
+ {
+ case Graphic3d_VTA_CENTER:
+ ydis = -0.5 * (GLdouble)ascentFont - descentFont;
+ break;
+ case Graphic3d_VTA_TOP:
+ ydis = -(GLdouble)ascentFont - descentFont;
+ break;
+ //case Graphic3d_VTA_BOTTOM:
+ //default: break;
+ }
+
+ float export_h = 1.;
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ if (is2d)
+ {
+ glLoadIdentity();
+ glTranslatef(x, y, 0.f);
+ glRotatef( 180, 1, 0, 0 );
+ }
+ else
+ {
+ const GLdouble identityMatrix[4][4] =
+ {
+ {1.,0.,0.,0.},
+ {0.,1.,0.,0.},
+ {0.,0.,1.,0.},
+ {0.,0.,0.,1.}
+ };
+
+ GLdouble projMatrix[4][4], modelMatrix[4][4];
+ GLint viewport[4];
+
+ GLdouble wx, wy, wz;
+ GLdouble x1, y1, z1;
+ GLdouble x2, y2, z2;
+
+ glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble*)modelMatrix );
+ glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble*)projMatrix );
+ glGetIntegerv( GL_VIEWPORT, (GLint*)viewport );
+
+ gluProject( x, y, z,
+ (GLdouble*)modelMatrix,
+ (GLdouble*)projMatrix,
+ (GLint*)viewport,
+ &wx, &wy, &wz );
+ glLoadIdentity();
+ gluUnProject( wx, wy, wz,
+ (GLdouble*)identityMatrix, (GLdouble*)projMatrix, (GLint*)viewport,
+ &x1, &y1 , &z1 );
+
+ GLdouble h = (GLdouble)fnt->FaceSize();
+
+ gluUnProject( wx, wy + h - 1., wz,
+ (GLdouble*)identityMatrix, (GLdouble*)projMatrix, (GLint*)viewport,
+ &x2, &y2, &z2 );
+
+ h = (y2-y1)/h;
+
+ glTranslated( x1, y1 , z1 );
+ glRotated(aspect->Angle(), 0, 0, 1);
+ glTranslated(xdis, ydis, 0);
+
+ if( !aspect->IsZoomable() )
+ {
+ glScaled( h, h, h );
+ }
+ else
+ {
+ export_h = (float )h;
+ }
+ }
+
+ GLint renderMode;
+ glGetIntegerv(GL_RENDER_MODE, &renderMode);
+ if ( renderMode == GL_FEEDBACK )
+ {
+#ifdef HAVE_GL2PS
+ export_h = (GLdouble)fnt->FaceSize() / export_h;
+ glPopMatrix();
+ ExportText( str, is2d, x, y, z, aspect, param, export_h );
+#endif
+ }
+ else
+ {
+ mgr->render_text( myFont, str, is2d );
+ glPopMatrix();
+ }
+ glPopAttrib();
+}
+
+/*-----------------------------------------------------------------------------*/
+
+static const int alignmentforgl2ps[3][3] = { {5,2,8}, {4,1,7}, {6,3,9} };
+
+void OpenGl_Display::ExportText (const wchar_t* text, const int is2d, const float x, const float y, const float z,
+ const OpenGl_AspectText *aspect, const OpenGl_TextParam *param, const float height)
+{
+#ifdef HAVE_GL2PS
+
+ int vh = 1;
+ switch (param->HAlign)
+ {
+ case Graphic3d_HTA_CENTER: vh = 2; break;
+ case Graphic3d_HTA_RIGHT: vh = 3; break;
+ //case Graphic3d_HTA_LEFT:
+ //default: break;
+ }
+
+ int vv = 1;
+ switch (param->VAlign)
+ {
+ case Graphic3d_VTA_CENTER: vv = 2; break;
+ case Graphic3d_VTA_TOP: vv = 3; break;
+ //case Graphic3d_VTA_BOTTOM:
+ //default: break;
+ }
+
+ const int alignment = alignmentforgl2ps[vh-1][vv-1];
+
+ const char* fontname = aspect->Font();
+ float angle = aspect->Angle();
+
+ GLubyte zero = 0;
+ char ps_font[64];
+
+ getGL2PSFontName(fontname, ps_font);
+
+ if( is2d )
+ glRasterPos2f( x, y );
+ else
+ glRasterPos3f( x, y, z );
+
+ glBitmap( 1, 1, 0, 0, 0, 0, &zero );
+
+ //szv: workaround for gl2ps!
+ const int len = 4 * (wcslen(text) + 1); //szv: should be more than enough
+ char *astr = new char[len];
+ wcstombs(astr,text,len);
+ gl2psTextOpt(astr, ps_font, height, alignment, angle);
+ delete[] astr;
+
+#endif
+}
--- /dev/null
+// File: OpenGl_Display_2.cxx
+// Created: 25 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Display.hxx>
+
+#ifdef HAVE_GL2PS
+#include <gl2ps.h>
+#endif
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+/*----------------------------------------------------------------------*/
+/*
+* Constantes
+*/
+
+#define DOT_LS 0xCCCC
+#define DASH_DOT_LS 0xFF18
+#define DASH_LS 0xFFC0
+#define DASH_DDOT_LS 0xFF24
+
+static const unsigned int myInteriors[TEL_HS_USER_DEF_START][32] =
+{
+ //TEL_HS_SOLID
+ {
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF
+ },
+ //TEL_HS_CROSS
+ {
+ 0xFFFFFFFF,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB,
+ 0xEEEEEEEE,
+ 0xBBBBBBBB
+ },
+ //TEL_HS_CROSS_SPARSE
+ {
+ 0x81818181,
+ 0x24242424,
+ 0x18181818,
+ 0x42424242,
+ 0x81818181,
+ 0x24242424,
+ 0x18181818,
+ 0x42424242,
+ 0x81818181,
+ 0x24242424,
+ 0x18181818,
+ 0x42424242,
+ 0x81818181,
+ 0x24242424,
+ 0x18181818,
+ 0x42424242,
+ 0x81818181,
+ 0x24242424,
+ 0x18181818,
+ 0x42424242,
+ 0x81818181,
+ 0x24242424,
+ 0x18181818,
+ 0x42424242,
+ 0x81818181,
+ 0x24242424,
+ 0x18181818,
+ 0x42424242,
+ 0x81818181,
+ 0x24242424,
+ 0x18181818,
+ 0x42424242
+ },
+ //TEL_HS_GRID
+ {
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888,
+ 0xFFFFFFFF,
+ 0x88888888
+ },
+ //TEL_HS_GRID_SPARSE
+ {
+ 0xFFFFFFFF,
+ 0x80808080,
+ 0x80808080,
+ 0x80808080,
+ 0xFFFFFFFF,
+ 0x80808080,
+ 0x80808080,
+ 0x80808080,
+ 0xFFFFFFFF,
+ 0x80808080,
+ 0x80808080,
+ 0x80808080,
+ 0xFFFFFFFF,
+ 0x80808080,
+ 0x80808080,
+ 0x80808080,
+ 0xFFFFFFFF,
+ 0x80808080,
+ 0x80808080,
+ 0x80808080,
+ 0xFFFFFFFF,
+ 0x80808080,
+ 0x80808080,
+ 0x80808080,
+ 0xFFFFFFFF,
+ 0x80808080,
+ 0x80808080,
+ 0x80808080,
+ 0xFFFFFFFF,
+ 0x80808080,
+ 0x80808080,
+ 0x80808080
+ },
+ //TEL_HS_DIAG_45
+ {
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222,
+ 0x88888888,
+ 0x22222222
+ },
+ //TEL_HS_DIAG_135
+ {
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444,
+ 0x11111111,
+ 0x44444444
+ },
+ //TEL_HS_HORIZONTAL
+ {
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000
+ },
+ //TEL_HS_VERTICAL
+ {
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111,
+ 0x11111111
+ },
+ //TEL_HS_DIAG_45_SPARSE
+ {
+ 0x80808080,
+ 0x20202020,
+ 0x08080808,
+ 0x02020202,
+ 0x80808080,
+ 0x20202020,
+ 0x08080808,
+ 0x02020202,
+ 0x80808080,
+ 0x20202020,
+ 0x08080808,
+ 0x02020202,
+ 0x80808080,
+ 0x20202020,
+ 0x08080808,
+ 0x02020202,
+ 0x80808080,
+ 0x20202020,
+ 0x08080808,
+ 0x02020202,
+ 0x80808080,
+ 0x20202020,
+ 0x08080808,
+ 0x02020202,
+ 0x80808080,
+ 0x20202020,
+ 0x08080808,
+ 0x02020202,
+ 0x80808080,
+ 0x20202020,
+ 0x08080808,
+ 0x02020202
+ },
+ //TEL_HS_DIAG_135_SPARSE
+ {
+ 0x01010101,
+ 0x04040404,
+ 0x10101010,
+ 0x40404040,
+ 0x01010101,
+ 0x04040404,
+ 0x10101010,
+ 0x40404040,
+ 0x01010101,
+ 0x04040404,
+ 0x10101010,
+ 0x40404040,
+ 0x01010101,
+ 0x04040404,
+ 0x10101010,
+ 0x40404040,
+ 0x01010101,
+ 0x04040404,
+ 0x10101010,
+ 0x40404040,
+ 0x01010101,
+ 0x04040404,
+ 0x10101010,
+ 0x40404040,
+ 0x01010101,
+ 0x04040404,
+ 0x10101010,
+ 0x40404040,
+ 0x01010101,
+ 0x04040404,
+ 0x10101010,
+ 0x40404040
+ },
+ //TEL_HS_HORIZONTAL_SPARSE
+ {
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ 0xFFFFFFFF,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000
+ },
+ //TEL_HS_VERTICAL_SPARSE
+ {
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010,
+ 0x10101010
+ }
+};
+
+/* Following Section relates to POLYMARKER */
+
+#define TEL_NO_OF_SIZES 13
+#define TEL_NB_OF_LISTS 5
+
+struct PM_FONT_INFO
+{
+ const char *str;
+ Tfloat width, height;
+ Tint offset;
+};
+typedef PM_FONT_INFO* pm_font_info;
+
+#define PM_PLUS_10_NUM 9*2
+#define PM_PLUS_15_NUM 11*2
+#define PM_PLUS_20_NUM 13*2
+#define PM_PLUS_25_NUM 15*2
+#define PM_PLUS_30_NUM 17*3
+#define PM_PLUS_35_NUM 19*3
+#define PM_PLUS_40_NUM 21*3
+#define PM_PLUS_45_NUM 23*3
+#define PM_PLUS_50_NUM 25*4
+#define PM_PLUS_55_NUM 27*4
+#define PM_PLUS_60_NUM 29*4
+#define PM_PLUS_65_NUM 31*4
+#define PM_PLUS_70_NUM 32*4
+
+#define PM_STAR_10_NUM 9
+#define PM_STAR_15_NUM 11*2
+#define PM_STAR_20_NUM 13*2
+#define PM_STAR_25_NUM 15*2
+#define PM_STAR_30_NUM 17*2
+#define PM_STAR_35_NUM 19*2
+#define PM_STAR_40_NUM 21*3
+#define PM_STAR_45_NUM 23*3
+#define PM_STAR_50_NUM 25*3
+#define PM_STAR_55_NUM 27*3
+#define PM_STAR_60_NUM 29*4
+#define PM_STAR_65_NUM 32*4
+#define PM_STAR_70_NUM 32*4
+
+#define PM_CIRC_10_NUM 7
+#define PM_CIRC_15_NUM 9*2
+#define PM_CIRC_20_NUM 9*2
+#define PM_CIRC_25_NUM 11*2
+#define PM_CIRC_30_NUM 13*2
+#define PM_CIRC_35_NUM 15*2
+#define PM_CIRC_40_NUM 17*3
+#define PM_CIRC_45_NUM 19*3
+#define PM_CIRC_50_NUM 21*3
+#define PM_CIRC_55_NUM 23*3
+#define PM_CIRC_60_NUM 25*4
+#define PM_CIRC_65_NUM 27*4
+#define PM_CIRC_70_NUM 29*4
+
+#define PM_CROSS_10_NUM 7
+#define PM_CROSS_15_NUM 9*2
+#define PM_CROSS_20_NUM 11*2
+#define PM_CROSS_25_NUM 13*2
+#define PM_CROSS_30_NUM 15*2
+#define PM_CROSS_35_NUM 17*3
+#define PM_CROSS_40_NUM 19*3
+#define PM_CROSS_45_NUM 21*3
+#define PM_CROSS_50_NUM 23*3
+#define PM_CROSS_55_NUM 25*4
+#define PM_CROSS_60_NUM 27*4
+#define PM_CROSS_65_NUM 32*4
+#define PM_CROSS_70_NUM 32*4
+
+#define PM_PLUS_10_OFT 0
+#define PM_PLUS_15_OFT PM_PLUS_10_OFT + PM_PLUS_10_NUM
+#define PM_PLUS_20_OFT PM_PLUS_15_OFT + PM_PLUS_15_NUM
+#define PM_PLUS_25_OFT PM_PLUS_20_OFT + PM_PLUS_20_NUM
+#define PM_PLUS_30_OFT PM_PLUS_25_OFT + PM_PLUS_25_NUM
+#define PM_PLUS_35_OFT PM_PLUS_30_OFT + PM_PLUS_30_NUM
+#define PM_PLUS_40_OFT PM_PLUS_35_OFT + PM_PLUS_35_NUM
+#define PM_PLUS_45_OFT PM_PLUS_40_OFT + PM_PLUS_40_NUM
+#define PM_PLUS_50_OFT PM_PLUS_45_OFT + PM_PLUS_45_NUM
+#define PM_PLUS_55_OFT PM_PLUS_50_OFT + PM_PLUS_50_NUM
+#define PM_PLUS_60_OFT PM_PLUS_55_OFT + PM_PLUS_55_NUM
+#define PM_PLUS_65_OFT PM_PLUS_60_OFT + PM_PLUS_60_NUM
+#define PM_PLUS_70_OFT PM_PLUS_65_OFT + PM_PLUS_65_NUM
+
+#define PM_STAR_10_OFT PM_PLUS_70_OFT + PM_PLUS_70_NUM
+#define PM_STAR_15_OFT PM_STAR_10_OFT + PM_STAR_10_NUM
+#define PM_STAR_20_OFT PM_STAR_15_OFT + PM_STAR_15_NUM
+#define PM_STAR_25_OFT PM_STAR_20_OFT + PM_STAR_20_NUM
+#define PM_STAR_30_OFT PM_STAR_25_OFT + PM_STAR_25_NUM
+#define PM_STAR_35_OFT PM_STAR_30_OFT + PM_STAR_30_NUM
+#define PM_STAR_40_OFT PM_STAR_35_OFT + PM_STAR_35_NUM
+#define PM_STAR_45_OFT PM_STAR_40_OFT + PM_STAR_40_NUM
+#define PM_STAR_50_OFT PM_STAR_45_OFT + PM_STAR_45_NUM
+#define PM_STAR_55_OFT PM_STAR_50_OFT + PM_STAR_50_NUM
+#define PM_STAR_60_OFT PM_STAR_55_OFT + PM_STAR_55_NUM
+#define PM_STAR_65_OFT PM_STAR_60_OFT + PM_STAR_60_NUM
+#define PM_STAR_70_OFT PM_STAR_65_OFT + PM_STAR_65_NUM
+
+#define PM_CIRC_10_OFT PM_STAR_70_OFT + PM_STAR_70_NUM
+#define PM_CIRC_15_OFT PM_CIRC_10_OFT + PM_CIRC_10_NUM
+#define PM_CIRC_20_OFT PM_CIRC_15_OFT + PM_CIRC_15_NUM
+#define PM_CIRC_25_OFT PM_CIRC_20_OFT + PM_CIRC_20_NUM
+#define PM_CIRC_30_OFT PM_CIRC_25_OFT + PM_CIRC_25_NUM
+#define PM_CIRC_35_OFT PM_CIRC_30_OFT + PM_CIRC_30_NUM
+#define PM_CIRC_40_OFT PM_CIRC_35_OFT + PM_CIRC_35_NUM
+#define PM_CIRC_45_OFT PM_CIRC_40_OFT + PM_CIRC_40_NUM
+#define PM_CIRC_50_OFT PM_CIRC_45_OFT + PM_CIRC_45_NUM
+#define PM_CIRC_55_OFT PM_CIRC_50_OFT + PM_CIRC_50_NUM
+#define PM_CIRC_60_OFT PM_CIRC_55_OFT + PM_CIRC_55_NUM
+#define PM_CIRC_65_OFT PM_CIRC_60_OFT + PM_CIRC_60_NUM
+#define PM_CIRC_70_OFT PM_CIRC_65_OFT + PM_CIRC_65_NUM
+
+#define PM_CROSS_10_OFT PM_CIRC_70_OFT + PM_CIRC_70_NUM
+#define PM_CROSS_15_OFT PM_CROSS_10_OFT + PM_CROSS_10_NUM
+#define PM_CROSS_20_OFT PM_CROSS_15_OFT + PM_CROSS_15_NUM
+#define PM_CROSS_25_OFT PM_CROSS_20_OFT + PM_CROSS_20_NUM
+#define PM_CROSS_30_OFT PM_CROSS_25_OFT + PM_CROSS_25_NUM
+#define PM_CROSS_35_OFT PM_CROSS_30_OFT + PM_CROSS_30_NUM
+#define PM_CROSS_40_OFT PM_CROSS_35_OFT + PM_CROSS_35_NUM
+#define PM_CROSS_45_OFT PM_CROSS_40_OFT + PM_CROSS_40_NUM
+#define PM_CROSS_50_OFT PM_CROSS_45_OFT + PM_CROSS_45_NUM
+#define PM_CROSS_55_OFT PM_CROSS_50_OFT + PM_CROSS_50_NUM
+#define PM_CROSS_60_OFT PM_CROSS_55_OFT + PM_CROSS_55_NUM
+#define PM_CROSS_65_OFT PM_CROSS_60_OFT + PM_CROSS_60_NUM
+#define PM_CROSS_70_OFT PM_CROSS_65_OFT + PM_CROSS_65_NUM
+
+static const PM_FONT_INFO arrPMFontInfo[][TEL_NO_OF_SIZES] =
+{
+ /* TOM_POINT - not used */
+ {{"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"}},
+
+ /* TOM_PLUS */
+ {{"\001", 9.f, 9.f, PM_PLUS_10_OFT},
+ {"\002", 11.f, 11.f, PM_PLUS_15_OFT},
+ {"\003", 13.f, 13.f, PM_PLUS_20_OFT},
+ {"\004", 15.f, 15.f, PM_PLUS_25_OFT},
+ {"\005", 17.f, 17.f, PM_PLUS_30_OFT},
+ {"\006", 19.f, 19.f, PM_PLUS_35_OFT},
+ {"\007", 21.f, 21.f, PM_PLUS_40_OFT},
+ {"\010", 23.f, 23.f, PM_PLUS_45_OFT},
+ {"\011", 25.f, 25.f, PM_PLUS_50_OFT},
+ {"\012", 27.f, 27.f, PM_PLUS_55_OFT},
+ {"\013", 29.f, 29.f, PM_PLUS_60_OFT},
+ {"\014", 31.f, 31.f, PM_PLUS_65_OFT},
+ {"\015", 32.f, 32.f, PM_PLUS_70_OFT}},
+
+ /* TOM_STAR */
+ {{"\016", 7.f, 9.f, PM_STAR_10_OFT},
+ {"\017", 9.f, 11.f, PM_STAR_15_OFT},
+ {"\020", 11.f, 13.f, PM_STAR_20_OFT},
+ {"\021", 13.f, 15.f, PM_STAR_25_OFT},
+ {"\022", 13.f, 17.f, PM_STAR_30_OFT},
+ {"\023", 15.f, 19.f, PM_STAR_35_OFT},
+ {"\024", 17.f, 21.f, PM_STAR_40_OFT},
+ {"\025", 19.f, 23.f, PM_STAR_45_OFT},
+ {"\026", 21.f, 25.f, PM_STAR_50_OFT},
+ {"\027", 23.f, 27.f, PM_STAR_55_OFT},
+ {"\030", 25.f, 29.f, PM_STAR_60_OFT},
+ {"\031", 32.f, 32.f, PM_STAR_65_OFT},
+ {"\032", 32.f, 32.f, PM_STAR_70_OFT}},
+
+ /* TOM_O */
+ {{"\033", 7.f, 7.f, PM_CIRC_10_OFT},
+ {"\034", 9.f, 9.f, PM_CIRC_15_OFT},
+ {"\035", 9.f, 9.f, PM_CIRC_20_OFT},
+ {"\036", 11.f, 11.f, PM_CIRC_25_OFT},
+ {"\037", 13.f, 13.f, PM_CIRC_30_OFT},
+ {"\040", 15.f, 15.f, PM_CIRC_35_OFT},
+ {"\041", 17.f, 17.f, PM_CIRC_40_OFT},
+ {"\042", 19.f, 19.f, PM_CIRC_45_OFT},
+ {"\043", 21.f, 21.f, PM_CIRC_50_OFT},
+ {"\044", 23.f, 23.f, PM_CIRC_55_OFT},
+ {"\045", 25.f, 25.f, PM_CIRC_60_OFT},
+ {"\046", 27.f, 27.f, PM_CIRC_65_OFT},
+ {"\047", 29.f, 29.f, PM_CIRC_70_OFT}},
+
+ /* TOM_X */
+ {{"\050", 7.f, 7.f, PM_CROSS_10_OFT},
+ {"\051", 9.f, 9.f, PM_CROSS_15_OFT},
+ {"\052", 11.f, 11.f, PM_CROSS_20_OFT},
+ {"\053", 13.f, 13.f, PM_CROSS_25_OFT},
+ {"\054", 15.f, 15.f, PM_CROSS_30_OFT},
+ {"\055", 17.f, 17.f, PM_CROSS_35_OFT},
+ {"\056", 19.f, 19.f, PM_CROSS_40_OFT},
+ {"\057", 21.f, 21.f, PM_CROSS_45_OFT},
+ {"\060", 23.f, 23.f, PM_CROSS_50_OFT},
+ {"\061", 25.f, 25.f, PM_CROSS_55_OFT},
+ {"\062", 27.f, 27.f, PM_CROSS_60_OFT},
+ {"\063", 32.f, 32.f, PM_CROSS_65_OFT},
+ {"\064", 32.f, 32.f, PM_CROSS_70_OFT}},
+
+ /* TOM_O_POINT - not used */
+ {{"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"},
+ {"\0"}},
+
+ /* TOM_O_PLUS */
+ {{"\001\033"},
+ {"\002\034"},
+ {"\003\035"},
+ {"\004\036"},
+ {"\005\037"},
+ {"\006\040"},
+ {"\007\041"},
+ {"\010\042"},
+ {"\011\043"},
+ {"\012\044"},
+ {"\013\045"},
+ {"\014\046"},
+ {"\015\047"}},
+
+ /* TOM_O_STAR */
+ {{"\016\033"},
+ {"\017\034"},
+ {"\020\035"},
+ {"\021\036"},
+ {"\022\037"},
+ {"\023\040"},
+ {"\024\041"},
+ {"\025\042"},
+ {"\026\043"},
+ {"\027\044"},
+ {"\030\045"},
+ {"\031\046"},
+ {"\032\047"}},
+
+ /* TOM_O_X */
+ {{"\050\033"},
+ {"\051\034"},
+ {"\052\035"},
+ {"\053\036"},
+ {"\054\037"},
+ {"\055\040"},
+ {"\056\041"},
+ {"\057\042"},
+ {"\060\043"},
+ {"\061\044"},
+ {"\062\045"},
+ {"\063\046"},
+ {"\064\047"}}
+};
+
+static const unsigned char myMarkerRaster[] =
+{
+ /* TYPE = PLUS */
+
+ 0x08,0x00,
+ 0x08,0x00,
+ 0x08,0x00,
+ 0x08,0x00,
+ 0xff,0x80,
+ 0x08,0x00,
+ 0x08,0x00,
+ 0x08,0x00,
+ 0x08,0x00, /* PLUS 9x9 = 1.0 */
+
+ 0x04,0x00,
+ 0x04,0x00,
+ 0x04,0x00,
+ 0x04,0x00,
+ 0x04,0x00,
+ 0xff,0xe0,
+ 0x04,0x00,
+ 0x04,0x00,
+ 0x04,0x00,
+ 0x04,0x00,
+ 0x04,0x00, /* PLUS 11x11 = 1.5 */
+
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0xff,0xf8,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,/* PLUS 13x13 = 2.0 */
+
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0xff,0xfe,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,/* PLUS 15x15 = 2.5 */
+
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0xff,0xff, 0x80,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,/* PLUS 17x17 = 3.0 */
+
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0xff,0xff, 0xe0,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,/* PLUS 19x19 = 3.5 */
+
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0xff,0xff, 0xf8,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,/* PLUS 21x21 = 4.0 */
+
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0xff,0xff, 0xfe,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,/* PLUS 23x23 = 4.5 */
+
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0xff,0xff, 0xff,0x80,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,/* PLUS 25x25 = 5.0 */
+
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0xff,0xff, 0xff,0xe0,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,/* PLUS 27x27 = 5.5 */
+
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0xff,0xff, 0xff,0xf8,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,
+ 0x00,0x02, 0x00,0x00,/* PLUS 29x29 = 6.0 */
+
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0xff,0xff, 0xff,0xfd,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,
+ 0x00,0x01, 0x00,0x00,/* PLUS 31x31 = 6.5 */
+
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0xff,0xff, 0xff,0xff,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,/* PLUS 32x32 = 7.0 */
+
+ /* TYPE = STAR */
+
+ 0x10,
+ 0x10,
+ 0xd6,
+ 0x38,
+ 0x10,
+ 0x38,
+ 0xd6,
+ 0x10,
+ 0x10,/* STAR 7x9 = 1.0 */
+
+ 0x08,0x00,
+ 0x08,0x00,
+ 0x08,0x00,
+ 0xc9,0x80,
+ 0x3e,0x00,
+ 0x08,0x00,
+ 0x3e,0x00,
+ 0xc9,0x80,
+ 0x08,0x00,
+ 0x08,0x00,
+ 0x08,0x00,/* STAR 9x11 = 1.5 */
+
+ 0x04,0x00,
+ 0x04,0x00,
+ 0x04,0x00,
+ 0x84,0x20,
+ 0x64,0xc0,
+ 0x1f,0x00,
+ 0x04,0x00,
+ 0x1f,0x00,
+ 0x64,0xc0,
+ 0x84,0x20,
+ 0x04,0x00,
+ 0x04,0x00,
+ 0x04,0x00,/* STAR 11x13 = 2.0 */
+
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x82,0x18,
+ 0x62,0x60,
+ 0x1b,0x80,
+ 0x06,0x00,
+ 0x1b,0x80,
+ 0x62,0x60,
+ 0x82,0x18,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,/* STAR 13x15 = 2.5 */
+
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x82,0x08,
+ 0x62,0x30,
+ 0x12,0x40,
+ 0x0f,0x80,
+ 0x02,0x00,
+ 0x0f,0x80,
+ 0x12,0x40,
+ 0x62,0x30,
+ 0x82,0x08,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,
+ 0x02,0x00,/* STAR 13x17 = 3.0 */
+
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0xc1,0x06,
+ 0x21,0x18,
+ 0x19,0x20,
+ 0x07,0xc0,
+ 0x01,0x00,
+ 0x07,0xc0,
+ 0x19,0x20,
+ 0x21,0x18,
+ 0xc1,0x06,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,
+ 0x01,0x00,/* STAR 15x19 = 3.5 */
+
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x80,0x80, 0x80,
+ 0x60,0x83, 0x00,
+ 0x10,0x8c, 0x00,
+ 0x0c,0x90, 0x00,
+ 0x03,0xe0, 0x00,
+ 0x00,0x80, 0x00,
+ 0x03,0xe0, 0x00,
+ 0x0c,0x90, 0x00,
+ 0x10,0x8c, 0x00,
+ 0x60,0x83, 0x00,
+ 0x80,0x80, 0x80,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,
+ 0x00,0x80, 0x00,/* STAR 17x21 = 4.0 */
+
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0xc0,0x40, 0x60,
+ 0x30,0x41, 0x80,
+ 0x08,0x42, 0x00,
+ 0x06,0x4c, 0x00,
+ 0x01,0xf0, 0x00,
+ 0x00,0x40, 0x00,
+ 0x01,0xf0, 0x00,
+ 0x06,0x4c, 0x00,
+ 0x08,0x42, 0x00,
+ 0x30,0x41, 0x80,
+ 0xc0,0x40, 0x60,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0x40, 0x00,/* STAR 19x23 = 4.5 */
+
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x80,0x20, 0x08,
+ 0x60,0x20, 0x30,
+ 0x18,0x20, 0xc0,
+ 0x04,0x21, 0x00,
+ 0x03,0x26, 0x00,
+ 0x00,0xf8, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0xf8, 0x00,
+ 0x03,0x26, 0x00,
+ 0x04,0x21, 0x00,
+ 0x18,0x20, 0xc0,
+ 0x60,0x20, 0x30,
+ 0x80,0x20, 0x08,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x20, 0x00,/* STAR 21x25 = 5.0 */
+
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0xc0,0x10, 0x06,
+ 0x30,0x10, 0x18,
+ 0x08,0x10, 0x60,
+ 0x06,0x10, 0x80,
+ 0x01,0x93, 0x00,
+ 0x00,0x7c, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x7c, 0x00,
+ 0x01,0x93, 0x00,
+ 0x06,0x10, 0x80,
+ 0x08,0x10, 0x60,
+ 0x30,0x10, 0x18,
+ 0xc0,0x10, 0x06,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x10, 0x00,/* STAR 23x27 = 5.5 */
+
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x80,0x08, 0x00,0x80,
+ 0x60,0x08, 0x03,0x00,
+ 0x18,0x08, 0x0c,0x00,
+ 0x04,0x08, 0x30,0x00,
+ 0x03,0x08, 0x40,0x00,
+ 0x00,0xc9, 0x80,0x00,
+ 0x00,0x3e, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x3e, 0x00,0x00,
+ 0x00,0xc9, 0x80,0x00,
+ 0x03,0x08, 0x40,0x00,
+ 0x04,0x08, 0x30,0x00,
+ 0x18,0x08, 0x0c,0x00,
+ 0x60,0x08, 0x03,0x00,
+ 0x80,0x08, 0x00,0x80,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,/* STAR 25x29 = 6.0 */
+
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x30,0x00, 0x80,0x06,
+ 0x0c,0x00, 0x80,0x18,
+ 0x03,0x00, 0x80,0x60,
+ 0x00,0xc0, 0x81,0x80,
+ 0x00,0x30, 0x86,0x00,
+ 0x00,0x0c, 0x98,0x00,
+ 0x00,0x03, 0xe0,0x00,
+ 0x00,0x03, 0xe0,0x00,
+ 0x00,0x0c, 0x98,0x00,
+ 0x00,0x30, 0x86,0x00,
+ 0x00,0xc0, 0x81,0x80,
+ 0x03,0x00, 0x80,0x60,
+ 0x0c,0x00, 0x80,0x18,
+ 0x30,0x00, 0x80,0x06,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x80,0x00,
+ 0x00,0x00, 0x00,0x00,
+ 0x00,0x00, 0x00,0x00,/* STAR 32x32 = 6.5 */
+
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x10, 0x00, 0x80, 0x04,
+ 0x0c, 0x00, 0x80, 0x18,
+ 0x02, 0x00, 0x80, 0x20,
+ 0x01, 0x80, 0x80, 0xc0,
+ 0x00, 0x40, 0x81, 0x00,
+ 0x00, 0x30, 0x86, 0x00,
+ 0x00, 0x08, 0x88, 0x00,
+ 0x00, 0x06, 0xb0, 0x00,
+ 0x00, 0x01, 0xc0, 0x00,
+ 0x00, 0x06, 0xb0, 0x00,
+ 0x00, 0x08, 0x88, 0x00,
+ 0x00, 0x30, 0x86, 0x00,
+ 0x00, 0x40, 0x81, 0x00,
+ 0x01, 0x80, 0x80, 0xc0,
+ 0x02, 0x00, 0x80, 0x20,
+ 0x0c, 0x00, 0x80, 0x18,
+ 0x10, 0x00, 0x80, 0x04,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x80, 0x00,/* STAR 32x32 = 7.0 */
+
+ /* TYPE = CIRC */
+
+ 0x38,
+ 0x44,
+ 0x82,
+ 0x82,
+ 0x82,
+ 0x44,
+ 0x38,/* CIRC 7x7 = 1.0 */
+
+ 0x3c,0x00,
+ 0x42,0x00,
+ 0x81,0x00,
+ 0x81,0x00,
+ 0x81,0x00,
+ 0x81,0x00,
+ 0x42,0x00,
+ 0x3c,0x00,
+ 0x00,0x00,/*CIRC 9x9 = 1.5 */
+
+ 0x3e, 0x00,
+ 0x41, 0x00,
+ 0x81, 0x80,
+ 0x80,0x80,
+ 0x80,0x80,
+ 0x80,0x80,
+ 0x81, 0x80,
+ 0x41, 0x00,
+ 0x3e,0x00,/* CIRC 9x9 = 2.0 */
+
+ 0x1f,0x00,
+ 0x20,0x80,
+ 0x40,0x40,
+ 0x80,0x20,
+ 0x80,0x20,
+ 0x80,0x20,
+ 0x80,0x20,
+ 0x80,0x20,
+ 0x40,0x40,
+ 0x20,0x80,
+ 0x1f,0x00,/* CIRC 11x11 = 2.5 */
+
+ 0x0f,0x80,
+ 0x10,0x40,
+ 0x20,0x20,
+ 0x40,0x10,
+ 0x80,0x08,
+ 0x80,0x08,
+ 0x80,0x08,
+ 0x80,0x08,
+ 0x80,0x08,
+ 0x40,0x10,
+ 0x20,0x20,
+ 0x10,0x40,
+ 0x0f,0x80,/* CIRC 13x13 = 3.0 */
+
+ 0x07,0xc0,
+ 0x18,0x30,
+ 0x20,0x08,
+ 0x40,0x04,
+ 0x40,0x04,
+ 0x80,0x02,
+ 0x80,0x02,
+ 0x80,0x02,
+ 0x80,0x02,
+ 0x80,0x02,
+ 0x40,0x04,
+ 0x40,0x04,
+ 0x20,0x08,
+ 0x18,0x30,
+ 0x07,0xc0,/* CIRC 15x15 = 3.5 */
+
+ 0x03,0xe0, 0x00,
+ 0x0c,0x18, 0x00,
+ 0x10,0x04, 0x00,
+ 0x20,0x02, 0x00,
+ 0x40,0x01, 0x00,
+ 0x40,0x01, 0x00,
+ 0x80,0x00, 0x80,
+ 0x80,0x00, 0x80,
+ 0x80,0x00, 0x80,
+ 0x80,0x00, 0x80,
+ 0x80,0x00, 0x80,
+ 0x40,0x01, 0x00,
+ 0x40,0x01, 0x00,
+ 0x20,0x02, 0x00,
+ 0x10,0x04, 0x00,
+ 0x0c,0x18, 0x00,
+ 0x03,0xe0, 0x00,/* CIRC 17x17 = 4.0 */
+
+ 0x03,0xf8, 0x00,
+ 0x0e,0x0e, 0x00,
+ 0x18,0x03, 0x00,
+ 0x20,0x00, 0x80,
+ 0x60,0x00, 0xc0,
+ 0x40,0x00, 0x40,
+ 0xc0,0x00, 0x60,
+ 0x80,0x00, 0x20,
+ 0x80,0x00, 0x20,
+ 0x80,0x00, 0x20,
+ 0x80,0x00, 0x20,
+ 0x80,0x00, 0x20,
+ 0xc0,0x00, 0x60,
+ 0x40,0x00, 0x40,
+ 0x60,0x00, 0xc0,
+ 0x20,0x00, 0x80,
+ 0x18,0x03, 0x00,
+ 0x0e,0x0e, 0x00,
+ 0x03,0xf8, 0x00,/* CIRC 19x19 = 4.5 */
+
+ 0x01,0xfc, 0x00,
+ 0x06,0x03, 0x00,
+ 0x08,0x00, 0x80,
+ 0x10,0x00, 0x40,
+ 0x20,0x00, 0x20,
+ 0x40,0x00, 0x10,
+ 0x40,0x00, 0x10,
+ 0x80,0x00, 0x08,
+ 0x80,0x00, 0x08,
+ 0x80,0x00, 0x08,
+ 0x80,0x00, 0x08,
+ 0x80,0x00, 0x08,
+ 0x80,0x00, 0x08,
+ 0x80,0x00, 0x08,
+ 0x40,0x00, 0x10,
+ 0x40,0x00, 0x10,
+ 0x20,0x00, 0x20,
+ 0x10,0x00, 0x40,
+ 0x08,0x00, 0x80,
+ 0x06,0x03, 0x00,
+ 0x01,0xfc, 0x00,/* CIRC 21x21 = 5.0 */
+
+ 0x00,0xfe, 0x00,
+ 0x03,0x01, 0x80,
+ 0x0c,0x00, 0x60,
+ 0x18,0x00, 0x30,
+ 0x30,0x00, 0x18,
+ 0x20,0x00, 0x08,
+ 0x40,0x00, 0x04,
+ 0x40,0x00, 0x04,
+ 0x80,0x00, 0x02,
+ 0x80,0x00, 0x02,
+ 0x80,0x00, 0x02,
+ 0x80,0x00, 0x02,
+ 0x80,0x00, 0x02,
+ 0x80,0x00, 0x02,
+ 0x80,0x00, 0x02,
+ 0x40,0x00, 0x04,
+ 0x40,0x00, 0x04,
+ 0x20,0x00, 0x08,
+ 0x30,0x00, 0x18,
+ 0x18,0x00, 0x30,
+ 0x0c,0x00, 0x60,
+ 0x03,0x01, 0x80,
+ 0x00,0xfe, 0x00,/* CIRC 23x23 = 5.5 */
+
+ 0x00,0x7f, 0x00,0x00,
+ 0x01,0x80, 0xc0,0x00,
+ 0x06,0x00, 0x30,0x00,
+ 0x08,0x00, 0x08,0x00,
+ 0x10,0x00, 0x04,0x00,
+ 0x20,0x00, 0x02,0x00,
+ 0x20,0x00, 0x02,0x00,
+ 0x40,0x00, 0x01,0x00,
+ 0x40,0x00, 0x01,0x00,
+ 0x80,0x00, 0x00,0x80,
+ 0x80,0x00, 0x00,0x80,
+ 0x80,0x00, 0x00,0x80,
+ 0x80,0x00, 0x00,0x80,
+ 0x80,0x00, 0x00,0x80,
+ 0x80,0x00, 0x00,0x80,
+ 0x80,0x00, 0x00,0x80,
+ 0x40,0x00, 0x01,0x00,
+ 0x40,0x00, 0x01,0x00,
+ 0x20,0x00, 0x02,0x00,
+ 0x20,0x00, 0x02,0x00,
+ 0x10,0x00, 0x04,0x00,
+ 0x08,0x00, 0x08,0x00,
+ 0x06,0x00, 0x30,0x00,
+ 0x01,0x80, 0xc0,0x00,
+ 0x00,0x7f, 0x00,0x00,/* CIRC 25x25 = 6.0 */
+
+ 0x00,0x3f, 0x80,0x00,
+ 0x01,0xc0, 0x70,0x00,
+ 0x03,0x00, 0x18,0x00,
+ 0x0c,0x00, 0x06,0x00,
+ 0x18,0x00, 0x03,0x00,
+ 0x10,0x00, 0x01,0x00,
+ 0x20,0x00, 0x00,0x80,
+ 0x60,0x00, 0x00,0xc0,
+ 0x40,0x00, 0x00,0x40,
+ 0x40,0x00, 0x00,0x40,
+ 0x80,0x00, 0x00,0x20,
+ 0x80,0x00, 0x00,0x20,
+ 0x80,0x00, 0x00,0x20,
+ 0x80,0x00, 0x00,0x20,
+ 0x80,0x00, 0x00,0x20,
+ 0x80,0x00, 0x00,0x20,
+ 0x80,0x00, 0x00,0x20,
+ 0x40,0x00, 0x00,0x40,
+ 0x40,0x00, 0x00,0x40,
+ 0x60,0x00, 0x00,0xc0,
+ 0x20,0x00, 0x00,0x80,
+ 0x10,0x00, 0x01,0x00,
+ 0x18,0x00, 0x03,0x00,
+ 0x0c,0x00, 0x06,0x00,
+ 0x03,0x00, 0x18,0x00,
+ 0x01,0xc0, 0x70,0x00,
+ 0x00,0x3f, 0x80,0x00,/* CIRC 27x27 = 6.5 */
+
+ 0x00,0x1f, 0xc0,0x00,
+ 0x00,0xe0, 0x38,0x00,
+ 0x01,0x00, 0x04,0x00,
+ 0x06,0x00, 0x03,0x00,
+ 0x08,0x00, 0x00,0x80,
+ 0x10,0x00, 0x00,0x40,
+ 0x10,0x00, 0x00,0x40,
+ 0x20,0x00, 0x00,0x20,
+ 0x40,0x00, 0x00,0x10,
+ 0x40,0x00, 0x00,0x10,
+ 0x40,0x00, 0x00,0x10,
+ 0x80,0x00, 0x00,0x08,
+ 0x80,0x00, 0x00,0x08,
+ 0x80,0x00, 0x00,0x08,
+ 0x80,0x00, 0x00,0x08,
+ 0x80,0x00, 0x00,0x08,
+ 0x80,0x00, 0x00,0x08,
+ 0x80,0x00, 0x00,0x08,
+ 0x40,0x00, 0x00,0x10,
+ 0x40,0x00, 0x00,0x10,
+ 0x40,0x00, 0x00,0x10,
+ 0x20,0x00, 0x00,0x20,
+ 0x10,0x00, 0x00,0x40,
+ 0x10,0x00, 0x00,0x40,
+ 0x08,0x00, 0x00,0x80,
+ 0x06,0x00, 0x03,0x00,
+ 0x01,0x00, 0x04,0x00,
+ 0x00,0xe0, 0x38,0x00,
+ 0x00,0x1f, 0xc0,0x00, /* CIRC 29x29 = 7.0 */
+
+ /* TYPE = CROSS */
+
+ 0x82,
+ 0x44,
+ 0x28,
+ 0x10,
+ 0x28,
+ 0x44,
+ 0x82,/* CROSS 7x7 = 1.0 */
+
+ 0x80,0x80,
+ 0x41,0x00,
+ 0x22,0x00,
+ 0x14,0x00,
+ 0x08,0x00,
+ 0x14,0x00,
+ 0x22,0x00,
+ 0x41,0x00,
+ 0x80,0x80,/* CROSS 9x9 = 1.5 */
+
+ 0x80,0x20,
+ 0x40,0x40,
+ 0x20,0x80,
+ 0x11,0x00,
+ 0x0a,0x00,
+ 0x04,0x00,
+ 0x0a,0x00,
+ 0x11,0x00,
+ 0x20,0x80,
+ 0x40,0x40,
+ 0x80,0x20,/* CROSS 11x11 = 2.0 */
+
+ 0x80,0x08,
+ 0x40,0x10,
+ 0x20,0x20,
+ 0x10,0x40,
+ 0x08,0x80,
+ 0x05,0x00,
+ 0x02,0x00,
+ 0x05,0x00,
+ 0x08,0x80,
+ 0x10,0x40,
+ 0x20,0x20,
+ 0x40,0x10,
+ 0x80,0x08,/* CROSS 13x13 = 2.5 */
+
+ 0x80,0x02,
+ 0x40,0x04,
+ 0x20,0x08,
+ 0x10,0x10,
+ 0x08,0x20,
+ 0x04,0x40,
+ 0x02,0x80,
+ 0x01,0x00,
+ 0x02,0x80,
+ 0x04,0x40,
+ 0x08,0x20,
+ 0x10,0x10,
+ 0x20,0x08,
+ 0x40,0x04,
+ 0x80,0x02,/* CROSS 15x15 = 3.0 */
+
+ 0x80,0x00, 0x80,
+ 0x40,0x01, 0x00,
+ 0x20,0x02, 0x00,
+ 0x10,0x04, 0x00,
+ 0x08,0x08, 0x00,
+ 0x04,0x10, 0x00,
+ 0x02,0x20, 0x00,
+ 0x01,0x40, 0x00,
+ 0x00,0x80, 0x00,
+ 0x01,0x40, 0x00,
+ 0x02,0x20, 0x00,
+ 0x04,0x10, 0x00,
+ 0x08,0x08, 0x00,
+ 0x10,0x04, 0x00,
+ 0x20,0x02, 0x00,
+ 0x40,0x01, 0x00,
+ 0x80,0x00, 0x80,/* CROSS 17x17 = 3.5 */
+
+ 0x80,0x00, 0x20,
+ 0x40,0x00, 0x40,
+ 0x20,0x00, 0x80,
+ 0x10,0x01, 0x00,
+ 0x08,0x02, 0x00,
+ 0x04,0x04, 0x00,
+ 0x02,0x08, 0x00,
+ 0x01,0x10, 0x00,
+ 0x00,0xa0, 0x00,
+ 0x00,0x40, 0x00,
+ 0x00,0xa0, 0x00,
+ 0x01,0x10, 0x00,
+ 0x02,0x08, 0x00,
+ 0x04,0x04, 0x00,
+ 0x08,0x02, 0x00,
+ 0x10,0x01, 0x00,
+ 0x20,0x00, 0x80,
+ 0x40,0x00, 0x40,
+ 0x80,0x00, 0x20,/* CROSS 19x19 = 4.0 */
+
+ 0x80,0x00, 0x08,
+ 0x40,0x00, 0x10,
+ 0x20,0x00, 0x20,
+ 0x10,0x00, 0x40,
+ 0x08,0x00, 0x80,
+ 0x04,0x01, 0x00,
+ 0x02,0x02, 0x00,
+ 0x01,0x04, 0x00,
+ 0x00,0x88, 0x00,
+ 0x00,0x50, 0x00,
+ 0x00,0x20, 0x00,
+ 0x00,0x50, 0x00,
+ 0x00,0x88, 0x00,
+ 0x01,0x04, 0x00,
+ 0x02,0x02, 0x00,
+ 0x04,0x01, 0x00,
+ 0x08,0x00, 0x80,
+ 0x10,0x00, 0x40,
+ 0x20,0x00, 0x20,
+ 0x40,0x00, 0x10,
+ 0x80,0x00, 0x08,/* CROSS 21x21 = 4.5 */
+
+ 0x80,0x00, 0x02,
+ 0x40,0x00, 0x04,
+ 0x20,0x00, 0x08,
+ 0x10,0x00, 0x10,
+ 0x08,0x00, 0x20,
+ 0x04,0x00, 0x40,
+ 0x02,0x00, 0x80,
+ 0x01,0x01, 0x00,
+ 0x00,0x82, 0x00,
+ 0x00,0x44, 0x00,
+ 0x00,0x28, 0x00,
+ 0x00,0x10, 0x00,
+ 0x00,0x28, 0x00,
+ 0x00,0x44, 0x00,
+ 0x00,0x82, 0x00,
+ 0x01,0x01, 0x00,
+ 0x02,0x00, 0x80,
+ 0x04,0x00, 0x40,
+ 0x08,0x00, 0x20,
+ 0x10,0x00, 0x10,
+ 0x20,0x00, 0x08,
+ 0x40,0x00, 0x04,
+ 0x80,0x00, 0x02,/* CROSS 23x23 = 5.0 */
+
+ 0x80,0x00, 0x00,0x80,
+ 0x40,0x00, 0x01,0x00,
+ 0x20,0x00, 0x02,0x00,
+ 0x10,0x00, 0x04,0x00,
+ 0x08,0x00, 0x08,0x00,
+ 0x04,0x00, 0x10,0x00,
+ 0x02,0x00, 0x20,0x00,
+ 0x01,0x00, 0x40,0x00,
+ 0x00,0x80, 0x80,0x00,
+ 0x00,0x41, 0x00,0x00,
+ 0x00,0x22, 0x00,0x00,
+ 0x00,0x14, 0x00,0x00,
+ 0x00,0x08, 0x00,0x00,
+ 0x00,0x14, 0x00,0x00,
+ 0x00,0x22, 0x00,0x00,
+ 0x00,0x41, 0x00,0x00,
+ 0x00,0x80, 0x80,0x00,
+ 0x01,0x00, 0x40,0x00,
+ 0x02,0x00, 0x20,0x00,
+ 0x04,0x00, 0x10,0x00,
+ 0x08,0x00, 0x08,0x00,
+ 0x10,0x00, 0x04,0x00,
+ 0x20,0x00, 0x02,0x00,
+ 0x40,0x00, 0x01,0x00,
+ 0x80,0x00, 0x00,0x80,/* CROSS 25x25 = 5.5 */
+
+ 0x80,0x00, 0x00,0x20,
+ 0x40,0x00, 0x00,0x40,
+ 0x20,0x00, 0x00,0x80,
+ 0x10,0x00, 0x01,0x00,
+ 0x08,0x00, 0x02,0x00,
+ 0x04,0x00, 0x04,0x00,
+ 0x02,0x00, 0x08,0x00,
+ 0x01,0x00, 0x10,0x00,
+ 0x00,0x80, 0x20,0x00,
+ 0x00,0x40, 0x40,0x00,
+ 0x00,0x20, 0x80,0x00,
+ 0x00,0x11, 0x00,0x00,
+ 0x00,0x0a, 0x00,0x00,
+ 0x00,0x04, 0x00,0x00,
+ 0x00,0x0a, 0x00,0x00,
+ 0x00,0x11, 0x00,0x00,
+ 0x00,0x20, 0x80,0x00,
+ 0x00,0x40, 0x40,0x00,
+ 0x00,0x80, 0x20,0x00,
+ 0x01,0x00, 0x10,0x00,
+ 0x02,0x00, 0x08,0x00,
+ 0x04,0x00, 0x04,0x00,
+ 0x08,0x00, 0x02,0x00,
+ 0x10,0x00, 0x01,0x00,
+ 0x20,0x00, 0x00,0x80,
+ 0x40,0x00, 0x00,0x40,
+ 0x80,0x00, 0x00,0x20,/* CROSS 27x27 = 6.0 */
+
+ 0x00,0x00, 0x00,0x00,
+ 0x00,0x00, 0x00,0x00,
+ 0x20,0x00, 0x00,0x04,
+ 0x10,0x00, 0x00,0x08,
+ 0x08,0x00, 0x00,0x10,
+ 0x04,0x00, 0x00,0x20,
+ 0x02,0x00, 0x00,0x40,
+ 0x01,0x00, 0x00,0x80,
+ 0x00,0x80, 0x01,0x00,
+ 0x00,0x40, 0x02,0x00,
+ 0x00,0x20, 0x04,0x00,
+ 0x00,0x10, 0x08,0x00,
+ 0x00,0x08, 0x10,0x00,
+ 0x00,0x04, 0x20,0x00,
+ 0x00,0x02, 0x40,0x00,
+ 0x00,0x01, 0x80,0x00,
+ 0x00,0x01, 0x80,0x00,
+ 0x00,0x02, 0x40,0x00,
+ 0x00,0x04, 0x20,0x00,
+ 0x00,0x08, 0x10,0x00,
+ 0x00,0x10, 0x08,0x00,
+ 0x00,0x20, 0x04,0x00,
+ 0x00,0x40, 0x02,0x00,
+ 0x00,0x80, 0x01,0x00,
+ 0x01,0x00, 0x00,0x80,
+ 0x02,0x00, 0x00,0x40,
+ 0x04,0x00, 0x00,0x20,
+ 0x08,0x00, 0x00,0x10,
+ 0x10,0x00, 0x00,0x08,
+ 0x20,0x00, 0x00,0x04,
+ 0x00,0x00, 0x00,0x00,
+ 0x00,0x00, 0x00,0x00,/* CROSS 32x32 = 6.5 */
+
+ 0x00,0x00, 0x00,0x00,
+ 0x40,0x00, 0x00,0x02,
+ 0x20,0x00, 0x00,0x04,
+ 0x10,0x00, 0x00,0x08,
+ 0x08,0x00, 0x00,0x10,
+ 0x04,0x00, 0x00,0x20,
+ 0x02,0x00, 0x00,0x40,
+ 0x01,0x00, 0x00,0x80,
+ 0x00,0x80, 0x01,0x00,
+ 0x00,0x40, 0x02,0x00,
+ 0x00,0x20, 0x04,0x00,
+ 0x00,0x10, 0x08,0x00,
+ 0x00,0x08, 0x10,0x00,
+ 0x00,0x04, 0x20,0x00,
+ 0x00,0x02, 0x40,0x00,
+ 0x00,0x01, 0x80,0x00,
+ 0x00,0x01, 0x80,0x00,
+ 0x00,0x02, 0x40,0x00,
+ 0x00,0x04, 0x20,0x00,
+ 0x00,0x08, 0x10,0x00,
+ 0x00,0x10, 0x08,0x00,
+ 0x00,0x20, 0x04,0x00,
+ 0x00,0x40, 0x02,0x00,
+ 0x00,0x80, 0x01,0x00,
+ 0x01,0x00, 0x00,0x80,
+ 0x02,0x00, 0x00,0x40,
+ 0x04,0x00, 0x00,0x20,
+ 0x08,0x00, 0x00,0x10,
+ 0x10,0x00, 0x00,0x08,
+ 0x20,0x00, 0x00,0x04,
+ 0x40,0x00, 0x00,0x02,
+ 0x00,0x00, 0x00,0x00/* CROSS 32x32 = 7.0 */
+};
+
+/*----------------------------------------------------------------------*/
+
+//TsmInitAttributes
+void OpenGl_Display::InitAttributes ()
+{
+ // Return if already initialized
+ if (myLinestyleBase) return;
+
+ myLinestyleBase = glGenLists(5);
+
+ /* Line */
+
+ glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_DASH, GL_COMPILE );
+ glLineStipple(1, DASH_LS );
+ glEndList();
+
+ glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_DOT, GL_COMPILE );
+ glLineStipple(1, DOT_LS );
+ glEndList();
+
+ glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_DOTDASH, GL_COMPILE );
+ glLineStipple(1, DASH_DOT_LS );
+ glEndList();
+
+ glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_USERDEFINED, GL_COMPILE );
+ glLineStipple(1, DASH_DDOT_LS );
+ glEndList();
+
+ /* FSXXX
+ * GL_POLYGON_STIPPLE
+ * need 32x32 stipple patterns
+ */
+ const int nbi = sizeof(myInteriors)/(32*sizeof(unsigned int));
+ myPatternBase = glGenLists(TEL_HS_USER_DEF_START);
+ int i;
+ for( i = 1; i < TEL_HS_USER_DEF_START; i++ )
+ {
+ glNewList( (GLuint)myPatternBase + i, GL_COMPILE );
+ glPolygonStipple((const GLubyte *) (myInteriors[i<nbi? i : 0]));
+ glEndList();
+ }
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ myMarkerBase = glGenLists (60);
+ int j;
+ for( i = 1; i < TEL_NB_OF_LISTS; i++ )
+ for( j = 0; j < TEL_NO_OF_SIZES; j++ )
+ {
+ const Tfloat w = arrPMFontInfo[i][j].width;
+ const Tfloat h = arrPMFontInfo[i][j].height;
+ const Tint offset = arrPMFontInfo[i][j].offset;
+
+ glNewList( (const GLuint)(arrPMFontInfo[i][j].str[0] + myMarkerBase), GL_COMPILE );
+ glBitmap( (GLsizei)w, (GLsizei)h, (GLfloat)(0.5f * w), (GLfloat)(0.5f * h), 0.f, 0.f, (const GLubyte *) &myMarkerRaster[offset] );
+ glEndList();
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+#define TEL_PM_START_SIZE 1.F
+#define TEL_PM_END_SIZE 7.F
+
+//TelGetStringForPM
+const char * OpenGl_Display::GetStringForMarker (const Aspect_TypeOfMarker AType, const Tfloat AVal) const
+{
+ const int atype = (int)(( AType > Aspect_TOM_O_X )? Aspect_TOM_X : AType);
+
+ const float index = ( float )(TEL_NO_OF_SIZES-1) * (AVal - ( float )TEL_PM_START_SIZE ) / ( float )(TEL_PM_END_SIZE - TEL_PM_START_SIZE);
+ int id = (int)(index + 0.5F);
+ if (id < 0) id = 0;
+ else if (id >= TEL_NO_OF_SIZES) id = TEL_NO_OF_SIZES-1;
+
+ return arrPMFontInfo[atype][id].str;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Display::SetBaseForMarker () const
+{
+ glListBase( (const GLuint) myMarkerBase );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Display::SetTypeOfLine (const Aspect_TypeOfLine AType) const
+{
+ if (AType != Aspect_TOL_SOLID)
+ {
+ glCallList((GLuint)myLinestyleBase+(GLuint)AType);
+ glEnable( GL_LINE_STIPPLE );
+#ifdef HAVE_GL2PS
+ gl2psEnable( GL2PS_LINE_STIPPLE );
+#endif
+ }
+ else
+ {
+ glDisable( GL_LINE_STIPPLE );
+#ifdef HAVE_GL2PS
+ gl2psDisable( GL2PS_LINE_STIPPLE );
+#endif
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Display::SetTypeOfHatch (const int AType) const
+{
+ if (AType)
+ {
+ glCallList((GLuint)myPatternBase+(GLuint)AType);
+ glEnable( GL_POLYGON_STIPPLE );
+ }
+ else
+ glDisable( GL_POLYGON_STIPPLE );
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Element.hxx
+// Created: 5 August 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_Element_Header
+#define OpenGl_Element_Header
+
+#include <OpenGl_Workspace.hxx>
+
+class OpenGl_Element
+{
+ public:
+ OpenGl_Element () {}
+ virtual ~OpenGl_Element () {}
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const = 0;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_Element_Header
--- /dev/null
+// File: OpenGl_ExtVBO.hxx
+// Created: 26 January 2012
+// Author: Kirill GAVRILOV
+// Copyright: OPEN CASCADE 2012
+
+#ifndef _OpenGl_ExtFBO_H__
+#define _OpenGl_ExtFBO_H__
+
+#if (defined(_WIN32) || defined(__WIN32__))
+ #include <windows.h>
+#endif
+#include <GL/gl.h>
+
+//! FBO is part of OpenGL since 2.0
+struct OpenGl_ExtFBO
+{
+ #ifndef GL_FRAMEBUFFER_EXT
+ #define GL_FRAMEBUFFER_EXT 0x8D40
+ #endif
+ #ifndef GL_COLOR_ATTACHMENT0_EXT
+ #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
+ #endif
+ #ifndef GL_FRAMEBUFFER_COMPLETE_EXT
+ #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
+ #endif
+ #ifndef GL_RENDERBUFFER_EXT
+ #define GL_RENDERBUFFER_EXT 0x8D41
+ #endif
+ #ifndef GL_DEPTH_ATTACHMENT_EXT
+ #define GL_DEPTH_ATTACHMENT_EXT 0x8D00
+ #endif
+
+public:
+
+ typedef void (APIENTRY *glGenFramebuffersEXT_t) (GLsizei n, GLuint* ids);
+ typedef void (APIENTRY *glDeleteFramebuffersEXT_t) (GLsizei n, GLuint* ids);
+ typedef void (APIENTRY *glBindFramebufferEXT_t) (GLenum target, GLuint id);
+ typedef void (APIENTRY *glFramebufferTexture2DEXT_t) (GLenum target, GLenum attachmentPoint,
+ GLenum textureTarget, GLuint textureId,
+ GLint level);
+ typedef GLenum (APIENTRY *glCheckFramebufferStatusEXT_t) (GLenum target);
+ typedef void (APIENTRY *glGenRenderbuffersEXT_t) (GLsizei n, GLuint* ids);
+ typedef void (APIENTRY *glDeleteRenderbuffersEXT_t) (GLsizei n, GLuint* ids);
+ typedef void (APIENTRY *glBindRenderbufferEXT_t) (GLenum target, GLuint id);
+ typedef void (APIENTRY *glRenderbufferStorageEXT_t) (GLenum target, GLenum internalFormat,
+ GLsizei width, GLsizei height);
+
+ typedef void (APIENTRY *glFramebufferRenderbufferEXT_t) (GLenum target,
+ GLenum attachmentPoint,
+ GLenum renderbufferTarget,
+ GLuint renderbufferId);
+
+public:
+
+ glGenFramebuffersEXT_t glGenFramebuffersEXT;
+ glDeleteFramebuffersEXT_t glDeleteFramebuffersEXT;
+ glBindFramebufferEXT_t glBindFramebufferEXT;
+ glFramebufferTexture2DEXT_t glFramebufferTexture2DEXT;
+ glCheckFramebufferStatusEXT_t glCheckFramebufferStatusEXT;
+ glGenRenderbuffersEXT_t glGenRenderbuffersEXT;
+ glDeleteRenderbuffersEXT_t glDeleteRenderbuffersEXT;
+ glBindRenderbufferEXT_t glBindRenderbufferEXT;
+ glRenderbufferStorageEXT_t glRenderbufferStorageEXT;
+ glFramebufferRenderbufferEXT_t glFramebufferRenderbufferEXT;
+
+};
+
+#endif // _OpenGl_ExtFBO_H__
+++ /dev/null
-/*
-* Fonction
-* ~~~~~~~~
-* Gestion des extensions sous OpenGL
-*
-*
-* Attention:
-* ~~~~~~~~~~~
-* Ce package a ete teste sur SGI, OSF, SUN, HP et WNT.
-*
-* Remarques:
-* ~~~~~~~~~~~
-* Le InitExtensionGLX permet d'initialiser le display. Ceci est necessaire
-* pour travailler sur les extensions de GLX. On ne peut appeler QueryExtensionGLX
-* si on n'a pas fait cette manip.
-* Par contre QueryExtension gere les extensions a GL, on n'a pas besoin du
-* Display.
-*
-* Pour l'instant on ne gere pas les extensions a GLU et a WGL.
-*
-* Historique des modifications
-* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-* 14-10-97: FMN ; creation
-* 23-10-97: FMN ; ajout gestion glx
-* 04-11-97: FMN ; Gestion des differentes versions GLX
-* 19-11-97: FMN ; Ajout GetCurrentDisplay
-* 04-12-97: FMN ; Ajout supportsOneDotOne
-* 22-07-98: FMN ; InitExtensionGLX n'est execute qu'une fois
-* 28-07-98: FMN ; Renomme theDisplay en mytheDisplay
-*/
-/*----------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <OpenGl_Extension.hxx>
-
-#define XDEBUG
-
-/*----------------------------------------------------------------------*/
-/*
-* Types definis
-*/
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-static Display *mytheDisplay = NULL;
-static int screen_num;
-static int GLXmajor, GLXminor;
-static int GLmajor, GLminor;
-
-static GLboolean flag_InitExtensionGLX = GL_FALSE;
-
-static GLboolean OneDotOne = GL_FALSE;
-static GLboolean initOneDotOne = GL_FALSE;
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions publiques
-*/
-
-/*----------------------------------------------------------------------*/
-extern GLboolean CheckExtension(char *extName, const char *extString)
-{
- /*
- ** Search for extName in the extensions string. Use of strstr()
- ** is not sufficient because extension names can be prefixes of
- ** other extension names. Could use strtok() but the constant
- ** string returned by glGetString can be in read-only memory.
- */
- char *p = (char *)extString;
- char *end;
- int extNameLen;
-
- extNameLen = strlen(extName);
- end = p + strlen(p);
-
- while (p < end) {
- int n = strcspn(p, " ");
- if ((extNameLen == n) && (strncmp(extName, p, n) == 0)) {
- return GL_TRUE;
- }
- p += (n + 1);
- }
- return GL_FALSE;
-}
-
-extern GLboolean InitExtensionGLX(Display *display)
-{
-#ifndef WNT
-
- int dontcare; /* for returned arguments we don't care about */
-
- if (display == NULL) return GL_FALSE;
-
- if (!flag_InitExtensionGLX)
- {
- /* does the server know about OpenGL & GLX? */
- if(!XQueryExtension(display, "GLX", &dontcare, &dontcare, &dontcare)) {
-#ifdef DEBUG
- fprintf(stderr,"This system doesn't appear to support OpenGL\n");
-#endif /* DEBUG */
- return GL_FALSE;
- }
-
- /* find the glx version */
- if(glXQueryVersion(display, &GLXmajor, &GLXminor)) {
-#ifdef DEBUG
- printf("GLX Version: %d.%d\n", GLXmajor, GLXminor);
-#endif /* DEBUG */
- } else {
-#ifdef DEBUG
- fprintf(stderr, "Error: glXQueryVersion() failed.\n");
-#endif /* DEBUG */
- return GL_FALSE;
- }
-
- /* get screen number */
- screen_num = DefaultScreen(display);
-
- flag_InitExtensionGLX = GL_TRUE;
- mytheDisplay = display;
-
- } /* (!flag_InitExtensionGLX) */
-
- return GL_TRUE;
-
-#else
-
- return GL_FALSE;
-
-#endif /* WNT */
-}
-
-/*----------------------------------------------------------------------*/
-extern GLboolean QueryExtensionGLX(char *extName)
-{
- GLboolean result = GL_FALSE;
-
-#ifdef GLX_VERSION_1_1
- if (flag_InitExtensionGLX)
- {
- if ( GLXminor > 1 || GLXmajor > 1 ) /* GLX_VERSION_1_2 */
- {
- /* Certaines extensions sont par defaut dans la version 1.2 */
- if (strcmp(extName,"GLX_EXT_import_context")) return GL_TRUE;
- result = CheckExtension(extName, glXQueryExtensionsString(mytheDisplay, screen_num));
- }
- else if( GLXminor > 0 || GLXmajor > 1 ) /* GLX_VERSION_1_1 */
- {
- result = CheckExtension(extName, glXQueryExtensionsString(mytheDisplay, screen_num));
- }
- }
-#endif
-#ifdef DEBUG
- printf("QueryExtensionGLX: %s %d", extName, result);
-#endif
- return result;
-}
-
-/*----------------------------------------------------------------------*/
-extern Display *GetCurrentDisplay(void)
-{
-#ifdef DEBUG
- printf("GetCurrentDisplay %x \n", mytheDisplay);
-#endif
- return mytheDisplay;
-}
-
-/*----------------------------------------------------------------------*/
-extern GLboolean QueryExtension(char *extName)
-{
- GLboolean result = GL_FALSE;
-
- if (supportsOneDotOne()) /* GL_VERSION_1_1 ou more */
- {
- /* Certaines extensions sont par defaut dans la version 1.1 */
- /* Certain extensions are the defaut in version 1.1 */
- if ((strcmp(extName,"GL_EXT_vertex_array")) ||
- (strcmp(extName,"GL_EXT_polygon_offset")) ||
- (strcmp(extName,"GL_EXT_blend_logic_op")) ||
- (strcmp(extName,"GL_EXT_texture")) ||
- (strcmp(extName,"GL_EXT_copy_texture")) ||
- (strcmp(extName,"GL_EXT_subtexture")) ||
- (strcmp(extName,"GL_EXT_texture_object")))
- result = GL_TRUE;
- else
- result = CheckExtension(extName, (char *)glGetString(GL_EXTENSIONS));
- }
- else /* GL_VERSION_1_0 */
- {
- result = CheckExtension(extName, (char *)glGetString(GL_EXTENSIONS));
- }
-
-#ifdef DEBUG
- printf("QueryExtension: %s %d \n", extName, result);
-#endif
- return result;
-}
-/*----------------------------------------------------------------------*/
-
-extern GLboolean supportsOneDotOne(void)
-{
- const GLubyte *version;
-
- if (!initOneDotOne)
- {
- version = glGetString(GL_VERSION);
- if(sscanf((const char *)version, "%d.%d", &GLmajor, &GLminor) == 2)
- {
- OneDotOne = (GLmajor>=1 && GLminor >=1);
- }
- initOneDotOne = GL_TRUE;
- }
-#ifdef DEBUG
- printf("GL Version: %d.%d\n", GLmajor, GLminor);
-#endif /* DEBUG */
- return OneDotOne;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/*
- * Fonction
- * ~~~~~~~~
- * Gestion des extensions sous OpenGL
- *
- *
- * Attention:
- * ~~~~~~~~~~~
- * Ce package a ete teste sur SGI, OSF, SUN, HP et WNT.
- *
- * Remarques:
- * ~~~~~~~~~~~
- * Le InitExtensionGLX permet d'initialiser le display. Ceci est necessaire
- * pour travailler sur les extensions de GLX. On ne peut appeler QueryExtensionGLX
- * si on n'a pas fait cette manip.
- * Par contre QueryExtension gere les extensions a GL, on n'a pas besoin du
- * Display.
- *
- * Pour l'instant on ne gere pas les extensions a GLU et a WGL.
- *
- * Historique des modifications
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- * 14-10-97: FMN ; Creation
- * 23-10-97: FMN ; Ajout gestion glx
- * 19-11-97: FMN ; Ajout GetCurrentDisplay
- * 04-12-97: FMN ; Ajout supportsOneDotOne
- * 19-06-98: FMN ; Portage Optimizer (C++)
- */
-/*----------------------------------------------------------------------*/
-
-#ifndef _OPENGL_EXTENSION_H__
-#define _OPENGL_EXTENSION_H__
-
-/*----------------------------------------------------------------------*/
-/*
- * Includes
- */
-
-#if defined(WNT) && !defined(HAVE_NO_DLL)
-# ifdef __OpenGl_DLL
-# define EXPORT __declspec(dllexport)
-# else
-# define EXPORT
-# endif /* DLL */
-# ifdef STRICT
-# undef STRICT
-# endif
-# define STRICT
-# include <windows.h>
-#else
-# define EXPORT
-#endif /* WNT */
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#ifdef WNT
-# include <windows.h>
-# ifndef Display
-# define Display char
-# endif /* Display */
-#else
-# include <GL/glx.h>
-#endif /* WNT */
-
-
-#ifdef GL_VERSION_1_1
-#define GL_EXT_vertex_array 1
-#define GL_EXT_polygon_offset 1
-#define GL_EXT_blend_logic_op 1
-#define GL_EXT_texture 1
-#define GL_EXT_copy_texture 1
-#define GL_EXT_subtexture 1
-#define GL_EXT_texture_object 1
-#endif /* GL_VERSION_1_1 */
-
-
-#ifndef GLU_VERSION_1_2
-#define GLUtesselator GLUtriangulatorObj
-#define GLU_TESS_BEGIN 100100
-#define GLU_TESS_VERTEX 100101
-#define GLU_TESS_END 100102
-#define GLU_TESS_ERROR 100103
-#define GLU_TESS_COMBINE 100105
-#endif
-
-#define INVALID_EXT_FUNCTION_PTR 0xffffffff
-/*
- * Contournement temporaire glPolygoneOffsetEXT
- * La syntaxe change entre OpenGL 1.0 et OpenGL 1.1
- */
-
-#if defined (__sun) || defined (__osf__) || defined (__hp)
-#define glPolygonOffsetEXT(a, b) glPolygonOffset(a, b)
-#endif
-#if defined (__sun)
-#define GL_POLYGON_OFFSET_EXT GL_POLYGON_OFFSET_FILL
-#endif
-
-#ifdef WNT
-#define glPolygonOffsetEXT(a, b) glPolygonOffset(a, b)
-#define GL_POLYGON_OFFSET_EXT GL_POLYGON_OFFSET_FILL
-#endif /* WNT */
-
-#if defined (__sun) || defined (__osf__) || defined (__hp) || defined (__sgi)
-#else
-typedef void (APIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);
-#endif
-
-/*----------------------------------------------------------------------*/
-/*
- * Prototypes
- */
-
-/*
- * Points d'entree Public du module
- */
-
-
-extern GLboolean InitExtensionGLX(Display *display);
-extern GLboolean QueryExtensionGLX(char *extName);
-
-extern GLboolean QueryExtension(char *extName);
-
-extern Display *GetCurrentDisplay(void);
-
-extern GLboolean supportsOneDotOne(void);
-
-extern GLboolean CheckExtension(char *extName, const char *extString);
-
-
-/* Methods defined in OpenGl_GraphicDriver.cxx */
-
-EXPORT GLboolean OpenGl_QueryExtensionGLX (const char *extName);
-
-EXPORT GLboolean OpenGl_QueryExtension (const char *extName);
-
-/*----------------------------------------------------------------------*/
-
-#endif /* _OPENGL_EXTENSION_H__ */
+// File: OpenGl_FrameBuffer.cxx
+// Author: Kirill GAVRILOV
+// Copyright: OPEN CASCADE 2011
+
#include <OpenGl_FrameBuffer.hxx>
#ifdef DEB
#include <iostream>
#endif
-#ifndef WNT
- #define glGetProcAddress( x ) glXGetProcAddress( (const GLubyte*) x )
-#else
- #define glGetProcAddress( x ) wglGetProcAddress( x )
-#endif
-
static inline bool isOddNumber (const GLsizei theNumber)
{
return theNumber & 0x01;
return theThreshold;
}
-Standard_Boolean OpenGl_FrameBuffer::AreFBOFunctionsValid()
-{
- return glGenFramebuffersEXT != NULL
- && glDeleteFramebuffersEXT != NULL
- && glBindFramebufferEXT != NULL
- && glFramebufferTexture2DEXT != NULL
- && glCheckFramebufferStatusEXT != NULL
- && glGenRenderbuffersEXT != NULL
- && glBindRenderbufferEXT != NULL
- && glDeleteRenderbuffersEXT != NULL
- && glRenderbufferStorageEXT != NULL
- && glFramebufferRenderbufferEXT != NULL;
-}
-
-Standard_Boolean OpenGl_FrameBuffer::InitFBOFunctions()
-{
- if (AreFBOFunctionsValid())
- {
- return Standard_True;
- }
- if (CheckExtension ((char *)"GL_EXT_framebuffer_object", (const char *)glGetString (GL_EXTENSIONS)))
- {
- glGenFramebuffersEXT = (glGenFramebuffersEXT_t) glGetProcAddress ("glGenFramebuffersEXT");
- glDeleteFramebuffersEXT = (glDeleteFramebuffersEXT_t) glGetProcAddress ("glDeleteFramebuffersEXT");
- glBindFramebufferEXT = (glBindFramebufferEXT_t) glGetProcAddress ("glBindFramebufferEXT");
- glFramebufferTexture2DEXT = (glFramebufferTexture2DEXT_t) glGetProcAddress ("glFramebufferTexture2DEXT");
- glCheckFramebufferStatusEXT = (glCheckFramebufferStatusEXT_t) glGetProcAddress ("glCheckFramebufferStatusEXT");
- glGenRenderbuffersEXT = (glGenRenderbuffersEXT_t) glGetProcAddress ("glGenRenderbuffersEXT");
- glDeleteRenderbuffersEXT = (glDeleteRenderbuffersEXT_t) glGetProcAddress ("glDeleteRenderbuffersEXT");
- glBindRenderbufferEXT = (glBindRenderbufferEXT_t) glGetProcAddress ("glBindRenderbufferEXT");
- glRenderbufferStorageEXT = (glRenderbufferStorageEXT_t) glGetProcAddress ("glRenderbufferStorageEXT");
- glFramebufferRenderbufferEXT = (glFramebufferRenderbufferEXT_t)glGetProcAddress ("glFramebufferRenderbufferEXT");
- return AreFBOFunctionsValid();
- }
- return Standard_False;
-}
-
OpenGl_FrameBuffer::OpenGl_FrameBuffer (GLint theTextureFormat)
: mySizeX (0),
mySizeY (0),
myTextFormat (theTextureFormat),
myGlTextureId (NO_TEXTURE),
myGlFBufferId (NO_FRAMEBUFFER),
- myGlDepthRBId (NO_RENDERBUFFER),
- glGenFramebuffersEXT (NULL),
- glDeleteFramebuffersEXT (NULL),
- glBindFramebufferEXT (NULL),
- glFramebufferTexture2DEXT (NULL),
- glCheckFramebufferStatusEXT (NULL),
- glGenRenderbuffersEXT (NULL),
- glDeleteRenderbuffersEXT (NULL),
- glBindRenderbufferEXT (NULL),
- glRenderbufferStorageEXT (NULL),
- glFramebufferRenderbufferEXT (NULL)
+ myGlDepthRBId (NO_RENDERBUFFER)
{
//
}
-Standard_Boolean OpenGl_FrameBuffer::Init (GLsizei theViewportSizeX,
+Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlContext,
+ GLsizei theViewportSizeX,
GLsizei theViewportSizeY,
GLboolean toForcePowerOfTwo)
{
- if (!InitFBOFunctions())
+ if (theGlContext->extFBO == NULL)
{
#ifdef DEB
std::cerr << "OpenGl_FrameBuffer, FBO extension not supported!\n";
}
// clean up previous state
- Release();
+ Release (theGlContext);
// upscale width/height if numbers are odd
if (toForcePowerOfTwo)
myVPSizeY = theViewportSizeY;
// Create the texture (will be used as color buffer)
- if (!InitTrashTexture())
+ if (!InitTrashTexture (theGlContext))
{
if (!isPowerOfTwo (mySizeX) || !isPowerOfTwo (mySizeY))
{
- return Init (theViewportSizeX, theViewportSizeY, GL_TRUE);
+ return Init (theGlContext, theViewportSizeX, theViewportSizeY, GL_TRUE);
}
- Release();
+ Release (theGlContext);
return Standard_False;
}
// Create RenderBuffer (will be used as depth buffer)
- glGenRenderbuffersEXT (1, &myGlDepthRBId);
- glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, myGlDepthRBId);
- glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, mySizeX, mySizeY);
+ theGlContext->extFBO->glGenRenderbuffersEXT (1, &myGlDepthRBId);
+ theGlContext->extFBO->glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, myGlDepthRBId);
+ theGlContext->extFBO->glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, mySizeX, mySizeY);
// Build FBO and setup it as texture
- glGenFramebuffersEXT (1, &myGlFBufferId);
- glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, myGlFBufferId);
+ theGlContext->extFBO->glGenFramebuffersEXT (1, &myGlFBufferId);
+ theGlContext->extFBO->glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, myGlFBufferId);
glEnable (GL_TEXTURE_2D);
glBindTexture (GL_TEXTURE_2D, myGlTextureId);
- glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, myGlTextureId, 0);
- glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, myGlFBufferId);
- if (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT)
+ theGlContext->extFBO->glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, myGlTextureId, 0);
+ theGlContext->extFBO->glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, myGlFBufferId);
+ if (theGlContext->extFBO->glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT)
{
if (!isPowerOfTwo (mySizeX) || !isPowerOfTwo (mySizeY))
{
- return Init (theViewportSizeX, theViewportSizeY, GL_TRUE);
+ return Init (theGlContext, theViewportSizeX, theViewportSizeY, GL_TRUE);
}
- Release();
+ Release (theGlContext);
return Standard_False;
}
- UnbindBuffer();
+ UnbindBuffer (theGlContext);
UnbindTexture();
- glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, NO_RENDERBUFFER);
+ theGlContext->extFBO->glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, NO_RENDERBUFFER);
#ifdef DEB
std::cerr << "OpenGl_FrameBuffer, created FBO " << mySizeX << "x" << mySizeY
return Standard_True;
}
-void OpenGl_FrameBuffer::Release()
+void OpenGl_FrameBuffer::Release (const Handle(OpenGl_Context)& theGlContext)
{
if (IsValidDepthBuffer())
{
- glDeleteRenderbuffersEXT (1, &myGlDepthRBId);
- myGlDepthRBId = NO_RENDERBUFFER;
+ if (!theGlContext.IsNull() && theGlContext->extFBO != NULL)
+ {
+ theGlContext->extFBO->glDeleteRenderbuffersEXT (1, &myGlDepthRBId);
+ myGlDepthRBId = NO_RENDERBUFFER;
+ }
+ else
+ {
+ std::cerr << "OpenGl_FrameBuffer::Release() called with invalid OpenGl_Context!\n";
+ }
}
if (IsValidTexture())
{
mySizeX = mySizeY = myVPSizeX = myVPSizeY = 0;
if (IsValidFrameBuffer())
{
- glDeleteFramebuffersEXT (1, &myGlFBufferId);
- myGlFBufferId = NO_FRAMEBUFFER;
+ if (!theGlContext.IsNull() && theGlContext->extFBO != NULL)
+ {
+ theGlContext->extFBO->glDeleteFramebuffersEXT (1, &myGlFBufferId);
+ myGlFBufferId = NO_FRAMEBUFFER;
+ }
+ else
+ {
+ std::cerr << "OpenGl_FrameBuffer::Release() called with invalid OpenGl_Context!\n";
+ }
}
}
return aTestParamX != 0 && aTestParamY != 0;
}
-Standard_Boolean OpenGl_FrameBuffer::InitTrashTexture()
+Standard_Boolean OpenGl_FrameBuffer::InitTrashTexture (const Handle(OpenGl_Context)& theGlContext)
{
// Check texture size is fit dimension maximum
GLint aMaxTexDim = 2048;
if (!IsProxySuccess())
{
- Release();
+ Release (theGlContext);
return Standard_False;
}
+// File: OpenGl_FrameBuffer.hxx
+// Author: Kirill GAVRILOV
+// Copyright: OPEN CASCADE 2011
+
#ifndef OPENGL_FRAME_BUFFER_H
#define OPENGL_FRAME_BUFFER_H
-#include <OpenGl_Extension.hxx>
+#include <OpenGl_Context.hxx>
#include <Standard_Boolean.hxx>
#include <InterfaceGraphic.hxx>
-#ifndef GL_FRAMEBUFFER_EXT
- #define GL_FRAMEBUFFER_EXT 0x8D40
-#endif
-
-#ifndef GL_COLOR_ATTACHMENT0_EXT
- #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
-#endif
-
-#ifndef GL_FRAMEBUFFER_COMPLETE_EXT
- #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
-#endif
-
-#ifndef GL_RENDERBUFFER_EXT
- #define GL_RENDERBUFFER_EXT 0x8D41
-#endif
-
-#ifndef GL_DEPTH_ATTACHMENT_EXT
- #define GL_DEPTH_ATTACHMENT_EXT 0x8D00
-#endif
-
-#ifdef WNT
- #define GL_API_ENTRY APIENTRY
-#else
- #define GL_API_ENTRY
-#endif
-
class OpenGl_FrameBuffer
{
static const GLuint NO_FRAMEBUFFER = 0;
static const GLuint NO_RENDERBUFFER = 0;
-public:
-
- typedef void (GL_API_ENTRY *glGenFramebuffersEXT_t) (GLsizei n, GLuint* ids);
- typedef void (GL_API_ENTRY *glDeleteFramebuffersEXT_t) (GLsizei n, GLuint* ids);
- typedef void (GL_API_ENTRY *glBindFramebufferEXT_t) (GLenum target, GLuint id);
- typedef void (GL_API_ENTRY *glFramebufferTexture2DEXT_t) (GLenum target, GLenum attachmentPoint,
- GLenum textureTarget, GLuint textureId,
- GLint level);
- typedef GLenum (GL_API_ENTRY *glCheckFramebufferStatusEXT_t) (GLenum target);
- typedef void (GL_API_ENTRY *glGenRenderbuffersEXT_t) (GLsizei n, GLuint* ids);
- typedef void (GL_API_ENTRY *glDeleteRenderbuffersEXT_t) (GLsizei n, GLuint* ids);
- typedef void (GL_API_ENTRY *glBindRenderbufferEXT_t) (GLenum target, GLuint id);
- typedef void (GL_API_ENTRY *glRenderbufferStorageEXT_t) (GLenum target, GLenum internalFormat,
- GLsizei width, GLsizei height);
-
- typedef void (GL_API_ENTRY *glFramebufferRenderbufferEXT_t) (GLenum target,
- GLenum attachmentPoint,
- GLenum renderbufferTarget,
- GLuint renderbufferId);
-
public:
OpenGl_FrameBuffer (GLint theTextureFormat = GL_RGBA8);
virtual ~OpenGl_FrameBuffer()
{
- Release();
+ Release (Handle(OpenGl_Context)());
}
//! Texture width.
//! current implementation will try to generate compatible FBO;
//! 2) FBO rendering will be done in software mode (ForceWare 'hack');
//! 3) FBO rendering will be incorrect (some obsolete Catalyst drivers).
- Standard_Boolean Init (GLsizei theViewportSizeX,
+ Standard_Boolean Init (const Handle(OpenGl_Context)& theGlContext,
+ GLsizei theViewportSizeX,
GLsizei theViewportSizeY,
GLboolean toForcePowerOfTwo = GL_FALSE);
//! Release GL objects
- void Release();
+ void Release (const Handle(OpenGl_Context)& theGlContext);
//! Setup viewport to render into FBO
void SetupViewport()
}
//! Bind frame buffer (to render into the texture).
- void BindBuffer()
+ void BindBuffer (const Handle(OpenGl_Context)& theGlContext)
{
- glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, myGlFBufferId);
+ theGlContext->extFBO->glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, myGlFBufferId);
}
//! Unbind frame buffer.
- void UnbindBuffer()
+ void UnbindBuffer (const Handle(OpenGl_Context)& theGlContext)
{
- glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, NO_FRAMEBUFFER);
+ theGlContext->extFBO->glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, NO_FRAMEBUFFER);
}
//! Bind the texture.
Standard_Boolean IsProxySuccess() const;
//! Generate texture with undefined data
- Standard_Boolean InitTrashTexture();
+ Standard_Boolean InitTrashTexture (const Handle(OpenGl_Context)& theGlContext);
Standard_Boolean IsValidTexture() const
{
return myGlTextureId != NO_RENDERBUFFER;
}
- Standard_Boolean AreFBOFunctionsValid();
- Standard_Boolean InitFBOFunctions();
-
private:
GLsizei mySizeX; // texture width
GLuint myGlFBufferId; // FBO object ID
GLuint myGlDepthRBId; // RenderBuffer object for depth ID
- // functions
- glGenFramebuffersEXT_t glGenFramebuffersEXT;
- glDeleteFramebuffersEXT_t glDeleteFramebuffersEXT;
- glBindFramebufferEXT_t glBindFramebufferEXT;
- glFramebufferTexture2DEXT_t glFramebufferTexture2DEXT;
- glCheckFramebufferStatusEXT_t glCheckFramebufferStatusEXT;
- glGenRenderbuffersEXT_t glGenRenderbuffersEXT;
- glDeleteRenderbuffersEXT_t glDeleteRenderbuffersEXT;
- glBindRenderbufferEXT_t glBindRenderbufferEXT;
- glRenderbufferStorageEXT_t glRenderbufferStorageEXT;
- glFramebufferRenderbufferEXT_t glFramebufferRenderbufferEXT;
-
};
#endif //OPENGL_FRAME_BUFFER_H
--- /dev/null
+// File: OpenGl_GraduatedTrihedron.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_tgl_all.hxx>
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+#include <InterfaceGraphic_Graphic3d.hxx>
+#include <InterfaceGraphic_Aspect.hxx>
+#include <InterfaceGraphic_Visual3d.hxx>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <OpenGl_Workspace.hxx>
+#include <OpenGl_View.hxx>
+#include <OpenGl_GraduatedTrihedron.hxx>
+#include <OpenGl_AspectLine.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(OpenGl_GraduatedTrihedron,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraduatedTrihedron,MMgt_TShared)
+
+const OpenGl_AspectLine myDefaultAspectLine;
+
+/* Bounding box */
+float xmin = 0.0f, ymin = 0.0f, zmin = 0.0f, xmax = 100.0f, ymax = 100.0f, zmax = 100.0f;
+
+/* Normal of the view (not normalized!) */
+static float getNormal(float* normal)
+{
+ GLint viewport[4];
+ GLdouble model_matrix[16], proj_matrix[16];
+
+ glGetDoublev(GL_MODELVIEW_MATRIX, model_matrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, proj_matrix);
+ glGetIntegerv(GL_VIEWPORT, viewport);
+
+ double x1, y1, z1, x2, y2, z2, x3, y3, z3;
+ gluUnProject(viewport[0], viewport[1], 0., model_matrix, proj_matrix, viewport, &x1, &y1, &z1);
+ gluUnProject(viewport[0] + viewport[2], viewport[1], 0., model_matrix, proj_matrix, viewport, &x2, &y2, &z2);
+ gluUnProject(viewport[0], viewport[1] + viewport[3], 0., model_matrix, proj_matrix, viewport, &x3, &y3, &z3);
+
+ /* Normal out of user is p1p3^p1p2 */
+ const double dx1 = x3 - x1;
+ const double dy1 = y3 - y1;
+ const double dz1 = z3 - z1;
+ const double dx2 = x2 - x1;
+ const double dy2 = y2 - y1;
+ const double dz2 = z2 - z1;
+ normal[0] = (float) (dy1 * dz2 - dz1 * dy2);
+ normal[1] = (float) (dz1 * dx2 - dx1 * dz2);
+ normal[2] = (float) (dx1 * dy2 - dy1 * dx2);
+
+ /* Distance corresponding to 1 pixel */
+ const float width = (float) sqrt(dx2 * dx2 + dy2 * dy2 + dz2 * dz2);
+ return width / (float) viewport[2];
+}
+
+static float getDistance2Corner(float* normal, float* center, float x, float y, float z)
+{
+ return normal[0] * (x - center[0]) + normal[1] * (y - center[1]) + normal[2] * (z - center[2]);
+}
+
+static char getFarestCorner(float d000, float d100, float d010, float d001,
+ float d110, float d101, float d011, float d111)
+{
+ if (d000 > 0.0f &&
+ d000 > d100 && d000 > d010 && d000 > d001 && d000 > d110 &&
+ d000 > d101 && d000 > d011 && d000 > d111)
+ {
+ return 1;
+ }
+ else if (d100 > 0.0f &&
+ d100 > d000 && d100 > d010 && d100 > d001 && d100 > d110 &&
+ d100 > d101 && d100 > d011 && d100 > d111)
+ {
+ return 2;
+ }
+ else if (d010 > 0.0f &&
+ d010 > d000 && d010 > d100 && d010 > d001 && d010 > d110 &&
+ d010 > d101 && d010 > d011 && d010 > d111)
+ {
+ return 3;
+ }
+ else if (d001 > 0.0f &&
+ d001 > d000 && d001 > d100 && d001 > d010 && d001 > d110 &&
+ d001 > d101 && d001 > d011 && d001 > d111)
+ {
+ return 4;
+ }
+ else if (d110 > 0.0f &&
+ d110 > d000 && d110 > d100 && d110 > d010 && d110 > d001 &&
+ d110 > d101 && d110 > d011 && d110 > d111)
+ {
+ return 5;
+ }
+ else if (d101 > 0.0f &&
+ d101 > d000 && d101 > d100 && d101 > d010 && d101 > d001 &&
+ d101 > d110 && d101 > d011 && d101 > d111)
+ {
+ return 6;
+ }
+ else if (d011 > 0.0f &&
+ d011 > d000 && d011 > d100 && d011 > d010 && d011 > d001 &&
+ d011 > d110 && d011 > d101 && d011 > d111)
+ {
+ return 7;
+ }
+ return 8; /* d111 */
+}
+
+static void drawText(const Handle(OpenGl_Workspace) &AWorkspace, const wchar_t* text, const char* font, OSD_FontAspect style, int size, float x, float y, float z)
+{
+ AWorkspace->FindFont(font, style, size);
+ AWorkspace->RenderText(text, 0, x, y, z);
+
+/* 4 OCC 6.3.1 and older:
+ GLuint fontBase;
+
+#ifndef WNT
+ fontBase = tXfmsetfont (1.0F, 1.0F);
+#else
+ fontBase = WNTSetFont (1.0F, 1.0F);
+#endif
+
+#ifndef WNT
+ tXfmprstr(text, fontBase, x, y, z);
+#else
+ WNTPuts(text, fontBase, 0, x, y, z);
+#endif
+*/
+}
+
+static void drawArrow(float x1, float y1, float z1,
+ float x2, float y2, float z2,
+ float xn, float yn, float zn)
+{
+ float h, r;
+ float xa, ya, za;
+ float x0, y0, z0;
+ float xr, yr, zr;
+ float xa1, ya1, za1, xa2, ya2, za2;
+
+ /* Start of arrow: at 10% from the end */
+ x0 = x1 + 0.9f * (x2 - x1); y0 = y1 + 0.9f * (y2 - y1); z0 = z1 + 0.9f * (z2 - z1);
+
+ /* Base of the arrow */
+ xa = (x2 - x0); ya = (y2 - y0); za = (z2 - z0);
+
+ /* Height of the arrow */
+ h = sqrtf(xa * xa + ya * ya + za * za);
+ if (h <= 0.0f)
+ return;
+ xa = xa / h; ya = ya / h; za = za / h;
+
+ /* Radial direction to the arrow */
+ xr = ya * zn - za * yn;
+ yr = za * xn - xa * zn;
+ zr = xa * yn - ya * xn;
+
+ /* Normalize the radial vector */
+ r = sqrtf(xr * xr + yr * yr + zr * zr);
+ if (r <= 0.0f)
+ return;
+ xr = xr / r; yr = yr / r; zr = zr / r;
+
+ /* First point of the base of the arrow */
+ r = 0.2f * h;
+ xr = r * xr; yr = r * yr; zr = r * zr;
+ xa1 = x0 + xr; ya1 = y0 + yr; za1 = z0 + zr;
+
+ /* Second point of the base of the arrow */
+ xa2 = x0 - xr; ya2 = y0 - yr; za2 = z0 - zr;
+
+ /* Draw a line to the arrow */
+ glBegin(GL_LINES);
+ glVertex3f(x1, y1, z1);
+ glVertex3f(x0, y0, z0);
+ glEnd();
+
+ /* Draw a triangle of the arrow */
+ glBegin(GL_LINE_LOOP);
+ glVertex3f(xa1, ya1, za1);
+ glVertex3f(xa2, ya2, za2);
+ glVertex3f(x2, y2, z2);
+ glEnd();
+}
+
+OpenGl_GraduatedTrihedron::OpenGl_GraduatedTrihedron (const Graphic3d_CGraduatedTrihedron &AData)
+: myXName(NULL), myYName(NULL), myZName(NULL),
+ myDrawXName(AData.xdrawname), myDrawYName(AData.ydrawname), myDrawZName(AData.zdrawname),
+ myDrawXValues(AData.xdrawvalues), myDrawYValues(AData.ydrawvalues), myDrawZValues(AData.zdrawvalues),
+ myDrawGrid(AData.drawgrid), myDrawAxes(AData.drawaxes),
+ myNbX(AData.nbx), myNbY(AData.nby), myNbZ(AData.nbz),
+ myXOffset(AData.xoffset), myYOffset(AData.yoffset), myZOffset(AData.zoffset),
+ myXAxisOffset(AData.xaxisoffset), myYAxisOffset(AData.yaxisoffset), myZAxisOffset(AData.zaxisoffset),
+ myDrawXTickmarks(AData.xdrawtickmarks), myDrawYTickmarks(AData.ydrawtickmarks), myDrawZTickmarks(AData.zdrawtickmarks),
+ myXTickmarkLength(AData.xtickmarklength), myYTickmarkLength(AData.ytickmarklength), myZTickmarkLength(AData.ztickmarklength),
+ myFontOfNames(NULL),
+ myStyleOfNames(AData.styleOfNames),
+ mySizeOfNames(AData.sizeOfNames),
+ myFontOfValues(NULL),
+ myStyleOfValues(AData.styleOfValues),
+ mySizeOfValues(AData.sizeOfValues),
+ myCbCubicAxes(AData.cbCubicAxes),
+ myPtrVisual3dView(AData.ptrVisual3dView)
+{
+ /* Names of axes */
+ /* X-name */
+ int len = AData.xname.Length();
+ if (len)
+ {
+ Standard_ExtString iname = AData.xname.ToExtString();
+ wchar_t *xname = new wchar_t[len+1];
+ len = 0; while (xname[len] = (wchar_t)(iname[len])) len++;
+ myXName = xname;
+ }
+ /* Y-name */
+ len = AData.yname.Length();
+ if (len)
+ {
+ Standard_ExtString iname = AData.yname.ToExtString();
+ wchar_t *yname = new wchar_t[len+1];
+ len = 0; while (yname[len] = (wchar_t)(iname[len])) len++;
+ myYName = yname;
+ }
+ /* Z-name */
+ len = AData.zname.Length();
+ if (len)
+ {
+ Standard_ExtString iname = AData.zname.ToExtString();
+ wchar_t *zname = new wchar_t[len+1];
+ len = 0; while (zname[len] = (wchar_t)(iname[len])) len++;
+ myZName = zname;
+ }
+ /* Grid color */
+ myGridColor[0] = (float) AData.gridcolor.Red();
+ myGridColor[1] = (float) AData.gridcolor.Green();
+ myGridColor[2] = (float) AData.gridcolor.Blue();
+ /* X name color */
+ myXNameColor[0] = (float) AData.xnamecolor.Red();
+ myXNameColor[1] = (float) AData.xnamecolor.Green();
+ myXNameColor[2] = (float) AData.xnamecolor.Blue();
+ /* Y name color */
+ myYNameColor[0] = (float) AData.ynamecolor.Red();
+ myYNameColor[1] = (float) AData.ynamecolor.Green();
+ myYNameColor[2] = (float) AData.ynamecolor.Blue();
+ /* Z name color */
+ myZNameColor[0] = (float) AData.znamecolor.Red();
+ myZNameColor[1] = (float) AData.znamecolor.Green();
+ myZNameColor[2] = (float) AData.znamecolor.Blue();
+ /* X color of axis and values */
+ myXColor[0] = (float) AData.xcolor.Red();
+ myXColor[1] = (float) AData.xcolor.Green();
+ myXColor[2] = (float) AData.xcolor.Blue();
+ /* Y color of axis and values */
+ myYColor[0] = (float) AData.ycolor.Red();
+ myYColor[1] = (float) AData.ycolor.Green();
+ myYColor[2] = (float) AData.ycolor.Blue();
+ /* Z color of axis and values */
+ myZColor[0] = (float) AData.zcolor.Red();
+ myZColor[1] = (float) AData.zcolor.Green();
+ myZColor[2] = (float) AData.zcolor.Blue();
+ /* Font name of names of axes: Courier, Arial, ... */
+ len = AData.fontOfNames.Length();
+ char *fontOfNames = new char[len+1];
+ if (len)
+ strcpy(fontOfNames, AData.fontOfNames.ToCString());
+ else
+ fontOfNames[0] = '\0';
+ myFontOfNames = fontOfNames;
+ /* Font name of values: Courier, Arial, ... */
+ len = AData.fontOfValues.Length();
+ char *fontOfValues = new char[len+1];
+ if (len)
+ strcpy(fontOfValues, AData.fontOfValues.ToCString());
+ else
+ fontOfValues[0] = '\0';
+ myFontOfValues = fontOfValues;
+}
+
+OpenGl_GraduatedTrihedron::~OpenGl_GraduatedTrihedron ()
+{
+ // Names of axes
+ if (myXName)
+ delete[] myXName;
+ if (myYName)
+ delete[] myYName;
+ if (myZName)
+ delete[] myZName;
+
+ // Fonts
+ if (myFontOfNames)
+ delete[] myFontOfNames;
+ if (myFontOfValues)
+ delete[] myFontOfValues;
+}
+
+//call_graduatedtrihedron_redraw
+void OpenGl_GraduatedTrihedron::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectLine *oldAspectLine = AWorkspace->SetAspectLine(&myDefaultAspectLine);
+ AWorkspace->AspectLine(Standard_True);
+
+ /* Update boundary box */
+ if (myCbCubicAxes)
+ myCbCubicAxes(myPtrVisual3dView);
+
+ /* Disable lighting for lines */
+ GLboolean light = glIsEnabled(GL_LIGHTING);
+ if (light)
+ glDisable(GL_LIGHTING);
+
+ /* Find the farest point of bounding box */
+
+ /* Get normal of the view out of user. */
+ /* Also, the method return distance corresponding to 1 pixel */
+ float normal[3];
+ float dpix = getNormal(normal);
+
+ /* Normalize normal */
+ float d = sqrtf(normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2]);
+ normal[0] /= d;
+ normal[1] /= d;
+ normal[2] /= d;
+
+ /* Get central point of bounding box */
+ float center[3];
+ center[0] = 0.5f * (xmin + xmax);
+ center[1] = 0.5f * (ymin + ymax);
+ center[2] = 0.5f * (zmin + zmax);
+
+ /* Check distance to corners of bounding box along the normal */
+ float d000 = getDistance2Corner(normal, center, xmin, ymin, zmin);
+ float d100 = getDistance2Corner(normal, center, xmax, ymin, zmin);
+ float d010 = getDistance2Corner(normal, center, xmin, ymax, zmin);
+ float d001 = getDistance2Corner(normal, center, xmin, ymin, zmax);
+ float d110 = getDistance2Corner(normal, center, xmax, ymax, zmin);
+ float d101 = getDistance2Corner(normal, center, xmax, ymin, zmax);
+ float d011 = getDistance2Corner(normal, center, xmin, ymax, zmax);
+ float d111 = getDistance2Corner(normal, center, xmax, ymax, zmax);
+ unsigned char farestCorner = getFarestCorner(d000, d100, d010, d001, d110, d101, d011, d111);
+
+ /* Choose axes for the grid. */
+ float LX1[6], LX2[6], LX3[6]; /* Lines along X direction */
+ float LY1[6], LY2[6], LY3[6]; /* Lines along Y direction */
+ float LZ1[6], LZ2[6], LZ3[6]; /* Lines along Z direction */
+ unsigned char LX1draw, LX2draw, LX3draw; /* Allows drawing of X-line (000 - 100 is forbidden) */
+ unsigned char LY1draw, LY2draw, LY3draw; /* Allows drawing of Y-line (000 - 010 is forbidden) */
+ unsigned char LZ1draw, LZ2draw, LZ3draw; /* Allows drawing of Z-line (000 - 001 is forbidden) */
+
+ /* The first axis will be used for drawing the text and the values. */
+ switch (farestCorner)
+ {
+ case 1: /* d000 */
+ {
+ /* 001 - 101 */
+ LX1draw = 1;
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
+ /* 000 - 100 */
+ LX2draw = 0; /* forbidden! */
+ LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmin;
+ /* 010 - 110 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
+
+ /* 100 - 110 */
+ LY1draw = 1;
+ LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
+ /* 000 - 010 */
+ LY2draw = 0; /* forbidden! */
+ LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmin;
+ /* 001 - 011 */
+ LY3draw = 1;
+ LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 100 - 101 */
+ LZ1draw = 1;
+ LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 000 - 001 */
+ LZ2draw = 0; /* forbidden! */
+ LZ2[0] = xmin; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymin; LZ2[5] = zmax;
+ /* 010 - 011 */
+ LZ3draw = 1;
+ LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 2: /* d100 */
+ {
+ /* 001 - 101 */
+ LX1draw = 1;
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
+ /* 000 - 100 */
+ LX2draw = 0; /* forbidden! */
+ LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmin;
+ /* 010 - 110 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
+
+ /* 000 - 010 */
+ LY1draw = 0; /* forbidden! */
+ LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
+ /* 100 - 110 */
+ LY2draw = 1;
+ LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmin;
+ /* 101 - 111 */
+ LY3draw = 1;
+ LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 000 - 001 */
+ LZ1draw = 0; /* forbidden! */
+ LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 100 - 101 */
+ LZ2draw = 1;
+ LZ2[0] = xmax; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymin; LZ2[5] = zmax;
+ /* 110 - 111 */
+ LZ3draw = 1;
+ LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 3: /* d010 */
+ {
+ /* 000 - 100 */
+ LX1draw = 0; /* forbidden */
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
+ /* 010 - 110 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmin;
+ /* 011 - 111 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
+
+ /* 100 - 110 */
+ LY1draw = 1;
+ LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
+ /* 000 - 010 */
+ LY2draw = 0; /* forbidden */
+ LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmin;
+ /* 001 - 011 */
+ LY3draw = 1;
+ LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 110 - 111 */
+ LZ1draw = 1;
+ LZ1[0] = xmax; LZ1[1] = ymax; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymax; LZ1[5] = zmax;
+ /* 010 - 011 */
+ LZ2draw = 1;
+ LZ2[0] = xmin; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymax; LZ2[5] = zmax;
+ /* 000 - 001 */
+ LZ3draw = 0; /* forbidden */
+ LZ3[0] = xmin; LZ3[1] = ymin; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymin; LZ3[5] = zmax;
+
+ break;
+ }
+ case 4: /* d001 */
+ {
+ /* 000 - 100 */
+ LX1draw = 0; /* forbidden */
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
+ /* 001 - 101 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmax;
+ /* 011 - 111 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
+
+ /* 000 - 010 */
+ LY1draw = 0; /* forbidden */
+ LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
+ /* 001 - 011 */
+ LY2draw = 1;
+ LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmax;
+ /* 101 - 111 */
+ LY3draw = 1;
+ LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 100 - 101 */
+ LZ1draw = 1;
+ LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 000 - 001 */
+ LZ2draw = 0; /* forbidden */
+ LZ2[0] = xmin; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymin; LZ2[5] = zmax;
+ /* 010 - 011 */
+ LZ3draw = 1;
+ LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 5: /* d110 */
+ {
+ /* 000 - 100 */
+ LX1draw = 0; /* forbidden */
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
+ /* 010 - 110 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmin;
+ /* 011 - 111 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
+
+ /* 000 - 010 */
+ LY1draw = 0; /* forbidden */
+ LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
+ /* 100 - 110 */
+ LY2draw = 1;
+ LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmin;
+ /* 101 - 111 */
+ LY3draw = 1;
+ LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 100 - 101 */
+ LZ1draw = 1;
+ LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 110 - 111 */
+ LZ2draw = 1;
+ LZ2[0] = xmax; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymax; LZ2[5] = zmax;
+ /* 010 - 011 */
+ LZ3draw = 1;
+ LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 6: /* d101 */
+ {
+ /* 000 - 100 */
+ LX1draw = 0; /* forbidden */
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
+ /* 001 - 101 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmax;
+ /* 011 - 111 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
+
+ /* 100 - 110 */
+ LY1draw = 1;
+ LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
+ /* 101 - 111 */
+ LY2draw = 1;
+ LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmax;
+ /* 001 - 011 */
+ LY3draw = 1;
+ LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 000 - 001 */
+ LZ1draw = 0; /* forbidden */
+ LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 100 - 101 */
+ LZ2draw = 1;
+ LZ2[0] = xmax; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymin; LZ2[5] = zmax;
+ /* 110 - 111 */
+ LZ3draw = 1;
+ LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 7: /* d011 */
+ {
+ /* 001 - 101 */
+ LX1draw = 1;
+ LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
+ /* 011 - 111 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmax;
+ /* 010 - 110 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
+
+ /* 000 - 010 */
+ LY1draw = 0; /* forbidden */
+ LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
+ /* 001 - 011 */
+ LY2draw = 1;
+ LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmax;
+ /* 101 - 111 */
+ LY3draw = 1;
+ LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 000 - 001 */
+ LZ1draw = 0; /* forbidden */
+ LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 010 - 011 */
+ LZ2draw = 1;
+ LZ2[0] = xmin; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymax; LZ2[5] = zmax;
+ /* 110 - 111 */
+ LZ3draw = 1;
+ LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ case 8: /* d111 */
+ {
+ /* 010 - 110 */
+ LX1draw = 1;
+ LX1[0] = xmin; LX1[1] = ymax; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymax; LX1[5] = zmin;
+ /* 011 - 111 */
+ LX2draw = 1;
+ LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmax;
+ /* 001 - 101 */
+ LX3draw = 1;
+ LX3[0] = xmin; LX3[1] = ymin; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymin; LX3[5] = zmax;
+
+ /* 100 - 110 */
+ LY1draw = 1;
+ LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
+ /* 101 - 111 */
+ LY2draw = 1;
+ LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmax;
+ /* 001 - 011 */
+ LY3draw = 1;
+ LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
+
+ /* 100 - 101 */
+ LZ1draw = 1;
+ LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
+ /* 110 - 111 */
+ LZ2draw = 1;
+ LZ2[0] = xmax; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymax; LZ2[5] = zmax;
+ /* 010 - 011 */
+ LZ3draw = 1;
+ LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
+
+ break;
+ }
+ }
+
+ /* Draw the graduated trihedron */
+ unsigned int i, j, offset;
+ float m1[3], m2[3];
+ float step, dx, dy, dz;
+
+ /* Grid */
+ if (myDrawGrid)
+ {
+ glColor3fv(myGridColor);
+ glBegin(GL_LINES);
+ /* Boundary grid-lines */
+ if (LX1draw == 1)
+ {
+ glVertex3fv(&(LX1[0]));
+ glVertex3fv(&(LX1[3]));
+ }
+ if (LX2draw == 1)
+ {
+ glVertex3fv(&(LX2[0]));
+ glVertex3fv(&(LX2[3]));
+ }
+ if (LX3draw == 1)
+ {
+ glVertex3fv(&(LX3[0]));
+ glVertex3fv(&(LX3[3]));
+ }
+ if (LY1draw == 1)
+ {
+ glVertex3fv(&(LY1[0]));
+ glVertex3fv(&(LY1[3]));
+ }
+ if (LY2draw == 1)
+ {
+ glVertex3fv(&(LY2[0]));
+ glVertex3fv(&(LY2[3]));
+ }
+ if (LY3draw == 1)
+ {
+ glVertex3fv(&(LY3[0]));
+ glVertex3fv(&(LY3[3]));
+ }
+ if (LZ1draw == 1)
+ {
+ glVertex3fv(&(LZ1[0]));
+ glVertex3fv(&(LZ1[3]));
+ }
+ if (LZ2draw == 1)
+ {
+ glVertex3fv(&(LZ2[0]));
+ glVertex3fv(&(LZ2[3]));
+ }
+ if (LZ3draw == 1)
+ {
+ glVertex3fv(&(LZ3[0]));
+ glVertex3fv(&(LZ3[3]));
+ }
+ glEnd();
+
+ /* Intermediate grid-lines */
+ /* X-Grid lines */
+ if (myNbX > 0)
+ {
+ i = myDrawAxes ? 1 : 0;
+ step = fabsf(LX1[3] - LX1[0]) / (float) myNbX;
+ while (i < myNbX)
+ {
+ glBegin(GL_LINE_STRIP);
+ glVertex3f(LX1[0] + i * step, LX1[1], LX1[2]);
+ glVertex3f(LX2[0] + i * step, LX2[1], LX2[2]);
+ glVertex3f(LX3[0] + i * step, LX3[1], LX3[2]);
+ glEnd();
+ i++;
+ }
+ }
+ /* Y-Grid lines */
+ if (myNbY > 0)
+ {
+ i = myDrawAxes ? 1 : 0;
+ step = fabsf(LY1[4] - LY1[1]) / (float) myNbY;
+ while (i < myNbY)
+ {
+ glBegin(GL_LINE_STRIP);
+ glVertex3f(LY1[0], LY1[1] + i * step, LY1[2]);
+ glVertex3f(LY2[0], LY2[1] + i * step, LY2[2]);
+ glVertex3f(LY3[0], LY3[1] + i * step, LY3[2]);
+ glEnd();
+ i++;
+ }
+ }
+ /* Z-Grid lines */
+ if (myNbZ > 0)
+ {
+ i = myDrawAxes ? 1 : 0;
+ step = fabsf(LZ1[5] - LZ1[2]) / (float) myNbZ;
+ while (i < myNbZ)
+ {
+ glBegin(GL_LINE_STRIP);
+ glVertex3f(LZ1[0], LZ1[1], LZ1[2] + i * step);
+ glVertex3f(LZ2[0], LZ2[1], LZ2[2] + i * step);
+ glVertex3f(LZ3[0], LZ3[1], LZ3[2] + i * step);
+ glEnd();
+ i++;
+ }
+ }
+ }
+
+ /* Axes (arrows) */
+ if (myDrawAxes)
+ {
+ /* X-axis */
+ glColor3fv(myXColor);
+ drawArrow(xmin, ymin, zmin, xmax, ymin, zmin, normal[0], normal[1], normal[2]);
+
+ /* Y-axis */
+ glColor3fv(myYColor);
+ drawArrow(xmin, ymin, zmin, xmin, ymax, zmin, normal[0], normal[1], normal[2]);
+
+ /* Z-axis */
+ glColor3fv(myZColor);
+ drawArrow(xmin, ymin, zmin, xmin, ymin, zmax, normal[0], normal[1], normal[2]);
+ }
+
+ /* Names of axes & values */
+ char textValue[128];
+ wchar_t wtextValue[128];
+
+ if (myDrawXName || myDrawXValues)
+ {
+ /* Middle point of the first X-axis */
+ m1[0] = 0.5f * (LX1[0] + LX1[3]);
+ m1[1] = 0.5f * (LX1[1] + LX1[4]);
+ m1[2] = 0.5f * (LX1[2] + LX1[5]);
+
+ /* Middle point of the second X-axis */
+ m2[0] = 0.5f * (LX2[0] + LX2[3]);
+ m2[1] = 0.5f * (LX2[1] + LX2[4]);
+ m2[2] = 0.5f * (LX2[2] + LX2[5]);
+
+ /* Apply offset to m1 */
+ dy = m1[1] - m2[1];
+ if (fabsf(dy) > 1.e-7f)
+ {
+ dy = (dy > 0.0f)? 1.0f : -1.0f;
+ }
+ dz = m1[2] - m2[2];
+ if (fabsf(dz) > 1.e-7f)
+ {
+ dz = (dz > 0.0f)? 1.0f : -1.0f;
+ }
+ m2[1] = dpix * dy;
+ m2[2] = dpix * dz;
+
+ /* Name of X-axis */
+ if (myDrawXName)
+ {
+ glColor3fv(myXNameColor);
+ offset = myXAxisOffset + myXTickmarkLength;
+ drawText(AWorkspace, myXName, myFontOfNames, myStyleOfNames, mySizeOfNames,
+ m1[0], m1[1] + offset * m2[1], m1[2] + offset * m2[2]);
+ }
+
+ /* X-values */
+ if (myDrawXValues && myNbX > 0)
+ {
+ glColor3fv(myXColor);
+
+ i = 0;
+ step = fabsf(LX1[3] - LX1[0]) / (float) myNbX;
+ offset = myXOffset + myXTickmarkLength;
+ while (i <= myNbX)
+ {
+ sprintf(textValue, "%g", LX1[0] + i * step);
+ j = 0; while (wtextValue[j] = textValue[j]) j++;
+ drawText(AWorkspace, wtextValue, myFontOfValues, myStyleOfValues, mySizeOfValues,
+ LX1[0] + i * step, m1[1] + offset * m2[1], m1[2] + offset * m2[2]);
+ i++;
+ }
+ }
+
+ /* X-tickmark */
+ if (myDrawXTickmarks && myNbX > 0)
+ {
+ glColor3fv(myGridColor);
+
+ i = 0;
+ step = fabsf(LX1[3] - LX1[0]) / (float) myNbX;
+ while (i <= myNbX)
+ {
+ glBegin(GL_LINES);
+ glVertex3f(LX1[0] + i * step, m1[1], m1[2]);
+ glVertex3f(LX1[0] + i * step, m1[1] + myXTickmarkLength * m2[1], m1[2] + myXTickmarkLength * m2[2]);
+ glEnd();
+ i++;
+ }
+ }
+ }
+
+ if (myDrawYName || myDrawYValues)
+ {
+ /* Middle point of the first Y-axis */
+ m1[0] = 0.5f * (LY1[0] + LY1[3]);
+ m1[1] = 0.5f * (LY1[1] + LY1[4]);
+ m1[2] = 0.5f * (LY1[2] + LY1[5]);
+
+ /* Middle point of the second Y-axis */
+ m2[0] = 0.5f * (LY2[0] + LY2[3]);
+ m2[1] = 0.5f * (LY2[1] + LY2[4]);
+ m2[2] = 0.5f * (LY2[2] + LY2[5]);
+
+ /* Apply offset to m1 */
+ dx = m1[0] - m2[0];
+ if (fabsf(dx) > 1.e-7f)
+ {
+ dx = (dx > 0.0f)? 1.0f : -1.0f;
+ }
+ dz = m1[2] - m2[2];
+ if (fabsf(dz) > 1.e-7f)
+ {
+ dz = (dz > 0.0f)? 1.0f : -1.0f;
+ }
+
+ m2[0] = dpix * dx;
+ m2[2] = dpix * dz;
+
+ /* Name of Y-axis */
+ if (myDrawYName)
+ {
+ glColor3fv(myYNameColor);
+ offset = myYAxisOffset + myYTickmarkLength;
+ drawText(AWorkspace, myYName, myFontOfNames, myStyleOfNames, mySizeOfNames,
+ m1[0] + offset * m2[0], m1[1], m1[2] + offset * m2[2]);
+ }
+
+ /* Y-values */
+ if (myDrawYValues && myNbY > 0)
+ {
+ glColor3fv(myYColor);
+
+ i = 0;
+ step = fabsf(LY1[4] - LY1[1]) / (float) myNbY;
+ offset = myYOffset + myYTickmarkLength;
+ while (i <= myNbY)
+ {
+ sprintf(textValue, "%g", LY1[1] + i * step);
+ j = 0; while (wtextValue[j] = textValue[j]) j++;
+ drawText(AWorkspace, wtextValue, myFontOfValues, myStyleOfValues, mySizeOfValues,
+ m1[0] + offset * m2[0], LY1[1] + i * step, m1[2] + offset * m2[2]);
+ i++;
+ }
+ }
+
+ /* Y-tickmark */
+ if (myDrawYTickmarks && myNbY > 0)
+ {
+ glColor3fv(myGridColor);
+
+ i = 0;
+ step = fabsf(LY1[4] - LY1[1]) / (float) myNbY;
+ while (i <= myNbY)
+ {
+ glBegin(GL_LINES);
+ glVertex3f(m1[0], LY1[1] + i * step, m1[2]);
+ glVertex3f(m1[0] + myYTickmarkLength * m2[0], LY1[1] + i * step, m1[2] + myYTickmarkLength * m2[2]);
+ glEnd();
+ i++;
+ }
+ }
+ }
+
+ if (myDrawZName || myDrawZValues)
+ {
+ /* Middle point of the first Z-axis */
+ m1[0] = 0.5f * (LZ1[0] + LZ1[3]);
+ m1[1] = 0.5f * (LZ1[1] + LZ1[4]);
+ m1[2] = 0.5f * (LZ1[2] + LZ1[5]);
+
+ /* Middle point of the second Z-axis */
+ m2[0] = 0.5f * (LZ2[0] + LZ2[3]);
+ m2[1] = 0.5f * (LZ2[1] + LZ2[4]);
+ m2[2] = 0.5f * (LZ2[2] + LZ2[5]);
+
+ /* Apply offset to m1 */
+ dx = m1[0] - m2[0];
+ if (fabsf(dx) > 1.e-7f)
+ {
+ dx = (dx > 0.0f)? 1.0f : -1.0f;
+ }
+ dy = m1[1] - m2[1];
+ if (fabsf(dy) > 1.e-7f)
+ {
+ dy = (dy > 0.0f)? 1.0f : -1.0f;
+ }
+
+ m2[0] = dpix * dx;
+ m2[1] = dpix * dy;
+
+ /* Name of Z-axis */
+ if (myDrawZName)
+ {
+ glColor3fv(myZNameColor);
+ offset = myZAxisOffset + myZTickmarkLength;
+ drawText(AWorkspace, myZName, myFontOfNames, myStyleOfNames, mySizeOfNames,
+ m1[0] + offset * m2[0], m1[1] + offset * m2[1], m1[2]);
+ }
+
+ /* Z-values */
+ if (myDrawZValues && myNbZ > 0)
+ {
+ glColor3fv(myZColor);
+
+ i = 0;
+ step = fabsf(LZ1[5] - LZ1[2]) / (float) myNbZ;
+ offset = myZOffset + myZTickmarkLength;
+ while (i <= myNbZ)
+ {
+ sprintf(textValue, "%g", LZ1[2] + i * step);
+ j = 0; while (wtextValue[j] = textValue[j]) j++;
+ drawText(AWorkspace, wtextValue, myFontOfValues, myStyleOfValues, mySizeOfValues,
+ m1[0] + offset * m2[0], m1[1] + offset * m2[1], LZ1[2] + i * step);
+ i++;
+ }
+ }
+
+ /* Z-tickmark */
+ if (myDrawZTickmarks && myNbZ > 0)
+ {
+ glColor3fv(myGridColor);
+
+ i = 0;
+ step = fabsf(LZ1[5] - LZ1[2]) / (float) myNbZ;
+ while (i <= myNbZ)
+ {
+ glBegin(GL_LINES);
+ glVertex3f(m1[0], m1[1], LZ1[2] + i * step);
+ glVertex3f(m1[0] + myZTickmarkLength * m2[0], m1[1] + myZTickmarkLength * m2[1], LZ1[2] + i * step);
+ glEnd();
+ i++;
+ }
+ }
+ }
+
+ /* Activate the lighting if it was turned off by this method call */
+ if (light)
+ glEnable(GL_LIGHTING);
+
+ AWorkspace->SetAspectLine(oldAspectLine);
+}
+
+//call_graduatedtrihedron_minmaxvalues
+void OpenGl_GraduatedTrihedron::SetMinMax (const Standard_ShortReal xMin, const Standard_ShortReal yMin, const Standard_ShortReal zMin,
+ const Standard_ShortReal xMax, const Standard_ShortReal yMax, const Standard_ShortReal zMax)
+{
+ xmin = xMin;
+ ymin = yMin;
+ zmin = zMin;
+ xmax = xMax;
+ ymax = yMax;
+ zmax = zMax;
+}
--- /dev/null
+// File: OpenGl_GraduatedTrihedron.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_GraduatedTrihedron_Header
+#define _OpenGl_GraduatedTrihedron_Header
+
+#include <Handle_OpenGl_GraduatedTrihedron.hxx>
+
+#include <Graphic3d_CGraduatedTrihedron.hxx>
+
+class OpenGl_View;
+
+class OpenGl_GraduatedTrihedron : public MMgt_TShared
+{
+ public:
+ OpenGl_GraduatedTrihedron (const Graphic3d_CGraduatedTrihedron &AData);
+ virtual ~OpenGl_GraduatedTrihedron ();
+
+ static void SetMinMax (const Standard_ShortReal xMin, const Standard_ShortReal yMin, const Standard_ShortReal zMin,
+ const Standard_ShortReal xMax, const Standard_ShortReal yMax, const Standard_ShortReal zMax);
+
+ void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ // Type definition
+ //
+ DEFINE_STANDARD_RTTI(OpenGl_GraduatedTrihedron)
+
+ protected:
+
+ const wchar_t *myXName;
+ const wchar_t *myYName;
+ const wchar_t *myZName;
+ unsigned char myDrawXName, myDrawYName, myDrawZName;
+ unsigned char myDrawXValues, myDrawYValues, myDrawZValues;
+ unsigned char myDrawGrid;
+ unsigned char myDrawAxes;
+ unsigned int myNbX, myNbY, myNbZ;
+ int myXOffset, myYOffset, myZOffset;
+ int myXAxisOffset, myYAxisOffset, myZAxisOffset;
+ unsigned char myDrawXTickmarks, myDrawYTickmarks, myDrawZTickmarks;
+ unsigned int myXTickmarkLength, myYTickmarkLength, myZTickmarkLength;
+ float myGridColor[3];
+ float myXNameColor[3];
+ float myYNameColor[3];
+ float myZNameColor[3];
+ float myXColor[3];
+ float myYColor[3];
+ float myZColor[3];
+ const char *myFontOfNames;
+ OSD_FontAspect myStyleOfNames;
+ int mySizeOfNames;
+ const char* myFontOfValues;
+ OSD_FontAspect myStyleOfValues;
+ int mySizeOfValues;
+ minMaxValuesCallback myCbCubicAxes;
+ void* myPtrVisual3dView;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //_OpenGl_GraduatedTrihedron_Header
+++ /dev/null
---
--- File: OpenGl_GraphicDriver.cdl
--- Created: Mardi 28 janvier 1997
--- Author: CAL
--- Modified:
--- 07-10-99 : EUG : Degeneration support (G003)
--- Add DegenerateStructure() and
--- SetBackFacingModel() methods.
--- 16-06-2000 : ATS,SPK : G005 : PARRAY method
--- 17/08/00 ; THA ; Thomas HARTL <t-hartl@muenchen.matra-dtv.fr>
--- -> Add Print methods (works only under Windows).
--- 27/03/02 ; GG ; RIC120302 Add new method Begin(Aspect_Display)
--- 23/12/02 ; SAV Added methods to set background image
--- 20/01/09 ; ABD : Integration support of system fonts (using FTGL and FreeType)
---
---
----Copyright: MatraDatavision 1997
---
-
-class GraphicDriver from OpenGl inherits GraphicDriver from Graphic3d
-
- ---Version:
-
- ---Purpose: This class allows the definition of an opengl graphic
- -- driver
-
- ---Keywords: OpenGl
-
- ---Warning:
- ---References:
-
-uses
-
- Array1OfInteger from TColStd,
- Array1OfReal from TColStd,
- Array2OfReal from TColStd,
-
- ExtendedString from TCollection,
-
- NameOfColor from Quantity,
- Color from Quantity,
- PlaneAngle from Quantity,
-
- AlienImage from AlienImage,
-
- Array1OfEdge from Aspect,
- CLayer2d from Aspect,
- TypeOfTriedronEcho from Aspect,
- TypeOfTriedronPosition from Aspect,
- Handle from Aspect,
- Display from Aspect,
- PrintAlgo from Aspect,
-
- AspectLine3d from Graphic3d,
- AspectMarker3d from Graphic3d,
- AspectText3d from Graphic3d,
- AspectFillArea3d from Graphic3d,
- HorizontalTextAlignment from Graphic3d,
- CBitFields20 from Graphic3d,
- CGroup from Graphic3d,
- CPick from Graphic3d,
- CStructure from Graphic3d,
- CView from Graphic3d,
- CRawBufferData from Image,
- Structure from Graphic3d,
- TextPath from Graphic3d,
- TypeOfComposition from Graphic3d,
- TypeOfPolygon from Graphic3d,
- TypeOfPrimitive from Graphic3d,
- Vector from Graphic3d,
- Array1OfVertex from Graphic3d,
- Array2OfVertex from Graphic3d,
- Vertex from Graphic3d,
- Array1OfVertexC from Graphic3d,
- Array2OfVertexC from Graphic3d,
- VertexC from Graphic3d,
- Array1OfVertexN from Graphic3d,
- Array2OfVertexN from Graphic3d,
- VertexN from Graphic3d,
- Array1OfVertexNC from Graphic3d,
- Array2OfVertexNC from Graphic3d,
- VertexNC from Graphic3d,
- VerticalTextAlignment from Graphic3d,
- CInitTexture from Graphic3d,
- TypeOfTexture from Graphic3d,
- VertexNT from Graphic3d,
- Array1OfVertexNT from Graphic3d,
- Array2OfVertexNT from Graphic3d,
- PrimitiveArray from Graphic3d,
- PtrFrameBuffer from Graphic3d,
- FillMethod from Aspect,
- GradientFillMethod from Aspect,
- HArray1OfByte from TColStd,
- ExportFormat from Graphic3d,
- SortType from Graphic3d,
- HArray1OfReal from TColStd,
- CUserDraw from Graphic3d,
- NListOfHAsciiString from Graphic3d,
- FontAspect from OSD,
- CGraduatedTrihedron from Graphic3d
-is
-
- Create ( AShrName : CString from Standard )
- returns mutable GraphicDriver from OpenGl;
-
- -------------------------
- -- Category: Init methods
- -------------------------
- DefaultTextHeight( me )
- returns ShortReal from Standard
- is redefined static;
-
- Begin ( me : mutable;
- ADisplay : CString from Standard )
- returns Boolean from Standard
- is redefined static;
- ---Purpose: call_togl_begin
-
- Begin ( me : mutable;
- ADisplay : Display from Aspect )
- returns Boolean from Standard
- is redefined static;
- ---Purpose: call_togl_begin_display
-
- End ( me : mutable )
- is redefined static;
- ---Purpose: call_togl_end
-
- ----------------------------
- -- Category: Inquire methods
- ----------------------------
-
- InquireLightLimit ( me : mutable )
- returns Integer from Standard
- is redefined static;
- ---Purpose: call_togl_inquirelight
-
- InquireMat ( me : mutable;
- ACView : CView from Graphic3d;
- AMatO : out Array2OfReal from TColStd;
- AMatM : out Array2OfReal from TColStd )
- is redefined static;
- ---Purpose: call_togl_inquiremat
-
- InquirePlaneLimit ( me : mutable )
- returns Integer from Standard
- is redefined static;
- ---Purpose: call_togl_inquireplane
-
- InquireViewLimit ( me : mutable )
- returns Integer from Standard
- is redefined static;
- ---Purpose: call_togl_inquireview
-
- InquireTextureAvailable ( me : mutable )
- returns Boolean from Standard
- is redefined static;
- ---Purpose: Returns Standard_True if texture is
- -- supported by the graphic driver
-
- ------------------------------
- -- Category: Highlight methods
- ------------------------------
-
- Blink ( me : mutable;
- ACStructure : CStructure from Graphic3d;
- Create : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_blink
-
- BoundaryBox ( me : mutable;
- ACStructure : CStructure from Graphic3d;
- Create : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_boundarybox
-
- HighlightColor ( me : mutable;
- ACStructure : CStructure from Graphic3d;
- R : ShortReal from Standard;
- G : ShortReal from Standard;
- B : ShortReal from Standard;
- Create : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_highlightcolor
-
- NameSetStructure ( me : mutable;
- ACStructure : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_namesetstructure
-
- -------------------------------------
- -- Category: Group management methods
- -------------------------------------
-
- ClearGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_cleargroup
-
- CloseGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_closegroup
-
- FaceContextGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- NoInsert : Integer from Standard )
- is redefined static;
- ---Purpose: call_togl_facecontextgroup
-
- Group ( me : mutable;
- ACGroup : in out CGroup from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_group
-
- LineContextGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- NoInsert : Integer from Standard )
- is redefined static;
- ---Purpose: call_togl_linecontextgroup
-
- MarkerContextGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- NoInsert : Integer from Standard )
- is redefined static;
- ---Purpose: call_togl_markercontextgroup
-
- MarkerContextGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- NoInsert : Integer from Standard;
- AMarkWidth : Integer from Standard;
- AMarkHeight : Integer from Standard;
- ATexture : HArray1OfByte from TColStd )
- is redefined static;
- ---Purpose: call_togl_markercontextgroup
-
-
- OpenGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_opengroup
-
- RemoveGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_removegroup
-
- TextContextGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- NoInsert : Integer from Standard )
- is redefined static;
- ---Purpose: call_togl_textcontextgroup
-
- -----------------------------------------
- -- Category: Structure management methods
- -----------------------------------------
-
- ClearStructure ( me : mutable;
- ACStructure : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_clearstructure
-
- Connect ( me : mutable;
- AFather : CStructure from Graphic3d;
- ASon : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_connect
-
- ContextStructure ( me : mutable;
- ACStructure : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_contextstructure
-
- Disconnect ( me : mutable;
- AFather : CStructure from Graphic3d;
- ASon : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_disconnect
-
- DisplayStructure ( me : mutable;
- ACView : CView from Graphic3d;
- ACStructure : CStructure from Graphic3d;
- APriority : Integer from Standard )
- is redefined static;
- ---Purpose: call_togl_displaystructure
-
- EraseStructure ( me : mutable;
- ACView : CView from Graphic3d;
- ACStructure : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_erasestructure
-
- RemoveStructure ( me : mutable;
- ACStructure : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_removestructure
-
- Structure ( me : mutable;
- ACStructure : in out CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_structure
-
- --------------------------------
- -- Category: Exploration methods
- --------------------------------
-
- DumpGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_structure_exploration
-
- DumpStructure ( me : mutable;
- ACStructure : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_structure_exploration
-
- DumpView ( me : mutable;
- ACView : CView from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_view_exploration
-
- ElementExploration ( me : mutable;
- ACStructure : CStructure from Graphic3d;
- ElementNumber : Integer from Standard;
- AVertex : out VertexNC from Graphic3d;
- AVector : out Vector from Graphic3d )
- returns Boolean from Standard
- is redefined static;
- ---Purpose: call_togl_element_exploration
-
- ElementType ( me : mutable;
- ACStructure : CStructure from Graphic3d;
- ElementNumber : Integer from Standard )
- returns TypeOfPrimitive from Graphic3d
- is redefined static;
- ---Purpose: call_togl_element_type
-
- ------------------------------------
- -- Category: Pick management methods
- ------------------------------------
-
- InitPick ( me : mutable )
- is redefined static;
- ---Purpose: call_togl_init_pick
-
- Pick ( me : mutable;
- ACPick : out CPick from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_pick
-
- PickId ( me : mutable;
- ACGroup : CGroup from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_pickid
-
- ------------------------------------
- -- Category: Structured mode methods
- ------------------------------------
-
- ActivateView ( me : mutable;
- ACView : CView from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_activateview
-
- AntiAliasing ( me : mutable;
- ACView : CView from Graphic3d;
- AFlag : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_antialiasing
-
- Background ( me : mutable;
- ACView : CView from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_background
-
- GradientBackground ( me : mutable;
- ACView : CView from Graphic3d;
- AColor1: Color from Quantity;
- AColor2: Color from Quantity;
- FillStyle : GradientFillMethod from Aspect
- )
- is redefined static;
- ---Purpose: call_togl_gradient_background
-
- BackgroundImage( me : mutable;
- FileName : CString from Standard;
- ACView : CView from Graphic3d;
- FillStyle : FillMethod from Aspect )
- is redefined static;
-
- SetBgImageStyle( me : mutable; ACView : CView from Graphic3d;
- FillStyle : FillMethod from Aspect )
- is redefined static;
-
- SetBgGradientStyle( me : mutable;
- ACView : CView from Graphic3d;
- FillStyle : GradientFillMethod from Aspect )
- is redefined static;
-
- ClipLimit ( me : mutable;
- ACView : CView from Graphic3d;
- AWait : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_cliplimit
-
- DeactivateView ( me : mutable;
- ACView : CView from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_deactivateview
-
- DepthCueing ( me : mutable;
- ACView : CView from Graphic3d;
- AFlag : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_cliplimit
-
- ProjectRaster ( me : mutable;
- ACView : CView from Graphic3d;
- AX : ShortReal from Standard;
- AY : ShortReal from Standard;
- AZ : ShortReal from Standard;
- AU : out Integer from Standard;
- AV : out Integer from Standard )
- returns Boolean from Standard
- is redefined static;
- ---Purpose: call_togl_unproject_raster
-
- UnProjectRaster ( me : mutable;
- ACView : CView from Graphic3d;
- Axm : Integer from Standard;
- Aym : Integer from Standard;
- AXM : Integer from Standard;
- AYM : Integer from Standard;
- AU : Integer from Standard;
- AV : Integer from Standard;
- AX : out ShortReal from Standard;
- AY : out ShortReal from Standard;
- AZ : out ShortReal from Standard )
- returns Boolean from Standard
- is redefined static;
- ---Purpose: call_togl_unproject_raster
-
- UnProjectRasterWithRay ( me : mutable;
- ACView : CView from Graphic3d;
- Axm : Integer from Standard;
- Aym : Integer from Standard;
- AXM : Integer from Standard;
- AYM : Integer from Standard;
- AU : Integer from Standard;
- AV : Integer from Standard;
- AX : out ShortReal from Standard;
- AY : out ShortReal from Standard;
- AZ : out ShortReal from Standard;
- DX : out ShortReal from Standard;
- DY : out ShortReal from Standard;
- DZ : out ShortReal from Standard )
- returns Boolean from Standard
- is redefined static;
- ---Purpose: call_togl_unproject_raster_with_ray
-
- RatioWindow ( me : mutable;
- ACView : CView from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_ratio_window
-
- Redraw ( me : mutable;
- ACView : CView from Graphic3d;
- ACUnderLayer : CLayer2d from Aspect;
- ACOverLayer : CLayer2d from Aspect;
- x : Integer = 0;
- y : Integer = 0;
- width : Integer = 0;
- height : Integer = 0 )
- is redefined static;
- ---Purpose: call_togl_redraw
-
- RemoveView ( me : mutable;
- ACView : CView from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_removeview
-
- SetLight ( me : mutable;
- ACView : CView from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_setlight
-
- SetPlane ( me : mutable;
- ACView : CView from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_setplane
-
- SetVisualisation ( me : mutable;
- ACView : CView from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_setvisualisation
-
- TransformStructure ( me : mutable;
- ACStructure : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_transformstructure
-
- DegenerateStructure ( me : mutable;
- ACStructure : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_degeneratestructure
-
- Transparency ( me : mutable;
- ACView : CView from Graphic3d;
- AFlag : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_transparency
-
- Update ( me : mutable;
- ACView : CView from Graphic3d;
- ACUnderLayer : CLayer2d from Aspect;
- ACOverLayer : CLayer2d from Aspect )
- is redefined static;
- ---Purpose: call_togl_update
-
- View ( me : mutable;
- ACView : in out CView from Graphic3d )
- returns Boolean from Standard
- is redefined static;
- ---Purpose: call_togl_view
-
- ViewMapping ( me : mutable;
- ACView : CView from Graphic3d;
- AWait : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_viewmapping
-
- ViewOrientation ( me : mutable;
- ACView : CView from Graphic3d;
- AWait : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_vieworientation
-
- Environment ( me : mutable;
- ACView : CView from Graphic3d )
- is redefined static;
- ---Purpose:
-
- ----------------------------------------
- -- Category: Methods to create Marker
- -- for Purpose : see Graphic3d_Group.cdl
- ----------------------------------------
-
- Marker ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- APoint : Vertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
-
- MarkerSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
-
- ----------------------------------------
- -- Category: Methods to create Polygon
- -- for Purpose : see Graphic3d_Group.cdl
- ----------------------------------------
-
- Polygon ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon
-
- Polygon ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- Normal : Vector from Graphic3d;
- AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon
-
- Polygon ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexN from Graphic3d;
- AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon
-
- Polygon ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexN from Graphic3d;
- Normal : Vector from Graphic3d;
- AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon
-
- Polygon ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexNT from Graphic3d;
- AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon
-
- PolygonHoles ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- Bounds : Array1OfInteger from TColStd;
- ListVertex : Array1OfVertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_holes
-
- PolygonHoles ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- Bounds : Array1OfInteger from TColStd;
- ListVertex : Array1OfVertex from Graphic3d;
- Normal : Vector from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_holes
-
- PolygonHoles ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- Bounds : Array1OfInteger from TColStd;
- ListVertex : Array1OfVertexN from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_holes
-
- PolygonHoles ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- Bounds : Array1OfInteger from TColStd;
- ListVertex : Array1OfVertexN from Graphic3d;
- Normal : Vector from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_holes
-
- ----------------------------------------
- -- Category: Methods to create Polyline
- -- for Purpose : see Graphic3d_Group.cdl
- ----------------------------------------
-
- Polyline ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- X1, Y1, Z1, X2, Y2, Z2 : Real from Standard;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polyline
-
- Polyline ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polyline
-
- Polyline ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexC from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polyline
-
- -----------------------------------------
- -- Category: Methods to create Quadrangle
- -- for Purpose : see Graphic3d_Group.cdl
- -----------------------------------------
-
- QuadrangleMesh ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array2OfVertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_quadrangle
-
- QuadrangleMesh ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array2OfVertexN from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_quadrangle
-
- QuadrangleMesh ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array2OfVertexNT from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_quadrangle
-
- QuadrangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_indices
-
- QuadrangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexN from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_indices
-
- QuadrangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexNT from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_indices
-
- QuadrangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexC from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_indices
-
- QuadrangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexNC from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_indices
-
- ----------------------------------------
- -- Category: Methods to create Text
- -- for Purpose : see Graphic3d_Group.cdl
- ----------------------------------------
-
- Text ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- AText : CString from Standard;
- APoint : Vertex from Graphic3d;
- AHeight : Real from Standard;
- AAngle : PlaneAngle from Quantity;
- ATp : TextPath from Graphic3d;
- AHta : HorizontalTextAlignment from Graphic3d;
- AVta : VerticalTextAlignment from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_text
-
- Text ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- AText : CString from Standard;
- APoint : Vertex from Graphic3d;
- AHeight : Real from Standard;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_text
-
- Text ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- AText : ExtendedString from TCollection;
- APoint : Vertex from Graphic3d;
- AHeight : Real from Standard;
- AAngle : PlaneAngle from Quantity;
- ATp : TextPath from Graphic3d;
- AHta : HorizontalTextAlignment from Graphic3d;
- AVta : VerticalTextAlignment from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_text
-
- Text ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- AText : ExtendedString from TCollection;
- APoint : Vertex from Graphic3d;
- AHeight : Real from Standard;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_text
-
- ----------------------------------------
- ---Category: Methods to create Triangle
- -- for Purpose : see Graphic3d_Group.cdl
- ----------------------------------------
-
- TriangleMesh ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_triangle
-
- TriangleMesh ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexN from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_triangle
-
- TriangleMesh ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexNT from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_triangle
-
- TriangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_indices
-
- TriangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexN from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_indices
-
- TriangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexNT from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_indices
-
- TriangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexC from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_indices
-
- TriangleSet ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertexNC from Graphic3d;
- ListEdge : Array1OfEdge from Aspect;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_polygon_indices
-
- PrimitiveArray( me : mutable;
- ACGroup : CGroup from Graphic3d;
- parray : PrimitiveArray from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_parray
-
- UserDraw( me : mutable;
- ACGroup : CGroup from Graphic3d;
- AUserDraw : CUserDraw from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_userdraw
-
- EnableVBO( me : mutable;
- status : Boolean from Standard )
- is redefined static;
- ---Purpose: enables/disables usage of OpenGL vertex buffer arrays while drawing primitiev arrays
-
-
- ----------------------------------------
- ---Category: Methods to create Triedron
- -- for Purpose : see Graphic3d_Group.cdl
- ----------------------------------------
-
- ZBufferTriedronSetup ( me : mutable;
- XColor : NameOfColor from Quantity = Quantity_NOC_RED;
- YColor : NameOfColor from Quantity = Quantity_NOC_GREEN;
- ZColor : NameOfColor from Quantity = Quantity_NOC_BLUE1;
- SizeRatio : Real from Standard = 0.8;
- AxisDiametr : Real from Standard = 0.05;
- NbFacettes : Integer from Standard = 12)
- is redefined static;
- ---Purpose: call_togl_ztriedron_setup
-
- TriedronDisplay ( me : mutable;
- ACView : CView from Graphic3d;
- APosition : TypeOfTriedronPosition from Aspect = Aspect_TOTP_CENTER;
- AColor : NameOfColor from Quantity = Quantity_NOC_WHITE ;
- AScale : Real from Standard = 0.02;
- AsWireframe : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_triedron_display
-
-
- TriedronErase ( me : mutable;
- ACView : CView from Graphic3d)
- is redefined static;
- ---Purpose: call_togl_triedron_erase
-
-
- TriedronEcho ( me : mutable;
- ACView : CView from Graphic3d;
- AType : TypeOfTriedronEcho from Aspect = Aspect_TOTE_NONE )
- is redefined static;
- ---Purpose: call_togl_triedron_echo
-
- ---------------------------------
- ---Category: Graduated trihedron
- --------------------------------
-
- GraduatedTrihedronDisplay(me : mutable;
- view : CView from Graphic3d;
- cubic : CGraduatedTrihedron from Graphic3d)
- ---Purpose: call_togl_graduatedtrihedron_display
- is redefined static;
-
- GraduatedTrihedronErase(me : mutable;
- view : CView from Graphic3d)
- ---Purpose: call_togl_graduatedtrihedron_erase
- is redefined static;
-
- GraduatedTrihedronMinMaxValues(me : mutable;
- xmin : ShortReal from Standard;
- ymin : ShortReal from Standard;
- zmin : ShortReal from Standard;
- xmax : ShortReal from Standard;
- ymax : ShortReal from Standard;
- zmax : ShortReal from Standard)
- ---Purpose: call_togl_graduatedtrihedron_minmaxvalues
- is redefined static;
-
- ----------------------------------------
- -- Category: Internal methods
- -- for Purpose : see Graphic3d_Group.cdl
- ----------------------------------------
-
- Bezier ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_bezier
-
- Bezier ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- ListWeight : Array1OfReal from TColStd;
- EvalMinMax : Boolean from Standard = Standard_True )
- is redefined static;
- ---Purpose: call_togl_bezier_weight
-
- ---------------------------
- -- Category: Animation mode
- ---------------------------
-
- BeginAnimation ( me : mutable;
- ACView : CView from Graphic3d)
- is redefined static;
- ---Purpose: call_togl_begin_animation
-
- EndAnimation ( me : mutable;
- ACView : CView from Graphic3d)
- is redefined static;
- ---Purpose: call_togl_end_animation
-
- ----------------------------------
- -- Category: Ajout mode methods
- ----------------------------------
-
- BeginAddMode ( me : mutable;
- ACView : CView from Graphic3d)
- returns Boolean from Standard
- is redefined static;
- ---Purpose: call_togl_begin_ajout_mode
-
- EndAddMode ( me : mutable)
- is redefined static;
- ---Purpose: call_togl_end_ajout_mode
-
- ----------------------------------
- -- Category: Immediat mode methods
- ----------------------------------
-
- BeginImmediatMode ( me : mutable;
- ACView : CView from Graphic3d;
- ACUnderLayer : CLayer2d from Aspect;
- ACOverLayer : CLayer2d from Aspect;
- DoubleBuffer : Boolean from Standard;
- RetainMode : Boolean from Standard)
- returns Boolean from Standard
- is redefined static;
- ---Purpose: call_togl_begin_immediat_mode
-
- BeginPolyline ( me : mutable )
- is redefined static;
- ---Purpose: call_togl_begin_polyline
-
- ClearImmediatMode ( me : mutable; ACView : CView from Graphic3d;
- aFlush : Boolean from Standard = Standard_True)
- is redefined static;
- ---Purpose: call_togl_clear_immediat_mode
-
- Draw ( me : mutable;
- X : ShortReal from Standard;
- Y : ShortReal from Standard;
- Z : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_draw
-
- DrawStructure ( me : mutable;
- ACStructure : CStructure from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_draw_structure
-
- EndImmediatMode ( me : mutable;
- Synchronize : Integer from Standard )
- is redefined static;
- ---Purpose: call_togl_end_immediat_mode
-
- EndPolyline ( me : mutable )
- is redefined static;
- ---Purpose: call_togl_end_polyline
-
- Move ( me : mutable;
- X : ShortReal from Standard;
- Y : ShortReal from Standard;
- Z : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_move
-
- SetLineColor ( me : mutable;
- R : ShortReal from Standard;
- G : ShortReal from Standard;
- B : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_set_linecolor
-
- SetLineType ( me : mutable;
- Type : Integer from Standard )
- is redefined static;
- ---Purpose: call_togl_set_linetype
-
- SetLineWidth ( me : mutable;
- Width : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_set_linewidth
-
- SetMinMax ( me : mutable;
- X1 : ShortReal from Standard;
- Y1 : ShortReal from Standard;
- Z1 : ShortReal from Standard;
- X2 : ShortReal from Standard;
- Y2 : ShortReal from Standard;
- Z2 : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_set_minmax
-
- Transform ( me : mutable;
- AMatrix : Array2OfReal from TColStd;
- AType : TypeOfComposition from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_transform
-
- -----------------------------
- -- Category: Textures methods
- -----------------------------
-
- CreateTexture ( me;
- Type : TypeOfTexture from Graphic3d;
- Image : AlienImage from AlienImage;
- FileName : CString from Standard;
- TexUpperBounds : HArray1OfReal from TColStd )
- returns Integer from Standard
- is redefined static;
- ---Purpose:
-
- DestroyTexture ( me;
- TexId : Integer from Standard )
- is redefined static;
- ---Purpose:
-
- ModifyTexture ( me;
- TexId : Integer from Standard;
- AValue : CInitTexture from Graphic3d )
- is redefined static;
- ---Purpose:
-
- -------------------------------
- -- Category: Layer mode methods
- -------------------------------
-
- Layer ( me : mutable;
- ACLayer : in out CLayer2d from Aspect )
- is redefined static;
- ---Purpose: call_togl_layer2d
-
- RemoveLayer ( me : mutable;
- ACLayer : CLayer2d from Aspect )
- is redefined static;
- ---Purpose: call_togl_removelayer2d
-
- BeginLayer ( me : mutable;
- ACLayer : CLayer2d from Aspect )
- is redefined static;
- ---Purpose: call_togl_begin_layer2d
-
- BeginPolygon2d ( me : mutable )
- is redefined static;
- ---Purpose: call_togl_begin_polygon2d
-
- BeginPolyline2d ( me : mutable )
- is redefined static;
- ---Purpose: call_togl_begin_polyline2d
-
- ClearLayer ( me : mutable;
- ACLayer : CLayer2d from Aspect )
- is redefined static;
- ---Purpose: call_togl_clear_layer2d
-
- Draw ( me : mutable;
- X : ShortReal from Standard;
- Y : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_draw2d
-
- Edge ( me : mutable;
- X : ShortReal from Standard;
- Y : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_edge2d
-
- EndLayer ( me : mutable )
- is redefined static;
- ---Purpose: call_togl_end_layer2d
-
- EndPolygon2d ( me : mutable )
- is redefined static;
- ---Purpose: call_togl_end_polygon2d
-
- EndPolyline2d ( me : mutable )
- is redefined static;
- ---Purpose: call_togl_end_polyline2d
-
- Move ( me : mutable;
- X : ShortReal from Standard;
- Y : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_move2d
-
- Rectangle ( me : mutable;
- X, Y : ShortReal from Standard;
- Width, Height : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_rectangle2d
-
- SetColor ( me : mutable;
- R : ShortReal from Standard;
- G : ShortReal from Standard;
- B : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_set_color
-
- SetTransparency ( me : mutable;
- ATransparency : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_set_transparency
-
- UnsetTransparency ( me : mutable )
- is redefined static;
- ---Purpose: call_togl_unset_transparency
-
- SetLineAttributes ( me : mutable;
- Type : Integer from Standard;
- Width : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_set_line_attributes
-
- SetTextAttributes ( me : mutable;
- FontName : CString from Standard;
- Type : Integer from Standard;
- R : ShortReal from Standard;
- G : ShortReal from Standard;
- B : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_set_text_attributes
-
-
- Text ( me : mutable;
- AText : CString from Standard;
- X, Y : ShortReal from Standard;
- AHeight : ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_text2d
-
- TextSize( me;
- AText : CString from Standard;
- AHeight : ShortReal from Standard;
- AWidth : in out ShortReal from Standard;
- AnAscent : in out ShortReal from Standard;
- ADescent : in out ShortReal from Standard )
- is redefined static;
- ---Purpose: call_togl_textsize2d
-
- SetBackFacingModel ( me : mutable;
- aView : CView from Graphic3d )
- is redefined static;
- ---Purpose: call_togl_backfacing
-
- Print (me;
- ACView : CView from Graphic3d;
- ACUnderLayer : CLayer2d from Aspect;
- ACOverLayer : CLayer2d from Aspect;
- hPrnDC : Handle from Aspect;
- showBackground : Boolean;
- filename : CString;
- printAlgorithm : PrintAlgo from Aspect = Aspect_PA_STRETCH;
- theScaleFactor : Real from Standard = 1.0 )
- returns Boolean from Standard is redefined static;
- ---Level: Internal
- ---Purpose: 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 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;
- ---Warning: Works only under Windows.
-
-
- Export( me: mutable;
- theFileName : CString from Standard;
- theFormat : ExportFormat from Graphic3d;
- theSortType : SortType from Graphic3d;
- theWidth, theHeight : Integer from Standard;
- theView : CView from Graphic3d;
- theLayerUnder : CLayer2d from Aspect;
- theLayerOver : CLayer2d from Aspect;
- thePrecision : Real from Standard = 0.005;
- theProgressBarFunc : Address from Standard = NULL;
- theProgressObject : Address from Standard = NULL )
- returns Boolean from Standard
- is redefined virtual;
- ---Purpose:
- -- Export scene into the one of the Vector graphics formats (SVG, PS, PDF...).
- -- Requires gl2ps library.
- -- 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.
- -- EMF export format requiers modified gl2ps library and available only on Windows platform.
-
-
- SetDepthTestEnabled( me; view : CView from Graphic3d;
- isEnabled : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_depthtest()
-
- IsDepthTestEnabled( me; view : CView from Graphic3d )
- returns Boolean from Standard is redefined static;
- ---Purpose: call_togl_isdepthtest()
-
- ReadDepths( me; view : CView from Graphic3d;
- x, y : Integer;
- width, height : Integer;
- buffer : Address )
- is redefined static;
- ---Purpose: Reads depths of shown pixels of the given
- -- rectangle (glReadPixels with GL_DEPTH_COMPONENT)
-
- FBOCreate( me : mutable;
- view : CView from Graphic3d;
- width, height : Integer from Standard )
- returns PtrFrameBuffer from Graphic3d
- is redefined static;
- ---Purpose: Generate offscreen FBO (needs OpenGL2+ hardware)
- -- If not supported on hardware returns NULL.
-
- FBORelease( me : mutable;
- view : CView from Graphic3d;
- fboPtr : in out PtrFrameBuffer from Graphic3d )
- is redefined static;
- ---Purpose: Remove offscreen FBO
-
- FBOGetDimensions( me : mutable;
- view : CView from Graphic3d;
- fboPtr : PtrFrameBuffer from Graphic3d;
- width, height : out Integer from Standard;
- widthMax, heightMax : out Integer from Standard )
- is redefined static;
- ---Purpose: Read offscreen FBO configuration.
-
- FBOChangeViewport( me : mutable;
- view : CView from Graphic3d;
- fboPtr : in out PtrFrameBuffer from Graphic3d;
- width, height : Integer from Standard )
- is redefined static;
- ---Purpose: Change offscreen FBO viewport.
-
- BufferDump( me : mutable;
- view : CView from Graphic3d;
- buffer : in out CRawBufferData from Image )
- returns Boolean from Standard
- is redefined static;
- ---Purpose: Dump active rendering buffer into specified memory buffer.
-
- SetGLLightEnabled( me; view : CView from Graphic3d;
- isEnabled : Boolean from Standard )
- is redefined static;
- ---Purpose: call_togl_gllight()
-
- IsGLLightEnabled( me; view : CView from Graphic3d )
- returns Boolean from Standard is redefined static;
- ---Purpose: call_togl_isgllight()
-
- --ListOfAvalableFontNames( me;
- -- lst: out NListOfHAsciiString from Graphic3d )
- -- returns Boolean from Standard
- -- is redefined;
- -- Purpose: Initialize list of names of avalable system fonts
- -- returns Standard_False if fails
- -- ABD Integration support of system fonts (using FTGL and FreeType)
-
- RemovePrimitiveArray( me : mutable;
- theCGroup : CGroup from Graphic3d;
- thePArray : PrimitiveArray from Graphic3d )
- is redefined static;
- ---Purpose: Clear visualization data in graphical driver and
- -- stop displaying the primitives array of the graphical group
- -- <theCGroup>. This method is internal and should be used
- -- by Graphic3d_Group only.
-
-end GraphicDriver from OpenGl;
+// File: OpenGl_GraphicDriver.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-// File OpenGl_GraphicDriver.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
+#include <OpenGl_GraphicDriver.hxx>
-//-Copyright MatraDatavision 1997
+#include <OpenGl_View.hxx>
+#include <OpenGl_Workspace.hxx>
-//-Version
+IMPLEMENT_STANDARD_HANDLE(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex, Phigs et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.ixx>
-#include <OpenGl_Extension.hxx>
-
-//-Aliases
-
-//-Global data definitions
+namespace
+{
+ // Global maps - shared by whole TKOpenGl module. To be removed.
+ static NCollection_DataMap<Standard_Integer, Handle(OpenGl_View)> TheMapOfView (1, NCollection_BaseAllocator::CommonBaseAllocator());
+ static NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)> TheMapOfWS (1, NCollection_BaseAllocator::CommonBaseAllocator());
+ static NCollection_DataMap<Standard_Integer, OpenGl_Structure*> TheMapOfStructure (1, NCollection_BaseAllocator::CommonBaseAllocator());
+ static Standard_Boolean TheToUseVbo = Standard_True;
+};
// Pour eviter de "mangler" MetaGraphicDriverFactory, le nom de la
// fonction qui cree un Graphic3d_GraphicDriver.
// classe Graphic3d_GraphicDevice
extern "C" {
#ifdef WNT /* disable MS VC++ warning on C-style function returning C++ object */
-#pragma warning(push)
-#pragma warning(disable:4190)
+ #pragma warning(push)
+ #pragma warning(disable:4190)
#endif
- Standard_EXPORT Handle(Graphic3d_GraphicDriver) MetaGraphicDriverFactory
- (const Standard_CString AShrName);
- Standard_EXPORT Handle(Graphic3d_GraphicDriver) MetaGraphicDriverFactory
- (const Standard_CString AShrName) {
- Handle(OpenGl_GraphicDriver) aOpenDriver = new OpenGl_GraphicDriver (AShrName);
- return aOpenDriver;
- // return new OpenGl_GraphicDriver (AShrName);
- }
+ Standard_EXPORT Handle(Graphic3d_GraphicDriver) MetaGraphicDriverFactory (const Standard_CString AShrName)
+ {
+ Handle(OpenGl_GraphicDriver) aOpenDriver = new OpenGl_GraphicDriver (AShrName);
+ return aOpenDriver;
+ }
#ifdef WNT
-#pragma warning(pop)
+ #pragma warning(pop)
#endif
}
-//-Constructors
-
-OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Standard_CString AShrName):Graphic3d_GraphicDriver (AShrName)
+OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Standard_CString theShrName)
+: Graphic3d_GraphicDriver (theShrName)
{
+ //
}
-//-Methods, in order
-
Standard_ShortReal OpenGl_GraphicDriver::DefaultTextHeight() const
{
return 16.;
}
-GLboolean OpenGl_QueryExtensionGLX (const char *extName)
+NCollection_DataMap<Standard_Integer, Handle(OpenGl_View)>& OpenGl_GraphicDriver::GetMapOfViews()
+{
+ return TheMapOfView;
+}
+
+NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)>& OpenGl_GraphicDriver::GetMapOfWorkspaces()
+{
+ return TheMapOfWS;
+}
+
+NCollection_DataMap<Standard_Integer, OpenGl_Structure*>& OpenGl_GraphicDriver::GetMapOfStructures()
+{
+ return TheMapOfStructure;
+}
+
+//TsmInitUpdateState
+void OpenGl_GraphicDriver::InvalidateAllWorkspaces()
+{
+ for (NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)>::Iterator anIt (OpenGl_GraphicDriver::GetMapOfWorkspaces());
+ anIt.More(); anIt.Next())
+ {
+ anIt.ChangeValue()->Invalidate();
+ anIt.ChangeValue()->EraseAnimation();
+ }
+}
+
+Standard_Boolean OpenGl_GraphicDriver::ToUseVBO()
{
- return QueryExtensionGLX(const_cast<char *>(extName));
+ return TheToUseVbo;
}
-GLboolean OpenGl_QueryExtension (const char *extName)
+void OpenGl_GraphicDriver::EnableVBO (const Standard_Boolean theToTurnOn)
{
- return QueryExtension(const_cast<char *>(extName));
+ TheToUseVbo = theToTurnOn;
}
--- /dev/null
+// File: OpenGl_GraphicDriver.hxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_GraphicDriver_HeaderFile
+#define _OpenGl_GraphicDriver_HeaderFile
+
+#include <Graphic3d_GraphicDriver.hxx>
+#include <Handle_OpenGl_GraphicDriver.hxx>
+
+#include <Standard_CString.hxx>
+
+#include <Handle_TColStd_HArray1OfByte.hxx>
+#include <Handle_TColStd_HArray1OfReal.hxx>
+#include <Quantity_PlaneAngle.hxx>
+#include <Quantity_NameOfColor.hxx>
+#include <Handle_AlienImage_AlienImage.hxx>
+#include <Image_CRawBufferData.hxx>
+
+#include <Aspect_Display.hxx>
+#include <Aspect_GradientFillMethod.hxx>
+#include <Aspect_FillMethod.hxx>
+#include <Aspect_CLayer2d.hxx>
+#include <Aspect_TypeOfTriedronPosition.hxx>
+#include <Aspect_TypeOfTriedronEcho.hxx>
+#include <Aspect_Handle.hxx>
+#include <Aspect_PrintAlgo.hxx>
+
+#include <Graphic3d_CView.hxx>
+#include <Graphic3d_CStructure.hxx>
+#include <Graphic3d_CGroup.hxx>
+#include <Graphic3d_TypeOfPrimitive.hxx>
+#include <Graphic3d_CPick.hxx>
+#include <Graphic3d_TypeOfPolygon.hxx>
+#include <Graphic3d_TextPath.hxx>
+#include <Graphic3d_HorizontalTextAlignment.hxx>
+#include <Graphic3d_VerticalTextAlignment.hxx>
+#include <Graphic3d_PrimitiveArray.hxx>
+#include <Graphic3d_CUserDraw.hxx>
+#include <Graphic3d_CGraduatedTrihedron.hxx>
+#include <Graphic3d_TypeOfComposition.hxx>
+#include <Graphic3d_TypeOfTexture.hxx>
+#include <Graphic3d_CInitTexture.hxx>
+#include <Graphic3d_ExportFormat.hxx>
+#include <Graphic3d_SortType.hxx>
+#include <Graphic3d_PtrFrameBuffer.hxx>
+#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_Array1OfVertexN.hxx>
+#include <Graphic3d_Array1OfVertexNT.hxx>
+#include <Graphic3d_Array1OfVertexC.hxx>
+#include <Graphic3d_Array1OfVertexNC.hxx>
+#include <Graphic3d_Array2OfVertex.hxx>
+#include <Graphic3d_Array2OfVertexN.hxx>
+#include <Graphic3d_Array2OfVertexNT.hxx>
+#include <NCollection_DataMap.hxx>
+
+class TColStd_Array1OfInteger;
+class TColStd_Array1OfReal;
+class TColStd_Array2OfReal;
+class TColStd_HArray1OfByte;
+class Graphic3d_VertexNC;
+class Graphic3d_Vector;
+class Quantity_Color;
+class Graphic3d_Vertex;
+class Aspect_Array1OfEdge;
+class TCollection_ExtendedString;
+class AlienImage_AlienImage;
+class TColStd_HArray1OfReal;
+class Handle(OpenGl_View);
+class Handle(OpenGl_Workspace);
+class OpenGl_Structure;
+
+//! This class defines an OpenGl graphic driver <br>
+class OpenGl_GraphicDriver : public Graphic3d_GraphicDriver
+{
+ public:
+
+ //! Constructor
+ Standard_EXPORT OpenGl_GraphicDriver (const Standard_CString theShrName);
+
+ Standard_EXPORT Standard_Boolean Begin (const Standard_CString ADisplay);
+ Standard_EXPORT Standard_Boolean Begin (const Aspect_Display ADisplay);
+ Standard_EXPORT void End ();
+ Standard_EXPORT Standard_Integer InquireLightLimit ();
+ Standard_EXPORT void InquireMat (const Graphic3d_CView& ACView, TColStd_Array2OfReal& AMatO, TColStd_Array2OfReal& AMatM);
+ Standard_EXPORT Standard_Integer InquireViewLimit ();
+ Standard_EXPORT Standard_Boolean InquireTextureAvailable ();
+ Standard_EXPORT void Blink (const Graphic3d_CStructure& ACStructure,const Standard_Boolean Create);
+ Standard_EXPORT void BoundaryBox (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create);
+ Standard_EXPORT void HighlightColor (const Graphic3d_CStructure& ACStructure, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B, const Standard_Boolean Create);
+ Standard_EXPORT void NameSetStructure (const Graphic3d_CStructure& ACStructure);
+
+public: // Methods for graphical groups
+
+ Standard_EXPORT void ClearGroup (const Graphic3d_CGroup& ACGroup);
+ Standard_EXPORT void CloseGroup (const Graphic3d_CGroup& ACGroup);
+ Standard_EXPORT void FaceContextGroup (const Graphic3d_CGroup& theCGroup,
+ const Standard_Integer theNoInsert);
+ Standard_EXPORT void Group (Graphic3d_CGroup& theCGroup);
+ Standard_EXPORT void LineContextGroup (const Graphic3d_CGroup& theCGroup,
+ const Standard_Integer theNoInsert);
+ Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
+ const Standard_Integer theNoInsert);
+ Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
+ const Standard_Integer theNoInsert,
+ const Standard_Integer theMarkWidth,
+ const Standard_Integer theMarkHeight,
+ const Handle(TColStd_HArray1OfByte)& theTexture);
+ Standard_EXPORT void OpenGroup (const Graphic3d_CGroup& theCGroup);
+ Standard_EXPORT void RemoveGroup (const Graphic3d_CGroup& theCGroup);
+ Standard_EXPORT void TextContextGroup (const Graphic3d_CGroup& theCGroup,
+ const Standard_Integer theNoInsert);
+
+public: // Methods for graphical structures
+
+ Standard_EXPORT void ClearStructure (const Graphic3d_CStructure& theCStructure);
+ Standard_EXPORT void ContextStructure (const Graphic3d_CStructure& theCStructure);
+ Standard_EXPORT void Connect (const Graphic3d_CStructure& theFather,
+ const Graphic3d_CStructure& theSon);
+ Standard_EXPORT void Disconnect (const Graphic3d_CStructure& theFather,
+ const Graphic3d_CStructure& theSon);
+ Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
+ const Graphic3d_CStructure& theCStructure,
+ const Standard_Integer thePriority);
+ Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView,
+ const Graphic3d_CStructure& theCStructure);
+ Standard_EXPORT void RemoveStructure (const Graphic3d_CStructure& theCStructure);
+ Standard_EXPORT void Structure (Graphic3d_CStructure& theCStructure);
+
+public:
+
+ Standard_EXPORT void DumpGroup (const Graphic3d_CGroup& theCGroup);
+ Standard_EXPORT void DumpStructure (const Graphic3d_CStructure& theCStructure);
+ Standard_EXPORT void DumpView (const Graphic3d_CView& theCView);
+ Standard_EXPORT Standard_Boolean ElementExploration (const Graphic3d_CStructure& ACStructure, const Standard_Integer ElementNumber, Graphic3d_VertexNC& AVertex, Graphic3d_Vector& AVector);
+ Standard_EXPORT Graphic3d_TypeOfPrimitive ElementType (const Graphic3d_CStructure& ACStructure, const Standard_Integer ElementNumber);
+ Standard_EXPORT void InitPick ();
+ Standard_EXPORT void Pick (Graphic3d_CPick& ACPick);
+ Standard_EXPORT void PickId (const Graphic3d_CGroup& ACGroup);
+ Standard_EXPORT void ActivateView (const Graphic3d_CView& ACView);
+ Standard_EXPORT void AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
+ Standard_EXPORT void Background (const Graphic3d_CView& ACView);
+ Standard_EXPORT void GradientBackground (const Graphic3d_CView& ACView, const Quantity_Color& AColor1, const Quantity_Color& AColor2, const Aspect_GradientFillMethod FillStyle);
+ Standard_EXPORT void BackgroundImage (const Standard_CString FileName, const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle);
+ Standard_EXPORT void SetBgImageStyle (const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle);
+ Standard_EXPORT void SetBgGradientStyle (const Graphic3d_CView& ACView, const Aspect_GradientFillMethod FillStyle);
+ Standard_EXPORT void ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
+ Standard_EXPORT void DeactivateView (const Graphic3d_CView& ACView);
+ Standard_EXPORT void DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
+ Standard_EXPORT Standard_Boolean ProjectRaster (const Graphic3d_CView& ACView, const Standard_ShortReal AX, const Standard_ShortReal AY, const Standard_ShortReal AZ, Standard_Integer& AU, Standard_Integer& AV);
+ Standard_EXPORT Standard_Boolean UnProjectRaster (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& AX, Standard_ShortReal& AY, Standard_ShortReal& AZ);
+ Standard_EXPORT Standard_Boolean UnProjectRasterWithRay (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& AX, Standard_ShortReal& AY, Standard_ShortReal& AZ, Standard_ShortReal& DX, Standard_ShortReal& DY, Standard_ShortReal& DZ);
+ Standard_EXPORT void RatioWindow (const Graphic3d_CView& ACView);
+ Standard_EXPORT void Redraw (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Integer x = 0, const Standard_Integer y = 0, const Standard_Integer width = 0, const Standard_Integer height = 0);
+ Standard_EXPORT void RemoveView (const Graphic3d_CView& ACView);
+ Standard_EXPORT void SetLight (const Graphic3d_CView& ACView);
+ Standard_EXPORT void SetPlane (const Graphic3d_CView& ACView);
+ Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
+ Standard_EXPORT void TransformStructure (const Graphic3d_CStructure& ACStructure);
+ Standard_EXPORT void DegenerateStructure (const Graphic3d_CStructure& ACStructure);
+ Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
+ Standard_EXPORT void Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer);
+ Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
+ Standard_EXPORT void ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
+ Standard_EXPORT void ViewOrientation (const Graphic3d_CView& ACView,const Standard_Boolean AWait);
+ Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
+ Standard_EXPORT void Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void MarkerSet (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_Vector& Normal, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexN& ListVertex, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexN& ListVertex, const Graphic3d_Vector& Normal, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexNT& ListVertex, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_Vector& Normal, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertexN& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertexN& ListVertex, const Graphic3d_Vector& Normal, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Standard_Real X1, const Standard_Real Y1, const Standard_Real Z1, const Standard_Real X2, const Standard_Real Y2, const Standard_Real Z2, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexC& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertexN& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertexNT& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertex& ListVertex,const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexN& ListVertex,const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNT& ListVertex,const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertex& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexN& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNT& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexC& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNC& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void PrimitiveArray (const Graphic3d_CGroup& ACGroup,const Graphic3d_PrimitiveArray& parray,const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void UserDraw (const Graphic3d_CGroup& ACGroup,const Graphic3d_CUserDraw& AUserDraw);
+ Standard_EXPORT void ZBufferTriedronSetup (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);
+ Standard_EXPORT 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);
+ Standard_EXPORT void TriedronErase (const Graphic3d_CView& ACView);
+ Standard_EXPORT void TriedronEcho (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE);
+ Standard_EXPORT void GraduatedTrihedronDisplay (const Graphic3d_CView& view, const Graphic3d_CGraduatedTrihedron& cubic);
+ Standard_EXPORT void GraduatedTrihedronErase (const Graphic3d_CView& view);
+ Standard_EXPORT void GraduatedTrihedronMinMaxValues (const Standard_ShortReal xmin, const Standard_ShortReal ymin, const Standard_ShortReal zmin, const Standard_ShortReal xmax, const Standard_ShortReal ymax, const Standard_ShortReal zmax);
+ Standard_EXPORT void BeginAnimation (const Graphic3d_CView& ACView);
+ Standard_EXPORT void EndAnimation (const Graphic3d_CView& ACView);
+ Standard_EXPORT Standard_Boolean BeginAddMode (const Graphic3d_CView& ACView);
+ Standard_EXPORT void EndAddMode ();
+ Standard_EXPORT Standard_Boolean BeginImmediatMode(const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Boolean DoubleBuffer, const Standard_Boolean RetainMode);
+ Standard_EXPORT void BeginPolyline ();
+ Standard_EXPORT void ClearImmediatMode (const Graphic3d_CView& ACView,const Standard_Boolean aFlush = Standard_True);
+ Standard_EXPORT void Draw (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z);
+ Standard_EXPORT void DrawStructure (const Graphic3d_CStructure& ACStructure);
+ Standard_EXPORT void EndImmediatMode (const Standard_Integer Synchronize);
+ Standard_EXPORT void EndPolyline ();
+ Standard_EXPORT void Move (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z);
+ Standard_EXPORT void SetLineColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B);
+ Standard_EXPORT void SetLineType (const Standard_Integer Type);
+ Standard_EXPORT void SetLineWidth (const Standard_ShortReal Width);
+ Standard_EXPORT void SetMinMax (const Standard_ShortReal X1, const Standard_ShortReal Y1, const Standard_ShortReal Z1, const Standard_ShortReal X2, const Standard_ShortReal Y2, const Standard_ShortReal Z2);
+ Standard_EXPORT void Transform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType);
+ Standard_EXPORT void Layer (Aspect_CLayer2d& ACLayer);
+ Standard_EXPORT void RemoveLayer (const Aspect_CLayer2d& ACLayer);
+ Standard_EXPORT void BeginLayer (const Aspect_CLayer2d& ACLayer);
+ Standard_EXPORT void BeginPolygon2d ();
+ Standard_EXPORT void BeginPolyline2d ();
+ Standard_EXPORT void ClearLayer (const Aspect_CLayer2d& ACLayer);
+ Standard_EXPORT void Draw (const Standard_ShortReal X,const Standard_ShortReal Y);
+ Standard_EXPORT void Edge (const Standard_ShortReal X,const Standard_ShortReal Y);
+ Standard_EXPORT void EndLayer ();
+ Standard_EXPORT void EndPolygon2d ();
+ Standard_EXPORT void EndPolyline2d ();
+ Standard_EXPORT void Move (const Standard_ShortReal X,const Standard_ShortReal Y);
+ Standard_EXPORT void Rectangle (const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal Width,const Standard_ShortReal Height);
+ Standard_EXPORT void SetColor (const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B);
+ Standard_EXPORT void SetTransparency (const Standard_ShortReal ATransparency);
+ Standard_EXPORT void UnsetTransparency ();
+ Standard_EXPORT void SetLineAttributes (const Standard_Integer Type,const Standard_ShortReal Width);
+ Standard_EXPORT void SetTextAttributes (const Standard_CString FontName,const Standard_Integer Type,const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B);
+ Standard_EXPORT void Text (const Standard_CString AText,const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal AHeight);
+ Standard_EXPORT void TextSize (const Standard_CString AText,const Standard_ShortReal AHeight,Standard_ShortReal& AWidth,Standard_ShortReal& AnAscent,Standard_ShortReal& ADescent) const;
+ Standard_EXPORT void SetBackFacingModel (const Graphic3d_CView& aView);
+ //! print the contents of all layers of the view to the printer. <br>
+ //! <hPrnDC> : Pass the PrinterDeviceContext (HDC), <br>
+ //! <showBackground> : When set to FALSE then print the view without background color <br>
+ //! (background is white) <br>
+ //! else set to TRUE for printing with current background color. <br>
+ //! <filename>: If != NULL, then the view will be printed to a file. <br>
+ //! <printAlgorithm>: Select print algorithm: stretch, tile. <br>
+ //! <theScaleFactor>: Scaling coefficient, used internally to scale the <br>
+ //! printings accordingly to the scale factor selected in the printer <br>
+ //! properties dialog. <br>
+ //! Returns Standard_True if the data is passed to the printer, otherwise <br>
+ //! Standard_False if the print operation failed due to the printer errors, <br>
+ //! or lack of system memory. This might be related to insufficient memory <br>
+ //! or some internal errors. All this errors are indicated by the message <br>
+ //! boxes (on level of OpenGl_GraphicDriver). <br>
+ //! Warning: This function can reuse FBO assigned to the view <br>
+ //! Please take it into account if you use it for your purposes; <br>
+ Standard_EXPORT Standard_Boolean Print (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, 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;
+ Standard_EXPORT void SetDepthTestEnabled (const Graphic3d_CView& view,const Standard_Boolean isEnabled) const;
+ Standard_EXPORT Standard_Boolean IsDepthTestEnabled (const Graphic3d_CView& view) const;
+ //! Reads depths of shown pixels of the given rectangle (glReadPixels with GL_DEPTH_COMPONENT) <br>
+ Standard_EXPORT 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;
+ //! Generate offscreen FBO (needs OpenGL2+ hardware) <br>
+ //! If not supported on hardware returns NULL. <br>
+ Standard_EXPORT Graphic3d_PtrFrameBuffer FBOCreate (const Graphic3d_CView& view, const Standard_Integer width, const Standard_Integer height);
+ //! Remove offscreen FBO <br>
+ Standard_EXPORT void FBORelease (const Graphic3d_CView& view, Graphic3d_PtrFrameBuffer& fboPtr);
+ //! Dump active rendering buffer into specified memory buffer. <br>
+ Standard_EXPORT Standard_Boolean BufferDump (const Graphic3d_CView& view, Image_CRawBufferData& buffer);
+ Standard_EXPORT void SetGLLightEnabled (const Graphic3d_CView& view,const Standard_Boolean isEnabled) const;
+ Standard_EXPORT Standard_Boolean IsGLLightEnabled (const Graphic3d_CView& view) const;
+ //! Clear visualization data in graphical driver and stop <br>
+ //! displaying the primitives array of the graphical group <theCGroup>. <br>
+ //! This method is internal and should be used by Graphic3d_Group only. <br>
+ Standard_EXPORT void RemovePrimitiveArray(const Graphic3d_CGroup& theCGroup,const Graphic3d_PrimitiveArray& thePArray);
+ Standard_EXPORT Standard_Integer InquirePlaneLimit();
+ Standard_EXPORT Standard_Integer CreateTexture(const Graphic3d_TypeOfTexture Type,const Handle(AlienImage_AlienImage)& Image,const Standard_CString FileName,const Handle(TColStd_HArray1OfReal)& TexUpperBounds) const;
+ Standard_EXPORT void DestroyTexture(const Standard_Integer TexId) const;
+ Standard_EXPORT void ModifyTexture(const Standard_Integer TexId,const Graphic3d_CInitTexture& AValue) const;
+ Standard_EXPORT Standard_ShortReal DefaultTextHeight() const;
+ Standard_EXPORT void FBOGetDimensions(const Graphic3d_CView& view,const Graphic3d_PtrFrameBuffer fboPtr,Standard_Integer& width,Standard_Integer& height,Standard_Integer& widthMax,Standard_Integer& heightMax);
+ Standard_EXPORT void FBOChangeViewport(const Graphic3d_CView& view,Graphic3d_PtrFrameBuffer& fboPtr,const Standard_Integer width,const Standard_Integer height);
+ Standard_EXPORT 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 Aspect_CLayer2d& theLayerUnder,const Aspect_CLayer2d& theLayerOver,const Standard_Real thePrecision = 0.005,const Standard_Address theProgressBarFunc = NULL,const Standard_Address theProgressObject = NULL);
+
+public:
+
+ //! Returns true if VBO usage does not forbidden.
+ Standard_EXPORT static Standard_Boolean ToUseVBO();
+
+ //! VBO usage can be forbidden by this method even if it is supported by GL driver.
+ //! Notice that disabling of VBO will cause rendering performance degradation.
+ //! Warning! This method should be called only before any primitives are displayed in GL scene!
+ Standard_EXPORT void EnableVBO (const Standard_Boolean theToTurnOn);
+
+private:
+
+ //! Access the global map of views.
+ static NCollection_DataMap<Standard_Integer, Handle(OpenGl_View)>& GetMapOfViews();
+
+ //! Access the global map of workspaces.
+ static NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)>& GetMapOfWorkspaces();
+
+ //! Access the global map of structures.
+ static NCollection_DataMap<Standard_Integer, OpenGl_Structure*>& GetMapOfStructures();
+
+ //! Invalidates all workspaces - thus they will be redrawn on next update call.
+ static void InvalidateAllWorkspaces();
+
+public:
+
+ DEFINE_STANDARD_RTTI(OpenGl_GraphicDriver)
+};
+
+#endif //_OpenGl_GraphicDriver_HeaderFile
+// File: OpenGl_GraphicDriver_1.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+#include <OpenGl_GraphicDriver.hxx>
-// File OpenGl_GraphicDriver_1.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// Modified GG 27/12/02 IMP120302 Add new method Begin(Aspect_Display)
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
+#include <OpenGl_CView.hxx>
+#include <OpenGl_Display.hxx>
//=======================================================================
//function : Begin
Standard_Boolean OpenGl_GraphicDriver::Begin (const Standard_CString ADisplay)
{
-
-
- Standard_Boolean Result;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_begin");
- PrintString ("Display", ADisplay);
+ try
+ {
+ openglDisplay = new OpenGl_Display(ADisplay);
+ return Standard_True;
}
- Result = call_togl_begin ((Standard_PCharacter)ADisplay);
- if (MyTraceLevel) {
- PrintIResult ("call_togl_begin", Result);
+ catch (Standard_Failure)
+ {
}
-
- return Result;
-
+ return Standard_False;
}
-//RIC120302
//=======================================================================
//function : Begin
//purpose :
Standard_Boolean OpenGl_GraphicDriver::Begin (const Aspect_Display ADisplay)
{
-
- Standard_Boolean Result;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_begin_display");
+ try
+ {
+ openglDisplay = new OpenGl_Display(ADisplay);
+ return Standard_True;
}
- Result = call_togl_begin_display (ADisplay);
- if (MyTraceLevel) {
- PrintIResult ("call_togl_begin_display", Result);
+ catch (Standard_Failure)
+ {
}
-
- return Result;
-
+ return Standard_False;
}
-//RIC120302
//=======================================================================
//function : End
//purpose :
//=======================================================================
-void OpenGl_GraphicDriver::End () {
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_end");
- }
- call_togl_end ();
-
+void OpenGl_GraphicDriver::End ()
+{
+ openglDisplay.Nullify();
}
//=======================================================================
//purpose :
//=======================================================================
-void OpenGl_GraphicDriver::BeginAnimation (const Graphic3d_CView& ACView) {
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_begin_animation");
- PrintCView (MyCView, 1);
+void OpenGl_GraphicDriver::BeginAnimation (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ const Standard_Boolean UpdateAM = (ACView.IsDegenerates && !ACView.IsDegeneratesPrev) || (!ACView.IsDegenerates && ACView.IsDegeneratesPrev);
+ aCView->WS->BeginAnimation(ACView.IsDegenerates != 0,UpdateAM);
+ ((Graphic3d_CView*)(&ACView))->IsDegeneratesPrev = ACView.IsDegenerates; //szvgl: temporary
}
- call_togl_begin_animation (&MyCView);
-
}
//=======================================================================
//purpose :
//=======================================================================
-void OpenGl_GraphicDriver::EndAnimation (const Graphic3d_CView& ACView) {
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_end_animation");
- PrintCView (MyCView, 1);
- }
- call_togl_end_animation (&MyCView);
-
+void OpenGl_GraphicDriver::EndAnimation (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->WS->EndAnimation();
}
+// File: OpenGl_GraphicDriver_2.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+#include <OpenGl_GraphicDriver.hxx>
-// File OpenGl_GraphicDriver_2.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
+#include <OpenGl_Display.hxx>
+#include <OpenGl_CView.hxx>
+#include <OpenGl_tgl_all.hxx>
#include <OpenGl_tgl_funcs.hxx>
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-Standard_Integer OpenGl_GraphicDriver::InquireLightLimit () {
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_inquirelight");
- }
- Standard_Integer Result = call_togl_inquirelight ();
- if (MyTraceLevel) {
- PrintIResult ("call_togl_inquirelight", Result);
- }
- return Result;
-
+Standard_Integer OpenGl_GraphicDriver::InquireLightLimit ()
+{
+ return (openglDisplay.IsNull()? 0 : openglDisplay->Facilities().MaxLights);
}
-void OpenGl_GraphicDriver::InquireMat (const Graphic3d_CView& ACView, TColStd_Array2OfReal& AMatO, TColStd_Array2OfReal& AMatM) {
-
- Graphic3d_CView MyCView = ACView;
-
- Standard_Integer i, j;
-
- CALL_DEF_MATRIX4X4 ori_matrix;
- CALL_DEF_MATRIX4X4 map_matrix;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_inquiremat");
- PrintCView (MyCView, 1);
- }
- if (call_togl_inquiremat (&MyCView, ori_matrix, map_matrix) == 0)
- for (i=0; i<=3; i++)
- for (j=0; j<=3; j++) {
- AMatO (i, j) = Standard_Real (ori_matrix[i][j]);
- AMatM (i, j) = Standard_Real (map_matrix[i][j]);
- }
- else
- for (i=0; i<=3; i++)
- for (j=0; j<=3; j++) {
- if (i == j) {
- AMatM (i, j) = 1.0;
- AMatO (i, j) = 1.0;
- }
- else {
- AMatM (i, j) = 0.0;
- AMatO (i, j) = 0.0;
- }
- }
-
- if (MyTraceLevel) {
- PrintMatrix ("Orientation", AMatO);
- PrintMatrix ("Mapping", AMatM);
- }
-
+void OpenGl_GraphicDriver::InquireMat (const Graphic3d_CView& ACView, TColStd_Array2OfReal& AMatO, TColStd_Array2OfReal& AMatM)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->View->GetMatrices(AMatO,AMatM,ACView.Orientation.IsCustomMatrix);
}
-Standard_Integer OpenGl_GraphicDriver::InquirePlaneLimit () {
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_inquireplane");
- }
- Standard_Integer Result = call_togl_inquireplane ();
- if (MyTraceLevel) {
- PrintIResult ("call_togl_inquireplane", Result);
- }
- return Result;
-
+Standard_Integer OpenGl_GraphicDriver::InquireViewLimit ()
+{
+ return (openglDisplay.IsNull()? 0 : openglDisplay->Facilities().MaxViews);
}
-Standard_Integer OpenGl_GraphicDriver::InquireViewLimit () {
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_inquireview");
- }
- Standard_Integer Result = call_togl_inquireview ();
- if (MyTraceLevel) {
- PrintIResult ("call_togl_inquireview", Result);
- }
- return Result;
-
+Standard_Boolean OpenGl_GraphicDriver::InquireTextureAvailable ()
+{
+ return Standard_True;
}
-
-
-Standard_Boolean OpenGl_GraphicDriver::InquireTextureAvailable () {
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_inquiretexture");
- }
- Standard_Integer Result = call_togl_inquiretexture ();
- if (MyTraceLevel) {
- PrintIResult ("call_togl_inquiretexture", Result);
- }
- return Result;
-
+Standard_Integer OpenGl_GraphicDriver::InquirePlaneLimit ()
+{
+ return call_togl_inquireplane();
}
+
+// File: OpenGl_GraphicDriver_3.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+#include <OpenGl_GraphicDriver.hxx>
-// File OpenGl_GraphicDriver_3.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
+#include <TColStd_HArray1OfByte.hxx>
-//-Copyright MatraDatavision 1997
+#include <OpenGl_Display.hxx>
+#include <OpenGl_Structure.hxx>
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-
-#include <OpenGl_tgl_funcs.hxx>
-
-int GenerateMarkerBitmap( int theId, unsigned int theWidth, unsigned int theHeight, unsigned char* theArray);
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& ACGroup) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel)
- {
- PrintFunction ("call_togl_cleargroup");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_cleargroup (&MyCGroup);
+void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& theCGroup)
+{
+ if (theCGroup.ptrGroup == NULL)
+ return;
+ ((OpenGl_Group* )theCGroup.ptrGroup)->Clear();
+ InvalidateAllWorkspaces();
}
-void OpenGl_GraphicDriver::CloseGroup (const Graphic3d_CGroup& ACGroup) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_closegroup");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_closegroup (&MyCGroup);
-
+void OpenGl_GraphicDriver::CloseGroup (const Graphic3d_CGroup& )
+{
+ // Do nothing
}
-void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_facecontextgroup");
- PrintCGroup (MyCGroup, 1);
- PrintInteger ("NoInsert", NoInsert);
- }
- call_togl_facecontextgroup (&MyCGroup, int (NoInsert));
+void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& theCGroup,
+ const Standard_Integer theNoInsert)
+{
+ if (!theCGroup.ContextFillArea.IsDef || theCGroup.ptrGroup == NULL)
+ return;
+ ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectFace (theCGroup.ContextFillArea, theNoInsert);
+ InvalidateAllWorkspaces();
}
-void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& ACGroup) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_group");
- PrintCGroup (MyCGroup, 1);
+void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& theCGroup)
+{
+ OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure;
+ if (aStructure)
+ {
+ theCGroup.ptrGroup = aStructure->AddGroup();
+ InvalidateAllWorkspaces();
}
- call_togl_group (&MyCGroup);
-
}
-void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_linecontextgroup");
- PrintCGroup (MyCGroup, 1);
- PrintInteger ("NoInsert", NoInsert);
- }
- call_togl_linecontextgroup (&MyCGroup, int (NoInsert));
+void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& theCGroup,
+ const Standard_Integer theNoInsert)
+{
+ if (!theCGroup.ContextLine.IsDef || theCGroup.ptrGroup == NULL) return;
+ ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectLine (theCGroup.ContextLine, theNoInsert);
+ InvalidateAllWorkspaces();
}
-void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_markercontextgroup");
- PrintCGroup (MyCGroup, 1);
- PrintInteger ("NoInsert", NoInsert);
- }
- call_togl_markercontextgroup (&MyCGroup, int (NoInsert));
+void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
+ const Standard_Integer theNoInsert)
+{
+ if (!theCGroup.ContextMarker.IsDef || theCGroup.ptrGroup == NULL) return;
+ ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert);
+ InvalidateAllWorkspaces();
}
-void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& ACGroup,
- const Standard_Integer NoInsert,
- const Standard_Integer AMarkWidth,
- const Standard_Integer AMarkHeight,
- const Handle(TColStd_HArray1OfByte)& ATexture )
+void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
+ const Standard_Integer theNoInsert,
+ const Standard_Integer theMarkWidth,
+ const Standard_Integer theMarkHeight,
+ const Handle(TColStd_HArray1OfByte)& theTexture)
{
+ if(!theCGroup.ContextMarker.IsDef)
+ return;
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- int aByteWidth = AMarkWidth / 8;
+ if (!openglDisplay.IsNull())
+ openglDisplay->AddUserMarker ((int )theCGroup.ContextMarker.Scale, theMarkWidth, theMarkHeight, theTexture);
- unsigned char *anArray = (unsigned char*) malloc(ATexture->Length());
- for( int anIndex = ATexture->Upper() - ATexture->Lower() - aByteWidth + 1; anIndex >= 0; anIndex -= aByteWidth )
- for( int i = 0; i < aByteWidth; i++ )
- anArray[ATexture->Upper() - ATexture->Lower() - aByteWidth + 1 - anIndex + i ] = ATexture->Value( anIndex + i + 1 );
-
- GenerateMarkerBitmap( (int)ACGroup.ContextMarker.Scale, AMarkWidth, AMarkHeight, anArray );
- if (MyTraceLevel) {
- PrintFunction ("call_togl_markercontextgroup");
- PrintCGroup (MyCGroup, 1);
- PrintInteger ("NoInsert", NoInsert);
+ if (theCGroup.ptrGroup != NULL)
+ {
+ ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert);
+ InvalidateAllWorkspaces();
}
- call_togl_markercontextgroup (&MyCGroup, int (NoInsert));
-
- free(anArray);
}
-
-void OpenGl_GraphicDriver::OpenGroup (const Graphic3d_CGroup& ACGroup) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_opengroup");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_opengroup (&MyCGroup);
-
+void OpenGl_GraphicDriver::OpenGroup (const Graphic3d_CGroup& )
+{
+ // Do nothing
}
-void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& ACGroup) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_removegroup");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_removegroup (&MyCGroup);
+void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup)
+{
+ OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure;
+ if (aStructure == NULL)
+ return;
+ aStructure->RemoveGroup ((const OpenGl_Group* )theCGroup.ptrGroup);
+ InvalidateAllWorkspaces();
}
-void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_textcontextgroup");
- PrintCGroup (MyCGroup, 1);
- PrintInteger ("NoInsert", NoInsert);
- }
- call_togl_textcontextgroup (&MyCGroup, int (NoInsert));
+void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& theCGroup,
+ const Standard_Integer theNoInsert)
+{
+ if (!theCGroup.ContextText.IsDef || theCGroup.ptrGroup == NULL)
+ return;
+ ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectText (theCGroup.ContextText, theNoInsert);
+ InvalidateAllWorkspaces();
}
+// File: OpenGl_GraphicDriver_4.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+#include <OpenGl_GraphicDriver.hxx>
-// File OpenGl_GraphicDriver_4.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
+#include <NCollection_DataMap.hxx>
+#include <OpenGl_Structure.hxx>
+#include <OpenGl_CView.hxx>
-//-Copyright MatraDatavision 1997
+void OpenGl_GraphicDriver::ClearStructure (const Graphic3d_CStructure& theCStructure)
+{
+ OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
+ if (aStructure == NULL)
+ return;
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
+ aStructure->Clear();
+ InvalidateAllWorkspaces();
+}
-//-Global data definitions
+void OpenGl_GraphicDriver::ContextStructure (const Graphic3d_CStructure& theCStructure)
+{
+ OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
+ if (aStructure == NULL)
+ return;
-//-Methods, in order
+ aStructure->SetTransformPersistence (theCStructure.TransformPersistence);
-void OpenGl_GraphicDriver::ClearStructure (const Graphic3d_CStructure& ACStructure) {
+ if (theCStructure.ContextLine.IsDef)
+ aStructure->SetAspectLine (theCStructure.ContextLine);
- Graphic3d_CStructure MyCStructure = ACStructure;
+ if (theCStructure.ContextFillArea.IsDef)
+ aStructure->SetAspectFace (theCStructure.ContextFillArea);
+ if (theCStructure.ContextMarker.IsDef)
+ aStructure->SetAspectMarker (theCStructure.ContextMarker);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_clearstructure");
- PrintCStructure (MyCStructure, 1);
- }
- call_togl_clearstructure (&MyCStructure);
+ if (theCStructure.ContextText.IsDef)
+ aStructure->SetAspectText (theCStructure.ContextText);
+ InvalidateAllWorkspaces();
}
-void OpenGl_GraphicDriver::Connect (const Graphic3d_CStructure& AFather, const Graphic3d_CStructure& ASon) {
-
- Graphic3d_CStructure MyFather = AFather;
- Graphic3d_CStructure MySon = ASon;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_connect");
- PrintString ("AFather", "");
- PrintCStructure (MyFather, 1);
- PrintString ("ASon", "");
- PrintCStructure (MySon, 1);
- }
- call_togl_connect (&MyFather, &MySon);
-
+void OpenGl_GraphicDriver::Connect (const Graphic3d_CStructure& theFather,
+ const Graphic3d_CStructure& theSon)
+{
+ OpenGl_Structure* aFather = (OpenGl_Structure* )theFather.ptrStructure;
+ OpenGl_Structure* aSon = (OpenGl_Structure* )theSon.ptrStructure;
+ if (aFather && aSon)
+ aFather->Connect(aSon);
}
-void OpenGl_GraphicDriver::ContextStructure (const Graphic3d_CStructure& ACStructure) {
-
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_contextstructure");
- PrintCStructure (MyCStructure, 1);
- PrintCStructure (MyCStructure, 2);
- }
- call_togl_contextstructure (&MyCStructure);
-
+void OpenGl_GraphicDriver::Disconnect (const Graphic3d_CStructure& theFather,
+ const Graphic3d_CStructure& theSon)
+{
+ OpenGl_Structure* aFather = (OpenGl_Structure* )theFather.ptrStructure;
+ OpenGl_Structure* aSon = (OpenGl_Structure* )theSon.ptrStructure;
+ if (aFather && aSon)
+ aFather->Disconnect(aSon);
}
-void OpenGl_GraphicDriver::Disconnect (const Graphic3d_CStructure& AFather, const Graphic3d_CStructure& ASon) {
-
- Graphic3d_CStructure MyFather = AFather;
- Graphic3d_CStructure MySon = ASon;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_disconnect");
- PrintString ("AFather", "");
- PrintCStructure (AFather, 1);
- PrintString ("ASon", "");
- PrintCStructure (MySon, 1);
- }
- call_togl_disconnect (&MyFather, &MySon);
-
+void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView,
+ const Graphic3d_CStructure& theCStructure,
+ const Standard_Integer thePriority)
+{
+ const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
+ OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
+ if (aCView == NULL || aStructure == NULL)
+ return;
+
+ aCView->View->DisplayStructure (aStructure, thePriority);
+ aCView->WS->Invalidate();
}
-void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& ACView, const Graphic3d_CStructure& ACStructure, const Standard_Integer APriority) {
-
- Graphic3d_CView MyCView = ACView;
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_displaystructure");
- PrintCView (MyCView, 1);
- PrintCStructure (MyCStructure, 1);
- PrintInteger ("Priority", APriority);
- }
- call_togl_displaystructure (&MyCView, MyCStructure.Id, int (APriority));
+void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
+ const Graphic3d_CStructure& theCStructure)
+{
+ const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
+ OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure;
+ if (aCView == NULL || aStructure == NULL)
+ return;
+ aCView->View->EraseStructure (aStructure);
+ aCView->WS->Invalidate();
}
-void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& ACView, const Graphic3d_CStructure& ACStructure) {
-
- Graphic3d_CView MyCView = ACView;
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_erasestructure");
- PrintCView (MyCView, 1);
- PrintCStructure (MyCStructure, 1);
- }
- call_togl_erasestructure (MyCView.ViewId, MyCStructure.Id);
+void OpenGl_GraphicDriver::RemoveStructure (const Graphic3d_CStructure& theCStructure)
+{
+ if (!GetMapOfStructures().IsBound (theCStructure.Id))
+ return;
+ OpenGl_Structure* aStructure = OpenGl_GraphicDriver::GetMapOfStructures().Find (theCStructure.Id);
+ OpenGl_GraphicDriver::GetMapOfStructures().UnBind (theCStructure.Id);
+ delete aStructure;
+ InvalidateAllWorkspaces();
}
-void OpenGl_GraphicDriver::RemoveStructure (const Graphic3d_CStructure& ACStructure) {
+void OpenGl_GraphicDriver::Structure (Graphic3d_CStructure& theCStructure)
+{
+ RemoveStructure (theCStructure);
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_removestructure");
- PrintCStructure (MyCStructure, 1);
- }
- call_togl_removestructure (&MyCStructure);
-
-}
+ OpenGl_Structure* aStructure = new OpenGl_Structure();
-void OpenGl_GraphicDriver::Structure (Graphic3d_CStructure& ACStructure) {
+ aStructure->SetDegenerateModel (theCStructure.ContextFillArea.DegenerationMode,
+ theCStructure.ContextFillArea.SkipRatio);
- Graphic3d_CStructure MyCStructure = ACStructure;
- if (MyTraceLevel) {
- PrintFunction ("call_togl_structure");
- PrintCStructure (MyCStructure, 1);
- }
- call_togl_structure (&MyCStructure);
+ Standard_Integer aStatus = 0;
+ if (theCStructure.highlight) aStatus |= OPENGL_NS_HIGHLIGHT;
+ if (!theCStructure.visible) aStatus |= OPENGL_NS_HIDE;
+ if (theCStructure.pick) aStatus |= OPENGL_NS_PICK;
+ aStructure->SetNamedStatus (aStatus);
+ theCStructure.ptrStructure = aStructure;
+ OpenGl_GraphicDriver::GetMapOfStructures().Bind (theCStructure.Id, aStructure);
+ InvalidateAllWorkspaces();
}
+// File: OpenGl_GraphicDriver_5.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+#include <OpenGl_GraphicDriver.hxx>
-// File OpenGl_GraphicDriver_5.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void OpenGl_GraphicDriver::DumpGroup (const Graphic3d_CGroup& ACGroup) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_structure_exploration");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_structure_exploration
- (long (MyCGroup.Struct->Id), long (MyCGroup.LabelBegin), long (MyCGroup.LabelEnd));
-
+void OpenGl_GraphicDriver::DumpGroup (const Graphic3d_CGroup& ACGroup)
+{
+ // Do nothing
}
-void OpenGl_GraphicDriver::DumpStructure (const Graphic3d_CStructure& ACStructure) {
-
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_structure_exploration");
- PrintCStructure (MyCStructure, 1);
- }
- call_togl_structure_exploration (long (MyCStructure.Id), 0, 0);
-
+void OpenGl_GraphicDriver::DumpStructure (const Graphic3d_CStructure& ACStructure)
+{
+ // Do nothing
}
-void OpenGl_GraphicDriver::DumpView (const Graphic3d_CView& ACView) {
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_view_exploration");
- PrintCView (MyCView, 1);
- }
- call_togl_view_exploration (long (MyCView.ViewId));
-
+void OpenGl_GraphicDriver::DumpView (const Graphic3d_CView& ACView)
+{
+ // Do nothing
}
-Standard_Boolean OpenGl_GraphicDriver::ElementExploration (const Graphic3d_CStructure & ACStructure, const Standard_Integer ElementNumber, Graphic3d_VertexNC& AVertex, Graphic3d_Vector& AVector) {
-
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- Quantity_Color AColor;
- long AType;
-
- CALL_DEF_POINT Pt;
- CALL_DEF_NORMAL Npt, Nfa;
- CALL_DEF_COLOR Cpt;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_element_exploration");
- PrintCStructure (MyCStructure, 1);
- }
- call_togl_element_exploration (MyCStructure.Id, ElementNumber, &AType, &Pt, &Npt, &Cpt, &Nfa);
-
- if (! AType) return (Standard_False);
- else {
- AVertex.SetCoord
- (double (Pt.x), double (Pt.y), double (Pt.z));
- AVertex.SetNormal
- (double (Npt.dx), double (Npt.dy), double (Npt.dz));
- AColor.SetValues
- (double (Cpt.r), double (Cpt.g),
- double (Cpt.b), Quantity_TOC_RGB);
- AVertex.SetColor (AColor);
- AVector.SetCoord
- (double (Nfa.dx), double (Nfa.dy), double (Nfa.dz));
- return (Standard_True);
- }
+Standard_Boolean OpenGl_GraphicDriver::ElementExploration (const Graphic3d_CStructure & ACStructure, const Standard_Integer ElementNumber, Graphic3d_VertexNC& AVertex, Graphic3d_Vector& AVector)
+{
+ // Do nothing
+ return (Standard_False);
}
-Graphic3d_TypeOfPrimitive OpenGl_GraphicDriver::ElementType (const Graphic3d_CStructure & ACStructure, const Standard_Integer ElementNumber) {
-
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- long AType;
- Graphic3d_TypeOfPrimitive top;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_element_type");
- PrintCStructure (MyCStructure, 1);
- }
- call_togl_element_type (MyCStructure.Id, ElementNumber, &AType);
-
- switch (AType) {
-
- case 0:
- top = Graphic3d_TOP_UNDEFINED;
- break;
- case 1:
- top = Graphic3d_TOP_POLYLINE;
- break;
- case 2:
- top = Graphic3d_TOP_POLYGON;
- break;
- case 3:
- top = Graphic3d_TOP_TRIANGLEMESH;
- break;
- case 4:
- top = Graphic3d_TOP_QUADRANGLEMESH;
- break;
- case 5:
- top = Graphic3d_TOP_TEXT;
- break;
- case 6:
- top = Graphic3d_TOP_MARKER;
- break;
- default:
- top = Graphic3d_TOP_UNDEFINED;
- break;
-
- }
-
- return (top);
+Graphic3d_TypeOfPrimitive OpenGl_GraphicDriver::ElementType (const Graphic3d_CStructure & ACStructure, const Standard_Integer ElementNumber)
+{
+ // Do nothing
+ return Graphic3d_TOP_UNDEFINED;
}
-// File OpenGl_GraphicDriver_6.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
+// File: OpenGl_GraphicDriver_6.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void OpenGl_GraphicDriver::InitPick () {
-
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_init_pick");
- }
- call_togl_init_pick ();
+#include <OpenGl_GraphicDriver.hxx>
+void OpenGl_GraphicDriver::InitPick ()
+{
+ // Do nothing
}
-void OpenGl_GraphicDriver::Pick (Graphic3d_CPick& ACPick) {
-
- Graphic3d_CPick MyCPick = ACPick;
-
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_pick");
- PrintCPick (MyCPick, 1);
- }
- call_togl_pick (&ACPick);
-
+void OpenGl_GraphicDriver::Pick (Graphic3d_CPick& ACPick)
+{
+ // Do nothing
}
-void OpenGl_GraphicDriver::PickId (const Graphic3d_CGroup& ACGroup) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_pickid");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_pickid (&MyCGroup);
-
+void OpenGl_GraphicDriver::PickId (const Graphic3d_CGroup& ACGroup)
+{
+ // Do nothing
}
+// File: OpenGl_GraphicDriver_7.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-// File OpenGl_GraphicDriver_7.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// Modified GG 10/11/99 PRO19603 Change the Redraw method (add redraw area capabillity)
-// EUG 07/10/99 G003 Add DegenerateStructure() and
-// SetBackFacingModel() methods.
+#include <OpenGl_GraphicDriver.hxx>
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-#include <InterfaceGraphic_RawBufferData.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_txgl.hxx>
#include <OpenGl_FrameBuffer.hxx>
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void OpenGl_GraphicDriver::ActivateView (const Graphic3d_CView& ACView) {
+#include <OpenGl_Structure.hxx>
+#include <OpenGl_CView.hxx>
+#include <OpenGl_Display.hxx>
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_activateview");
- PrintCView (MyCView, 1);
- }
- call_togl_activateview (&MyCView);
+/*----------------------------------------------------------------------*/
+void OpenGl_GraphicDriver::ActivateView (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->WS->SetActiveView(aCView->View);
}
-void OpenGl_GraphicDriver::AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) {
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_antialiasing");
- PrintCView (MyCView, 1);
- PrintBoolean ("AFlag", AFlag);
- }
- call_togl_antialiasing (&MyCView, (AFlag ? 1 : 0));
-
+void OpenGl_GraphicDriver::AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->View->SetAntiAliasing(AFlag);
}
-void OpenGl_GraphicDriver::Background (const Graphic3d_CView& ACView) {
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_background");
- PrintCView (MyCView, 1);
+void OpenGl_GraphicDriver::Background (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->WS->SetBackgroundColor(ACView.DefWindow.Background.r,ACView.DefWindow.Background.g,ACView.DefWindow.Background.b);
+ aCView->WS->Invalidate();
}
- call_togl_background (&MyCView);
-
}
-void OpenGl_GraphicDriver::GradientBackground(const Graphic3d_CView& ACView,
+void OpenGl_GraphicDriver::GradientBackground (const Graphic3d_CView& ACView,
const Quantity_Color& AColor1,
const Quantity_Color& AColor2,
- const Aspect_GradientFillMethod AType){
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_gradient_background");
- PrintCView (MyCView, 1);
+ const Aspect_GradientFillMethod AType)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->SetBackgroundGradient(AColor1,AColor2,AType);
+ aCView->WS->Invalidate();
}
- Standard_Real R1,G1,B1,R2,G2,B2;
- AColor1.Values( R1, G1, B1, Quantity_TOC_RGB );
- AColor2.Values( R2, G2, B2, Quantity_TOC_RGB );
- TEL_COLOUR tcolor1, tcolor2;
- tcolor1.rgb[0] = R1;
- tcolor1.rgb[1] = G1;
- tcolor1.rgb[2] = B1;
- tcolor1.rgb[3] = 0;
- tcolor2.rgb[0] = R2;
- tcolor2.rgb[1] = G2;
- tcolor2.rgb[2] = B2;
- tcolor2.rgb[3] = 0;
-
- call_togl_gradient_background (MyCView.WsId, AType, &tcolor1, &tcolor2);
-
}
-
-void OpenGl_GraphicDriver::Blink (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create) {
-
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_blink");
- PrintCStructure (MyCStructure, 1);
- PrintBoolean ("Create", Create);
- }
- call_togl_blink (&MyCStructure, (Create ? 1 : 0));
-
+void OpenGl_GraphicDriver::Blink (const Graphic3d_CStructure &, const Standard_Boolean)
+{
+ // Do nothing
}
-void OpenGl_GraphicDriver::BoundaryBox (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create) {
-
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_boundarybox");
- PrintCStructure (MyCStructure, 1);
- PrintBoolean ("Create", Create);
- }
- call_togl_boundarybox (&MyCStructure, (Create ? 1 : 0));
+void OpenGl_GraphicDriver::BoundaryBox (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create)
+{
+ OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
+ if (!astructure)
+ return;
+ if ( Create )
+ astructure->SetHighlightBox(ACStructure.BoundBox);
+ else
+ astructure->ClearHighlightBox();
}
-void OpenGl_GraphicDriver::HighlightColor (const Graphic3d_CStructure& ACStructure, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B, const Standard_Boolean Create) {
-
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_highlightcolor");
- PrintCStructure (MyCStructure, 1);
- PrintShortReal ("R", R);
- PrintShortReal ("G", G);
- PrintShortReal ("B", B);
- }
- CALL_DEF_COLOR acolor;
- acolor.r = R;
- acolor.g = G;
- acolor.b = B;
- call_togl_highlightcolor (&MyCStructure, &acolor, (Create ? 1 : 0));
+void OpenGl_GraphicDriver::HighlightColor (const Graphic3d_CStructure& ACStructure, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B, const Standard_Boolean Create)
+{
+ OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
+ if (!astructure)
+ return;
+ if ( Create )
+ astructure->SetHighlightColor(R,G,B);
+ else
+ astructure->ClearHighlightColor();
}
-void OpenGl_GraphicDriver::NameSetStructure (const Graphic3d_CStructure& ACStructure) {
-
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_namesetstructure");
- PrintCStructure (MyCStructure, 1);
+void OpenGl_GraphicDriver::NameSetStructure (const Graphic3d_CStructure& ACStructure)
+{
+ OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
+ if (astructure)
+ {
+ Standard_Integer aStatus = 0;
+ if (ACStructure.highlight) aStatus |= OPENGL_NS_HIGHLIGHT;
+ if (!ACStructure.visible) aStatus |= OPENGL_NS_HIDE;
+ if (ACStructure.pick) aStatus |= OPENGL_NS_PICK;
+ astructure->SetNamedStatus( aStatus );
}
- call_togl_namesetstructure (&MyCStructure);
-
}
-void OpenGl_GraphicDriver::ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait) {
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_cliplimit");
- PrintCView (MyCView, 1);
- PrintBoolean ("AWait", AWait);
+void OpenGl_GraphicDriver::ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->SetClipLimit(ACView);
+ if (!AWait && !ACView.DefBitmap.bitmap)
+ {
+ aCView->WS->Resize(ACView.DefWindow);
+ aCView->WS->Invalidate();
+ }
}
- call_togl_cliplimit (&MyCView, (AWait ? 1 : 0));
-
}
-void OpenGl_GraphicDriver::DeactivateView (const Graphic3d_CView& ACView) {
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_deactivateview");
- PrintCView (MyCView, 1);
+void OpenGl_GraphicDriver::DeactivateView (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ const Handle(OpenGl_View) aDummyView;
+ aCView->WS->SetActiveView(aDummyView);
}
- call_togl_deactivateview (&MyCView);
-
}
-void OpenGl_GraphicDriver::DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) {
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_depthcueing");
- PrintCView (MyCView, 1);
- PrintBoolean ("AFlag", AFlag);
- }
- call_togl_depthcueing (&MyCView, (AFlag ? 1 : 0));
-
+void OpenGl_GraphicDriver::DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->View->SetFog(ACView, AFlag);
}
-Standard_Boolean OpenGl_GraphicDriver::ProjectRaster (const Graphic3d_CView& ACView, const Standard_ShortReal AX, const Standard_ShortReal AY, const Standard_ShortReal AZ, Standard_Integer& AU, Standard_Integer& AV) {
-
- Graphic3d_CView MyCView = ACView;
+Standard_Boolean OpenGl_GraphicDriver::ProjectRaster (const Graphic3d_CView& ACView, const Standard_ShortReal AX, const Standard_ShortReal AY, const Standard_ShortReal AZ, Standard_Integer& AU, Standard_Integer& AV)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (!aCView)
+ return Standard_False;
- Standard_Integer Result;
+ Standard_Integer aWidth = aCView->WS->Width();
+ Standard_Integer aHeight = aCView->WS->Height();
- if (MyTraceLevel) {
- PrintFunction ("call_togl_project_raster");
- PrintCView (MyCView, 1);
- }
//if we want project something before to dump it into pixmap
- if ( ACView.DefBitmap.bitmap ) {
- Result = call_togl_adopt_to_rect( ACView.ViewId,
- ACView.DefBitmap.width,
- ACView.DefBitmap.height );
- if (MyTraceLevel) {
- PrintIResult ("call_togl_adopt_to_rect", Result);
- }
- if (Result)
- return Standard_False;
- }
-
- Result = call_togl_project_raster (ACView.ViewId, AX, AY, AZ, &AU, &AV);
- if (MyTraceLevel) {
- PrintIResult ("call_togl_project_raster", Result);
+ //For right copution of projection before dumping to pixmap
+ if ( ACView.DefBitmap.bitmap )
+ {
+ aWidth = ACView.DefBitmap.width;
+ aHeight = ACView.DefBitmap.height;
}
- if ( ACView.DefBitmap.bitmap ) {
- Result = call_togl_adopt_to_rect( ACView.ViewId,
- ACView.DefWindow.dx,
- ACView.DefWindow.dy );
- if (MyTraceLevel) {
- PrintIResult ("call_togl_adopt_to_rect", Result);
- }
- if (Result)
- return Standard_False;
+ Standard_ShortReal xr, yr;
+ if (aCView->View->ProjectObjectToRaster(aWidth, aHeight, AX, AY, AZ, xr, yr))
+ {
+ AU = (Standard_Integer) xr;
+ AV = aHeight - (Standard_Integer) yr;
+ return Standard_True;
}
- return (Result == 0 ? Standard_True : Standard_False);
-
+ return Standard_False;
}
-Standard_Boolean OpenGl_GraphicDriver::UnProjectRaster (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az) {
-
- Graphic3d_CView MyCView = ACView;
+Standard_Boolean OpenGl_GraphicDriver::UnProjectRaster (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (!aCView)
+ return Standard_False;
- Standard_Integer Result;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_unproject_raster");
- PrintCView (MyCView, 1);
- }
- Result = call_togl_unproject_raster
- (ACView.ViewId, Axm, Aym, AXM, AYM, AU, AV, &Ax, &Ay, &Az);
- if (MyTraceLevel) {
- PrintIResult ("call_togl_unproject_raster", Result);
- }
- return (Result == 0 ? Standard_True : Standard_False);
+ const Standard_Integer aWidth = aCView->WS->Width();
+ const Standard_Integer aHeight = aCView->WS->Height();
+ /*
+ Patched by P.Dolbey: the window pixel height decreased by one
+ in order for yr to remain within valid coordinate range [0; Ym -1]
+ where Ym means window pixel height.
+ */
+ return aCView->View->ProjectRasterToObject( aWidth, aHeight, AU, (AYM-1)-Aym-AV, Ax, Ay, Az );
}
-Standard_Boolean OpenGl_GraphicDriver::UnProjectRasterWithRay (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az, Standard_ShortReal& Dx, Standard_ShortReal& Dy, Standard_ShortReal& Dz) {
-
- Graphic3d_CView MyCView = ACView;
+Standard_Boolean OpenGl_GraphicDriver::UnProjectRasterWithRay (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az, Standard_ShortReal& Dx, Standard_ShortReal& Dy, Standard_ShortReal& Dz)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (!aCView)
+ return Standard_False;
- Standard_Integer Result;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_unproject_raster_with_ray");
- PrintCView (MyCView, 1);
- }
- Result = call_togl_unproject_raster_with_ray
- (ACView.ViewId, Axm, Aym, AXM, AYM, AU, AV, &Ax, &Ay, &Az, &Dx, &Dy, &Dz);
- if (MyTraceLevel) {
- PrintIResult ("call_togl_unproject_raster_with_ray", Result);
- }
- return (Result == 0 ? Standard_True : Standard_False);
+ const Standard_Integer aWidth = aCView->WS->Width();
+ const Standard_Integer aHeight = aCView->WS->Height();
+ return aCView->View->ProjectRasterToObjectWithRay( aWidth, aHeight, AU, AYM-Aym-AV, Ax, Ay, Az, Dx, Dy, Dz );
}
-void OpenGl_GraphicDriver::RatioWindow (const Graphic3d_CView& ACView) {
-
- Graphic3d_CView MyCView = ACView;
+void OpenGl_GraphicDriver::RatioWindow (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (!aCView)
+ if( !ACView.DefBitmap.bitmap )
+ aCView->WS->Resize(ACView.DefWindow);
+}
- if (MyTraceLevel) {
- PrintFunction ("call_togl_ratio_window");
- PrintCView (MyCView, 1);
+void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Integer x, const Standard_Integer y, const Standard_Integer width, const Standard_Integer height)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ /*if( width <= 0 || height <= 0 )
+ aCView->WS->Redraw(ACView, ACUnderLayer, ACOverLayer);
+ else
+ aCView->WS->RedrawArea(ACView, ACUnderLayer, ACOverLayer, x, y, width, height);*/
+ // Always do full redraw
+ aCView->WS->Redraw(ACView, ACUnderLayer, ACOverLayer);
}
- call_togl_ratio_window (&MyCView);
-
}
-void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Integer x, const Standard_Integer y, const Standard_Integer width, const Standard_Integer height) {
-
- Graphic3d_CView MyCView = ACView;
- Aspect_CLayer2d MyCUnderLayer = ACUnderLayer;
- Aspect_CLayer2d MyCOverLayer = ACOverLayer;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_redraw");
- PrintCView (MyCView, 1);
- }
- //PRO19603
- if( width <= 0 || height <= 0 )
- call_togl_redraw (&MyCView, &MyCUnderLayer, &MyCOverLayer);
- else {
- call_togl_redraw_area (&MyCView, &MyCUnderLayer, &MyCOverLayer,
- x, y, width, height);
- }
- //PRO19603
+Graphic3d_PtrFrameBuffer OpenGl_GraphicDriver::FBOCreate (const Graphic3d_CView& ACView, const Standard_Integer theWidth, const Standard_Integer theHeight)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ return aCView->WS->FBOCreate(theWidth, theHeight);
+ return (Graphic3d_PtrFrameBuffer)NULL;
}
-Graphic3d_PtrFrameBuffer OpenGl_GraphicDriver::FBOCreate (const Graphic3d_CView& theCView,
- const Standard_Integer theWidth,
- const Standard_Integer theHeight) {
+Graphic3d_PtrFrameBuffer OpenGl_Workspace::FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight)
+{
// activate OpenGL context
- CMN_KEY_DATA aData;
- if ((TsmGetWSAttri (theCView.WsId, WSWindow, &aData) != TSuccess) ||
- (TxglWinset (call_thedisplay, (WINDOW) aData.ldata) != TSuccess))
- {
+ if (!Activate())
return NULL;
- }
+
// create the FBO
OpenGl_FrameBuffer* aFrameBuffer = new OpenGl_FrameBuffer();
- if (!aFrameBuffer->Init (theWidth, theHeight))
+ if (!aFrameBuffer->Init (GetGlContext(), theWidth, theHeight))
{
delete aFrameBuffer;
return NULL;
return (Graphic3d_PtrFrameBuffer )aFrameBuffer;
}
-void OpenGl_GraphicDriver::FBORelease (const Graphic3d_CView& theCView,
- Graphic3d_PtrFrameBuffer& theFBOPtr)
+void OpenGl_GraphicDriver::FBORelease (const Graphic3d_CView& ACView, Graphic3d_PtrFrameBuffer& theFBOPtr)
{
if (theFBOPtr == NULL)
- {
return;
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->WS->FBORelease(theFBOPtr);
+ theFBOPtr = NULL;
}
+}
+
+void OpenGl_Workspace::FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr)
+{
// activate OpenGL context
- CMN_KEY_DATA aData;
- if ((TsmGetWSAttri (theCView.WsId, WSWindow, &aData) != TSuccess) ||
- (TxglWinset (call_thedisplay, (WINDOW) aData.ldata) != TSuccess))
- {
+ if (!Activate())
return;
- }
+
// release the object
- OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )theFBOPtr;
+ OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer*)theFBOPtr;
+ aFrameBuffer->Release (GetGlContext());
delete aFrameBuffer;
- theFBOPtr = NULL;
}
void OpenGl_GraphicDriver::FBOGetDimensions (const Graphic3d_CView& ,
#define GL_BGRA 0x80E1
#endif
-
static inline GLenum TFormatToGLEnum (const TRawBufferDataFormat theTFormat)
{
switch (theTFormat)
}
}
-Standard_Boolean OpenGl_GraphicDriver::BufferDump (const Graphic3d_CView& theCView,
- Image_CRawBufferData& theBuffer)
+Standard_Boolean OpenGl_GraphicDriver::BufferDump (const Graphic3d_CView& ACView, Image_CRawBufferData& theBuffer)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ return aCView->WS->BufferDump((OpenGl_FrameBuffer *)ACView.ptrFBO,theBuffer);
+ return Standard_False;
+}
+
+Standard_Boolean OpenGl_Workspace::BufferDump (OpenGl_FrameBuffer *theFBOPtr, Image_CRawBufferData& theBuffer)
{
GLenum aFormat = TFormatToGLEnum (theBuffer.format);
GLenum aType = TTypeToGLEnum (theBuffer.type);
}
// activate OpenGL context
- CMN_KEY_DATA aData;
- if ((TsmGetWSAttri (theCView.WsId, WSWindow, &aData) != TSuccess) ||
- (TxglWinset (call_thedisplay, (WINDOW) aData.ldata) != TSuccess))
- {
+ if (!Activate())
return Standard_False;
- }
// bind FBO if used
- OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )theCView.ptrFBO;
+ OpenGl_FrameBuffer* aFrameBuffer = theFBOPtr;
GLint aReadBufferPrev = GL_BACK;
if (aFrameBuffer != NULL && aFrameBuffer->IsValid())
{
- aFrameBuffer->BindBuffer();
+ aFrameBuffer->BindBuffer (GetGlContext());
}
else
{
if (aFrameBuffer != NULL && aFrameBuffer->IsValid())
{
- aFrameBuffer->UnbindBuffer();
+ aFrameBuffer->UnbindBuffer (GetGlContext());
}
else
{
return Standard_True;
}
-void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& ACView) {
-
- Graphic3d_CView MyCView = ACView;
+void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& ACView)
+{
+ if (GetMapOfViews().IsBound (ACView.ViewId))
+ GetMapOfViews().UnBind (ACView.ViewId);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_removeview");
- PrintCView (MyCView, 1);
- }
- call_togl_removeview (&MyCView);
+ if (GetMapOfWorkspaces().IsBound (ACView.WsId))
+ GetMapOfWorkspaces().UnBind (ACView.WsId);
+ OpenGl_CView *aCView = (OpenGl_CView *)ACView.ptrView;
+ delete aCView;
+ ((Graphic3d_CView *)&ACView)->ptrView = NULL;
}
-void OpenGl_GraphicDriver::SetLight (const Graphic3d_CView& ACView) {
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_setlight");
- PrintCView (MyCView, 1);
- }
- call_togl_setlight (&MyCView);
-
+void OpenGl_GraphicDriver::SetLight (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->View->SetLights(ACView.Context);
}
-void OpenGl_GraphicDriver::SetPlane (const Graphic3d_CView& ACView) {
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_setplane");
- PrintCView (MyCView, 1);
- }
- call_togl_setplane (&MyCView);
-
+void OpenGl_GraphicDriver::SetPlane (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->View->SetClippingPlanes(ACView.Context);
}
-void OpenGl_GraphicDriver::SetVisualisation (const Graphic3d_CView& ACView) {
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_setvisualisation");
- PrintCView (MyCView, 1);
+void OpenGl_GraphicDriver::SetVisualisation (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->SetVisualisation(ACView.Context);
+ aCView->WS->UseZBuffer() = ( ACView.Context.Visualization == 0? (ACView.Context.ZBufferActivity == 1) : (ACView.Context.ZBufferActivity != 0) );
}
- call_togl_setvisualisation (&MyCView);
-
}
-void OpenGl_GraphicDriver::TransformStructure (const Graphic3d_CStructure& ACStructure) {
-
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_transformstructure");
- PrintCStructure (MyCStructure, 1);
- }
- call_togl_transformstructure (&MyCStructure);
-
+void OpenGl_GraphicDriver::TransformStructure (const Graphic3d_CStructure& ACStructure)
+{
+ OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
+ if (astructure)
+ astructure->SetTransformation(&(ACStructure.Transformation[0][0]));
}
-void OpenGl_GraphicDriver :: DegenerateStructure (
- const Graphic3d_CStructure& ACStructure
- ) {
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if ( MyTraceLevel ) {
-
- PrintFunction ( "call_togl_degeneratestructure" );
- PrintCStructure ( MyCStructure, 1 );
-
- } // end if
-
- call_togl_degeneratestructure ( &MyCStructure );
- } // end OpenGl_GraphicDriver :: DegenerateStructure
-
- void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) {
-
- Graphic3d_CView MyCView = ACView;
+void OpenGl_GraphicDriver::DegenerateStructure (const Graphic3d_CStructure& ACStructure)
+{
+ OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
+ if (astructure)
+ astructure->SetDegenerateModel( ACStructure.ContextFillArea.DegenerationMode, ACStructure.ContextFillArea.SkipRatio );
+}
- if (MyTraceLevel) {
- PrintFunction ("call_togl_transparency");
- PrintCView (MyCView, 1);
- PrintBoolean ("AFlag", AFlag);
- }
- call_togl_transparency (MyCView.WsId, MyCView.ViewId, (AFlag ? 1 : 0));
+void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->WS->UseTransparency(AFlag);
+}
- }
+void OpenGl_GraphicDriver::Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->WS->Update(ACView,ACUnderLayer,ACOverLayer);
+}
- void OpenGl_GraphicDriver::Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer) {
+Standard_Boolean OpenGl_GraphicDriver::View (Graphic3d_CView& ACView)
+{
+ if (openglDisplay.IsNull())
+ return Standard_False;
- Graphic3d_CView MyCView = ACView;
- Aspect_CLayer2d MyCUnderLayer = ACUnderLayer;
- Aspect_CLayer2d MyCOverLayer = ACOverLayer;
+ if (GetMapOfViews().IsBound (ACView.ViewId))
+ GetMapOfViews().UnBind (ACView.ViewId);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_update");
- PrintCView (MyCView, 1);
- }
- call_togl_update (&MyCView, &MyCUnderLayer, &MyCOverLayer);
+ if (GetMapOfWorkspaces().IsBound (ACView.WsId))
+ GetMapOfWorkspaces().UnBind (ACView.WsId);
+ Handle(OpenGl_Workspace) aWS = Handle(OpenGl_Workspace)::DownCast(openglDisplay->GetWindow( ACView.DefWindow.XWindow ));
+ if ( aWS.IsNull() )
+ {
+ aWS = new OpenGl_Workspace( openglDisplay, ACView.DefWindow, ACView.GContext );
+ openglDisplay->SetWindow( ACView.DefWindow.XWindow, aWS );
}
- Standard_Boolean OpenGl_GraphicDriver::View (Graphic3d_CView& ACView) {
+ GetMapOfWorkspaces().Bind (ACView.WsId, aWS);
- Graphic3d_CView MyCView = ACView;
- Standard_Integer Result;
+ Handle(OpenGl_View) aView = new OpenGl_View( ACView.Context );
+ GetMapOfViews().Bind (ACView.ViewId, aView);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_view");
- PrintCView (MyCView, 1);
- }
- Result = call_togl_view (&MyCView);
- if (MyTraceLevel) {
- PrintIResult ("call_togl_view", Result);
- }
- return (Result == 1 ? Standard_True : Standard_False);
+ OpenGl_CView *aCView = new OpenGl_CView;
+ aCView->View = aView;
+ aCView->WS = aWS;
+ ACView.ptrView = aCView;
- }
-
- void OpenGl_GraphicDriver::ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait) {
-
- Graphic3d_CView MyCView = ACView;
- Standard_Integer Result;
+ return Standard_True;
+}
- if (MyTraceLevel) {
- PrintFunction ("call_togl_viewmapping");
- PrintCView (MyCView, 1);
- PrintBoolean ("AWait", AWait);
- }
- Result = call_togl_viewmapping (&MyCView, (AWait ? 1 : 0));
- if (MyTraceLevel) {
- PrintIResult ("call_togl_viewmapping", Result);
+void OpenGl_GraphicDriver::ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->SetMapping(ACView);
+ if (!AWait && !ACView.DefBitmap.bitmap)
+ {
+ aCView->WS->Resize(ACView.DefWindow);
+ aCView->WS->Invalidate();
}
-
}
+}
- void OpenGl_GraphicDriver::ViewOrientation (const Graphic3d_CView& ACView, const Standard_Boolean AWait) {
-
- Graphic3d_CView MyCView = ACView;
- Standard_Integer Result;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_vieworientation");
- PrintCView (MyCView, 1);
- PrintBoolean ("AWait", AWait);
- }
- Result = call_togl_vieworientation (&MyCView, (AWait ? 1 : 0));
- if (MyTraceLevel) {
- PrintIResult ("call_togl_viewmapping", Result);
+void OpenGl_GraphicDriver::ViewOrientation (const Graphic3d_CView& ACView, const Standard_Boolean AWait)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->SetOrientation(ACView);
+ if (!AWait && !ACView.DefBitmap.bitmap)
+ {
+ aCView->WS->Resize(ACView.DefWindow);
+ aCView->WS->Invalidate();
}
-
}
+}
- void OpenGl_GraphicDriver :: SetBackFacingModel ( const Graphic3d_CView& aView )
- {
- Graphic3d_CView myView = aView;
-
- if ( MyTraceLevel ) {
-
- PrintFunction ( "call_togl_backfacing" );
- PrintCView ( myView, 1 );
-
- } // end if
-
- call_togl_backfacing ( &myView );
- } // end Graphic3d_GraphicDriver :: SetBackFacingModel
+void OpenGl_GraphicDriver::SetBackFacingModel (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->View->SetBackfacing(ACView.Backfacing);
+}
+// File: OpenGl_GraphicDriver_703.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-// File OpenGl_GraphicDriver_703.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
+#include <OpenGl_GraphicDriver.hxx>
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
#include <Aspect_TypeOfMarker.hxx>
+#include <OpenGl_Group.hxx>
+#include <OpenGl_MarkerSet.hxx>
+#include <Graphic3d_Array1OfVertex.hxx>
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-int GenerateMarkerBitmap( unsigned int theWidth, unsigned int theHeight, unsigned char* theArray);
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void OpenGl_GraphicDriver::Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint, const Standard_Boolean )
+static void OpenGl_CreateMarkers(const Graphic3d_CGroup& ACGroup, const Standard_Integer NbPoints, const Graphic3d_Vertex *Points)
{
+ OpenGl_MarkerSet *amarkerset = new OpenGl_MarkerSet( NbPoints, Points );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelMarkerSet, amarkerset );
+}
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- CALL_DEF_MARKER amarker;
-
- amarker.x = float (APoint.X ());
- amarker.y = float (APoint.Y ());
- amarker.z = float (APoint.Z ());
-
- Standard_Real AMR, AMG, AMB, R, G, B;
- Aspect_TypeOfMarker AMType;
- Standard_Real AMScale, AScale;
-
- // Sauvegarde des valeurs initiales
- AMR = R = Standard_Real (MyCGroup.ContextMarker.Color.r);
- AMG = G = Standard_Real (MyCGroup.ContextMarker.Color.g);
- AMB = B = Standard_Real (MyCGroup.ContextMarker.Color.b);
- AMType = Aspect_TypeOfMarker (MyCGroup.ContextMarker.MarkerType);
- AMScale = AScale = Standard_Real (MyCGroup.ContextMarker.Scale);
+void OpenGl_GraphicDriver::Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint, const Standard_Boolean )
+{
+ if (!ACGroup.ptrGroup)
+ return;
- int noinsert = 0;
- Standard_Real H, L, S;
- Standard_Real LastS;
- Standard_Real Limit=0, Delta;
+ const Aspect_TypeOfMarker AType = Aspect_TypeOfMarker (ACGroup.ContextMarker.MarkerType);
- switch (AMType)
+ switch (AType)
{
+ case Aspect_TOM_POINT :
+ case Aspect_TOM_PLUS :
+ case Aspect_TOM_STAR :
+ case Aspect_TOM_O :
+ case Aspect_TOM_X :
+ case Aspect_TOM_O_POINT :
+ case Aspect_TOM_O_PLUS :
+ case Aspect_TOM_O_STAR :
+ case Aspect_TOM_O_X :
+ case Aspect_TOM_RING1 :
+ case Aspect_TOM_RING2 :
+ case Aspect_TOM_RING3 :
+ case Aspect_TOM_USERDEFINED:
+ OpenGl_CreateMarkers(ACGroup, 1, &APoint);
+ break;
- case Aspect_TOM_POINT :
- case Aspect_TOM_PLUS :
- case Aspect_TOM_STAR :
- case Aspect_TOM_O :
- case Aspect_TOM_X :
- case Aspect_TOM_USERDEFINED:
- if (MyTraceLevel)
+ case Aspect_TOM_BALL :
{
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker (&MyCGroup, &amarker);
- break;
-
- case Aspect_TOM_O_POINT :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw the circle
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
+ const Standard_Real Delta = 0.1;
- MyCGroup.ContextMarker.IsSet = 1;
+ Standard_Real R, G, B, H, L, S, AScale;
+ R = Standard_Real (ACGroup.ContextMarker.Color.r);
+ G = Standard_Real (ACGroup.ContextMarker.Color.g);
+ B = Standard_Real (ACGroup.ContextMarker.Color.b);
+ AScale = Standard_Real (ACGroup.ContextMarker.Scale);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker (&MyCGroup, &amarker);
-
- // we draw the point
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_POINT);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker (&MyCGroup, &amarker);
- break;
-
- case Aspect_TOM_O_PLUS :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw the circle
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker (&MyCGroup, &amarker);
-
- // we draw the plus
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_PLUS);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker (&MyCGroup, &amarker);
- break;
-
- case Aspect_TOM_O_STAR :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw the circle
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker (&MyCGroup, &amarker);
-
- // we draw the star
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_STAR);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker (&MyCGroup, &amarker);
- break;
-
- case Aspect_TOM_O_X :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw the circle
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker (&MyCGroup, &amarker);
-
- // we draw the cross
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_X);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker (&MyCGroup, &amarker);
- break;
-
- case Aspect_TOM_BALL :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw a set of circles
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- Delta = 0.1;
- while (AScale >= 1.0) {
- Quantity_Color::RgbHls (R, G, B, H, L, S);
- // Modification de la saturation de 5 %
- LastS = S;
- S = S - S * 0.05;
- if (S < 0.0) S = LastS;
- Quantity_Color::HlsRgb (H, L, S, R, G, B);
- MyCGroup.ContextMarker.Color.r = float (R);
- MyCGroup.ContextMarker.Color.g = float (G);
- MyCGroup.ContextMarker.Color.b = float (B);
- MyCGroup.ContextMarker.Scale = float (AScale);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker (&MyCGroup, &amarker);
- AScale -= Delta;
- }
- break;
-
- case Aspect_TOM_RING1 :
- case Aspect_TOM_RING2 :
- case Aspect_TOM_RING3 :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw a set of circles
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- if (AMType == Aspect_TOM_RING1)
- Limit = AScale - AScale * 0.8;
- if (AMType == Aspect_TOM_RING2)
- Limit = AScale - AScale * 0.5;
- if (AMType == Aspect_TOM_RING3)
- Limit = AScale - AScale * 0.2;
- Delta = 0.1;
- while (AScale > Limit && AScale >= 1.0) {
- MyCGroup.ContextMarker.Scale = float (AScale);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker");
- PrintCGroup (MyCGroup, 1);
+ // we draw a set of circles
+ CALL_DEF_CONTEXTMARKER AContext;
+ AContext.MarkerType = int (Aspect_TOM_O);
+ while (AScale >= 1.0)
+ {
+ Quantity_Color::RgbHls (R, G, B, H, L, S);
+ // Modification de la saturation de 5 %
+ S *= 0.95;
+ Quantity_Color::HlsRgb (H, L, S, R, G, B);
+ AContext.Color.r = float (R);
+ AContext.Color.g = float (G);
+ AContext.Color.b = float (B);
+ AContext.Scale = float (AScale);
+ ((OpenGl_Group *)ACGroup.ptrGroup)->SetAspectMarker(AContext, Standard_False);
+ OpenGl_CreateMarkers(ACGroup, 1, &APoint);
+ AScale -= Delta;
}
- call_togl_marker (&MyCGroup, &amarker);
- AScale -= Delta;
+ break;
}
- break ;
- default:
- break ;
+ default:
+ break;
}
-
- // Restauration des valeurs initiales
- MyCGroup.ContextMarker.Color.r = float (AMR);
- MyCGroup.ContextMarker.Color.g = float (AMR);
- MyCGroup.ContextMarker.Color.b = float (AMR);
- MyCGroup.ContextMarker.MarkerType = int (AMType);
- MyCGroup.ContextMarker.Scale = float (AMScale);
-
}
void OpenGl_GraphicDriver::MarkerSet (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertex& ListVertex,
+ const Standard_Boolean )
{
- // const Standard_Boolean EvalMinMax) {
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- //static void (*fp2) (Graphic3d_CGroup *, CALL_DEF_LISTMARKERS *) = NULL;
-
- //if (! fp2) {
- //OSD_Function osdfp = NULL;
- //osdfp = MySharedLibrary.DlSymb ("call_togl_marker_set");
- //fp2 = (void (*)(Graphic3d_CGroup *, CALL_DEF_LISTMARKERS *)) osdfp;
- //if (! osdfp)
- //Aspect_DriverDefinitionError::Raise
- //(MySharedLibrary.DlError ());
- //}
+ if (!ACGroup.ptrGroup)
+ return;
- //static void (*fp3) (Graphic3d_CGroup *, int) = NULL;
+ const Standard_Integer nb = ListVertex.Length();
+ const Graphic3d_Vertex *arr = &ListVertex( ListVertex.Lower() );
- //if (! fp3) {
- //OSD_Function osdfp = NULL;
- //osdfp = MySharedLibrary.DlSymb ("call_togl_markercontextgroup");
- //fp3 = (void (*)(Graphic3d_CGroup *, int)) osdfp;
- //if (! osdfp)
- //Aspect_DriverDefinitionError::Raise
- //(MySharedLibrary.DlError ());
- //}
-
- Standard_Integer Lower = ListVertex.Lower ();
-
- CALL_DEF_LISTMARKERS almarkers;
-
- almarkers.NbMarkers = int (ListVertex.Length ());
- almarkers.Markers = (CALL_DEF_MARKER *) &ListVertex (Lower);
-
- Standard_Real AMR, AMG, AMB, R, G, B;
- Aspect_TypeOfMarker AMType;
- Standard_Real AMScale, AScale;
-
- // Sauvegarde des valeurs initiales
- AMR = R = Standard_Real (MyCGroup.ContextMarker.Color.r);
- AMG = G = Standard_Real (MyCGroup.ContextMarker.Color.g);
- AMB = B = Standard_Real (MyCGroup.ContextMarker.Color.b);
- AMType = Aspect_TypeOfMarker (MyCGroup.ContextMarker.MarkerType);
- AMScale = AScale = Standard_Real (MyCGroup.ContextMarker.Scale);
-
- int noinsert = 0;
- Standard_Real H, L, S;
- Standard_Real LastS;
- Standard_Real Limit=0, Delta;
-
- switch (AMType) {
+ const Aspect_TypeOfMarker AType = Aspect_TypeOfMarker (ACGroup.ContextMarker.MarkerType);
+ switch (AType)
+ {
case Aspect_TOM_POINT :
case Aspect_TOM_PLUS :
case Aspect_TOM_STAR :
case Aspect_TOM_O :
case Aspect_TOM_X :
- case Aspect_TOM_USERDEFINED:
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
- break;
-
case Aspect_TOM_O_POINT :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw the circle
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
-
- // we draw the point
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_POINT);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
- break;
-
case Aspect_TOM_O_PLUS :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw the circle
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
-
- // we draw the plus
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_PLUS);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
- break;
-
case Aspect_TOM_O_STAR :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw the circle
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
-
- // we draw the star
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_STAR);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
- break;
-
case Aspect_TOM_O_X :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw the circle
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
-
- // we draw the cross
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_X);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
+ case Aspect_TOM_RING1 :
+ case Aspect_TOM_RING2 :
+ case Aspect_TOM_RING3 :
+ case Aspect_TOM_USERDEFINED:
+ OpenGl_CreateMarkers(ACGroup, nb, arr);
break;
case Aspect_TOM_BALL :
- MyCGroup.ContextMarker.IsDef = 1;
+ {
+ const Standard_Real Delta = 0.1;
+
+ Standard_Real R, G, B, H, L, S, AScale;
+ R = Standard_Real (ACGroup.ContextMarker.Color.r);
+ G = Standard_Real (ACGroup.ContextMarker.Color.g);
+ B = Standard_Real (ACGroup.ContextMarker.Color.b);
+ AScale = Standard_Real (ACGroup.ContextMarker.Scale);
// we draw a set of circles
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- Delta = 0.1;
- while (AScale >= 1.0) {
+ CALL_DEF_CONTEXTMARKER AContext;
+ AContext.MarkerType = int (Aspect_TOM_O);
+ while (AScale >= 1.0)
+ {
Quantity_Color::RgbHls (R, G, B, H, L, S);
// Modification de la saturation de 5 %
- LastS = S;
- S = S - S * 0.05;
- if (S < 0.0) S = LastS;
+ S *= 0.95;
Quantity_Color::HlsRgb (H, L, S, R, G, B);
- MyCGroup.ContextMarker.Color.r = float (R);
- MyCGroup.ContextMarker.Color.g = float (G);
- MyCGroup.ContextMarker.Color.b = float (B);
- MyCGroup.ContextMarker.Scale = float (AScale);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
- AScale -= Delta;
- }
- break;
-
- case Aspect_TOM_RING1 :
- case Aspect_TOM_RING2 :
- case Aspect_TOM_RING3 :
- MyCGroup.ContextMarker.IsDef = 1;
-
- // we draw a set of circles
- MyCGroup.ContextMarker.MarkerType =
- int (Aspect_TOM_O);
- if (AMType == Aspect_TOM_RING1)
- Limit = AScale - AScale * 0.8;
- if (AMType == Aspect_TOM_RING2)
- Limit = AScale - AScale * 0.5;
- if (AMType == Aspect_TOM_RING3)
- Limit = AScale - AScale * 0.2;
- Delta = 0.1;
- while (AScale > Limit && AScale >= 1.0) {
- MyCGroup.ContextMarker.Scale = float (AScale);
- call_togl_markercontextgroup (&MyCGroup, noinsert);
-
- MyCGroup.ContextMarker.IsSet = 1;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_marker_set");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_marker_set (&MyCGroup, &almarkers);
- AScale -= Delta;
+ AContext.Color.r = float (R);
+ AContext.Color.g = float (G);
+ AContext.Color.b = float (B);
+ AContext.Scale = float (AScale);
+ ((OpenGl_Group *)ACGroup.ptrGroup)->SetAspectMarker(AContext, Standard_False);
+ OpenGl_CreateMarkers(ACGroup, nb, arr);
+ AScale -= Delta;
}
break;
+ }
default:
break;
}
-
- // Restauration des valeurs initiales
- MyCGroup.ContextMarker.Color.r = float (AMR);
- MyCGroup.ContextMarker.Color.g = float (AMR);
- MyCGroup.ContextMarker.Color.b = float (AMR);
- MyCGroup.ContextMarker.MarkerType = int (AMType);
- MyCGroup.ContextMarker.Scale = float (AMScale);
-
}
+// File: OpenGl_GraphicDriver_705.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-// File OpenGl_GraphicDriver_705.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// Modified
-// 27/07/97 ; PCT : ajout coordonnee texture
+#include <OpenGl_GraphicDriver.hxx>
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
+#include <OpenGl_Group.hxx>
+#include <OpenGl_Polygon.hxx>
void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Graphic3d_TypeOfPolygon AType,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertex& AListVertex,
+ const Graphic3d_TypeOfPolygon AType,
+ const Standard_Boolean )
{
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Integer i;
- Standard_Integer Lower = ListVertex.Lower ();
-
- CALL_DEF_FACET afacet;
-
- i = ListVertex.Length ();
-
- afacet.TypeFacet = int (AType);
-
- afacet.NormalIsDefined = 0;
- afacet.ColorIsDefined = 0;
-
- afacet.NbPoints = int (i);
- afacet.TypePoints = 1;
- afacet.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower);
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon");
- PrintCGroup (MyCGroup, 1);
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_Polygon *apolygon = new OpenGl_Polygon( AListVertex, AType );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolygon, apolygon );
}
- call_togl_polygon (&MyCGroup, &afacet);
-
}
-void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Graphic3d_Vector& Normal,
- const Graphic3d_TypeOfPolygon AType,
- const Standard_Boolean )
+void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ,
+ const Graphic3d_Array1OfVertex& ,
+ const Graphic3d_Vector& ,
+ const Graphic3d_TypeOfPolygon ,
+ const Standard_Boolean )
{
- Graphic3d_CGroup MyCGroup = ACGroup;
-
-
- Standard_Real X, Y, Z;
-
- Standard_Integer i;
- Standard_Integer Lower = ListVertex.Lower ();
-
- CALL_DEF_FACET afacet;
-
- i = ListVertex.Length ();
-
- afacet.TypeFacet = int (AType);
-
- afacet.NormalIsDefined = 1;
- afacet.ColorIsDefined = 0;
-
- Normal.Coord (X, Y, Z);
- afacet.Normal.dx = float (X);
- afacet.Normal.dy = float (Y);
- afacet.Normal.dz = float (Z);
-
- afacet.NbPoints = int (i);
- afacet.TypePoints = 1;
- afacet.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower);
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon (&MyCGroup, &afacet);
-
+ // Do nothing
}
-void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexN& ListVertex,
- const Graphic3d_TypeOfPolygon AType,
- const Standard_Boolean )
+void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ,
+ const Graphic3d_Array1OfVertexN& ,
+ const Graphic3d_TypeOfPolygon ,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j;
- Standard_Integer Lower = ListVertex.Lower ();
- Standard_Integer Upper = ListVertex.Upper ();
-
- CALL_DEF_FACET afacet;
- CALL_DEF_POINTN *points;
-
- i = ListVertex.Length ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINTN [i];
-
- afacet.TypeFacet = int (AType);
-
- afacet.NormalIsDefined = 0;
- afacet.ColorIsDefined = 0;
-
- afacet.NbPoints = int (i);
- afacet.TypePoints = 2;
- afacet.UPoints.PointsN = points;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon (&MyCGroup, &afacet);
-
- // Desallocation dynamique
- delete [] points;
-
+ // Do nothing
}
-void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexN& ListVertex,
- const Graphic3d_Vector& Normal,
- const Graphic3d_TypeOfPolygon AType,
- const Standard_Boolean )
+void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ,
+ const Graphic3d_Array1OfVertexN& ,
+ const Graphic3d_Vector& ,
+ const Graphic3d_TypeOfPolygon ,
+ const Standard_Boolean )
{
- Graphic3d_CGroup MyCGroup = ACGroup;
-
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j;
- Standard_Integer Lower = ListVertex.Lower ();
- Standard_Integer Upper = ListVertex.Upper ();
-
- CALL_DEF_FACET afacet;
- CALL_DEF_POINTN *points;
-
- i = ListVertex.Length ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINTN [i];
-
- afacet.TypeFacet = int (AType);
-
- afacet.NormalIsDefined = 1;
- afacet.ColorIsDefined = 0;
-
- Normal.Coord (DX, DY, DZ);
- afacet.Normal.dx = float (DX);
- afacet.Normal.dy = float (DY);
- afacet.Normal.dz = float (DZ);
-
- afacet.NbPoints = int (i);
- afacet.TypePoints = 2;
- afacet.UPoints.PointsN = points;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon (&MyCGroup, &afacet);
-
- // Desallocation dynamique
- delete [] points;
-
+ // Do nothing
}
-
-void OpenGl_GraphicDriver::Polygon(const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexNT& ListVertex,
- const Graphic3d_TypeOfPolygon AType,
- const Standard_Boolean )
+void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ,
+ const Graphic3d_Array1OfVertexNT& ,
+ const Graphic3d_TypeOfPolygon ,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
- Standard_Real TX, TY;
-
- Standard_Integer i, j;
- Standard_Integer Lower = ListVertex.Lower ();
- Standard_Integer Upper = ListVertex.Upper ();
-
- CALL_DEF_FACET afacet;
- CALL_DEF_POINTNT *points;
-
- i = ListVertex.Length ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINTNT [i];
-
- afacet.TypeFacet = int (AType);
-
- afacet.NormalIsDefined = 0;
- afacet.ColorIsDefined = 0;
-
- afacet.NbPoints = int (i);
- afacet.TypePoints = 5;
- afacet.UPoints.PointsNT = points;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- ListVertex (i).TextureCoordinate(TX, TY);
- points[j].TextureCoord.tx = float(TX);
- points[j].TextureCoord.ty = float(TY);
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon (&MyCGroup, &afacet);
-
- // Desallocation dynamique
- delete [] points;
-
+ // Do nothing
}
-
-void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ACGroup,
- const TColStd_Array1OfInteger& Bounds,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Standard_Boolean )
+void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ,
+ const TColStd_Array1OfInteger& ,
+ const Graphic3d_Array1OfVertex& ,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
-
- Standard_Integer i, ii;
- Standard_Integer j;
- Standard_Integer k, kk;
- Standard_Integer nb_points;
- Standard_Integer begin_points;
- Standard_Integer end_points;
- Standard_Integer Lower, Upper;
-
- CALL_DEF_LISTFACETS alfacets;
- CALL_DEF_FACET *facets;
- CALL_DEF_POINT *points;
-
- i = ListVertex.Length ();
- j = Bounds.Length ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINT [i];
- facets = new CALL_DEF_FACET [j];
-
- alfacets.NbFacets = int (j);
- alfacets.LFacets = facets;
-
- begin_points = ListVertex.Lower ();
- end_points = ListVertex.Upper ();
-
- Lower = Bounds.Lower ();
- Upper = Bounds.Upper ();
-
- nb_points = 0;
-
- // Parcours des facettes
- for (k=0, kk=Lower; kk<=Upper; k++, kk++) {
- facets[k].TypeFacet = 0; /* TOP_UNKNOWN */
-
- facets[k].NormalIsDefined = 0;
- facets[k].ColorIsDefined = 0;
-
- facets[k].NbPoints = int (Bounds.Value (kk));
- facets[k].TypePoints = 1;
- facets[k].UPoints.Points = (points + nb_points);
-
- // Parcours des sommets
- for (i=0, ii=begin_points;
- ((ii<=end_points) || (i==facets[k].NbPoints-1));
- i++, ii++) {
- ListVertex (ii).Coord (X, Y, Z);
- points[nb_points+i].x = float (X);
- points[nb_points+i].y = float (Y);
- points[nb_points+i].z = float (Z);
- }
- begin_points += facets[k].NbPoints;
- nb_points += facets[k].NbPoints;
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_holes");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_holes (&MyCGroup, &alfacets);
-
- // Desallocation dynamique
- delete [] points;
- delete [] facets;
-
+ // Do nothing
}
-void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ACGroup,
- const TColStd_Array1OfInteger& Bounds,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Graphic3d_Vector& Normal,
- const Standard_Boolean )
+void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ,
+ const TColStd_Array1OfInteger& ,
+ const Graphic3d_Array1OfVertex& ,
+ const Graphic3d_Vector& ,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real NX, NY, NZ;
-
- Standard_Integer i, ii;
- Standard_Integer j;
- Standard_Integer k, kk;
- Standard_Integer nb_points;
- Standard_Integer begin_points;
- Standard_Integer end_points;
- Standard_Integer Lower, Upper;
-
- CALL_DEF_LISTFACETS alfacets;
- CALL_DEF_FACET *facets;
- CALL_DEF_POINT *points;
-
- i = ListVertex.Length ();
- j = Bounds.Length ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINT [i];
- facets = new CALL_DEF_FACET [j];
-
- alfacets.NbFacets = int (j);
- alfacets.LFacets = facets;
-
- begin_points = ListVertex.Lower ();
- end_points = ListVertex.Upper ();
-
- Lower = Bounds.Lower ();
- Upper = Bounds.Upper ();
-
- nb_points = 0;
-
- Normal.Coord (NX, NY, NZ);
-
- // Parcours des facettes
- for (k=0, kk=Lower; kk<=Upper; k++, kk++) {
- facets[k].TypeFacet = 0; /* TOP_UNKNOWN */
-
- facets[k].ColorIsDefined = 0;
- facets[k].NormalIsDefined = 1;
- facets[k].Normal.dx = float (NX);
- facets[k].Normal.dy = float (NY);
- facets[k].Normal.dz = float (NZ);
-
- facets[k].NbPoints = int (Bounds.Value (kk));
- facets[k].TypePoints = 1;
- facets[k].UPoints.Points = (points + nb_points);
-
- // Parcours des sommets
- for (i=0, ii=begin_points;
- ((ii<=end_points) || (i==facets[k].NbPoints-1));
- i++, ii++) {
- ListVertex (ii).Coord (X, Y, Z);
- points[nb_points+i].x = float (X);
- points[nb_points+i].y = float (Y);
- points[nb_points+i].z = float (Z);
- }
- begin_points += facets[k].NbPoints;
- nb_points += facets[k].NbPoints;
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_holes");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_holes (&MyCGroup, &alfacets);
-
- // Desallocation dynamique
- delete [] points;
- delete [] facets;
-
+ // Do nothing
}
-void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ACGroup,
- const TColStd_Array1OfInteger& Bounds,
- const Graphic3d_Array1OfVertexN& ListVertex,
- const Standard_Boolean )
+void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ,
+ const TColStd_Array1OfInteger& ,
+ const Graphic3d_Array1OfVertexN& ,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, ii;
- Standard_Integer j;
- Standard_Integer k, kk;
- Standard_Integer nb_points;
- Standard_Integer begin_points;
- Standard_Integer end_points;
- Standard_Integer Lower, Upper;
-
- CALL_DEF_LISTFACETS alfacets;
- CALL_DEF_FACET *facets;
- CALL_DEF_POINTN *points;
-
- i = ListVertex.Length ();
- j = Bounds.Length ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINTN [i];
- facets = new CALL_DEF_FACET [j];
-
- alfacets.NbFacets = int (j);
- alfacets.LFacets = facets;
-
- begin_points = ListVertex.Lower ();
- end_points = ListVertex.Upper ();
-
- Lower = Bounds.Lower ();
- Upper = Bounds.Upper ();
-
- nb_points = 0;
-
- // Parcours des facettes
- for (k=0, kk=Lower; kk<=Upper; k++, kk++) {
- facets[k].TypeFacet = 0; /* TOP_UNKNOWN */
-
- facets[k].NormalIsDefined = 0;
- facets[k].ColorIsDefined = 0;
-
- facets[k].NbPoints = int (Bounds.Value (kk));
- facets[k].TypePoints = 2;
- facets[k].UPoints.PointsN = (points + nb_points);
-
- // Parcours des sommets
- for (i=0, ii=begin_points;
- ((ii<=end_points) || (i==facets[k].NbPoints-1));
- i++, ii++) {
- ListVertex (ii).Coord (X, Y, Z);
- points[nb_points+i].Point.x = float (X);
- points[nb_points+i].Point.y = float (Y);
- points[nb_points+i].Point.z = float (Z);
- ListVertex (ii).Normal (DX, DY, DZ);
- points[nb_points+i].Normal.dx = float (DX);
- points[nb_points+i].Normal.dy = float (DY);
- points[nb_points+i].Normal.dz = float (DZ);
- }
- begin_points += facets[k].NbPoints;
- nb_points += facets[k].NbPoints;
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_holes");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_holes (&MyCGroup, &alfacets);
-
- // Desallocation dynamique
- delete [] points;
- delete [] facets;
-
+ // Do nothing
}
-void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ACGroup,
- const TColStd_Array1OfInteger& Bounds,
- const Graphic3d_Array1OfVertexN& ListVertex,
- const Graphic3d_Vector& Normal,
- const Standard_Boolean )
+void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ,
+ const TColStd_Array1OfInteger& ,
+ const Graphic3d_Array1OfVertexN& ,
+ const Graphic3d_Vector& ,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
- Standard_Real NX, NY, NZ;
-
- Standard_Integer i, ii;
- Standard_Integer j;
- Standard_Integer k, kk;
- Standard_Integer nb_points;
- Standard_Integer begin_points;
- Standard_Integer end_points;
- Standard_Integer Lower, Upper;
-
- CALL_DEF_LISTFACETS alfacets;
- CALL_DEF_FACET *facets;
- CALL_DEF_POINTN *points;
-
- i = ListVertex.Length ();
- j = Bounds.Length ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINTN [i];
- facets = new CALL_DEF_FACET [j];
-
- alfacets.NbFacets = int (j);
- alfacets.LFacets = facets;
-
- begin_points = ListVertex.Lower ();
- end_points = ListVertex.Upper ();
-
- Lower = Bounds.Lower ();
- Upper = Bounds.Upper ();
-
- nb_points = 0;
-
- Normal.Coord (NX, NY, NZ);
-
- // Parcours des facettes
- for (k=0, kk=Lower; kk<=Upper; k++, kk++) {
- facets[k].TypeFacet = 0; /* TOP_UNKNOWN */
-
- facets[k].ColorIsDefined = 0;
- facets[k].NormalIsDefined = 1;
- facets[k].Normal.dx = float (NX);
- facets[k].Normal.dy = float (NY);
- facets[k].Normal.dz = float (NZ);
-
- facets[k].NbPoints = int (Bounds.Value (kk));
- facets[k].TypePoints = 2;
- facets[k].UPoints.PointsN = (points + nb_points);
-
- // Parcours des sommets
- for (i=0, ii=begin_points;
- ((ii<=end_points) || (i==facets[k].NbPoints-1));
- i++, ii++) {
- ListVertex (ii).Coord (X, Y, Z);
- points[nb_points+i].Point.x = float (X);
- points[nb_points+i].Point.y = float (Y);
- points[nb_points+i].Point.z = float (Z);
- ListVertex (ii).Normal (DX, DY, DZ);
- points[nb_points+i].Normal.dx = float (DX);
- points[nb_points+i].Normal.dy = float (DY);
- points[nb_points+i].Normal.dz = float (DZ);
- }
- begin_points += facets[k].NbPoints;
- nb_points += facets[k].NbPoints;
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_holes");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_holes (&MyCGroup, &alfacets);
-
- // Desallocation dynamique
- delete [] points;
- delete [] facets;
-
+ // Do nothing
}
+// File: OpenGl_GraphicDriver_707.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-// File OpenGl_GraphicDriver_707.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
+#include <OpenGl_GraphicDriver.hxx>
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
+#include <OpenGl_Group.hxx>
+#include <OpenGl_Polyline.hxx>
void OpenGl_GraphicDriver::Polyline (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertex& AListVertex,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Integer i;
- Standard_Integer Lower = ListVertex.Lower ();
-
- CALL_DEF_LISTPOINTS alpoints;
-
- i = ListVertex.Length ();
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 1;
- alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower);
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polyline");
- PrintCGroup (MyCGroup, 1);
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_Polyline *apolyline = new OpenGl_Polyline( AListVertex );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolyline, apolyline );
}
- call_togl_polyline (&MyCGroup, &alpoints);
-
}
void OpenGl_GraphicDriver::Polyline (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexC& ListVertex,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertexC& AListVertex,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
-
- Standard_Real X, Y, Z;
- Standard_Real R, G, B;
-
- Standard_Integer i, j;
- Standard_Integer Lower = ListVertex.Lower ();
- Standard_Integer Upper = ListVertex.Upper ();
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_POINTC *points;
-
- i = ListVertex.Length ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINTC [i];
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 3;
- alpoints.UPoints.PointsC= points;
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- (ListVertex (i).Color ()).Values (R, G, B, Quantity_TOC_RGB);
- points[j].Color.r = float (R);
- points[j].Color.g = float (G);
- points[j].Color.b = float (B);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polyline");
- PrintCGroup (MyCGroup, 1);
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_Polyline *apolyline = new OpenGl_Polyline( AListVertex );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolyline, apolyline );
}
- call_togl_polyline (&MyCGroup, &alpoints);
-
- // Desallocation dynamique
- delete [] points;
-
}
void OpenGl_GraphicDriver::Polyline (const Graphic3d_CGroup& ACGroup,
- const Standard_Real X1,
- const Standard_Real Y1,
- const Standard_Real Z1,
- const Standard_Real X2,
- const Standard_Real Y2,
- const Standard_Real Z2,
- const Standard_Boolean )
+ const Standard_Real X1,
+ const Standard_Real Y1,
+ const Standard_Real Z1,
+ const Standard_Real X2,
+ const Standard_Real Y2,
+ const Standard_Real Z2,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup TheGroup = ACGroup;
-
- CALL_DEF_LISTPOINTS alpoints;
-
- CALL_DEF_POINT *points;
-
- // Allocation dynamique
- points = new CALL_DEF_POINT [2];
-
- alpoints.NbPoints = 2;
- alpoints.TypePoints = 1;
- alpoints.UPoints.Points = points;
-
- points[0].x = float (X1);
- points[0].y = float (Y1);
- points[0].z = float (Z1);
- points[1].x = float (X2);
- points[1].y = float (Y2);
- points[1].z = float (Z2);
-
- call_togl_polyline (&TheGroup, &alpoints);
-
- // Desallocation dynamique
- delete [] points;
-
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_Polyline *apolyline = new OpenGl_Polyline( X1, Y1, Z1, X2, Y2, Z2 );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolyline, apolyline );
+ }
}
+// File: OpenGl_GraphicDriver_709.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-// File OpenGl_GraphicDriver_709.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-// Modified
-// 27/08/97 ; PCT : ajout coordonnee texture
+#include <OpenGl_GraphicDriver.hxx>
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
+#include <OpenGl_Group.hxx>
+#include <OpenGl_QuadrangleStrip.hxx>
void OpenGl_GraphicDriver::QuadrangleMesh (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array2OfVertex& ListVertex,
- const Standard_Boolean )
-{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
-
- Standard_Integer i, j, k;
- Standard_Integer LowerRow = ListVertex.LowerRow ();
- Standard_Integer UpperRow = ListVertex.UpperRow ();
- Standard_Integer LowerCol = ListVertex.LowerCol ();
- Standard_Integer UpperCol = ListVertex.UpperCol ();
-
- CALL_DEF_QUAD aquad;
- CALL_DEF_POINT *points;
-
- i = ListVertex.RowLength ();
- j = ListVertex.ColLength ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINT [i*j];
-
- aquad.NbPoints = int (i*j);
- aquad.TypePoints = 1;
- aquad.SizeRow = int (i);
- aquad.SizeCol = int (j);
- aquad.UPoints.Points = points;
-
- // Parcours des sommets
- k = 0;
- for (i=LowerRow; i<=UpperRow; i++)
- for (j=LowerCol; j<=UpperCol; j++) {
- ListVertex (i, j).Coord (X, Y, Z);
- points[k].x = float (X);
- points[k].y = float (Y);
- points[k].z = float (Z);
- k++;
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_quadrangle");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_quadrangle (&MyCGroup, &aquad);
-
- // Desallocation dynamique
- delete [] points;
-
-}
-
-void OpenGl_GraphicDriver::QuadrangleMesh (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array2OfVertexN& ListVertex,
- const Standard_Boolean )
-{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j, k;
- Standard_Integer LowerRow = ListVertex.LowerRow ();
- Standard_Integer UpperRow = ListVertex.UpperRow ();
- Standard_Integer LowerCol = ListVertex.LowerCol ();
- Standard_Integer UpperCol = ListVertex.UpperCol ();
-
- CALL_DEF_QUAD aquad;
- CALL_DEF_POINTN *points;
-
- i = ListVertex.RowLength ();
- j = ListVertex.ColLength ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINTN [i*j];
-
- aquad.NbPoints = int (i*j);
- aquad.TypePoints = 2;
- aquad.SizeRow = int (i);
- aquad.SizeCol = int (j);
- aquad.UPoints.PointsN = points;
-
- // Parcours des sommets
- k = 0;
- for (i=LowerRow; i<=UpperRow; i++)
- for (j=LowerCol; j<=UpperCol; j++) {
- ListVertex (i, j).Coord (X, Y, Z);
- points[k].Point.x = float (X);
- points[k].Point.y = float (Y);
- points[k].Point.z = float (Z);
- ListVertex (i, j).Normal (DX, DY, DZ);
- points[k].Normal.dx = float (DX);
- points[k].Normal.dy = float (DY);
- points[k].Normal.dz = float (DZ);
- k++;
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_quadrangle");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_quadrangle (&MyCGroup, &aquad);
-
- // Desallocation dynamique
- delete [] points;
-
-}
-
-
-void OpenGl_GraphicDriver::QuadrangleMesh(const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array2OfVertexNT& ListVertex,
+ const Graphic3d_Array2OfVertex& ListVertex,
const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j, k;
- Standard_Integer LowerRow = ListVertex.LowerRow ();
- Standard_Integer UpperRow = ListVertex.UpperRow ();
- Standard_Integer LowerCol = ListVertex.LowerCol ();
- Standard_Integer UpperCol = ListVertex.UpperCol ();
-
- CALL_DEF_QUAD aquad;
- CALL_DEF_POINTNT *points;
-
- i = ListVertex.RowLength ();
- j = ListVertex.ColLength ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINTNT [i*j];
-
- aquad.NbPoints = int (i*j);
- aquad.TypePoints = 5;
- aquad.SizeRow = int (i);
- aquad.SizeCol = int (j);
- aquad.UPoints.PointsNT = points;
-
- // Parcours des sommets
- k = 0;
- for (i=LowerRow; i<=UpperRow; i++)
- for (j=LowerCol; j<=UpperCol; j++) {
- ListVertex (i, j).Coord (X, Y, Z);
- points[k].Point.x = float (X);
- points[k].Point.y = float (Y);
- points[k].Point.z = float (Z);
- ListVertex (i, j).Normal (DX, DY, DZ);
- points[k].Normal.dx = float (DX);
- points[k].Normal.dy = float (DY);
- points[k].Normal.dz = float (DZ);
- ListVertex (i, j).TextureCoordinate(DX,DY);
- points[k].TextureCoord.tx = float(DX);
- points[k].TextureCoord.ty = float(DY);
- k++;
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_quadrangle");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_quadrangle (&MyCGroup, &aquad);
-
- // Desallocation dynamique
- delete [] points;
-
-}
-
-
-void OpenGl_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Aspect_Array1OfEdge& ListEdge,
- const Standard_Boolean )
-{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Integer i, j, k;
- Standard_Integer Lower, Upper;
- Standard_Integer OffSet;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_LISTEDGES aledges;
- CALL_DEF_EDGE *edges;
-
- // Permettra une generalisation plus facile a une methode du style
- // PolygonSet (ListVertex, ListEdge, Bounds).
- int *integers;
- CALL_DEF_LISTINTEGERS albounds;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
- k = int (j/4);
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
- OffSet = Lower;
-
- // Allocation dynamique
- edges = new CALL_DEF_EDGE [j];
- integers= new int [k];
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 1;
- alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower);
-
- aledges.NbEdges = int (j);
- aledges.Edges = edges;
-
- albounds.NbIntegers = int (k);
- albounds.Integers = integers;
-
- Lower = ListEdge.Lower ();
- Upper = ListEdge.Upper ();
-
- // Parcours des aretes
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet);
- edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet);
- edges[j].Type = int (ListEdge (i).Type ());
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_QuadrangleStrip *aqstrip = new OpenGl_QuadrangleStrip( ListVertex );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelQuadrangle, aqstrip );
}
-
- // Parcours des limites (ici toutes les limites sont egales a 4.
- for (j=0; j<albounds.NbIntegers; j++) integers[j] = 4;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_indices");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_indices (&MyCGroup, &alpoints, &aledges, &albounds);
-
- // Desallocation dynamique
- delete [] edges;
- delete [] integers;
-
}
-void OpenGl_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexN& ListVertex,
- const Aspect_Array1OfEdge& ListEdge,
- const Standard_Boolean )
-{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j, k;
- Standard_Integer Lower, Upper;
- Standard_Integer OffSet;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_POINTN *points;
- CALL_DEF_LISTEDGES aledges;
- CALL_DEF_EDGE *edges;
-
- // Permettra une generalisation plus facile a une methode du style
- // PolygonSet (ListVertex, ListEdge, Bounds).
- int *integers;
- CALL_DEF_LISTINTEGERS albounds;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
- k = int (j/4);
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
- OffSet = Lower;
-
- // Allocation dynamique
- points = new CALL_DEF_POINTN [i];
- edges = new CALL_DEF_EDGE [j];
- integers= new int [k];
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 2;
- alpoints.UPoints.PointsN= points;
-
- aledges.NbEdges = int (j);
- aledges.Edges = edges;
-
- albounds.NbIntegers = int (k);
- albounds.Integers = integers;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- }
-
- Lower = ListEdge.Lower ();
- Upper = ListEdge.Upper ();
-
- // Parcours des aretes
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet);
- edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet);
- edges[j].Type = int (ListEdge (i).Type ());
- }
-
- // Parcours des limites (ici toutes les limites sont egales a 4.
- for (j=0; j<albounds.NbIntegers; j++) integers[j] = 4;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_indices");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_indices (&MyCGroup, &alpoints, &aledges, &albounds);
-
- // Desallocation dynamique
- delete [] points;
- delete [] edges;
- delete [] integers;
-
-}
-
-void OpenGl_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexC& ListVertex,
- const Aspect_Array1OfEdge& ListEdge,
+void OpenGl_GraphicDriver::QuadrangleMesh (const Graphic3d_CGroup& ACGroup,
+ const Graphic3d_Array2OfVertexN& ListVertex,
const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real R, G, B;
-
- Standard_Integer i, j, k;
- Standard_Integer Lower, Upper;
- Standard_Integer OffSet;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_POINTC *points;
- CALL_DEF_LISTEDGES aledges;
- CALL_DEF_EDGE *edges;
-
- // Permettra une generalisation plus facile a une methode du style
- // PolygonSet (ListVertex, ListEdge, Bounds).
- int *integers;
- CALL_DEF_LISTINTEGERS albounds;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
- k = int (j/4);
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
- OffSet = Lower;
-
- // Allocation dynamique
- points = new CALL_DEF_POINTC [i];
- edges = new CALL_DEF_EDGE [j];
- integers= new int [k];
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 3;
- alpoints.UPoints.PointsC= points;
-
- aledges.NbEdges = int (j);
- aledges.Edges = edges;
-
- albounds.NbIntegers = int (k);
- albounds.Integers = integers;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- (ListVertex (i).Color ()).Values (R, G, B, Quantity_TOC_RGB);
- points[j].Color.r = float (R);
- points[j].Color.g = float (G);
- points[j].Color.b = float (B);
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_QuadrangleStrip *aqstrip = new OpenGl_QuadrangleStrip( ListVertex );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelQuadrangle, aqstrip );
}
-
- Lower = ListEdge.Lower ();
- Upper = ListEdge.Upper ();
-
- // Parcours des aretes
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet);
- edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet);
- edges[j].Type = int (ListEdge (i).Type ());
- }
-
- // Parcours des limites (ici toutes les limites sont egales a 4.
- for (j=0; j<albounds.NbIntegers; j++) integers[j] = 4;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_indices");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_indices (&MyCGroup, &alpoints, &aledges, &albounds);
-
- // Desallocation dynamique
- delete [] points;
- delete [] edges;
- delete [] integers;
-
}
-void OpenGl_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexNC& ListVertex,
- const Aspect_Array1OfEdge& ListEdge,
- const Standard_Boolean )
-{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real R, G, B;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j, k;
- Standard_Integer Lower, Upper;
- Standard_Integer OffSet;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_POINTNC *points;
- CALL_DEF_LISTEDGES aledges;
- CALL_DEF_EDGE *edges;
-
- // Permettra une generalisation plus facile a une methode du style
- // PolygonSet (ListVertex, ListEdge, Bounds).
- int *integers;
- CALL_DEF_LISTINTEGERS albounds;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
- k = int (j/4);
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
- OffSet = Lower;
-
- // Allocation dynamique
- points = new CALL_DEF_POINTNC [i];
- edges = new CALL_DEF_EDGE [j];
- integers= new int [k];
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 4;
- alpoints.UPoints.PointsNC= points;
-
- aledges.NbEdges = int (j);
- aledges.Edges = edges;
-
- albounds.NbIntegers = int (k);
- albounds.Integers = integers;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- (ListVertex (i).Color ()).Values (R, G, B, Quantity_TOC_RGB);
- points[j].Color.r = float (R);
- points[j].Color.g = float (G);
- points[j].Color.b = float (B);
- }
-
- Lower = ListEdge.Lower ();
- Upper = ListEdge.Upper ();
-
- // Parcours des aretes
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet);
- edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet);
- edges[j].Type = int (ListEdge (i).Type ());
- }
-
- // Parcours des limites (ici toutes les limites sont egales a 4.
- for (j=0; j<albounds.NbIntegers; j++) integers[j] = 4;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_indices");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_indices (&MyCGroup, &alpoints, &aledges, &albounds);
-
- // Desallocation dynamique
- delete [] points;
- delete [] edges;
- delete [] integers;
-
-}
-
-
-
-void OpenGl_GraphicDriver::QuadrangleSet(const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexNT& ListVertex,
- const Aspect_Array1OfEdge& ListEdge,
+void OpenGl_GraphicDriver::QuadrangleMesh(const Graphic3d_CGroup& ACGroup,
+ const Graphic3d_Array2OfVertexNT& ListVertex,
const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j, k;
- Standard_Integer Lower, Upper;
- Standard_Integer OffSet;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_POINTNT *points;
- CALL_DEF_LISTEDGES aledges;
- CALL_DEF_EDGE *edges;
-
- // Permettra une generalisation plus facile a une methode du style
- // PolygonSet (ListVertex, ListEdge, Bounds).
- int *integers;
- CALL_DEF_LISTINTEGERS albounds;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
- k = int (j/4);
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
- OffSet = Lower;
-
- // Allocation dynamique
- points = new CALL_DEF_POINTNT [i];
- edges = new CALL_DEF_EDGE [j];
- integers= new int [k];
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 5;
- alpoints.UPoints.PointsNT= points;
-
- aledges.NbEdges = int (j);
- aledges.Edges = edges;
-
- albounds.NbIntegers = int (k);
- albounds.Integers = integers;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- ListVertex (i).TextureCoordinate(DX,DY);
- points[j].TextureCoord.tx = float(DX);
- points[j].TextureCoord.ty = float(DY);
- }
-
- Lower = ListEdge.Lower ();
- Upper = ListEdge.Upper ();
-
- // Parcours des aretes
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet);
- edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet);
- edges[j].Type = int (ListEdge (i).Type ());
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_QuadrangleStrip *aqstrip = new OpenGl_QuadrangleStrip( ListVertex );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelQuadrangle, aqstrip );
}
-
- // Parcours des limites (ici toutes les limites sont egales a 4.
- for (j=0; j<albounds.NbIntegers; j++) integers[j] = 4;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_indices");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_indices (&MyCGroup, &alpoints, &aledges, &albounds);
-
- // Desallocation dynamique
- delete [] points;
- delete [] edges;
- delete [] integers;
-
}
+// File: OpenGl_GraphicDriver_710.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-#define NOVIRTUAL
+#include <OpenGl_GraphicDriver.hxx>
-// File OpenGl_GraphicDriver_710.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
#include <TCollection_AsciiString.hxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
+#include <OpenGl_Group.hxx>
+#include <OpenGl_Text.hxx>
void OpenGl_GraphicDriver::Text
(
const Standard_Boolean
)
{
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- CALL_DEF_TEXT atext;
-
- Standard_Real X, Y, Z;
- APoint.Coord (X, Y, Z);
- atext.Position.x = float (X);
- atext.Position.y = float (Y);
- atext.Position.z = float (Z);
- atext.Height = float (AHeight);
- if (atext.Height < 0)
- atext.Height = DefaultTextHeight();
- atext.Angle = float (AAngle);
- atext.Path = int (ATp);
- atext.HAlign = int (AHta);
- atext.VAlign = int (AVta);
- atext.string = (unsigned short *)AText.ToExtString ();
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_text");
- PrintCGroup (MyCGroup, 1);
+ if (ACGroup.ptrGroup)
+ {
+ Standard_Real theHeight = AHeight;
+ if (theHeight < 0.)
+ theHeight = DefaultTextHeight();
+
+ OpenGl_Text *atext = new OpenGl_Text( AText, APoint, theHeight, AHta, AVta );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelText, atext );
}
- call_togl_text (&MyCGroup, &atext);
}
void OpenGl_GraphicDriver::Text
const Standard_Boolean
)
{
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- CALL_DEF_TEXT atext;
-
- Standard_Real X, Y, Z;
- APoint.Coord (X, Y, Z);
- atext.Position.x = float (X);
- atext.Position.y = float (Y);
- atext.Position.z = float (Z);
- atext.Height = float (AHeight);
- if (atext.Height < 0)
- atext.Height = DefaultTextHeight();
- atext.Angle = float (M_PI / 2.);
- atext.Path = int (Graphic3d_TP_RIGHT);
- atext.HAlign = int (Graphic3d_HTA_LEFT);
- atext.VAlign = int (Graphic3d_VTA_BOTTOM);
- atext.string = (unsigned short *)AText.ToExtString ();
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_text");
- PrintCGroup (MyCGroup, 1);
+ if (ACGroup.ptrGroup)
+ {
+ Standard_Real theHeight = AHeight;
+ if (theHeight < 0.)
+ theHeight = DefaultTextHeight();
+
+ OpenGl_Text *atext = new OpenGl_Text( AText, APoint, theHeight, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelText, atext );
}
- call_togl_text (&MyCGroup, &atext);
}
-// File OpenGl_GraphicDriver_711.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-//
-// Modified
-// 27/08/97 ; PCT : ajout coordonne texture
+// File: OpenGl_GraphicDriver_711.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-//-Copyright MatraDatavision 1997
+#include <OpenGl_GraphicDriver.hxx>
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-#include <Aspect_DriverDefinitionError.hxx>
-
-
-#include <OSD_Timer.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
+#include <OpenGl_Group.hxx>
+#include <OpenGl_TriangleStrip.hxx>
+#include <OpenGl_Mesh.hxx>
void OpenGl_GraphicDriver::TriangleMesh (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertex& ListVertex,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Integer Lower = ListVertex.Lower ();
-
- CALL_DEF_TRIKE atrike;
-
- atrike.NbPoints = int (ListVertex.Length ());
- atrike.TypePoints = 1;
- atrike.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower);
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_triangle");
- PrintCGroup (MyCGroup, 1);
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_TriangleStrip *atstrip = new OpenGl_TriangleStrip( ListVertex );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelTriangleMesh, atstrip );
}
- call_togl_triangle (&MyCGroup, &atrike);
-
}
void OpenGl_GraphicDriver::TriangleMesh (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexN& ListVertex,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertexN& ListVertex,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j;
- Standard_Integer Lower = ListVertex.Lower ();
- Standard_Integer Upper = ListVertex.Upper ();
-
- CALL_DEF_TRIKE atrike;
- CALL_DEF_POINTN *points;
-
- i = ListVertex.Length ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINTN [i];
-
- atrike.NbPoints = int (i);
- atrike.TypePoints = 2;
- atrike.UPoints.PointsN = points;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_triangle");
- PrintCGroup (MyCGroup, 1);
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_TriangleStrip *atstrip = new OpenGl_TriangleStrip( ListVertex );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelTriangleMesh, atstrip );
}
- call_togl_triangle (&MyCGroup, &atrike);
-
- // Desallocation dynamique
- delete [] points;
-
}
-
void OpenGl_GraphicDriver::TriangleMesh(const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexNT& ListVertex,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertexNT& ListVertex,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j;
- Standard_Integer Lower = ListVertex.Lower ();
- Standard_Integer Upper = ListVertex.Upper ();
-
- CALL_DEF_TRIKE atrike;
- CALL_DEF_POINTNT *points;
-
- i = ListVertex.Length ();
-
- // Allocation dynamique
- points = new CALL_DEF_POINTNT [i];
-
- atrike.NbPoints = int (i);
- atrike.TypePoints = 5;
- atrike.UPoints.PointsNT = points;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- ListVertex (i).TextureCoordinate(DX,DY);
- points[j].TextureCoord.tx = float(DX);
- points[j].TextureCoord.ty = float(DY);
- }
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_triangle");
- PrintCGroup (MyCGroup, 1);
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_TriangleStrip *atstrip = new OpenGl_TriangleStrip( ListVertex );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelTriangleMesh, atstrip );
}
- call_togl_triangle (&MyCGroup, &atrike);
-
- // Desallocation dynamique
- delete [] points;
-
}
void OpenGl_GraphicDriver::TriangleSet (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Aspect_Array1OfEdge& ListEdge,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertex& ListVertex,
+ const Aspect_Array1OfEdge& ListEdge,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- OSD_Timer theTimer;
- Standard_Real seconds, CPUtime;
- Standard_Integer minutes, hours;
-
- Standard_Integer i, j, k;
- Standard_Integer Lower, Upper;
- Standard_Integer OffSet;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_LISTEDGES aledges;
- CALL_DEF_EDGE *edges;
-
- // Permettra une generalisation plus facile a une methode du style
- // PolygonSet (ListVertex, ListEdge, Bounds).
- int *integers;
- CALL_DEF_LISTINTEGERS albounds;
-
- theTimer.Reset();theTimer.Start();
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
- k = int (j/3);
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
- OffSet = Lower;
-
- // Allocation dynamique
- edges = new CALL_DEF_EDGE [j];
- integers= new int [k];
-
-#ifdef a
- alpoints.NbPoints = int (i);
-#else
- alpoints.NbPoints = i;
-#endif
- alpoints.TypePoints = 1;
- alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower);
-
-#ifdef a
- aledges.NbEdges = int (j);
-#else
- aledges.NbEdges = j;
-#endif
- aledges.Edges = edges;
-
-#ifdef a
- albounds.NbIntegers = int (k);
-#else
- albounds.NbIntegers = k;
-#endif
- albounds.Integers = integers;
-
- Lower = ListEdge.Lower ();
- Upper = ListEdge.Upper ();
-
- // Parcours des aretes
- for (j=0, i=Lower; i<=Upper; i++, j++) {
-#ifdef a
- edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet);
- edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet);
- edges[j].Type = int (ListEdge (i).Type ());
-#else
- edges[j].Index1 = ListEdge (i).FirstIndex ()-OffSet;
- edges[j].Index2 = ListEdge (i).LastIndex ()-OffSet;
- edges[j].Type = ListEdge (i).Type ();
-#endif
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_Mesh *amesh = new OpenGl_Mesh (ListVertex, ListEdge);
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolygonIndices, amesh );
}
-
- // Parcours des limites (ici toutes les limites sont egales a 3.
- for (j=0; j<albounds.NbIntegers; j++) integers[j] = 3;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_indices");
- PrintCGroup (MyCGroup, 1);
- }
-
-
- theTimer.Stop();
- theTimer.Show(seconds, minutes, hours, CPUtime);
-#ifdef TRACE
- cout<<"opengl_driver general stuff in : sec: "<<seconds<< "; min: " << minutes <<endl;
-#endif
-
- theTimer.Reset();theTimer.Start();
- call_togl_polygon_indices (&MyCGroup, &alpoints, &aledges, &albounds);
- theTimer.Stop();
- theTimer.Show(seconds, minutes, hours, CPUtime);
-#ifdef TRACE
- cout<<"call_togl_polygon_indices in : sec: "<<seconds<< "; min: " << minutes <<endl;
-#endif
- // Desallocation dynamique
- delete [] edges;
- delete [] integers;
-
}
void OpenGl_GraphicDriver::TriangleSet (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexN& ListVertex,
- const Aspect_Array1OfEdge& ListEdge,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertexN& ListVertex,
+ const Aspect_Array1OfEdge& ListEdge,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j, k;
- Standard_Integer Lower, Upper;
- Standard_Integer OffSet;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_POINTN *points;
- CALL_DEF_LISTEDGES aledges;
- CALL_DEF_EDGE *edges;
-
- // Permettra une generalisation plus facile a une methode du style
- // PolygonSet (ListVertex, ListEdge, Bounds).
- int *integers;
- CALL_DEF_LISTINTEGERS albounds;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
- k = int (j/3);
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
- OffSet = Lower;
-
- // Allocation dynamique
- points = new CALL_DEF_POINTN [i];
- edges = new CALL_DEF_EDGE [j];
- integers= new int [k];
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 2;
- alpoints.UPoints.PointsN= points;
-
- aledges.NbEdges = int (j);
- aledges.Edges = edges;
-
- albounds.NbIntegers = int (k);
- albounds.Integers = integers;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- }
-
- Lower = ListEdge.Lower ();
- Upper = ListEdge.Upper ();
-
- // Parcours des aretes
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet);
- edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet);
- edges[j].Type = int (ListEdge (i).Type ());
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_Mesh *amesh = new OpenGl_Mesh (ListVertex, ListEdge);
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolygonIndices, amesh );
}
-
- // Parcours des limites (ici toutes les limites sont egales a 3.
- for (j=0; j<albounds.NbIntegers; j++) integers[j] = 3;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_indices");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_indices (&MyCGroup, &alpoints, &aledges, &albounds);
-
- // Desallocation dynamique
- delete [] points;
- delete [] edges;
- delete [] integers;
-
}
void OpenGl_GraphicDriver::TriangleSet (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexC& ListVertex,
- const Aspect_Array1OfEdge& ListEdge,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertexC& ListVertex,
+ const Aspect_Array1OfEdge& ListEdge,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real R, G, B;
-
- Standard_Integer i, j, k;
- Standard_Integer Lower, Upper;
- Standard_Integer OffSet;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_POINTC *points;
- CALL_DEF_LISTEDGES aledges;
- CALL_DEF_EDGE *edges;
-
- // Permettra une generalisation plus facile a une methode du style
- // PolygonSet (ListVertex, ListEdge, Bounds).
- int *integers;
- CALL_DEF_LISTINTEGERS albounds;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
- k = int (j/3);
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
- OffSet = Lower;
-
- // Allocation dynamique
- points = new CALL_DEF_POINTC [i];
- edges = new CALL_DEF_EDGE [j];
- integers= new int [k];
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 3;
- alpoints.UPoints.PointsC= points;
-
- aledges.NbEdges = int (j);
- aledges.Edges = edges;
-
- albounds.NbIntegers = int (k);
- albounds.Integers = integers;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- (ListVertex (i).Color ()).Values (R, G, B, Quantity_TOC_RGB);
- points[j].Color.r = float (R);
- points[j].Color.g = float (G);
- points[j].Color.b = float (B);
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_Mesh *amesh = new OpenGl_Mesh (ListVertex, ListEdge);
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolygonIndices, amesh );
}
-
- Lower = ListEdge.Lower ();
- Upper = ListEdge.Upper ();
-
- // Parcours des aretes
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet);
- edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet);
- edges[j].Type = int (ListEdge (i).Type ());
- }
-
- // Parcours des limites (ici toutes les limites sont egales a 3.
- for (j=0; j<albounds.NbIntegers; j++) integers[j] = 3;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_indices");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_indices (&MyCGroup, &alpoints, &aledges, &albounds);
-
- // Desallocation dynamique
- delete [] points;
- delete [] edges;
- delete [] integers;
-
}
void OpenGl_GraphicDriver::TriangleSet (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexNC& ListVertex,
- const Aspect_Array1OfEdge& ListEdge,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertexNC& ListVertex,
+ const Aspect_Array1OfEdge& ListEdge,
+ const Standard_Boolean )
{
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Real X, Y, Z;
- Standard_Real R, G, B;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j, k;
- Standard_Integer Lower, Upper;
- Standard_Integer OffSet;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_POINTNC *points;
- CALL_DEF_LISTEDGES aledges;
- CALL_DEF_EDGE *edges;
-
- // Permettra une generalisation plus facile a une methode du style
- // PolygonSet (ListVertex, ListEdge, Bounds).
- int *integers;
- CALL_DEF_LISTINTEGERS albounds;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
- k = int (j/3);
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
- OffSet = Lower;
-
- // Allocation dynamique
- points = new CALL_DEF_POINTNC [i];
- edges = new CALL_DEF_EDGE [j];
- integers= new int [k];
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 4;
- alpoints.UPoints.PointsNC= points;
-
- aledges.NbEdges = int (j);
- aledges.Edges = edges;
-
- albounds.NbIntegers = int (k);
- albounds.Integers = integers;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- (ListVertex (i).Color ()).Values (R, G, B, Quantity_TOC_RGB);
- points[j].Color.r = float (R);
- points[j].Color.g = float (G);
- points[j].Color.b = float (B);
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_Mesh *amesh = new OpenGl_Mesh (ListVertex, ListEdge);
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolygonIndices, amesh );
}
-
- Lower = ListEdge.Lower ();
- Upper = ListEdge.Upper ();
-
- // Parcours des aretes
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet);
- edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet);
- edges[j].Type = int (ListEdge (i).Type ());
- }
-
- // Parcours des limites (ici toutes les limites sont egales a 3.
- for (j=0; j<albounds.NbIntegers; j++) integers[j] = 3;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_indices");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_indices (&MyCGroup, &alpoints, &aledges, &albounds);
-
- // Desallocation dynamique
- delete [] points;
- delete [] edges;
- delete [] integers;
-
}
-
-
void OpenGl_GraphicDriver::TriangleSet(const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertexNT& ListVertex,
- const Aspect_Array1OfEdge& ListEdge,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertexNT& ListVertex,
+ const Aspect_Array1OfEdge& ListEdge,
+ const Standard_Boolean )
{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
- Standard_Real X, Y, Z;
- Standard_Real DX, DY, DZ;
-
- Standard_Integer i, j, k;
- Standard_Integer Lower, Upper;
- Standard_Integer OffSet;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_POINTNT *points;
- CALL_DEF_LISTEDGES aledges;
- CALL_DEF_EDGE *edges;
-
- // Permettra une generalisation plus facile a une methode du style
- // PolygonSet (ListVertex, ListEdge, Bounds).
- int *integers;
- CALL_DEF_LISTINTEGERS albounds;
-
- i = ListVertex.Length ();
- j = ListEdge.Length ();
- k = int (j/3);
-
- Lower = ListVertex.Lower ();
- Upper = ListVertex.Upper ();
- OffSet = Lower;
-
- // Allocation dynamique
- points = new CALL_DEF_POINTNT [i];
- edges = new CALL_DEF_EDGE [j];
- integers= new int [k];
-
- alpoints.NbPoints = int (i);
- alpoints.TypePoints = 5;
- alpoints.UPoints.PointsNT= points;
-
- aledges.NbEdges = int (j);
- aledges.Edges = edges;
-
- albounds.NbIntegers = int (k);
- albounds.Integers = integers;
-
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- points[j].Point.x = float (X);
- points[j].Point.y = float (Y);
- points[j].Point.z = float (Z);
- ListVertex (i).Normal (DX, DY, DZ);
- points[j].Normal.dx = float (DX);
- points[j].Normal.dy = float (DY);
- points[j].Normal.dz = float (DZ);
- ListVertex (i).TextureCoordinate(DX,DY);
- points[j].TextureCoord.tx = float(DX);
- points[j].TextureCoord.ty = float(DY);
- }
-
- Lower = ListEdge.Lower ();
- Upper = ListEdge.Upper ();
-
- // Parcours des aretes
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet);
- edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet);
- edges[j].Type = int (ListEdge (i).Type ());
+ if (ACGroup.ptrGroup)
+ {
+ OpenGl_Mesh *amesh = new OpenGl_Mesh (ListVertex, ListEdge);
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolygonIndices, amesh );
}
-
- // Parcours des limites (ici toutes les limites sont egales a 3.
- for (j=0; j<albounds.NbIntegers; j++) integers[j] = 3;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_polygon_indices");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_polygon_indices (&MyCGroup, &alpoints, &aledges, &albounds);
-
- // Desallocation dynamique
- delete [] points;
- delete [] edges;
- delete [] integers;
-
}
+++ /dev/null
-
-// File OpenGl_GraphicDriver_712.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-void OpenGl_GraphicDriver::Bezier (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Standard_Boolean )
-{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Integer Lower = ListVertex.Lower ();
-
- CALL_DEF_LISTPOINTS alpoints;
-
- alpoints.NbPoints = int (ListVertex.Length ());
- alpoints.TypePoints = 1;
- alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower);
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_bezier");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_bezier (&MyCGroup, &alpoints);
-
-}
-
-void OpenGl_GraphicDriver::Bezier (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& ListVertex,
- const TColStd_Array1OfReal& ListWeight,
- const Standard_Boolean )
-{
-
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- Standard_Integer i, j;
- Standard_Integer Lower = ListVertex.Lower ();
- Standard_Integer Upper = ListVertex.Upper ();
-
- CALL_DEF_LISTREALS alweights;
- float *weights;
- CALL_DEF_LISTPOINTS alpoints;
-
- j = ListWeight.Length ();
-
- alpoints.NbPoints = int (ListVertex.Length ());
- alpoints.TypePoints = 1;
- alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower);
-
- weights = new float [j];
- alweights.NbReals = j;
- alweights.Reals = weights;
-
- Lower = ListWeight.Lower ();
- Upper = ListWeight.Upper ();
-
- // Parcours des poids
- for (j=0, i=Lower; i<=Upper; i++, j++)
- weights[j] = float (ListWeight (i));
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_bezier_weight");
- PrintCGroup (MyCGroup, 1);
- }
- call_togl_bezier_weight (&MyCGroup, &alpoints, &alweights);
-
- // Desallocation dynamique
- delete [] weights;
-
-}
-// File OpenGl_GraphicDriver_713.cxx
-// Created 22-10-01
-// Author SAV
+// File: OpenGl_GraphicDriver_713.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-// SAV 09/07/02 merged with OpenGl_GraphicDriver_713.cxx created 16/06/2000 by ATS,SPK,GG : G005
-// implementation of PARRAY method
+#include <OpenGl_GraphicDriver.hxx>
-#include <OpenGl_GraphicDriver.jxx>
+#include <OpenGl_Callback.hxx>
+#include <OpenGl_Group.hxx>
+#include <OpenGl_PrimitiveArray.hxx>
-#include <Aspect_DriverDefinitionError.hxx>
+#include <OpenGl_CView.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_telem_util.hxx>
-
-
-#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
-from higher API */
-#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
-from higher API */
-
-
-void OpenGl_GraphicDriver::SetDepthTestEnabled( const Graphic3d_CView& view,
- const Standard_Boolean isEnabled ) const
+void OpenGl_GraphicDriver::SetDepthTestEnabled( const Graphic3d_CView& ACView, const Standard_Boolean isEnabled ) const
{
-
-#ifdef BUC61044
- Graphic3d_CView MyCView = view;
- call_togl_depthtest( &MyCView, isEnabled );
-#endif
-
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->WS->UseDepthTest() = isEnabled;
}
-Standard_Boolean OpenGl_GraphicDriver
-::IsDepthTestEnabled( const Graphic3d_CView& view ) const
+Standard_Boolean OpenGl_GraphicDriver::IsDepthTestEnabled( const Graphic3d_CView& ACView ) const
{
-#ifdef BUC61044
- Graphic3d_CView MyCView = view;
- return call_togl_isdepthtest (&MyCView) != 0;
-#endif
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ return aCView->WS->UseDepthTest();
+ return Standard_False;
}
-void OpenGl_GraphicDriver::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
+void OpenGl_GraphicDriver::ReadDepths( const Graphic3d_CView& ACView,
+ const Standard_Integer x,
+ const Standard_Integer y,
+ const Standard_Integer width,
+ const Standard_Integer height,
+ const Standard_Address buffer ) const
{
- TelReadDepths (view.WsId, x, y, width, height, (float*) buffer);
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->WS->ReadDepths(x, y, width, height, (float*) buffer);
}
-void OpenGl_GraphicDriver::SetGLLightEnabled( const Graphic3d_CView& view,
- const Standard_Boolean isEnabled ) const
+void OpenGl_GraphicDriver::SetGLLightEnabled( const Graphic3d_CView& ACView, const Standard_Boolean isEnabled ) const
{
-#ifdef BUC61045
- Graphic3d_CView MyCView = view;
- call_togl_gllight( &MyCView, isEnabled );
-#endif
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->WS->UseGLLight() = isEnabled;
}
-Standard_Boolean OpenGl_GraphicDriver
-::IsGLLightEnabled( const Graphic3d_CView& view ) const
+Standard_Boolean OpenGl_GraphicDriver::IsGLLightEnabled( const Graphic3d_CView& ACView ) const
{
-#ifdef BUC61045
- Graphic3d_CView MyCView = view;
- return call_togl_isgllight (&MyCView) != 0;
-#endif
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ return aCView->WS->UseGLLight();
+ return Standard_False;
}
-void OpenGl_GraphicDriver :: PrimitiveArray( const Graphic3d_CGroup& ACGroup,
- const Graphic3d_PrimitiveArray& parray,
- const Standard_Boolean EvalMinMax )
+void OpenGl_GraphicDriver::PrimitiveArray( const Graphic3d_CGroup& ACGroup,
+ const Graphic3d_PrimitiveArray& parray,
+ const Standard_Boolean EvalMinMax )
{
- Graphic3d_CGroup MyCGroup = ACGroup;
-
- if( parray ) call_togl_parray (&MyCGroup,parray);
+ if ( ACGroup.ptrGroup && parray )
+ {
+ OpenGl_PrimitiveArray *aparray = new OpenGl_PrimitiveArray( (CALL_DEF_PARRAY *) parray );
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelParray, aparray );
+ }
}
//=======================================================================
// Graphic3d_Group only.
//=======================================================================
-void OpenGl_GraphicDriver::RemovePrimitiveArray (const Graphic3d_CGroup& theCGroup,
- const Graphic3d_PrimitiveArray& thePArray)
+void OpenGl_GraphicDriver::RemovePrimitiveArray (const Graphic3d_CGroup& ACGroup,
+ const Graphic3d_PrimitiveArray& thePArray)
{
- Graphic3d_CGroup MyCGroup = theCGroup;
- if (thePArray != NULL) call_togl_parray_remove (&MyCGroup, thePArray);
+ if ( ACGroup.ptrGroup && thePArray )
+ {
+ ((OpenGl_Group *)ACGroup.ptrGroup)->RemovePrimitiveArray( (CALL_DEF_PARRAY *) thePArray );
+ }
}
-void OpenGl_GraphicDriver :: UserDraw ( const Graphic3d_CGroup& ACGroup,
- const Graphic3d_CUserDraw& AUserDraw )
-{
- Graphic3d_CGroup MyCGroup = ACGroup;
- Graphic3d_CUserDraw MyUserDraw = AUserDraw;
+static OpenGl_UserDrawCallback MyUserDrawCallback = NULL;
- call_togl_userdraw (&MyCGroup,&MyUserDraw);
+OpenGl_UserDrawCallback& UserDrawCallback ()
+{
+ return MyUserDrawCallback;
}
-extern int VBOenabled;
-
-void OpenGl_GraphicDriver :: EnableVBO( const Standard_Boolean flag )
+void OpenGl_GraphicDriver::UserDraw ( const Graphic3d_CGroup& ACGroup,
+ const Graphic3d_CUserDraw& AUserDraw )
{
- VBOenabled = flag;
+ if (ACGroup.ptrGroup && MyUserDrawCallback)
+ {
+ OpenGl_Element *auserdraw = (*MyUserDrawCallback)(&AUserDraw);
+
+ if (auserdraw != 0)
+ ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelUserdraw, auserdraw );
+ }
}
-// File OpenGl_GraphicDriver_8.cxx
-// Created Mardi 28 janvier 1997
-// Author CAL
+// File: OpenGl_GraphicDriver_8.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-//-Copyright MatraDatavision 1997
+#include <OpenGl_GraphicDriver.hxx>
-//-Version
+#include <OpenGl_CView.hxx>
+#include <OpenGl_Structure.hxx>
-//-Design Declaration des variables specifiques aux Drivers
+static Handle(OpenGl_Workspace) myImmediateWS;
-//-Warning Un driver encapsule les Pex et OpenGl drivers
+/*----------------------------------------------------------------------*/
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
-
-#include <Aspect_DriverDefinitionError.hxx>
-
-
-#include <OpenGl_tgl_funcs.hxx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Methods, in order
-
-
-Standard_Boolean OpenGl_GraphicDriver::BeginAddMode (const Graphic3d_CView& ACView)
+Standard_Boolean OpenGl_GraphicDriver::BeginAddMode (const Graphic3d_CView& ACView)
{
+ if (ACView.ViewId == -1)
+ return Standard_False;
- Graphic3d_CView MyCView = ACView;
- Standard_Boolean Result;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_begin_ajout_mode");
- PrintCView (MyCView, 1);
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView && aCView->WS->BeginAddMode())
+ {
+ myImmediateWS = aCView->WS;
+ return Standard_True;
}
- Result = call_togl_begin_ajout_mode (&MyCView);
- if (MyTraceLevel) {
- PrintIResult ("call_togl_begin_ajout_mode", Result);
- }
- return Result;
+ return Standard_False;
}
-void OpenGl_GraphicDriver::EndAddMode (void)
+void OpenGl_GraphicDriver::EndAddMode (void)
{
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_end_ajout_mode");
+ if (!myImmediateWS.IsNull())
+ {
+ myImmediateWS->EndAddMode();
+ myImmediateWS.Nullify();
}
- call_togl_end_ajout_mode ();
-
}
-Standard_Boolean OpenGl_GraphicDriver::BeginImmediatMode (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Boolean DoubleBuffer, const Standard_Boolean RetainMode)
+Standard_Boolean OpenGl_GraphicDriver::BeginImmediatMode (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Boolean DoubleBuffer, const Standard_Boolean RetainMode)
{
+ if (ACView.ViewId == -1)
+ return Standard_False;
- Graphic3d_CView MyCView = ACView;
- Aspect_CLayer2d MyCUnderLayer = ACUnderLayer;
- Aspect_CLayer2d MyCOverLayer = ACOverLayer;
- Standard_Boolean Result;
-
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_begin_immediat_mode");
- PrintCView (MyCView, 1);
- PrintBoolean ("DoubleBuffer", DoubleBuffer);
- PrintBoolean ("RetainMode", RetainMode);
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView && aCView->WS->BeginImmediatMode(ACView, DoubleBuffer, RetainMode))
+ {
+ myImmediateWS = aCView->WS;
+ return Standard_True;
}
- Result = call_togl_begin_immediat_mode
- (&MyCView, &MyCUnderLayer, &MyCOverLayer,
- (DoubleBuffer ? 1 : 0), (RetainMode ? 1 : 0));
- if (MyTraceLevel) {
- PrintIResult ("call_togl_begin_immediat_mode", Result);
- }
- return Result;
+ return Standard_False;
}
-void OpenGl_GraphicDriver::BeginPolyline ()
+void OpenGl_GraphicDriver::BeginPolyline ()
{
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_begin_polyline");
- }
- call_togl_begin_polyline ();
-
+ if (!myImmediateWS.IsNull())
+ myImmediateWS->BeginPolyline();
}
-void OpenGl_GraphicDriver::ClearImmediatMode (const Graphic3d_CView& ACView,
- const Standard_Boolean aFlush)
+void OpenGl_GraphicDriver::ClearImmediatMode (const Graphic3d_CView& ACView, const Standard_Boolean aFlush)
{
-
- Graphic3d_CView MyCView = ACView;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_clear_immediat_mode");
- PrintCView (MyCView, 1);
- }
- call_togl_clear_immediat_mode (&MyCView, aFlush);
-
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ aCView->WS->ClearImmediatMode(ACView,aFlush);
}
-void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z)
+void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z)
{
-
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_draw");
- PrintShortReal ("X", X);
- PrintShortReal ("Y", Y);
- PrintShortReal ("Z", Z);
- }
- call_togl_draw (X, Y, Z);
-
+ if (!myImmediateWS.IsNull())
+ myImmediateWS->Draw(X,Y,Z);
}
-void OpenGl_GraphicDriver::DrawStructure (const Graphic3d_CStructure& ACStructure) {
-
- Graphic3d_CStructure MyCStructure = ACStructure;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_draw_structure");
- PrintCStructure (MyCStructure, 1);
- }
- call_togl_draw_structure (ACStructure.Id);
+void OpenGl_GraphicDriver::DrawStructure (const Graphic3d_CStructure& ACStructure)
+{
+ OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure;
+ if (!astructure)
+ return;
+ if (!myImmediateWS.IsNull())
+ myImmediateWS->DrawStructure(astructure);
}
-void OpenGl_GraphicDriver::EndImmediatMode (const Standard_Integer Synchronize)
+void OpenGl_GraphicDriver::EndImmediatMode (const Standard_Integer Synchronize)
{
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_end_immediat_mode");
- PrintInteger ("Synchronize", Synchronize);
+ if (!myImmediateWS.IsNull())
+ {
+ myImmediateWS->EndImmediatMode();
+ myImmediateWS.Nullify();
}
- call_togl_end_immediat_mode (int (Synchronize));
-
}
-void OpenGl_GraphicDriver::EndPolyline ()
+void OpenGl_GraphicDriver::EndPolyline ()
{
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_end_polyline");
- }
- call_togl_end_polyline ();
-
+ if (!myImmediateWS.IsNull())
+ myImmediateWS->EndPolyline();
}
-void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z)
+void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z)
{
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_move");
- PrintShortReal ("X", X);
- PrintShortReal ("Y", Y);
- PrintShortReal ("Z", Z);
- }
- call_togl_move (X, Y, Z);
-
+ if (!myImmediateWS.IsNull())
+ myImmediateWS->Move(X,Y,Z);
}
-void OpenGl_GraphicDriver::SetLineColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B)
+void OpenGl_GraphicDriver::SetLineColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B)
{
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_set_linecolor");
- PrintShortReal ("R", R);
- PrintShortReal ("G", G);
- PrintShortReal ("B", B);
- }
- call_togl_set_linecolor (R, G, B);
-
+ if (!myImmediateWS.IsNull())
+ myImmediateWS->SetLineColor(R,G,B);
}
-void OpenGl_GraphicDriver::SetLineType (const Standard_Integer Type)
+void OpenGl_GraphicDriver::SetLineType (const Standard_Integer Type)
{
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_set_linetype");
- PrintInteger ("Type", Type);
- }
- call_togl_set_linetype (long (Type));
-
+ if (!myImmediateWS.IsNull())
+ myImmediateWS->SetLineType(Type);
}
void OpenGl_GraphicDriver::SetLineWidth (const Standard_ShortReal Width)
{
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_set_linewidth");
- PrintShortReal ("Width", Width);
- }
- call_togl_set_linewidth (float (Width));
-
+ if (!myImmediateWS.IsNull())
+ myImmediateWS->SetLineWidth(Width);
}
void OpenGl_GraphicDriver::SetMinMax (const Standard_ShortReal X1, const Standard_ShortReal Y1, const Standard_ShortReal Z1, const Standard_ShortReal X2, const Standard_ShortReal Y2, const Standard_ShortReal Z2)
{
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_set_minmax");
- PrintShortReal ("X1", X1);
- PrintShortReal ("Y1", Y1);
- PrintShortReal ("Z1", Z1);
- PrintShortReal ("X2", X2);
- PrintShortReal ("Y2", Y2);
- PrintShortReal ("Z2", Z2);
- }
- call_togl_set_minmax (X1, Y1, Z1, X2, Y2, Z2);
-
+ if (!myImmediateWS.IsNull())
+ myImmediateWS->SetMinMax(X1,Y1,Z1,X2,Y2,Z2);
}
void OpenGl_GraphicDriver::Transform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType)
{
-
- float theMatrix[4][4];
- Standard_Integer i, j;
- Standard_Integer lr, lc;
-
- lr = AMatrix.LowerRow ();
- lc = AMatrix.LowerCol ();
-
- for (i=0; i<=3; i++)
- for (j=0; j<=3; j++)
- theMatrix[i][j] = float (AMatrix (i+lr, j+lc));
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_transform");
- PrintMatrix ("AMatrix", AMatrix);
- }
- call_togl_transform (theMatrix, (AType == Graphic3d_TOC_REPLACE) ? 1 : 0);
-
+ if (!myImmediateWS.IsNull())
+ myImmediateWS->Transform(AMatrix,AType);
}
-// File OpenGl_GraphicDriver_9.cxx
-// Created 1/08/97
-// Author PCT
-// Modified
-// 16-09-98 ; BGN : Points d'entree du Triedre (S3819, Phase 1)
-// 22-09-98 ; BGN : S3989 (anciennement S3819)
-// TypeOfTriedron* from Aspect (pas Graphic3d)
-
-//-Copyright MatraDatavision 1997
-
-//-Version
-
-//-Design Declaration des variables specifiques aux Drivers
-
-//-Warning Un driver encapsule les Pex et OpenGl drivers
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
+// File: OpenGl_GraphicDriver_9.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_GraphicDriver.hxx>
+#include <OpenGl_CView.hxx>
+#include <OpenGl_Trihedron.hxx>
+#include <OpenGl_GraduatedTrihedron.hxx>
+#include <OpenGl_TextureBox.hxx>
+#include <OpenGl_tgl_funcs.hxx>
-// for the class
+#include <Quantity_NameOfColor.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <AlienImage_AlienImage.hxx>
+#include <Image_Image.hxx>
-#define IMP131100 //GG_Enable to creates more than one texture
-// with the same name.
+void OpenGl_GraphicDriver::Environment(const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->SetTextureEnv(ACView.Context.TexEnvId);
+ aCView->View->SetSurfaceDetail((Visual3d_TypeOfSurfaceDetail)ACView.Context.SurfaceDetail);
+ }
+}
-#define OCC1188 //SAV added methods to set background image
+//
+// Triedron methods : the Triedron is a non-zoomable object.
+//
-#include <OpenGl_GraphicDriver.jxx>
+void OpenGl_GraphicDriver::ZBufferTriedronSetup (
+ const Quantity_NameOfColor XColor,
+ const Quantity_NameOfColor YColor,
+ const Quantity_NameOfColor ZColor,
+ const Standard_Real SizeRatio,
+ const Standard_Real AxisDiametr,
+ const Standard_Integer NbFacettes)
+{
+ OpenGl_Trihedron::Setup(XColor,YColor,ZColor,SizeRatio,AxisDiametr,NbFacettes);
+}
-#include <Aspect_DriverDefinitionError.hxx>
-#include <Quantity_NameOfColor.hxx>
-#include <AlienImage.hxx>
-#include <Standard_Integer.hxx>
+void OpenGl_GraphicDriver::TriedronDisplay (
+ const Graphic3d_CView& ACView,
+ const Aspect_TypeOfTriedronPosition APosition,
+ const Quantity_NameOfColor AColor,
+ const Standard_Real AScale,
+ const Standard_Boolean AsWireframe )
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->TriedronDisplay(APosition, AColor, AScale, AsWireframe);
+ aCView->WS->Invalidate();
+ }
+}
-#include <OpenGl_tgl_funcs.hxx>
+void OpenGl_GraphicDriver::TriedronErase (const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->TriedronErase();
+ aCView->WS->Invalidate();
+ }
+}
-#include <stdlib.h>
-#include <stdio.h>
+void OpenGl_GraphicDriver::TriedronEcho (const Graphic3d_CView& ACView,const Aspect_TypeOfTriedronEcho AType )
+{
+ // Do nothing
+}
+void OpenGl_GraphicDriver::BackgroundImage( const Standard_CString FileName,
+ const Graphic3d_CView& ACView,
+ const Aspect_FillMethod FillStyle )
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->CreateBackgroundTexture( FileName, FillStyle );
+ aCView->WS->Invalidate();
+ }
+}
-#include <Image_Image.hxx>
+void OpenGl_GraphicDriver::SetBgImageStyle( const Graphic3d_CView& ACView,
+ const Aspect_FillMethod FillStyle )
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->SetBackgroundTextureStyle( FillStyle );
+ aCView->WS->Invalidate();
+ }
+}
+void OpenGl_GraphicDriver::SetBgGradientStyle(const Graphic3d_CView& ACView,const Aspect_GradientFillMethod FillType)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->SetBackgroundGradientType(FillType);
+ aCView->WS->Invalidate();
+ }
+}
-//-Aliases
+void OpenGl_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView& ACView, const Graphic3d_CGraduatedTrihedron& cubic)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->GraduatedTrihedronDisplay(cubic);
+ aCView->WS->Invalidate();
+ }
+}
-//-Global data definitions
+void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& ACView)
+{
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ {
+ aCView->View->GraduatedTrihedronErase();
+ aCView->WS->Invalidate();
+ }
+}
-//-Methods, in order
+void OpenGl_GraphicDriver::GraduatedTrihedronMinMaxValues(const Standard_ShortReal xmin,
+ const Standard_ShortReal ymin,
+ const Standard_ShortReal zmin,
+ const Standard_ShortReal xmax,
+ const Standard_ShortReal ymax,
+ const Standard_ShortReal zmax)
+{
+ OpenGl_GraduatedTrihedron::SetMinMax(xmin, ymin, zmin, xmax, ymax, zmax);
+}
// Helper function, returns the nearest power of two greater than the argument value
inline Standard_Integer GetNearestPow2(Standard_Integer theValue)
return aRes;
}
-Standard_Integer OpenGl_GraphicDriver::CreateTexture(const Graphic3d_TypeOfTexture Type,const Handle_AlienImage_AlienImage &Image,const Standard_CString FileName,const Handle(TColStd_HArray1OfReal)& TexUpperBounds) const
+Standard_Integer OpenGl_GraphicDriver::CreateTexture (const Graphic3d_TypeOfTexture Type,
+ const Handle_AlienImage_AlienImage &Image,
+ const Standard_CString FileName,
+ const Handle(TColStd_HArray1OfReal)& TexUpperBounds) const
{
- // transmutation de l'image en un bon tableau RGBA pour la toolkit des textures
- // lamentable d'un point de vue vitesse...
Handle(Image_Image) MyPic = Image->ToImage();
- //TODO: The temporary fix in order to make AIS_TexturedShape work. To be improved in next release.
Standard_Integer aGlWidth = (Type == Graphic3d_TOT_2D_MIPMAP) ? MyPic->Width() : GetNearestPow2(MyPic->Width());
Standard_Integer aGlHeight = (Type == Graphic3d_TOT_2D_MIPMAP) ? MyPic->Height() : GetNearestPow2(MyPic->Height());
if (MyImageData == NULL)
return -1;
-#ifdef IMP131100
-
static Standard_Integer textureRank=0;
char textureName[16];
Standard_PCharacter fileName = textureName;
sprintf(fileName,"Tex%d",++textureRank);
-#else
- Standard_CString fileName = FileName
-#endif
for (j = MyPic->Height() - 1; j >= 0; j--)
for (i = 0; i < aGlWidth; i++){
{
call_togl_modify_texture(TexId, (CALL_DEF_INIT_TEXTURE *)&AValue);
}
-
-
-
-
-void OpenGl_GraphicDriver::Environment(const Graphic3d_CView& ACView)
-{
- call_togl_environment((CALL_DEF_VIEW *)&ACView);
-}
-
-
-//
-// Triedron methods : the Triedron is a non-zoomable object.
-//
-
-void OpenGl_GraphicDriver::ZBufferTriedronSetup (
- const Quantity_NameOfColor XColor,
- const Quantity_NameOfColor YColor,
- const Quantity_NameOfColor ZColor,
- const Standard_Real SizeRatio,
- const Standard_Real AxisDiametr,
- const Standard_Integer NbFacettes)
-{
- float Xrgb[3];
- float Yrgb[3];
- float Zrgb[3];
- Standard_Real R,G,B;
- Quantity_Color(XColor).Values(R, G, B, Quantity_TOC_RGB);
- Xrgb[0] = float (R);
- Xrgb[1] = float (G);
- Xrgb[2] = float (B);
- Quantity_Color(YColor).Values(R, G, B, Quantity_TOC_RGB);
- Yrgb[0] = float (R);
- Yrgb[1] = float (G);
- Yrgb[2] = float (B);
- Quantity_Color(ZColor).Values(R, G, B, Quantity_TOC_RGB);
- Zrgb[0] = float (R);
- Zrgb[1] = float (G);
- Zrgb[2] = float (B);
-
- call_togl_ztriedron_setup(Xrgb, Yrgb, Zrgb,
- (Standard_ShortReal)(SizeRatio), (Standard_ShortReal)(AxisDiametr), NbFacettes);
-}
-
-void OpenGl_GraphicDriver::TriedronDisplay (
- const Graphic3d_CView& ACView,
- const Aspect_TypeOfTriedronPosition APosition,
- const Quantity_NameOfColor AColor,
- const Standard_Real AScale,
- const Standard_Boolean AsWireframe )
-{
- Standard_Real R,G,B;
- float r,g,b;
- Quantity_Color Color(AColor);
- Color.Values(R,G,B,Quantity_TOC_RGB);
- r = float (R);
- g = float (G);
- b = float (B);
-
- call_togl_triedron_display((CALL_DEF_VIEW *)&ACView,(int)APosition, r,g,b, (float)AScale, AsWireframe);
-}
-
-void OpenGl_GraphicDriver::TriedronErase (const Graphic3d_CView& ACView)
-{
- call_togl_triedron_erase((CALL_DEF_VIEW *)&ACView);
-}
-
-void OpenGl_GraphicDriver::TriedronEcho (const Graphic3d_CView& ACView,const Aspect_TypeOfTriedronEcho AType )
-{
- call_togl_triedron_echo( (CALL_DEF_VIEW *)&ACView,AType );
-}
-
-void OpenGl_GraphicDriver::BackgroundImage( const Standard_CString FileName,
- const Graphic3d_CView& ACView,
- const Aspect_FillMethod FillStyle )
-{
-#ifdef OCC1188
- Graphic3d_CView MyCView = ACView;
- Standard_Integer width, height;
- Handle(Image_Image) image;
-
- Standard_Boolean result = AlienImage::LoadImageFile( FileName, image, width, height );
-
- if ( result ) {
- unsigned char *data = (unsigned char*)malloc( width * height * 3 );
- unsigned char *pdata = data;
- Standard_Integer i,j;
- Quantity_Color color;
-
- if ( data != NULL ) {
- for ( j = height - 1; j >= 0; j-- )
- for ( i = 0; i < width; i++ ) {
- color = image->PixelColor( i, j );
- *pdata++ = (int)( 255 * color.Red() );
- *pdata++ = (int)( 255 * color.Green() );
- *pdata++ = (int)( 255 * color.Blue() );
- }
- call_togl_create_bg_texture( (CALL_DEF_VIEW*)&MyCView, width, height, data, (int)FillStyle );
- // delete data here
- free( data );
- }
- }
-#endif // OCC1188
-}
-
-void OpenGl_GraphicDriver::SetBgImageStyle( const Graphic3d_CView& ACView,
- const Aspect_FillMethod FillStyle )
-{
-#ifdef OCC1188
- Graphic3d_CView MyCView = ACView;
- call_togl_set_bg_texture_style( (CALL_DEF_VIEW*)&MyCView, (int)FillStyle );
-#endif //OCC1188
-}
-
-void OpenGl_GraphicDriver::SetBgGradientStyle(const Graphic3d_CView& ACView,const Aspect_GradientFillMethod FillType)
-{
- call_togl_set_gradient_type( ACView.WsId, FillType);
-}
-
-void OpenGl_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView& view,
- const Graphic3d_CGraduatedTrihedron& cubic)
-{
- call_togl_graduatedtrihedron_display((CALL_DEF_VIEW*)&view, cubic);
-}
-
-void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& view)
-{
- call_togl_graduatedtrihedron_erase((CALL_DEF_VIEW*)&view);
-}
-
-void OpenGl_GraphicDriver::GraduatedTrihedronMinMaxValues(const Standard_ShortReal xmin,
- const Standard_ShortReal ymin,
- const Standard_ShortReal zmin,
- const Standard_ShortReal xmax,
- const Standard_ShortReal ymax,
- const Standard_ShortReal zmax)
-{
- call_togl_graduatedtrihedron_minmaxvalues(xmin, ymin, zmin, xmax, ymax, zmax);
-}
\ No newline at end of file
/* Includes */
/************************************************************************/
-#include <OpenGl_GraphicDriver.jxx>
+#include <OpenGl_GraphicDriver.hxx>
#include <OSD_Localizer.hxx>
#ifdef HAVE_GL2PS
+// File: OpenGl_GraphicDriver_Layer.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-// File OpenGl_GraphicDriver_Layer.cxx
-// Created Mardi 3 novembre 1998
-// Author CAL
+#include <OpenGl_GraphicDriver.hxx>
-//-Copyright MatraDatavision 1998
+#include <OSD_FontAspect.hxx>
-//-Version
+#include <OpenGl_tgl_all.hxx>
-//-Design Declaration des variables specifiques aux Drivers
+#include <OpenGl_Display.hxx>
+#include <OpenGl_AspectText.hxx>
+#include <OpenGl_TextParam.hxx>
-//-Warning Un driver encapsule les Pex et OpenGl drivers
+/*----------------------------------------------------------------------*/
-//-References
-
-//-Language C++ 2.0
+struct OpenGl_LAYER_PROP
+{
+ int ListId;
-//-Declarations
+ TEL_COLOUR Color;
+ int NbPoints;
+ int LineType;
+ float LineWidth;
+ int FontCurrent;
-// for the class
-#include <OpenGl_GraphicDriver.jxx>
+ Standard_Boolean FontChanged;
-#include <Aspect_DriverDefinitionError.hxx>
+ OpenGl_AspectText AspectText;
+ OpenGl_TextParam TextParam;
+};
-#include <OpenGl_tgl_funcs.hxx>
+/*----------------------------------------------------------------------*/
-//-Aliases
-#define NO_DEBUG
+static const TEL_COLOUR myDefaultColor = {{ 1.F, 1.F, 1.F, 1.F }};
+static const CALL_DEF_CONTEXTTEXT myDefaultContextText =
+{
+ 1, //IsDef
+ 1, //IsSet
+ "Courier", //Font
+ 0.3F, //Space
+ 1.F, //Expan
+ { 1.F, 1.F, 1.F }, //Color
+ (int)Aspect_TOST_NORMAL, //Style
+ (int)Aspect_TODT_NORMAL, //DisplayType
+ { 1.F, 1.F, 1.F }, //ColorSubTitle
+ 0, //TextZoomable
+ 0.F, //TextAngle
+ (int)OSD_FA_Regular //TextFontAspect
+};
+
+static Standard_Boolean TheLayerIsOpen = Standard_False;
+static OpenGl_LAYER_PROP TheLayerProp;
+
+/*----------------------------------------------------------------------*/
+
+void InitLayerProp (const int AListId)
+{
+ TheLayerProp.ListId = AListId;
-//-Global data definitions
+ if (AListId)
+ {
+ TheLayerProp.Color = myDefaultColor;
+ TheLayerProp.NbPoints = 0;
+ TheLayerProp.LineType = -1;
+ TheLayerProp.LineWidth = -1.F;
+ TheLayerProp.FontCurrent = 0;
-//-Methods, in order
+ TheLayerProp.FontChanged = Standard_False;
-void OpenGl_GraphicDriver::Layer (Aspect_CLayer2d& ACLayer) {
- Aspect_CLayer2d MyCLayer = ACLayer;
+ TheLayerProp.AspectText.SetContext(myDefaultContextText);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_layer2d");
- PrintInteger ("ALayerType", int (ACLayer.layerType));
- }
- call_togl_layer2d (&MyCLayer);
- ACLayer = MyCLayer;
-#ifdef DEBUG
- cout << "OpenGl_GraphicDriver::Layer" << endl;
- call_def_ptrLayer ptrLayer;
- ptrLayer = (call_def_ptrLayer) MyCLayer.ptrLayer;
- if (ptrLayer == NULL)
- cout << "\tptrLayer == NULL" << endl;
- else
- cout << "\tptrLayer->listIndex = " << ptrLayer->listIndex << endl;
-#endif
-}
-
-void OpenGl_GraphicDriver::RemoveLayer (const Aspect_CLayer2d& ACLayer) {
- Aspect_CLayer2d MyCLayer = ACLayer;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_removelayer2d");
- PrintInteger ("ALayerType", int (ACLayer.layerType));
+ TheLayerProp.TextParam.Height = -1;
+ TheLayerProp.TextParam.HAlign = Graphic3d_HTA_LEFT;
+ TheLayerProp.TextParam.VAlign = Graphic3d_VTA_BOTTOM;
}
- call_togl_removelayer2d (&MyCLayer);
}
-void OpenGl_GraphicDriver::BeginLayer (const Aspect_CLayer2d& ACLayer) {
- Aspect_CLayer2d MyCLayer = ACLayer;
+/*----------------------------------------------------------------------*/
- if (MyTraceLevel) {
- PrintFunction ("call_togl_begin_layer2d");
- PrintInteger ("ALayerType", int (ACLayer.layerType));
- }
- call_togl_begin_layer2d (&MyCLayer);
+void OpenGl_GraphicDriver::Layer (Aspect_CLayer2d& ACLayer)
+{
+ ACLayer.ptrLayer = (call_def_ptrLayer) malloc (sizeof (CALL_DEF_PTRLAYER));
+ ACLayer.ptrLayer->listIndex = glGenLists(1);
}
-void OpenGl_GraphicDriver::BeginPolygon2d () {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_begin_polygon2d");
- }
- call_togl_begin_polygon2d ();
+/*----------------------------------------------------------------------*/
+
+void OpenGl_GraphicDriver::RemoveLayer (const Aspect_CLayer2d& ACLayer)
+{
+ if (!ACLayer.ptrLayer) return;
+ if (!ACLayer.ptrLayer->listIndex) return;
+ if (TheLayerProp.ListId == ACLayer.ptrLayer->listIndex)
+ EndLayer();
+ glDeleteLists (ACLayer.ptrLayer->listIndex, 1);
+ ACLayer.ptrLayer->listIndex = 0;
+ //szvgl: memory leak here?
+ //free ( ACLayer.ptrLayer );
+ //ACLayer.ptrLayer = NULL;
}
-void OpenGl_GraphicDriver::BeginPolyline2d () {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_begin_polyline2d");
- }
- call_togl_begin_polyline2d ();
+/*----------------------------------------------------------------------*/
+
+void OpenGl_GraphicDriver::BeginLayer (const Aspect_CLayer2d& ACLayer)
+{
+ call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
+ if (!ptrLayer) return;
+
+ InitLayerProp(ptrLayer->listIndex);
+ if (!TheLayerProp.ListId) return;
+
+ glEnable(GL_TEXTURE_2D);
+ //GLboolean stat = glIsEnabled( GL_TEXTURE_2D );
+
+ glNewList (TheLayerProp.ListId, GL_COMPILE);
+ TheLayerIsOpen = Standard_True;
}
-void OpenGl_GraphicDriver::ClearLayer (const Aspect_CLayer2d& ACLayer) {
- Aspect_CLayer2d MyCLayer = ACLayer;
+void OpenGl_GraphicDriver::BeginPolygon2d ()
+{
+ if (!TheLayerProp.ListId) return;
+ TheLayerProp.NbPoints = 0;
+ glBegin (GL_POLYGON);
+}
- if (MyTraceLevel) {
- PrintFunction ("call_togl_clear_layer2d");
- PrintInteger ("ALayerType", int (ACLayer.layerType));
- }
- call_togl_clear_layer2d (&MyCLayer);
+void OpenGl_GraphicDriver::BeginPolyline2d ()
+{
+ if (!TheLayerProp.ListId) return;
+ TheLayerProp.NbPoints = 0;
+ glBegin (GL_LINE_STRIP);
}
-void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y) {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_draw2d");
- PrintShortReal ("X", X);
- PrintShortReal ("Y", Y);
- }
- call_togl_draw2d (X, Y);
+void OpenGl_GraphicDriver::ClearLayer (const Aspect_CLayer2d& ACLayer)
+{
+ if (!ACLayer.ptrLayer) return;
+
+ InitLayerProp(ACLayer.ptrLayer->listIndex);
+ if (!TheLayerProp.ListId) return;
+
+ glNewList (TheLayerProp.ListId, GL_COMPILE);
+ glEndList ();
}
-void OpenGl_GraphicDriver::Edge (const Standard_ShortReal X, const Standard_ShortReal Y) {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_edge2d");
- PrintShortReal ("X", X);
- PrintShortReal ("Y", Y);
- }
- call_togl_edge2d (X, Y);
+void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y)
+{
+ if (!TheLayerProp.ListId) return;
+ TheLayerProp.NbPoints++;
+ glVertex3f (X, Y, 0.F);
}
-void OpenGl_GraphicDriver::EndLayer () {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_end_layer2d");
- }
- call_togl_end_layer2d ();
+void OpenGl_GraphicDriver::Edge (const Standard_ShortReal X, const Standard_ShortReal Y)
+{
+ if (!TheLayerProp.ListId) return;
+ TheLayerProp.NbPoints++;
+ glVertex3f (X, Y, 0.F);
}
-void OpenGl_GraphicDriver::EndPolygon2d () {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_end_polygon2d");
+void OpenGl_GraphicDriver::EndLayer ()
+{
+ if (!TheLayerProp.ListId) return;
+ if (TheLayerIsOpen)
+ {
+ glEndList();
+ TheLayerIsOpen = Standard_False;
}
- call_togl_end_polygon2d ();
+ TheLayerProp.ListId = 0;
}
-void OpenGl_GraphicDriver::EndPolyline2d () {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_end_polyline2d");
- }
- call_togl_end_polyline2d ();
+void OpenGl_GraphicDriver::EndPolygon2d ()
+{
+ if (!TheLayerProp.ListId) return;
+ glEnd ();
}
-void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y) {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_move2d");
- PrintShortReal ("X", X);
- PrintShortReal ("Y", Y);
- }
- call_togl_move2d (X, Y);
+void OpenGl_GraphicDriver::EndPolyline2d ()
+{
+ if (!TheLayerProp.ListId) return;
+ glEnd ();
}
-void OpenGl_GraphicDriver::Rectangle (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Width, const Standard_ShortReal Height) {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_rectangle2d");
- PrintShortReal ("X", X);
- PrintShortReal ("Y", Y);
- PrintShortReal ("Width", Width);
- PrintShortReal ("Height", Height);
+void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y)
+{
+ if (!TheLayerProp.ListId) return;
+ if (TheLayerProp.NbPoints)
+ {
+ glEnd ();
+ TheLayerProp.NbPoints = 0;
+ glBegin (GL_LINE_STRIP);
}
- call_togl_rectangle2d (X, Y, Width, Height);
+ TheLayerProp.NbPoints++;
+ glVertex3f (X, Y, 0.F);
}
-void OpenGl_GraphicDriver::SetColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_set_color");
- PrintShortReal ("R", R);
- PrintShortReal ("G", G);
- PrintShortReal ("B", B);
- }
- call_togl_set_color (R, G, B);
+void OpenGl_GraphicDriver::Rectangle (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Width, const Standard_ShortReal Height)
+{
+ if (!TheLayerProp.ListId) return;
+ glRectf (X, Y, X + Width, Y + Height);
}
-void OpenGl_GraphicDriver::SetTransparency (const Standard_ShortReal ATransparency) {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_set_transparency");
- PrintShortReal ("Transparency", ATransparency);
- }
- call_togl_set_transparency (ATransparency);
+void OpenGl_GraphicDriver::SetColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B)
+{
+ if (!TheLayerProp.ListId) return;
+ TheLayerProp.Color.rgb[0] = R;
+ TheLayerProp.Color.rgb[1] = G;
+ TheLayerProp.Color.rgb[2] = B;
+ glColor3fv (TheLayerProp.Color.rgb);
}
-void OpenGl_GraphicDriver::UnsetTransparency () {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_unset_transparency");
- }
- call_togl_unset_transparency ();
+void OpenGl_GraphicDriver::SetTransparency (const Standard_ShortReal ATransparency)
+{
+ if (!TheLayerProp.ListId) return;
+ TheLayerProp.Color.rgb[3] = ATransparency;
+ glEnable (GL_BLEND);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glColor4fv (TheLayerProp.Color.rgb);
+}
+
+void OpenGl_GraphicDriver::UnsetTransparency ()
+{
+ if (!TheLayerProp.ListId) return;
+ TheLayerProp.Color.rgb[3] = 1.F;
+ glDisable (GL_BLEND);
}
-void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer Type, const Standard_ShortReal Width) {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_set_line_attributes");
- PrintInteger ("Type", Type);
- PrintShortReal ("Width", Width);
+void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer Type, const Standard_ShortReal Width)
+{
+ if (!TheLayerProp.ListId || openglDisplay.IsNull()) return;
+
+ if (TheLayerProp.LineType != Type)
+ {
+ TheLayerProp.LineType = Type;
+ openglDisplay->SetTypeOfLine((Aspect_TypeOfLine) Type);
+ }
+ if (TheLayerProp.LineWidth != Width)
+ {
+ TheLayerProp.LineWidth = Width;
+ glLineWidth ((GLfloat) Width);
}
- call_togl_set_line_attributes (Type, Width);
}
-void OpenGl_GraphicDriver::SetTextAttributes (const Standard_CString Font, const Standard_Integer AType, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) {
- if (MyTraceLevel) {
- PrintFunction ("call_togl_set_text_attributes");
- PrintString ("Font", Font);
- PrintInteger ("Type", AType);
- PrintShortReal ("R", R);
- PrintShortReal ("G", G);
- PrintShortReal ("B", B);
+void OpenGl_GraphicDriver::SetTextAttributes (const Standard_CString Font, const Standard_Integer AType, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B)
+{
+ if (!TheLayerProp.ListId || openglDisplay.IsNull()) return;
+
+ if ( strcmp ( TheLayerProp.AspectText.Font(), Font ) != 0 ||
+ (int)TheLayerProp.AspectText.DisplayType() != AType )
+ {
+ CALL_DEF_CONTEXTTEXT aContextText = myDefaultContextText;
+
+ aContextText.Font = (char*)Font;
+ aContextText.DisplayType = AType;
+ aContextText.Color.r = R;
+ aContextText.Color.g = G;
+ aContextText.Color.b = B;
+ TheLayerProp.AspectText.SetContext(aContextText);
+
+ TheLayerProp.FontCurrent = openglDisplay->FindFont(TheLayerProp.AspectText.Font(), TheLayerProp.AspectText.FontAspect(), TheLayerProp.TextParam.Height);
+
+ TheLayerProp.FontChanged = Standard_True;
}
- call_togl_set_text_attributes ((Tchar*)Font, AType, R, G, B);
-}
+}
-void OpenGl_GraphicDriver::Text (const Standard_CString AText, const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Height)
+void OpenGl_GraphicDriver::Text (const Standard_CString AText, const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal AHeight)
{
- if (MyTraceLevel) {
- PrintFunction ("call_togl_text2d");
- PrintString ("Text", AText);
- PrintShortReal ("X", X);
- PrintShortReal ("Y", Y);
- PrintShortReal ("Height", Height);
+ if (!TheLayerProp.ListId || openglDisplay.IsNull()) return;
+
+ const Standard_ShortReal height = (AHeight < 0)? DefaultTextHeight() : AHeight;
+
+ if ( TheLayerProp.TextParam.Height != height || TheLayerProp.FontChanged || TheLayerProp.FontCurrent == 0 )
+ {
+ TheLayerProp.TextParam.Height = (int )height;
+ TheLayerProp.FontCurrent = openglDisplay->FindFont(TheLayerProp.AspectText.Font(), TheLayerProp.AspectText.FontAspect(), (int )height);
+ TheLayerProp.FontChanged = Standard_False;
}
- const Standard_ShortReal h = (Height < 0)? DefaultTextHeight() : Height;
+
TCollection_ExtendedString estr(AText);
- call_togl_text2d ((Techar *)estr.ToExtString(), X, Y, h);
+ const Techar *s = (const Techar *)estr.ToExtString();
+
+ //szv: conversion of Techar to wchar_t
+ wchar_t *s1 = (wchar_t*)s;
+ if (sizeof(Techar) != sizeof(wchar_t))
+ {
+ Tint i = 0; while (s[i++]);
+ s1 = new wchar_t[i];
+ i = 0; while (s1[i++] = (wchar_t)(*s++));
+ }
+
+ openglDisplay->RenderText(s1, 1, (float)X, (float)Y, 0.F, &TheLayerProp.AspectText, &TheLayerProp.TextParam);
+
+ //szv: delete temporary wide string
+ if (sizeof(Techar) != sizeof(wchar_t))
+ delete[] s1;
}
void OpenGl_GraphicDriver::TextSize (const Standard_CString AText, const Standard_ShortReal AHeight, Standard_ShortReal& AWidth, Standard_ShortReal& AnAscent, Standard_ShortReal& ADescent) const
{
+ if (!TheLayerProp.ListId || openglDisplay.IsNull()) return;
+
+ const Standard_ShortReal height = (AHeight < 0)? DefaultTextHeight() : AHeight;
+
+ if ( TheLayerProp.TextParam.Height != height || TheLayerProp.FontChanged || TheLayerProp.FontCurrent == 0 )
+ {
+ TheLayerProp.TextParam.Height = (int )height;
+ TheLayerProp.FontCurrent = openglDisplay->FindFont(TheLayerProp.AspectText.Font(), TheLayerProp.AspectText.FontAspect(), (int )height);
+ TheLayerProp.FontChanged = Standard_False;
+ }
+
TCollection_ExtendedString estr(AText);
- call_togl_textsize2d ((Techar *)estr.ToExtString(), AHeight, &AWidth, &AnAscent, &ADescent);
- if (MyTraceLevel) {
- PrintFunction ("call_togl_textsize2d");
- PrintString ("Text", AText);
- PrintShortReal ("AHeight", AHeight);
- PrintShortReal ("AWidth", AWidth);
- PrintShortReal ("AnAscent", AnAscent);
- PrintShortReal ("ADescent", ADescent);
+ const Techar *s = (const Techar *)estr.ToExtString();
+
+ //szv: conversion of Techar to wchar_t
+ wchar_t *s1 = (wchar_t*)s;
+ if (sizeof(Techar) != sizeof(wchar_t))
+ {
+ Tint i = 0; while (s[i++]);
+ s1 = new wchar_t[i];
+ i = 0; while (s1[i++] = (wchar_t)(*s++));
}
+
+ int aWidth = 0, anAscent = 0, aDescent = 0;
+ openglDisplay->StringSize(s1, aWidth, anAscent, aDescent);
+
+ //szv: delete temporary wide string
+ if (sizeof(Techar) != sizeof(wchar_t))
+ delete[] s1;
+
+ AWidth = (Standard_ShortReal) aWidth;
+ AnAscent = (Standard_ShortReal) anAscent;
+ ADescent = (Standard_ShortReal) aDescent;
}
-// File OpenGl_GraphicDriver_print.c
-// Created March 2000
-// Author THA
-// e-mail t-hartl@muenchen.matra-dtv.fr
+// File: OpenGl_GraphicDriver_print.cxx
+// Created: 20 October 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
-/************************************************************************/
-/* Includes */
-/************************************************************************/
+#include <OpenGl_GraphicDriver.hxx>
-#include <OpenGl_GraphicDriver.jxx>
-#include <Aspect_DriverDefinitionError.hxx>
#include <Standard_NotImplemented.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-
-
-/************************************************************************/
-/* Print Methods */
-/************************************************************************/
+#include <OpenGl_CView.hxx>
Standard_Boolean OpenGl_GraphicDriver::Print
(const Graphic3d_CView& ACView,
const Aspect_PrintAlgo printAlgorithm,
const Standard_Real theScaleFactor) const
{
-
#ifdef WNT
- Graphic3d_CView MyCView = ACView;
- Aspect_CLayer2d MyCUnderLayer = ACUnderLayer;
- Aspect_CLayer2d MyCOverLayer = ACOverLayer;
-
- if (MyTraceLevel) {
- PrintFunction ("call_togl_print");
- PrintCView (MyCView, 1);
- }
- return call_togl_print (&MyCView, &MyCUnderLayer, &MyCOverLayer,
- hPrintDC, (int)showBackground, filename,
- (int)printAlgorithm, (float)theScaleFactor);
+ const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+ if (aCView)
+ return aCView->WS->Print(ACView,ACUnderLayer,ACOverLayer,hPrintDC,showBackground,filename,printAlgorithm,theScaleFactor);
#else
- Standard_NotImplemented::Raise ("OpenGl_GraphicDriver::Print is implemented "
- "only on Windows");
- return Standard_False;
+ Standard_NotImplemented::Raise ("OpenGl_GraphicDriver::Print is implemented only on Windows");
#endif
+ return Standard_False;
}
--- /dev/null
+// File: OpenGl_Group.cxx
+// Created: 1 August 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Group.hxx>
+
+#include <OpenGl_TextureBox.hxx>
+#include <OpenGl_PrimitiveArray.hxx>
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Group::OpenGl_Group ()
+: myAspectLine(NULL),
+ myAspectFace(NULL),
+ myAspectMarker(NULL),
+ myAspectText(NULL),
+ myFirst(NULL), myLast(NULL)
+{
+}
+
+OpenGl_Group::~OpenGl_Group()
+{
+ Clear();
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Group::SetAspectLine (const CALL_DEF_CONTEXTLINE& theContext,
+ const Standard_Boolean theIsGlobal)
+{
+ if (theIsGlobal || myFirst == NULL)
+ {
+ if (myAspectLine == NULL)
+ myAspectLine = new OpenGl_AspectLine();
+ myAspectLine->SetContext (theContext);
+ }
+ else
+ {
+ OpenGl_AspectLine* anAspectLine = new OpenGl_AspectLine();
+ anAspectLine->SetContext (theContext);
+ AddElement (TelNil/*TelAspectLine*/, anAspectLine);
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Group::SetAspectFace (const CALL_DEF_CONTEXTFILLAREA& theContext,
+ const Standard_Boolean theIsGlobal)
+{
+ if (theIsGlobal || myFirst == NULL)
+ {
+ if (myAspectFace == NULL)
+ myAspectFace = new OpenGl_AspectFace();
+ myAspectFace->SetContext (theContext);
+ }
+ else
+ {
+ OpenGl_AspectFace* anAspectFace = new OpenGl_AspectFace();
+ anAspectFace->SetContext (theContext);
+ AddElement (TelNil/*TelAspectFace*/, anAspectFace);
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Group::SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theContext,
+ const Standard_Boolean theIsGlobal)
+{
+ if (theIsGlobal || myFirst == NULL)
+ {
+ if (myAspectMarker == NULL)
+ myAspectMarker = new OpenGl_AspectMarker();
+ myAspectMarker->SetContext (theContext);
+ }
+ else
+ {
+ OpenGl_AspectMarker* anAspectMarker = new OpenGl_AspectMarker();
+ anAspectMarker->SetContext (theContext);
+ AddElement (TelNil/*TelAspectMarker*/, anAspectMarker);
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Group::SetAspectText (const CALL_DEF_CONTEXTTEXT& theContext,
+ const Standard_Boolean theIsGlobal)
+{
+ if (theIsGlobal || myFirst == NULL)
+ {
+ if (myAspectText == NULL)
+ myAspectText = new OpenGl_AspectText();
+ myAspectText->SetContext (theContext);
+ }
+ else
+ {
+ OpenGl_AspectText* anAspectText = new OpenGl_AspectText();
+ anAspectText->SetContext (theContext);
+ AddElement ( TelNil/*TelAspectText*/, anAspectText);
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Group::AddElement (const TelType AType, OpenGl_Element *AElem )
+{
+ OpenGl_ElementNode *node = new OpenGl_ElementNode();
+
+ node->type = AType;
+ node->elem = AElem;
+ node->next = NULL;
+ (myLast? myLast->next : myFirst) = node;
+ myLast = node;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Group::Clear ()
+{
+ if (myAspectLine)
+ {
+ // Delete line context
+ delete myAspectLine;
+ myAspectLine = NULL;
+ }
+ if (myAspectFace)
+ {
+ // Delete face context
+ delete myAspectFace;
+ myAspectFace = NULL;
+ }
+ if (myAspectMarker)
+ {
+ // Delete marker context
+ delete myAspectMarker;
+ myAspectMarker = NULL;
+ }
+ if (myAspectText)
+ {
+ // Delete text context
+ delete myAspectText;
+ myAspectText = NULL;
+ }
+ // Delete elements
+ while (myFirst)
+ {
+ OpenGl_ElementNode *next = myFirst->next;
+ delete myFirst->elem;
+ delete myFirst;
+ myFirst = next;
+ }
+ myLast = NULL;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Group::RemovePrimitiveArray (CALL_DEF_PARRAY *APArray)
+{
+ OpenGl_ElementNode *prevnode = NULL, *node = myFirst;
+ while (node)
+ {
+ if (node->type == TelParray)
+ {
+ CALL_DEF_PARRAY *aCurPArray = ((const OpenGl_PrimitiveArray *)node->elem)->PArray();
+
+ // validate for correct pointer
+ if (aCurPArray->num_bounds == APArray->num_bounds &&
+ aCurPArray->num_edges == APArray->num_edges &&
+ aCurPArray->num_vertexs == APArray->num_vertexs &&
+ aCurPArray->type == APArray->type)
+ {
+ (prevnode? prevnode->next : myFirst) = node->next;
+ if (!myFirst) myLast = NULL;
+ delete node->elem;
+ delete node;
+ break;
+ }
+ }
+ prevnode = node;
+ node = node->next;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Group::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ // Is rendering in ADD or IMMEDIATE mode?
+ const Standard_Boolean isImmediate = (AWorkspace->NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) != 0;
+
+ // Setup aspects
+ const OpenGl_AspectLine *aspect_line = AWorkspace->AspectLine(Standard_False);
+ const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace(Standard_False);
+ const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker(Standard_False);
+ const OpenGl_AspectText *aspect_text = AWorkspace->AspectText(Standard_False);
+ if (myAspectLine)
+ AWorkspace->SetAspectLine(myAspectLine);
+ if (myAspectFace)
+ AWorkspace->SetAspectFace(myAspectFace);
+ if (myAspectMarker)
+ AWorkspace->SetAspectMarker(myAspectMarker);
+ if (myAspectText)
+ AWorkspace->SetAspectText(myAspectText);
+
+ // Render group elements
+ OpenGl_ElementNode *node = myFirst;
+ while (node)
+ {
+ switch (node->type)
+ {
+ case TelPolyline:
+ case TelMarker:
+ case TelMarkerSet:
+ case TelText:
+ {
+ glDisable(GL_LIGHTING);
+
+ if (isImmediate)
+ {
+ glDepthMask(GL_FALSE);
+ }
+ else if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) != 0 &&
+ (AWorkspace->NamedStatus & OPENGL_NS_WIREFRAME) == 0 &&
+ AWorkspace->DegenerateModel != 0 )
+ {
+ glDisable( GL_DEPTH_TEST );
+ if ( AWorkspace->NamedStatus & OPENGL_NS_TEXTURE ) DisableTexture();
+ AWorkspace->NamedStatus |= OPENGL_NS_WIREFRAME;
+ }
+
+ node->elem->Render( AWorkspace );
+
+ if ( !isImmediate && (AWorkspace->NamedStatus & OPENGL_NS_TEXTURE) != 0 ) EnableTexture();
+ break;
+ }
+
+ case TelPolygon:
+ case TelPolygonIndices:
+ case TelQuadrangle:
+ case TelTriangleMesh:
+ {
+ if (isImmediate)
+ {
+ glDepthMask(GL_FALSE);
+ }
+ else if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) != 0 &&
+ (AWorkspace->NamedStatus & OPENGL_NS_WIREFRAME) != 0 &&
+ AWorkspace->DegenerateModel < 2 )
+ {
+ if ( AWorkspace->NamedStatus & OPENGL_NS_TEXTURE ) EnableTexture ();
+
+ glEnable( GL_DEPTH_TEST );
+ AWorkspace->NamedStatus &= ~OPENGL_NS_WIREFRAME;
+ }
+
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ AWorkspace->DisablePolygonOffset();
+
+ node->elem->Render( AWorkspace );
+
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ AWorkspace->EnablePolygonOffset();
+ break;
+ }
+
+ default:
+ {
+ node->elem->Render( AWorkspace );
+ break;
+ }
+ }
+ node = node->next;
+ }
+
+ // Restore aspects
+ AWorkspace->SetAspectLine(aspect_line);
+ AWorkspace->SetAspectFace(aspect_face);
+ AWorkspace->SetAspectMarker(aspect_marker);
+ AWorkspace->SetAspectText(aspect_text);
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Group.hxx
+// Created: 1 August 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_Group_Header
+#define _OpenGl_Group_Header
+
+#include <InterfaceGraphic_Graphic3d.hxx>
+
+#include <OpenGl_Element.hxx>
+
+#include <OpenGl_AspectLine.hxx>
+#include <OpenGl_AspectFace.hxx>
+#include <OpenGl_AspectMarker.hxx>
+#include <OpenGl_AspectText.hxx>
+
+#include <OpenGl_tsm.hxx>
+
+struct OpenGl_ElementNode
+{
+ TelType type;
+ OpenGl_Element *elem;
+ OpenGl_ElementNode *next;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+class OpenGl_Group : public OpenGl_Element
+{
+ public:
+ OpenGl_Group ();
+ virtual ~OpenGl_Group();
+
+ void SetAspectLine (const CALL_DEF_CONTEXTLINE &AContext, const Standard_Boolean IsGlobal = Standard_True);
+ void SetAspectFace (const CALL_DEF_CONTEXTFILLAREA &AContext, const Standard_Boolean IsGlobal = Standard_True);
+ void SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext, const Standard_Boolean IsGlobal = Standard_True);
+ void SetAspectText (const CALL_DEF_CONTEXTTEXT &AContext, const Standard_Boolean IsGlobal = Standard_True);
+
+ void AddElement (const TelType, OpenGl_Element * );
+ void Clear ();
+
+ void RemovePrimitiveArray (CALL_DEF_PARRAY *APArray);
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ OpenGl_AspectLine *myAspectLine;
+ OpenGl_AspectFace *myAspectFace;
+ OpenGl_AspectMarker *myAspectMarker;
+ OpenGl_AspectText *myAspectText;
+
+ OpenGl_ElementNode *myFirst, *myLast;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //_OpenGl_Group_Header
--- /dev/null
+// File: OpenGl_Light.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_Light_Header
+#define OpenGl_Light_Header
+
+#include <NCollection_List.hxx>
+
+#include <InterfaceGraphic_telem.hxx>
+
+#define OpenGLMaxLights 8
+
+struct OpenGl_Light
+{
+ TLightType type;
+ int HeadLight;
+ TEL_COLOUR col;
+ Tfloat pos[3];
+ Tfloat dir[3];
+ Tfloat shine;
+ Tfloat atten[2];
+ Tfloat angle;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+typedef NCollection_List<OpenGl_Light> OpenGl_ListOfLight;
+
+#endif //OpenGl_Light_Header
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-Gestion des light sous OpenGL
-
-
-REMARQUES:
-----------
-
-- We can't take in account GL_QUADRATIC_ATTENUATION.
-
-- Position des lumieres. Il faut faire le glLight(GL_POSITION) apres la
-gestion des matrices de transformation (GL_MODELVIEW).
-
-- Se mefier de GL_POSITION pour les lumieres directionelle. GL_POSITION
-indique bien la position ou se trouve la lumiere. Comme on a une direction
-comme valeur il faut l'inverser.
-
-
-FONCTIONNEMENT:
----------------
-- La variable lightOn permet d'optimiser le changement d'etat des lumieres.
-Ceci permet d'eviter d'appeler glIsEnable(GL_LIGHTING). Il faut bien sur
-que l'on utilise les 2 points d'entree LightOn() et LightOff().
-L'init de la variable est faite par call_func_redraw_all_structs (OpenGl_funcs.c)
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-20-06-97 : PCT ; creation
-30-06-96 : FMN ; Integration
-18-07-96 : FMN, PCT ; Correction indice, ajout IsLightOn()
-25-07-97 : CAL ; Portage NT (include OpenGl_tgl_all.h)
-07-10-97 : FMN ; Simplification WNT
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <math.h>
-#include <memory.h>
-
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-#ifndef DEBUG
-#define DEBUG 0
-#endif
-
-#define NO_PRINT_DEBUG
-
-#define GROW_SIZE_WKS 10
-#define GROW_SIZE_LIGHT 8
-
-/*----------------------------------------------------------------------*/
-/*
-* Types definis
-*/
-struct TEL_LIGHT_DATA
-{
- Tint LightID;
- TEL_LIGHT light;
- IMPLEMENT_MEMORY_OPERATORS
-};
-
-struct TEL_LIGHT_WKS
-{
- Tint wks;
- int lights_count;
- int lights_size;
- TEL_LIGHT_DATA *lights;
- IMPLEMENT_MEMORY_OPERATORS
-};
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-static TEL_LIGHT_WKS *wks = NULL;
-static int wks_count = 0;
-static int wks_size = 0;
-
-static GLfloat default_amb[4] = { 0.0, 0.0, 0.0, 1.0 };
-static GLfloat default_sptdir[3] = { 0.0, 0.0, -1.0 };
-static GLfloat default_sptexpo = 0.0;
-static GLfloat default_sptcutoff = 180.0;
-
-static GLboolean lightOn = GL_FALSE;
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions privees
-*/
-
-/*-----------------------------------------------------------------*/
-/*
-* Set des lumieres
-*/
-static void bind_light(TEL_LIGHT *lptr, int *gl_lid)
-{
- GLfloat data_amb[4];
- GLfloat data_diffu[4];
- GLfloat data_pos[4];
- GLfloat data_sptdir[3];
- GLfloat data_sptexpo;
- GLfloat data_sptcutoff;
- GLfloat data_constantattenuation;
- GLfloat data_linearattenuation;
- GLint cur_matrix;
-
-
- /* on n'a droit qu'a 8 lights avec OpenGL... */
- if (*gl_lid > GL_LIGHT7) return;
-
-
- /* la light est une headlight ? */
- if (lptr->HeadLight)
- {
- glGetIntegerv(GL_MATRIX_MODE, &cur_matrix);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
- }
-
-
- /* set la light en fonction de son type */
- switch (lptr->type)
- {
- case TLightAmbient:
- data_amb[0] = lptr->col.rgb[0];
- data_amb[1] = lptr->col.rgb[1];
- data_amb[2] = lptr->col.rgb[2];
- data_amb[3] = 1.0;
-
- /*------------------------- Ambient ---------------------------*/
- /*
- * The GL_AMBIENT parameter refers to RGBA intensity of the ambient
- * light.
- */
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, data_amb);
-
-#if DEBUG
- printf("OpenGL_LightBox::bind_light:LightAmbient \n");
- printf("\tGL_LIGHT_MODEL_AMBIENT %f %f %f \n", data_amb[0], data_amb[1], data_amb[2]);
-#endif
- break;
-
-
- case TLightDirectional:
- data_diffu[0] = lptr->col.rgb[0];
- data_diffu[1] = lptr->col.rgb[1];
- data_diffu[2] = lptr->col.rgb[2];
- data_diffu[3] = 1.0;
-
- /*------------------------- Direction ---------------------------*/
- /* From Open GL Programming Rev 1 Guide Chapt 6 :
- Lighting The Mathematics of Lighting ( p 168 )
-
- Directional Light Source ( Infinite ) :
- if the last parameter of GL_POSITION , w , is zero, the
- corresponding light source is a Directional one.
-
- GL_SPOT_CUTOFF a 180 signifie que ce n'est pas un spot.
- To create a realistic effect, set the GL_SPECULAR parameter
- to the same value as the GL_DIFFUSE.
- */
-
- data_pos[0] = -lptr->dir[0];
- data_pos[1] = -lptr->dir[1];
- data_pos[2] = -lptr->dir[2];
- data_pos[3] = 0.0;
-
- glLightfv(*gl_lid, GL_AMBIENT, default_amb);
- glLightfv(*gl_lid, GL_DIFFUSE, data_diffu);
- glLightfv(*gl_lid, GL_SPECULAR, data_diffu);
-
- glLightfv(*gl_lid, GL_POSITION, data_pos);
- glLightfv(*gl_lid, GL_SPOT_DIRECTION, default_sptdir);
- glLightf(*gl_lid, GL_SPOT_EXPONENT, default_sptexpo);
- glLightf(*gl_lid, GL_SPOT_CUTOFF, default_sptcutoff);
-
-#if DEBUG
- printf("OpenGL_LightBox::bind_light:LightDirection \n");
- printf("\tGL_AMBIENT %f %f %f \n", default_amb[0], default_amb[1], default_amb[2]);
- printf("\tGL_DIFFUSE %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]);
- printf("\tGL_SPECULAR %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]);
- printf("\tGL_POSITION %f %f %f \n", data_pos[0], data_pos[1], data_pos[2]);
-#endif
- break;
-
-
- case TLightPositional:
- data_diffu[0] = lptr->col.rgb[0];
- data_diffu[1] = lptr->col.rgb[1];
- data_diffu[2] = lptr->col.rgb[2];
- data_diffu[3] = 1.0;
-
- /*------------------------- Position -----------------------------*/
- /* From Open GL Programming Rev 1 Guide Chapt 6 :
- Lighting The Mathematics of Lighting ( p 168 )
- Positional Light Source :
- if the last parameter of GL_POSITION , w , is nonzero,
- the corresponding light source is a Positional one.
-
- GL_SPOT_CUTOFF a 180 signifie que ce n'est pas un spot.
-
- To create a realistic effect, set the GL_SPECULAR parameter
- to the same value as the GL_DIFFUSE.
- */
-
- data_pos[0] = lptr->pos[0];
- data_pos[1] = lptr->pos[1];
- data_pos[2] = lptr->pos[2];
- data_pos[3] = 1.0;
-
- data_constantattenuation = lptr->atten[0];
- data_linearattenuation = lptr->atten[1];
-
- glLightfv(*gl_lid, GL_AMBIENT, default_amb);
- glLightfv(*gl_lid, GL_DIFFUSE, data_diffu);
- glLightfv(*gl_lid, GL_SPECULAR, data_diffu);
-
- glLightfv(*gl_lid, GL_POSITION, data_pos);
- glLightfv(*gl_lid, GL_SPOT_DIRECTION, default_sptdir);
- glLightf(*gl_lid, GL_SPOT_EXPONENT, default_sptexpo);
- glLightf(*gl_lid, GL_SPOT_CUTOFF, default_sptcutoff);
- glLightf(*gl_lid, GL_CONSTANT_ATTENUATION, data_constantattenuation);
- glLightf(*gl_lid, GL_LINEAR_ATTENUATION, data_linearattenuation);
- glLightf(*gl_lid, GL_QUADRATIC_ATTENUATION, 0.0);
-
-#if DEBUG
- printf("OpenGL_LightBox::bind_light:LightPosition \n");
- printf("\tGL_AMBIENT %f %f %f \n", default_amb[0], default_amb[1], default_amb[2]);
- printf("\tGL_DIFFUSE %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]);
- printf("\tGL_SPECULAR %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]);
- printf("\tGL_POSITION %f %f %f \n", data_pos[0], data_pos[1], data_pos[2]);
-#endif
- break;
-
-
- case TLightSpot:
- data_diffu[0] = lptr->col.rgb[0];
- data_diffu[1] = lptr->col.rgb[1];
- data_diffu[2] = lptr->col.rgb[2];
- data_diffu[3] = 1.0;
-
- data_pos[0] = lptr->pos[0];
- data_pos[1] = lptr->pos[1];
- data_pos[2] = lptr->pos[2];
- data_pos[3] = 1.0;
-
- data_sptdir[0] = lptr->dir[0];
- data_sptdir[1] = lptr->dir[1];
- data_sptdir[2] = lptr->dir[2];
-
- data_sptexpo = ( float )lptr->shine * 128.0F;
- data_sptcutoff = ( float )(lptr->angle * 180.0F)/( float )M_PI;
-
- data_constantattenuation = lptr->atten[0];
- data_linearattenuation = lptr->atten[1];
-
- glLightfv(*gl_lid, GL_AMBIENT, default_amb);
- glLightfv(*gl_lid, GL_DIFFUSE, data_diffu);
- glLightfv(*gl_lid, GL_SPECULAR, data_diffu);
-
- glLightfv(*gl_lid, GL_POSITION, data_pos);
- glLightfv(*gl_lid, GL_SPOT_DIRECTION, data_sptdir);
- glLightf(*gl_lid, GL_SPOT_EXPONENT, data_sptexpo);
- glLightf(*gl_lid, GL_SPOT_CUTOFF, data_sptcutoff);
- glLightf(*gl_lid, GL_CONSTANT_ATTENUATION, data_constantattenuation);
- glLightf(*gl_lid, GL_LINEAR_ATTENUATION, data_linearattenuation);
- glLightf(*gl_lid, GL_QUADRATIC_ATTENUATION, 0.0);
-
-#if DEBUG
- printf("OpenGL_LightBox::bind_light:LightSpot \n");
- printf("\tGL_AMBIENT %f %f %f \n", default_amb[0], default_amb[1], default_amb[2]);
- printf("\tGL_DIFFUSE %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]);
- printf("\tGL_SPECULAR %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]);
- printf("\tGL_POSITION %f %f %f \n", data_pos[0], data_pos[1], data_pos[2]);
- printf("\tGL_SPOT_DIRECTION %f %f %f \n", data_sptdir[0], data_sptdir[1], data_sptdir[2]);
- printf("\tGL_SPOT_EXPONENT %f \n", data_sptexpo);
- printf("\tGL_SPOT_CUTOFF %f \n", data_sptcutoff);
- printf("\tGL_CONSTANT_ATTENUATION %f \n", data_constantattenuation);
- printf("\tGL_LINEAR_ATTENUATION %f \n", data_linearattenuation);
-#endif
- break;
- }
-
-
- if (lptr->type != TLightAmbient)
- {
-#if DEBUG
- printf("OpenGL_LightBox::bind_light:glEnable %d \n", *gl_lid);
-#endif
- glEnable(*gl_lid);
- (*gl_lid)++;
- }
-
-
- /* si la light etait une headlight alors restaure la matrice precedente */
- if (lptr->HeadLight)
- {
- glPopMatrix();
- glMatrixMode(cur_matrix);
- }
-}
-
-
-/*-----------------------------------------------------------------*/
-/*
-* recherche de la liste de lampe d'une wks, creation d'une liste si non existante
-*/
-static int find_wks(Tint WksID, int alloc)
-{
- int i;
-
- /* recherche la wks dans la liste si elle existe */
- for (i=0; i<wks_count; i++)
- if (wks[i].wks == WksID)
- return i;
-
- if (!alloc) return -1;
-
- /* la wks n'existe pas => on fait de la place si yen a plus */
- if (wks_count == wks_size )
- {
- wks_size += GROW_SIZE_WKS;
- if (!wks)
- wks = new TEL_LIGHT_WKS[wks_size];
- else
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- wks = (TEL_LIGHT_WKS*)realloc(wks, wks_size*sizeof(TEL_LIGHT_WKS));
-#else
- wks = cmn_resizemem<TEL_LIGHT_WKS>(wks, wks_size);
-#endif
-
- if (!wks)
- return -1;
- }
-
- wks[wks_count].wks = WksID;
- wks[wks_count].lights = NULL;
- wks[wks_count].lights_size = 0;
- wks[wks_count].lights_count = 0;
-
- return wks_count++;
-}
-
-/*-----------------------------------------------------------------*/
-/*
-* recherche une lampe d'une wks, creation d'une lampe si elle n'existe pas
-*/
-static int find_light(int WksIdx, Tint LightID, int alloc)
-{
- int i;
- TEL_LIGHT_DATA *lights;
-
-
- /* recherche la light dans la liste de la wks */
- lights = wks[WksIdx].lights;
- for (i=0; i<wks[WksIdx].lights_count; i++)
- if (lights[i].LightID == LightID)
- return i;
-
- if (!alloc) return -1;
-
- /* la lampe n'existe pas => on cree une lampe */
- if (wks[WksIdx].lights_count == wks[WksIdx].lights_size)
- {
- wks[WksIdx].lights_size += GROW_SIZE_LIGHT;
- if (!wks[WksIdx].lights)
- wks[WksIdx].lights = new TEL_LIGHT_DATA[wks[WksIdx].lights_size];
- else
- wks[WksIdx].lights =
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- (TEL_LIGHT_DATA*)realloc( wks[WksIdx].lights,
- wks[WksIdx].lights_size*sizeof(TEL_LIGHT_DATA) );
-#else
- cmn_resizemem<TEL_LIGHT_DATA>( wks[WksIdx].lights,
- wks[WksIdx].lights_size );
-#endif
- if (!wks[WksIdx].lights)
- return -1;
- }
-
- return wks[WksIdx].lights_count++;
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions publiques
-*/
-
-
-/*-----------------------------------------------------------------*/
-/*
-* Ajout d'une lumiere dans la Wks
-*/
-TStatus AddLight(Tint WksID, Tint LightID, tel_light light)
-{
- int wks_entry;
- int light_entry;
-
-#if DEBUG
- printf("AddLight %d dans wks %d [wds_count=%d]\n", LightID, WksID, wks_count);
-#endif
-
- /* obtient le numero de la liste de lights de la wks */
- wks_entry = find_wks(WksID, 1);
- if (wks_entry == -1) return TFailure;
-
- /* recherche le numero de la lampe si elle existe */
- light_entry = find_light(wks_entry, LightID, 1);
- if (light_entry == -1) return TFailure;
-
- /* met a jour la light */
- wks[wks_entry].lights[light_entry].LightID = LightID;
- wks[wks_entry].lights[light_entry].light = *light;
-
-#if DEBUG
- printf("ajout ok\n");
-#endif
- return TSuccess;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*
-* Maj des lumieres de la Wks
-*/
-TStatus UpdateLight(Tint WksID)
-{
- int wks_entry;
- int i;
- int gl_lid;
-
-
-#if DEBUG
- printf("UpdateLight %d\n", WksID);
-#endif
-
- /* vire toutes les lights des le depart avant une re-init complete */
- for (i=GL_LIGHT0; i<=GL_LIGHT7; i++)
- glDisable(i);
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, default_amb);
-
- /* recherche la liste de light de la wks */
- wks_entry = find_wks(WksID, 0);
- if (wks_entry == -1) return TFailure;
-
-#if DEBUG
- printf("*** Update: nb = %d\n", wks[wks_entry].lights_count);
-#endif
-
- /* set les lights */
- gl_lid = GL_LIGHT0;
- for (i=0; i<wks[wks_entry].lights_count; i++)
- {
-#if DEBUG
- printf("binding light %d\n", i);
-#endif
- bind_light(&wks[wks_entry].lights[i].light, &gl_lid);
- }
-
- if (wks[wks_entry].lights_count > 0) LightOn();
-
-#if DEBUG
- printf("update ok\n");
-#endif
-
- return TSuccess;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*
-* Remove une lumiere de la Wks
-*/
-TStatus RemoveLight(Tint WksID, Tint LightID)
-{
- int wks_entry;
- int light_entry;
-
-
- /* recherche de la wks */
- wks_entry = find_wks(WksID, 0);
- if (wks_entry == -1) return TFailure;
-
- /* recherche de la light */
- light_entry = find_light(wks_entry, LightID, 0);
- if (light_entry == -1) return TFailure;
-
- /* retire la light */
- memcpy(&wks[wks_entry].lights[light_entry],
- &wks[wks_entry].lights[light_entry+1],
- (wks[wks_entry].lights_count - light_entry - 1)*sizeof(TEL_LIGHT_DATA));
- wks[wks_entry].lights_count--;
-
-#if DEBUG
- printf("RemoveLight %d dans wks %d [wds_count=%d]\n", LightID, WksID, wks_count);
-#endif
-
- return TSuccess;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*
-* Remove des lumieres de la Wks
-*/
-TStatus RemoveWksLight(Tint WksID)
-{
- int wks_entry;
-
- /* recherche de la wks */
- wks_entry = find_wks(WksID, 0);
- if (wks_entry == -1) return TFailure;
-
- /* destruction de toute la wks */
- free(wks[wks_entry].lights);
- memcpy(&wks[wks_entry],
- &wks[wks_entry+1],
- (wks_count - wks_entry - 1)*sizeof(TEL_LIGHT_WKS));
- wks_count--;
-
- return TSuccess;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*
-* Reset de toutes les lights d'une Wks
-*/
-TStatus ResetWksLight(Tint WksID)
-{
- int wks_entry;
-
- /* recherche de la wks */
- wks_entry = find_wks(WksID, 0);
- if (wks_entry == -1) return TFailure;
-
- /* destruction de toutes les lights */
- wks[wks_entry].lights_count = 0;
-
- return TSuccess;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*
-* Enable des lights
-*/
-void LightOn(void)
-{
-#ifdef PRINT_DEBUG
- if(IsLightOn())
- printf("LightOn(): lighting already enabled!");
- else
- printf("LightOn() succeeded");
-#endif
- glEnable(GL_LIGHTING);
-}
-
-
-/*-----------------------------------------------------------------*/
-/*
-* Disable des lights
-*/
-void LightOff(void)
-{
-#ifdef PRINT_DEBUG
- if(!IsLightOn())
- printf("LightOff(): lighting already disabled!");
- else
- printf("LightOff() succeeded");
-#endif
- glDisable(GL_LIGHTING);
-}
-/*-----------------------------------------------------------------*/
-
-/*
-* IsEnable des lights
-*/
-
-GLboolean IsLightOn(void)
-{
- return glIsEnabled(GL_LIGHTING);
-}
-/*-----------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-Gestion des light sous OpenGL
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-20-06-97 : PCT ; creation
-30-06-97 : FMN ; Integration
-18-07-97 : FMN ; Ajout IsLightOn()
-02-10-97 : FMN ; Ajout gl.h pour WNT
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-
-#ifndef __OPENGL_LIGHTBOX_H_
-#define __OPENGL_LIGHTBOX_H_
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <GL/gl.h>
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_tsm.hxx>
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define OpenGLMaxLights 8
-
-/*----------------------------------------------------------------------*/
-/*
-* Types definis
-*/
-
-typedef struct
-{
- TLightType type;
- int HeadLight;
- TEL_COLOUR col;
- Tfloat pos[3];
- Tfloat dir[3];
- Tfloat shine;
- Tfloat atten[2];
- Tfloat angle;
-} TEL_LIGHT, *tel_light;
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes
-*/
-
-/*
-* Ajout d'une lumiere dans la Wks
-*/
-extern TStatus AddLight(Tint WksID, Tint LightID, tel_light light);
-
-/*
-* Maj des lumieres de la Wks
-*/
-extern TStatus UpdateLight(Tint WksID);
-
-/*
-* Remove une lumiere de la Wks
-*/
-extern TStatus RemoveLight(Tint WksID, Tint LightID);
-
-/*
-* Remove des lumieres de la Wks
-*/
-extern TStatus RemoveWksLight(Tint WksID);
-
-/*
-* Reset de toutes les lights d'une Wks
-*/
-extern TStatus ResetWksLight(Tint WksID);
-
-/*
-* Enable des lights
-*/
-extern void LightOn(void);
-
-/*
-* Disable des lights
-*/
-extern void LightOff(void);
-
-/*
-* IsEnable des lights
-*/
-extern GLboolean IsLightOn(void);
-
-/*----------------------------------------------------------------------*/
-
-#endif /* __OPENGL_LIGHTBOX_H_ */
-
-/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Marker.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Marker.hxx>
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <OpenGl_AspectMarker.hxx>
+#include <OpenGl_Structure.hxx>
+#include <OpenGl_Display.hxx>
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Marker::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker( Standard_True );
+
+ // Use highlight colours
+ glColor3fv( (AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)? AWorkspace->HighlightColor->rgb : aspect_marker->Color().rgb );
+
+ switch ( aspect_marker->Type() )
+ {
+ case Aspect_TOM_O_POINT :
+ {
+ const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, aspect_marker->Scale() );
+ glRasterPos3fv( myPoint.xyz );
+ AWorkspace->GetDisplay()->SetBaseForMarker();
+ glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str );
+ }
+ case Aspect_TOM_POINT :
+ {
+ glPointSize( aspect_marker->Scale() );
+ glBegin( GL_POINTS );
+ glVertex3fv( myPoint.xyz );
+ glEnd();
+ break;
+ }
+ default:
+ {
+ glRasterPos3fv( myPoint.xyz );
+ switch ( aspect_marker->Type() )
+ {
+ case Aspect_TOM_RING1 :
+ case Aspect_TOM_RING2 :
+ case Aspect_TOM_RING3 :
+ {
+ const float ADelta = 0.1f;
+ float AScale = aspect_marker->Scale();
+ float ALimit = 0.f;
+ if (aspect_marker->Type() == Aspect_TOM_RING1)
+ ALimit = AScale * 0.2f;
+ else if (aspect_marker->Type() == Aspect_TOM_RING2)
+ ALimit = AScale * 0.5f;
+ else
+ ALimit = AScale * 0.8f;
+ AWorkspace->GetDisplay()->SetBaseForMarker();
+ while (AScale > ALimit && AScale >= 1.f)
+ {
+ const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, AScale );
+ glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str );
+ AScale -= ADelta;
+ }
+ break;
+ }
+ case Aspect_TOM_USERDEFINED :
+ {
+ glCallList( openglDisplay->GetUserMarkerListIndex( (int)aspect_marker->Scale() ) );
+ break;
+ }
+ default :
+ {
+ AWorkspace->GetDisplay()->SetBaseForMarker();
+ const char *str = AWorkspace->GetDisplay()->GetStringForMarker( aspect_marker->Type(), aspect_marker->Scale() );
+ glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *)str );
+ }
+ }
+ GLint mode;
+ glGetIntegerv( GL_RENDER_MODE, &mode );
+ if( mode==GL_FEEDBACK )
+ {
+ glBegin( GL_POINTS );
+ glVertex3fv( myPoint.xyz );
+ glEnd();
+ /* it is necessary to indicate end of marker information*/
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Marker.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_Marker_Header
+#define OpenGl_Marker_Header
+
+#include <InterfaceGraphic_telem.hxx>
+
+#include <OpenGl_Element.hxx>
+
+class OpenGl_Marker : public OpenGl_Element
+{
+ public:
+
+ OpenGl_Marker (const TEL_POINT &APoint) : myPoint(APoint) {}
+ virtual ~OpenGl_Marker () {}
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ TEL_POINT myPoint;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_Marker_Header
--- /dev/null
+// File: OpenGl_MarkerSet.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_MarkerSet.hxx>
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <OpenGl_AspectMarker.hxx>
+#include <OpenGl_Structure.hxx>
+#include <OpenGl_Display.hxx>
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_MarkerSet::OpenGl_MarkerSet (const Standard_Integer ANbPoints, const Graphic3d_Vertex *APoints)
+: myNbPoints(ANbPoints),
+ myPoints(new TEL_POINT[ANbPoints])
+{
+ memcpy( myPoints, APoints, ANbPoints*sizeof(TEL_POINT) );
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_MarkerSet::~OpenGl_MarkerSet ()
+{
+ if (myPoints)
+ delete[] myPoints;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_MarkerSet::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker( Standard_True );
+
+ // Use highlight colors
+ glColor3fv( (AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)? AWorkspace->HighlightColor->rgb : aspect_marker->Color().rgb );
+
+ const TEL_POINT *ptr;
+ Tint i;
+
+ switch ( aspect_marker->Type() )
+ {
+ case Aspect_TOM_O_POINT :
+ {
+ const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, aspect_marker->Scale() );
+ AWorkspace->GetDisplay()->SetBaseForMarker();
+ for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ )
+ {
+ glRasterPos3fv( ptr->xyz );
+ glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str );
+ }
+ }
+ case Aspect_TOM_POINT :
+ {
+ glPointSize( aspect_marker->Scale() );
+ glBegin( GL_POINTS );
+ for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ )
+ glVertex3fv( ptr->xyz );
+ glEnd();
+ break;
+ }
+ default:
+ {
+ switch ( aspect_marker->Type() )
+ {
+ case Aspect_TOM_RING1 :
+ case Aspect_TOM_RING2 :
+ case Aspect_TOM_RING3 :
+ {
+ const float ADelta = 0.1f;
+ float AScale = aspect_marker->Scale();
+ float ALimit = 0.f;
+ if (aspect_marker->Type() == Aspect_TOM_RING1)
+ ALimit = AScale * 0.2f;
+ else if (aspect_marker->Type() == Aspect_TOM_RING2)
+ ALimit = AScale * 0.5f;
+ else
+ ALimit = AScale * 0.8f;
+ AWorkspace->GetDisplay()->SetBaseForMarker();
+ for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ )
+ {
+ glRasterPos3fv( ptr->xyz );
+ AScale = aspect_marker->Scale();
+ while (AScale > ALimit && AScale >= 1.f)
+ {
+ const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, AScale );
+ glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str );
+ AScale -= ADelta;
+ }
+ }
+ break;
+ }
+ case Aspect_TOM_USERDEFINED :
+ {
+ for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ )
+ {
+ glRasterPos3fv( ptr->xyz );
+ glCallList( openglDisplay->GetUserMarkerListIndex( (int)aspect_marker->Scale() ) );
+ }
+ break;
+ }
+ default :
+ {
+ AWorkspace->GetDisplay()->SetBaseForMarker();
+ const char *str = AWorkspace->GetDisplay()->GetStringForMarker( aspect_marker->Type(), aspect_marker->Scale() );
+ for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ )
+ {
+ glRasterPos3fv( ptr->xyz );
+ glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str );
+ }
+ }
+ }
+ GLint mode;
+ glGetIntegerv( GL_RENDER_MODE, &mode );
+ if( mode==GL_FEEDBACK )
+ {
+ glBegin( GL_POINTS );
+ for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ )
+ glVertex3fv( ptr->xyz );
+ glEnd();
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_MarkerSet.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_MarkerSet_Header
+#define OpenGl_MarkerSet_Header
+
+#include <InterfaceGraphic_telem.hxx>
+
+#include <OpenGl_Element.hxx>
+
+#include <Graphic3d_Vertex.hxx>
+
+class OpenGl_MarkerSet : public OpenGl_Element
+{
+ public:
+
+ OpenGl_MarkerSet (const Standard_Integer ANbPoints, const Graphic3d_Vertex *APoints);
+ virtual ~OpenGl_MarkerSet ();
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ Tint myNbPoints;
+ TEL_POINT *myPoints;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_MarkerSet_Header
--- /dev/null
+// File: OpenGl_Matrix.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Matrix.hxx>
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Multiplymat3 (OpenGl_Matrix *c, const OpenGl_Matrix *a, const OpenGl_Matrix *b)
+{
+ int row, col, i;
+ for (row = 0; row < 4; row++) {
+ for (col = 0; col < 4; col++) {
+ float sum = 0.F;
+ for (i = 0; i < 4; i++)
+ sum += a->mat[row][i] * b->mat[i][col];
+ c->mat[row][col] = sum;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Transposemat3 (OpenGl_Matrix *c, const OpenGl_Matrix *a)
+{
+ Tint row, col;
+ for (row = 0; row < 4; row++)
+ for (col = 0; col < 4; col++)
+ c->mat[row][col] = a->mat[col][row];
+}
--- /dev/null
+// File: OpenGl_Matrix.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_Matrix_Header
+#define OpenGl_Matrix_Header
+
+#include <InterfaceGraphic_telem.hxx>
+
+struct OpenGl_Matrix
+{
+ float mat[4][4];
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+Standard_EXPORT void OpenGl_Multiplymat3 (OpenGl_Matrix *c, const OpenGl_Matrix *a, const OpenGl_Matrix *b);
+Standard_EXPORT void OpenGl_Transposemat3 (OpenGl_Matrix *c, const OpenGl_Matrix *a);
+
+#endif //OpenGl_Matrix_Header
+++ /dev/null
-#include <OpenGl_Memory.hxx>
-
-OpenGl_MemoryMgr::OpenGl_MemoryMgr(){}
-OpenGl_MemoryMgr::OpenGl_MemoryMgr(const OpenGl_MemoryMgr&){}
-OpenGl_MemoryMgr::~OpenGl_MemoryMgr(){}
-
#define OPENGL_MEMORY_H
#include <OpenGl_tgl_all.hxx>
-#include <Standard_TypeDef.hxx>
-#include <NCollection_DataMap.hxx>
-#include <NCollection_Stack.hxx>
-#include <NCollection_List.hxx>
-#include <NCollection_Array1.hxx>
-#include <NCollection_Vector.hxx>
-
template <class XType> XType *cmn_resizemem( XType *ptr, Tint size )
{
return ptr;
}
-class OpenGl_MemoryMgr {
-private:
- OpenGl_MemoryMgr();
- OpenGl_MemoryMgr(const OpenGl_MemoryMgr&);
- ~OpenGl_MemoryMgr();
-};
-
#endif //OPENGL_MEMORY_H
--- /dev/null
+// File: OpenGl_Mesh.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#define OCC749 /* SAV 19/09/02 added processing of colored vertices */
+#define OCC7824 /* ASL 26/01/05 transparency of polygon with colors assigned to vertices */
+
+/*----------------------------------------------------------------------*/
+/*
+* Includes
+*/
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <OpenGl_Mesh.hxx>
+
+#include <OpenGl_telem_util.hxx>
+#include <OpenGl_TextureBox.hxx>
+
+#include <OpenGl_AspectFace.hxx>
+#include <OpenGl_Structure.hxx>
+
+#include <float.h>
+
+static long s_Rand = 1L;
+# define OPENGL_RAND() ( ( unsigned )( s_Rand = s_Rand * 214013L + 2531011L ) )
+
+/*----------------------------------------------------------------------*/
+/*
+* Prototypes
+*/
+
+typedef TEL_INDEXPOLY_DATA* tel_indexpoly_data;
+
+void set_drawable_items ( GLboolean*, int, const float );
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Mesh::draw_indexpoly (const Tint front_lighting_model,
+ const Aspect_InteriorStyle interior_style,
+ const TEL_COLOUR *edge_colour,
+ const OPENGL_SURF_PROP *prop,
+ const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ Tint i, j, k, a, newList = 0;
+ Tint lighting_model;
+
+ /* Following pointers have been provided for performance improvement */
+ Tint *ind;
+ tel_point pfn, pvn, pv;
+ tel_colour pvc, pfc;
+ tel_texture_coord pvt;
+
+ ind = myData.indices;
+ pfn = myData.fnormals;
+ pvn = myData.vnormals;
+ pvc = myData.vcolours;
+ pfc = myData.fcolours;
+ pv = myData.vertices;
+ pvt = myData.vtexturecoord;
+ if ( AWorkspace->DegenerateModel < 2 && interior_style != Aspect_IS_EMPTY )
+ {
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ {
+ pvc = 0;
+ pfc = 0;
+ }
+
+ if ( interior_style == Aspect_IS_HIDDENLINE)
+ {
+ pvc = 0;
+ pfc = 0;
+ }
+
+ if ( front_lighting_model )
+ glEnable(GL_LIGHTING);
+ else
+ glDisable(GL_LIGHTING);
+
+ lighting_model = front_lighting_model;
+
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 )
+ goto doDraw; /* Disable object display list out of animation */
+ /* window's context and bitmap's one */
+
+ if ( myDS->model != lighting_model || !myDS->list ||
+ myDS->model == -1 || ( AWorkspace->DegenerateModel && myDS->skipRatio != AWorkspace->SkipRatio ))
+ {
+ myDS->skipRatio = AWorkspace->SkipRatio;
+ myDS->model = lighting_model;
+ myDS->degMode = AWorkspace->DegenerateModel;
+ if ( AWorkspace->SkipRatio <= 0.f ) {
+ if ( !myDS->list ) myDS->list = glGenLists ( 1 );
+
+ glNewList ( myDS->list, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+doDraw:
+ if ( !lighting_model )
+ {
+ if ( myData.num_bounds == 3 )
+ glBegin ( GL_TRIANGLES );
+ else if ( myData.num_bounds == 4 )
+ glBegin ( GL_QUADS );
+ else glBegin ( GL_POLYGON );
+
+ if ( pvc )
+ {
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i )
+ {
+ a = j + myData.num_bounds;
+ for ( ; j < a; ++j )
+ {
+ glColor3fv ( pvc[ ind[ j ] ].rgb );
+ glVertex3fv ( pv[ ind[ j ] ].xyz );
+ }
+ }
+ }
+ else if ( pfc )
+ {
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i )
+ {
+ a = j + myData.num_bounds;
+ glColor3fv ( pfc[ i ].rgb );
+ for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
+ }
+ }
+ else
+ {
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i )
+ {
+ a = j + myData.num_bounds;
+ for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
+ }
+ }
+ glEnd ();
+ }
+ else
+ {
+ /* lighting_model != TelLModelNone */
+ if ( myData.num_bounds == 3 )
+ glBegin ( GL_TRIANGLES );
+ else if ( myData.num_bounds == 4 )
+ glBegin ( GL_QUADS );
+ else glBegin ( GL_POLYGON );
+
+#ifdef OCC749
+ for ( i = a = 0; i < myData.num_facets; ++i ) {
+ j = a; a += myData.num_bounds;
+ if( pfn ) glNormal3fv ( pfn[ i ].xyz );
+ if( pfc && !prop->isphysic ) {
+ GLfloat diff[4], ambi[4], emsv[4], r, g, b;
+
+ ambi[3] = diff[3] = emsv[3] = prop->trans;
+
+ r = pfc[ i ].rgb[0]; g = pfc[ i ].rgb[1]; b = pfc[ i ].rgb[2];
+
+ if( prop->color_mask & OPENGL_AMBIENT_MASK ) {
+ ambi[0] = prop->amb * r;
+ ambi[1] = prop->amb * g;
+ ambi[2] = prop->amb * b;
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambi);
+ }
+ if( prop->color_mask & OPENGL_DIFFUSE_MASK ) {
+ diff[0] = prop->diff * r;
+ diff[1] = prop->diff * g;
+ diff[2] = prop->diff * b;
+ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff);
+ }
+ if( prop->color_mask & OPENGL_EMISSIVE_MASK ) {
+ emsv[0] = prop->emsv * r;
+ emsv[1] = prop->emsv * g;
+ emsv[2] = prop->emsv * b;
+ glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, emsv);
+ }
+ }
+ for ( ; j < a; ++j ) {
+ k = ind[ j ];
+ if( pvn ) glNormal3fv ( pvn[ k ].xyz );
+ if( pvc && !prop->isphysic ) {
+ GLfloat diff[4], ambi[4], emsv[4], r, g, b;
+
+ ambi[3] = diff[3] = emsv[3] = prop->trans;
+
+ r = pvc[ k ].rgb[0]; g = pvc[ k ].rgb[1]; b = pvc[ k ].rgb[2];
+
+ if( prop->color_mask & OPENGL_AMBIENT_MASK ) {
+ ambi[0] = prop->amb * r;
+ ambi[1] = prop->amb * g;
+ ambi[2] = prop->amb * b;
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambi);
+ }
+ if( prop->color_mask & OPENGL_DIFFUSE_MASK ) {
+ diff[0] = prop->diff * r;
+ diff[1] = prop->diff * g;
+ diff[2] = prop->diff * b;
+ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff);
+ }
+ if( prop->color_mask & OPENGL_EMISSIVE_MASK ) {
+ emsv[0] = prop->emsv * r;
+ emsv[1] = prop->emsv * g;
+ emsv[2] = prop->emsv * b;
+ glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, emsv);
+ }
+ }
+ if( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 ) glTexCoord2fv ( pvt[ k ].xy );
+ glVertex3fv ( pv[ k ].xyz );
+ } /* end for ( j . . . ) */
+ } /* end for ( i . . . ) */
+ glEnd ();
+#else
+ if ( pvn ) {
+ if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 )
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+ a = j + myData.num_bounds;
+ for ( ; j < a; ++j ) {
+ glNormal3fv ( pvn[ ind[ j ] ].xyz );
+ glTexCoord2fv ( pvt[ ind[ j ] ].xy );
+ glVertex3fv ( pv[ ind[ j ] ].xyz );
+ } /* end for ( j . . . ) */
+ } /* end for ( i . . . ) */
+ else
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+ a = j + myData.num_bounds;
+ for ( ; j < a; ++j ) {
+ glNormal3fv ( pvn[ ind[ j ] ].xyz );
+ glVertex3fv ( pv[ ind[ j ] ].xyz );
+ } /* end for ( j . . . ) */
+ } /* end for ( i . . . ) */
+ } else { /* !pvn */
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+ a = j + myData.num_bounds;
+ glNormal3fv ( pfn[ i ].xyz );
+ for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
+ } /* end for */
+ } /* end else */
+ glEnd ();
+#endif /* OCC749 */
+
+ } /* end else */
+ } else if ( AWorkspace->SkipRatio < 1.f ) {
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+ set_drawable_items ( myDS->bDraw, myData.num_facets, AWorkspace->SkipRatio );
+ if ( !lighting_model ) {
+ if ( myData.num_bounds == 3 )
+ glBegin ( GL_TRIANGLES );
+ else if ( myData.num_bounds == 4 )
+ glBegin ( GL_QUADS );
+ else glBegin ( GL_POLYGON );
+
+ if ( pvc ) {
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+ a = j + myData.num_bounds;
+ if ( myDS->bDraw[ i ] )
+ for ( ; j < a; ++j ) {
+ glColor3fv ( pvc[ ind[ j ] ].rgb );
+ glVertex3fv ( pv[ ind[ j ] ].xyz );
+ } /* end for ( j . . . ) */
+ else j = a;
+ } /* end for ( i . . . ) */
+ } else if ( pfc ) {
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+ a = j + myData.num_bounds;
+ if ( myDS->bDraw[ i ] ) {
+ glColor3fv ( pfc[ i ].rgb );
+ for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
+ } else j = a;
+ } /* end for */
+ } else {
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+ a = j + myData.num_bounds;
+ if ( myDS->bDraw[ i ] )
+ for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
+ else j = a;
+ } /* end for */
+ } /* end else */
+ glEnd ();
+ } else { /* lighting_model != TelLModelNone */
+ if ( myData.num_bounds == 3 )
+ glBegin ( GL_TRIANGLES );
+ else if ( myData.num_bounds == 4 )
+ glBegin ( GL_QUADS );
+ else glBegin ( GL_POLYGON );
+
+ if ( pvn ) {
+ if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 )
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+ a = j + myData.num_bounds;
+ if ( myDS->bDraw[ i ] )
+ for ( ; j < a; ++j ) {
+ glNormal3fv ( pvn[ ind[ j ] ].xyz );
+ glTexCoord2fv ( pvt[ ind[ j ] ].xy );
+ glVertex3fv ( pv[ ind[ j ] ].xyz );
+ } /* end for ( j . . . ) */
+ else j = a;
+ } /* end for ( i . . . ) */
+ else
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+ a = j + myData.num_bounds;
+ if ( myDS->bDraw[ i ] )
+ for ( ; j < a; ++j ) {
+ glNormal3fv ( pvn[ ind[ j ] ].xyz );
+ glVertex3fv ( pv[ ind[ j ] ].xyz );
+ } /* end for ( j . . . ) */
+ else j = a;
+ } /* end for ( i . . . ) */
+ } else { /* !pvn */
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+ a = j + myData.num_bounds;
+ if ( myDS->bDraw[ i ] ) {
+ glNormal3fv ( pfn[ i ].xyz );
+ for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
+ } else j = a;
+ } /* end for */
+ } /* end else */
+ glEnd ();
+ } /* end else */
+ } else {
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+ } /* end else */
+ if ( newList ) glEndList ();
+ if ( AWorkspace->DegenerateModel ) return;
+ } else {
+ glCallList ( AWorkspace->SkipRatio <= 0.f ? myDS->list : myDS->dlist );
+ if ( AWorkspace->DegenerateModel ) return;
+ } /* end else */
+ }
+
+ i = 0;
+
+ switch ( AWorkspace->DegenerateModel )
+ {
+ default:
+ break;
+
+ case 2: /* XXX_TDM_WIREFRAME */
+ i = 1;
+ break;
+
+ case 3: /* XXX_TDM_MARKER */
+ draw_degenerates_as_points ( AWorkspace->SkipRatio );
+ return;
+
+ case 4: /* XXX_TDM_BBOX */
+ draw_degenerates_as_bboxs ();
+ return;
+ }
+
+ draw_edges ( edge_colour, interior_style, i, AWorkspace );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Mesh::draw_edges (const TEL_COLOUR *edge_colour, const Aspect_InteriorStyle interior_style,
+ Tint forceDraw, const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True );
+
+ if ( interior_style != Aspect_IS_HIDDENLINE && !forceDraw && aspect_face->Context().Edge == TOff )
+ return;
+
+ glDisable(GL_LIGHTING);
+ const GLboolean texture_on = IsTextureEnabled();
+ if (texture_on) DisableTexture();
+
+ // Setup line aspect
+ const OpenGl_AspectLine *aspect_line_old = AWorkspace->SetAspectLine( aspect_face->AspectEdge() );
+ AWorkspace->AspectLine( Standard_True );
+
+ tel_point pv = myData.vertices;
+ Tint *ind = myData.indices;
+ Tint *vis = myData.edge_vis;
+
+ Tint i, j, a, newList = 0;
+
+ if ( !forceDraw ) {
+
+ glColor3fv ( edge_colour -> rgb );
+ glPushAttrib ( GL_POLYGON_BIT );
+ glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE );
+
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+
+ a = j + myData.num_bounds;
+
+ glBegin ( GL_POLYGON );
+
+ for ( ; j < a; ++j ) {
+
+ glEdgeFlag ( ( GLboolean )( vis[ j ] == 1 ? GL_TRUE : GL_FALSE ) );
+ glVertex3fv ( pv[ ind[ j ] ].xyz );
+
+ } /* end for */
+
+ glEnd();
+
+ glEdgeFlag ( GL_TRUE );
+
+ } /* end for */
+
+ glPopAttrib ();
+
+ } else {
+
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 )
+ goto doDraw; /* Disable object display list out of animation */
+
+ if ( myDS->degMode != 2 || myDS->skipRatio != AWorkspace->SkipRatio || !myDS->dlist ) {
+
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+
+ myDS->degMode = 2;
+ myDS->skipRatio = AWorkspace->SkipRatio;
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+
+doDraw:
+ glPushAttrib ( GL_POLYGON_BIT | GL_DEPTH_BUFFER_BIT );
+
+ glEdgeFlag ( GL_TRUE );
+ glDisable ( GL_DEPTH_TEST );
+ glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE );
+
+ if ( AWorkspace->SkipRatio <= 0.f )
+
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+
+ a = j + myData.num_bounds;
+
+ glBegin ( GL_POLYGON );
+
+ for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
+
+ glEnd();
+
+ } /* end for */
+
+ else if ( AWorkspace->SkipRatio < 1.f ) {
+
+ set_drawable_items ( myDS->bDraw, myData.num_facets, AWorkspace->SkipRatio );
+
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+
+ a = j + myData.num_bounds;
+
+ if ( myDS->bDraw[ i ] ) {
+
+ glBegin ( GL_POLYGON );
+
+ for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
+
+ glEnd();
+
+ } else j = a;
+
+ } /* end for */
+
+ } /* end if */
+
+ glPopAttrib ();
+ if ( newList ) glEndList ();
+
+ } else glCallList ( myDS->dlist );
+
+ } /* end else */
+
+ // Restore line context
+ AWorkspace->SetAspectLine( aspect_line_old );
+
+ if (texture_on) EnableTexture();
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Mesh::draw_degenerates_as_points (const float aSkipRatio) const
+{
+ Tint* ind, *vis;
+ Tint i, j, n, a, newList = 0;
+ GLfloat pt[ 3 ];
+ tel_point pv;
+
+ pv = myData.vertices;
+ ind = myData.indices;
+ vis = myData.edge_vis;
+
+ glDisable(GL_LIGHTING);
+
+ if ( myDS->degMode != 3 || myDS->skipRatio != aSkipRatio || !myDS->dlist ) {
+
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+
+ myDS->degMode = 3;
+ myDS->skipRatio = aSkipRatio;
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+
+ if ( aSkipRatio <= 0.f ) {
+
+ glBegin ( GL_POINTS );
+
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+
+ n = myData.num_bounds;
+ a = j + n;
+
+ for ( pt [ 0 ] = pt[ 1 ] = pt[ 2 ] = 0.; j < a; ++j ) {
+
+ pt[ 0 ] += pv[ ind[ j ] ].xyz[ 0 ];
+ pt[ 1 ] += pv[ ind[ j ] ].xyz[ 1 ];
+ pt[ 2 ] += pv[ ind[ j ] ].xyz[ 2 ];
+
+ } /* end for ( j ) */
+
+ pt[ 0 ] /= n;
+ pt[ 1 ] /= n;
+ pt[ 2 ] /= n;
+
+ glVertex3fv ( pt );
+
+ } /* end for ( i ) */
+
+ glEnd ();
+
+ } else if ( aSkipRatio < 1.f ) {
+
+ set_drawable_items ( myDS->bDraw, myData.num_facets, aSkipRatio );
+
+ glBegin ( GL_POINTS );
+
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+
+ n = myData.num_bounds;
+ a = j + n;
+
+ if ( myDS->bDraw[ i ] ) {
+
+ for ( pt [ 0 ] = pt[ 1 ] = pt[ 2 ] = 0.; j < a; ++j ) {
+
+ pt[ 0 ] += pv[ ind[ j ] ].xyz[ 0 ];
+ pt[ 1 ] += pv[ ind[ j ] ].xyz[ 1 ];
+ pt[ 2 ] += pv[ ind[ j ] ].xyz[ 2 ];
+
+ } /* end for ( j ) */
+
+ pt[ 0 ] /= n;
+ pt[ 1 ] /= n;
+ pt[ 2 ] /= n;
+
+ glVertex3fv ( pt );
+
+ } else j = a;
+
+ } /* end for ( i ) */
+
+ glEnd ();
+
+ } /* end if */
+
+ glEndList ();
+
+ } else glCallList ( myDS->dlist );
+
+}
+
+void OpenGl_Mesh::draw_degenerates_as_bboxs () const
+{
+ Tint* ind, *vis;
+ Tint i, j, n, a, newList = 0;
+ GLfloat minp[ 3 ] = { FLT_MAX, FLT_MAX, FLT_MAX };
+ GLfloat maxp[ 3 ] = { FLT_MIN, FLT_MIN, FLT_MIN };
+ tel_point pv;
+
+ pv = myData.vertices;
+ ind = myData.indices;
+ vis = myData.edge_vis;
+
+ glDisable(GL_LIGHTING);
+
+ if ( myDS->degMode != 4 || !myDS->dlist ) {
+
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+
+ myDS->degMode = 4;
+
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+
+ for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) {
+
+ n = myData.num_bounds;
+ a = j + n;
+
+ for ( ; j < a; ++j ) {
+
+ if ( pv[ ind[ j ] ].xyz[ 0 ] < minp[ 0 ] )
+ minp[ 0 ] = pv[ ind[ j ] ].xyz[ 0 ] ;
+ if ( pv[ ind[ j ] ].xyz[ 1 ] < minp[ 1 ] )
+ minp[ 1 ] = pv[ ind[ j ] ].xyz[ 1 ] ;
+ if ( pv[ ind[ j ] ].xyz[ 2 ] < minp[ 2 ] )
+ minp[ 2 ] = pv[ ind[ j ] ].xyz[ 2 ] ;
+
+ if ( pv[ ind[ j ] ].xyz[ 0 ] > maxp[ 0 ] )
+ maxp[ 0 ] = pv[ ind[ j ] ].xyz[ 0 ] ;
+ if ( pv[ ind[ j ] ].xyz[ 1 ] > maxp[ 1 ] )
+ maxp[ 1 ] = pv[ ind[ j ] ].xyz[ 1 ] ;
+ if ( pv[ ind[ j ] ].xyz[ 2 ] > maxp[ 2 ] )
+ maxp[ 2 ] = pv[ ind[ j ] ].xyz[ 2 ] ;
+
+ } /* end for ( j ) */
+
+ } /* end for ( i ) */
+
+ /* OCC11904 -- Temporarily disable environment mapping */
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_TEXTURE_1D);
+ glDisable(GL_TEXTURE_2D);
+
+ glBegin ( GL_LINE_STRIP );
+
+ glVertex3fv ( minp );
+ glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] );
+ glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( minp[ 0 ], minp[ 1 ], minp[ 2 ] );
+
+ glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] );
+ glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] );
+ glVertex3f ( maxp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] );
+
+ glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
+ glVertex3fv ( maxp );
+ glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] );
+ glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] );
+
+ glEnd();
+ glPopAttrib();
+ glEndList ();
+
+ } else glCallList ( myDS->dlist );
+}
+
+/*----------------------------------------------------------------------*/
+
+void set_drawable_items ( GLboolean* pbDraw, int n, const float aSkipRatio )
+{
+ memset ( pbDraw, 0, sizeof ( GLboolean ) * n );
+
+ int i = ( int )( ( 1.0F - aSkipRatio ) * n );
+
+ while ( i-- ) pbDraw[ OPENGL_RAND() % n ] = 1;
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Mesh::OpenGl_Mesh (const Graphic3d_Array1OfVertex& AListVertex, const Aspect_Array1OfEdge& AListEdge)
+{
+ const Standard_Integer nv = AListVertex.Length();
+
+ // Dynamic allocation
+ TEL_POINT *points = new TEL_POINT[nv];
+ memcpy( points, &AListVertex(AListVertex.Lower()), nv*sizeof(TEL_POINT) );
+
+ Init (nv,points,NULL,NULL,NULL,AListEdge,3);
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Mesh::OpenGl_Mesh (const Graphic3d_Array1OfVertexN& AListVertex, const Aspect_Array1OfEdge& AListEdge)
+{
+ const Standard_Integer nv = AListVertex.Length ();
+
+ // Dynamic allocation
+ TEL_POINT *points = new TEL_POINT[nv];
+ TEL_POINT *normals = new TEL_POINT[nv];
+
+ Standard_Integer i = 0, j = AListVertex.Lower();
+ Standard_Real X, Y, Z;
+ for ( ; i < nv; i++, j++)
+ {
+ AListVertex(j).Coord(X, Y, Z);
+ points[i].xyz[0] = float (X);
+ points[i].xyz[1] = float (Y);
+ points[i].xyz[2] = float (Z);
+ AListVertex(j).Normal(X, Y, Z);
+ normals[i].xyz[0] = float (X);
+ normals[i].xyz[1] = float (Y);
+ normals[i].xyz[2] = float (Z);
+ }
+
+ Init (nv,points,normals,NULL,NULL,AListEdge,3);
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Mesh::OpenGl_Mesh (const Graphic3d_Array1OfVertexC& AListVertex, const Aspect_Array1OfEdge& AListEdge)
+{
+ const Standard_Integer nv = AListVertex.Length ();
+
+ // Dynamic allocation
+ TEL_POINT *points = new TEL_POINT[nv];
+ TEL_COLOUR *colors = new TEL_COLOUR[nv];
+
+ Standard_Integer i = 0, j = AListVertex.Lower();
+ Standard_Real X, Y, Z;
+ for ( ; i < nv; i++, j++)
+ {
+ AListVertex(j).Coord(X, Y, Z);
+ points[i].xyz[0] = float (X);
+ points[i].xyz[1] = float (Y);
+ points[i].xyz[2] = float (Z);
+ AListVertex(j).Color().Values (X, Y, Z, Quantity_TOC_RGB);
+ colors[i].rgb[0] = float (X);
+ colors[i].rgb[1] = float (Y);
+ colors[i].rgb[2] = float (Z);
+ colors[i].rgb[3] = 1.0F;
+ }
+
+ Init (nv,points,NULL,colors,NULL,AListEdge,3);
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Mesh::OpenGl_Mesh (const Graphic3d_Array1OfVertexNC& AListVertex, const Aspect_Array1OfEdge& AListEdge)
+{
+ const Standard_Integer nv = AListVertex.Length ();
+
+ // Dynamic allocation
+ TEL_POINT *points = new TEL_POINT[nv];
+ TEL_POINT *normals = new TEL_POINT[nv];
+ TEL_COLOUR *colors = new TEL_COLOUR[nv];
+
+ Standard_Integer i = 0, j = AListVertex.Lower();
+ Standard_Real X, Y, Z;
+ for ( ; i < nv; i++, j++)
+ {
+ AListVertex(j).Coord(X, Y, Z);
+ points[i].xyz[0] = float (X);
+ points[i].xyz[1] = float (Y);
+ points[i].xyz[2] = float (Z);
+ AListVertex(j).Normal(X, Y, Z);
+ normals[i].xyz[0] = float (X);
+ normals[i].xyz[1] = float (Y);
+ normals[i].xyz[2] = float (Z);
+ AListVertex(j).Color().Values (X, Y, Z, Quantity_TOC_RGB);
+ colors[i].rgb[0] = float (X);
+ colors[i].rgb[1] = float (Y);
+ colors[i].rgb[2] = float (Z);
+ colors[i].rgb[3] = 1.0F;
+ }
+
+ Init (nv,points,normals,colors,NULL,AListEdge,3);
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Mesh::OpenGl_Mesh (const Graphic3d_Array1OfVertexNT& AListVertex, const Aspect_Array1OfEdge& AListEdge)
+{
+ const Standard_Integer nv = AListVertex.Length ();
+
+ // Dynamic allocation
+ TEL_POINT *points = new TEL_POINT[nv];
+ TEL_POINT *normals = new TEL_POINT[nv];
+ TEL_TEXTURE_COORD *tcoords = new TEL_TEXTURE_COORD[nv];
+
+ Standard_Integer i = 0, j = AListVertex.Lower();
+ Standard_Real X, Y, Z;
+ for ( ; i < nv; i++, j++)
+ {
+ AListVertex(j).Coord(X, Y, Z);
+ points[i].xyz[0] = float (X);
+ points[i].xyz[1] = float (Y);
+ points[i].xyz[2] = float (Z);
+ AListVertex(j).Normal(X, Y, Z);
+ normals[i].xyz[0] = float (X);
+ normals[i].xyz[1] = float (Y);
+ normals[i].xyz[2] = float (Z);
+ AListVertex(j).TextureCoordinate(X, Y);
+ tcoords[i].xy[0] = float(X);
+ tcoords[i].xy[1] = float(Y);
+ }
+
+ Init (nv,points,normals,NULL,tcoords,AListEdge,3);
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Mesh::Init (const Tint ANbVertices, tel_point AVertices,
+ tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords,
+ const Aspect_Array1OfEdge& AListEdge, const Tint ANbBounds)
+{
+ // Get number of bounds in a facet
+ myData.num_bounds = ANbBounds;
+
+ // Get number of vertices
+ myData.num_vertices = ANbVertices;
+
+ // Get vertices
+ myData.vertices = AVertices;
+
+ // Get number of edges
+ const Standard_Integer nb_edges = AListEdge.Length ();
+
+ myData.indices = new Tint[nb_edges];
+ myData.edge_vis = new Tint[nb_edges];
+
+ const Standard_Integer LowerE = AListEdge.Lower ();
+ const Standard_Integer UpperE = AListEdge.Upper ();
+
+ // Loop on edges
+ Standard_Integer i, j;
+ for (j=0, i=LowerE; i<=UpperE; i++, j++)
+ {
+ myData.indices[j] = AListEdge(i).FirstIndex() - LowerE; //LastIndex unused
+ myData.edge_vis[j] = AListEdge(i).Type() ? TOff : TOn;
+ }
+
+ // Get number of facets
+ myData.num_facets = nb_edges / ANbBounds;
+
+ myData.vnormals = AVNormals;
+ if (AVNormals)
+ {
+ myData.vertex_flag = TEL_VT_NORMAL;
+ for( i = 0; i < ANbVertices; i++ )
+ vecnrm( myData.vnormals[i].xyz );
+ }
+ else
+ {
+ myData.vertex_flag = TEL_VT_NONE;
+ }
+
+ myData.vcolours = AVColors;
+ myData.vtexturecoord = ATCoords;
+
+ myData.facet_flag = TEL_FA_NONE;
+ myData.fnormals = new TEL_POINT[myData.num_facets];
+ for( i = 0, j = 0; i < myData.num_facets; i++ )
+ {
+ TelGetPolygonNormal( myData.vertices, &myData.indices[j], myData.num_bounds, myData.fnormals[i].xyz );
+ j += myData.num_bounds;
+ }
+
+ myData.fcolours = NULL;
+
+ myDS = new DS_INTERNAL();
+ myDS->list = 0;
+ myDS->dlist = 0;
+ myDS->degMode = 0;
+ myDS->model = -1;
+ myDS->skipRatio = 0.0F;
+ myDS->bDraw = new unsigned char[myData.num_facets];
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Mesh::~OpenGl_Mesh ()
+{
+ if( myData.edge_vis )
+ delete[] myData.edge_vis;
+ if( myData.indices )
+ delete[] myData.indices;
+ if( myData.fcolours )
+ delete[] myData.fcolours;
+ if( myData.fnormals )
+ delete[] myData.fnormals;
+ if( myData.vertices )
+ delete[] myData.vertices;
+ if( myData.vcolours )
+ delete[] myData.vcolours;
+ if( myData.vnormals )
+ delete[] myData.vnormals;
+ if( myData.vtexturecoord )
+ delete[] myData.vtexturecoord;
+
+ if ( myDS )
+ {
+ if ( GET_GL_CONTEXT() != NULL )
+ {
+ if ( myDS->list ) glDeleteLists ( myDS->list, 1 );
+ if ( myDS->dlist ) glDeleteLists ( myDS->dlist, 1 );
+ }
+
+ if ( myDS->bDraw )
+ delete[] myDS->bDraw;
+
+ delete myDS;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Mesh::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True );
+
+ Tint front_lighting_model = aspect_face->Context().IntFront.color_mask;
+ const TEL_COLOUR *interior_colour = &aspect_face->Context().IntFront.matcol;
+ const TEL_COLOUR *edge_colour = &aspect_face->AspectEdge()->Color();
+
+ // Use highlight colors
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ {
+ edge_colour = interior_colour = AWorkspace->HighlightColor;
+ front_lighting_model = 0;
+ }
+
+ glColor3fv( interior_colour->rgb );
+
+ draw_indexpoly( front_lighting_model,
+ aspect_face->Context().InteriorStyle,
+ edge_colour,
+ &aspect_face->Context().IntFront,
+ AWorkspace );
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Mesh.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_Mesh_Header
+#define OpenGl_Mesh_Header
+
+#include <InterfaceGraphic_telem.hxx>
+#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_Array1OfVertexN.hxx>
+#include <Graphic3d_Array1OfVertexC.hxx>
+#include <Graphic3d_Array1OfVertexNC.hxx>
+#include <Graphic3d_Array1OfVertexNT.hxx>
+#include <Aspect_Array1OfEdge.hxx>
+#include <Aspect_InteriorStyle.hxx>
+
+#include <OpenGl_Element.hxx>
+#include <OpenGl_AspectFace.hxx>
+
+struct TEL_INDEXPOLY_DATA
+{
+ Tint num_vertices; /* Number of vertices */
+ Tint num_facets; /* Number of facets (triangles, quadrangles or polygons) */
+ Tint num_bounds; /* Number of bounds in a facet (3, 4 or more) */
+ Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */
+ Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */
+ Tint *edge_vis; /* Edge visibility indicators for each edge */
+ Tint *indices; /* Connectivity array */
+ tel_point fnormals; /* Facet normals */
+ tel_colour fcolours; /* Facet colour values */
+ tel_point vertices; /* Vertices */
+ tel_colour vcolours; /* Vertex colour values */
+ tel_point vnormals; /* Vertex normals */
+ tel_texture_coord vtexturecoord; /* Texture Coordinates */
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+class OpenGl_Mesh : public OpenGl_Element
+{
+ public:
+
+ OpenGl_Mesh (const Graphic3d_Array1OfVertex& AListVertex, const Aspect_Array1OfEdge& AListEdge);
+ OpenGl_Mesh (const Graphic3d_Array1OfVertexN& AListVertex, const Aspect_Array1OfEdge& AListEdge);
+ OpenGl_Mesh (const Graphic3d_Array1OfVertexC& AListVertex, const Aspect_Array1OfEdge& AListEdge);
+ OpenGl_Mesh (const Graphic3d_Array1OfVertexNC& AListVertex, const Aspect_Array1OfEdge& AListEdge);
+ OpenGl_Mesh (const Graphic3d_Array1OfVertexNT& AListVertex, const Aspect_Array1OfEdge& AListEdge);
+
+ virtual ~OpenGl_Mesh ();
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ void Init (const Tint ANbVertices, tel_point AVertices,
+ tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords,
+ const Aspect_Array1OfEdge& AListEdge, const Tint ANbBounds);
+
+ void draw_indexpoly (const Tint, /* front_lighting_model, */
+ const Aspect_InteriorStyle, /* interior_style, */
+ const TEL_COLOUR *, /* edge_colour, */
+ const OPENGL_SURF_PROP *,
+ const Handle(OpenGl_Workspace) &) const;
+
+ void draw_degenerates_as_points (const float) const;
+
+ void draw_degenerates_as_bboxs () const;
+
+ void draw_edges (const TEL_COLOUR *, const Aspect_InteriorStyle, Tint, const Handle(OpenGl_Workspace) &) const;
+
+ TEL_INDEXPOLY_DATA myData;
+ DS_INTERNAL *myDS;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_Mesh_Header
--- /dev/null
+// File: OpenGl_NamedStatus.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_NamedStatus_Header
+#define _OpenGl_NamedStatus_Header
+
+// Dynamic fields
+#define OPENGL_NS_HIDE (1<<0)
+#define OPENGL_NS_PICK (1<<1)
+#define OPENGL_NS_HIGHLIGHT (1<<2)
+#define OPENGL_NS_WIREFRAME (1<<3)
+#define OPENGL_NS_RESMAT (1<<4)
+#define OPENGL_NS_ADD (1<<5)
+#define OPENGL_NS_IMMEDIATE (1<<6)
+#define OPENGL_NS_TEXTURE (1<<7)
+#define OPENGL_NS_ANTIALIASING (1<<8)
+#define OPENGL_NS_ANIMATION (1<<9)
+#define OPENGL_NS_UPDATEAM (1<<10)
+#define OPENGL_NS_DEGENERATION (1<<11)
+#define OPENGL_NS_2NDPASSNEED (1<<12)
+#define OPENGL_NS_2NDPASSDO (1<<13)
+#define OPENGL_NS_FORBIDSETTEX (1<<14)
+#define OPENGL_NS_FLIST (1<<15)
+#define OPENGL_NS_WHITEBACK (1<<16)
+#define OPENGL_NS_ISBITMAP (1<<17)
+
+#endif //_OpenGl_NamedStatus_Header
--- /dev/null
+// File: OpenGl_Polygon.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Context.hxx>
+
+#include <OpenGl_Polygon.hxx>
+
+#include <OpenGl_tgl_all.hxx>
+#include <OpenGl_telem_util.hxx>
+#include <OpenGl_TextureBox.hxx>
+#include <OpenGl_Memory.hxx>
+
+#include <OpenGl_AspectFace.hxx>
+#include <OpenGl_Structure.hxx>
+
+#include <GL/glu.h>
+
+#if (defined(_WIN32) || defined(__WIN32__))
+ #define STATIC
+#else
+ #define STATIC static
+#endif
+
+struct EXTRA_VERTEX
+{
+ GLfloat vert[3];
+ int ind;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+typedef EXTRA_VERTEX* extra_vertex;
+
+struct SEQ_
+{
+ Tint ts_num, ts_alloc;
+ void **tmesh_sequence;
+ GLenum triangle_type; /* FSXXX OPTI */
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+struct OPENGL_DISPLAY_PGN
+{
+ Tint num_of_seq;
+ Tint num_alloc;
+ SEQ_ *seq;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+static void bgntriangulate( const TEL_POLYGON_DATA *, void (APIENTRY*)() );
+static void endtriangulate(void);
+
+#ifndef GLU_VERSION_1_2
+ #define GLUtesselator GLUtriangulatorObj
+ void gluTessBeginContour();
+ void gluTessBeginPolygon();
+ void gluTessEndPolygon();
+ void gluTessEndContour();
+ #define GLU_TESS_BEGIN 100100
+ #define GLU_TESS_VERTEX 100101
+ #define GLU_TESS_END 100102
+ #define GLU_TESS_ERROR 100103
+ #define GLU_TESS_COMBINE 100105
+#endif
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Polygon::draw_polygon (const Handle(OpenGl_Workspace) &AWorkspace, Tint front_lighting_model) const
+{
+ Tint i;
+
+ tel_point ptr;
+ tel_point pvn;
+ tel_colour pfc, pvc;
+ tel_texture_coord pvt;
+
+ pfc = myData.fcolour;
+ pvc = myData.vcolours;
+ pvn = myData.vnormals;
+ pvt = myData.vtexturecoord;
+
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ pvc = pfc = NULL;
+
+ ptr = myData.vertices;
+ if ( pfc )
+ glColor3fv( pfc->rgb );
+ if ( front_lighting_model )
+ glNormal3fv( myData.fnormal.xyz );
+
+ if( myData.reverse_order ) glFrontFace( GL_CW );
+
+ if (myData.num_vertices == 3) glBegin(GL_TRIANGLES);
+ else if(myData.num_vertices == 4) glBegin(GL_QUADS);
+ else glBegin(GL_POLYGON);
+ if( front_lighting_model )
+ {
+ if( pvn )
+ {
+ if (pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0)
+ for( i=0; i<myData.num_vertices; i++, ptr++ )
+ {
+ glNormal3fv( pvn[i].xyz );
+ glTexCoord2fv( pvt[i].xy );
+ glVertex3fv( ptr->xyz );
+ }
+ else
+ for( i=0; i<myData.num_vertices; i++, ptr++ )
+ {
+ glNormal3fv( pvn[i].xyz );
+ glVertex3fv( ptr->xyz );
+ }
+ }
+ else
+ {
+ for( i=0; i<myData.num_vertices; i++, ptr++ )
+ {
+ glVertex3fv( ptr->xyz );
+ }
+ }
+ }
+ else
+ {
+ if( pvc )
+ {
+ for( i=0; i<myData.num_vertices; i++, ptr++ )
+ {
+ glColor3fv( pvc[i].rgb );
+ glVertex3fv( ptr->xyz );
+ }
+ }
+ else
+ {
+ for( i=0; i<myData.num_vertices; i++, ptr++ )
+ {
+ glVertex3fv( ptr->xyz );
+ }
+ }
+ }
+ glEnd();
+ if( myData.reverse_order ) glFrontFace( GL_CCW );
+
+}
+
+/*----------------------------------------------------------------------*/
+
+/* JWR - allow varying the size */
+
+#define INCREMENT 8
+
+static int seq_increment = INCREMENT;
+
+static const TEL_POLYGON_DATA *DaTa;
+static GLUtesselator *tripak = 0;
+
+STATIC void APIENTRY
+out_bgntmesh( GLenum triangle_type )
+{
+ OPENGL_DISPLAY_PGN *dis = DaTa->dsply;
+
+ dis->num_of_seq++;
+ if( dis->num_alloc < dis->num_of_seq )
+ {
+ dis->num_alloc += seq_increment;
+
+ if( dis->seq == 0 )
+ {
+ dis->seq = new SEQ_[dis->num_alloc];
+ }
+ else
+ {
+#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
+ dis->seq = (SEQ_*)realloc( dis->seq, dis->num_alloc*sizeof(SEQ_) );
+#else
+ dis->seq = cmn_resizemem<SEQ_>( dis->seq, dis->num_alloc );
+#endif
+ }
+ }
+ dis->seq[ dis->num_of_seq - 1 ].ts_num = 0;
+ dis->seq[ dis->num_of_seq - 1 ].ts_alloc = 0;
+ dis->seq[ dis->num_of_seq - 1 ].tmesh_sequence = 0;
+
+#ifdef JWR_DEC_TRIFAN_BUG
+ dis->seq[ dis->num_of_seq - 1 ].triangle_type = GL_POLYGON;
+ glBegin(GL_POLYGON);
+#else
+ dis->seq[ dis->num_of_seq - 1 ].triangle_type = triangle_type;
+ glBegin(triangle_type);
+#endif
+}
+
+/*----------------------------------------------------------------------*/
+
+STATIC void APIENTRY
+out_vert1( void *data )
+{
+ SEQ_ *s = &( DaTa->dsply->seq[ DaTa->dsply->num_of_seq - 1 ] );
+
+ s->ts_num++;
+ if( s->ts_alloc < s->ts_num )
+ {
+ s->ts_alloc += seq_increment;
+
+ if( s->tmesh_sequence == 0 )
+ {
+ s->tmesh_sequence = new void*[s->ts_alloc];
+ }
+ else
+ {
+#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
+ s->tmesh_sequence = (void**)realloc( s->tmesh_sequence, s->ts_alloc*sizeof(void*));
+#else
+ s->tmesh_sequence = cmn_resizemem<void*>( s->tmesh_sequence, s->ts_alloc);
+#endif
+ }
+ }
+ s->tmesh_sequence[ s->ts_num - 1 ] = data;
+
+
+ if ( data < (void *)0xffff ) {
+ long a = (long)data;
+
+ glVertex3fv( DaTa->vertices[a].xyz );
+ }
+ else {
+ extra_vertex b = (extra_vertex) data;
+
+ glVertex3fv( b->vert );
+ }
+
+}
+
+/*----------------------------------------------------------------------*/
+
+STATIC void APIENTRY
+out_vert2( void *data )
+{
+ SEQ_ *s = &( DaTa->dsply->seq[ DaTa->dsply->num_of_seq - 1 ] );
+
+ s->ts_num++;
+ if( s->ts_alloc < s->ts_num )
+ {
+ s->ts_alloc += seq_increment;
+
+ if( s->tmesh_sequence == 0 )
+ {
+ s->tmesh_sequence = new void*[s->ts_alloc];
+ }
+ else
+ {
+#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
+ s->tmesh_sequence = (void**)( s->tmesh_sequence, s->ts_alloc*sizeof(void*) );
+#else
+ s->tmesh_sequence = cmn_resizemem<void*>( s->tmesh_sequence, s->ts_alloc );
+#endif
+ }
+ }
+ s->tmesh_sequence[ s->ts_num - 1 ] = data;
+
+ if ( data < (void *)0xffff ) {
+ long a = (long)data;
+
+ glColor3fv( DaTa->vcolours[a].rgb );
+ glVertex3fv( DaTa->vertices[a].xyz );
+ }
+ else {
+ extra_vertex b = (extra_vertex) data;
+
+ glColor3fv( DaTa->vcolours[(b->ind)].rgb );
+ glVertex3fv( b->vert );
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+STATIC void APIENTRY
+out_vert3( void *data )
+{
+ SEQ_ *s = &( DaTa->dsply->seq[ DaTa->dsply->num_of_seq - 1 ] );
+
+ s->ts_num++;
+ if( s->ts_alloc < s->ts_num )
+ {
+ s->ts_alloc += seq_increment;
+
+ if( s->tmesh_sequence == 0 )
+ {
+ s->tmesh_sequence = new void*[s->ts_alloc];
+ }
+ else
+ {
+#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
+ s->tmesh_sequence = (void**)realloc( s->tmesh_sequence, s->ts_alloc*sizeof(void*) );
+#else
+ s->tmesh_sequence = cmn_resizemem<void*>( s->tmesh_sequence, s->ts_alloc );
+#endif
+ }
+ }
+ s->tmesh_sequence[ s->ts_num - 1 ] = data;
+
+ if ( data <= (void *)0xffff ) {
+ long a = (long)data;
+
+ glNormal3fv( DaTa->vnormals[a].xyz );
+ glVertex3fv( DaTa->vertices[a].xyz);
+ }
+ else {
+ extra_vertex b = (extra_vertex) data;
+
+ glNormal3fv( DaTa->vnormals[(b->ind)].xyz );
+ glVertex3fv( b->vert );
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+STATIC void APIENTRY
+mycombine( GLdouble coords[3], int *data, GLfloat w[4], void **dataout)
+{
+ extra_vertex new_vertex = (extra_vertex) malloc(sizeof(EXTRA_VERTEX));
+
+ new_vertex->vert[0] = ( float )coords[0];
+ new_vertex->vert[1] = ( float )coords[1];
+ new_vertex->vert[2] = ( float )coords[2];
+ new_vertex->ind = *data;
+ *dataout = new_vertex;
+}
+
+/*----------------------------------------------------------------------*/
+
+STATIC void APIENTRY
+out_endtmesh( void )
+{
+ glEnd();
+}
+
+/*----------------------------------------------------------------------*/
+
+STATIC void APIENTRY
+out_error( GLenum error )
+{
+ printf( "POLYGON : %s\n", (char *) gluErrorString(error) );
+}
+
+/*----------------------------------------------------------------------*/
+
+static void
+bgntriangulate(const TEL_POLYGON_DATA *d, void ( APIENTRY * out_ver)() )
+{
+ DaTa = d;
+
+ tripak = gluNewTess();
+
+#if defined(linux) && !defined(NOGLUfuncptr)
+ gluTessCallback( tripak, GLU_TESS_BEGIN, (_GLUfuncptr)(out_bgntmesh) );
+ gluTessCallback( tripak, GLU_TESS_VERTEX, out_ver );
+ gluTessCallback( tripak, GLU_TESS_END, out_endtmesh );
+ gluTessCallback( tripak, GLU_TESS_ERROR, (_GLUfuncptr)(out_error) );
+ gluTessCallback( tripak, GLU_TESS_COMBINE, (_GLUfuncptr)(mycombine) );
+#else
+ gluTessCallback( tripak, GLU_TESS_BEGIN, (void (APIENTRY*)())out_bgntmesh );
+ gluTessCallback( tripak, GLU_TESS_VERTEX, (void (APIENTRY*)())out_ver );
+ gluTessCallback( tripak, GLU_TESS_END, (void (APIENTRY*)())out_endtmesh );
+ gluTessCallback( tripak, GLU_TESS_ERROR, (void (APIENTRY*)())out_error );
+ gluTessCallback( tripak, GLU_TESS_COMBINE, (void (APIENTRY*)())mycombine );
+#endif
+}
+
+/*----------------------------------------------------------------------*/
+
+static void
+endtriangulate()
+{
+ DaTa = 0;
+ gluDeleteTess(tripak);
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Polygon::draw_polygon_concav (const Handle(OpenGl_Workspace) &AWorkspace, Tint front_lighting_model) const
+{
+ long i;
+
+ tel_point pvn;
+ tel_point ptr;
+ tel_colour pfc, pvc;
+ GLdouble xyz[3];
+
+ pfc = myData.fcolour;
+ pvc = myData.vcolours;
+ pvn = myData.vnormals;
+
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ pvc = pfc = NULL;
+
+ ptr = myData.vertices;
+ DaTa = &myData;
+
+ if ( pfc )
+ glColor3fv( pfc->rgb );
+ if ( front_lighting_model )
+ glNormal3fv( myData.fnormal.xyz );
+
+ if( myData.reverse_order ) glFrontFace( GL_CW );
+
+ if( !myData.dsply )
+ {
+ if( front_lighting_model )
+ {
+ if( pvn )
+ {
+ bgntriangulate(&myData, (void (APIENTRY*)())out_vert3);
+ }
+ else
+ {
+ bgntriangulate(&myData, (void (APIENTRY*)())out_vert1);
+ }
+ }
+ else
+ {
+ if( pvc )
+ {
+ bgntriangulate(&myData, (void (APIENTRY*)())out_vert2);
+ }
+ else
+ {
+ bgntriangulate(&myData, (void (APIENTRY*)())out_vert1);
+ }
+ }
+ gluTessBeginPolygon( tripak, NULL );
+ gluTessBeginContour( tripak);
+
+ for( i=0; i<myData.num_vertices; i++, ptr++ )
+ {
+ xyz[0] = ptr->xyz[0];
+ xyz[1] = ptr->xyz[1];
+ xyz[2] = ptr->xyz[2];
+#ifndef WNT
+ gluTessVertex( tripak, xyz,(void * ) i );
+#else
+ {
+ double v[ 3 ] = {ptr -> xyz[ 0 ], ptr -> xyz[ 1 ], ptr -> xyz[ 2 ]};
+ gluTessVertex ( tripak, v, ( void* )i );
+ }
+#endif /* WNT */
+ }
+ gluTessEndContour( tripak );
+ gluTessEndPolygon( tripak );
+ endtriangulate();
+ }
+ else
+ {
+ if( front_lighting_model )
+ {
+ draw_tmesh( pvn? 3 : 1 );
+ }
+ else
+ {
+ draw_tmesh( pvc? 2 : 1 );
+ }
+ }
+
+ if( myData.reverse_order ) glFrontFace( GL_CCW );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Polygon::draw_edges (const TEL_COLOUR *edge_colour, const Aspect_InteriorStyle interior_style, const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True );
+
+ if ( interior_style != Aspect_IS_HIDDENLINE && aspect_face->Context().Edge == TOff )
+ return;
+
+ glDisable(GL_LIGHTING);
+ const GLboolean texture_on = IsTextureEnabled();
+ if (texture_on) DisableTexture();
+
+ // Setup line aspect
+ const OpenGl_AspectLine *aspect_line_old = AWorkspace->SetAspectLine( aspect_face->AspectEdge() );
+ AWorkspace->AspectLine( Standard_True );
+
+ Tint i;
+ tel_point ptr = myData.vertices;
+
+ glColor3fv( edge_colour->rgb );
+
+ glBegin(GL_LINE_LOOP);
+ for( i=0; i<myData.num_vertices; i++, ptr++ )
+ {
+ glVertex3fv( ptr->xyz );
+ }
+ glEnd();
+
+ // Restore line context
+ AWorkspace->SetAspectLine( aspect_line_old );
+
+ if (texture_on) EnableTexture();
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Polygon::draw_tmesh ( Tint v ) const
+{
+ Tint i, j, k;
+ SEQ_ *s;
+ extra_vertex b;
+
+ OPENGL_DISPLAY_PGN *dis = myData.dsply;
+ for( i = 0; i < dis->num_of_seq; i++ )
+ {
+ s = &(dis->seq[i]);
+
+ glBegin(s->triangle_type);
+ switch( v )
+ {
+ case 1:
+ {
+ for( j = 0, k = 0; j < s->ts_num; j++ )
+ {
+ if ( s->tmesh_sequence[j] < (void *)0xffff )
+ glVertex3fv( myData.vertices[ (long)s->tmesh_sequence[ j ] ].xyz );
+ else {
+ extra_vertex b = (extra_vertex)s->tmesh_sequence[j];
+ glVertex3fv( b->vert );
+ }
+
+ }
+ break;
+ }
+ case 2:
+ {
+ for( j = 0, k = 0; j < s->ts_num; j++ )
+ {
+ if ( s->tmesh_sequence[j] < (void *)0xffff ) {
+ glColor3fv( myData.vcolours[ (long) s->tmesh_sequence[ j ] ].rgb );
+ glVertex3fv( myData.vertices[ (long) s->tmesh_sequence[ j ] ].xyz );
+ } else {
+ b = (extra_vertex) s->tmesh_sequence[j];
+ glColor3fv( myData.vcolours[(b->ind)].rgb);
+ glVertex3fv( b->vert );
+ }
+ }
+ break;
+ }
+ case 3:
+ {
+ for( j = 0, k = 0; j < s->ts_num; j++ )
+ {
+ if ( s->tmesh_sequence[j] < (void *)0xffff ) {
+ glNormal3fv( myData.vnormals[ (long) s->tmesh_sequence[ j ] ].xyz);
+ glVertex3fv( myData.vertices[ (long) s->tmesh_sequence[ j ] ].xyz);
+ } else {
+ b = (extra_vertex) s->tmesh_sequence[j];
+ glNormal3fv( myData.vnormals[(b->ind)].xyz);
+ glVertex3fv( b->vert );
+ }
+ }
+ break;
+ }
+ }
+ glEnd();
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Polygon::OpenGl_Polygon (const Graphic3d_Array1OfVertex& AListVertex,
+ const Graphic3d_TypeOfPolygon AType)
+{
+ const Standard_Integer nv = AListVertex.Length();
+
+ myData.num_vertices = nv;
+
+ myData.vertices = new TEL_POINT[nv];
+ memcpy( myData.vertices, &AListVertex(AListVertex.Lower()), nv*sizeof(TEL_POINT) );
+
+ myData.vertex_flag = TEL_VT_NONE;
+ myData.vnormals = NULL;
+
+ myData.vcolours = NULL;
+
+ myData.vtexturecoord = NULL;
+
+ myData.reverse_order = 0;
+
+ myData.facet_flag = TEL_FA_NONE;
+ TelGetPolygonNormal( myData.vertices, NULL, nv, myData.fnormal.xyz );
+
+ myData.fcolour = NULL;
+
+#if defined(__sgi) || defined(IRIX)
+ // Pb with tesselator on sgi
+ myData.shape_flag = TEL_SHAPE_CONVEX;
+#else
+ switch (AType)
+ {
+ case Graphic3d_TOP_UNKNOWN :
+ myData.shape_flag = TEL_SHAPE_UNKNOWN;
+ break;
+ case Graphic3d_TOP_COMPLEX :
+ myData.shape_flag = TEL_SHAPE_COMPLEX;
+ break;
+ case Graphic3d_TOP_CONCAVE :
+ myData.shape_flag = TEL_SHAPE_CONCAVE;
+ break;
+ //case Graphic3d_TOP_CONVEX :
+ default :
+ myData.shape_flag = TEL_SHAPE_CONVEX;
+ break;
+ }
+#endif
+
+ myData.dsply = new OPENGL_DISPLAY_PGN();
+ myData.dsply->num_of_seq = 0;
+ myData.dsply->num_alloc = 0;
+ myData.dsply->seq = NULL;
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Polygon::~OpenGl_Polygon ()
+{
+ if( myData.fcolour )
+ delete myData.fcolour;
+ if( myData.vertices )
+ delete[] myData.vertices;
+ if( myData.vcolours )
+ delete[] myData.vcolours;
+ if( myData.vnormals )
+ delete[] myData.vnormals;
+ if ( myData.vtexturecoord )
+ delete myData.vtexturecoord;
+
+ if ( myData.dsply )
+ {
+ Tint i, j;
+
+ for( i = 0; i < myData.dsply->num_of_seq; i++ )
+ {
+ if(myData.dsply->seq[i].tmesh_sequence) {
+ for ( j = 0; j < myData.dsply->seq[i].ts_num ; j++ ) {
+ if ( myData.dsply->seq[i].tmesh_sequence[j] >= (void *)0xffff )
+ free(myData.dsply->seq[i].tmesh_sequence[j]);
+ }
+ }
+ delete[] myData.dsply->seq[i].tmesh_sequence;
+ }
+ delete[] myData.dsply->seq;
+ delete myData.dsply;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Polygon::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True );
+
+ Tint front_lighting_model = aspect_face->Context().IntFront.color_mask;
+ const Aspect_InteriorStyle interior_style = aspect_face->Context().InteriorStyle;
+ const TEL_COLOUR *interior_colour = &aspect_face->Context().IntFront.matcol;
+ const TEL_COLOUR *edge_colour = &aspect_face->AspectEdge()->Color();
+
+ // Use highlight colous
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ {
+ edge_colour = interior_colour = AWorkspace->HighlightColor;
+ front_lighting_model = 0;
+ }
+
+ if( interior_style != Aspect_IS_EMPTY && AWorkspace->DegenerateModel < 2 )
+ {
+ if ( front_lighting_model )
+ glEnable(GL_LIGHTING);
+ else
+ glDisable(GL_LIGHTING);
+
+ glColor3fv( interior_colour->rgb );
+
+ if( myData.shape_flag != TEL_SHAPE_CONVEX )
+ draw_polygon_concav( AWorkspace, front_lighting_model );
+ else
+ draw_polygon( AWorkspace, front_lighting_model );
+ }
+
+ /* OCC11904 -- Temporarily disable environment mapping */
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_TEXTURE_1D);
+ glDisable(GL_TEXTURE_2D);
+
+ switch ( AWorkspace->DegenerateModel )
+ {
+ default:
+ draw_edges ( edge_colour, interior_style, AWorkspace );
+ break;
+ case 3: /* marker degeneration */
+ break;
+ }
+
+ glPopAttrib(); /* skt: GL_ENABLE_BIT*/
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Polygon.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_Polygon_Header
+#define OpenGl_Polygon_Header
+
+#include <InterfaceGraphic_telem.hxx>
+#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_TypeOfPolygon.hxx>
+#include <Aspect_InteriorStyle.hxx>
+
+#include <OpenGl_Element.hxx>
+
+struct OPENGL_DISPLAY_PGN;
+
+struct TEL_POLYGON_DATA
+{
+ Tint num_vertices; /* Number of vertices */
+ Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */
+ Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */
+ Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or
+ TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */
+ Tint reverse_order; /* 1 if polygon vertex must be display in reverse order */
+ TEL_POINT fnormal; /* Facet normal */
+ tel_colour fcolour; /* Facet colour */
+ tel_point vertices; /* Vertices */
+ tel_colour vcolours; /* Vertex colour values */
+ tel_point vnormals; /* Vertex normals */
+ tel_texture_coord vtexturecoord; /* Texture Coordinates */
+ OPENGL_DISPLAY_PGN *dsply;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+class OpenGl_Polygon : public OpenGl_Element
+{
+ public:
+
+ OpenGl_Polygon (const Graphic3d_Array1OfVertex& AListVertex,
+ const Graphic3d_TypeOfPolygon AType);
+ virtual ~OpenGl_Polygon ();
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ void draw_polygon_concav (const Handle(OpenGl_Workspace) &AWorkspace, Tint) const;
+
+ void draw_polygon (const Handle(OpenGl_Workspace) &AWorkspace, Tint) const;
+
+ void draw_tmesh (Tint) const;
+
+ void draw_edges (const TEL_COLOUR *, const Aspect_InteriorStyle, const Handle(OpenGl_Workspace) &) const;
+
+ TEL_POLYGON_DATA myData;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_Polygon_Header
--- /dev/null
+// File: OpenGl_Polyline.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Polyline.hxx>
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <OpenGl_AspectLine.hxx>
+#include <OpenGl_Structure.hxx>
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Polyline::OpenGl_Polyline (const Graphic3d_Array1OfVertex& AListVertex)
+: myNbVertices(AListVertex.Length()),
+ myVertices(NULL),
+ myColors(NULL)
+{
+ myVertices = new TEL_POINT[myNbVertices];
+ memcpy( myVertices, &AListVertex(AListVertex.Lower()), myNbVertices*sizeof(TEL_POINT) );
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Polyline::OpenGl_Polyline (const Graphic3d_Array1OfVertexC& AListVertex)
+: myNbVertices(AListVertex.Length()),
+ myVertices(NULL),
+ myColors(NULL)
+{
+ myVertices = new TEL_POINT[myNbVertices];
+ myColors = new TEL_COLOUR[myNbVertices];
+
+ Standard_Integer i = 0, j = AListVertex.Lower();
+ Standard_Real X, Y, Z;
+ for ( ; i < myNbVertices; i++, j++)
+ {
+ AListVertex(j).Coord(X, Y, Z);
+ myVertices[i].xyz[0] = float (X);
+ myVertices[i].xyz[1] = float (Y);
+ myVertices[i].xyz[2] = float (Z);
+ AListVertex(j).Color().Values(X, Y, Z, Quantity_TOC_RGB);
+ myColors[i].rgb[0] = float (X);
+ myColors[i].rgb[1] = float (Y);
+ myColors[i].rgb[2] = float (Z);
+ myColors[i].rgb[3] = 1.0F;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Polyline::OpenGl_Polyline (const Standard_Real X1,const Standard_Real Y1,const Standard_Real Z1,
+ const Standard_Real X2,const Standard_Real Y2,const Standard_Real Z2)
+: myNbVertices(2),
+ myVertices(new TEL_POINT[2]),
+ myColors(NULL)
+{
+ myVertices[0].xyz[0] = float (X1);
+ myVertices[0].xyz[1] = float (Y1);
+ myVertices[0].xyz[2] = float (Z1);
+ myVertices[1].xyz[0] = float (X2);
+ myVertices[1].xyz[1] = float (Y2);
+ myVertices[1].xyz[2] = float (Z2);
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Polyline::~OpenGl_Polyline ()
+{
+ if ( myVertices )
+ delete[] myVertices;
+ if( myColors )
+ delete[] myColors;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Polyline::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
+{
+ // Apply line aspect
+ const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True);
+
+ // Temporarily disable environment mapping
+ glPushAttrib (GL_ENABLE_BIT);
+ glDisable (GL_TEXTURE_1D);
+ glDisable (GL_TEXTURE_2D);
+
+ glBegin (theWorkspace->DegenerateModel != 3 ? GL_LINE_STRIP : GL_POINTS);
+ if (!myColors || (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT))
+ {
+ // Use highlight colors
+ glColor3fv ((theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) ? theWorkspace->HighlightColor->rgb : anAspectLine->Color().rgb);
+
+ for (Tint i = 0; i < myNbVertices; ++i)
+ glVertex3fv (myVertices[i].xyz);
+ }
+ else
+ {
+ for (Tint i = 0; i < myNbVertices; ++i)
+ {
+ glColor3fv (myColors[i].rgb);
+ glVertex3fv (myVertices[i].xyz);
+ }
+ }
+ glEnd();
+
+ glPopAttrib();
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Polyline.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_Polyline_Header
+#define OpenGl_Polyline_Header
+
+#include <InterfaceGraphic_telem.hxx>
+
+#include <OpenGl_Element.hxx>
+
+#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_Array1OfVertexC.hxx>
+
+class OpenGl_Polyline : public OpenGl_Element
+{
+ public:
+
+ OpenGl_Polyline (const Graphic3d_Array1OfVertex& AListVertex);
+ OpenGl_Polyline (const Graphic3d_Array1OfVertexC& AListVertex);
+ OpenGl_Polyline (const Standard_Real X1,const Standard_Real Y1,const Standard_Real Z1,
+ const Standard_Real X2,const Standard_Real Y2,const Standard_Real Z2);
+ virtual ~OpenGl_Polyline ();
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ Tint myNbVertices; // Number of vertices in vertices array
+ tel_point myVertices; // Vertices array of length myNbVertices
+ tel_colour myColors; // Vertex color values for each vertex
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_Polyline_Header
-/*
-File OpenGl_PrimitiveArray.c
-
-Created 16/06/2000 : ATS : G005 : Modified version of OpenGl_indexpolygons.c, which use glDrawArrays or glDrawElements for rendering of primitive
-21.06.03 : SAN : suppress display at all in animation mode if degenartion ratio == 1 (FULL_DEGENER)
-03.07.03 : SAN : draw_degenerates_as_lines() function - all client states disabled except GL_VERTEX_ARRAY
-in order to avoid exceptions in animation mode (OCC3192)
-*/
-
-#define xOGLBUG /* UNFORTUNATLY the edge flags are attached to vertexes
-and not to the edges. So the edge visibillity flags array
-is not usable.
-*/
-
-#define xPRINT
-
-#define TEST
-
-#define FULL_DEGENER
-#define OCC3192
-
-
-#ifndef OGL_Max
-#define OGL_Max(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-#ifndef OGL_Rand
-static unsigned long vRand = 1L;
-#define OGL_Rand() (vRand = vRand * 214013L + 2531011L)
-#endif
-
-
-#define OCC7833 /* ASL 26/01/05 transparency of polygon with colors assigned to vertices */
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
+// File: OpenGl_PrimitiveArray.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
#include <OpenGl_tgl_all.hxx>
+#include <OpenGl_PrimitiveArray.hxx>
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#include <iostream>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_TextureBox.hxx>
+#include <OpenGl_AspectFace.hxx>
+#include <OpenGl_GraphicDriver.hxx>
+#include <OpenGl_Memory.hxx>
#include <OpenGl_ResourceCleaner.hxx>
#include <OpenGl_ResourceVBO.hxx>
+#include <OpenGl_Structure.hxx>
+#include <OpenGl_TextureBox.hxx>
+
#include <InterfaceGraphic_PrimitiveArray.hxx>
-#include <OpenGl_Memory.hxx>
-#include <Standard.hxx>
-
-# include <float.h>
-# define DEF_DS_INTERNAL
-# include <OpenGl_degeneration.hxx>
-
-#include <OpenGl_Extension.hxx>
-
-extern GLboolean g_fBitmap;
-
-typedef CALL_DEF_PARRAY *call_def_parray;
-
-#define GL_ARRAY_BUFFER_ARB 0x8892
-#define GL_STATIC_DRAW_ARB 0x88E4
-#define GL_ELEMENTS_ARRAY_BUFFER_ARB 0x8893
-#define GL_EDGE_FLAG_ARRAY_EXT 0x8079
-
-#ifdef WNT
-typedef void (APIENTRY* PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
-typedef void (APIENTRY* PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
-typedef void (APIENTRY* PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
-typedef void (APIENTRY* PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage);
-#else//WNT
-typedef void (*PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
-typedef void (*PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
-typedef void (*PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
-#if defined ( __sgi )
-typedef void (*PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage);
-#else
-typedef void (*PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
-#endif
-
-#endif//WNT
-
-PFNGLGENBUFFERSARBPROC glVBOGenBuffersARB = NULL; // VBO Name Generation Procedure
-PFNGLBINDBUFFERARBPROC glVBOBindBufferARB = NULL; // VBO Bind Procedure
-PFNGLBUFFERDATAARBPROC glVBOBufferDataARB = NULL; // VBO Data Loading Procedure
-PFNGLDELETEBUFFERSARBPROC glVBODeleteBuffersARB = NULL; // VBO Data Deleting Procedure
-
-int VBOExtension = 0;
-int VBOenabled = 1;
-
-#define VBO_NOT_INITIALIZED -1
-#define VBO_ERROR 0
-#define VBO_OK 1
-
-#ifndef WNT
-#define glGetProcAddress( x ) glXGetProcAddress( (const GLubyte*) x )
-#else
-#define glGetProcAddress( x ) wglGetProcAddress( x )
-#endif
-
-void clearRAMMemory( CALL_DEF_PARRAY* p )
+
+enum
{
- if( p->bufferVBO[VBOEdges] ){
- Standard::Free((Standard_Address&)p->edges);
- p->edges = NULL;
- }
- if( p->bufferVBO[VBOVertices] ){
- Standard::Free((Standard_Address&)p->vertices);
- p->vertices = NULL;
- }
- if( p->bufferVBO[VBOVcolours] ){
- Standard::Free((Standard_Address&)p->vcolours);
- p->vcolours = NULL;
- }
- if( p->bufferVBO[VBOVnormals] ){
- Standard::Free((Standard_Address&)p->vnormals);
- p->vnormals = NULL;
- }
- if( p->bufferVBO[VBOVtexels] ){
- Standard::Free((Standard_Address&)p->vtexels);
- p->vtexels = NULL;
- }
- if( p->edge_vis ){
- Standard::Free((Standard_Address&)p->edge_vis);
- p->edge_vis = NULL;
- }
-}
+ VBO_NOT_INITIALIZED = -1,
+ VBO_ERROR = 0,
+ VBO_OK = 1
+};
+
+namespace
+{
+ static unsigned long vRand = 1L;
+ #define OGL_Rand() (vRand = vRand * 214013L + 2531011L)
+};
-void clearGraphicRAMMemory( CALL_DEF_PARRAY* p )
+// =======================================================================
+// function : clearMemoryOwn
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::clearMemoryOwn() const
{
- if( p->bufferVBO[VBOEdges] ){
- glVBODeleteBuffersARB( 1 , &p->bufferVBO[VBOEdges]);
+ if (myPArray->bufferVBO[VBOEdges] != 0)
+ {
+ Standard::Free ((Standard_Address& )myPArray->edges);
+ myPArray->edges = NULL;
}
- if( p->bufferVBO[VBOVertices] ){
- glVBODeleteBuffersARB( 1 , &p->bufferVBO[VBOVertices]);
+ if (myPArray->bufferVBO[VBOVertices] != 0)
+ {
+ Standard::Free ((Standard_Address& )myPArray->vertices);
+ myPArray->vertices = NULL;
}
- if( p->bufferVBO[VBOVcolours] ){
- glVBODeleteBuffersARB( 1 , &p->bufferVBO[VBOVcolours]);
+ if (myPArray->bufferVBO[VBOVcolours] != 0)
+ {
+ Standard::Free ((Standard_Address& )myPArray->vcolours);
+ myPArray->vcolours = NULL;
}
- if( p->bufferVBO[VBOVnormals] ){
- glVBODeleteBuffersARB( 1 , &p->bufferVBO[VBOVnormals]);
- }
- if( p->bufferVBO[VBOVtexels] ){
- glVBODeleteBuffersARB( 1 , &p->bufferVBO[VBOVtexels]);
+ if (myPArray->bufferVBO[VBOVnormals] != 0)
+ {
+ Standard::Free ((Standard_Address& )myPArray->vnormals);
+ myPArray->vnormals = NULL;
+ }
+ if (myPArray->bufferVBO[VBOVtexels] != 0)
+ {
+ Standard::Free ((Standard_Address& )myPArray->vtexels);
+ myPArray->vtexels = NULL;
+ }
+ if (myPArray->edge_vis != NULL) /// ????
+ {
+ Standard::Free ((Standard_Address& )myPArray->edge_vis);
+ myPArray->edge_vis = NULL;
}
- glVBOBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
- glVBOBindBufferARB(GL_ELEMENTS_ARRAY_BUFFER_ARB, 0);
}
-int checkSizeForGraphicMemory( CALL_DEF_PARRAY* p )
+// =======================================================================
+// function : clearMemoryGL
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::clearMemoryGL (const Handle(OpenGl_Context)& theGlContext) const
{
- if( GL_OUT_OF_MEMORY == glGetError() ){
- p->flagBufferVBO = VBO_ERROR;
- clearGraphicRAMMemory(p);
+ if (myPArray->bufferVBO[VBOEdges] != 0)
+ {
+ theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOEdges]);
+ }
+ if (myPArray->bufferVBO[VBOVertices] != 0)
+ {
+ theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOVertices]);
+ }
+ if (myPArray->bufferVBO[VBOVcolours] != 0)
+ {
+ theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOVcolours]);
}
- else
- p->flagBufferVBO = VBO_OK;
- return p->flagBufferVBO ;
+ if (myPArray->bufferVBO[VBOVnormals] != 0)
+ {
+ theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOVnormals]);
+ }
+ if (myPArray->bufferVBO[VBOVtexels] != 0)
+ {
+ theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOVtexels]);
+ }
+ theGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0);
+ theGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, 0);
}
-int initVBO()
+// =======================================================================
+// function : checkSizeForGraphicMemory
+// purpose :
+// =======================================================================
+Standard_Boolean OpenGl_PrimitiveArray::checkSizeForGraphicMemory (const Handle(OpenGl_Context)& theGlContext) const
{
- if(CheckExtension((char *)"GL_ARB_vertex_buffer_object",(const char *)glGetString( GL_EXTENSIONS ))){
- glVBOGenBuffersARB = (PFNGLGENBUFFERSARBPROC) glGetProcAddress("glGenBuffersARB");
- glVBOBindBufferARB = (PFNGLBINDBUFFERARBPROC) glGetProcAddress("glBindBufferARB");
- glVBOBufferDataARB = (PFNGLBUFFERDATAARBPROC) glGetProcAddress("glBufferDataARB");
- glVBODeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) glGetProcAddress("glDeleteBuffersARB");
- VBOExtension = 1;
- return 1;
- }
- return 0;
+ if (glGetError() == GL_OUT_OF_MEMORY)
+ {
+ myPArray->flagBufferVBO = VBO_ERROR;
+ clearMemoryGL (theGlContext);
+ }
+ else
+ {
+ myPArray->flagBufferVBO = VBO_OK;
+ }
+ return myPArray->flagBufferVBO == VBO_OK;
}
-static void BuildVBO( CALL_DEF_PARRAY* p )
+// =======================================================================
+// function : BuildVBO
+// purpose :
+// =======================================================================
+Standard_Boolean OpenGl_PrimitiveArray::BuildVBO (const Handle(OpenGl_Workspace)& theWorkspace) const
{
int size_reqd = 0;
- if( p->edges ){
- size_reqd = ( p->num_edges * sizeof( Tint ) );
- glVBOGenBuffersARB( 1, &p->bufferVBO[VBOEdges] );
- glVBOBindBufferARB( GL_ELEMENTS_ARRAY_BUFFER_ARB, p->bufferVBO[VBOEdges] );
- glVBOBufferDataARB( GL_ELEMENTS_ARRAY_BUFFER_ARB, size_reqd , p->edges, GL_STATIC_DRAW_ARB );
- if( checkSizeForGraphicMemory( p ) == VBO_ERROR )
- return;
+ const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext();
+ if (myPArray->edges != NULL)
+ {
+ size_reqd = myPArray->num_edges * sizeof(Tint);
+ aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOEdges]);
+ aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]);
+ aGlContext->arbVBO->glBufferDataARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, size_reqd, myPArray->edges, GL_STATIC_DRAW_ARB);
+ if (!checkSizeForGraphicMemory (aGlContext))
+ return Standard_False;
}
- if( p->vertices ){
- size_reqd = ( p->num_vertexs * sizeof( TEL_POINT ) );
- glVBOGenBuffersARB( 1, &p->bufferVBO[VBOVertices]);
- glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVertices] );
- glVBOBufferDataARB( GL_ARRAY_BUFFER_ARB, size_reqd , p->vertices, GL_STATIC_DRAW_ARB );
- if( checkSizeForGraphicMemory( p ) == VBO_ERROR )
- return;
+ if (myPArray->vertices != NULL)
+ {
+ size_reqd = myPArray->num_vertexs * sizeof(TEL_POINT);
+ aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOVertices]);
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVertices]);
+ aGlContext->arbVBO->glBufferDataARB (GL_ARRAY_BUFFER_ARB, size_reqd, myPArray->vertices, GL_STATIC_DRAW_ARB);
+ if (!checkSizeForGraphicMemory (aGlContext))
+ return Standard_False;
}
- if( p->vcolours ){
- size_reqd = ( p->num_vertexs * sizeof( Tint ) );
- glVBOGenBuffersARB( 1, &p->bufferVBO[VBOVcolours] );
- glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVcolours]);
- glVBOBufferDataARB( GL_ARRAY_BUFFER_ARB, size_reqd , p->vcolours, GL_STATIC_DRAW_ARB );
- if( checkSizeForGraphicMemory( p ) == VBO_ERROR )
- return;
+ if (myPArray->vcolours != NULL)
+ {
+ size_reqd = myPArray->num_vertexs * sizeof(Tint);
+ aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOVcolours]);
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVcolours]);
+ aGlContext->arbVBO->glBufferDataARB (GL_ARRAY_BUFFER_ARB, size_reqd, myPArray->vcolours, GL_STATIC_DRAW_ARB);
+ if (!checkSizeForGraphicMemory (aGlContext))
+ return Standard_False;
}
- if( p->vnormals ){
- size_reqd = ( p->num_vertexs * sizeof( TEL_POINT ) );
- glVBOGenBuffersARB( 1, &p->bufferVBO[VBOVnormals] );
- glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVnormals] );
- glVBOBufferDataARB( GL_ARRAY_BUFFER_ARB, size_reqd , p->vnormals, GL_STATIC_DRAW_ARB );
- if( checkSizeForGraphicMemory( p ) == VBO_ERROR)
- return;
+ if (myPArray->vnormals != NULL)
+ {
+ size_reqd = myPArray->num_vertexs * sizeof(TEL_POINT);
+ aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOVnormals]);
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVnormals]);
+ aGlContext->arbVBO->glBufferDataARB (GL_ARRAY_BUFFER_ARB, size_reqd, myPArray->vnormals, GL_STATIC_DRAW_ARB);
+ if (!checkSizeForGraphicMemory (aGlContext))
+ return Standard_False;
}
- if( p->vtexels ){
- size_reqd = ( p->num_vertexs * sizeof( TEL_TEXTURE_COORD ) );
- glVBOGenBuffersARB( 1, &p->bufferVBO[VBOVtexels] );
- glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVtexels] );
- glVBOBufferDataARB( GL_ARRAY_BUFFER_ARB, size_reqd , p->vtexels , GL_STATIC_DRAW_ARB );
- if( checkSizeForGraphicMemory( p ) == VBO_ERROR )
- return;
- }
-
- if( p->flagBufferVBO == VBO_OK )
- clearRAMMemory(p);
-
- //specify context for VBO resource
- p->contextId = (Standard_Address)GET_GL_CONTEXT();
-
-}
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes
-*/
-
-static TStatus ParrayDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ParrayAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ParrayDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ParrayPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ParrayInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*static GLboolean lighting_mode;*/
-
-static void draw_array(
- call_def_parray,
- Tint, /* highlight_flag */
- Tint, /* front_lighting_model, */
- Tint, /* interior_style, */
- Tint, /* edge_flag, */
- tel_colour, /* interior_colour, */
- tel_colour, /* line_colour, */
- tel_colour /* edge_colour, */
-#ifdef OCC7833
- ,tel_surf_prop
-#endif
- );
-
-static void draw_edges ( call_def_parray, tel_colour );
-static void draw_degenerates_as_points ( call_def_parray, tel_colour );
-static void draw_degenerates_as_lines ( call_def_parray, tel_colour );
-static void draw_degenerates_as_bboxs ( call_def_parray, tel_colour );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- NULL, /* PickTraverse */
- ParrayDisplay,
- ParrayAdd,
- ParrayDelete,
- 0,
- 0
-};
-static GLenum draw_mode;
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */
-
-extern int g_nDegenerateModel;
-extern float g_fSkipRatio;
+ if (myPArray->vtexels)
+ {
+ size_reqd = myPArray->num_vertexs * sizeof(TEL_TEXTURE_COORD);
+ aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOVtexels]);
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVtexels]);
+ aGlContext->arbVBO->glBufferDataARB (GL_ARRAY_BUFFER_ARB, size_reqd, myPArray->vtexels, GL_STATIC_DRAW_ARB);
+ if (!checkSizeForGraphicMemory (aGlContext))
+ return Standard_False;
+ }
-/*----------------------------------------------------------------------*/
+ if (myPArray->flagBufferVBO == VBO_OK)
+ clearMemoryOwn();
-MtblPtr
-TelParrayInitClass( TelType* el )
-{
- *el = TelParray;
- return MtdTbl;
+ // specify context for VBO resource
+ myPArray->contextId = (Standard_Address )theWorkspace->GetGContext();
+ return Standard_True;
}
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ParrayAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
+// =======================================================================
+// function : DrawArrays
+// purpose : Auxiliary method to split Feedback/Normal rendering modes
+// =======================================================================
+inline void DrawArrays (const Handle(OpenGl_Workspace)& theWorkspace,
+ const CALL_DEF_PARRAY* thePArray,
+ const Standard_Boolean theIsFeedback,
+ GLenum theMode,
+ GLint theFirst,
+ GLsizei theCount)
{
+ if (!theIsFeedback)
+ {
+ glDrawArrays (theMode, theFirst, theCount);
+ return;
+ }
- if( k[0]->id != PARRAY_ID ) return TFailure;
-
- ((tsm_elem_data)(d.pdata))->pdata = k[0]->data.pdata;
-
- return TSuccess;
+ glBegin (theMode);
+ for (int anIter = theFirst; anIter < (theFirst + theCount); ++anIter)
+ {
+ if (thePArray->vnormals != NULL)
+ glNormal3fv (thePArray->vnormals[anIter].xyz);
+ if (thePArray->vtexels != NULL && (theWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0)
+ glTexCoord3fv (thePArray->vtexels[anIter].xy);
+ if (thePArray->vertices != NULL)
+ glVertex3fv (thePArray->vertices[anIter].xyz);
+ if (thePArray->vcolours != NULL)
+ glColor4ubv((GLubyte* )thePArray->vcolours[anIter]);
+ }
+ glEnd();
}
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ParrayDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
+// =======================================================================
+// function : DrawElements
+// purpose : Auxiliary method to split Feedback/Normal rendering modes
+// =======================================================================
+inline void DrawElements (const Handle(OpenGl_Workspace)& theWorkspace,
+ const CALL_DEF_PARRAY* thePArray,
+ const Standard_Boolean theIsFeedback,
+ GLenum theMode,
+ GLsizei theCount,
+ GLenum* theIndices)
{
- CMN_KEY k11, k12, k17, k18, k111, k114, k115;
-
- Tint front_lighting_model;
- Tint interior_style;
- TEL_COLOUR interior_colour;
- TEL_COLOUR edge_colour;
- TEL_COLOUR line_colour;
- Tint edge_flag;
-
-#ifdef OCC7833
- CMN_KEY k117;
- TEL_SURF_PROP prop;
-#endif
-
- call_def_parray d = (call_def_parray)data.pdata;
-
- k12.id = TelInteriorReflectanceEquation;
- k17.id = TelInteriorStyle;
- k18.id = TelEdgeFlag;
- k111.id = TelInteriorColour;
- k111.data.pdata = &interior_colour;
- k114.id = TelEdgeColour;
- k114.data.pdata = &edge_colour;
- k115.id = TelPolylineColour;
- k115.data.pdata = &line_colour;
-
-#ifdef OCC7833
- k117.id = TelSurfaceAreaProperties;
- k117.data.pdata = ∝
-#endif
-
-#ifdef OCC7833
- TsmGetAttri( 7, &k12, &k17, &k18, &k111, &k114, &k115, &k117 );
-#else
- TsmGetAttri( 6, &k12, &k17, &k18, &k111, &k114, &k115 );
-#endif
-
- front_lighting_model = k12.data.ldata;
- interior_style = k17.data.ldata;
- edge_flag = k18.data.ldata;
-
-#ifdef PRINT
- printf("ParrayDisplay type %d\n",d->type);
-#endif
-
- /*
- * Use highlight colours
- */
-
- if( k[0]->id == TOn ) {
- TEL_HIGHLIGHT hrep;
-
- k11.id = TelHighlightIndex;
- TsmGetAttri( 1, &k11 );
- if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep ) == TSuccess ) {
- if( hrep.type == TelHLForcedColour ) {
- edge_colour = interior_colour = line_colour = hrep.col;
- front_lighting_model = CALL_PHIGS_REFL_NONE;
- } else if( hrep.type == TelHLColour ) {
- edge_colour = hrep.col;
- k[0]->id = TOff;
- }
- } else {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- if( hrep.type == TelHLForcedColour ) {
- edge_colour = interior_colour = line_colour = hrep.col;
- front_lighting_model = CALL_PHIGS_REFL_NONE;
- } else if( hrep.type == TelHLColour ) {
- edge_colour = hrep.col;
- k[0]->id = TOff;
- }
- }
+ if (!theIsFeedback)
+ {
+ glDrawElements (theMode, theCount, GL_UNSIGNED_INT, theIndices);
+ return;
}
- draw_array( d, k[0]->id,
- front_lighting_model,
- interior_style,
- edge_flag,
- &interior_colour,
- &line_colour,
- &edge_colour
-#ifdef OCC7833
- ,&prop
-#endif
- );
-
- return TSuccess;
-
-}
-
-/*----------------------------------------------------------------------*/
-
-static void
-draw_primitive_array( call_def_parray p, GLenum mode, GLint first, GLsizei count )
-{
- int i;
- glBegin( mode );
- for( i=first; i<(first + count); i++ ){
- if( p->vnormals )
- glNormal3fv( p->vnormals[i].xyz );
- if( p->vtexels && !ForbidSetTextureMapping )
- glTexCoord3fv( p->vtexels[i].xy );
- if( p->vertices )
- glVertex3fv( p->vertices[i].xyz );
- if ( p->vcolours )
- glColor4ubv( (GLubyte*) p->vcolours[i] );
+ GLenum anIndex;
+ glBegin (theMode);
+ for (GLsizei anIter = 0; anIter < theCount; ++anIter)
+ {
+ anIndex = theIndices[anIter];
+ if (thePArray->vnormals != NULL)
+ glNormal3fv (thePArray->vnormals[anIndex].xyz);
+ if (thePArray->vtexels != NULL && (theWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0)
+ glTexCoord3fv (thePArray->vtexels[anIndex].xy);
+ if (thePArray->vertices != NULL)
+ glVertex3fv (thePArray->vertices[anIndex].xyz);
+ if (thePArray->vcolours != NULL)
+ glColor4ubv ((GLubyte* )thePArray->vcolours[anIndex]);
}
glEnd();
}
-/*----------------------------------------------------------------------*/
-static void
-draw_primitive_elements( call_def_parray p, GLenum mode, GLsizei count, GLenum type, GLenum *indices )
+// =======================================================================
+// function : DrawArray
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawArray (Tint theLightingModel,
+ const Aspect_InteriorStyle theInteriorStyle,
+ Tint theEdgeFlag,
+ const TEL_COLOUR* theInteriorColour,
+ const TEL_COLOUR* theLineColour,
+ const TEL_COLOUR* theEdgeColour,
+ const OPENGL_SURF_PROP* theFaceProp,
+ const Handle(OpenGl_Workspace)& theWorkspace) const
{
- int i;
- GLenum index;
- glBegin( mode );
- for( i=0; i<count; i++ ){
- index = indices[i];
- if( p->vnormals )
- glNormal3fv( p->vnormals[index].xyz );
- if( p->vtexels && !ForbidSetTextureMapping )
- glTexCoord3fv( p->vtexels[index].xy );
- if( p->vertices )
- glVertex3fv( p->vertices[index].xyz );
- if ( p->vcolours )
- glColor4ubv( (GLubyte*) p->vcolours[index] );
- }
- glEnd();
-}
-/*----------------------------------------------------------------------*/
-static void
-draw_array( call_def_parray p, Tint hflag,
- Tint lighting_model,
- Tint interior_style,
- Tint edge_flag,
- tel_colour interior_colour,
- tel_colour line_colour,
- tel_colour edge_colour
-#ifdef OCC7833
- ,tel_surf_prop prop
-#endif
- ){
+ const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext();
+
Tint i,n;
Tint transp = 0;
GLint renderMode;
- /* Following pointers have been provided for performance improvement */
- tel_colour pfc;
- Tint * pvc;
-
- pvc = p->vcolours;
- pfc = p->fcolours;
-
-#ifdef OCC7833
- if( pvc ){
- for( i=0; i<p->num_vertexs; i++ ){
- transp = (int)(prop->trans * 255.);
-#if defined (sparc) || defined (__sparc__) || defined (__sparc)
- pvc[i] = ( pvc[i] & 0xffffff00 );
- pvc[i] += transp ;
-
-#else
- pvc[i] = ( pvc[i] & 0x00ffffff );
+ // Following pointers have been provided for performance improvement
+ tel_colour pfc = myPArray->fcolours;
+ Tint* pvc = myPArray->vcolours;
+ if (pvc != NULL)
+ {
+ for (i = 0; i < myPArray->num_vertexs; ++i)
+ {
+ transp = int(theFaceProp->trans * 255.0f);
+ #if defined (sparc) || defined (__sparc__) || defined (__sparc)
+ pvc[i] = (pvc[i] & 0xffffff00);
+ pvc[i] += transp;
+ #else
+ pvc[i] = (pvc[i] & 0x00ffffff);
pvc[i] += transp << 24;
-#endif
+ #endif
}
}
-#endif
- switch( p->type ) {
+ switch (myPArray->type)
+ {
case TelPointsArrayType:
- draw_mode = GL_POINTS;
- glColor3fv( line_colour->rgb );
- break;
case TelPolylinesArrayType:
- draw_mode = GL_LINE_STRIP;
- glColor3fv( line_colour->rgb );
- break;
case TelSegmentsArrayType:
- draw_mode = GL_LINES;
- glColor3fv( line_colour->rgb );
+ glColor3fv (theLineColour->rgb);
break;
case TelPolygonsArrayType:
- draw_mode = GL_POLYGON;
- glColor3fv( interior_colour->rgb );
- break;
case TelTrianglesArrayType:
- draw_mode = GL_TRIANGLES;
- glColor3fv( interior_colour->rgb );
- break;
case TelQuadranglesArrayType:
- draw_mode = GL_QUADS;
- glColor3fv( interior_colour->rgb );
- break;
case TelTriangleStripsArrayType:
- draw_mode = GL_TRIANGLE_STRIP;
- glColor3fv( interior_colour->rgb );
- break;
case TelQuadrangleStripsArrayType:
- draw_mode = GL_QUAD_STRIP;
- glColor3fv( interior_colour->rgb );
- break;
case TelTriangleFansArrayType:
- draw_mode = GL_TRIANGLE_FAN;
- glColor3fv( interior_colour->rgb );
+ glColor3fv (theInteriorColour->rgb);
break;
- default:
- return;
}
- /* OCC11904 -- Temporarily disable environment mapping */
- if( draw_mode <= GL_LINE_STRIP ){
- glPushAttrib(GL_ENABLE_BIT);
- glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
+ // Temporarily disable environment mapping
+ if (myDrawMode <= GL_LINE_STRIP)
+ {
+ glPushAttrib (GL_ENABLE_BIT);
+ glDisable (GL_TEXTURE_1D);
+ glDisable (GL_TEXTURE_2D);
}
- if( p->VBOEnabled == -1 ){
- p->VBOEnabled = VBOenabled;
- if( VBOExtension == 0)
- initVBO();
- if( (VBOExtension == 1) && (p->VBOEnabled != 0))
- BuildVBO( p );
- }
-
-
- #ifdef PRINT
- printf(" $$$ g_nDegenerateModel %d\n",g_nDegenerateModel);
- #endif
- if ( g_nDegenerateModel < 2 &&
- ( (draw_mode > GL_LINE_STRIP && interior_style != TSM_EMPTY) ||
- (draw_mode <= GL_LINE_STRIP /*&& !hflag*/)) ) {
-
- if( hflag == TOn ) {
+ if (theWorkspace->DegenerateModel < 2 &&
+ ((myDrawMode > GL_LINE_STRIP && theInteriorStyle != Aspect_IS_EMPTY) ||
+ (myDrawMode <= GL_LINE_STRIP)))
+ {
+ if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
+ {
pfc = NULL;
pvc = NULL;
}
- if ( interior_style == TSM_HIDDENLINE) {
- edge_flag = 1;
+ if (theInteriorStyle == Aspect_IS_HIDDENLINE)
+ {
+ theEdgeFlag = 1;
pfc = NULL;
pvc = NULL;
}
- /*OCC12297 - Sometimes the GL_LIGHTING mode is activated here
- without LightOn() call for an unknown reason, so it is necessary
- to call LightOn() to synchronize LightOn/Off mechanism*/
- LightOn();
-
- if( lighting_model == CALL_PHIGS_REFL_NONE || draw_mode <= GL_LINE_STRIP )
- LightOff();
-
- glGetIntegerv( GL_RENDER_MODE, &renderMode );
-
- if ( p->num_vertexs > 0 && p->flagBufferVBO != VBO_OK) {
- if( renderMode != GL_FEEDBACK ){
- if( p->vertices ) {
- glVertexPointer(3, GL_FLOAT, 0, p->vertices);/* array of vertices */
- glEnableClientState(GL_VERTEX_ARRAY);
- }
-
- if( p->vnormals ) {
- glNormalPointer(GL_FLOAT, 0, p->vnormals);/* array of normals */
- glEnableClientState(GL_NORMAL_ARRAY);
- }
-
- if ( p->vtexels) {
- glTexCoordPointer(2, GL_FLOAT, 0, p->vtexels);/* array of texture coordinates */
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- }
+ // Sometimes the GL_LIGHTING mode is activated here
+ // without glEnable(GL_LIGHTING) call for an unknown reason, so it is necessary
+ // to call glEnable(GL_LIGHTING) to synchronize Light On/Off mechanism*
+ if (theLightingModel == 0 || myDrawMode <= GL_LINE_STRIP)
+ glDisable (GL_LIGHTING);
+ else
+ glEnable (GL_LIGHTING);
+
+ glGetIntegerv (GL_RENDER_MODE, &renderMode);
+
+ if (myPArray->num_vertexs > 0
+ && myPArray->flagBufferVBO != VBO_OK
+ && renderMode != GL_FEEDBACK)
+ {
+ if (myPArray->vertices != NULL)
+ {
+ glVertexPointer (3, GL_FLOAT, 0, myPArray->vertices); // array of vertices
+ glEnableClientState (GL_VERTEX_ARRAY);
+ }
+ if (myPArray->vnormals != NULL)
+ {
+ glNormalPointer (GL_FLOAT, 0, myPArray->vnormals); // array of normals
+ glEnableClientState (GL_NORMAL_ARRAY);
+ }
+ if (myPArray->vtexels != NULL)
+ {
+ glTexCoordPointer (2, GL_FLOAT, 0, myPArray->vtexels); // array of texture coordinates
+ glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+ }
- if ( pvc ) {
-#ifdef OCC7833
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, pvc); /* array of colors */
-#else
- glColorPointer(3, GL_UNSIGNED_BYTE, 0, pvc); /* array of colors */
-#endif
- glEnableClientState(GL_COLOR_ARRAY);
- glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
- glEnable(GL_COLOR_MATERIAL);
- }
+ if (pvc != NULL)
+ {
+ glColorPointer (4, GL_UNSIGNED_BYTE, 0, pvc); // array of colors
+ glEnableClientState (GL_COLOR_ARRAY);
+ glColorMaterial (GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
+ glEnable (GL_COLOR_MATERIAL);
}
}
-
- //Bindings concrete pointer in accordance with VBO buffer
- //Using VBO
- if ( p->num_vertexs > 0 && p->flagBufferVBO == VBO_OK ) {
- if( p->bufferVBO[VBOVertices] ){
- glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVertices]);
- glVertexPointer(3, GL_FLOAT, 0, (char *) NULL);// array of vertices
- glEnableClientState(GL_VERTEX_ARRAY);
+ else if (myPArray->num_vertexs > 0
+ && myPArray->flagBufferVBO == VBO_OK)
+ {
+ // Bindings concrete pointer in accordance with VBO buffer
+ if (myPArray->bufferVBO[VBOVertices] != 0)
+ {
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVertices]);
+ glVertexPointer (3, GL_FLOAT, 0, NULL); // array of vertices
+ glEnableClientState (GL_VERTEX_ARRAY);
}
-
- if( p->bufferVBO[VBOVnormals] ){
- glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVnormals]);
- glNormalPointer(GL_FLOAT, 0, (char *) NULL);// array of normals
- glEnableClientState(GL_NORMAL_ARRAY);
+ if (myPArray->bufferVBO[VBOVnormals] != 0)
+ {
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVnormals]);
+ glNormalPointer (GL_FLOAT, 0, NULL); // array of normals
+ glEnableClientState (GL_NORMAL_ARRAY);
}
-
- if ( p->bufferVBO[VBOVtexels] && !ForbidSetTextureMapping ) {
- glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVtexels]);
- glTexCoordPointer(2, GL_FLOAT, 0, (char *) NULL);/* array of texture coordinates */
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ if (myPArray->bufferVBO[VBOVtexels] != 0 && (theWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0)
+ {
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVtexels]);
+ glTexCoordPointer (2, GL_FLOAT, 0, NULL); // array of texture coordinates
+ glEnableClientState (GL_TEXTURE_COORD_ARRAY);
}
-
- if ( p->bufferVBO[VBOVcolours] ) {
- glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVcolours]);
- glColorPointer( 4, GL_UNSIGNED_BYTE, 0, (char *) NULL);// array of colors
- glEnableClientState(GL_COLOR_ARRAY);
- glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
- glEnable(GL_COLOR_MATERIAL);
+ if (myPArray->bufferVBO[VBOVcolours] != 0)
+ {
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVcolours]);
+ glColorPointer (4, GL_UNSIGNED_BYTE, 0, NULL); // array of colors
+ glEnableClientState (GL_COLOR_ARRAY);
+ glColorMaterial (GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
+ glEnable (GL_COLOR_MATERIAL);
}
}
+
// OCC22236 NOTE: draw for all situations:
- // 1) draw elements from p->bufferVBO[VBOEdges] indicies array
+ // 1) draw elements from myPArray->bufferVBO[VBOEdges] indicies array
// 2) draw elements from vertice array, when bounds defines count of primitive's verts.
// 3) draw primitive by vertexes if no edges and bounds array is specified
- if( p->flagBufferVBO == VBO_OK ){
- if ( p->num_edges > 0 && p->bufferVBO[VBOEdges] ) {
- glVBOBindBufferARB(GL_ELEMENTS_ARRAY_BUFFER_ARB, p->bufferVBO[VBOEdges]); // for edge indices
-
- // draw primitives by vertex count with the indicies
- if( p->num_bounds > 0 ) {
- Tint* offset = 0;
- for( i = 0, offset = 0 ; i < p->num_bounds ; i++ ) {
- glDrawElements(draw_mode, p->bounds[i], GL_UNSIGNED_INT, offset);
- offset += p->bounds[i];
+ if (myPArray->flagBufferVBO == VBO_OK)
+ {
+ if (myPArray->num_edges > 0 && myPArray->bufferVBO[VBOEdges] != 0)
+ {
+ aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]); // for edge indices
+ if (myPArray->num_bounds > 0)
+ {
+ // draw primitives by vertex count with the indicies
+ Tint* anOffset = NULL;
+ for (i = 0; i < myPArray->num_bounds; ++i)
+ {
+ glDrawElements (myDrawMode, myPArray->bounds[i], GL_UNSIGNED_INT, anOffset);
+ anOffset += myPArray->bounds[i];
}
}
- // draw one (or sequential) primitive by the indicies
- else {
- glDrawElements(draw_mode, p->num_edges , GL_UNSIGNED_INT, 0);
+ else
+ {
+ // draw one (or sequential) primitive by the indicies
+ glDrawElements (myDrawMode, myPArray->num_edges, GL_UNSIGNED_INT, NULL);
}
}
- else if( p->num_bounds > 0 ) {
- for( i = n = 0 ; i < p->num_bounds ; i ++ ){
- glDrawArrays(draw_mode, n, p->bounds[i]);
- n += p->bounds[i];
+ else if (myPArray->num_bounds > 0)
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ glDrawArrays (myDrawMode, n, myPArray->bounds[i]);
+ n += myPArray->bounds[i];
}
}
- else {
- glDrawArrays(draw_mode, 0, p->num_vertexs);
+ else
+ {
+ glDrawArrays (myDrawMode, 0, myPArray->num_vertexs);
}
- //bind with 0
- glVBOBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
- glVBOBindBufferARB(GL_ELEMENTS_ARRAY_BUFFER_ARB, 0);
+ // bind with 0
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0);
+ aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, 0);
}
- else {
- if( p->num_bounds > 0 ) {
- if( p->num_edges > 0 ) {
- for( i=n=0 ; i<p->num_bounds ; i++ ) {
- if( pfc ) glColor3fv ( pfc[i].rgb );
- if( renderMode == GL_FEEDBACK )
- draw_primitive_elements( p, draw_mode, p->bounds[i],
- GL_UNSIGNED_INT,(GLenum*) &p->edges[n]);
- else
- glDrawElements( draw_mode, p->bounds[i],
- GL_UNSIGNED_INT, &p->edges[n]);
- n += p->bounds[i];
- }
- } else {
- for( i=n=0 ; i<p->num_bounds ; i++ ) {
- if( pfc )
- glColor3fv ( pfc[i].rgb );
- if( renderMode == GL_FEEDBACK )
- draw_primitive_array( p, draw_mode, n, p->bounds[i]);
- else
- {
- glDrawArrays( draw_mode, n, p->bounds[i]);
- }
- n += p->bounds[i];
- }
+ else
+ {
+ if (myPArray->num_bounds > 0)
+ {
+ if (myPArray->num_edges > 0)
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ if (pfc != NULL) glColor3fv (pfc[i].rgb);
+ DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ myPArray->bounds[i], (GLenum* )&myPArray->edges[n]);
+ n += myPArray->bounds[i];
+ }
+ }
+ else
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ if (pfc != NULL)
+ {
+ glColor3fv (pfc[i].rgb);
}
- } else if( p->num_edges > 0 ) {
- if( renderMode == GL_FEEDBACK )
- draw_primitive_elements( p, draw_mode, p->num_edges,
- GL_UNSIGNED_INT,(GLenum*) &p->edges[0]);
- else
- glDrawElements( draw_mode, p->num_edges, GL_UNSIGNED_INT, p->edges);
- } else {
- if( renderMode == GL_FEEDBACK )
- draw_primitive_array( p, draw_mode, 0, p->num_vertexs);
- else
- glDrawArrays( draw_mode, 0, p->num_vertexs);
+ DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ n, myPArray->bounds[i]);
+ n += myPArray->bounds[i];
+ }
}
+ }
+ else if (myPArray->num_edges > 0)
+ {
+ DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ myPArray->num_edges, (GLenum* )myPArray->edges);
+ }
+ else
+ {
+ DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ 0, myPArray->num_vertexs);
+ }
}
-#ifdef TEST
- if( p->bufferVBO[VBOVcolours] || pvc ) {
- glDisable(GL_COLOR_MATERIAL);
- TelResetMaterial();
+ if (myPArray->bufferVBO[VBOVcolours] != 0 || pvc != NULL)
+ {
+ glDisable (GL_COLOR_MATERIAL);
+ theWorkspace->NamedStatus |= OPENGL_NS_RESMAT; // Reset material
}
-#endif
-
- if( p->bufferVBO[VBOVertices] || p->vertices )
- glDisableClientState(GL_VERTEX_ARRAY);
- if( p->bufferVBO[VBOVcolours] || p->vcolours )
- glDisableClientState(GL_COLOR_ARRAY);
- if( p->bufferVBO[VBOVnormals] || p->vnormals )
- glDisableClientState(GL_NORMAL_ARRAY);
- if ( (p->bufferVBO[VBOVtexels] && !ForbidSetTextureMapping ) || p->vtexels )
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-
- if ( g_nDegenerateModel ){
- if(draw_mode <= GL_LINE_STRIP)
+
+ if (myPArray->bufferVBO[VBOVertices] != 0 || myPArray->vertices != NULL)
+ glDisableClientState (GL_VERTEX_ARRAY);
+ if (myPArray->bufferVBO[VBOVcolours] != 0 || myPArray->vcolours != NULL)
+ glDisableClientState (GL_COLOR_ARRAY);
+ if (myPArray->bufferVBO[VBOVnormals] != 0 || myPArray->vnormals != NULL)
+ glDisableClientState (GL_NORMAL_ARRAY);
+ if ((myPArray->bufferVBO[VBOVtexels] != 0 && (theWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0) || myPArray->vtexels != NULL)
+ glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+
+ if (theWorkspace->DegenerateModel)
+ {
+ if (myDrawMode <= GL_LINE_STRIP)
+ {
glPopAttrib();
+ }
return;
}
}
- if( edge_flag || g_nDegenerateModel )
- switch ( g_nDegenerateModel ) {
- default: /* XXX_TDM_NODE or TINY */
- /*
- On some NVIDIA graphic cards, using glEdgeFlagPointer() in
- combination with VBO ( edge flag data put into a VBO buffer)
- leads to a crash in a driver. Therefore, edge flags are simply
- igonored when VBOs are enabled, so all the edges are drawn if
- edge visibility is turned on. In order to draw edges selectively,
- either disable VBO or turn off edge visibilty in the current
- primitive array and create a separate primitive array (segments)
- and put edges to be drawn into it.
- */
- draw_edges ( p, edge_flag ? edge_colour : interior_colour );
+ if (theEdgeFlag || theWorkspace->DegenerateModel)
+ {
+ switch (theWorkspace->DegenerateModel)
+ {
+ default: // XXX_TDM_NODE or TINY
+ // On some NVIDIA graphic cards, using glEdgeFlagPointer() in
+ // combination with VBO ( edge flag data put into a VBO buffer)
+ // leads to a crash in a driver. Therefore, edge flags are simply
+ // igonored when VBOs are enabled, so all the edges are drawn if
+ // edge visibility is turned on. In order to draw edges selectively,
+ // either disable VBO or turn off edge visibilty in the current
+ // primitive array and create a separate primitive array (segments)
+ // and put edges to be drawn into it.
+ DrawEdges (theEdgeFlag ? theEdgeColour : theInteriorColour, theWorkspace);
+ break;
+ // DegenerateModel(as Lines, Points, BBoxs) are used only without VBO
+ case 2: // XXX_TDM_WIREFRAME
+ if (myPArray->VBOEnabled == 0)
+ DrawDegeneratesAsLines ((theEdgeFlag ? theEdgeColour : theInteriorColour), theWorkspace);
+ break;
+ case 3: // XXX_TDM_MARKER
+ if (myPArray->VBOEnabled == 0)
+ DrawDegeneratesAsPoints ((theEdgeFlag ? theEdgeColour : theInteriorColour), theWorkspace->SkipRatio);
break;
- // DegenerateModel(as Lines, Points, BBoxs) are used only without VBO
- case 2: /* XXX_TDM_WIREFRAME */
- if( p->VBOEnabled == 0 )
- draw_degenerates_as_lines ( p, edge_flag ? edge_colour : interior_colour );
- break;
- case 3: /* XXX_TDM_MARKER */
- if( p->VBOEnabled == 0 )
- draw_degenerates_as_points ( p, edge_flag ? edge_colour : interior_colour );
- break;
- case 4: /* XXX_TDM_BBOX */
- if( p->VBOEnabled == 0 )
- draw_degenerates_as_bboxs ( p, edge_flag ? edge_colour : interior_colour );
- break;
- }
-
- if(draw_mode <= GL_LINE_STRIP)
+ case 4: // XXX_TDM_BBOX
+ if (myPArray->VBOEnabled == 0)
+ DrawDegeneratesAsBBoxs (theEdgeFlag ? theEdgeColour : theInteriorColour);
+ break;
+ }
+ }
+
+ if (myDrawMode <= GL_LINE_STRIP)
glPopAttrib();
}
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ParrayDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
+// =======================================================================
+// function : DrawEdges
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawEdges (const TEL_COLOUR* theEdgeColour,
+ const Handle(OpenGl_Workspace)& theWorkspace) const
{
- call_def_parray p = (call_def_parray)data.pdata;
- if( p->VBOEnabled == VBO_OK ) {
- OpenGl_ResourceCleaner* resCleaner = OpenGl_ResourceCleaner::GetInstance();
- if( p->bufferVBO[VBOEdges] )
- resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOEdges]) );
- if( p->bufferVBO[VBOVertices] )
- resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVertices]) );
- if( p->bufferVBO[VBOVcolours] )
- resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVcolours]) );
- if( p->bufferVBO[VBOVnormals] )
- resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVnormals]) );
- if( p->bufferVBO[VBOVtexels] )
- resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVtexels]) );
- }
-
- return TSuccess;
-}
+ glDisable (GL_LIGHTING);
-/*----------------------------------------------------------------------*/
+ const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext();
+ const OpenGl_AspectLine* anAspectLineOld = NULL;
+ if (myDrawMode > GL_LINE_STRIP)
+ {
+ anAspectLineOld = theWorkspace->SetAspectLine (theWorkspace->AspectFace (Standard_True)->AspectEdge());
+ theWorkspace->AspectLine (Standard_True);
-static void
-draw_edges ( call_def_parray p, tel_colour edge_colour )
-{
- Tint i, j, n;
- Tint edge_type=0, line_type_preserve=0;
- Tfloat edge_width=0, line_width_preserve=0;
- /* GLboolean texture_on;*/
+ glPushAttrib (GL_POLYGON_BIT);
+ glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+ }
+ Tint i, j, n;
GLint renderMode;
-
- LightOff();
-
- if( draw_mode > GL_LINE_STRIP ) {
- CMN_KEY k, k1, k2, k3, k4;
-
- k1.id = TelPolylineWidth;
- k2.id = TelPolylineType;
- k3.id = TelEdgeType;
- k4.id = TelEdgeWidth;
-
- TsmGetAttri( 4, &k1, &k2, &k3, &k4 );
-
- line_width_preserve = k1.data.fdata;
- line_type_preserve = k2.data.ldata;
- edge_type = k3.data.ldata;
- edge_width = k4.data.fdata;
-
- if( line_width_preserve != edge_width ) {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type ) {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
-
- glPushAttrib( GL_POLYGON_BIT );
- glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
- }
// OCC22236 NOTE: draw edges for all situations:
- // 1) draw elements with GL_LINE style as edges from p->bufferVBO[VBOEdges] indicies array
+ // 1) draw elements with GL_LINE style as edges from myPArray->bufferVBO[VBOEdges] indicies array
// 2) draw elements from vertice array, when bounds defines count of primitive's verts.
// 3) draw primitive's edges by vertexes if no edges and bounds array is specified
- if(p->flagBufferVBO == VBO_OK)
+ if (myPArray->flagBufferVBO == VBO_OK)
{
- glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVertices] );
- glEnableClientState( GL_VERTEX_ARRAY );
- glColor3fv( edge_colour->rgb );
- if ( p->num_edges > 0 && p->bufferVBO[VBOEdges] ) {
- glVBOBindBufferARB(GL_ELEMENTS_ARRAY_BUFFER_ARB, p->bufferVBO[VBOEdges]);
-
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVertices]);
+ glEnableClientState (GL_VERTEX_ARRAY);
+ glColor3fv (theEdgeColour->rgb);
+ if (myPArray->num_edges > 0 && myPArray->bufferVBO[VBOEdges])
+ {
+ aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]);
+
// draw primitives by vertex count with the indicies
- if( p->num_bounds > 0 ) {
+ if (myPArray->num_bounds > 0)
+ {
Tint* offset = 0;
- for( i = 0, offset = 0 ; i < p->num_bounds ; i++ ) {
- glDrawElements( draw_mode, p->bounds[i], GL_UNSIGNED_INT, offset);
- offset += p->bounds[i];
+ for (i = 0, offset = 0; i < myPArray->num_bounds; ++i)
+ {
+ glDrawElements (myDrawMode, myPArray->bounds[i], GL_UNSIGNED_INT, offset);
+ offset += myPArray->bounds[i];
}
}
// draw one (or sequential) primitive by the indicies
- else {
- glDrawElements( draw_mode, p->num_edges , GL_UNSIGNED_INT, 0);
+ else
+ {
+ glDrawElements (myDrawMode, myPArray->num_edges, GL_UNSIGNED_INT, NULL);
}
}
- else if( p->num_bounds > 0 ) {
- for( i = n = 0 ; i < p->num_bounds ; i ++ ){
- glDrawArrays( draw_mode, n, p->bounds[i]);
- n += p->bounds[i];
+ else if (myPArray->num_bounds > 0)
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ glDrawArrays (myDrawMode, n, myPArray->bounds[i]);
+ n += myPArray->bounds[i];
}
}
- else {
- glDrawArrays( draw_mode, 0, p->num_vertexs);
+ else
+ {
+ glDrawArrays (myDrawMode, 0, myPArray->num_vertexs);
}
// unbind buffers
- glDisableClientState(GL_VERTEX_ARRAY);
- glVBOBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
- glVBOBindBufferARB(GL_ELEMENTS_ARRAY_BUFFER_ARB, 0);
- }
- else {
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, p->vertices); /* array of vertices */
-#ifdef OGLBUG
- if( p->edge_vis ) {
- glEnableClientState(GL_EDGE_FLAG_ARRAY);
- glEdgeFlagPointer( sizeof(Tchar), p->edge_vis);
- } else
- glDisableClientState(GL_EDGE_FLAG_ARRAY);
-#endif
-
- glGetIntegerv( GL_RENDER_MODE, &renderMode );
-
- glColor3fv( edge_colour->rgb );
- if( p->num_bounds > 0 ) {
- if( p->num_edges > 0 ) {
- for( i=n=0 ; i<p->num_bounds ; i++ ) {
-#ifndef OGLBUG
- if( p->edge_vis ) {
- glBegin( draw_mode );
- for( j=0 ; j<p->bounds[i] ; j++ ) {
- glEdgeFlag( p->edge_vis[n+j] );
- glVertex3fv( &p->vertices[p->edges[n+j]].xyz[0] );
- }
- glEnd();
- } else
-#endif
- if( renderMode == GL_FEEDBACK )
- draw_primitive_elements( p, draw_mode, p->bounds[i],
- GL_UNSIGNED_INT, (GLenum*)&p->edges[n]);
- else
- glDrawElements( draw_mode, p->bounds[i],
- GL_UNSIGNED_INT, &p->edges[n]);
- n += p->bounds[i];
+ glDisableClientState (GL_VERTEX_ARRAY);
+ aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0);
+ aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, 0);
+ }
+ else
+ {
+ glEnableClientState (GL_VERTEX_ARRAY);
+ glVertexPointer (3, GL_FLOAT, 0, myPArray->vertices); // array of vertices
+ glGetIntegerv (GL_RENDER_MODE, &renderMode);
+
+ glColor3fv (theEdgeColour->rgb);
+ if (myPArray->num_bounds > 0)
+ {
+ if (myPArray->num_edges > 0)
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ if (myPArray->edge_vis)
+ {
+ glBegin (myDrawMode);
+ for (j = 0; j < myPArray->bounds[i]; ++j)
+ {
+ glEdgeFlag (myPArray->edge_vis[n+j]);
+ glVertex3fv (&myPArray->vertices[myPArray->edges[n+j]].xyz[0]);
+ }
+ glEnd();
}
- } else {
- for( i=n=0 ; i<p->num_bounds ; i++ ) {
- if( renderMode == GL_FEEDBACK )
- draw_primitive_array( p, draw_mode, n, p->bounds[i]);
- else
- glDrawArrays( draw_mode, n, p->bounds[i]);
- n += p->bounds[i];
+ else
+ {
+ DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ myPArray->bounds[i], (GLenum* )&myPArray->edges[n]);
}
+ n += myPArray->bounds[i];
}
- }
- else if( p->num_edges > 0 ) {
-#ifndef OGLBUG
- if( p->edge_vis ) {
- glBegin( draw_mode );
- for( i=0 ; i<p->num_edges ; i++ ) {
- glEdgeFlag( p->edge_vis[i] );
- glVertex3fv( &p->vertices[p->edges[i]].xyz[0] );
- }
- glEnd();
- } else
-#endif
- if( renderMode == GL_FEEDBACK )
- draw_primitive_elements( p, draw_mode, p->num_edges,
- GL_UNSIGNED_INT,(GLenum*) p->edges);
+ }
else
- glDrawElements( draw_mode, p->num_edges,
- GL_UNSIGNED_INT, p->edges);
- } else {
- if( renderMode == GL_FEEDBACK )
- draw_primitive_array( p, draw_mode, 0, p->num_vertexs);
+ {
+ for (i = n = 0 ; i < myPArray->num_bounds; ++i)
+ {
+ DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ n, myPArray->bounds[i]);
+ n += myPArray->bounds[i];
+ }
+ }
+ }
+ else if (myPArray->num_edges > 0)
+ {
+ if (myPArray->edge_vis)
+ {
+ glBegin (myDrawMode);
+ for (i = 0; i < myPArray->num_edges; ++i)
+ {
+ glEdgeFlag (myPArray->edge_vis[i]);
+ glVertex3fv (&myPArray->vertices[myPArray->edges[i]].xyz[0]);
+ }
+ glEnd();
+ }
else
- glDrawArrays( draw_mode, 0, p->num_vertexs);
+ {
+ DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ myPArray->num_edges, (GLenum* )myPArray->edges);
}
}
-
- if( draw_mode > GL_LINE_STRIP ) {
- CMN_KEY k;
- if( line_width_preserve != edge_width ) {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type ) {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
+ else
+ {
+ DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ 0, myPArray->num_vertexs);
}
+ }
+
+ if (myDrawMode > GL_LINE_STRIP)
+ {
+ // Restore line context
+ theWorkspace->SetAspectLine (anAspectLineOld);
glPopAttrib();
}
}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_points_as_points ( call_def_parray p ) {
-
- Tint j;
- tel_point pv = p -> vertices;
-
-#ifdef FULL_DEGENER
- if ( g_fSkipRatio == 1. )
- return;
-#endif
-
- for ( j=0 ; j<p->num_vertexs ; j++ ) {
- glVertex3fv ( &pv[j].xyz[0] );
+// =======================================================================
+// function : DrawDegeneratesPointsAsPoints
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesPointsAsPoints() const
+{
+ tel_point pv = myPArray->vertices;
+ for (Tint aVertId = 0; aVertId < myPArray->num_vertexs; ++aVertId)
+ {
+ glVertex3fv (&pv[aVertId].xyz[0]);
}
-}
-
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_lines_as_points ( call_def_parray p ) {
-
- Tint j;
- GLfloat pt[ 3 ];
- tel_point pv = p -> vertices;
+}
-#ifdef FULL_DEGENER
- if ( g_fSkipRatio == 1. )
- return;
-#endif
-
- for ( j=0 ; j<p->num_vertexs ; j+=2 ) {
- pt[0] = pt[1] = pt[2] = 0.;
- pt[ 0 ] += pv[j].xyz[ 0 ];
- pt[ 1 ] += pv[j].xyz[ 1 ];
- pt[ 2 ] += pv[j].xyz[ 2 ];
- pt[ 0 ] += pv[j+1].xyz[ 0 ];
- pt[ 1 ] += pv[j+1].xyz[ 1 ];
- pt[ 2 ] += pv[j+1].xyz[ 2 ];
- pt[ 0 ] /= 2;
- pt[ 1 ] /= 2;
- pt[ 2 ] /= 2;
- glVertex3fv ( pt );
+// =======================================================================
+// function : DrawDegeneratesLinesAsPoints
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesLinesAsPoints() const
+{
+ GLfloat pt[3];
+ tel_point pv = myPArray->vertices;
+
+ Tint j = 0;
+ while (j < myPArray->num_vertexs)
+ {
+ pt[0] = pv[j].xyz[0];
+ pt[1] = pv[j].xyz[1];
+ pt[2] = pv[j].xyz[2]; ++j;
+ pt[0] += pv[j].xyz[0];
+ pt[1] += pv[j].xyz[1];
+ pt[2] += pv[j].xyz[2]; ++j;
+ pt[0] *= 0.5f;
+ pt[1] *= 0.5f;
+ pt[2] *= 0.5f;
+ glVertex3fv (pt);
}
}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_triangles_as_points ( call_def_parray p ) {
-
- Tint i, j, iv;
- GLfloat pt[ 3 ];
- tel_point pv = p -> vertices;
-
-#ifdef FULL_DEGENER
- if ( g_fSkipRatio == 1. )
- return;
-#endif
-
- if( p->num_edges > 0 ) {
- for ( j=0 ; j<p->num_edges ; j+=3 ) {
- pt[0] = pt[1] = pt[2] = 0.;
- for ( i=0 ; i<3 ; i++ ) {
- iv = p->edges[j+i];
- pt[ 0 ] += pv[iv].xyz[ 0 ];
- pt[ 1 ] += pv[iv].xyz[ 1 ];
- pt[ 2 ] += pv[iv].xyz[ 2 ];
+// =======================================================================
+// function : DrawDegeneratesTrianglesAsPoints
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesTrianglesAsPoints() const
+{
+ Tint i, j, iv;
+ GLfloat pt[ 3 ];
+ tel_point pv = myPArray->vertices;
+
+ if (myPArray->num_edges > 0)
+ {
+ for (j = 0; j < myPArray->num_edges; j += 3)
+ {
+ iv = myPArray->edges[j];
+ pt[0] = pv[iv].xyz[0];
+ pt[1] = pv[iv].xyz[1];
+ pt[2] = pv[iv].xyz[2];
+ for (i = 1; i < 3; ++i)
+ {
+ iv = myPArray->edges[j+i];
+ pt[0] += pv[iv].xyz[0];
+ pt[1] += pv[iv].xyz[1];
+ pt[2] += pv[iv].xyz[2];
}
- pt[ 0 ] /= 3;
- pt[ 1 ] /= 3;
- pt[ 2 ] /= 3;
- glVertex3fv ( pt );
+ pt[0] /= 3.f;
+ pt[1] /= 3.f;
+ pt[2] /= 3.f;
+ glVertex3fv (pt);
}
- } else {
- for ( j=0 ; j<p->num_vertexs ; j+=3 ) {
- pt[0] = pt[1] = pt[2] = 0.;
- for ( i=0 ; i<3 ; i++ ) {
- pt[ 0 ] += pv[j+i].xyz[ 0 ];
- pt[ 1 ] += pv[j+i].xyz[ 1 ];
- pt[ 2 ] += pv[j+i].xyz[ 2 ];
+ }
+ else
+ {
+ for (j = 0; j < myPArray->num_vertexs; j += 3)
+ {
+ pt[0] = pv[j].xyz[0];
+ pt[1] = pv[j].xyz[1];
+ pt[2] = pv[j].xyz[2];
+ for (i = 1; i < 3; ++i)
+ {
+ pt[0] += pv[j+i].xyz[0];
+ pt[1] += pv[j+i].xyz[1];
+ pt[2] += pv[j+i].xyz[2];
}
- pt[ 0 ] /= 3;
- pt[ 1 ] /= 3;
- pt[ 2 ] /= 3;
- glVertex3fv ( pt );
+ pt[0] /= 3.f;
+ pt[1] /= 3.f;
+ pt[2] /= 3.f;
+ glVertex3fv (pt);
}
}
-}
-
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_trianglestrips_as_points ( call_def_parray p ) {
-
- Tint i, j, k, n;
- GLfloat pt[ 3 ];
- tel_point pv = p -> vertices;
-
-#ifdef FULL_DEGENER
- if ( g_fSkipRatio == 1. )
- return;
-#endif
+}
- if( p->num_bounds > 0 ) {
- for ( k=n=0 ; k<p->num_bounds ; k++ ) {
- for ( j=0 ; j<p->bounds[k]-2 ; j++ ) {
- pt[0] = pt[1] = pt[2] = 0.;
- for ( i=0 ; i<3 ; i++ ) {
- pt[ 0 ] += pv[n+j+i].xyz[ 0 ];
- pt[ 1 ] += pv[n+j+i].xyz[ 1 ];
- pt[ 2 ] += pv[n+j+i].xyz[ 2 ];
+// =======================================================================
+// function : DrawDegeneratesTrianglesAsPoints
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesTrianglestripsAsPoints() const
+{
+ Tint i, j, k, n;
+ GLfloat pt[ 3 ];
+ tel_point pv = myPArray->vertices;
+
+ if (myPArray->num_bounds > 0)
+ {
+ for (k = n = 0; k < myPArray->num_bounds; ++k)
+ {
+ for (j = 0; j < myPArray->bounds[k] - 2; ++j)
+ {
+ pt[0] = pv[n+j].xyz[0];
+ pt[1] = pv[n+j].xyz[1];
+ pt[2] = pv[n+j].xyz[2];
+ for (i = 1; i < 3; ++i)
+ {
+ pt[0] += pv[n+j+i].xyz[0];
+ pt[1] += pv[n+j+i].xyz[1];
+ pt[2] += pv[n+j+i].xyz[2];
}
- pt[ 0 ] /= 3;
- pt[ 1 ] /= 3;
- pt[ 2 ] /= 3;
- glVertex3fv ( pt );
+ pt[0] /= 3.f;
+ pt[1] /= 3.f;
+ pt[2] /= 3.f;
+ glVertex3fv (pt);
}
- n += p->bounds[k];
+ n += myPArray->bounds[k];
}
- } else {
- for ( j=0 ; j<p->num_vertexs-2 ; j++ ) {
- pt[0] = pt[1] = pt[2] = 0.;
- for ( i=0 ; i<3 ; i++ ) {
- pt[ 0 ] += pv[j+i].xyz[ 0 ];
- pt[ 1 ] += pv[j+i].xyz[ 1 ];
- pt[ 2 ] += pv[j+i].xyz[ 2 ];
+ }
+ else
+ {
+ for (j = 0; j < myPArray->num_vertexs - 2; ++j)
+ {
+ pt[0] = pv[j].xyz[0];
+ pt[1] = pv[j].xyz[1];
+ pt[2] = pv[j].xyz[2];
+ for (i = 1; i < 3; ++i)
+ {
+ pt[0] += pv[j+i].xyz[0];
+ pt[1] += pv[j+i].xyz[1];
+ pt[2] += pv[j+i].xyz[2];
}
- pt[ 0 ] /= 3;
- pt[ 1 ] /= 3;
- pt[ 2 ] /= 3;
- glVertex3fv ( pt );
+ pt[0] /= 3.f;
+ pt[1] /= 3.f;
+ pt[2] /= 3.f;
+ glVertex3fv (pt);
}
}
-}
-
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_polygons_as_points ( call_def_parray p ) {
-
- Tint j, k, n, iv;
- GLfloat pt[ 3 ];
- tel_point pv = p -> vertices;
-
-#ifdef FULL_DEGENER
- if ( g_fSkipRatio == 1. )
- return;
-#endif
+}
- if( p->num_bounds > 0 ) {
- if( p->num_edges > 0 ) {
- for ( k=n=0 ; k<p->num_bounds ; k++ ) {
- pt[0] = pt[1] = pt[2] = 0.;
- for ( j=0 ; j<p->bounds[k] ; j++ ) {
- iv = p->edges[n+j];
- pt[ 0 ] += pv[iv].xyz[ 0 ];
- pt[ 1 ] += pv[iv].xyz[ 1 ];
- pt[ 2 ] += pv[iv].xyz[ 2 ];
+// =======================================================================
+// function : DrawDegeneratesPolygonsAsPoints
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesPolygonsAsPoints() const
+{
+ Tint j, k, n, iv;
+ GLfloat pt[3];
+ tel_point pv = myPArray->vertices;
+
+ if (myPArray->num_bounds > 0)
+ {
+ if (myPArray->num_edges > 0)
+ {
+ for (k = n = 0; k < myPArray->num_bounds; ++k)
+ {
+ pt[0] = pt[1] = pt[2] = 0.0;
+ for (j = 0; j < myPArray->bounds[k]; ++j)
+ {
+ iv = myPArray->edges[n+j];
+ pt[0] += pv[iv].xyz[0];
+ pt[1] += pv[iv].xyz[1];
+ pt[2] += pv[iv].xyz[2];
}
- pt[ 0 ] /= p->bounds[k];
- pt[ 1 ] /= p->bounds[k];
- pt[ 2 ] /= p->bounds[k];
- glVertex3fv ( pt );
- n += p->bounds[k];
+ pt[0] /= myPArray->bounds[k];
+ pt[1] /= myPArray->bounds[k];
+ pt[2] /= myPArray->bounds[k];
+ glVertex3fv (pt);
+ n += myPArray->bounds[k];
}
- } else {
- for ( k=n=0 ; k<p->num_bounds ; k++ ) {
- pt[0] = pt[1] = pt[2] = 0.;
- for ( j=0 ; j<p->bounds[k] ; j++ ) {
- pt[ 0 ] += pv[n+j].xyz[ 0 ];
- pt[ 1 ] += pv[n+j].xyz[ 1 ];
- pt[ 2 ] += pv[n+j].xyz[ 2 ];
+ }
+ else
+ {
+ for (k = n = 0; k < myPArray->num_bounds; ++k)
+ {
+ pt[0] = pt[1] = pt[2] = 0.0;
+ for (j = 0; j < myPArray->bounds[k]; ++j)
+ {
+ pt[0] += pv[n+j].xyz[0];
+ pt[1] += pv[n+j].xyz[1];
+ pt[2] += pv[n+j].xyz[2];
}
- pt[ 0 ] /= p->bounds[k];
- pt[ 1 ] /= p->bounds[k];
- pt[ 2 ] /= p->bounds[k];
- glVertex3fv ( pt );
- n += p->bounds[k];
+ pt[0] /= myPArray->bounds[k];
+ pt[1] /= myPArray->bounds[k];
+ pt[2] /= myPArray->bounds[k];
+ glVertex3fv (pt);
+ n += myPArray->bounds[k];
}
}
- } else if( p->num_edges > 0 ) {
- pt[0] = pt[1] = pt[2] = 0.;
- for ( j=0 ; j<p->num_edges ; j++ ) {
- iv = p->edges[j];
- pt[ 0 ] += pv[iv].xyz[ 0 ];
- pt[ 1 ] += pv[iv].xyz[ 1 ];
- pt[ 2 ] += pv[iv].xyz[ 2 ];
+ }
+ else if (myPArray->num_edges > 0)
+ {
+ pt[0] = pt[1] = pt[2] = 0.0;
+ for (j = 0; j < myPArray->num_edges; ++j)
+ {
+ iv = myPArray->edges[j];
+ pt[0] += pv[iv].xyz[0];
+ pt[1] += pv[iv].xyz[1];
+ pt[2] += pv[iv].xyz[2];
}
- pt[ 0 ] /= p->num_edges;
- pt[ 1 ] /= p->num_edges;
- pt[ 2 ] /= p->num_edges;
- glVertex3fv ( pt );
- } else {
- pt[0] = pt[1] = pt[2] = 0.;
- for ( j=0 ; j<p->num_vertexs ; j++ ) {
- pt[ 0 ] += pv[j].xyz[ 0 ];
- pt[ 1 ] += pv[j].xyz[ 1 ];
- pt[ 2 ] += pv[j].xyz[ 2 ];
+ pt[0] /= myPArray->num_edges;
+ pt[1] /= myPArray->num_edges;
+ pt[2] /= myPArray->num_edges;
+ glVertex3fv (pt);
+ }
+ else
+ {
+ pt[0] = pt[1] = pt[2] = 0.0;
+ for (j = 0; j < myPArray->num_vertexs; ++j)
+ {
+ pt[0] += pv[j].xyz[0];
+ pt[1] += pv[j].xyz[1];
+ pt[2] += pv[j].xyz[2];
}
- pt[ 0 ] /= p->num_vertexs;
- pt[ 1 ] /= p->num_vertexs;
- pt[ 2 ] /= p->num_vertexs;
- glVertex3fv ( pt );
+ pt[0] /= myPArray->num_vertexs;
+ pt[1] /= myPArray->num_vertexs;
+ pt[2] /= myPArray->num_vertexs;
+ glVertex3fv (pt);
}
-}
-
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_quadrangles_as_points ( call_def_parray p ) {
-
- Tint i, j, iv;
- GLfloat pt[ 3 ];
- tel_point pv = p -> vertices;
-
-#ifdef FULL_DEGENER
- if ( g_fSkipRatio == 1. )
- return;
-#endif
+}
- if( p->num_edges > 0 ) {
- for ( j=0 ; j<p->num_edges ; j+=4 ) {
- pt[0] = pt[1] = pt[2] = 0.;
- for ( i=0 ; i<4 ; i++ ) {
- iv = p->edges[j+i];
- pt[ 0 ] += pv[iv].xyz[ 0 ];
- pt[ 1 ] += pv[iv].xyz[ 1 ];
- pt[ 2 ] += pv[iv].xyz[ 2 ];
+// =======================================================================
+// function : DrawDegeneratesQuadranglesAsPoints
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesQuadranglesAsPoints() const
+{
+ Tint i, j, iv;
+ GLfloat pt[ 3 ];
+ tel_point pv = myPArray->vertices;
+
+ if (myPArray->num_edges > 0)
+ {
+ for (j = 0; j < myPArray->num_edges; j += 4)
+ {
+ pt[0] = pt[1] = pt[2] = 0.0;
+ for (i = 0; i < 4; ++i)
+ {
+ iv = myPArray->edges[j+i];
+ pt[0] += pv[iv].xyz[0];
+ pt[1] += pv[iv].xyz[1];
+ pt[2] += pv[iv].xyz[2];
}
- pt[ 0 ] /= 4;
- pt[ 1 ] /= 4;
- pt[ 2 ] /= 4;
+ pt[0] /= 4;
+ pt[1] /= 4;
+ pt[2] /= 4;
glVertex3fv ( pt );
}
- } else {
- for ( j=0 ; j<p->num_vertexs ; j+=4 ) {
- pt[0] = pt[1] = pt[2] = 0.;
- for ( i=0 ; i<4 ; i++ ) {
- pt[ 0 ] += pv[j+i].xyz[ 0 ];
- pt[ 1 ] += pv[j+i].xyz[ 1 ];
- pt[ 2 ] += pv[j+i].xyz[ 2 ];
+ }
+ else
+ {
+ for (j = 0; j < myPArray->num_vertexs; j += 4)
+ {
+ pt[0] = pt[1] = pt[2] = 0.0;
+ for (i = 0; i < 4; ++i)
+ {
+ pt[0] += pv[j+i].xyz[0];
+ pt[1] += pv[j+i].xyz[1];
+ pt[2] += pv[j+i].xyz[2];
}
- pt[ 0 ] /= 4;
- pt[ 1 ] /= 4;
- pt[ 2 ] /= 4;
- glVertex3fv ( pt );
+ pt[0] /= 4;
+ pt[1] /= 4;
+ pt[2] /= 4;
+ glVertex3fv (pt);
}
}
}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_quadranglestrips_as_points ( call_def_parray p ) {
-
- Tint i, j, k, n;
- GLfloat pt[ 3 ];
- tel_point pv = p -> vertices;
-
-#ifdef FULL_DEGENER
- if ( g_fSkipRatio == 1. )
- return;
-#endif
-
- if( p->num_bounds > 0 ) {
- for ( k=n=0 ; k<p->num_bounds ; k++ ) {
- for ( j=0 ; j<p->bounds[k]-2 ; j+=2 ) {
+// =======================================================================
+// function : DrawDegeneratesAsPoints
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesQuadranglestripsAsPoints() const
+{
+ Tint i, j, k, n;
+ GLfloat pt[3];
+ tel_point pv = myPArray->vertices;
+
+ if (myPArray->num_bounds > 0)
+ {
+ for (k = n = 0; k < myPArray->num_bounds; ++k)
+ {
+ for (j = 0; j < myPArray->bounds[k] - 2; j += 2)
+ {
pt[0] = pt[1] = pt[2] = 0.;
- for ( i=0 ; i<4 ; i++ ) {
- pt[ 0 ] += pv[n+j+i].xyz[ 0 ];
- pt[ 1 ] += pv[n+j+i].xyz[ 1 ];
- pt[ 2 ] += pv[n+j+i].xyz[ 2 ];
+ for (i = 0; i < 4; ++i)
+ {
+ pt[0] += pv[n+j+i].xyz[0];
+ pt[1] += pv[n+j+i].xyz[1];
+ pt[2] += pv[n+j+i].xyz[2];
}
- pt[ 0 ] /= 4;
- pt[ 1 ] /= 4;
- pt[ 2 ] /= 4;
- glVertex3fv ( pt );
+ pt[0] /= 4;
+ pt[1] /= 4;
+ pt[2] /= 4;
+ glVertex3fv (pt);
}
- n += p->bounds[k];
+ n += myPArray->bounds[k];
}
- } else {
- for ( j=0 ; j<p->num_vertexs-2 ; j+=2 ) {
+ }
+ else
+ {
+ for (j = 0; j < myPArray->num_vertexs - 2; j += 2)
+ {
pt[0] = pt[1] = pt[2] = 0.;
- for ( i=0 ; i<4 ; i++ ) {
- pt[ 0 ] += pv[j+i].xyz[ 0 ];
- pt[ 1 ] += pv[j+i].xyz[ 1 ];
- pt[ 2 ] += pv[j+i].xyz[ 2 ];
+ for (i = 0; i < 4; ++i)
+ {
+ pt[0] += pv[j+i].xyz[0];
+ pt[1] += pv[j+i].xyz[1];
+ pt[2] += pv[j+i].xyz[2];
}
- pt[ 0 ] /= 4;
- pt[ 1 ] /= 4;
- pt[ 2 ] /= 4;
- glVertex3fv ( pt );
+ pt[0] /= 4;
+ pt[1] /= 4;
+ pt[2] /= 4;
+ glVertex3fv (pt);
}
}
-}
+}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_as_points ( call_def_parray p,
- tel_colour edge_colour )
+// =======================================================================
+// function : DrawDegeneratesAsPoints
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesAsPoints (const TEL_COLOUR* theEdgeColour,
+ const float theSkipRatio) const
{
+ if (theSkipRatio >= 1.0f)
+ return;
- GLboolean zbuff_state = glIsEnabled(GL_DEPTH_TEST);
- LightOff ();
- if( zbuff_state ) glDisable(GL_DEPTH_TEST);
- glColor3fv( edge_colour->rgb );
- glBegin ( GL_POINTS );
- switch( draw_mode ) {
- case GL_POINTS:
- draw_degenerates_points_as_points( p );
- break;
- case GL_LINES:
- draw_degenerates_lines_as_points( p );
- break;
- case GL_LINE_STRIP:
- case GL_POLYGON:
- draw_degenerates_polygons_as_points( p );
- break;
- case GL_TRIANGLES:
- draw_degenerates_triangles_as_points( p );
- break;
- case GL_QUADS:
- draw_degenerates_quadrangles_as_points( p );
- break;
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- draw_degenerates_trianglestrips_as_points( p );
- break;
- case GL_QUAD_STRIP:
- draw_degenerates_quadranglestrips_as_points( p );
- break;
- default:
- break;
+ GLboolean zbuff_state = glIsEnabled (GL_DEPTH_TEST);
+ glDisable (GL_LIGHTING);
+ if (zbuff_state)
+ glDisable (GL_DEPTH_TEST);
+ glColor3fv (theEdgeColour->rgb);
+
+ glBegin (GL_POINTS);
+ switch (myDrawMode)
+ {
+ case GL_POINTS:
+ DrawDegeneratesPointsAsPoints();
+ break;
+ case GL_LINES:
+ DrawDegeneratesLinesAsPoints();
+ break;
+ case GL_LINE_STRIP:
+ case GL_POLYGON:
+ DrawDegeneratesPolygonsAsPoints();
+ break;
+ case GL_TRIANGLES:
+ DrawDegeneratesTrianglesAsPoints();
+ break;
+ case GL_QUADS:
+ DrawDegeneratesQuadranglesAsPoints();
+ break;
+ case GL_TRIANGLE_FAN:
+ case GL_TRIANGLE_STRIP:
+ DrawDegeneratesTrianglestripsAsPoints();
+ break;
+ case GL_QUAD_STRIP:
+ DrawDegeneratesQuadranglestripsAsPoints();
+ break;
+ default:
+ break;
}
-
- glEnd ();
-
- if( zbuff_state ) glEnable(GL_DEPTH_TEST);
+ glEnd();
+ if (zbuff_state)
+ glEnable (GL_DEPTH_TEST);
}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_lines_as_lines ( call_def_parray p ) {
-
- Tint i,j,n,iv;
- tel_point pv = p -> vertices;
+// =======================================================================
+// function : DrawDegeneratesLinesAsLines
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesLinesAsLines (const float theSkipRatio) const
+{
+ Tint i, iv;
+ tel_point pv = myPArray->vertices;
- n = p->num_vertexs;
- j = (int)((1.-g_fSkipRatio)*n);
- while ( j-- ) {
+ Tint n = myPArray->num_vertexs;
+ Tint j = int((1.0f - theSkipRatio) * n);
+ for (; j > 0; --j)
+ {
i = OGL_Rand() % n;
- p->keys[i] = -p->keys[i];
- };
-
- if( p->num_bounds > 0 ) {
- if( p->num_edges > 0 ) {
- for ( i=n=0 ; i<p->num_bounds ; i++ ) {
- glBegin ( GL_LINES );
- for ( j=0 ; j<p->bounds[i] ; j++ ) {
- iv = p->edges[n+j];
- if( p->keys[iv] < 0 ) {
- p->keys[iv] = -p->keys[iv];
- glVertex3fv ( pv[iv].xyz );
+ myPArray->keys[i] = -myPArray->keys[i];
+ }
+
+ if (myPArray->num_bounds > 0)
+ {
+ if (myPArray->num_edges > 0)
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ glBegin (GL_LINES);
+ for (j = 0; j < myPArray->bounds[i]; ++j)
+ {
+ iv = myPArray->edges[n + j];
+ if (myPArray->keys[iv] < 0)
+ {
+ myPArray->keys[iv] = -myPArray->keys[iv];
+ glVertex3fv (pv[iv].xyz);
}
}
glEnd();
- n += p->bounds[i];
+ n += myPArray->bounds[i];
}
- } else {
- for ( i=n=0 ; i<p->num_bounds ; i++ ) {
- glBegin ( GL_LINES );
- for ( j=0 ; j<p->bounds[i] ; j++ ) {
- if( p->keys[n+j] < 0 ) {
- p->keys[n+j] = -p->keys[n+j];
- glVertex3fv ( pv[n+j].xyz );
+ }
+ else
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ glBegin (GL_LINES);
+ for (j = 0; j < myPArray->bounds[i]; ++j)
+ {
+ if (myPArray->keys[n+j] < 0)
+ {
+ myPArray->keys[n+j] = -myPArray->keys[n+j];
+ glVertex3fv (pv[n+j].xyz);
}
}
glEnd();
- n += p->bounds[i];
+ n += myPArray->bounds[i];
}
}
- } else if( p->num_edges > 0 ) {
- glBegin ( GL_LINES );
- for ( j=0 ; j<p->num_edges ; j++ ) {
- iv = p->edges[j];
- if( p->keys[iv] < 0 ) {
- p->keys[iv] = -p->keys[iv];
- glVertex3fv ( pv[iv].xyz );
+ }
+ else if (myPArray->num_edges > 0)
+ {
+ glBegin (GL_LINES);
+ for (j = 0; j < myPArray->num_edges; ++j)
+ {
+ iv = myPArray->edges[j];
+ if (myPArray->keys[iv] < 0)
+ {
+ myPArray->keys[iv] = -myPArray->keys[iv];
+ glVertex3fv (pv[iv].xyz);
}
}
glEnd();
- } else {
- glBegin ( GL_LINES );
- for ( j=0 ; j<p->num_vertexs ; j++ ) {
- if( p->keys[j] < 0 ) {
- p->keys[j] = -p->keys[j];
- glVertex3fv ( pv[j].xyz );
+ }
+ else
+ {
+ glBegin (GL_LINES);
+ for (j = 0; j < myPArray->num_vertexs; ++j)
+ {
+ if (myPArray->keys[j] < 0)
+ {
+ myPArray->keys[j] = -myPArray->keys[j];
+ glVertex3fv (pv[j].xyz);
}
}
glEnd();
}
-}
+}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_triangles_as_lines ( call_def_parray p )
+// =======================================================================
+// function : DrawDegeneratesTrianglesAsLines
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesTrianglesAsLines (const float theSkipRatio) const
{
+ Tint i, iv;
+ tel_point pv = myPArray->vertices;
- Tint i,j,n,iv;
- tel_point pv = p -> vertices;
-
- n = p->num_vertexs/3;
- j = (int)((1.-g_fSkipRatio)*n);
- while ( j-- ) {
+ Tint n = myPArray->num_vertexs / 3;
+ Tint j = int((1.0f - theSkipRatio) * n);
+ for (; j > 0; --j)
+ {
i = OGL_Rand() % n; i *= 3;
- p->keys[i] = -p->keys[i];
- };
-
- if( p->num_edges > 0 ) {
- for ( j=0 ; j<p->num_edges ; j+=3 ) {
- iv = p->edges[j];
- if( p->keys[iv] < 0 ) {
- p->keys[iv] = -p->keys[iv];
- glBegin ( GL_LINE_LOOP );
- for ( i=0 ; i<3 ; i++ ) {
- iv = p->edges[j+i];
- glVertex3fv ( pv[iv].xyz );
+ myPArray->keys[i] = -myPArray->keys[i];
+ }
+
+ if (myPArray->num_edges > 0)
+ {
+ for (j = 0; j < myPArray->num_edges; j += 3)
+ {
+ iv = myPArray->edges[j];
+ if (myPArray->keys[iv] < 0)
+ {
+ myPArray->keys[iv] = -myPArray->keys[iv];
+ glBegin (GL_LINE_LOOP);
+ for (i = 0; i < 3; ++i)
+ {
+ iv = myPArray->edges[j+i];
+ glVertex3fv (pv[iv].xyz);
}
glEnd();
}
}
- } else {
- for ( j=0 ; j<p->num_vertexs ; j+=3 ) {
- if( p->keys[j] < 0 ) {
- p->keys[j] = -p->keys[j];
- glBegin ( GL_LINE_LOOP );
- for ( i=0 ; i<3 ; i++ ) {
- glVertex3fv ( pv[j+i].xyz );
+ }
+ else
+ {
+ for (j = 0; j < myPArray->num_vertexs; j += 3)
+ {
+ if (myPArray->keys[j] < 0)
+ {
+ myPArray->keys[j] = -myPArray->keys[j];
+ glBegin (GL_LINE_LOOP);
+ for (i = 0; i < 3; ++i)
+ {
+ glVertex3fv (pv[j+i].xyz);
}
glEnd();
}
}
}
-}
+}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_trianglestrips_as_lines ( call_def_parray p )
+// =======================================================================
+// function : DrawDegeneratesTrianglesAsLines
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesTrianglestripsAsLines (const float theSkipRatio) const
{
-
- Tint i,j,k,n,ni;
- tel_point pv = p -> vertices;
-
- if( p->num_bounds > 0 ) {
- for ( i=n=0 ; i<p->num_bounds ; i++ ) {
- ni = p->bounds[i]-2;
- k = (int)((1.-g_fSkipRatio)*ni);
- while ( k-- ) {
+ Tint i, j, k, n, ni;
+ tel_point pv = myPArray->vertices;
+
+ if (myPArray->num_bounds > 0)
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ ni = myPArray->bounds[i] - 2;
+ k = int((1.0f - theSkipRatio) * ni);
+ for (; k > 0; --k)
+ {
j = OGL_Rand() % ni; j += 2;
- p->keys[n+j] = -p->keys[n+j];
- };
- for ( j=2 ; j<p->bounds[i] ; j++ ) {
- if( p->keys[n+j] < 0 ) {
- p->keys[n+j] = -p->keys[n+j];
- glBegin ( GL_LINE_LOOP );
- glVertex3fv ( pv[n+j-2].xyz );
- glVertex3fv ( pv[n+j-1].xyz );
- glVertex3fv ( pv[n+j].xyz );
+ myPArray->keys[n+j] = -myPArray->keys[n+j];
+ }
+ for (j = 2; j < myPArray->bounds[i]; ++j)
+ {
+ if (myPArray->keys[n+j] < 0)
+ {
+ myPArray->keys[n+j] = -myPArray->keys[n+j];
+ glBegin (GL_LINE_LOOP);
+ glVertex3fv (pv[n+j-2].xyz);
+ glVertex3fv (pv[n+j-1].xyz);
+ glVertex3fv (pv[n+j].xyz);
glEnd();
}
}
- n += p->bounds[i];
+ n += myPArray->bounds[i];
}
- } else {
- ni = p->num_vertexs-2;
- k = (int)((1.-g_fSkipRatio)*ni);
- while ( k-- ) {
+ }
+ else
+ {
+ ni = myPArray->num_vertexs - 2;
+ k = int((1.0f - theSkipRatio) * ni);
+ for (; k > 0; --k)
+ {
j = OGL_Rand() % ni; j += 2;
- p->keys[j] = -p->keys[j];
- };
- for ( j=2 ; j<p->num_vertexs ; j++ ) {
- if( p->keys[j] < 0 ) {
- p->keys[j] = -p->keys[j];
- glBegin ( GL_LINE_LOOP );
- glVertex3fv ( pv[j-2].xyz );
- glVertex3fv ( pv[j-1].xyz );
- glVertex3fv ( pv[j].xyz );
+ myPArray->keys[j] = -myPArray->keys[j];
+ }
+ for (j = 2; j < myPArray->num_vertexs; ++j)
+ {
+ if (myPArray->keys[j] < 0)
+ {
+ myPArray->keys[j] = -myPArray->keys[j];
+ glBegin (GL_LINE_LOOP);
+ glVertex3fv (pv[j-2].xyz);
+ glVertex3fv (pv[j-1].xyz);
+ glVertex3fv (pv[j].xyz);
glEnd();
}
}
}
-}
+}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_polygons_as_lines ( call_def_parray p )
+// =======================================================================
+// function : DrawDegeneratesPolygonsAsLines
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesPolygonsAsLines (const float theSkipRatio) const
{
- Tint i,j,n,iv;
- tel_point pv = p -> vertices;
+ Tint i, iv;
+ tel_point pv = myPArray->vertices;
- n = p->num_vertexs;
- j = (int)((1.-g_fSkipRatio)*n);
- while ( j-- ) {
+ Tint n = myPArray->num_vertexs;
+ Tint j = int((1.0f - theSkipRatio) * n);
+ for (; j > 0; --j)
+ {
i = OGL_Rand() % n;
- p->keys[i] = -p->keys[i];
- };
-
- if( p->num_bounds > 0 ) {
- if( p->num_edges > 0 ) {
- for ( i=n=0 ; i<p->num_bounds ; i++ ) {
- glBegin ( GL_LINE_LOOP );
- for ( j=0 ; j<p->bounds[i] ; j++ ) {
- iv = p->edges[n+j];
- if( p->keys[iv] < 0 ) {
- p->keys[iv] = -p->keys[iv];
- glVertex3fv ( pv[iv].xyz );
+ myPArray->keys[i] = -myPArray->keys[i];
+ }
+
+ if (myPArray->num_bounds > 0)
+ {
+ if (myPArray->num_edges > 0)
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ glBegin (GL_LINE_LOOP);
+ for (j = 0; j < myPArray->bounds[i]; ++j)
+ {
+ iv = myPArray->edges[n+j];
+ if (myPArray->keys[iv] < 0)
+ {
+ myPArray->keys[iv] = -myPArray->keys[iv];
+ glVertex3fv (pv[iv].xyz);
}
}
glEnd();
- n += p->bounds[i];
+ n += myPArray->bounds[i];
}
- } else {
- for ( i=n=0 ; i<p->num_bounds ; i++ ) {
- glBegin ( GL_LINE_LOOP );
- for ( j=0 ; j<p->bounds[i] ; j++ ) {
- if( p->keys[n+j] < 0 ) {
- p->keys[n+j] = -p->keys[n+j];
- glVertex3fv ( pv[n+j].xyz );
+ }
+ else
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ glBegin (GL_LINE_LOOP);
+ for (j = 0; j < myPArray->bounds[i]; ++j)
+ {
+ if (myPArray->keys[n+j] < 0)
+ {
+ myPArray->keys[n+j] = -myPArray->keys[n+j];
+ glVertex3fv (pv[n+j].xyz);
}
}
glEnd();
- n += p->bounds[i];
+ n += myPArray->bounds[i];
}
}
- } else if( p->num_edges > 0 ) {
- glBegin ( GL_LINE_LOOP );
- for ( j=0 ; j<p->num_edges ; j++ ) {
- iv = p->edges[j];
- if( p->keys[iv] < 0 ) {
- p->keys[iv] = -p->keys[iv];
- glVertex3fv ( pv[iv].xyz );
+ }
+ else if (myPArray->num_edges > 0)
+ {
+ glBegin (GL_LINE_LOOP);
+ for (j = 0; j < myPArray->num_edges; ++j)
+ {
+ iv = myPArray->edges[j];
+ if (myPArray->keys[iv] < 0)
+ {
+ myPArray->keys[iv] = -myPArray->keys[iv];
+ glVertex3fv (pv[iv].xyz);
}
}
glEnd();
- } else {
- glBegin ( GL_LINE_LOOP );
- for ( j=0 ; j<p->num_vertexs ; j++ ) {
- if( p->keys[j] < 0 ) {
- p->keys[j] = -p->keys[j];
- glVertex3fv ( pv[j].xyz );
+ }
+ else
+ {
+ glBegin (GL_LINE_LOOP);
+ for (j = 0; j < myPArray->num_vertexs; ++j)
+ {
+ if (myPArray->keys[j] < 0)
+ {
+ myPArray->keys[j] = -myPArray->keys[j];
+ glVertex3fv (pv[j].xyz);
}
}
glEnd();
}
-
}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_quadrangles_as_lines ( call_def_parray p )
-{
-
- Tint i,j,n,iv;
- tel_point pv = p -> vertices;
+// =======================================================================
+// function : DrawDegeneratesQuadranglesAsLines
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesQuadranglesAsLines (const float theSkipRatio) const
+{
+ Tint i, iv;
+ tel_point pv = myPArray->vertices;
- n = p->num_vertexs/4;
- j = (int)((1.-g_fSkipRatio)*n);
- while ( j-- ) {
+ Tint n = myPArray->num_vertexs / 4;
+ Tint j = int((1.0f - theSkipRatio) * n);
+ for (; j > 0; --j)
+ {
i = OGL_Rand() % n; i *= 4;
- p->keys[i] = -p->keys[i];
- };
-
- if( p->num_edges > 0 ) {
- for ( j=0 ; j<p->num_edges ; j+=4 ) {
- iv = p->edges[j];
- if( p->keys[iv] < 0 ) {
- p->keys[iv] = -p->keys[iv];
- glBegin ( GL_LINE_LOOP );
- for ( i=0 ; i<4 ; i++ ) {
- iv = p->edges[j+i];
- glVertex3fv ( pv[iv].xyz );
+ myPArray->keys[i] = -myPArray->keys[i];
+ }
+
+ if (myPArray->num_edges > 0)
+ {
+ for (j = 0; j < myPArray->num_edges; j += 4)
+ {
+ iv = myPArray->edges[j];
+ if (myPArray->keys[iv] < 0)
+ {
+ myPArray->keys[iv] = -myPArray->keys[iv];
+ glBegin (GL_LINE_LOOP);
+ for (i = 0; i < 4; ++i)
+ {
+ iv = myPArray->edges[j+i];
+ glVertex3fv (pv[iv].xyz);
}
glEnd();
}
}
- } else {
- for ( j=0 ; j<p->num_vertexs ; j+=4 ) {
- if( p->keys[j] < 0 ) {
- p->keys[j] = -p->keys[j];
- glBegin ( GL_LINE_LOOP );
- for ( i=0 ; i<4 ; i++ ) {
- glVertex3fv ( pv[j+i].xyz );
+ }
+ else
+ {
+ for (j = 0; j < myPArray->num_vertexs; j += 4)
+ {
+ if (myPArray->keys[j] < 0)
+ {
+ myPArray->keys[j] = -myPArray->keys[j];
+ glBegin (GL_LINE_LOOP);
+ for (i = 0; i < 4; ++i)
+ {
+ glVertex3fv (pv[j+i].xyz);
}
glEnd();
}
}
}
-}
+}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_quadranglestrips_as_lines ( call_def_parray p )
+// =======================================================================
+// function : DrawDegeneratesQuadranglesAsLines
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesQuadranglestripsAsLines (const float theSkipRatio) const
{
-
- Tint i,j,k,n,ni;
- tel_point pv = p -> vertices;
-
- if( p->num_bounds > 0 ) {
- for ( i=n=0 ; i<p->num_bounds ; i++ ) {
- ni = p->bounds[i]/2-2;
- k = (int)((1.-g_fSkipRatio)*ni);
- while ( k-- ) {
- j = OGL_Rand() % ni; j = j*2+2;
- p->keys[n+j] = -p->keys[n+j];
- };
- for ( j=3 ; j<p->bounds[i] ; j+=2 ) {
- if( p->keys[n+j] < 0 ) {
- p->keys[n+j] = -p->keys[n+j];
- glBegin ( GL_LINE_LOOP );
- glVertex3fv ( pv[n+j-3].xyz );
- glVertex3fv ( pv[n+j-2].xyz );
- glVertex3fv ( pv[n+j-1].xyz );
- glVertex3fv ( pv[n+j].xyz );
+ Tint i, j, k, n, ni;
+ tel_point pv = myPArray->vertices;
+
+ if (myPArray->num_bounds > 0)
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ ni = myPArray->bounds[i] / 2 - 2;
+ k = int((1.0f - theSkipRatio) * ni);
+ for (; k > 0; --k)
+ {
+ j = OGL_Rand() % ni; j = j * 2 + 2;
+ myPArray->keys[n+j] = -myPArray->keys[n+j];
+ }
+ for (j = 3; j < myPArray->bounds[i]; j += 2)
+ {
+ if (myPArray->keys[n+j] < 0)
+ {
+ myPArray->keys[n+j] = -myPArray->keys[n+j];
+ glBegin (GL_LINE_LOOP);
+ glVertex3fv (pv[n+j-3].xyz);
+ glVertex3fv (pv[n+j-2].xyz);
+ glVertex3fv (pv[n+j-1].xyz);
+ glVertex3fv (pv[n+j].xyz);
glEnd();
}
}
- n += p->bounds[i];
+ n += myPArray->bounds[i];
+ }
+ }
+ else
+ {
+ ni = myPArray->num_vertexs / 2 - 2;
+ k = int((1.0f - theSkipRatio) * ni);
+ for (; k > 0; --k)
+ {
+ j = OGL_Rand() % ni; j = j * 2 + 2;
+ myPArray->keys[j] = -myPArray->keys[j];
}
- } else {
- ni = p->num_vertexs/2-2;
- k = (int)((1.-g_fSkipRatio)*ni);
- while ( k-- ) {
- j = OGL_Rand() % ni; j = j*2+2;
- p->keys[j] = -p->keys[j];
- };
- for ( j=3 ; j<p->num_vertexs ; j+=2 ) {
- if( p->keys[j] < 0 ) {
- p->keys[j] = -p->keys[j];
- glBegin ( GL_LINE_LOOP );
- glVertex3fv ( pv[j-3].xyz );
- glVertex3fv ( pv[j-2].xyz );
- glVertex3fv ( pv[j-1].xyz );
- glVertex3fv ( pv[j].xyz );
+ for (j = 3; j < myPArray->num_vertexs; j += 2)
+ {
+ if (myPArray->keys[j] < 0)
+ {
+ myPArray->keys[j] = -myPArray->keys[j];
+ glBegin (GL_LINE_LOOP);
+ glVertex3fv (pv[j-3].xyz);
+ glVertex3fv (pv[j-2].xyz);
+ glVertex3fv (pv[j-1].xyz);
+ glVertex3fv (pv[j].xyz);
glEnd();
}
}
}
-}
+}
-/*----------------------------------------------------------------------*/
-static void draw_degenerates_as_lines ( call_def_parray p,
- tel_colour edge_colour )
+// =======================================================================
+// function : DrawDegeneratesAsLines
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesAsLines (const TEL_COLOUR* theEdgeColour,
+ const Handle(OpenGl_Workspace)& theWorkspace) const
{
+ const float aSkipRatio = theWorkspace->SkipRatio;
- GLint renderMode;
-
- GLboolean zbuff_state = glIsEnabled(GL_DEPTH_TEST);
+ GLboolean zbuff_state = glIsEnabled (GL_DEPTH_TEST);
- LightOff ();
+ glDisable (GL_LIGHTING);
- if( zbuff_state ) glDisable(GL_DEPTH_TEST);
+ if (zbuff_state)
+ glDisable (GL_DEPTH_TEST);
- glColor3fv( edge_colour->rgb );
+ glColor3fv (theEdgeColour->rgb);
- if( g_fSkipRatio != 0 ) switch( draw_mode ) {
+ if (aSkipRatio != 0.0f)
+ {
+ switch (myDrawMode)
+ {
case GL_POINTS:
- draw_degenerates_points_as_points( p );
+ if (aSkipRatio < 1.0f)
+ DrawDegeneratesPointsAsPoints();
break;
case GL_LINES:
- draw_degenerates_lines_as_lines( p );
+ DrawDegeneratesLinesAsLines (aSkipRatio);
break;
case GL_LINE_STRIP:
case GL_POLYGON:
- draw_degenerates_polygons_as_lines( p );
+ DrawDegeneratesPolygonsAsLines (aSkipRatio);
break;
case GL_TRIANGLES:
- draw_degenerates_triangles_as_lines( p );
+ DrawDegeneratesTrianglesAsLines (aSkipRatio);
break;
case GL_QUADS:
- draw_degenerates_quadrangles_as_lines( p );
+ DrawDegeneratesQuadranglesAsLines (aSkipRatio);
break;
case GL_TRIANGLE_FAN:
case GL_TRIANGLE_STRIP:
- draw_degenerates_trianglestrips_as_lines( p );
+ DrawDegeneratesTrianglestripsAsLines (aSkipRatio);
break;
case GL_QUAD_STRIP:
- draw_degenerates_quadranglestrips_as_lines( p );
+ DrawDegeneratesQuadranglestripsAsLines (aSkipRatio);
break;
default:
break;
+ }
}
- else {
+ else
+ {
int i,n;
-
-#ifdef OCC3192
- GLboolean color_array_mode,
- edge_flag_array_mode,
- index_array_mode,
- normal_array_mode,
- texture_coord_array_mode,
- vertex_array_mode;
-#endif
- glPushAttrib( GL_POLYGON_BIT );
- glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
-
-#ifdef OCC3192
- color_array_mode = glIsEnabled( GL_COLOR_ARRAY );
- edge_flag_array_mode = glIsEnabled( GL_EDGE_FLAG_ARRAY );
- index_array_mode = glIsEnabled( GL_INDEX_ARRAY );
- normal_array_mode = glIsEnabled( GL_NORMAL_ARRAY );
- texture_coord_array_mode = glIsEnabled( GL_TEXTURE_COORD_ARRAY );
- vertex_array_mode = glIsEnabled( GL_VERTEX_ARRAY );
-
- glDisableClientState( GL_COLOR_ARRAY );
- glDisableClientState( GL_EDGE_FLAG_ARRAY );
- glDisableClientState( GL_INDEX_ARRAY );
- glDisableClientState( GL_NORMAL_ARRAY );
- glDisableClientState( GL_TEXTURE_COORD_ARRAY );
-
- if( !vertex_array_mode ) glEnableClientState( GL_VERTEX_ARRAY );
-#else
- glEnableClientState( GL_VERTEX_ARRAY );
-#endif
- glVertexPointer(3, GL_FLOAT, 0, p->vertices); /* array of vertices */
-
- glGetIntegerv( GL_RENDER_MODE, &renderMode );
-
- if( p->num_bounds > 0 ) {
- if( p->num_edges > 0 ) {
- for( i=n=0 ; i<p->num_bounds ; i++ ) {
- if( renderMode == GL_FEEDBACK )
- draw_primitive_elements( p, draw_mode, p->bounds[i],
- GL_UNSIGNED_INT, (GLenum*) &p->edges[n]);
- else
- glDrawElements( draw_mode, p->bounds[i],
- GL_UNSIGNED_INT, &p->edges[n]);
- n += p->bounds[i];
- }
- } else {
- for( i=n=0 ; i<p->num_bounds ; i++ ) {
- if( renderMode == GL_FEEDBACK )
- draw_primitive_array( p, draw_mode, n, p->bounds[i]);
- else
- glDrawArrays( draw_mode, n, p->bounds[i]);
- n += p->bounds[i];
+ glPushAttrib (GL_POLYGON_BIT);
+ glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
+
+ GLboolean color_array_mode = glIsEnabled (GL_COLOR_ARRAY);
+ GLboolean edge_flag_array_mode = glIsEnabled (GL_EDGE_FLAG_ARRAY);
+ GLboolean index_array_mode = glIsEnabled (GL_INDEX_ARRAY);
+ GLboolean normal_array_mode = glIsEnabled (GL_NORMAL_ARRAY);
+ GLboolean texture_coord_array_mode = glIsEnabled (GL_TEXTURE_COORD_ARRAY);
+ GLboolean vertex_array_mode = glIsEnabled (GL_VERTEX_ARRAY);
+
+ glDisableClientState (GL_COLOR_ARRAY);
+ glDisableClientState (GL_EDGE_FLAG_ARRAY);
+ glDisableClientState (GL_INDEX_ARRAY);
+ glDisableClientState (GL_NORMAL_ARRAY);
+ glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+
+ if (!vertex_array_mode)
+ glEnableClientState (GL_VERTEX_ARRAY);
+
+ glVertexPointer (3, GL_FLOAT, 0, myPArray->vertices); // array of vertices
+
+ GLint renderMode;
+ glGetIntegerv (GL_RENDER_MODE, &renderMode);
+
+ if (myPArray->num_bounds > 0)
+ {
+ if (myPArray->num_edges > 0)
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ myPArray->bounds[i], (GLenum* )&myPArray->edges[n]);
+ n += myPArray->bounds[i];
}
}
- } else if( p->num_edges > 0 ) {
- if( renderMode == GL_FEEDBACK )
- draw_primitive_elements( p, draw_mode, p->num_edges,
- GL_UNSIGNED_INT, (GLenum*) p->edges);
- else
- glDrawElements( draw_mode, p->num_edges,
- GL_UNSIGNED_INT, p->edges);
- } else {
- if( renderMode == GL_FEEDBACK )
- draw_primitive_array( p, draw_mode, 0, p->num_vertexs);
else
- glDrawArrays( draw_mode, 0, p->num_vertexs);
+ {
+ for (i = n = 0; i < myPArray->num_bounds; ++i)
+ {
+ DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ n, myPArray->bounds[i]);
+ n += myPArray->bounds[i];
+ }
+ }
+ }
+ else if (myPArray->num_edges > 0)
+ {
+ DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ myPArray->num_edges, (GLenum* )myPArray->edges);
+ }
+ else
+ {
+ DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode,
+ 0, myPArray->num_vertexs);
}
-#ifdef OCC3192
- if( !vertex_array_mode ) glDisableClientState( GL_VERTEX_ARRAY );
+ if (!vertex_array_mode) glDisableClientState (GL_VERTEX_ARRAY);
+
+ if (color_array_mode) glEnableClientState (GL_COLOR_ARRAY);
+ if (edge_flag_array_mode) glEnableClientState (GL_EDGE_FLAG_ARRAY);
+ if (index_array_mode) glEnableClientState (GL_INDEX_ARRAY);
+ if (normal_array_mode) glEnableClientState (GL_NORMAL_ARRAY);
+ if (texture_coord_array_mode) glEnableClientState (GL_TEXTURE_COORD_ARRAY);
- if( color_array_mode ) glEnableClientState( GL_COLOR_ARRAY );
- if( edge_flag_array_mode ) glEnableClientState( GL_EDGE_FLAG_ARRAY );
- if( index_array_mode ) glEnableClientState( GL_INDEX_ARRAY );
- if( normal_array_mode ) glEnableClientState( GL_NORMAL_ARRAY );
- if( texture_coord_array_mode ) glEnableClientState( GL_TEXTURE_COORD_ARRAY );
-#endif
glPopAttrib();
}
- if( zbuff_state ) glEnable(GL_DEPTH_TEST);
-
+ if (zbuff_state)
+ glEnable(GL_DEPTH_TEST);
}
-static void draw_degenerates_as_bboxs ( call_def_parray p,
- tel_colour edge_colour )
+// =======================================================================
+// function : DrawDegeneratesAsBBoxs
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::DrawDegeneratesAsBBoxs (const TEL_COLOUR* theEdgeColour) const
{
+ GLfloat minp[3] = { FLT_MAX, FLT_MAX, FLT_MAX };
+ GLfloat maxp[3] = { FLT_MIN, FLT_MIN, FLT_MIN };
+ tel_point pv = myPArray->vertices;
+
+ glDisable (GL_LIGHTING);
+
+ glColor3fv (theEdgeColour->rgb);
+
+ for (Tint i = 0; i < myPArray->num_vertexs; ++i)
+ {
+ if (pv[i].xyz[0] < minp[0])
+ minp[0] = pv[i].xyz[0];
+ if (pv[i].xyz[1] < minp[1])
+ minp[1] = pv[i].xyz[1];
+ if (pv[i].xyz[2] < minp[2])
+ minp[2] = pv[i].xyz[2];
+
+ if (pv[i].xyz[0] > maxp[0])
+ maxp[0] = pv[i].xyz[0];
+ if (pv[i].xyz[1] > maxp[1])
+ maxp[1] = pv[i].xyz[1];
+ if (pv[i].xyz[2] > maxp[2])
+ maxp[2] = pv[i].xyz[2];
+ }
+
+ glBegin (GL_LINE_STRIP);
+
+ glVertex3fv (minp);
+ glVertex3f (minp[0], maxp[1], minp[2]);
+ glVertex3f (minp[0], maxp[1], maxp[2]);
+ glVertex3f (minp[0], minp[1], maxp[2]);
+ glVertex3f (minp[0], minp[1], minp[2]);
+
+ glVertex3f (maxp[0], minp[1], minp[2]);
+ glVertex3f (maxp[0], maxp[1], minp[2]);
+ glVertex3f (maxp[0], maxp[1], maxp[2]);
+ glVertex3f (maxp[0], minp[1], maxp[2]);
+ glVertex3f (maxp[0], minp[1], minp[2]);
- Tint i;
- GLfloat minp[ 3 ] = { FLT_MAX, FLT_MAX, FLT_MAX };
- GLfloat maxp[ 3 ] = { FLT_MIN, FLT_MIN, FLT_MIN };
- tel_point pv = p -> vertices;
-
- LightOff ();
-
- glColor3fv( edge_colour->rgb );
-
- for ( i=0 ; i<p->num_vertexs ; ++i ) {
- if ( pv[ i ].xyz[ 0 ] < minp[ 0 ] )
- minp[ 0 ] = pv[ i ].xyz[ 0 ] ;
- if ( pv[ i ].xyz[ 1 ] < minp[ 1 ] )
- minp[ 1 ] = pv[ i ].xyz[ 1 ] ;
- if ( pv[ i ].xyz[ 2 ] < minp[ 2 ] )
- minp[ 2 ] = pv[ i ].xyz[ 2 ] ;
-
- if ( pv[ i ].xyz[ 0 ] > maxp[ 0 ] )
- maxp[ 0 ] = pv[ i ].xyz[ 0 ] ;
- if ( pv[ i ].xyz[ 1 ] > maxp[ 1 ] )
- maxp[ 1 ] = pv[ i ].xyz[ 1 ] ;
- if ( pv[ i ].xyz[ 2 ] > maxp[ 2 ] )
- maxp[ 2 ] = pv[ i ].xyz[ 2 ] ;
- } /* end for ( i ) */
-
- glBegin ( GL_LINE_STRIP );
-
- glVertex3fv ( minp );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], minp[ 1 ], minp[ 2 ] );
-
- glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] );
- glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] );
- glVertex3f ( maxp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
- glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] );
-
- glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
- glVertex3fv ( maxp );
- glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] );
+ glVertex3f (maxp[0], minp[1], maxp[2]);
+ glVertex3f (minp[0], minp[1], maxp[2]);
+ glVertex3f (minp[0], maxp[1], maxp[2]);
+ glVertex3fv (maxp);
+ glVertex3f (maxp[0], maxp[1], minp[2]);
+ glVertex3f (minp[0], maxp[1], minp[2]);
glEnd();
+}
-} /* end draw_degenerates_as_bboxs */
+// =======================================================================
+// function : OpenGl_PrimitiveArray
+// purpose :
+// =======================================================================
+OpenGl_PrimitiveArray::OpenGl_PrimitiveArray (CALL_DEF_PARRAY* thePArray)
+: myPArray (thePArray),
+ myDrawMode (GL_NONE)
+{
+ switch (myPArray->type)
+ {
+ case TelPointsArrayType:
+ myDrawMode = GL_POINTS;
+ break;
+ case TelPolylinesArrayType:
+ myDrawMode = GL_LINE_STRIP;
+ break;
+ case TelSegmentsArrayType:
+ myDrawMode = GL_LINES;
+ break;
+ case TelPolygonsArrayType:
+ myDrawMode = GL_POLYGON;
+ break;
+ case TelTrianglesArrayType:
+ myDrawMode = GL_TRIANGLES;
+ break;
+ case TelQuadranglesArrayType:
+ myDrawMode = GL_QUADS;
+ break;
+ case TelTriangleStripsArrayType:
+ myDrawMode = GL_TRIANGLE_STRIP;
+ break;
+ case TelQuadrangleStripsArrayType:
+ myDrawMode = GL_QUAD_STRIP;
+ break;
+ case TelTriangleFansArrayType:
+ myDrawMode = GL_TRIANGLE_FAN;
+ break;
+ }
+}
+
+// =======================================================================
+// function : ~OpenGl_PrimitiveArray
+// purpose :
+// =======================================================================
+OpenGl_PrimitiveArray::~OpenGl_PrimitiveArray ()
+{
+ if (myPArray == NULL)
+ return;
+
+ if (myPArray->VBOEnabled == VBO_OK)
+ {
+ OpenGl_ResourceCleaner* aResCleaner = OpenGl_ResourceCleaner::GetInstance();
+ if (myPArray->bufferVBO[VBOEdges] != 0)
+ aResCleaner->AddResource ((GLCONTEXT )myPArray->contextId,
+ new OpenGl_ResourceVBO (myPArray->bufferVBO[VBOEdges]));
+ if (myPArray->bufferVBO[VBOVertices] != 0)
+ aResCleaner->AddResource ((GLCONTEXT )myPArray->contextId,
+ new OpenGl_ResourceVBO (myPArray->bufferVBO[VBOVertices]));
+ if (myPArray->bufferVBO[VBOVcolours] != 0)
+ aResCleaner->AddResource ((GLCONTEXT )myPArray->contextId,
+ new OpenGl_ResourceVBO (myPArray->bufferVBO[VBOVcolours]));
+ if (myPArray->bufferVBO[VBOVnormals] != 0)
+ aResCleaner->AddResource ((GLCONTEXT )myPArray->contextId,
+ new OpenGl_ResourceVBO (myPArray->bufferVBO[VBOVnormals]));
+ if (myPArray->bufferVBO[VBOVtexels] != 0)
+ aResCleaner->AddResource ((GLCONTEXT )myPArray->contextId,
+ new OpenGl_ResourceVBO (myPArray->bufferVBO[VBOVtexels]));
+ }
+}
+
+// =======================================================================
+// function : Render
+// purpose :
+// =======================================================================
+void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
+{
+ if (myPArray == NULL || myDrawMode == GL_NONE)
+ return;
+
+ // create VBOs on first render call
+ if (myPArray->VBOEnabled == -1) // special value for uninitialized state
+ {
+ myPArray->VBOEnabled = OpenGl_GraphicDriver::ToUseVBO() && (theWorkspace->GetGlContext()->arbVBO != NULL);
+ if (myPArray->VBOEnabled != 0)
+ BuildVBO (theWorkspace);
+ }
+
+ switch (myPArray->type)
+ {
+ case TelPointsArrayType:
+ case TelPolylinesArrayType:
+ case TelSegmentsArrayType:
+ {
+ glDisable (GL_LIGHTING);
+
+ if ((theWorkspace->NamedStatus & OPENGL_NS_ANIMATION) != 0 &&
+ (theWorkspace->NamedStatus & OPENGL_NS_WIREFRAME) == 0 &&
+ theWorkspace->DegenerateModel)
+ {
+ glDisable (GL_DEPTH_TEST);
+ if (theWorkspace->NamedStatus & OPENGL_NS_TEXTURE)
+ DisableTexture();
+ theWorkspace->NamedStatus |= OPENGL_NS_WIREFRAME;
+ }
+ break;
+ }
+ case TelPolygonsArrayType:
+ case TelTrianglesArrayType:
+ case TelQuadranglesArrayType:
+ case TelTriangleStripsArrayType:
+ case TelTriangleFansArrayType:
+ case TelQuadrangleStripsArrayType:
+ {
+ if ((theWorkspace->NamedStatus & OPENGL_NS_ANIMATION) != 0 &&
+ (theWorkspace->NamedStatus & OPENGL_NS_WIREFRAME) != 0 &&
+ theWorkspace->DegenerateModel < 2)
+ {
+ if (theWorkspace->NamedStatus & OPENGL_NS_TEXTURE)
+ EnableTexture();
+ glEnable (GL_DEPTH_TEST);
+ theWorkspace->NamedStatus &= ~OPENGL_NS_WIREFRAME;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace (Standard_True);
+ const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True);
+
+ Tint aFrontLightingModel = anAspectFace->Context().IntFront.color_mask;
+ const TEL_COLOUR* anInteriorColor = &anAspectFace->Context().IntFront.matcol;
+ const TEL_COLOUR* anEdgeColor = &anAspectFace->AspectEdge()->Color();
+ const TEL_COLOUR* aLineColor = &anAspectLine->Color();
+
+ // Use highlight colors
+ if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
+ {
+ anEdgeColor = anInteriorColor = aLineColor = theWorkspace->HighlightColor;
+ aFrontLightingModel = 0;
+ }
+
+ DrawArray (aFrontLightingModel,
+ anAspectFace->Context().InteriorStyle,
+ anAspectFace->Context().Edge,
+ anInteriorColor,
+ aLineColor,
+ anEdgeColor,
+ &anAspectFace->Context().IntFront,
+ theWorkspace);
+
+ switch (myPArray->type)
+ {
+ case TelPointsArrayType:
+ case TelPolylinesArrayType:
+ case TelSegmentsArrayType:
+ {
+ if (theWorkspace->NamedStatus & OPENGL_NS_TEXTURE)
+ EnableTexture();
+ }
+ }
+}
--- /dev/null
+// File: OpenGl_PrimitiveArray.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_PrimitiveArray_Header
+#define OpenGl_PrimitiveArray_Header
+
+#include <OpenGl_Context.hxx>
+
+#include <InterfaceGraphic_telem.hxx>
+#include <Aspect_InteriorStyle.hxx>
+
+#include <OpenGl_Element.hxx>
+
+struct OPENGL_SURF_PROP;
+
+class OpenGl_PrimitiveArray : public OpenGl_Element
+{
+public:
+
+ //! Default constructor
+ OpenGl_PrimitiveArray (CALL_DEF_PARRAY* thePArray);
+
+ //! Destructor
+ virtual ~OpenGl_PrimitiveArray();
+
+ //! Render primitives to the window
+ virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
+
+ CALL_DEF_PARRAY* PArray() const { return myPArray; }
+
+private:
+
+ //! VBO initialization procedures
+ Standard_Boolean BuildVBO (const Handle(OpenGl_Workspace)& theWorkspace) const;
+ void clearMemoryOwn() const;
+ void clearMemoryGL (const Handle(OpenGl_Context)& theGlContext) const;
+ Standard_Boolean checkSizeForGraphicMemory (const Handle(OpenGl_Context)& theGlContext) const;
+
+ //! Main procedure to draw array
+ void DrawArray (Tint theLightingModel,
+ const Aspect_InteriorStyle theInteriorStyle,
+ Tint theEdgeFlag,
+ const TEL_COLOUR* theInteriorColour,
+ const TEL_COLOUR* theLineColour,
+ const TEL_COLOUR* theEdgeColour,
+ const OPENGL_SURF_PROP* theFaceProp,
+ const Handle(OpenGl_Workspace)& theWorkspace) const;
+
+ //! Auxiliary procedures
+ void DrawEdges (const TEL_COLOUR* theEdgeColour,
+ const Handle(OpenGl_Workspace)& theWorkspace) const;
+
+ void DrawDegeneratesAsPoints (const TEL_COLOUR* theEdgeColour,
+ const float theSkipRatio) const;
+ void DrawDegeneratesAsLines (const TEL_COLOUR* theEdgeColour,
+ const Handle(OpenGl_Workspace)& theWorkspace) const;
+ void DrawDegeneratesAsBBoxs (const TEL_COLOUR* theEdgeColour) const;
+
+ void DrawDegeneratesPointsAsPoints() const;
+ void DrawDegeneratesLinesAsPoints() const;
+ void DrawDegeneratesLinesAsLines (const float theSkipRatio) const;
+ void DrawDegeneratesTrianglesAsPoints() const;
+ void DrawDegeneratesTrianglesAsLines (const float theSkipRatio) const;
+ void DrawDegeneratesTrianglestripsAsPoints() const;
+ void DrawDegeneratesTrianglestripsAsLines (const float theSkipRatio) const;
+ void DrawDegeneratesQuadranglesAsPoints() const;
+ void DrawDegeneratesQuadranglesAsLines (const float theSkipRatio) const;
+ void DrawDegeneratesQuadranglestripsAsPoints() const;
+ void DrawDegeneratesQuadranglestripsAsLines (const float theSkipRatio) const;
+ void DrawDegeneratesPolygonsAsPoints() const;
+ void DrawDegeneratesPolygonsAsLines (const float theSkipRatio) const;
+
+protected:
+
+ mutable CALL_DEF_PARRAY* myPArray;
+ GLenum myDrawMode;
+
+public:
+
+ IMPLEMENT_MEMORY_OPERATORS
+
+};
+
+#endif //OpenGl_PrimitiveArray_Header
#include <OpenGl_PrinterContext.hxx>
OpenGl_PrinterContext* OpenGl_PrinterContext::g_PrinterContext = NULL;
-GLCONTEXT OpenGl_PrinterContext::g_ContextId = NULL;
+GLCONTEXT OpenGl_PrinterContext::g_ContextId = NULL;
//=======================================================================
//function : OpenGl_PrinterContext
#include <InterfaceGraphic_Visual3d.hxx>
#include <TColStd_Array2OfReal.hxx>
+#include <OpenGl_Workspace.hxx>
+
class Standard_Transient;
class Handle(Standard_Type);
class Handle(MMgt_TShared);
GLCONTEXT myCtx;
// the printer context could be created only in method call_togl_print
- friend Standard_Boolean call_togl_print (CALL_DEF_VIEW *, CALL_DEF_LAYER *,
+ /*friend Standard_Boolean call_togl_print (CALL_DEF_VIEW *, CALL_DEF_LAYER *,
CALL_DEF_LAYER *,
const Aspect_Drawable, const int,
- const char*, const int, const float);
+ const char*, const int, const float);*/
+ friend Standard_Boolean OpenGl_Workspace::Print (const Graphic3d_CView& ACView,
+ const Aspect_CLayer2d& ACUnderLayer,
+ const Aspect_CLayer2d& ACOverLayer,
+ const Aspect_Handle hPrintDC,
+ const Standard_Boolean showBackground,
+ const Standard_CString filename,
+ const Aspect_PrintAlgo printAlgorithm,
+ const Standard_Real theScaleFactor);
};
#endif
--- /dev/null
+// File: OpenGl_PriorityList.cxx
+// Created: 2 November 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_PriorityList.hxx>
+
+#include <OpenGl_Structure.hxx>
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_PriorityList::Add (const OpenGl_Structure *AStructure,const Standard_Integer APriority)
+{
+ Standard_Integer anIndex = APriority;
+ if (anIndex < 0) anIndex = 0;
+ else if (anIndex >= myArray.Length()) anIndex = myArray.Length()-1;
+ myArray(anIndex).Append(AStructure);
+ myNbStructures++;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_PriorityList::Remove (const OpenGl_Structure *AStructure)
+{
+ const Standard_Integer aNbPr = myArray.Length();
+ Standard_Integer i = 0;
+ OpenGl_SequenceOfStructure::Iterator its;
+ for (; i < aNbPr; i++)
+ {
+ OpenGl_SequenceOfStructure &aSeq = myArray(i);
+ for (its.Init(aSeq); its.More(); its.Next())
+ {
+ if (its.Value() == AStructure)
+ {
+ aSeq.Remove(its);
+ myNbStructures--;
+ return;
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_PriorityList::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const Standard_Integer aNbPr = myArray.Length();
+ Standard_Integer i = 0;
+ OpenGl_SequenceOfStructure::Iterator its;
+ for (; i < aNbPr; i++)
+ {
+ for (its.Init(myArray(i)); its.More(); its.Next())
+ its.Value()->Render(AWorkspace);
+ }
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_PriorityList.hxx
+// Created: 2 November 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_PriorityList_Header
+#define _OpenGl_PriorityList_Header
+
+#include <NCollection_Sequence.hxx>
+#include <NCollection_Array1.hxx>
+
+#include <InterfaceGraphic_telem.hxx>
+
+#include <Handle_OpenGl_Workspace.hxx>
+
+class OpenGl_Structure;
+
+typedef NCollection_Sequence<const OpenGl_Structure*> OpenGl_SequenceOfStructure;
+typedef NCollection_Array1<OpenGl_SequenceOfStructure> OpenGl_ArrayOfStructure;
+
+class OpenGl_PriorityList
+{
+ public:
+
+ OpenGl_PriorityList (const Standard_Integer ANbPriorities = 11) : myArray(0,(ANbPriorities-1)), myNbStructures(0) {}
+ virtual ~OpenGl_PriorityList () {}
+
+ void Add (const OpenGl_Structure *AStructure, const Standard_Integer APriority);
+ void Remove (const OpenGl_Structure *AStructure);
+
+ Standard_Integer NbStructures () const { return myNbStructures; }
+
+ void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ OpenGl_ArrayOfStructure myArray;
+ Standard_Integer myNbStructures;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //_OpenGl_PriorityList_Header
--- /dev/null
+// File: OpenGl_QuadrangleStrip.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <OpenGl_QuadrangleStrip.hxx>
+
+#include <OpenGl_telem_util.hxx>
+#include <OpenGl_TextureBox.hxx>
+
+#include <OpenGl_AspectFace.hxx>
+#include <OpenGl_Structure.hxx>
+
+/*----------------------------------------------------------------------*/
+
+#define OPENGL_RAND() ( ( unsigned )( s_Rand = s_Rand * 214013L + 2531011L ) )
+
+/*----------------------------------------------------------------------*/
+
+extern void draw_degenerates_as_points ( PDS_INTERNAL, tel_point, Tint, const Handle(OpenGl_Workspace) & );
+extern void draw_degenerates_as_bboxs ( PDS_INTERNAL, tel_point, Tint, const Handle(OpenGl_Workspace) & );
+extern void set_drawable_items ( GLboolean*, int, const float );
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_QuadrangleStrip::draw_qstrip (const Tint front_lighting_model,
+ const Aspect_InteriorStyle interior_style,
+ const TEL_COLOUR *edge_colour,
+ const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ Tint i, m, newList = 0;
+ Tint nf, nv, nr, nc;
+ Tint lighting_model;
+
+ tel_point pfn = myData.fnormals;
+ tel_colour pfc = myData.fcolours;
+ tel_point pv = myData.vertices;
+ tel_colour pvc = myData.vcolours;
+ tel_point pvn = myData.vnormals;
+ tel_texture_coord pvt = myData.vtexturecoord;
+
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ {
+ pvc = 0;
+ pfc = 0;
+ }
+
+ if ( AWorkspace->DegenerateModel < 2 && interior_style != Aspect_IS_EMPTY )
+ {
+ if ( front_lighting_model )
+ glEnable(GL_LIGHTING);
+ else
+ glDisable(GL_LIGHTING);
+
+ lighting_model = front_lighting_model;
+ nr = myData.num_rows;
+ nc = myData.num_columns;
+ nf = nr * nc;
+ nv = ( nr + 1 ) * ( nc + 1 );
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 )
+ goto doDraw; /* Disable object display list out of animation */
+ /* window's context and bitmap's one */
+ if ( myDS->model != front_lighting_model || !myDS->list || myDS->model == -1 ||
+ ( AWorkspace->DegenerateModel && myDS->skipRatio != AWorkspace->SkipRatio ) )
+ {
+ myDS->skipRatio = AWorkspace->SkipRatio;
+ myDS->model = front_lighting_model;
+ myDS->degMode = AWorkspace->DegenerateModel;
+
+ if ( AWorkspace->SkipRatio == 0.f ) {
+
+ if ( !myDS->list ) myDS->list = glGenLists ( 1 );
+
+ glNewList ( myDS->list, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+doDraw:
+ if ( lighting_model )
+ {
+ if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 )
+ {
+ for ( m = 0; m < nr; ++m )
+ {
+ glBegin ( GL_QUAD_STRIP );
+ glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz );
+ glTexCoord2fv ( pvt[ m * ( nc + 1 ) ].xy );
+ glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
+ glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glTexCoord2fv ( pvt[ ( m + 1 ) * ( nc + 1 ) ].xy );
+ glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ for ( i = 1; i < nc + 1; ++i )
+ {
+ glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz );
+ glTexCoord2fv ( pvt[ i + m * ( nc + 1 ) ].xy );
+ glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
+ glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glTexCoord2fv ( pvt[ i + ( m + 1 ) * ( nc + 1 ) ].xy );
+ glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ }
+ glEnd ();
+ }
+ }
+ else
+ {
+ for ( m = 0; m < nr; ++m )
+ {
+ glBegin ( GL_QUAD_STRIP );
+ glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
+ glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ for ( i = 1; i < nc + 1; ++i )
+ {
+ glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
+ glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ }
+ glEnd ();
+ }
+ }
+ }
+ else
+ {
+ if ( pvc )
+ {
+ for ( m = 0; m < nr; ++m )
+ {
+ glBegin ( GL_QUAD_STRIP );
+ glColor3fv ( pvc[ m * ( nc + 1 ) ].rgb );
+ glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
+ glColor3fv ( pvc[ ( m + 1 ) * ( nc + 1 ) ].rgb );
+ glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ for ( i = 1; i < nc + 1; ++i )
+ {
+ glColor3fv ( pvc[ i + m * ( nc + 1 ) ].rgb );
+ glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
+ glColor3fv ( pvc[ i + ( m + 1 ) * ( nc + 1 ) ].rgb );
+ glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ }
+ glEnd ();
+ }
+ }
+ else if ( pfc )
+ {
+ glColor3fv ( pfc[ 0 ].rgb );
+ for ( m = 0; m < nr; ++m )
+ {
+ glBegin ( GL_QUAD_STRIP );
+ glColor3fv ( pfc[ m * nc ].rgb );
+ glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ for ( i = 1; i < nc + 1; ++i )
+ {
+ glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
+ glColor3fv ( pfc[ i - 1 + m * nc ].rgb );
+ glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ }
+ glEnd ();
+ }
+ }
+ else
+ {
+ for ( m = 0; m < nr; ++m )
+ {
+ glBegin ( GL_QUAD_STRIP );
+ glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ for ( i = 1; i < nc + 1; ++i )
+ {
+ glVertex3fv( pv[ i + m * ( nc + 1 ) ].xyz );
+ glVertex3fv( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ }
+ glEnd ();
+ }
+ }
+ }
+ }
+ else if ( AWorkspace->SkipRatio < 1.f )
+ {
+ set_drawable_items ( myDS->bDraw, nr, AWorkspace->SkipRatio );
+
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+
+ if ( lighting_model )
+ {
+ if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 )
+ {
+ for ( m = 0; m < nr; ++m )
+ {
+ if ( myDS->bDraw[ m ] )
+ {
+ glBegin ( GL_QUADS );
+ glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz );
+ glTexCoord2fv ( pvt[ m * ( nc + 1 ) ].xy );
+ glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
+ glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glTexCoord2fv ( pvt[ ( m + 1 ) * ( nc + 1 ) ].xy );
+ glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ for ( i = 1; i < nc + 1; ++i )
+ {
+ glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glTexCoord2fv ( pvt[ i + ( m + 1 ) * ( nc + 1 ) ].xy );
+ glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz );
+ glTexCoord2fv ( pvt[ i + m * ( nc + 1 ) ].xy );
+ glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
+ }
+ glEnd ();
+ }
+ }
+ }
+ else
+ {
+ for ( m = 0; m < nr; ++m )
+ {
+ if ( myDS->bDraw[ m ] )
+ {
+ glBegin ( GL_QUADS );
+ glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
+ glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ for ( i = 1; i < nc + 1; ++i )
+ {
+ glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
+ }
+ glEnd ();
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( pvc )
+ {
+ for ( m = 0; m < nr; ++m )
+ {
+ if ( myDS->bDraw[ m ] )
+ {
+ glBegin ( GL_QUAD_STRIP );
+ glColor3fv ( pvc[ m * ( nc + 1 ) ].rgb );
+ glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
+ glColor3fv ( pvc[ ( m + 1 ) * ( nc + 1 ) ].rgb );
+ glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ for ( i = 1; i < nc + 1; ++i )
+ {
+ glColor3fv ( pvc[ i + ( m + 1 ) * ( nc + 1 ) ].rgb );
+ glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glColor3fv ( pvc[ i + m * ( nc + 1 ) ].rgb );
+ glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
+ }
+ glEnd ();
+ }
+ }
+ }
+ else if ( pfc )
+ {
+ glColor3fv ( pfc[ 0 ].rgb );
+ for ( m = 0; m < nr; ++m )
+ {
+ if ( myDS->bDraw[ m ] )
+ {
+ glBegin ( GL_QUADS );
+ glColor3fv ( pfc[ m * nc ].rgb );
+ glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ for ( i = 1; i < nc + 1; ++i )
+ {
+ glColor3fv ( pfc[ i - 1 + m * nc ].rgb );
+ glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
+ }
+ glEnd ();
+ }
+ }
+ }
+ else
+ {
+ for ( m = 0; m < nr; ++m )
+ {
+ if ( myDS->bDraw[ m ] )
+ {
+ glBegin ( GL_QUADS );
+ glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
+ glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
+ for ( i = 1; i < nc + 1; ++i )
+ {
+ glVertex3fv( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
+ glVertex3fv( pv[ i + m * ( nc + 1 ) ].xyz );
+ }
+ glEnd ();
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+
+ } /* end else */
+ if ( newList ) glEndList ();
+
+ if ( AWorkspace->DegenerateModel ) return;
+
+ } else {
+
+ glCallList ( AWorkspace->SkipRatio <= 0.f ? myDS->list : myDS->dlist );
+
+ if ( AWorkspace->DegenerateModel ) return;
+
+ } /* end else */
+ }
+
+ i = 0;
+
+ /* OCC11904 -- Temporarily disable environment mapping */
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_TEXTURE_1D);
+ glDisable(GL_TEXTURE_2D);
+
+ switch ( AWorkspace->DegenerateModel )
+ {
+ default:
+ break;
+
+ case 2: /* XXX_TDM_WIREFRAME */
+ i = 1;
+ break;
+
+ case 3: /* XXX_TDM_MARKER */
+ draw_degenerates_as_points ( myDS, myData.vertices, ( myData.num_rows + 1 ) * ( myData.num_columns + 1 ), AWorkspace );
+ glPopAttrib();
+ return;
+
+ case 4: /* XXX_TDM_BBOX */
+ draw_degenerates_as_bboxs ( myDS, myData.vertices, ( myData.num_rows + 1 ) * ( myData.num_columns + 1 ), AWorkspace );
+ glPopAttrib();
+ return;
+ } /* end switch */
+
+ draw_edges ( edge_colour, interior_style, i, AWorkspace );
+
+ glPopAttrib();
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_QuadrangleStrip::draw_edges (const TEL_COLOUR *edge_colour, const Aspect_InteriorStyle interior_style,
+ Tint forceDraw, const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True );
+
+ if ( interior_style != Aspect_IS_HIDDENLINE && !forceDraw && aspect_face->Context().Edge == TOff )
+ return;
+
+ glDisable(GL_LIGHTING);
+ const GLboolean texture_on = IsTextureEnabled();
+ if ( texture_on ) DisableTexture();
+
+ // Setup line aspect
+ const OpenGl_AspectLine *aspect_line_old = AWorkspace->SetAspectLine( aspect_face->AspectEdge() );
+ AWorkspace->AspectLine( Standard_True );
+
+ tel_point pv = myData.vertices;
+ Tint nc = myData.num_columns;
+ Tint nf = myData.num_rows * myData.num_columns;
+
+ Tint newList = 0;
+
+ if ( !forceDraw )
+ draw_line_strip ( edge_colour, nf, nc );
+ else
+ {
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 )
+ goto doDraw; /* Disable object display list out of animation */
+ if ( myDS->degMode != 2 || myDS->skipRatio != AWorkspace->SkipRatio || !myDS->dlist ) {
+
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+
+ myDS->degMode = 2;
+ myDS->skipRatio = AWorkspace->SkipRatio;
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+doDraw:
+ glPushAttrib ( GL_DEPTH_BUFFER_BIT );
+ glDisable ( GL_DEPTH_TEST );
+
+ if ( AWorkspace->SkipRatio <= 0.f )
+
+ draw_line_strip ( edge_colour, nf, nc );
+
+ else if ( AWorkspace->SkipRatio < 1.f ) {
+
+ int i, m1, m2, n1, n2, n3, n4;
+
+ set_drawable_items ( myDS->bDraw, nf, AWorkspace->SkipRatio );
+
+ glColor3fv ( edge_colour -> rgb );
+
+ for ( i = 0; i < nf; ++i )
+
+ if ( myDS->bDraw[ i ] ) {
+
+ glBegin ( GL_LINE_STRIP );
+ m1 = i / nc;
+ m2 = i % nc;
+ n1 = m1 * ( nc + 1 ) + m2;
+ n2 = n1 + nc + 1;
+ n3 = n2 + 1;
+ n4 = n1 + 1;
+
+ glVertex3fv ( myData.vertices[ n1 ].xyz );
+ glVertex3fv ( myData.vertices[ n2 ].xyz );
+ glVertex3fv ( myData.vertices[ n3 ].xyz );
+ glVertex3fv ( myData.vertices[ n4 ].xyz );
+ glVertex3fv ( myData.vertices[ n1 ].xyz );
+ glEnd();
+
+ } /* end if */
+
+ } /* end if */
+
+ glPopAttrib ();
+ if ( newList ) glEndList ();
+
+ } else glCallList ( myDS->dlist );
+
+ } /* end else */
+
+ // Restore line context
+ AWorkspace->SetAspectLine( aspect_line_old );
+
+ if ( texture_on ) EnableTexture ();
+}
+
+void OpenGl_QuadrangleStrip::draw_line_strip (const TEL_COLOUR *c, Tint nf, Tint nc) const
+{
+ int i, m1, m2, n1, n2, n3, n4;
+
+ glColor3fv ( c->rgb );
+
+ for ( i = 0; i < nf; ++i )
+ {
+ glBegin ( GL_LINE_STRIP );
+ m1 = i / nc;
+ m2 = i % nc;
+ n1 = m1 * ( nc + 1 ) + m2;
+ n2 = n1 + nc + 1;
+ n3 = n2 + 1;
+ n4 = n1 + 1;
+
+ glVertex3fv ( myData.vertices[ n1 ].xyz );
+ glVertex3fv ( myData.vertices[ n2 ].xyz );
+ glVertex3fv ( myData.vertices[ n3 ].xyz );
+ glVertex3fv ( myData.vertices[ n4 ].xyz );
+ glVertex3fv ( myData.vertices[ n1 ].xyz );
+ glEnd();
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_QuadrangleStrip::OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertex& AListVertex)
+{
+ const Standard_Integer nbr = AListVertex.RowLength ();
+ const Standard_Integer nbc = AListVertex.ColLength ();
+ const Standard_Integer nbf = nbr*nbc;
+
+ // Dynamic allocation
+ TEL_POINT *points = new TEL_POINT[nbf];
+
+ const Standard_Integer LowerRow = AListVertex.LowerRow ();
+ const Standard_Integer UpperRow = AListVertex.UpperRow ();
+ const Standard_Integer LowerCol = AListVertex.LowerCol ();
+ const Standard_Integer UpperCol = AListVertex.UpperCol ();
+
+ Standard_Integer i, j, k = 0;
+ Standard_Real X, Y, Z;
+ for (i=LowerRow; i<=UpperRow; i++)
+ for (j=LowerCol; j<=UpperCol; j++)
+ {
+ AListVertex (i, j).Coord (X, Y, Z);
+ points[k].xyz[0] = float (X);
+ points[k].xyz[1] = float (Y);
+ points[k].xyz[2] = float (Z);
+ k++;
+ }
+
+ Init(nbr,nbc,points,NULL,NULL,NULL,NULL,NULL,TEL_SHAPE_UNKNOWN);
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_QuadrangleStrip::OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertexN& AListVertex)
+{
+ const Standard_Integer nbr = AListVertex.RowLength ();
+ const Standard_Integer nbc = AListVertex.ColLength ();
+ const Standard_Integer nbf = nbr*nbc;
+
+ // Dynamic allocation
+ TEL_POINT *points = new TEL_POINT[nbf];
+ TEL_POINT *normals = new TEL_POINT[nbf];
+
+ const Standard_Integer LowerRow = AListVertex.LowerRow ();
+ const Standard_Integer UpperRow = AListVertex.UpperRow ();
+ const Standard_Integer LowerCol = AListVertex.LowerCol ();
+ const Standard_Integer UpperCol = AListVertex.UpperCol ();
+
+ Standard_Integer i, j, k = 0;
+ Standard_Real X, Y, Z;
+ for (i=LowerRow; i<=UpperRow; i++)
+ for (j=LowerCol; j<=UpperCol; j++)
+ {
+ AListVertex (i, j).Coord (X, Y, Z);
+ points[k].xyz[0] = float (X);
+ points[k].xyz[1] = float (Y);
+ points[k].xyz[2] = float (Z);
+ AListVertex (i, j).Normal (X, Y, Z);
+ normals[k].xyz[0] = float (X);
+ normals[k].xyz[1] = float (Y);
+ normals[k].xyz[2] = float (Z);
+ k++;
+ }
+
+ Init(nbr,nbc,points,normals,NULL,NULL,NULL,NULL,TEL_SHAPE_UNKNOWN);
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_QuadrangleStrip::OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertexNT& AListVertex)
+{
+ const Standard_Integer nbr = AListVertex.RowLength ();
+ const Standard_Integer nbc = AListVertex.ColLength ();
+ const Standard_Integer nbf = nbr*nbc;
+
+ // Dynamic allocation
+ TEL_POINT *points = new TEL_POINT[nbf];
+ TEL_POINT *normals = new TEL_POINT[nbf];
+ TEL_TEXTURE_COORD *tcoords = new TEL_TEXTURE_COORD[nbf];
+
+ const Standard_Integer LowerRow = AListVertex.LowerRow ();
+ const Standard_Integer UpperRow = AListVertex.UpperRow ();
+ const Standard_Integer LowerCol = AListVertex.LowerCol ();
+ const Standard_Integer UpperCol = AListVertex.UpperCol ();
+
+ Standard_Integer i, j, k = 0;
+ Standard_Real X, Y, Z;
+ for (i=LowerRow; i<=UpperRow; i++)
+ for (j=LowerCol; j<=UpperCol; j++)
+ {
+ AListVertex (i, j).Coord (X, Y, Z);
+ points[k].xyz[0] = float (X);
+ points[k].xyz[1] = float (Y);
+ points[k].xyz[2] = float (Z);
+ AListVertex (i, j).Normal (X, Y, Z);
+ normals[k].xyz[0] = float (X);
+ normals[k].xyz[1] = float (Y);
+ normals[k].xyz[2] = float (Z);
+ AListVertex (i, j).TextureCoordinate(X, Y);
+ tcoords[k].xy[0] = float(X);
+ tcoords[k].xy[1] = float(Y);
+ k++;
+ }
+
+ Init(nbr,nbc,points,normals,NULL,tcoords,NULL,NULL,TEL_SHAPE_UNKNOWN);
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_QuadrangleStrip::Init (const Tint ANbRows, const Tint ANbCols, tel_point AVertices,
+ tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords,
+ tel_point AFNormals, tel_colour AFColors, const Tint AShapeFlag)
+{
+ myData.num_rows = ANbRows;
+ myData.num_columns = ANbCols;
+
+ const Tint nf = ANbRows * ANbCols;
+ const Tint nv = ( ANbRows+1 ) * ( ANbCols+1 );
+
+ Tint i;
+
+ // Store vertices
+ myData.vertices = AVertices;
+
+ // Store or compute (based on vertices) facet normals
+ if (AFNormals)
+ {
+ myData.facet_flag = TEL_FA_NORMAL;
+ myData.fnormals = new TEL_POINT[nf];
+ memcpy( myData.fnormals, AFNormals, nf*sizeof(TEL_POINT) );
+ for( i = 0; i < nf; i++ )
+ vecnrm( myData.fnormals[i].xyz );
+ }
+ else
+ {
+ myData.facet_flag = TEL_FA_NONE;
+ myData.fnormals = new TEL_POINT[nf];
+ for( i = 0; i < nf; i++ )
+ {
+ const Tint r = i/ANbCols;
+ const Tint c = i%ANbCols;
+ const Tint id = r*(ANbCols+1) + c;
+
+ TEL_POINT p1, p2, p3, p4;
+
+ p1 = myData.vertices[id];
+ p2 = myData.vertices[id+ANbCols+1];
+ p3 = myData.vertices[id+ANbCols+2];
+ p4 = myData.vertices[id+1];
+
+ p4.xyz[0] -= p2.xyz[0];
+ p4.xyz[1] -= p2.xyz[1];
+ p4.xyz[2] -= p2.xyz[2];
+
+ p4.xyz[0] += p1.xyz[0];
+ p4.xyz[1] += p1.xyz[1];
+ p4.xyz[2] += p1.xyz[2];
+
+ TelGetNormal( p4.xyz, p1.xyz, p3.xyz, myData.fnormals[i].xyz );
+ }
+ }
+
+ // Store or compute (based on facet normals) vertex normals
+ if (AVNormals)
+ {
+ myData.vertex_flag = TEL_VT_NORMAL;
+ myData.vnormals = AVNormals;
+ for( i = 0; i < nv; i++ )
+ vecnrm( myData.vnormals[i].xyz );
+ }
+ else
+ {
+ myData.vertex_flag = TEL_VT_NONE;
+ myData.vnormals = new TEL_POINT[nv];
+ Tint r, c, id;
+ for( i = 0; i < nv; i++ )
+ {
+ if( i == 0 )
+ myData.vnormals[i] = myData.fnormals[i];
+ else if( i == (nv-1) )
+ myData.vnormals[i] = myData.fnormals[nf-1];
+ else if( i == (nv-ANbCols-1) )
+ myData.vnormals[i] = myData.fnormals[nf-ANbCols];
+ else if( i == ANbCols )
+ myData.vnormals[i] = myData.fnormals[i-1];
+ else if( i%(ANbCols+1) == 0 )
+ {
+ r = i/(myData.num_columns+1);
+ myData.vnormals[i].xyz[0] = ( myData.fnormals[(r-1)*ANbCols].xyz[0] + myData.fnormals[r*ANbCols].xyz[0] ) / 2.0F;
+ myData.vnormals[i].xyz[1] = ( myData.fnormals[(r-1)*ANbCols].xyz[1] + myData.fnormals[r*ANbCols].xyz[1] ) / 2.0F;
+ myData.vnormals[i].xyz[2] = ( myData.fnormals[(r-1)*ANbCols].xyz[2] + myData.fnormals[r*ANbCols].xyz[2] ) / 2.0F;
+ }
+ else if( i <= ANbCols )
+ {
+ myData.vnormals[i].xyz[0] = ( myData.fnormals[i-1].xyz[0] + myData.fnormals[i].xyz[0] ) / 2.0F;
+ myData.vnormals[i].xyz[1] = ( myData.fnormals[i-1].xyz[1] + myData.fnormals[i].xyz[1] ) / 2.0F;
+ myData.vnormals[i].xyz[2] = ( myData.fnormals[i-1].xyz[2] + myData.fnormals[i].xyz[2] ) / 2.0F;
+ }
+ else if( i >= (nv-ANbCols-1 ) )
+ {
+ c = i%(ANbCols+1);
+ id = nf-ANbCols+c;
+
+ myData.vnormals[i].xyz[0] = ( myData.fnormals[id-1].xyz[0] + myData.fnormals[id].xyz[0] ) / 2.0F;
+ myData.vnormals[i].xyz[1] = ( myData.fnormals[id-1].xyz[1] + myData.fnormals[id].xyz[1] ) / 2.0F;
+ myData.vnormals[i].xyz[2] = ( myData.fnormals[id-1].xyz[2] + myData.fnormals[id].xyz[2] ) / 2.0F;
+ }
+ else if( (i+1)%(ANbCols+1) == 0 )
+ {
+ r = (i+1)/(ANbCols+1);
+ myData.vnormals[i].xyz[0] = ( myData.fnormals[(r-1)*ANbCols-1].xyz[0] + myData.fnormals[r*ANbCols-1].xyz[0] ) / 2.0F;
+ myData.vnormals[i].xyz[1] = ( myData.fnormals[(r-1)*ANbCols-1].xyz[1] + myData.fnormals[r*ANbCols-1].xyz[1] ) / 2.0F;
+ myData.vnormals[i].xyz[2] = ( myData.fnormals[(r-1)*ANbCols-1].xyz[2] + myData.fnormals[r*ANbCols-1].xyz[2] ) / 2.0F;
+ }
+ else
+ {
+ r = i/(ANbCols+1);
+ c = i%(ANbCols+1);
+
+ id = r*ANbCols+c;
+
+ myData.vnormals[i].xyz[0] = ( myData.fnormals[id].xyz[0] + myData.fnormals[id-ANbCols].xyz[0] + myData.fnormals[id-1].xyz[0] + myData.fnormals[id-ANbCols-1].xyz[0] ) / 4.0F;
+ myData.vnormals[i].xyz[1] = ( myData.fnormals[id].xyz[1] + myData.fnormals[id-ANbCols].xyz[1] + myData.fnormals[id-1].xyz[1] + myData.fnormals[id-ANbCols-1].xyz[1] ) / 4.0F;
+ myData.vnormals[i].xyz[2] = ( myData.fnormals[id].xyz[2] + myData.fnormals[id-ANbCols].xyz[2] + myData.fnormals[id-1].xyz[2] + myData.fnormals[id-ANbCols-1].xyz[2] ) / 4.0F;
+ }
+ }
+ }
+
+ myData.vcolours = AVColors;
+ myData.vtexturecoord = ATCoords;
+ myData.fcolours = AFColors;
+
+ myData.shape_flag = AShapeFlag;
+
+ myDS = new DS_INTERNAL;
+ myDS->list = 0;
+ myDS->dlist = 0;
+ myDS->degMode = 0;
+ myDS->model = -1;
+ myDS->skipRatio = 0.0F;
+ myDS->bDraw = new unsigned char[nv];
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_QuadrangleStrip::~OpenGl_QuadrangleStrip ()
+{
+ if( myData.fnormals )
+ delete[] myData.fnormals;
+ if( myData.fcolours )
+ delete[] myData.fcolours;
+ if( myData.vertices )
+ delete[] myData.vertices;
+ if( myData.vcolours )
+ delete[] myData.vcolours;
+ if( myData.vnormals )
+ delete[] myData.vnormals;
+ if ( myData.vtexturecoord )
+ delete[] myData.vtexturecoord;
+
+ if ( myDS )
+ {
+ if ( GET_GL_CONTEXT() != NULL )
+ {
+ if ( myDS->list ) glDeleteLists ( myDS->list, 1 );
+ if ( myDS->dlist ) glDeleteLists ( myDS->dlist, 1 );
+ }
+ if ( myDS->bDraw )
+ delete[] myDS->bDraw;
+
+ delete myDS;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_QuadrangleStrip::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True );
+
+ Tint front_lighting_model = aspect_face->Context().IntFront.color_mask;
+ const TEL_COLOUR *interior_colour = &aspect_face->Context().IntFront.matcol;
+ const TEL_COLOUR *edge_colour = &aspect_face->AspectEdge()->Color();
+
+ // Use highlight colors
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ {
+ edge_colour = interior_colour = AWorkspace->HighlightColor;
+ front_lighting_model = 0;
+ }
+
+ glColor3fv( interior_colour->rgb );
+
+ draw_qstrip( front_lighting_model,
+ aspect_face->Context().InteriorStyle,
+ edge_colour,
+ AWorkspace );
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_QuadrangleStrip.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_QuadrangleStrip_Header
+#define OpenGl_QuadrangleStrip_Header
+
+#include <InterfaceGraphic_telem.hxx>
+#include <Graphic3d_Array2OfVertex.hxx>
+#include <Graphic3d_Array2OfVertexN.hxx>
+#include <Graphic3d_Array2OfVertexNT.hxx>
+#include <Aspect_InteriorStyle.hxx>
+
+#include <OpenGl_Element.hxx>
+
+struct OPENGL_QSTRIP_DATA
+{
+ Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or
+ TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */
+ Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */
+ Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */
+ Tint num_rows, num_columns; /* Number of rows and columns */
+ tel_point fnormals; /* Facet normals */
+ tel_colour fcolours; /* Facet colours */
+ tel_point vertices; /* Vertices */
+ tel_colour vcolours; /* Vertex colour values */
+ tel_point vnormals; /* Vertex normals */
+ tel_texture_coord vtexturecoord; /* Texture coordinates */
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+class OpenGl_QuadrangleStrip : public OpenGl_Element
+{
+ public:
+
+ OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertex& AListVertex);
+ OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertexN& AListVertex);
+ OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertexNT& AListVertex);
+ virtual ~OpenGl_QuadrangleStrip ();
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ void Init (const Tint ANbRows, const Tint ANbCols, tel_point AVertices,
+ tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords,
+ tel_point AFNormals, tel_colour AFColors, const Tint AShapeFlag);
+
+ void draw_qstrip (const Tint, /* front_lighting_model, */
+ const Aspect_InteriorStyle, /* interior_style, */
+ const TEL_COLOUR *, /* edge_colour, */
+ const Handle(OpenGl_Workspace) &) const;
+
+ void draw_edges (const TEL_COLOUR *, const Aspect_InteriorStyle, Tint, const Handle(OpenGl_Workspace) &) const;
+
+ void draw_line_strip (const TEL_COLOUR *, Tint, Tint) const;
+
+ OPENGL_QSTRIP_DATA myData;
+ DS_INTERNAL *myDS;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_QuadrangleStrip_Header
class Standard_Transient;
class Handle(Standard_Type);
class Handle(MMgt_TShared);
+class Handle(OpenGl_Context);
class OpenGl_ResourceCleaner;
//! Class represents basic OpenGl memory resource, which
OpenGl_Resource(const OpenGl_Resource& theBase) : myId(theBase.myId) { }
//! Copy operation
- OpenGl_Resource& operator = (const OpenGl_Resource& theBase)
+ OpenGl_Resource& operator= (const OpenGl_Resource& theBase)
{
this->myId = theBase.myId;
return *this;
}
//! Destructor
- virtual ~OpenGl_Resource() { }
+ virtual ~OpenGl_Resource() {}
//! method clean() is accessible only by OpenGl_ResourceCleaner
friend class OpenGl_ResourceCleaner;
//! Clean procedure, should be called only by OpenGl_ResourceCleaner;
//! Each type of resource has its own cleaning procedure
- virtual void Clean() = 0;
+ virtual void Clean (const Handle(OpenGl_Context)& theGlContext) = 0;
protected:
//purpose : Clear the unused resources for active OpenGl context
//=======================================================================
-void OpenGl_ResourceCleaner::Cleanup()
+void OpenGl_ResourceCleaner::Cleanup (const Handle(OpenGl_Context)& theGlContext)
{
GLCONTEXT aContext = GET_GL_CONTEXT();
+ if (aContext == NULL)
+ return;
- // if we have active context, we can delete the resources
- if (aContext != NULL)
- // if the context is found in shared list
- if (mySharedContexts.Contains(aContext))
+ // if the context is found in shared list
+ if (mySharedContexts.Contains (aContext))
+ {
+ while (mySharedQueue.Size() > 0)
{
- while(mySharedQueue.Size() > 0)
- {
- mySharedQueue.Front()->Clean(); // delete resource memory
- mySharedQueue.Pop();
- }
+ mySharedQueue.Front()->Clean (theGlContext); // delete resource memory
+ mySharedQueue.Pop();
}
- // if the context is found in non-shared list
- else if (myInstanceQueue.IsBound(aContext))
+ }
+ // if the context is found in non-shared list
+ else if (myInstanceQueue.IsBound (aContext))
+ {
+ QueueOfResources* aQueue = &myInstanceQueue.ChangeFind (aContext);
+ while (aQueue->Size() > 0)
{
- QueueOfResources * aQueue = &myInstanceQueue.ChangeFind(aContext);
- while(aQueue->Size() > 0)
- {
- aQueue->Front()->Clean(); // delete resource memory
- aQueue->Pop();
- }
+ aQueue->Front()->Clean (theGlContext); // delete resource memory
+ aQueue->Pop();
}
+ }
}
//=======================================================================
#include <OpenGl_Resource.hxx>
class OpenGl_Resource;
-class Handle_OpenGl_Resource;
+class Handle(OpenGl_Resource);
+class Handle(OpenGl_Context);
typedef NCollection_Queue<Handle_OpenGl_Resource> QueueOfResources;
typedef NCollection_DataMap<GLCONTEXT, QueueOfResources> DataMapOfContextsResources;
//! You should add the cleaner resources by AddResources method;
//! It is suggested to call this method right before the OpenGl
//! new frame drawing procedure starts.
- void Cleanup();
+ void Cleanup (const Handle(OpenGl_Context)& theGlContext);
//! Remove the OpenGl context from the OpenGl_ResourceCleaner control list.
void RemoveContext(GLCONTEXT theContext);
#include <OpenGl_ResourceTexture.hxx>
#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_Extension.hxx>
-
-#ifdef __sgi
-#define glGenTextures glGenTexturesEXT
-#define glDeleteTextures glDeleteTexturesEXT
-#define glBindTexture glBindTextureEXT
-#endif /* IRIX */
//=======================================================================
//function : OpenGl_ResourceTexture
//purpose : Constructor
//=======================================================================
-
-OpenGl_ResourceTexture::OpenGl_ResourceTexture(GLuint theId)
-: OpenGl_Resource(theId)
+OpenGl_ResourceTexture::OpenGl_ResourceTexture (GLuint theId)
+: OpenGl_Resource (theId)
{
-
+ //
}
//=======================================================================
//function : OpenGl_ResourceTexture
//purpose : Copy constructor
//=======================================================================
-
-OpenGl_ResourceTexture::OpenGl_ResourceTexture(const OpenGl_ResourceTexture& theResource)
-: OpenGl_Resource(theResource)
+OpenGl_ResourceTexture::OpenGl_ResourceTexture (const OpenGl_ResourceTexture& theResource)
+: OpenGl_Resource (theResource)
{
-
+ //
}
//=======================================================================
//function : Clean
//purpose : free OpenGl memory allocated for texture resource
//=======================================================================
-
-void OpenGl_ResourceTexture::Clean()
+void OpenGl_ResourceTexture::Clean (const Handle(OpenGl_Context)& theGlContext)
{
- glDeleteTextures(1, &myId);
+ glDeleteTextures (1, &myId);
}
//! Clean procedure for texture resource;
//! Should be called by the OpenGl_ResourceCleaner
- void Clean();
+ virtual void Clean (const Handle(OpenGl_Context)& theGlContext);
};
// Author: Anton POLETAEV
#include <OpenGl_ResourceVBO.hxx>
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_Extension.hxx>
-
-typedef void (APIENTRY* PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
-
-extern PFNGLDELETEBUFFERSARBPROC glVBODeleteBuffersARB;
-extern int VBOExtension;
+#include <OpenGl_Context.hxx>
//=======================================================================
//function : OpenGl_ResourceVBO
//purpose : Constructor
//=======================================================================
-
-OpenGl_ResourceVBO::OpenGl_ResourceVBO(GLuint theId)
-: OpenGl_Resource(theId)
+OpenGl_ResourceVBO::OpenGl_ResourceVBO (GLuint theId)
+: OpenGl_Resource (theId)
{
-
+ //
}
//=======================================================================
//function : OpenGl_ResourceVBO
//purpose : Copy constructor
//=======================================================================
-
-OpenGl_ResourceVBO::OpenGl_ResourceVBO( const OpenGl_ResourceVBO& theResource)
-: OpenGl_Resource(theResource)
+OpenGl_ResourceVBO::OpenGl_ResourceVBO (const OpenGl_ResourceVBO& theResource)
+: OpenGl_Resource (theResource)
{
-
+ //
}
//=======================================================================
//function : Clean
//purpose : free OpenGl memory allocated for vbo resource
//=======================================================================
-
-void OpenGl_ResourceVBO::Clean()
+void OpenGl_ResourceVBO::Clean (const Handle(OpenGl_Context)& theGlContext)
{
- if (VBOExtension)
- glVBODeleteBuffersARB( 1 , &myId );
+ if (theGlContext->arbVBO == NULL)
+ {
+ std::cerr << "OpenGl_ResourceVBO::Clean(), active GL context doesn't support VBO!\n";
+ return;
+ }
+ theGlContext->arbVBO->glDeleteBuffersARB (1 , &myId);
}
//! Clean procedure for VBO resource;
//! Should be called by the OpenGl_ResourceCleaner
- void Clean();
+ virtual void Clean (const Handle(OpenGl_Context)& theGlContext);
};
--- /dev/null
+// File: OpenGl_Structure.cxx
+// Created: 1 August 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Structure.hxx>
+
+#include <OpenGl_Polyline.hxx>
+#include <OpenGl_Workspace.hxx>
+#include <OpenGl_View.hxx>
+
+#include <OpenGl_tgl_all.hxx>
+#include <OpenGl_telem_util.hxx>
+
+
+/*----------------------------------------------------------------------*/
+
+static void call_util_transpose_mat (float tmat[16], float mat[4][4])
+{
+ int i, j;
+
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ tmat[j*4+i] = mat[i][j];
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Structure::OpenGl_Structure ()
+: myTransformation(NULL),
+ myTransPers(NULL),
+ myDegenerateModel(NULL),
+ myAspectLine(NULL),
+ myAspectFace(NULL),
+ myAspectMarker(NULL),
+ myAspectText(NULL),
+ myHighlightBox(NULL),
+ myHighlightColor(NULL),
+ myNamedStatus(0)
+{
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Structure::~OpenGl_Structure ()
+{
+ if (myTransformation)
+ {
+ delete myTransformation;
+ myTransformation = NULL;
+ }
+ if (myTransPers)
+ {
+ delete myTransPers;
+ myTransPers = NULL;
+ }
+ if (myDegenerateModel)
+ {
+ delete myDegenerateModel;
+ myDegenerateModel = NULL;
+ }
+ if (myAspectLine)
+ {
+ delete myAspectLine;
+ myAspectLine = NULL;
+ }
+ if (myAspectFace)
+ {
+ delete myAspectFace;
+ myAspectFace = NULL;
+ }
+ if (myAspectMarker)
+ {
+ delete myAspectMarker;
+ myAspectMarker = NULL;
+ }
+ if (myAspectText)
+ {
+ delete myAspectText;
+ myAspectText = NULL;
+ }
+ ClearHighlightColor();
+ // Delete groups
+ Clear();
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::SetTransformation(const float *AMatrix)
+{
+ if (!myTransformation)
+ myTransformation = new OpenGl_Matrix;
+
+ matcpy( myTransformation->mat, AMatrix );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::SetTransformPersistence(const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers)
+{
+ if (!myTransPers)
+ myTransPers = new TEL_TRANSFORM_PERSISTENCE;
+
+ myTransPers->mode = ATransPers.Flag;
+ myTransPers->pointX = ATransPers.Point.x;
+ myTransPers->pointY = ATransPers.Point.y;
+ myTransPers->pointZ = ATransPers.Point.z;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::SetDegenerateModel (const Standard_Integer AMode, const float ASkipRatio)
+{
+ if (!myDegenerateModel)
+ myDegenerateModel = new DEGENERATION;
+
+ myDegenerateModel->mode = AMode;
+ myDegenerateModel->skipRatio = ASkipRatio;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::SetAspectLine (const CALL_DEF_CONTEXTLINE &AContext)
+{
+ if (!myAspectLine)
+ myAspectLine = new OpenGl_AspectLine;
+ myAspectLine->SetContext( AContext );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::SetAspectFace (const CALL_DEF_CONTEXTFILLAREA &AContext)
+{
+ if (!myAspectFace)
+ myAspectFace = new OpenGl_AspectFace;
+ myAspectFace->SetContext( AContext );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext)
+{
+ if (!myAspectMarker)
+ myAspectMarker = new OpenGl_AspectMarker;
+ myAspectMarker->SetContext( AContext );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::SetAspectText (const CALL_DEF_CONTEXTTEXT &AContext)
+{
+ if (!myAspectText)
+ myAspectText = new OpenGl_AspectText;
+ myAspectText->SetContext( AContext );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::SetHighlightBox (const CALL_DEF_BOUNDBOX &ABoundBox)
+{
+ if (!myHighlightBox)
+ myHighlightBox = new OpenGl_Group;
+ else
+ myHighlightBox->Clear();
+
+ CALL_DEF_CONTEXTLINE context_line;
+ context_line.Color = ABoundBox.Color;
+ context_line.LineType = Aspect_TOL_SOLID;
+ context_line.Width = 1.0f;
+ myHighlightBox->SetAspectLine( context_line );
+
+#define CALL_MAX_BOUNDBOXSIZE 16
+
+ Graphic3d_Array1OfVertex points(1,CALL_MAX_BOUNDBOXSIZE);
+ const float Xm = ABoundBox.Pmin.x;
+ const float Ym = ABoundBox.Pmin.y;
+ const float Zm = ABoundBox.Pmin.z;
+ const float XM = ABoundBox.Pmax.x;
+ const float YM = ABoundBox.Pmax.y;
+ const float ZM = ABoundBox.Pmax.z;
+ points( 1).SetCoord(Xm,Ym,Zm);
+ points( 2).SetCoord(Xm,Ym,ZM);
+ points( 3).SetCoord(Xm,YM,ZM);
+ points( 4).SetCoord(Xm,YM,Zm);
+ points( 5).SetCoord(Xm,Ym,Zm);
+ points( 6).SetCoord(XM,Ym,Zm);
+ points( 7).SetCoord(XM,Ym,ZM);
+ points( 8).SetCoord(XM,YM,ZM);
+ points( 9).SetCoord(XM,YM,Zm);
+ points(10).SetCoord(XM,Ym,Zm);
+ points(11).SetCoord(XM,YM,Zm);
+ points(12).SetCoord(Xm,YM,Zm);
+ points(13).SetCoord(Xm,YM,ZM);
+ points(14).SetCoord(XM,YM,ZM);
+ points(15).SetCoord(XM,Ym,ZM);
+ points(16).SetCoord(Xm,Ym,ZM);
+
+ OpenGl_Polyline *apolyline = new OpenGl_Polyline(points);
+ myHighlightBox->AddElement( TelPolyline, apolyline );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::ClearHighlightBox ()
+{
+ if (myHighlightBox)
+ {
+ delete myHighlightBox;
+ myHighlightBox = NULL;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::SetHighlightColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B)
+{
+ ClearHighlightBox();
+ if (!myHighlightColor)
+ myHighlightColor = new TEL_COLOUR;
+
+ myHighlightColor->rgb[0] = R;
+ myHighlightColor->rgb[1] = G;
+ myHighlightColor->rgb[2] = B;
+ myHighlightColor->rgb[3] = 1.F;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::ClearHighlightColor ()
+{
+ ClearHighlightBox();
+ if (myHighlightColor)
+ {
+ delete myHighlightColor;
+ myHighlightColor = NULL;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::Connect (const OpenGl_Structure *AStructure)
+{
+ Disconnect (AStructure);
+ myConnected.Append(AStructure);
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::Disconnect (const OpenGl_Structure *AStructure)
+{
+ OpenGl_ListOfStructure::Iterator its(myConnected);
+ while (its.More())
+ {
+ // Check for the given structure
+ if (its.Value() == AStructure)
+ {
+ myConnected.Remove(its);
+ return;
+ }
+ its.Next();
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Group * OpenGl_Structure::AddGroup ()
+{
+ // Create new group
+ OpenGl_Group *g = new OpenGl_Group;
+ myGroups.Append(g);
+ return g;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::RemoveGroup (const OpenGl_Group *AGroup)
+{
+ OpenGl_ListOfGroup::Iterator itg(myGroups);
+ while (itg.More())
+ {
+ // Check for the given group
+ if (itg.Value() == AGroup)
+ {
+ // Delete object
+ delete AGroup;
+ myGroups.Remove(itg);
+ return;
+ }
+ itg.Next();
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::Clear ()
+{
+ OpenGl_ListOfGroup::Iterator itg(myGroups);
+ while (itg.More())
+ {
+ // Delete objects
+ delete itg.Value();
+ itg.Next();
+ }
+ myGroups.Clear();
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ // Process the structure only if visible
+ if ( myNamedStatus & OPENGL_NS_HIDE )
+ return;
+
+ // Render named status
+ const Standard_Integer named_status = AWorkspace->NamedStatus;
+ AWorkspace->NamedStatus |= myNamedStatus;
+
+ // Is rendering in ADD or IMMEDIATE mode?
+ const Standard_Boolean isImmediate = (AWorkspace->NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) != 0;
+
+ // Apply local transformation
+ GLint matrix_mode = 0;
+ const OpenGl_Matrix *local_trsf = NULL;
+ if (myTransformation)
+ {
+ if (isImmediate)
+ {
+ float mat16[16];
+ call_util_transpose_mat (mat16, myTransformation->mat);
+ glGetIntegerv (GL_MATRIX_MODE, &matrix_mode);
+ glMatrixMode (GL_MODELVIEW);
+ glPushMatrix ();
+ glScalef (1.F, 1.F, 1.F);
+ glMultMatrixf (mat16);
+ }
+ else
+ {
+ glMatrixMode (GL_MODELVIEW);
+ glPushMatrix();
+
+ local_trsf = AWorkspace->SetStructureMatrix(myTransformation);
+ }
+ }
+
+ // Apply transform persistence
+ const TEL_TRANSFORM_PERSISTENCE *trans_pers = NULL;
+ if ( myTransPers && myTransPers->mode != 0 )
+ {
+ trans_pers = AWorkspace->ActiveView()->BeginTransformPersistence( myTransPers );
+ }
+
+ // Apply degeneration
+ if (myDegenerateModel)
+ {
+ if ( AWorkspace->NamedStatus & OPENGL_NS_DEGENERATION )
+ {
+ AWorkspace->DegenerateModel = myDegenerateModel->mode;
+ switch ( AWorkspace->DegenerateModel )
+ {
+ case 0: break;
+
+ default:
+ glLineWidth ( 1.0 );
+ glDisable ( GL_LINE_STIPPLE );
+
+ case 1:
+ AWorkspace->SkipRatio = myDegenerateModel->skipRatio;
+ }
+ }
+ }
+
+ // Apply aspects
+ const OpenGl_AspectLine *aspect_line = AWorkspace->AspectLine(Standard_False);
+ const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace(Standard_False);
+ const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker(Standard_False);
+ const OpenGl_AspectText *aspect_text = AWorkspace->AspectText(Standard_False);
+ if (myAspectLine)
+ AWorkspace->SetAspectLine(myAspectLine);
+ if (myAspectFace)
+ AWorkspace->SetAspectFace(myAspectFace);
+ if (myAspectMarker)
+ AWorkspace->SetAspectMarker(myAspectMarker);
+ if (myAspectText)
+ AWorkspace->SetAspectText(myAspectText);
+
+ // Apply highlight box
+ if (myHighlightBox)
+ myHighlightBox->Render( AWorkspace );
+
+ // Apply highlight color
+ const TEL_COLOUR *highlight_color = AWorkspace->HighlightColor;
+ if (myHighlightColor)
+ AWorkspace->HighlightColor = myHighlightColor;
+
+ // Render connected structures
+ OpenGl_ListOfStructure::Iterator its(myConnected);
+ while (its.More())
+ {
+ its.Value()->Render(AWorkspace);
+ its.Next();
+ }
+
+ // Render groups
+ OpenGl_ListOfGroup::Iterator itg(myGroups);
+ while (itg.More())
+ {
+ itg.Value()->Render(AWorkspace);
+ itg.Next();
+ }
+
+ // Restore highlight color
+ AWorkspace->HighlightColor = highlight_color;
+
+ // Restore aspects
+ AWorkspace->SetAspectLine(aspect_line);
+ AWorkspace->SetAspectFace(aspect_face);
+ AWorkspace->SetAspectMarker(aspect_marker);
+ AWorkspace->SetAspectText(aspect_text);
+
+ // Restore transform persistence
+ if ( myTransPers && myTransPers->mode != 0 )
+ {
+ AWorkspace->ActiveView()->BeginTransformPersistence( trans_pers );
+ }
+
+ // Restore local transformation
+ if (myTransformation)
+ {
+ if (isImmediate)
+ {
+ glPopMatrix ();
+ glMatrixMode (matrix_mode);
+ }
+ else
+ {
+ AWorkspace->SetStructureMatrix(local_trsf);
+
+ glMatrixMode (GL_MODELVIEW);
+ glPopMatrix();
+ }
+ }
+
+ // Restore named status
+ AWorkspace->NamedStatus = named_status;
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Structure.hxx
+// Created: 1 August 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_Structure_Header
+#define OpenGl_Structure_Header
+
+#include <NCollection_List.hxx>
+#include <InterfaceGraphic_Graphic3d.hxx>
+
+#include <OpenGl_AspectLine.hxx>
+#include <OpenGl_AspectFace.hxx>
+#include <OpenGl_AspectMarker.hxx>
+#include <OpenGl_AspectText.hxx>
+
+#include <OpenGl_Group.hxx>
+#include <OpenGl_Matrix.hxx>
+
+typedef NCollection_List<const OpenGl_Structure *> OpenGl_ListOfStructure;
+typedef NCollection_List<const OpenGl_Group *> OpenGl_ListOfGroup;
+
+class OpenGl_Structure : public OpenGl_Element
+{
+ public:
+ OpenGl_Structure ();
+ virtual ~OpenGl_Structure ();
+
+ void SetTransformation (const float *AMatrix);
+
+ void SetTransformPersistence (const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers);
+
+ void SetDegenerateModel (const Standard_Integer AMode, const float ASkipRatio);
+
+ void SetAspectLine (const CALL_DEF_CONTEXTLINE &AContext);
+ void SetAspectFace (const CALL_DEF_CONTEXTFILLAREA &AContext);
+ void SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext);
+ void SetAspectText (const CALL_DEF_CONTEXTTEXT &AContext);
+
+ void SetHighlightBox (const CALL_DEF_BOUNDBOX &ABoundBox);
+ void ClearHighlightBox ();
+
+ void SetHighlightColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B);
+ void ClearHighlightColor ();
+
+ void SetNamedStatus (const Standard_Integer aStatus) { myNamedStatus = aStatus; }
+
+ void Connect (const OpenGl_Structure *astructure);
+ void Disconnect (const OpenGl_Structure *astructure);
+
+ OpenGl_Group * AddGroup ();
+ void RemoveGroup (const OpenGl_Group *);
+ void Clear ();
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ //Structure_LABBegin
+ OpenGl_Matrix *myTransformation;
+ TEL_TRANSFORM_PERSISTENCE *myTransPers;
+ DEGENERATION *myDegenerateModel;
+ OpenGl_AspectLine *myAspectLine;
+ OpenGl_AspectFace *myAspectFace;
+ OpenGl_AspectMarker *myAspectMarker;
+ OpenGl_AspectText *myAspectText;
+ //Structure_LABHighlight
+ OpenGl_Group *myHighlightBox;
+ TEL_COLOUR *myHighlightColor;
+ //Structure_LABVisibility
+ //Structure_LABPick
+ int myNamedStatus; //Structure_LABNameSet
+
+ OpenGl_ListOfStructure myConnected;
+
+ OpenGl_ListOfGroup myGroups;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_Structure_Header
--- /dev/null
+// File: OpenGl_Text.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Text.hxx>
+
+#if (!defined(_WIN32) && !defined(__WIN32__))
+ #include <X11/Xlib.h>
+#endif
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <OpenGl_Memory.hxx>
+
+#include <OpenGl_AspectText.hxx>
+#include <OpenGl_Structure.hxx>
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Text::OpenGl_Text (const TCollection_ExtendedString& AText,
+ const Graphic3d_Vertex& APoint,
+ const Standard_Real AHeight,
+ const Graphic3d_HorizontalTextAlignment AHta,
+ const Graphic3d_VerticalTextAlignment AVta)
+: myString(NULL)
+{
+ const Techar *str = (const Techar *) AText.ToExtString();
+
+ //szv: instead of strlen + 1
+ int i = 0; while (str[i++]);
+
+ wchar_t *wstr = new wchar_t[i];
+
+ //szv: instead of memcpy
+ i = 0; while (wstr[i++] = (wchar_t)(*str++));
+ if (myString) delete[] myString;
+ myString = wstr;
+
+ Standard_Real X, Y, Z;
+ APoint.Coord(X, Y, Z);
+ myAttachPnt.xyz[0] = float (X);
+ myAttachPnt.xyz[1] = float (Y);
+ myAttachPnt.xyz[2] = float (Z);
+
+ myParam.Height = int (AHeight);
+
+ myParam.HAlign = AHta;
+ myParam.VAlign = AVta;
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_Text::~OpenGl_Text ()
+{
+ if (myString)
+ delete[] myString;
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Text::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ if ( AWorkspace->DegenerateModel > 0 && AWorkspace->SkipRatio >= 1.f )
+ return;
+
+ const OpenGl_AspectText *aspect_text = AWorkspace->AspectText( Standard_True );
+
+ const TEL_COLOUR *tcolor, *scolor;
+
+ // Use highlight colours
+ if( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ {
+ tcolor = scolor = AWorkspace->HighlightColor;
+ }
+ else
+ {
+ tcolor = &aspect_text->Color();
+ scolor = &aspect_text->SubtitleColor();
+ }
+
+ // Handle annotation style
+ GLboolean flag_zbuffer = GL_FALSE;
+ if (aspect_text->StyleType() == Aspect_TOST_ANNOTATION)
+ {
+ flag_zbuffer = glIsEnabled(GL_DEPTH_TEST);
+ if (flag_zbuffer) glDisable(GL_DEPTH_TEST);
+ }
+
+ AWorkspace->SetTextParam(&myParam);
+
+ GLboolean blend_state = GL_FALSE;
+ GLdouble modelMatrix[16], projMatrix[16];
+ GLint viewport[4];
+ GLdouble objrefX, objrefY, objrefZ;
+ GLdouble objX, objY, objZ;
+ GLdouble obj1X, obj1Y, obj1Z;
+ GLdouble obj2X, obj2Y, obj2Z;
+ GLdouble obj3X, obj3Y, obj3Z;
+ GLdouble winx1, winy1, winz1;
+ GLdouble winx, winy, winz;
+ GLint status;
+
+ /* display type of text */
+ if (aspect_text->DisplayType() != Aspect_TODT_NORMAL)
+ {
+ /* Optimisation: il faudrait ne faire le Get qu'une fois par Redraw */
+ glGetIntegerv (GL_VIEWPORT, viewport);
+ glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
+ glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
+
+ switch (aspect_text->DisplayType())
+ {
+ case Aspect_TODT_BLEND:
+ blend_state = glIsEnabled(GL_BLEND);
+ if (!blend_state) glEnable(GL_BLEND);
+ glEnable(GL_COLOR_LOGIC_OP);
+ glLogicOp(GL_XOR);
+ break;
+ case Aspect_TODT_SUBTITLE:
+ {
+ int sWidth, sAscent, sDescent;
+ AWorkspace->StringSize(myString, sWidth, sAscent, sDescent);
+
+ objrefX = (float)myAttachPnt.xyz[0];
+ objrefY = (float)myAttachPnt.xyz[1];
+ objrefZ = (float)myAttachPnt.xyz[2];
+ status = gluProject (objrefX, objrefY, objrefZ, modelMatrix, projMatrix, viewport,
+ &winx1, &winy1, &winz1);
+
+ winx = winx1;
+ winy = winy1-sDescent;
+ winz = winz1+0.00001;
+ status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
+ &objX, &objY, &objZ);
+
+ winx = winx1 + sWidth;
+ winy = winy1-sDescent;
+ winz = winz1+0.00001; /* il vaut mieux F+B / 1000000 ? */
+ status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
+ &obj1X, &obj1Y, &obj1Z);
+
+ winx = winx1 + sWidth;
+ winy = winy1 + sAscent;
+ winz = winz1+0.00001;
+ status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
+ &obj2X, &obj2Y, &obj2Z);
+
+ winx = winx1;
+ winy = winy1+ sAscent;
+ winz = winz1+0.00001;
+ status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
+ &obj3X, &obj3Y, &obj3Z);
+
+ glColor3fv( scolor->rgb );
+ glBegin(GL_POLYGON);
+ glVertex3d(objX, objY, objZ);
+ glVertex3d(obj1X, obj1Y, obj1Z);
+ glVertex3d(obj2X, obj2Y, obj2Z);
+ glVertex3d(obj3X, obj3Y, obj3Z);
+ glEnd();
+ break;
+ }
+
+ case Aspect_TODT_DEKALE:
+ objrefX = (float)myAttachPnt.xyz[0];
+ objrefY = (float)myAttachPnt.xyz[1];
+ objrefZ = (float)myAttachPnt.xyz[2];
+ status = gluProject (objrefX, objrefY, objrefZ, modelMatrix, projMatrix, viewport,
+ &winx1, &winy1, &winz1);
+
+ winx = winx1+1;
+ winy = winy1+1;
+ winz = winz1+0.00001;
+ status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
+ &objX, &objY, &objZ);
+
+ glColor3fv( scolor->rgb );
+ AWorkspace->RenderText( myString, 0, (float)objX, (float)objY,(float)objZ );
+ winx = winx1-1;
+ winy = winy1-1;
+ status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
+ &objX, &objY, &objZ);
+
+ AWorkspace->RenderText( myString, 0, (float)objX, (float)objY,(float)objZ );
+ winx = winx1-1;
+ winy = winy1+1;
+ status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
+ &objX, &objY, &objZ);
+
+ AWorkspace->RenderText( myString, 0, (float)objX, (float)objY,(float)objZ );
+ winx = winx1+1;
+ winy = winy1-1;
+ status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
+ &objX, &objY, &objZ);
+ AWorkspace->RenderText( myString, 0, (float)objX, (float)objY,(float)objZ );
+ break;
+ }
+ }
+
+ glColor3fv( tcolor->rgb );
+ AWorkspace->RenderText( myString, 0, (float)myAttachPnt.xyz[0], (float)myAttachPnt.xyz[1],(float)myAttachPnt.xyz[2] );
+ /* maj attributs */
+ if (flag_zbuffer) glEnable(GL_DEPTH_TEST);
+ if (aspect_text->DisplayType() == Aspect_TODT_BLEND)
+ {
+ if (!blend_state) glDisable(GL_BLEND);
+ glDisable(GL_COLOR_LOGIC_OP);
+ }
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Text.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_Text_Header
+#define OpenGl_Text_Header
+
+#include <OpenGl_Element.hxx>
+
+#include <OpenGl_TextParam.hxx>
+
+#include <TCollection_ExtendedString.hxx>
+#include <Graphic3d_Vertex.hxx>
+#include <Graphic3d_HorizontalTextAlignment.hxx>
+#include <Graphic3d_VerticalTextAlignment.hxx>
+
+class OpenGl_Text : public OpenGl_Element
+{
+ public:
+
+ OpenGl_Text (const TCollection_ExtendedString& AText,
+ const Graphic3d_Vertex& APoint,
+ const Standard_Real AHeight,
+ const Graphic3d_HorizontalTextAlignment AHta,
+ const Graphic3d_VerticalTextAlignment AVta);
+ virtual ~OpenGl_Text ();
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ OpenGl_TextParam myParam;
+ TEL_POINT myAttachPnt;
+ const wchar_t *myString;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_Text_Header
--- /dev/null
+// File: OpenGl_TextParam.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_TextParam_Header
+#define _OpenGl_TextParam_Header
+
+#include <InterfaceGraphic_telem.hxx>
+#include <Graphic3d_HorizontalTextAlignment.hxx>
+#include <Graphic3d_VerticalTextAlignment.hxx>
+
+struct OpenGl_TextParam
+{
+ int Height;
+ Graphic3d_HorizontalTextAlignment HAlign;
+ Graphic3d_VerticalTextAlignment VAlign;
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //_OpenGl_TextParam_Header
+++ /dev/null
-/*
-* Includes
-*/
-#include <stdio.h>
-#include <string.h>
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_FontMgr.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_TextRender.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_PrinterContext.hxx>
-#include <Standard_Stream.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-#include <OSD_Environment.hxx>
-#include <Quantity_NameOfColor.hxx>
-#include <AlienImage.hxx>
-
-#ifdef HAVE_GL2PS
-#include <gl2ps.h>
-#endif
-
-/*-----------------------------------------------------------------------------*/
-/*
-* Prototypes variables statiques
-*/
-
-int OpenGl_TextRender::curFont = -1;
-int OpenGl_TextRender::curSize = -1;
-int OpenGl_TextRender::curScale = -1;
-int OpenGl_TextRender::curTexFont = -1;
-
-OpenGl_TextRender::FontMapNode OpenGl_TextRender::fontMap[] = {
-
-#ifdef WNT
-
- { "Courier" , "Courier New" , OSD_FA_Regular },
- { "Times-Roman" , "Times New Roman", OSD_FA_Regular },
- { "Times-Bold" , "Times New Roman", OSD_FA_Bold },
- { "Times-Italic" , "Times New Roman", OSD_FA_Italic },
- { "Times-BoldItalic" , "Times New Roman", OSD_FA_BoldItalic },
- { "ZapfChancery-MediumItalic", "Script" , OSD_FA_Regular },
- { "Symbol" , "Symbol" , OSD_FA_Regular },
- { "ZapfDingbats" , "WingDings" , OSD_FA_Regular },
- { "Rock" , "Arial" , OSD_FA_Regular },
- { "Iris" , "Lucida Console" , OSD_FA_Regular }
-
-#else //X11
-
- { "Courier" , "Courier" , OSD_FA_Regular },
- { "Times-Roman" , "Times" , OSD_FA_Regular },
- { "Times-Bold" , "Times" , OSD_FA_Bold },
- { "Times-Italic" , "Times" , OSD_FA_Italic },
- { "Times-BoldItalic" , "Times" , OSD_FA_BoldItalic },
- { "Arial" , "Helvetica" , OSD_FA_Regular },
- { "ZapfChancery-MediumItalic", "-adobe-itc zapf chancery-medium-i-normal--*-*-*-*-*-*-iso8859-1" , OSD_FA_Regular },
- { "Symbol" , "-adobe-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , OSD_FA_Regular },
- { "ZapfDingbats" , "-adobe-itc zapf dingbats-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , OSD_FA_Regular },
- { "Rock" , "-sgi-rock-medium-r-normal--*-*-*-*-p-*-iso8859-1" , OSD_FA_Regular },
- { "Iris" , "--iris-medium-r-normal--*-*-*-*-m-*-iso8859-1" , OSD_FA_Regular }
-#endif
-
-};
-
-OpenGl_TextRender::FontEntry OpenGl_TextRender::fontEntry[] = {
-
- { "Courier" , "Courier New" },
- { "Times-Roman" , "Times New Roman" },
- { "Times-Bold" , "Times New Roman Bold" },
- { "Times-Italic" , "Times New Roman Italic" },
- { "Times-BoldItalic" , "Times New Roman Bold Italic" },
- { "ZapfChancery-MediumItalic", "Script" },
- { "Symbol" , "Symbol" },
- { "ZapfDingbats" , "WingDings" },
- { "Rock" , "Arial" },
- { "Iris" , "Lucida Console" }
-
-};
-
-#define NUM_FONT_ENTRIES (sizeof(fontMap)/sizeof(FontMapNode))
-
-/*-----------------------------------------------------------------------------*/
-
-/*
-* Constants
-*/
-
-#ifdef HAVE_GL2PS
-void OpenGl_TextRender::getGL2PSFontName(char *src_font, char *ps_font)
-{
- /*
- Convert font name used for rendering to some "good" font names
- that produce good vector text
- */
- static char const *family[] = {"Helvetica", "Courier", "Times"};
- static char const *italic[] = {"Oblique", "Oblique", "Italic"};
- static char const *base[] = {"", "", "-Roman"};
-
- int font = 0;
- int isBold = 0;
- int isItalic = 0;
-
-
- if( strstr( src_font, "Symbol" ) ){
- sprintf( ps_font, "%s", "Symbol" );
- return;
- }
-
- if( strstr( src_font, "ZapfDingbats" ) ){
- sprintf( ps_font, "%s", "WingDings" );
- return;
- }
-
- if ( strstr( src_font, "Courier" ) ){
- font = 1;
- }
- else if ( strstr( src_font, "Times" ) ){
- font = 2;
- }
-
- if ( strstr( src_font, "Bold" ) ){
- isBold = 1;
- }
-
- if ( strstr( src_font, "Italic" ) || strstr( src_font, "Oblique" ) ){
- isItalic = 1;
- }
-
- if ( isBold ){
- sprintf( ps_font, "%s-%s", family[font], "Bold");
- if ( isItalic ){
- sprintf(ps_font, "%s%s", ps_font, italic[font]);
- }
- }
- else if ( isItalic )
- {
- sprintf( ps_font, "%s-%s", family[font], italic[font] );
- }
- else
- {
- sprintf( ps_font, "%s%s", family[font], base[font] );
- }
-}
-#endif
-
-/*-----------------------------------------------------------------------------*/
-
-/*
-* Constructors
-*/
-
-OpenGl_TextRender::OpenGl_TextRender()
-: _CurrentFontId(-1),
-_XCurrentScale(1.f),
-_YCurrentScale(1.f) {
-}
-
-
-
-/*-----------------------------------------------------------------------------*/
-
-/*
-* Fonctions publiques
-*/
-
-OpenGl_TextRender* OpenGl_TextRender::instance() {
- static OpenGl_TextRender* _textRend = NULL;
- if ( _textRend == NULL )
- {
- _textRend = new OpenGl_TextRender();
- }
-
- return _textRend;
-}
-
-
-/*----------------------------------------------------------------------*/
-OpenGl_TextRender::FontMapNode OpenGl_TextRender::searchFontInMap( Handle(TCollection_HAsciiString)& fontName ) {
- for ( int i = 0; i < NUM_FONT_ENTRIES; ++i )
- {
- TCollection_AsciiString compare_String(fontMap[i].enumName) ;
- if(compare_String.IsEqual( fontName->ToCString() ))
- {
- return fontMap[i];
- }
- }
- //default font returns
- return fontMap[0];
-}
-
-/*-----------------------------------------------------------------------------*/
-
-Tint OpenGl_TextRender::FindFont ( Tchar* fontName,
- OSD_FontAspect aspect,
- Tfloat bestSize,
- Tfloat xScale ,
- Tfloat yScale )
-{
- if (!fontName)
- return -1;
- OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance();
-
- Handle(TCollection_HAsciiString) family_name
- = new TCollection_HAsciiString((char*)fontName);
-
- curFont = mgr->request_font(family_name,
- aspect,
- Standard_Integer(bestSize) );
-
- if( curFont == -1 ) {
- //try to use font names mapping
- FontMapNode newTempFont = searchFontInMap ( family_name );
- curFont = mgr->request_font( new TCollection_HAsciiString(newTempFont.FontName),
- newTempFont.fontAspect,
- Standard_Integer(bestSize) );
- }
-
- // Requested family name not found -> serach for any font family with given aspect and height
- family_name = new TCollection_HAsciiString( "" );
- if ( curFont == -1 ) {
- curFont = mgr->request_font(family_name, aspect, Standard_Integer(bestSize) );
- }
-
- // The last resort: trying to use ANY font available in the system
- if ( curFont == -1 ) {
- curFont = mgr->request_font(family_name, OSD_FA_Undefined, -1 );
- }
-
- if ( curFont != -1 )
- mgr->setCurrentScale( xScale, yScale );
- return curFont;
-
-}
-
-/*-----------------------------------------------------------------------------*/
-void OpenGl_TextRender::StringSize(const wchar_t *str, GLint *Width, GLint *Ascent, GLint *Descent)
-{
-
- /* int dir, asc, des;*/
- *Ascent = 0;
- *Descent = 0;
- *Width = 0;
- if (curFont != -1) {
- OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance();
- const FTFont* font = mgr->fontById( curFont );
- if ( font ) {
- *Width = GLint( mgr->computeWidth( curFont, str ) );
- *Ascent = GLint( font->Ascender() );
- *Descent = GLint( font->Descender() );
- }
- }
-#ifdef TRACE
- printf("sizeString::asc = %d des = %d width = %d \n", *Ascent, *Descent, *Width);
-#endif
-
-}
-
-/*-----------------------------------------------------------------------------*/
-
-void OpenGl_TextRender::RenderText ( const wchar_t* str, GLuint base, int is2d, GLfloat x, GLfloat y, GLfloat z )
-{
- GLdouble projMatrix[4][4], modelMatrix[4][4];
- GLint viewport[4];
- GLint widthFont, ascentFont, descentFont;
- GLdouble xdis = 0., ydis = 0.;
- GLint renderMode;
-
- // FTFont changes texture state when it renders and computes size for the text
- glPushAttrib(GL_TEXTURE_BIT);
- StringSize(str, &widthFont, &ascentFont, &descentFont );
-
- GLdouble identityMatrix[4][4] =
- {
- {1.,0.,0.,0.},
- {0.,1.,0.,0.},
- {0.,0.,1.,0.},
- {0.,0.,0.,1.}
- };
-
- TEL_ALIGN_DATA align;
-
- CMN_KEY key;
- key.id = TelTextAlign;
- key.data.pdata = &align;
- TsmGetAttri( 1, &key );
-
- Tfloat angle = 0;
- CMN_KEY keyAngle;
- keyAngle.id = TelTextAngle;//This flag responding about Angle text
- TsmGetAttri( 1, &keyAngle );
- angle = keyAngle.data.ldata;
-
- Tint zoom = 0;
- CMN_KEY keyZoom;
- keyZoom.id = TelTextZoomable;//This flag responding about Zoomable text
- TsmGetAttri( 1, &keyZoom );
- zoom = keyZoom.data.ldata;
-
- OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
- int vh = 2 ;
- int vv = 2 ;
-
- switch( align.Hmode )
- {
- case CALL_PHIGS_HOR_LEFT://0
- xdis =0.; vh = 1;
- break;
- case CALL_PHIGS_HOR_CENTER://1
- xdis = -(GLdouble)widthFont / 2.0; vh = 2;
- break;
- case CALL_PHIGS_HOR_RIGHT://2
- xdis = -(GLdouble)widthFont; vh = 3;
- break;
- default:
- xdis = 0.;
- }
-
- switch( align.Vmode )
- {
- case CALL_PHIGS_VERT_BOTTOM://0
- ydis = 0.; vv = 1;
- break;
- case CALL_PHIGS_VERT_CENTER://1
- ydis = -(GLdouble)(ascentFont) / 2.0 - descentFont; vv = 2;
- break;
- case CALL_PHIGS_VERT_TOP://2
- ydis = -(GLdouble)ascentFont - descentFont; vv= 3;
- break;
- default:
- ydis = 0.;
- }
-
- OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance();
-
- const FTFont* fnt = mgr->fontById( curFont );
- if ( !fnt ) {
- glPopAttrib();
- return;
- }
-
- float export_h = 1.;
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- if (is2d) {
- glLoadIdentity();
- glTranslatef(x, y, 0.f);
- glRotatef( 180, 1, 0, 0 );
- }
- else {
- GLdouble wx, wy, wz;
- GLdouble x1, y1, z1;
- GLdouble x2, y2, z2;
-
- glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble*)modelMatrix );
- glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble*)projMatrix );
- glGetIntegerv( GL_VIEWPORT, (GLint*)viewport );
-
- gluProject( x, y, z,
- (GLdouble*)modelMatrix,
- (GLdouble*)projMatrix,
- (GLint*)viewport,
- &wx, &wy, &wz );
- glLoadIdentity();
- gluUnProject( wx, wy, wz,
- (GLdouble*)identityMatrix, (GLdouble*)projMatrix, (GLint*)viewport,
- &x1, &y1 , &z1 );
-
- GLdouble h = (GLdouble)fnt->FaceSize();
-
-
- gluUnProject( wx, wy + h - 1., wz,
- (GLdouble*)identityMatrix, (GLdouble*)projMatrix, (GLint*)viewport,
- &x2, &y2, &z2 );
-
- h = (y2-y1)/h;
-
- glTranslated( x1, y1 , z1 );
- glRotated(angle, 0, 0, 1);
- glTranslated(xdis, ydis, 0);
-
- if( ! zoom )
- {
-#ifdef WNT
- // if the context has assigned printer context, use it's parameters
- OpenGl_PrinterContext* aPrinterContext =
- OpenGl_PrinterContext::GetPrinterContext( GET_GL_CONTEXT() );
- if( aPrinterContext )
- {
- // get printing scaling in x and y dimensions
- GLfloat aTextScalex = 1, aTextScaley = 1;
- aPrinterContext->GetScale( aTextScalex, aTextScaley );
-
- // text should be scaled in all directions with same
- // factor to save its proportions, so use height (y) scaling
- // as it is better for keeping text/3d graphics proportions
- glScalef( aTextScaley, aTextScaley, aTextScaley );
- }
-#endif
- glScaled( h, h, h );
- }
- else
- {
- export_h = h;
- }
- }
- glGetIntegerv(GL_RENDER_MODE, &renderMode);
- if ( renderMode == GL_FEEDBACK )
- {
-#ifdef HAVE_GL2PS
- CMN_KEY keyfontName;
- keyfontName.id = TelTextFont;//This flag responding about TextFontName
- TsmGetAttri( 1, &keyfontName );
- char *fontName = new char[strlen((char*)keyfontName.data.pdata) + 1];
- strcpy(fontName,(char*)keyfontName.data.pdata);
-
- export_h = (GLdouble)fnt->FaceSize() / export_h;
- int aligment = alignmentforgl2ps( vh, vv );
- glPopMatrix();
- ExportText( str, fontName, export_h, angle, aligment, x, y, z, is2d!=0 );
- delete [] fontName;
-#endif
- }
- else
- {
- mgr->render_text( curFont, str, is2d );
- glPopMatrix();
- }
- glPopAttrib();
-
-}
-
-#ifdef HAVE_GL2PS
-int OpenGl_TextRender::alignmentforgl2ps(int vh, int vy)
-{
- if( vh == 1 && vy == 1)
- {
- return 5;
- }
- if( vh == 2 && vy == 1)
- {
- return 4;
- }
- if( vh == 3 && vy == 1)
- {
- return 6;
- }
-
- if( vh == 1 && vy == 2)
- {
- return 2;
- }
- if( vh == 2 && vy == 2)
- {
- return 1;
- }
- if( vh == 3 && vy == 2)
- {
- return 3;
- }
-
- if( vh == 1 && vy == 3)
- {
- return 8;
- }
- if( vh == 2 && vy == 3)
- {
- return 7;
- }
- if( vh == 3 && vy == 3)
- {
- return 9;
- }
- return 0;
-};
-#endif
-
-/*-----------------------------------------------------------------------------*/
-void OpenGl_TextRender::ExportText( const wchar_t* text, char* fontname, GLfloat height, GLfloat angle, GLint alignment,
- GLfloat x, GLfloat y, GLfloat z, GLboolean is2d )
-{
-#ifdef HAVE_GL2PS
-
- GLubyte zero = 0;
- char ps_font[64];
-
- getGL2PSFontName(fontname, ps_font);
-
- if( is2d )
- glRasterPos2f( x, y );
- else
- glRasterPos3f( x, y, z );
-
- glBitmap( 1, 1, 0, 0, 0, 0, &zero );
-
- //szv: workaround for gl2ps!
- const int len = 4 * (wcslen(text) + 1); //szv: should be more than enough
- char *astr = new char[len];
- wcstombs(astr,text,len);
- gl2psTextOpt(astr, ps_font, height, alignment, angle);
- delete[] astr;
-
-#endif
-}
+++ /dev/null
-#include <OSD_FontAspect.hxx>
-#include <InterfaceGraphic_tgl_all.hxx>
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_telem.hxx>
-#include <NCollection_DataMap.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <FTFont.h>
-
-#define NUM_FONT_SIZES 40
-#define NUM_CHAR_FONT 1024
-#define CACHE_SIZE 30
-
-class OpenGl_TextRender
-{
- public:
-
- static OpenGl_TextRender* instance();
- Tint FindFont ( Tchar*, OSD_FontAspect, Tfloat, Tfloat = 1. , Tfloat = 1.);
-
- void StringSize( const wchar_t *text, GLint *width, GLint *ascent, GLint *descent);
- void RenderText( const wchar_t*, GLuint, int, GLfloat, GLfloat, GLfloat );
- void ExportText( const wchar_t* text, char* fontname, GLfloat height, GLfloat angle, GLint alingment, GLfloat x, GLfloat y, GLfloat z, GLboolean is2d );
-#ifdef HAVE_GL2PS
- static void getGL2PSFontName(char *src_font, char *ps_font);
-#endif
-
- private:
-
- static int curFont ;
- static int curSize ;
- static int curScale ;
- static int curTexFont ;
-#ifdef HAVE_GL2PS
- int alignmentforgl2ps(int Hmode, int Vmode);
-#endif
-
- struct FontMapNode
- {
- char* enumName;
- char* FontName;
- OSD_FontAspect fontAspect;
- };
-
- struct FontEntry
- {
- char* name;
- char* xlfd;
- float xsizes[NUM_FONT_SIZES];
- int count;
- };
-
- FontMapNode searchFontInMap( Handle(TCollection_HAsciiString)& fontName );
-
- static FontMapNode fontMap[];
- static FontEntry fontEntry[];
-
- OpenGl_TextRender();
- OpenGl_TextRender( const OpenGl_TextRender& ){};
- OpenGl_TextRender& operator = ( const OpenGl_TextRender&){ return *this;};
- ~OpenGl_TextRender(){};
-
-
- struct OGLFont_Cache
- {
- FTFont* Font;
- Standard_Integer FontHeight;
- GLCONTEXT GlContext;
- };
-
- typedef NCollection_DataMap<Standard_Integer,OGLFont_Cache> FontCache;
- FontCache _FontCache;
- Standard_Integer _CurrentFontId;
- Standard_ShortReal _XCurrentScale,
- _YCurrentScale;
-
-};
* generation de texture automatique en OBJECT_LINEAR
* rendu avec MODULATE
*
-* Remarques:
-* ~~~~~~~~~~~
-* Pour utiliser le binding des textures il faut que les 2 extensions
-*
-* o GL_EXT_texture_object:
-* - glBindTextureEXT, glGenTexturesEXT, glDeleteTexturesEXT
-*
-* Attention:
-* ~~~~~~~~~~~
-* Ce package a ete teste sur SGI, OSF, SUN, HP et WNT.
-*
-*
* Historique des modifications
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* 22-05-97: PCT ; Creation
* 22-07-98: FGU ; Ajout fonctions TransferTexture_To_Data() et TransferData_To_Texture()
*
*/
-/*----------------------------------------------------------------------*/
-
-#define IMP141100 /*GG_Allocates and free texture block count
-// correctly
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_Extension.hxx>
-#include <OpenGl_ImageBox.hxx>
+#include <OpenGl_Display.hxx>
#include <OpenGl_TextureBox.hxx>
+#include <OpenGl_ImageBox.hxx>
#include <OpenGl_Memory.hxx>
#include <OpenGl_ResourceCleaner.hxx>
#include <OpenGl_ResourceTexture.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define XPRINT
-#define XEXTENSION
-
#define GROW_TEXTURES 8
#define GROW_TEXTURES_DATA 8
#define GROW_CONTEXT 8
-#ifdef __sgi
-#define glGenTextures glGenTexturesEXT
-#define glDeleteTextures glDeleteTexturesEXT
-#define glBindTexture glBindTextureEXT
-#endif /* IRIX */
-
#ifndef max
-#define max(a,b) ((a) > (b)) ? (a) : (b);
+ #define max(a,b) ((a) > (b)) ? (a) : (b);
#endif
-/*----------------------------------------------------------------------*/
-/*
-* Types definis
-*/
-
typedef enum {TEXDATA_NONE, TEXDATA_1D, TEXDATA_2D, TEXDATA_2DMM} texDataStatus;
typedef enum {TEX_NONE, TEX_ALLOCATED} texStatus;
static GLenum status2type[] = { GL_NONE, GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_2D };
-static GLboolean init_extension = GL_FALSE;
-static GLboolean use_bind_texture = GL_FALSE;
-
/*----------------------------------------------------------------------*/
/*
* Fonctions privees
for (i=0; i<textures_data_size; i++)
if (texdata[i].status == TEXDATA_NONE)
{
-#ifndef IMP141100
- textures_data_count++;
-#else
- textures_data_count = max(textures_data_count,i+1);
-#endif
+ textures_data_count = max (textures_data_count, i + 1);
return i;
}
for (i=0; i<textures_size; i++)
if (textab[i].status == TEX_NONE)
{
-#ifndef IMP141100
- textures_count++;
-#else
- textures_count = max(textures_count,i+1);
-#endif
+ textures_count = max (textures_count, i + 1);
return i;
}
/*
* simulation du glGenTexturesEXT pour un context
*/
-static void MyGenTextureEXT(TextureID ID)
+static void MyGenTextureEXT (TextureID ID)
{
-#if defined(GL_EXT_texture_object)
-
- int Context;
- TextureDataID data;
-
- Context = textab[ID].context_count;
- data = textab[ID].data;
-
- if (!init_extension)
- {
- use_bind_texture = QueryExtension("GL_EXT_texture_object");
-
- init_extension = GL_TRUE;
-#ifdef EXTENSION
- printf("GL_EXT_texture_object %d\n", use_bind_texture);
-#endif
- }
-
- if (use_bind_texture)
- {
-#ifdef PRINT
- printf("MyGenTextureEXT::gen texture\n");
-#endif
-
- textab[ID].context[Context] = GET_GL_CONTEXT();
- textab[ID].drawable[Context] = GET_GLDEV_CONTEXT();
- textab[ID].use_bind_texture[Context] = (char)use_bind_texture;
- glGenTextures(1, &textab[ID].number[Context]);
- glBindTexture(texdata[data].type, textab[ID].number[Context]);
- LoadTexture(ID);
- textab[ID].context_count++;
- }
- else
-#endif /* GL_EXT_texture_object */
- if (current_texture_data != textab[ID].data)
- LoadTexture(ID);
+ int Context = textab[ID].context_count;
+ TextureDataID data = textab[ID].data;
+
+ textab[ID].context[Context] = GET_GL_CONTEXT();
+ textab[ID].drawable[Context] = GET_GLDEV_CONTEXT();
+ textab[ID].use_bind_texture[Context] = (char )GL_TRUE;
+ glGenTextures (1, &textab[ID].number[Context]);
+ glBindTexture (texdata[data].type, textab[ID].number[Context]);
+ LoadTexture (ID);
+ textab[ID].context_count++;
}
/*----------------------------------------------------------------------*/
/*
* simulation du glBindTextureEXT
*/
-static void MyBindTextureEXT(TextureID ID, int Context)
+static void MyBindTextureEXT (TextureID ID, int Context)
{
- /* si l'extension est presente, c'est facile */
-#if defined(GL_EXT_texture_object)
- TextureDataID data;
- data = textab[ID].data;
-
+ // si l'extension est presente, c'est facile
+ TextureDataID data = textab[ID].data;
if (textab[ID].status == TEXDATA_NONE)
return;
-#ifdef PRINT
- printf("MyBindTextureEXT::ID %d data %d context %d Current %d\n", ID, textab[ID].data, Context, current_texture_data);
-#endif
-
- if (textab[ID].use_bind_texture[Context])
+ // OCC11904 - make sure that the correct texture is bound before drawing
+ GLenum aParamName = textab[ID].status == TEXDATA_1D ? GL_TEXTURE_BINDING_1D : GL_TEXTURE_BINDING_2D;
+ GLint aCurrTex = -1;
+ glGetIntegerv (aParamName, &aCurrTex);
+ if (textab[ID].number[Context] != aCurrTex)
{
- /* OCC11904 - make sure that the correct texture is bound before drawing */
- GLenum aParamName = textab[ID].status == TEXDATA_1D ?
-GL_TEXTURE_BINDING_1D : GL_TEXTURE_BINDING_2D;
- GLint aCurrTex = -1;
- glGetIntegerv( aParamName, &aCurrTex );
- if ( textab[ID].number[Context] != aCurrTex )
- {
-#ifdef PRINT
- printf("MyBindTextureEXT::bind texture\n");
-#endif
- glBindTexture( texdata[data].type, textab[ID].number[Context] );
- }
- }
- /* sinon on reset tout */
- else
-#endif /* GL_EXT_texture_object */
- {
- /* OCC11904 - make sure that the correct texture is bound before drawing */
- GLenum aParamName = textab[ID].status == TEXDATA_1D ?
-GL_TEXTURE_BINDING_1D : GL_TEXTURE_BINDING_2D;
- GLint aCurrTex = -1;
- glGetIntegerv( aParamName, &aCurrTex );
- if ( textab[ID].number[Context] != aCurrTex )
- {
-#ifdef PRINT
- printf("MyBindTextureEXT::chargement sans bind de la texture\n");
-#endif
- LoadTexture(ID);
- }
+ glBindTexture (texdata[data].type, textab[ID].number[Context]);
}
}
TextureDataID data;
bool notResource = false; // if there old-style texture deletion
-#if defined(GL_EXT_texture_object)
GLCONTEXT cur_context;
GLDRAWABLE cur_drawable;
int i;
-#endif /* GL_EXT_texture_object */
if (!IsTextureValid(ID)) return;
texdata[data].share_count--;
if (texdata[data].share_count == 0)
{
- /* liberation des datas de la textures */
+ // liberation des datas de la textures
free(texdata[data].image);
-#if defined(GL_EXT_texture_object)
- if(use_bind_texture)
+ // liberation de la texture dans tous les contextes
+ cur_drawable = GET_GLDEV_CONTEXT();
+ for (i = 0; i < textab[ID].context_count; ++i)
{
- /* liberation de la texture dans tous les contextes */
- cur_drawable = GET_GLDEV_CONTEXT();
- for (i=0; i<textab[ID].context_count; i++)
- {
-#ifdef PRINT
- printf("FreeTexture::liberation de %d\n", ID);
-#endif
- cur_context = 0;
- bool isResource = false;
+ cur_context = 0;
+ bool isResource = false;
- if (textab[ID].use_bind_texture[i])
+ if (textab[ID].use_bind_texture[i])
+ {
+ if( !OpenGl_ResourceCleaner::GetInstance()->AddResource(textab[ID].context[i],
+ new OpenGl_ResourceTexture(textab[ID].number[i])) )
{
- if( !OpenGl_ResourceCleaner::GetInstance()->AddResource(textab[ID].context[i],
- new OpenGl_ResourceTexture(textab[ID].number[i])) )
- {
- GL_MAKE_CURRENT(GetCurrentDisplay(),
- textab[ID].drawable[i],
- textab[ID].context[i]);
-
- /*This check has been added to avoid exception,
- which is raised when trying to delete textures when no rendering context
- is available*/
- cur_context = GET_GL_CONTEXT();
- if( cur_context )
- glDeleteTextures(1, &textab[ID].number[i]);
- notResource = true;
- }
- else
- isResource = true;
+ GL_MAKE_CURRENT((openglDisplay.IsNull() ? (Display* )NULL : (Display* )openglDisplay->GetDisplay()),
+ textab[ID].drawable[i],
+ textab[ID].context[i]);
+
+ // This check has been added to avoid exception,
+ // which is raised when trying to delete textures when no rendering context is available
+ cur_context = GET_GL_CONTEXT();
+ if (cur_context)
+ glDeleteTextures (1, &textab[ID].number[i]);
+ notResource = true;
+ }
+ else
+ {
+ isResource = true;
}
-
- if( !isResource && cur_context )
- glFinish();
}
- if( notResource )
- GL_MAKE_CURRENT(GetCurrentDisplay(),cur_drawable,cur_context);
+ if( !isResource && cur_context )
+ glFinish();
+ }
- texdata[data].status = TEXDATA_NONE;
-#ifndef IMP141100
- textures_data_count--;
-#else
- if( data+1 == textures_data_count ) textures_data_count--;
-#endif
- free(textab[ID].context);
- free(textab[ID].drawable);
- free(textab[ID].use_bind_texture);
- free(textab[ID].number);
+ if( notResource )
+ GL_MAKE_CURRENT((openglDisplay.IsNull() ? (Display* )NULL : (Display* )openglDisplay->GetDisplay()),
+ cur_drawable, cur_context);
+
+ texdata[data].status = TEXDATA_NONE;
+ if (data + 1 == textures_data_count)
+ {
+ --textures_data_count;
+ }
- } /* use_bind_texture */
-#endif /* GL_EXT_texture_object */
+ free(textab[ID].context);
+ free(textab[ID].drawable);
+ free(textab[ID].use_bind_texture);
+ free(textab[ID].number);
}
textab[ID].status = TEX_NONE;
-#ifndef IMP141100
- textures_count--;
-#else
- if( ID+1 == textures_count ) textures_count--;
-#endif
+ if (ID + 1 == textures_count)
+ {
+ --textures_count;
+ }
current_texture_data = TEXTUREDATA_ERROR;
}
--- /dev/null
+// File: OpenGl_TriangleStrip.cxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <OpenGl_TriangleStrip.hxx>
+
+#include <OpenGl_telem_util.hxx>
+#include <OpenGl_TextureBox.hxx>
+
+#include <OpenGl_AspectFace.hxx>
+#include <OpenGl_Structure.hxx>
+
+/*----------------------------------------------------------------------*/
+
+void draw_degenerates_as_points ( PDS_INTERNAL, tel_point, Tint, const Handle(OpenGl_Workspace) & );
+void draw_degenerates_as_bboxs ( PDS_INTERNAL, tel_point, Tint, const Handle(OpenGl_Workspace) & );
+extern void set_drawable_items ( GLboolean*, int, const float );
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_TriangleStrip::draw_tmesh (const Tint front_lighting_model,
+ const Aspect_InteriorStyle interior_style,
+ const TEL_COLOUR *edge_colour,
+ const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ Tint i, newList = 0;
+
+ tel_point pfn = myData.fnormals;
+ tel_colour pfc = myData.fcolours;
+ tel_point pv = myData.vertices;
+ tel_colour pvc = myData.vcolours;
+ tel_point pvn = myData.vnormals;
+ tel_texture_coord pvt = myData.vtexturecoord;
+
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) pvc = pfc = 0;
+
+ if ( AWorkspace->DegenerateModel < 2 && interior_style != Aspect_IS_EMPTY )
+ {
+ if ( front_lighting_model )
+ glEnable(GL_LIGHTING);
+ else
+ glDisable(GL_LIGHTING);
+
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 )
+ goto doDraw; /* Disable object display list out of animation */
+ if ( myDS->model != front_lighting_model || !myDS->list || myDS->model == -1 ||
+ ( AWorkspace->DegenerateModel && myDS->skipRatio != AWorkspace->SkipRatio ) )
+ {
+ myDS->skipRatio = AWorkspace->SkipRatio;
+ myDS->model = front_lighting_model;
+ myDS->degMode = AWorkspace->DegenerateModel;
+
+ if ( AWorkspace->SkipRatio <= 0.f ) {
+
+ if ( !myDS->list ) myDS->list = glGenLists ( 1 );
+
+ glNewList ( myDS->list, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+doDraw:
+ glBegin ( GL_TRIANGLE_STRIP );
+
+ if ( front_lighting_model )
+ {
+ if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 )
+ {
+ for ( i = 0; i < myData.num_facets + 2; ++i )
+ {
+ glNormal3fv ( pvn[ i ].xyz );
+ glTexCoord2fv ( pvt[ i ].xy );
+ glVertex3fv ( pv [ i ].xyz );
+ }
+ }
+ else
+ for ( i = 0; i < myData.num_facets + 2; ++i )
+ {
+ glNormal3fv( pvn[ i ].xyz );
+ glVertex3fv( pv[ i ].xyz );
+ }
+ }
+ else
+ {
+ if ( pvc )
+ {
+ for ( i = 0; i < myData.num_facets + 2; ++i )
+ {
+ glColor3fv ( pvc[ i ].rgb );
+ glVertex3fv ( pv [ i ].xyz );
+ }
+ }
+ else if ( pfc )
+ {
+ glColor3fv ( pfc[ 0 ].rgb );
+ glVertex3fv ( pv [ 0 ].xyz );
+ glVertex3fv ( pv [ 1 ].xyz );
+ for ( i = 2; i < myData.num_facets + 2; ++i )
+ {
+ glColor3fv ( pfc[ i - 2 ].rgb );
+ glVertex3fv( pv [ i ].xyz );
+ }
+ }
+ else
+ for ( i = 0; i < myData.num_facets + 2; ++i ) glVertex3fv ( pv[ i ].xyz );
+ }
+ glEnd ();
+ }
+ else if ( AWorkspace->SkipRatio < 1.f )
+ {
+ set_drawable_items ( myDS->bDraw, myData.num_facets + 2, AWorkspace->SkipRatio );
+
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+
+ glBegin ( GL_TRIANGLES );
+
+ if ( front_lighting_model )
+ {
+ if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 )
+ {
+ for ( i = 0; i < myData.num_facets; ++i )
+ {
+ if ( myDS->bDraw[ i ] )
+ {
+ if ( i % 2 )
+ {
+ glNormal3fv ( pvn[ i ].xyz );
+ glTexCoord2fv ( pvt[ i ].xy );
+ glVertex3fv ( pv [ i ].xyz );
+ glNormal3fv ( pvn[ i + 2 ].xyz );
+ glTexCoord2fv ( pvt[ i + 2 ].xy );
+ glVertex3fv ( pv [ i + 2 ].xyz );
+ glNormal3fv ( pvn[ i + 1 ].xyz );
+ glTexCoord2fv ( pvt[ i + 1 ].xy );
+ glVertex3fv ( pv [ i + 1 ].xyz );
+ }
+ else
+ {
+ glNormal3fv ( pvn[ i + 2 ].xyz );
+ glTexCoord2fv ( pvt[ i + 2 ].xy );
+ glVertex3fv ( pv [ i + 2 ].xyz );
+ glNormal3fv ( pvn[ i ].xyz );
+ glTexCoord2fv ( pvt[ i ].xy );
+ glVertex3fv ( pv [ i ].xyz );
+ glNormal3fv ( pvn[ i + 1 ].xyz );
+ glTexCoord2fv ( pvt[ i + 1 ].xy );
+ glVertex3fv ( pv [ i + 1 ].xyz );
+ }
+ }
+ }
+ }
+ else
+ {
+ for ( i = 0; i < myData.num_facets; ++i )
+ {
+ if ( myDS->bDraw[ i ] )
+ {
+ if ( i % 2 )
+ {
+ glNormal3fv( pvn[ i ].xyz );
+ glVertex3fv( pv[ i ].xyz );
+ glNormal3fv( pvn[ i + 2 ].xyz );
+ glVertex3fv( pv[ i + 2 ].xyz );
+ glNormal3fv( pvn[ i + 1 ].xyz );
+ glVertex3fv( pv[ i + 1 ].xyz );
+ }
+ else
+ {
+ glNormal3fv( pvn[ i + 2 ].xyz );
+ glVertex3fv( pv[ i + 2 ].xyz );
+ glNormal3fv( pvn[ i ].xyz );
+ glVertex3fv( pv[ i ].xyz );
+ glNormal3fv( pvn[ i + 1 ].xyz );
+ glVertex3fv( pv[ i + 1 ].xyz );
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( pvc )
+ {
+ for ( i = 0; i < myData.num_facets; ++i )
+ {
+ if ( myDS->bDraw[ i ] )
+ {
+ if ( i % 2 )
+ {
+ glColor3fv ( pvc[ i ].rgb );
+ glVertex3fv ( pv [ i ].xyz );
+ glColor3fv ( pvc[ i + 2 ].rgb );
+ glVertex3fv ( pv [ i + 2 ].xyz );
+ glColor3fv ( pvc[ i + 1 ].rgb );
+ glVertex3fv ( pv [ i + 1 ].xyz );
+ }
+ else
+ {
+ glColor3fv ( pvc[ i + 2 ].rgb );
+ glVertex3fv ( pv [ i + 2 ].xyz );
+ glColor3fv ( pvc[ i ].rgb );
+ glVertex3fv ( pv [ i ].xyz );
+ glColor3fv ( pvc[ i + 1 ].rgb );
+ glVertex3fv ( pv [ i + 1 ].xyz );
+ }
+ }
+ }
+ }
+ else if ( pfc )
+ {
+ for ( i = 0; i < myData.num_facets; ++i )
+ {
+ if ( myDS->bDraw[ i ] )
+ {
+ if ( i % 2 )
+ {
+ glColor3fv ( pfc[ i ].rgb );
+ glVertex3fv( pv [ i ].xyz );
+ glColor3fv ( pfc[ i + 2 ].rgb );
+ glVertex3fv( pv [ i + 2 ].xyz );
+ glColor3fv ( pfc[ i + 1 ].rgb );
+ glVertex3fv( pv [ i + 1 ].xyz );
+ }
+ else
+ {
+ glColor3fv ( pfc[ i + 2 ].rgb );
+ glVertex3fv( pv [ i + 2 ].xyz );
+ glColor3fv ( pfc[ i ].rgb );
+ glVertex3fv( pv [ i ].xyz );
+ glColor3fv ( pfc[ i + 1 ].rgb );
+ glVertex3fv( pv [ i + 1 ].xyz );
+ }
+ }
+ }
+ }
+ else
+ {
+ for ( i = 0; i < myData.num_facets; ++i )
+ {
+ if ( myDS->bDraw[ i ] )
+ {
+ if ( i % 2 )
+ {
+ glVertex3fv ( pv[ i ].xyz );
+ glVertex3fv ( pv[ i + 2 ].xyz );
+ glVertex3fv ( pv[ i + 1 ].xyz );
+ }
+ else
+ {
+ glVertex3fv ( pv[ i + 2 ].xyz );
+ glVertex3fv ( pv[ i ].xyz );
+ glVertex3fv ( pv[ i + 1 ].xyz );
+ }
+ }
+ }
+ }
+ }
+ glEnd ();
+ }
+ else
+ {
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+ }
+ if ( newList ) glEndList ();
+
+ if ( AWorkspace->DegenerateModel ) return;
+ }
+ else
+ {
+ glCallList ( AWorkspace->SkipRatio <= 0.f ? myDS->list : myDS->dlist );
+ if ( AWorkspace->DegenerateModel ) return;
+ }
+ }
+
+ i = 0;
+
+ /* OCC11904 -- Temporarily disable environment mapping */
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_TEXTURE_1D);
+ glDisable(GL_TEXTURE_2D);
+
+ switch ( AWorkspace->DegenerateModel )
+ {
+ default:
+ break;
+
+ case 2: /* XXX_TDM_WIREFRAME */
+ i = 1;
+ break;
+
+ case 3: /* XXX_TDM_MARKER */
+ draw_degenerates_as_points ( myDS, myData.vertices, myData.num_facets + 2, AWorkspace );
+ glPopAttrib();
+ return;
+
+ case 4: /* XXX_TDM_BBOX */
+ draw_degenerates_as_bboxs ( myDS, myData.vertices, myData.num_facets + 2, AWorkspace );
+ glPopAttrib();
+ return;
+ }
+
+ draw_edges ( edge_colour, interior_style, i, AWorkspace );
+
+ glPopAttrib();
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_TriangleStrip::draw_edges (const TEL_COLOUR *edge_colour, const Aspect_InteriorStyle interior_style,
+ Tint forceDraw, const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True );
+
+ if ( interior_style != Aspect_IS_HIDDENLINE && !forceDraw && aspect_face->Context().Edge == TOff )
+ return;
+
+ glDisable(GL_LIGHTING);
+ const GLboolean texture_on = IsTextureEnabled();
+ if ( texture_on ) DisableTexture();
+
+ // Setup line aspect
+ const OpenGl_AspectLine *aspect_line_old = AWorkspace->SetAspectLine( aspect_face->AspectEdge() );
+ AWorkspace->AspectLine( Standard_True );
+
+ tel_point pv = myData.vertices;
+ Tint i, newList = 0;
+
+ glColor3fv ( edge_colour->rgb );
+ if ( !forceDraw )
+ draw_line_loop ();
+ else
+ {
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 )
+ goto doDraw; /* Disable object display list out of animation */
+ if ( myDS->degMode != 2 || myDS->skipRatio != AWorkspace->SkipRatio || !myDS->dlist ) {
+
+ if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 );
+
+ myDS->degMode = 2;
+ myDS->skipRatio = AWorkspace->SkipRatio;
+ glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+doDraw:
+ glPushAttrib ( GL_DEPTH_BUFFER_BIT );
+ glDisable ( GL_DEPTH_TEST );
+
+ if ( AWorkspace->SkipRatio <= 0.f )
+
+ draw_line_loop ();
+
+ else if ( AWorkspace->SkipRatio < 1.f ) {
+
+ set_drawable_items ( myDS->bDraw, myData.num_facets + 2, AWorkspace->SkipRatio );
+
+ for ( i = 0; i < myData.num_facets; ++i )
+
+ if ( myDS->bDraw[ i ] ) {
+
+ glBegin ( GL_LINE_LOOP );
+ glVertex3fv ( pv[ i ].xyz );
+ glVertex3fv ( pv[ i + 1 ].xyz );
+ glVertex3fv ( pv[ i + 2 ].xyz );
+ glEnd();
+
+ } /* end if */
+
+ } /* end if */
+
+ glPopAttrib ();
+ if ( newList ) glEndList ();
+
+ } else glCallList ( myDS->dlist );
+
+ } /* end else */
+
+ // Restore line context
+ AWorkspace->SetAspectLine( aspect_line_old );
+
+ if ( texture_on ) EnableTexture ();
+}
+
+void draw_degenerates_as_points ( PDS_INTERNAL pd, tel_point p, Tint n, const Handle(OpenGl_Workspace) &AWorkspace )
+{
+ int i, newList = 0;
+
+ glDisable(GL_LIGHTING);
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 )
+ goto doDraw; /* Disable object display list out of animation */
+ if ( pd -> degMode != 3 || pd -> skipRatio != AWorkspace->SkipRatio || !pd -> dlist ) {
+
+ if ( !pd -> dlist ) pd -> dlist = glGenLists ( 1 );
+
+ pd -> degMode = 3;
+ pd -> skipRatio = AWorkspace->SkipRatio;
+ glNewList ( pd -> dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+
+ if ( AWorkspace->SkipRatio <= 0.f ) {
+doDraw:
+ glBegin ( GL_POINTS );
+
+ for ( i = 0; i < n; ++i ) glVertex3fv ( p[ i ].xyz );
+
+ glEnd ();
+
+ } else if ( AWorkspace->SkipRatio < 1.f ) {
+
+ set_drawable_items ( pd -> bDraw, n, AWorkspace->SkipRatio );
+
+ glBegin ( GL_POINTS );
+
+ for ( i = 0; i < n; ++i )
+
+ if ( pd -> bDraw[ i ] ) glVertex3fv ( p[ i ].xyz );
+
+ glEnd ();
+
+ } /* end if */
+ if ( newList ) glEndList ();
+
+ } else glCallList ( pd -> dlist );
+
+} /* end draw_degenerates_as_points */
+
+void draw_degenerates_as_bboxs ( PDS_INTERNAL pd, tel_point p, Tint n, const Handle(OpenGl_Workspace) &AWorkspace )
+{
+ int i, newList = 0;
+ GLfloat minp[ 3 ] = { FLT_MAX, FLT_MAX, FLT_MAX };
+ GLfloat maxp[ 3 ] = { FLT_MIN, FLT_MIN, FLT_MIN };
+
+ glDisable(GL_LIGHTING);
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 )
+ goto doDraw; /* Disable object display list out of animation */
+ if ( pd -> degMode != 4 || !pd -> dlist ) {
+
+ if ( !pd -> dlist ) pd -> dlist = glGenLists ( 1 );
+
+ pd -> degMode = 4;
+
+ glNewList ( pd -> dlist, GL_COMPILE_AND_EXECUTE );
+ newList = 1;
+doDraw:
+ for ( i = 0; i < n; ++i ) {
+
+ TEL_POINT pt = p[ i ];
+
+ if ( pt.xyz[ 0 ] < minp[ 0 ] )
+ minp[ 0 ] = pt.xyz[ 0 ] ;
+ if ( pt.xyz[ 1 ] < minp[ 1 ] )
+ minp[ 1 ] = pt.xyz[ 1 ] ;
+ if ( pt.xyz[ 2 ] < minp[ 2 ] )
+ minp[ 2 ] = pt.xyz[ 2 ] ;
+
+ if ( pt.xyz[ 0 ] > maxp[ 0 ] )
+ maxp[ 0 ] = pt.xyz[ 0 ] ;
+ if ( pt.xyz[ 1 ] > maxp[ 1 ] )
+ maxp[ 1 ] = pt.xyz[ 1 ] ;
+ if ( pt.xyz[ 2 ] > maxp[ 2 ] )
+ maxp[ 2 ] = pt.xyz[ 2 ] ;
+
+ } /* end for */
+
+ glBegin ( GL_LINE_STRIP );
+
+ glVertex3fv ( minp );
+ glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] );
+ glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( minp[ 0 ], minp[ 1 ], minp[ 2 ] );
+
+ glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] );
+ glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] );
+ glVertex3f ( maxp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] );
+
+ glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] );
+ glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
+ glVertex3fv ( maxp );
+ glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] );
+ glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] );
+
+ glEnd();
+ if ( newList ) glEndList ();
+
+ } else glCallList ( pd -> dlist );
+
+} /* end draw_degenerates_as_bboxs */
+
+void OpenGl_TriangleStrip::draw_line_loop () const
+{
+ int i;
+
+ for ( i = 0; i < myData.num_facets; ++i )
+ {
+ glBegin ( GL_LINE_LOOP );
+ glVertex3fv ( myData.vertices[ i ].xyz );
+ glVertex3fv ( myData.vertices[ i + 1 ].xyz );
+ glVertex3fv ( myData.vertices[ i + 2 ].xyz );
+ glEnd();
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_TriangleStrip::OpenGl_TriangleStrip (const Graphic3d_Array1OfVertex& AListVertex)
+{
+ const Standard_Integer nv = AListVertex.Length();
+ TEL_POINT *points = new TEL_POINT[nv];
+ memcpy( points, &AListVertex(AListVertex.Lower()), nv*sizeof(TEL_POINT) );
+
+ Init(nv - 2,points,NULL,NULL,NULL,NULL,NULL);
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_TriangleStrip::OpenGl_TriangleStrip (const Graphic3d_Array1OfVertexN& AListVertex)
+{
+ const Standard_Integer nv = AListVertex.Length ();
+
+ // Dynamic allocation
+ TEL_POINT *points = new TEL_POINT[nv];
+ TEL_POINT *normals = new TEL_POINT[nv];
+
+ Standard_Integer i = 0, j = AListVertex.Lower();
+ Standard_Real X, Y, Z;
+ for ( ; i < nv; i++, j++)
+ {
+ AListVertex(j).Coord (X, Y, Z);
+ points[i].xyz[0] = float (X);
+ points[i].xyz[1] = float (Y);
+ points[i].xyz[2] = float (Z);
+ AListVertex(j).Normal (X, Y, Z);
+ normals[i].xyz[0] = float (X);
+ normals[i].xyz[1] = float (Y);
+ normals[i].xyz[2] = float (Z);
+ }
+
+ Init(nv - 2,points,normals,NULL,NULL,NULL,NULL);
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_TriangleStrip::OpenGl_TriangleStrip (const Graphic3d_Array1OfVertexNT& AListVertex)
+{
+ const Standard_Integer nv = AListVertex.Length();
+
+ // Dynamic allocation
+ TEL_POINT *points = new TEL_POINT[nv];
+ TEL_POINT *normals = new TEL_POINT[nv];
+ TEL_TEXTURE_COORD *tcoords = new TEL_TEXTURE_COORD[nv];
+
+ Standard_Integer i = 0, j = AListVertex.Upper();
+ Standard_Real X, Y, Z;
+ for ( ; i < nv; i++, j++)
+ {
+ AListVertex(j).Coord (X, Y, Z);
+ points[i].xyz[0] = float (X);
+ points[i].xyz[1] = float (Y);
+ points[i].xyz[2] = float (Z);
+ AListVertex(j).Normal (X, Y, Z);
+ normals[i].xyz[0] = float (X);
+ normals[i].xyz[1] = float (Y);
+ normals[i].xyz[2] = float (Z);
+ AListVertex(j).TextureCoordinate(X, Y);
+ tcoords[i].xy[0] = float(X);
+ tcoords[i].xy[1] = float(Y);
+ }
+
+ Init(nv - 2,points,normals,NULL,tcoords,NULL,NULL);
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_TriangleStrip::Init (const Tint ANbFacets, tel_point AVertices,
+ tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords,
+ tel_point AFNormals, tel_colour AFColors)
+{
+ myData.num_facets = ANbFacets;
+
+ const Tint nv = ANbFacets + 2;
+
+ Tint i;
+
+ // Store vertices
+ myData.vertices = AVertices;
+
+ // Store or compute (based on vertices) facet normals
+ if (AFNormals)
+ {
+ myData.facet_flag = TEL_FA_NORMAL;
+ myData.fnormals = AFNormals;
+ for( i = 0; i < ANbFacets; i++ )
+ vecnrm( myData.fnormals[i].xyz );
+ }
+ else
+ {
+ myData.facet_flag = TEL_FA_NONE;
+ myData.fnormals = new TEL_POINT[ANbFacets];
+ for( i = 0; i < ANbFacets; i++ )
+ {
+ if( i & 1 ) {
+ TelGetNormal( myData.vertices[i].xyz, myData.vertices[i+2].xyz, myData.vertices[i+1].xyz, myData.fnormals[i].xyz );
+ } else {
+ TelGetNormal( myData.vertices[i].xyz, myData.vertices[i+1].xyz, myData.vertices[i+2].xyz, myData.fnormals[i].xyz );
+ }
+ }
+ }
+
+ // Store or compute (based on facet normals) vertex normals
+ if (AVNormals)
+ {
+ myData.vertex_flag = TEL_VT_NORMAL;
+ myData.vnormals = AVNormals;
+ for( i = 0; i < nv; i++ )
+ vecnrm( myData.vnormals[i].xyz );
+ }
+ else
+ {
+ myData.vertex_flag = TEL_VT_NONE;
+ myData.vnormals = new TEL_POINT[nv];
+ for( i = 2; i < ANbFacets; i++ )
+ {
+ myData.vnormals[i].xyz[0] = ( myData.fnormals[i-2].xyz[0] + myData.fnormals[i-1].xyz[0] + myData.fnormals[i].xyz[0] ) / 3.0F;
+ myData.vnormals[i].xyz[1] = ( myData.fnormals[i-2].xyz[1] + myData.fnormals[i-1].xyz[1] + myData.fnormals[i].xyz[1] ) / 3.0F;
+ myData.vnormals[i].xyz[2] = ( myData.fnormals[i-2].xyz[2] + myData.fnormals[i-1].xyz[2] + myData.fnormals[i].xyz[2] ) / 3.0F;
+ }
+ myData.vnormals[0] = myData.fnormals[0];
+ if( ANbFacets > 1 )
+ {
+ myData.vnormals[1].xyz[0] = ( myData.fnormals[0].xyz[0] + myData.fnormals[1].xyz[0] ) / 2.0F;
+ myData.vnormals[1].xyz[1] = ( myData.fnormals[0].xyz[1] + myData.fnormals[1].xyz[1] ) / 2.0F;
+ myData.vnormals[1].xyz[2] = ( myData.fnormals[0].xyz[2] + myData.fnormals[1].xyz[2] ) / 2.0F;
+ }
+ else
+ myData.vnormals[1] = myData.fnormals[0];
+ // last vertex
+ myData.vnormals[ANbFacets+1] = myData.fnormals[ANbFacets-1];
+ // second last vertex
+ if( ANbFacets > 1 )
+ {
+ myData.vnormals[ANbFacets].xyz[0] = ( myData.fnormals[ANbFacets-1].xyz[0] + myData.fnormals[ANbFacets-2].xyz[0] ) / 2.0F;
+ myData.vnormals[ANbFacets].xyz[1] = ( myData.fnormals[ANbFacets-1].xyz[1] + myData.fnormals[ANbFacets-2].xyz[1] ) / 2.0F;
+ myData.vnormals[ANbFacets].xyz[2] = ( myData.fnormals[ANbFacets-1].xyz[2] + myData.fnormals[ANbFacets-2].xyz[2] ) / 2.0F;
+ }
+ }
+
+ myData.vcolours = AVColors;
+ myData.vtexturecoord = ATCoords;
+ myData.fcolours = AFColors;
+
+ myDS = new DS_INTERNAL();
+ myDS->list = 0;
+ myDS->dlist = 0;
+ myDS->degMode = 0;
+ myDS->model = -1;
+ myDS->skipRatio = 0.0F;
+ myDS->bDraw = new unsigned char[nv];
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_TriangleStrip::~OpenGl_TriangleStrip ()
+{
+ if( myData.fnormals )
+ delete[] myData.fnormals;
+ if( myData.fcolours )
+ delete[] myData.fcolours;
+ if( myData.vertices )
+ delete[] myData.vertices;
+ if( myData.vcolours )
+ delete[] myData.vcolours;
+ if( myData.vnormals )
+ delete[] myData.vnormals;
+ if ( myData.vtexturecoord )
+ delete[] myData.vtexturecoord;
+
+ if ( myDS )
+ {
+ if ( GET_GL_CONTEXT() != NULL )
+ {
+ if ( myDS->list ) glDeleteLists ( myDS->list, 1 );
+ if ( myDS->dlist ) glDeleteLists ( myDS->dlist, 1 );
+ }
+ if ( myDS->bDraw )
+ delete[] myDS->bDraw;
+
+ delete myDS;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_TriangleStrip::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True );
+
+ Tint front_lighting_model = aspect_face->Context().IntFront.color_mask;
+ const TEL_COLOUR *interior_colour = &aspect_face->Context().IntFront.matcol;
+ const TEL_COLOUR *edge_colour = &aspect_face->AspectEdge()->Color();
+
+ // Use highlight colors
+ if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT )
+ {
+ edge_colour = interior_colour = AWorkspace->HighlightColor;
+ front_lighting_model = 0;
+ }
+
+ glColor3fv( interior_colour->rgb );
+
+ draw_tmesh( front_lighting_model,
+ aspect_face->Context().InteriorStyle,
+ edge_colour,
+ AWorkspace );
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_TriangleStrip.hxx
+// Created: 13 July 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef OpenGl_TriangleStrip_Header
+#define OpenGl_TriangleStrip_Header
+
+#include <InterfaceGraphic_telem.hxx>
+#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_Array1OfVertexN.hxx>
+#include <Graphic3d_Array1OfVertexNT.hxx>
+#include <Aspect_InteriorStyle.hxx>
+
+#include <OpenGl_Element.hxx>
+
+struct TEL_TMESH_DATA
+{
+ Tint num_facets; /* Number of facets */
+ Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */
+ Tint vertex_flag;/* TEL_VT_NONE or TEL_VT_NORMAL */
+ tel_point fnormals; /* length = num_facets */
+ tel_colour fcolours; /* length = num_facets */
+ tel_point vertices; /* length = num_facets + 2 */
+ tel_colour vcolours; /* length = num_facets + 2 */
+ tel_point vnormals; /* length = num_facets + 2 */
+ tel_texture_coord vtexturecoord; /* Texture coordinates */
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+class OpenGl_TriangleStrip : public OpenGl_Element
+{
+ public:
+
+ OpenGl_TriangleStrip (const Graphic3d_Array1OfVertex& AListVertex);
+ OpenGl_TriangleStrip (const Graphic3d_Array1OfVertexN& AListVertex);
+ OpenGl_TriangleStrip (const Graphic3d_Array1OfVertexNT& AListVertex);
+ virtual ~OpenGl_TriangleStrip ();
+
+ virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ protected:
+
+ void Init (const Tint ANbFacets, tel_point AVertices,
+ tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords,
+ tel_point AFNormals, tel_colour AFColors);
+
+ void draw_tmesh (const Tint, /* front_lighting_model, */
+ const Aspect_InteriorStyle, /* interior_style */
+ const TEL_COLOUR *, /* edge_colour */
+ const Handle(OpenGl_Workspace) &) const;
+
+ void draw_edges (const TEL_COLOUR *, const Aspect_InteriorStyle, Tint, const Handle(OpenGl_Workspace) &) const;
+
+ void draw_line_loop () const;
+
+ TEL_TMESH_DATA myData;
+ DS_INTERNAL *myDS;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //OpenGl_TriangleStrip_Header
--- /dev/null
+// File: OpenGl_Trihedron.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#define QTOCC_PATCH /* Active QtOPENCASCADE patches */
+
+#include <OpenGl_tgl_all.hxx>
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h> /* pour M_PI */
+
+#include <OpenGl_TextureBox.hxx>
+
+#include <InterfaceGraphic_Graphic3d.hxx> /* pour CALL_DEF_STRUCTURE */
+#include <InterfaceGraphic_Aspect.hxx> /* pour CALL_DEF_VIEW */
+#include <InterfaceGraphic_Visual3d.hxx>
+
+#include <OpenGl_transform_persistence.hxx>
+
+#ifdef HAVE_GL2PS
+#include <gl2ps.h>
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <OpenGl_Workspace.hxx>
+#include <OpenGl_View.hxx>
+#include <OpenGl_Trihedron.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(OpenGl_Trihedron,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Trihedron,MMgt_TShared)
+
+/*----------------------------------------------------------------------*/
+/*
+* Constantes
+*/
+
+#define NO_DEBUG
+#define NO_PRINT
+#define NO_PRINT_MATRIX
+
+#ifndef M_PI
+# define M_PI 3.14159265358979323846
+#endif
+
+static const CALL_DEF_CONTEXTLINE myDefaultContextLine =
+{
+ 1, //IsDef
+ 1, //IsSet
+ { 1.F, 1.F, 1.F }, //Color
+ Aspect_TOL_SOLID, //LineType
+ 1.F //Width
+};
+
+static const CALL_DEF_CONTEXTTEXT myDefaultContextText =
+{
+ 1, //IsDef
+ 1, //IsSet
+ "Courier", //Font
+ 0.3F, //Space
+ 1.0F, //Expan
+ { 1.F, 1.F, 1.F }, //Color
+ Aspect_TOST_NORMAL, //Style
+ Aspect_TODT_NORMAL, //DisplayType
+ { 1.F, 1.F, 1.F }, //ColorSubTitle
+ 0, //TextZoomable
+ 0.F, //TextAngle
+ OSD_FA_Regular //TextFontAspect
+};
+
+/*----------------------------------------------------------------------*/
+/*
+* Variables statiques
+*/
+
+/* Default parameters for ZBUFFER triheron */
+static TEL_COLOUR theXColor = {{ 1.F, 0.F, 0.F, 0.6F }};
+static TEL_COLOUR theYColor = {{ 0.F, 1.F, 0.F, 0.6F }};
+static TEL_COLOUR theZColor = {{ 0.F, 0.F, 1.F, 0.6F }};
+static float theRatio = 0.8f;
+static float theDiameter = 0.05f;
+static int theNbFacettes = 12;
+
+/*----------------------------------------------------------------------*/
+
+/*
+* affichage d'un triedre non zoomable a partir des index dans les tables
+* des structures non zoomables.
+*
+* Triedre = Objet non Zoomable :
+* on recalcule ses dimensions et son origine en fonction de la taille
+* de la fenetre; on positionne selon le choix de l'init;
+* et on inhibe seulement les translations.
+*
+*/
+
+//call_triedron_redraw
+void OpenGl_Trihedron::Redraw (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const Standard_Real U = AWorkspace->ActiveView()->Height();
+ const Standard_Real V = AWorkspace->ActiveView()->Width();
+
+ /* la taille des axes est 1 proportion (fixee a l'init du triedre) */
+ /* de la dimension la plus petite de la window. */
+ const GLdouble L = ( U < V ? U : V ) * myScale;
+
+ /*
+ * On inhibe les translations; on conserve les autres transformations.
+ */
+
+ /* on lit les matrices de transformation et de projection de la vue */
+ /* pour annuler les translations (dernieres colonnes des matrices). */
+ GLdouble modelMatrix[4][4];
+ glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix );
+ GLdouble projMatrix[4][4];
+ glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix );
+
+ /* on annule la translation qui peut etre affectee a la vue */
+ modelMatrix[3][0] = 0.;
+ modelMatrix[3][1] = 0.;
+ modelMatrix[3][2] = 0.;
+ projMatrix[3][0] = 0.;
+ projMatrix[3][1] = 0.;
+ projMatrix[3][2] = 0.;
+
+ /* sauvegarde du contexte des matrices avant chargement */
+ glMatrixMode (GL_MODELVIEW);
+ glPushMatrix ();
+ glLoadMatrixd( (GLdouble *) modelMatrix );
+ glMatrixMode ( GL_PROJECTION );
+ glPushMatrix ();
+ glLoadMatrixd( (GLdouble *) projMatrix );
+
+ /*
+ * Positionnement de l'origine du triedre selon le choix de l'init
+ */
+
+ /* on fait uniquement une translation de l'origine du Triedre */
+
+ switch (myPos)
+ {
+ case Aspect_TOTP_LEFT_LOWER :
+ glTranslated( -0.5*U + L , -0.5*V + L , 0. );
+ break;
+
+ case Aspect_TOTP_LEFT_UPPER :
+ glTranslated( -0.5*U + L , +0.5*V - L -L/3., 0. );
+ break;
+
+ case Aspect_TOTP_RIGHT_LOWER :
+ glTranslated( 0.5*U - L -L/3. , -0.5*V + L , 0. );
+ break;
+
+ case Aspect_TOTP_RIGHT_UPPER :
+ glTranslated( 0.5*U - L -L/3. , +0.5*V - L -L/3. , 0. );
+ break;
+
+ //case Aspect_TOTP_CENTER :
+ default :
+ break;
+ }
+
+ /*
+ * Creation du triedre
+ */
+ const OpenGl_AspectLine *AspectLine = AWorkspace->AspectLine( Standard_True );
+
+#ifdef QTOCC_PATCH /* Fotis Sioutis 2007-11-14 15:06
+ I have also seen in previous posts that the view trihedron in V3d_WIREFRAME mode
+ changes colors depending on the state of the view. This behaviour can be easily
+ corrected by altering call_triedron_redraw function in OpenGl_triedron.c of TKOpengl.
+ The only change needed is to erase glDisable(GL_LIGHTING) that is called before the
+ Axis name drawing and move this function call just before the initial axis drawing.
+ Below is the code portion with the modification.I don't know if this is considered to
+ be a bug but anyway i believe it might help some of you out there.*/
+ glDisable(GL_LIGHTING);
+#endif
+
+ /* Position de l'origine */
+ const GLdouble TriedronOrigin[3] = { 0.0, 0.0, 0.0 };
+
+ /* Position des Axes */
+ GLdouble TriedronAxeX[3] = { 1.0, 0.0, 0.0 };
+ GLdouble TriedronAxeY[3] = { 0.0, 1.0, 0.0 };
+ GLdouble TriedronAxeZ[3] = { 0.0, 0.0, 1.0 };
+ TriedronAxeX[0] = L ;
+ TriedronAxeY[1] = L ;
+ TriedronAxeZ[2] = L ;
+
+ /* dessin des axes */
+ glBegin(GL_LINES);
+ glVertex3dv( TriedronOrigin );
+ glVertex3dv( TriedronAxeX );
+
+ glVertex3dv( TriedronOrigin );
+ glVertex3dv( TriedronAxeY );
+
+ glVertex3dv( TriedronOrigin );
+ glVertex3dv( TriedronAxeZ );
+ glEnd();
+
+ /* fleches au bout des axes (= cones de la couleur demandee) */
+ const GLdouble l = 0.75*L; /* distance a l'origine */
+ const GLdouble rayon = L/30. ; /* rayon de la base du cone */
+ const int NbFacettes = 12; /* le cone sera compose de 12 facettes triangulaires */
+ const double Angle = 2. * M_PI/ NbFacettes;
+
+ int ii;
+ GLdouble TriedronCoord[3] = { 1.0, 0.0, 0.0 };
+
+ /* solution FILAIRE des cones au bout des axes : une seule ligne */
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ /* (la couleur est deja initialisee dans AspectLine) */
+ /* FIN de la solution FILAIRE CHOISIE pour les cones des axes */
+
+ /* fleche en X */
+ glBegin(GL_TRIANGLE_FAN);
+ glVertex3dv( TriedronAxeX );
+ TriedronCoord[0] = l;
+ ii = NbFacettes;
+ while (ii >= 0 ) {
+ TriedronCoord[1] = rayon * sin(ii * Angle);
+ TriedronCoord[2] = rayon * cos(ii * Angle);
+ glVertex3dv( TriedronCoord );
+ ii--;
+ }
+ glEnd();
+
+ /* fleche en Y */
+ glBegin(GL_TRIANGLE_FAN);
+ glVertex3dv( TriedronAxeY );
+ TriedronCoord[1] = l;
+ ii = NbFacettes;
+ while (ii >= 0 ) {
+ TriedronCoord[0] = rayon * cos(ii * Angle);
+ TriedronCoord[2] = rayon * sin(ii * Angle);
+ glVertex3dv( TriedronCoord );
+ ii--;
+ }
+ glEnd();
+
+ /* fleche en Z */
+ glBegin(GL_TRIANGLE_FAN);
+ glVertex3dv( TriedronAxeZ );
+ TriedronCoord[2] = l;
+ ii = NbFacettes;
+ while (ii >= 0 ) {
+ TriedronCoord[0] = rayon * sin(ii * Angle);
+ TriedronCoord[1] = rayon * cos(ii * Angle);
+ glVertex3dv( TriedronCoord );
+ ii--;
+ }
+ glEnd();
+
+ /* dessin de l'origine */
+ TriedronCoord[2] = 0.0 ;
+ ii = 24 ;
+ const double Angle1 = 2. * M_PI/ ii;
+ glBegin(GL_LINE_LOOP);
+ while (ii >= 0 ) {
+ TriedronCoord[0] = rayon * sin(ii * Angle1);
+ TriedronCoord[1] = rayon * cos(ii * Angle1);
+ glVertex3dv( TriedronCoord );
+ ii--;
+ }
+ glEnd();
+
+ /*
+ * Noms des axes et de l'origine
+ */
+ const OpenGl_AspectText *AspectText = AWorkspace->AspectText( Standard_True );
+ glColor3fv (AspectText->Color().rgb);
+
+ AWorkspace->RenderText (L"X", 0, float(L + rayon), 0.0f, float(-rayon));
+ AWorkspace->RenderText (L"Y", 0, float(rayon), float(L + 3.0 * rayon), float(2.0 * rayon));
+ AWorkspace->RenderText (L"Z", 0, float(-2.0 * rayon), float(0.5 * rayon), float(L + 3.0 * rayon));
+
+ /*
+ * restauration du contexte des matrices
+ */
+ glMatrixMode (GL_PROJECTION);
+ glPopMatrix ();
+ glMatrixMode (GL_MODELVIEW);
+ glPopMatrix ();
+}
+
+
+/*******************************************************
+* Draws ZBUFFER trihedron mode
+*******************************************************/
+//call_zbuffer_triedron_redraw
+void OpenGl_Trihedron::RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const Standard_Real U = AWorkspace->ActiveView()->Height();
+ const Standard_Real V = AWorkspace->ActiveView()->Width();
+
+ GLdouble modelMatrix[4][4];
+ glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix );
+ GLdouble projMatrix[4][4];
+ glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix );
+
+ /* Check position in the ViewPort */
+#ifdef QTOCC_PATCH /* PCD 29/09/2008 */
+ /* Simple code modification recommended by Fotis Sioutis and Peter Dolbey */
+ /* to remove the irritating default behaviour of triedrons using V3d_ZBUFFER */
+ /* which causes the glyph to jump around the screen when the origin moves offscreen. */
+ GLboolean isWithinView = GL_FALSE;
+#else
+ /* Original code */
+ GLint aViewPort[4]; /* to store view port coordinates */
+ glGetIntegerv(GL_VIEWPORT, aViewPort);
+ GLdouble aWinCoord[3];
+ /* Position de l'origine */
+ const GLdouble TriedronOrigin[3] = { 0.0, 0.0, 0.0 };
+ gluProject(TriedronOrigin[0], TriedronOrigin[1], TriedronOrigin[2],
+ (GLdouble *)modelMatrix, (GLdouble *)projMatrix, aViewPort,
+ &aWinCoord[0], &aWinCoord[1], &aWinCoord[2]);
+
+ GLboolean isWithinView = !((aWinCoord[0]<aViewPort[0]) || (aWinCoord[0]>aViewPort[2]) ||
+ (aWinCoord[1]<aViewPort[1]) || (aWinCoord[1]>aViewPort[3]));
+#endif
+
+ /* la taille des axes est 1 proportion (fixee a l'init du triedre) */
+ /* de la dimension la plus petite de la window. */
+ GLdouble L = ( U < V ? U : V ) * myScale;
+
+ if (!isWithinView)
+ {
+ /* Annulate translation matrix */
+ modelMatrix[3][0] = 0.;
+ modelMatrix[3][1] = 0.;
+ modelMatrix[3][2] = 0.;
+ projMatrix[3][0] = 0.;
+ projMatrix[3][1] = 0.;
+ projMatrix[3][2] = 0.;
+
+ /* save matrix */
+ glMatrixMode (GL_MODELVIEW);
+ glPushMatrix ();
+ //glLoadIdentity ();
+ glLoadMatrixd( (GLdouble *) modelMatrix);
+ glMatrixMode ( GL_PROJECTION );
+ glPushMatrix ();
+ //glLoadIdentity();
+ glLoadMatrixd( (GLdouble *) projMatrix);
+
+ /*
+ * Define position in the view
+ */
+ switch (myPos)
+ {
+ case Aspect_TOTP_LEFT_LOWER :
+ glTranslated( -0.5*U + L , -0.5*V + L , 0. );
+ break;
+
+ case Aspect_TOTP_LEFT_UPPER :
+ glTranslated( -0.5*U + L , +0.5*V - L -L/3. , 0. );
+ break;
+
+ case Aspect_TOTP_RIGHT_LOWER :
+ glTranslated( 0.5*U - L -L/3. , -0.5*V + L , 0. );
+ break;
+
+ case Aspect_TOTP_RIGHT_UPPER :
+ glTranslated( 0.5*U - L -L/3. , +0.5*V - L -L/3. , 0. );
+ break;
+
+ //case Aspect_TOTP_CENTER :
+ default :
+ break;
+ }
+ L *= myRatio;
+ }
+
+ const OpenGl_AspectLine *AspectLine = AWorkspace->AspectLine( Standard_True );
+ const TEL_COLOUR &aLineColor = AspectLine->Color();
+
+ /*
+ * Creation the trihedron
+ */
+#define CYLINDER_LENGTH 0.75f
+
+ const GLuint startList = glGenLists(4);
+ GLUquadricObj* aQuadric = gluNewQuadric();
+
+ const GLboolean aIsDepthEnabled = glIsEnabled(GL_DEPTH_TEST);
+
+#ifndef BUG
+
+ GLboolean aIsDepthMaskEnabled;
+#ifdef QTOCC_PATCH /*PCD 02/07/07 */
+ /* GL_DEPTH_WRITEMASK is not a valid argument to glIsEnabled, the */
+ /* original code is shown to be broken when run under an OpenGL debugger */
+ /* like GLIntercept. This is the correct way to retrieve the mask value. */
+ glGetBooleanv(GL_DEPTH_WRITEMASK, &aIsDepthMaskEnabled);
+#else
+ aIsDepthMaskEnabled = glIsEnabled(GL_DEPTH_WRITEMASK);
+#endif
+
+#endif
+
+ const GLdouble aCylinderLength = L * CYLINDER_LENGTH;
+ const GLdouble aCylinderDiametr = L * myDiameter;
+ const GLdouble aConeDiametr = aCylinderDiametr * 2.;
+ const GLdouble aConeLength = L * (1 - CYLINDER_LENGTH);
+ /* Correct for owerlapping */
+ /* aCylinderLength += aConeLength - 1.2*aCylinderDiametr*aConeLength/aConeDiametr;*/
+
+ /* Create cylinder for axis */
+ gluQuadricDrawStyle(aQuadric, GLU_FILL); /* smooth shaded */
+ gluQuadricNormals(aQuadric, GLU_FLAT);
+ /* Axis */
+ glNewList(startList, GL_COMPILE);
+ gluCylinder(aQuadric, aCylinderDiametr, aCylinderDiametr, aCylinderLength, myNbFacettes, 1);
+ glEndList();
+ /* Cone */
+ glNewList(startList + 1, GL_COMPILE);
+ gluCylinder(aQuadric, aConeDiametr, 0., aConeLength, myNbFacettes, 1);
+ glEndList();
+ /* Central sphere */
+ glNewList(startList + 2, GL_COMPILE);
+ gluSphere(aQuadric, aCylinderDiametr * 2., myNbFacettes, myNbFacettes);
+ glEndList();
+ /* End disk */
+ gluQuadricOrientation(aQuadric,GLU_INSIDE); /*szv*/
+ glNewList(startList + 3, GL_COMPILE);
+ gluDisk(aQuadric, aCylinderDiametr, aConeDiametr, myNbFacettes, 1/*szv:2*/);
+ glEndList();
+
+ /* Store previous attributes */
+ glPushAttrib(GL_LIGHTING_BIT | GL_POLYGON_BIT);
+ glEnable(GL_LIGHTING);
+
+ glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
+
+#ifdef QTOCC_PATCH /*Fotis Sioutis | 2008-01-21 10:55
+ In the function call_zbuffer_triedron_redraw of TKOpengl,
+ the z buffered trihedron changes colors in case there
+ is an object in the scene that has an explicit material
+ attached to it.In the trihedron display loop,
+ GL_COLOR_MATERIAL is enabled, but only the GL_DIFFUSE
+ parameter is utilized in glColorMaterial(...).
+ This causes the last ambient,specular and emission values
+ used, to stay at the stack and applied to the trihedron
+ (which causes the color change).
+ A fix is proposed , to change GL_DIFFUSE to
+ GL_AMBIENT_AND_DIFFUSE in glColorMaterial call in
+ line 946.The above of course will leave unchanged
+ the SPECULAR and EMISSION values.
+ Another proposal which would fix 100% the problem
+ is to use glMaterial instead of glColor on the trihedron
+ drawing loop. */
+ const GLfloat aNULLColor[] = { 0.f, 0.f, 0.f, 0.f }; /* FS 21/01/08 */
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, aNULLColor);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, aNULLColor);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, aNULLColor);
+ glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.f);
+#endif
+
+ glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
+ glEnable(GL_COLOR_MATERIAL);
+
+ if (!aIsDepthEnabled) {
+ glEnable(GL_DEPTH_TEST);
+#ifndef BUG
+ glClear(GL_DEPTH_BUFFER_BIT);
+#endif
+ }
+#ifdef BUG
+ if (!(aIsDepthEnabled && isWithinView))
+ glClear(GL_DEPTH_BUFFER_BIT);
+#endif
+
+#ifndef BUG
+ if (!aIsDepthMaskEnabled) {
+ /* This is how the depthmask needs to be re-enabled...*/
+ glDepthMask(GL_TRUE);
+ /* ...and not this stuff below */
+ }
+#endif
+
+ /* Position des Axes */
+ GLdouble TriedronAxeX[3] = { 1.0, 0.0, 0.0 };
+ GLdouble TriedronAxeY[3] = { 0.0, 1.0, 0.0 };
+ GLdouble TriedronAxeZ[3] = { 0.0, 0.0, 1.0 };
+ TriedronAxeX[0] = L;
+ TriedronAxeY[1] = L;
+ TriedronAxeZ[2] = L;
+
+ glMatrixMode(GL_MODELVIEW);
+
+#ifdef QTOCC_PATCH /* PCD 17/06/07 */
+ GLint df;
+ glGetIntegerv (GL_DEPTH_FUNC, &df);
+#else
+ /*
+#define COLOR_REDUCE 0.3f
+#ifdef BUG
+#define ALPHA_REDUCE 0.4f
+#else
+#define ALPHA_REDUCE 1.0f
+#endif
+ //szv:if (isWithinView) {
+ glDepthFunc(GL_GREATER);
+ glPushMatrix();
+ glPushMatrix();
+ glPushMatrix();
+
+ glColor4f(aLineColor.rgb[0]*COLOR_REDUCE,
+ aLineColor.rgb[1]*COLOR_REDUCE,
+ aLineColor.rgb[2]*COLOR_REDUCE,
+ ALPHA_REDUCE);
+ glCallList(startList+2);
+
+ // Z axis
+ glColor4f(myZColor.rgb[0]*COLOR_REDUCE,
+ myZColor.rgb[1]*COLOR_REDUCE,
+ myZColor.rgb[2]*COLOR_REDUCE,
+ ALPHA_REDUCE);
+ glCallList(startList);
+ glTranslated(0, 0, L * CYLINDER_LENGTH);
+ glCallList(startList + 3);
+ glCallList(startList + 1);
+ glPopMatrix();
+
+ // X axis
+ glRotated(90.0, TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2]);
+ glColor4f(myXColor.rgb[0]*COLOR_REDUCE,
+ myXColor.rgb[1]*COLOR_REDUCE,
+ myXColor.rgb[2]*COLOR_REDUCE,
+ ALPHA_REDUCE);
+ glCallList(startList);
+ glTranslated(0, 0, L * CYLINDER_LENGTH);
+ glCallList(startList + 3);
+ glCallList(startList + 1);
+ glPopMatrix();
+
+ // Y axis
+ glRotated(-90.0, TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]);
+ glColor4f(myYColor.rgb[0]*COLOR_REDUCE,
+ myYColor.rgb[1]*COLOR_REDUCE,
+ myYColor.rgb[2]*COLOR_REDUCE,
+ ALPHA_REDUCE);
+ glCallList(startList);
+ glTranslated(0, 0, L * CYLINDER_LENGTH);
+ glCallList(startList + 3);
+ glCallList(startList + 1);
+ glPopMatrix();
+
+ glDepthFunc(GL_LESS);
+ //szv:}
+ */
+#endif
+
+#ifdef QTOCC_PATCH
+ int i;
+ for (i = 0; i < 2; i++) /* PCD 11/02/08 Two pass method */
+ {
+ if (i == 0) /* First pass */
+ {
+ glDepthFunc(GL_ALWAYS);
+ }
+ else
+ {
+ glDepthFunc(GL_LEQUAL);
+ }
+#endif
+
+ glPushMatrix();
+ glPushMatrix();
+ glPushMatrix();
+
+ glColor3fv(aLineColor.rgb);
+ glCallList(startList+2);
+
+ // Z axis
+ glColor4fv(myZColor.rgb);
+ glCallList(startList);
+ glTranslated(0, 0, L * CYLINDER_LENGTH);
+ glCallList(startList + 3);
+ glCallList(startList + 1);
+ glPopMatrix();
+
+ // X axis
+ glRotated(90.0, TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2]);
+ glColor4fv(myXColor.rgb);
+ glCallList(startList);
+ glTranslated(0, 0, L * CYLINDER_LENGTH);
+ glCallList(startList + 3);
+ glCallList(startList + 1);
+ glPopMatrix();
+
+ // Y axis
+ glRotated(-90.0, TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]);
+ glColor4fv(myYColor.rgb);
+ glCallList(startList);
+ glTranslated(0, 0, L * CYLINDER_LENGTH);
+ glCallList(startList + 3);
+ glCallList(startList + 1);
+ glPopMatrix();
+
+#ifdef QTOCC_PATCH
+ }
+#endif
+
+ if (!aIsDepthEnabled)
+ glDisable(GL_DEPTH_TEST);
+#ifndef BUG
+ if (!aIsDepthMaskEnabled)
+
+#ifdef QTOCC_PATCH /*PCD 02/07/07 */
+ glDepthMask(GL_FALSE);
+#else
+ glDisable(GL_DEPTH_WRITEMASK);
+#endif
+
+#endif
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_COLOR_MATERIAL);
+
+ gluDeleteQuadric(aQuadric);
+ glColor3fv (aLineColor.rgb);
+
+#ifdef QTOCC_PATCH /* PCD 11/02/08 */
+ /* Always write the text */
+ glDepthFunc(GL_ALWAYS);
+#endif
+
+ glPopAttrib();
+
+ /* fleches au bout des axes (= cones de la couleur demandee) */
+ //const GLdouble l = 0.75*L; /* distance a l'origine */
+ const GLdouble rayon = L/30. ; /* rayon de la base du cone */
+ //const double Angle = 2. * M_PI/ myNbFacettes;
+
+ glDeleteLists(startList, 4);
+
+ glDisable(GL_LIGHTING);
+
+ /*
+ * origine names
+ */
+ const OpenGl_AspectText *AspectText = AWorkspace->AspectText( Standard_True );
+ glColor3fv (AspectText->Color().rgb);
+
+ AWorkspace->RenderText (L"X", 0, float(L + rayon), 0.0f, float(-rayon));
+ AWorkspace->RenderText (L"Y", 0, float(rayon), float(L + 3.0 * rayon), float(2.0 * rayon));
+ AWorkspace->RenderText (L"Z", 0, float(-2.0 * rayon), float(0.5 * rayon), float(L + 3.0 * rayon));
+
+#ifdef QTOCC_PATCH
+ /*PCD 17/06/07 */
+ glDepthFunc(df);
+#endif
+
+ if (!isWithinView) { /* restore matrix */
+ glMatrixMode (GL_PROJECTION);
+ glPopMatrix ();
+ glMatrixMode (GL_MODELVIEW);
+ glPopMatrix ();
+ }
+}
+
+
+/*----------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------*/
+/*
+* Fonctions publiques
+*/
+
+
+/*
+* initialisation d'un triedre non zoomable dans une vue.
+* ou modification des valeurs deja initialisees.
+*/
+
+//call_triedron_init
+OpenGl_Trihedron::OpenGl_Trihedron (const Aspect_TypeOfTriedronPosition APosition, const Quantity_NameOfColor AColor,
+ const Standard_Real AScale, const Standard_Boolean AsWireframe)
+: myPos(APosition),
+ myScale(AScale),
+ myIsWireframe(AsWireframe)
+{
+ Standard_Real R,G,B;
+ Quantity_Color Color(AColor);
+ Color.Values(R,G,B,Quantity_TOC_RGB);
+
+ CALL_DEF_CONTEXTLINE aContextLine = myDefaultContextLine;
+ aContextLine.Color.r = (float)R;
+ aContextLine.Color.g = (float)G;
+ aContextLine.Color.b = (float)B;
+ myAspectLine.SetContext(aContextLine);
+
+ CALL_DEF_CONTEXTTEXT aContextText = myDefaultContextText;
+ aContextText.Color.r = (float)R;
+ aContextText.Color.g = (float)G;
+ aContextText.Color.b = (float)B;
+ myAspectText.SetContext(aContextText);
+
+ myXColor = theXColor;
+ myYColor = theYColor;
+ myZColor = theZColor;
+
+ myRatio = theRatio;
+ myDiameter = theDiameter;
+ myNbFacettes = theNbFacettes;
+}
+
+/*----------------------------------------------------------------------*/
+
+/*
+* destruction du triedre non zoomable d'une vue.
+*/
+
+//call_triedron_erase
+OpenGl_Trihedron::~OpenGl_Trihedron ()
+{
+}
+
+/*----------------------------------------------------------------------*/
+
+/*
+* affichage d'un triedre non zoomable dans la wks awsid
+*
+* Triedre = Objet non Zoomable;
+* on cree cette fonction pour pouvoir travailler par les structures
+* utilisees par les fonctions Tsm* et TEL_VIEW_REP
+*
+*/
+
+//call_triedron_redraw_from_wsid
+void OpenGl_Trihedron::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
+{
+ const OpenGl_AspectLine *oldAspectLine = AWorkspace->SetAspectLine(&myAspectLine);
+ const OpenGl_AspectText *oldAspectText = AWorkspace->SetAspectText(&myAspectText);
+
+ /* check if GL_LIGHTING should be disabled
+ no enabling 'cause it will be done (if necessary: kinda Polygon types )
+ during redrawing structures
+ */
+ if (!AWorkspace->UseGLLight())
+ glDisable( GL_LIGHTING );
+
+ /* sauvegarde du contexte (on reste dans le buffer courant) */
+ const GLboolean save_texture_state = IsTextureEnabled();
+ DisableTexture();
+
+ /* affichage du Triedre Non Zoomable */
+ AWorkspace->ActiveView()->EndTransformPersistence();
+
+ if (myIsWireframe)
+ Redraw (AWorkspace);
+ else
+ RedrawZBuffer (AWorkspace);
+
+ /* restauration du contexte */
+ if (save_texture_state) EnableTexture();
+
+ AWorkspace->SetAspectText(oldAspectText);
+ AWorkspace->SetAspectLine(oldAspectLine);
+}
+
+/*----------------------------------------------------------------------*/
+//call_ztriedron_setup
+void OpenGl_Trihedron::Setup (const Quantity_NameOfColor XColor, const Quantity_NameOfColor YColor, const Quantity_NameOfColor ZColor,
+ const Standard_Real SizeRatio, const Standard_Real AxisDiametr, const Standard_Integer NbFacettes)
+{
+ Standard_Real R,G,B;
+
+ Quantity_Color(XColor).Values(R, G, B, Quantity_TOC_RGB);
+ theXColor.rgb[0] = float (R);
+ theXColor.rgb[1] = float (G);
+ theXColor.rgb[2] = float (B);
+
+ Quantity_Color(YColor).Values(R, G, B, Quantity_TOC_RGB);
+ theYColor.rgb[0] = float (R);
+ theYColor.rgb[1] = float (G);
+ theYColor.rgb[2] = float (B);
+
+ Quantity_Color(ZColor).Values(R, G, B, Quantity_TOC_RGB);
+ theZColor.rgb[0] = float (R);
+ theZColor.rgb[1] = float (G);
+ theZColor.rgb[2] = float (B);
+
+ theRatio = float (SizeRatio);
+ theDiameter = float (AxisDiametr);
+ theNbFacettes = NbFacettes;
+}
--- /dev/null
+// File: OpenGl_Trihedron.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_Trihedron_Header
+#define _OpenGl_Trihedron_Header
+
+#include <Handle_OpenGl_Trihedron.hxx>
+
+#include <Quantity_NameOfColor.hxx>
+#include <Aspect_TypeOfTriedronPosition.hxx>
+
+#include <OpenGl_AspectLine.hxx>
+#include <OpenGl_AspectText.hxx>
+
+class OpenGl_Trihedron : public MMgt_TShared
+{
+ public:
+ OpenGl_Trihedron (const Aspect_TypeOfTriedronPosition APosition, const Quantity_NameOfColor AColor, const Standard_Real AScale, const Standard_Boolean AsWireframe);
+ virtual ~OpenGl_Trihedron ();
+
+ static void Setup (const Quantity_NameOfColor XColor, const Quantity_NameOfColor YColor, const Quantity_NameOfColor ZColor,
+ const Standard_Real SizeRatio, const Standard_Real AxisDiametr, const Standard_Integer NbFacettes);
+
+ void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ // Type definition
+ //
+ DEFINE_STANDARD_RTTI(OpenGl_Trihedron)
+
+ protected:
+
+ void Redraw (const Handle(OpenGl_Workspace) &AWorkspace) const;
+ void RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace) const;
+
+ Aspect_TypeOfTriedronPosition myPos;
+ Standard_Real myScale;
+ Standard_Boolean myIsWireframe;
+ // Parameters for zbuffered mode
+ TEL_COLOUR myXColor;
+ TEL_COLOUR myYColor;
+ TEL_COLOUR myZColor;
+ float myRatio;
+ float myDiameter;
+ int myNbFacettes;
+
+ OpenGl_AspectLine myAspectLine;
+ OpenGl_AspectText myAspectText;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //_OpenGl_Trihedron_Header
--- /dev/null
+// File: OpenGl_View.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_View.hxx>
+
+#include <OpenGl_Workspace.hxx>
+#include <OpenGl_Display.hxx>
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <OpenGl_Display.hxx>
+#include <OpenGl_Trihedron.hxx>
+#include <OpenGl_GraduatedTrihedron.hxx>
+
+#include <OpenGl_transform_persistence.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(OpenGl_View,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_View,MMgt_TShared)
+
+/*----------------------------------------------------------------------*/
+
+static const OPENGL_BG_TEXTURE myDefaultBgTexture = { 0, 0, 0, Aspect_FM_CENTERED };
+static const OPENGL_BG_GRADIENT myDefaultBgGradient = { {{ 0.F, 0.F, 0.F, 1.F }}, {{ 0.F, 0.F, 0.F, 1.F }}, Aspect_GFM_NONE };
+static const Tmatrix3 myDefaultMatrix = { { 1.F, 0.F, 0.F, 0.F }, { 0.F, 1.F, 0.F, 0.F }, { 0.F, 0.F, 1.F, 0.F }, { 0.F, 0.F, 0.F, 1.F } };
+static const OPENGL_ZCLIP myDefaultZClip = { { Standard_True, 0.F }, { Standard_True, 1.F } };
+static const OPENGL_EXTRA_REP myDefaultExtra =
+{
+ //vrp
+ { 0.F, 0.F, 0.F },
+ //vpn
+ { 0.F, 0.F, 1.F },
+ //vup
+ { 0.F, 1.F, 0.F },
+ //map
+ {
+ //window
+ { 0.F, 0.F, 1.F, 1.F },
+ //viewport
+ { 0.F, 0.F, 0.F, 1.F, 1.F, 1.F },
+ //proj
+ TelParallel,
+ //prp
+ { 0.F, 0.F, 0.F },
+ //vpd
+ 0.F,
+ //fpd
+ 0.F,
+ //bpd
+ -1.F
+ },
+ //scaleFactors
+ { 1.F, 1.F, 1.F }
+};
+
+static const OPENGL_FOG myDefaultFog = { Standard_False, 0.F, 1.F, { { 0.F, 0.F, 0.F, 1.F } } };
+static const TEL_TRANSFORM_PERSISTENCE myDefaultTransPers = { 0, 0.F, 0.F, 0.F };
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_View::OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext)
+: myTextureEnv(0),
+ mySurfaceDetail(Visual3d_TOD_NONE),
+ myBackfacing(0),
+ myBgTexture(myDefaultBgTexture),
+ myBgGradient(myDefaultBgGradient),
+ //myOrientationMatrix(myDefaultMatrix),
+ //myMappingMatrix(myDefaultMatrix),
+ //shield_indicator = TOn,
+ //shield_colour = { { 0.F, 0.F, 0.F, 1.F } },
+ //border_indicator = TOff,
+ //border_colour = { { 0.F, 0.F, 0.F, 1.F } },
+ //active_status = TOn,
+ myZClip(myDefaultZClip),
+ myExtra(myDefaultExtra),
+ myFog(myDefaultFog),
+ myVisualization(AContext.Visualization),
+ myIntShadingMethod(TEL_SM_GOURAUD),
+ myAntiAliasing(Standard_False),
+ myAnimationListIndex(0),
+ myAnimationListReady(Standard_False),
+ myTransPers(&myDefaultTransPers),
+ myIsTransPers(Standard_False),
+ myResetFLIST(Standard_False)
+{
+ // Initialize matrices
+ memcpy(myOrientationMatrix,myDefaultMatrix,sizeof(Tmatrix3));
+ memcpy(myMappingMatrix,myDefaultMatrix,sizeof(Tmatrix3));
+
+ // Shading method
+ switch (AContext.Model)
+ {
+ case 1 : /* VISUAL3D_TOM_INTERP_COLOR */
+ case 3 : /* VISUAL3D_TOM_VERTEX */
+ myIntShadingMethod = TEL_SM_GOURAUD;
+ break;
+ default :
+ myIntShadingMethod = TEL_SM_FLAT;
+ break;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+OpenGl_View::~OpenGl_View ()
+{
+ if (myAnimationListIndex)
+ glDeleteLists((GLuint)myAnimationListIndex,1);
+
+ if ( myBgTexture.TexId != 0 )
+ glDeleteTextures( 1, (GLuint*)&(myBgTexture.TexId) );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_View::SetBackfacing (const Standard_Integer AMode)
+{
+ myBackfacing = AMode;
+ myResetFLIST = Standard_True;
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_setlight
+void OpenGl_View::SetLights (const CALL_DEF_VIEWCONTEXT &AContext)
+{
+ myLights.Clear();
+
+ const int nb_lights = AContext.NbActiveLight;
+
+ int i = 0;
+ const CALL_DEF_LIGHT *alight = &(AContext.ActiveLight[0]);
+ for ( ; i < nb_lights; i++, alight++ )
+ {
+ OpenGl_Light rep;
+
+ switch( alight->LightType )
+ {
+ case 0 : /* TOLS_AMBIENT */
+ rep.type = TLightAmbient;
+ rep.col.rgb[0] = alight->Color.r;
+ rep.col.rgb[1] = alight->Color.g;
+ rep.col.rgb[2] = alight->Color.b;
+ break;
+
+ case 1 : /* TOLS_DIRECTIONAL */
+ rep.type = TLightDirectional;
+ rep.col.rgb[0] = alight->Color.r;
+ rep.col.rgb[1] = alight->Color.g;
+ rep.col.rgb[2] = alight->Color.b;
+ rep.dir[0] = alight->Direction.x;
+ rep.dir[1] = alight->Direction.y;
+ rep.dir[2] = alight->Direction.z;
+ break;
+
+ case 2 : /* TOLS_POSITIONAL */
+ rep.type = TLightPositional;
+ rep.col.rgb[0] = alight->Color.r;
+ rep.col.rgb[1] = alight->Color.g;
+ rep.col.rgb[2] = alight->Color.b;
+ rep.pos[0] = alight->Position.x;
+ rep.pos[1] = alight->Position.y;
+ rep.pos[2] = alight->Position.z;
+ rep.atten[0] = alight->Attenuation[0];
+ rep.atten[1] = alight->Attenuation[1];
+ break;
+
+ case 3 : /* TOLS_SPOT */
+ rep.type = TLightSpot;
+ rep.col.rgb[0] = alight->Color.r;
+ rep.col.rgb[1] = alight->Color.g;
+ rep.col.rgb[2] = alight->Color.b;
+ rep.pos[0] = alight->Position.x;
+ rep.pos[1] = alight->Position.y;
+ rep.pos[2] = alight->Position.z;
+ rep.dir[0] = alight->Direction.x;
+ rep.dir[1] = alight->Direction.y;
+ rep.dir[2] = alight->Direction.z;
+ rep.shine = alight->Concentration;
+ rep.atten[0] = alight->Attenuation[0];
+ rep.atten[1] = alight->Attenuation[1];
+ rep.angle = alight->Angle;
+ break;
+ }
+
+ rep.HeadLight = alight->Headlight;
+
+ myLights.Append(rep);
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_setplane
+void OpenGl_View::SetClippingPlanes (const CALL_DEF_VIEWCONTEXT &AContext)
+{
+ // clear clipping planes information
+ myClippingPlanes.Clear();
+ // update information
+ int i = 0;
+ for (; i < AContext.NbActivePlane; i++)
+ {
+ const CALL_DEF_PLANE &aCPlane = AContext.ActivePlane[i];
+ if ( aCPlane.Active && aCPlane.PlaneId > 0 )
+ {
+ OPENGL_CLIP_REP aPlane;
+ aPlane.equation[0] = aCPlane.CoefA;
+ aPlane.equation[1] = aCPlane.CoefB;
+ aPlane.equation[2] = aCPlane.CoefC;
+ aPlane.equation[3] = aCPlane.CoefD;
+ myClippingPlanes.Append( aPlane );
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_setvisualisation
+void OpenGl_View::SetVisualisation (const CALL_DEF_VIEWCONTEXT &AContext)
+{
+ myVisualization = AContext.Visualization;
+ // Shading method
+ switch (AContext.Model)
+ {
+ case 1 : /* VISUAL3D_TOM_INTERP_COLOR */
+ case 3 : /* VISUAL3D_TOM_VERTEX */
+ myIntShadingMethod = TEL_SM_GOURAUD;
+ break;
+ default :
+ myIntShadingMethod = TEL_SM_FLAT;
+ break;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_cliplimit
+void OpenGl_View::SetClipLimit (const CALL_DEF_VIEW &ACView)
+{
+ myZClip.Back.Limit =
+ ( ACView.Context.ZClipBackPlane - ACView.Mapping.BackPlaneDistance ) /
+ ( ACView.Mapping.FrontPlaneDistance - ACView.Mapping.BackPlaneDistance );
+ myZClip.Front.Limit =
+ ( ACView.Context.ZClipFrontPlane - ACView.Mapping.BackPlaneDistance ) /
+ ( ACView.Mapping.FrontPlaneDistance - ACView.Mapping.BackPlaneDistance );
+ if ( myZClip.Back.Limit < 0.F )
+ myZClip.Back.Limit = 0.F;
+ if ( myZClip.Front.Limit > 1.F )
+ myZClip.Front.Limit = 1.F;
+ if ( myZClip.Back.Limit > myZClip.Front.Limit )
+ {
+ myZClip.Back.Limit = 0.F;
+ myZClip.Front.Limit = 1.F;
+ }
+
+ myZClip.Back.IsOn = (ACView.Context.BackZClipping != 0);
+ myZClip.Front.IsOn = (ACView.Context.FrontZClipping != 0);
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_viewmapping
+void OpenGl_View::SetMapping (const CALL_DEF_VIEW &ACView)
+{
+ const float ratio = ACView.DefWindow.dy / ACView.DefWindow.dx;
+ const float r_ratio = ACView.DefWindow.dx / ACView.DefWindow.dy;
+
+ TEL_VIEW_MAPPING Map;
+
+ Map.window.xmin = ACView.Mapping.WindowLimit.um;
+ Map.window.ymin = ACView.Mapping.WindowLimit.vm;
+ Map.window.xmax = ACView.Mapping.WindowLimit.uM;
+ Map.window.ymax = ACView.Mapping.WindowLimit.vM;
+
+ Map.viewport.xmin = 0.F;
+ Map.viewport.xmax = ( 1.F < r_ratio ? 1.F : r_ratio );
+ Map.viewport.ymin = 0.F;
+ Map.viewport.ymax = ( 1.F < ratio ? 1.F : ratio );
+ Map.viewport.zmin = 0.F;
+ Map.viewport.zmax = 1.F;
+
+ /* projection type */
+ switch( ACView.Mapping.Projection )
+ {
+ case 0 :
+ Map.proj = TelPerspective;
+ break;
+ case 1 :
+ Map.proj = TelParallel;
+ break;
+ }
+
+ /* projection reference point */
+ Map.prp[0] = ACView.Mapping.ProjectionReferencePoint.x;
+ Map.prp[1] = ACView.Mapping.ProjectionReferencePoint.y;
+ Map.prp[2] = ACView.Mapping.ProjectionReferencePoint.z;
+ if (!openglDisplay.IsNull() && !openglDisplay->Walkthrough())
+ Map.prp[2] += ACView.Mapping.FrontPlaneDistance;
+
+ /* view plane distance */
+ Map.vpd = ACView.Mapping.ViewPlaneDistance;
+
+ /* back plane distance */
+ Map.bpd = ACView.Mapping.BackPlaneDistance;
+
+ /* front plane distance */
+ Map.fpd = ACView.Mapping.FrontPlaneDistance;
+
+ Tint err_ind = 0;
+
+ /* use user-defined matrix */
+ if ( ACView.Mapping.IsCustomMatrix )
+ {
+ int i, j;
+ for( i = 0; i < 4; i++ )
+ for( j = 0; j < 4; j++ )
+ myMappingMatrix[i][j] = ACView.Mapping.ProjectionMatrix[i][j];
+ }
+ else
+ TelEvalViewMappingMatrix( &Map, &err_ind, myMappingMatrix );
+
+ if ( !err_ind )
+ myExtra.map = Map;
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_vieworientation
+void OpenGl_View::SetOrientation (const CALL_DEF_VIEW &ACView)
+{
+ Tfloat Vrp[3];
+ Tfloat Vpn[3];
+ Tfloat Vup[3];
+ Tfloat ScaleFactors[3];
+
+ Vrp[0] = ACView.Orientation.ViewReferencePoint.x;
+ Vrp[1] = ACView.Orientation.ViewReferencePoint.y;
+ Vrp[2] = ACView.Orientation.ViewReferencePoint.z;
+
+ Vpn[0] = ACView.Orientation.ViewReferencePlane.x;
+ Vpn[1] = ACView.Orientation.ViewReferencePlane.y;
+ Vpn[2] = ACView.Orientation.ViewReferencePlane.z;
+
+ Vup[0] = ACView.Orientation.ViewReferenceUp.x;
+ Vup[1] = ACView.Orientation.ViewReferenceUp.y;
+ Vup[2] = ACView.Orientation.ViewReferenceUp.z;
+
+ ScaleFactors[0] = ACView.Orientation.ViewScaleX;
+ ScaleFactors[1] = ACView.Orientation.ViewScaleY;
+ ScaleFactors[2] = ACView.Orientation.ViewScaleZ;
+
+ Tint err_ind = 0;
+
+ // use user-defined matrix
+ if ( ACView.Orientation.IsCustomMatrix )
+ {
+ int i, j;
+ for( i = 0; i < 4; i++ )
+ for( j = 0; j < 4; j++ )
+ myOrientationMatrix[i][j] = ACView.Orientation.ModelViewMatrix[i][j];
+ }
+ else
+ TelEvalViewOrientationMatrix( Vrp, Vpn, Vup, ScaleFactors, &err_ind, myOrientationMatrix );
+
+ if ( !err_ind )
+ {
+ myExtra.vrp[0] = Vrp[0];
+ myExtra.vrp[1] = Vrp[1];
+ myExtra.vrp[2] = Vrp[2];
+
+ myExtra.vpn[0] = Vpn[0];
+ myExtra.vpn[1] = Vpn[1];
+ myExtra.vpn[2] = Vpn[2];
+
+ myExtra.vup[0] = Vup[0];
+ myExtra.vup[1] = Vup[1];
+ myExtra.vup[2] = Vup[2];
+
+ myExtra.scaleFactors[0] = ScaleFactors[0],
+ myExtra.scaleFactors[1] = ScaleFactors[1],
+ myExtra.scaleFactors[2] = ScaleFactors[2];
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_View::SetFog (const CALL_DEF_VIEW &ACView, const Standard_Boolean AFlag)
+{
+ if( !AFlag )
+ {
+ myFog.IsOn = Standard_False;
+ }
+ else
+ {
+ myFog.IsOn = Standard_True;
+
+ myFog.Front =
+ (ACView.Context.DepthFrontPlane - ACView.Mapping.BackPlaneDistance) /
+ (ACView.Mapping.FrontPlaneDistance - ACView.Mapping.BackPlaneDistance);
+
+ myFog.Back =
+ (ACView.Context.DepthBackPlane - ACView.Mapping.BackPlaneDistance) /
+ (ACView.Mapping.FrontPlaneDistance - ACView.Mapping.BackPlaneDistance);
+
+ if (myFog.Front < 0.F)
+ myFog.Front = 0.F;
+ else if (myFog.Front > 1.F)
+ myFog.Front = 1.F;
+
+ if (myFog.Back < 0.F)
+ myFog.Back = 0.F;
+ else if (myFog.Back > 1.F)
+ myFog.Back = 1.F;
+
+ if (myFog.Back > myFog.Front)
+ {
+ myFog.Front = 1.F;
+ myFog.Back = 0.F;
+ }
+
+ myFog.Color.rgb[0] = ACView.DefWindow.Background.r;
+ myFog.Color.rgb[1] = ACView.DefWindow.Background.g;
+ myFog.Color.rgb[2] = ACView.DefWindow.Background.b;
+ myFog.Color.rgb[3] = 1.F;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_View::TriedronDisplay (const Aspect_TypeOfTriedronPosition APosition, const Quantity_NameOfColor AColor,
+ const Standard_Real AScale, const Standard_Boolean AsWireframe)
+{
+ myTrihedron = new OpenGl_Trihedron (APosition, AColor, AScale, AsWireframe);
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_View::TriedronErase ()
+{
+ myTrihedron.Nullify();
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_View::GraduatedTrihedronDisplay (const Graphic3d_CGraduatedTrihedron &data)
+{
+ myGraduatedTrihedron = new OpenGl_GraduatedTrihedron(data);
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_View::GraduatedTrihedronErase ()
+{
+ myGraduatedTrihedron.Nullify();
+}
+
+/*----------------------------------------------------------------------*/
+
+//transform_persistence_end
+void OpenGl_View::EndTransformPersistence ()
+{
+ if ( myIsTransPers )
+ {
+ /* restore matrix */
+ glMatrixMode (GL_PROJECTION);
+ glPopMatrix ();
+ glMatrixMode (GL_MODELVIEW);
+ glPopMatrix ();
+ myIsTransPers = Standard_False;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//transform_persistence_begin
+const TEL_TRANSFORM_PERSISTENCE * OpenGl_View::BeginTransformPersistence (const TEL_TRANSFORM_PERSISTENCE *ATransPers)
+{
+ const TEL_TRANSFORM_PERSISTENCE *TransPers_old = myTransPers;
+
+ if ( ATransPers->mode == 0 )
+ {
+ EndTransformPersistence();
+ return TransPers_old;
+ }
+
+ myTransPers = ATransPers;
+
+ GLint viewport[4];
+ glGetIntegerv (GL_VIEWPORT, viewport);
+ GLdouble modelMatrix[4][4];
+ glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix );
+ GLdouble projMatrix[4][4];
+ glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix );
+
+ double W = viewport[2];
+ double H = viewport[3];
+
+ if ( myIsTransPers )
+ {
+ /* restore matrix */
+ glMatrixMode (GL_PROJECTION);
+ glPopMatrix ();
+ glMatrixMode (GL_MODELVIEW);
+ glPopMatrix ();
+ }
+ else
+ myIsTransPers = Standard_True;
+
+ glMatrixMode( GL_MODELVIEW );
+ glPushMatrix();
+ glLoadIdentity();
+
+ glMatrixMode( GL_PROJECTION );
+ glPushMatrix();
+ glLoadIdentity();
+
+ /*pre loading matrix*/
+ if( ATransPers->mode & TPF_PAN )
+ /* Annulate translate matrix */
+ {
+ modelMatrix[3][0] = 0.;
+ modelMatrix[3][1] = 0.;
+ modelMatrix[3][2] = 0.;
+ projMatrix[3][0] = 0.;
+ projMatrix[3][1] = 0.;
+ projMatrix[3][2] = 0.;
+ }
+
+ if( ATransPers->mode & TPF_ZOOM )
+ /* Annulate zoom matrix */
+ {
+ const double scaleX = myExtra.scaleFactors[0];
+ const double scaleY = myExtra.scaleFactors[1];
+ const double scaleZ = myExtra.scaleFactors[2];
+
+ for (int i = 0; i < 3; ++i)
+ {
+ modelMatrix[0][i] /= scaleX;
+ modelMatrix[1][i] /= scaleY;
+ modelMatrix[2][i] /= scaleZ;
+ }
+
+ const double det2 = 0.002 / ( W > H ? projMatrix[1][1] : projMatrix[0][0]);
+ projMatrix[0][0] *= det2;
+ projMatrix[1][1] *= det2;
+ }
+
+ if( ATransPers->mode & TPF_ROTATE )
+ /* Annulate rotate matrix */
+ {
+ modelMatrix[0][0] = 1.;
+ modelMatrix[1][1] = 1.;
+ modelMatrix[2][2] = 1.;
+
+ modelMatrix[1][0] = 0.;
+ modelMatrix[2][0] = 0.;
+ modelMatrix[0][1] = 0.;
+ modelMatrix[2][1] = 0.;
+ modelMatrix[0][2] = 0.;
+ modelMatrix[1][2] = 0.;
+ }
+ else if( ATransPers->mode & TPF_RELATIVE_ROTATE )
+ /* Initialize relative rotate matrix*/
+ {
+ modelMatrix[3][0] = 0.;
+ modelMatrix[3][1] = 0.;
+ modelMatrix[3][2] = 0.;
+
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+ glTranslated( ATransPers->pointX, ATransPers->pointY, ATransPers->pointZ );
+ }
+
+ if( ATransPers->mode == TPF_TRIEDRON )
+ {
+ /* Annulate translation matrix */
+ modelMatrix[3][0] = 0.;
+ modelMatrix[3][1] = 0.;
+ modelMatrix[3][2] = 0.;
+
+ projMatrix[3][0] = 0.;
+ projMatrix[3][1] = 0.;
+ projMatrix[3][2] = 0.;
+
+ const double det2 = 0.002 / ( W > H ? projMatrix[1][1] : projMatrix[0][0]);
+ projMatrix[0][0] *= det2;
+ projMatrix[1][1] *= det2;
+ }
+
+ /* load matrix */
+ glMatrixMode (GL_MODELVIEW);
+ glMultMatrixd ((GLdouble *) modelMatrix);
+
+ glMatrixMode (GL_PROJECTION);
+ glMultMatrixd ((GLdouble *) projMatrix);
+
+ /*post loading matrix*/
+ if( ATransPers->mode == TPF_TRIEDRON )
+ {
+ glMatrixMode( GL_PROJECTION );
+
+ double winx, winy, winz;
+ const GLdouble idenMatrix[4][4] = { {1.,0.,0.,0.}, {0.,1.,0.,0.}, {0.,0.,1.,0.}, {0.,0.,0.,1.} };
+
+ gluUnProject( W/2., H/2., 0., (GLdouble*)idenMatrix, (GLdouble*)projMatrix, (GLint*)viewport, &winx, &winy, &winz);
+ double W1, H1;
+ W1 = winx;
+ H1 = winy;
+ gluUnProject( -W/2., -H/2., 0., (GLdouble*)idenMatrix, (GLdouble*)projMatrix, (GLint*)viewport, &winx, &winy, &winz);
+ double W2, H2;
+ W2 = winx;
+ H2 = winy;
+
+ if( ATransPers->pointX == 0. && ATransPers->pointY == 0. )
+ {
+ /*center*/
+ }
+ else if( ATransPers->pointX > 0. && ATransPers->pointY > 0. )
+ {
+ /*right upper*/
+ glTranslated( 0.5*(W1 - W2 - ATransPers->pointZ), 0.5*(H1 - H2 - ATransPers->pointZ), 0. );
+ }
+ else if( ATransPers->pointX > 0. && ATransPers->pointY < 0. )
+ {
+ /*right lower*/
+ glTranslated( 0.5*(W1 - W2 - ATransPers->pointZ), 0.5*(H2 - H1 + ATransPers->pointZ), 0. );
+ }
+ else if( ATransPers->pointX < 0. && ATransPers->pointY > 0. )
+ {
+ /*left upper*/
+ glTranslated( 0.5*(W2 - W1 + ATransPers->pointZ), 0.5*(H1 - H2 - ATransPers->pointZ), 0. );
+ }
+ else if( ATransPers->pointX < 0 && ATransPers->pointY < 0 )
+ {
+ /*left lower*/
+ glTranslated( -(W1 - W2)/2. + ATransPers->pointZ/2., -(H1-H2)/2. + ATransPers->pointZ/2., 0. );
+ }
+ }
+
+ return TransPers_old;
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_View.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_View_Header
+#define _OpenGl_View_Header
+
+#include <MMgt_TShared.hxx>
+#include <Standard_DefineHandle.hxx>
+
+#include <TColStd_Array2OfReal.hxx>
+#include <NCollection_List.hxx>
+
+#include <Quantity_NameOfColor.hxx>
+#include <Aspect_FillMethod.hxx>
+#include <Aspect_GradientFillMethod.hxx>
+#include <Aspect_TypeOfTriedronPosition.hxx>
+#include <Aspect_CLayer2d.hxx>
+
+#include <InterfaceGraphic_Graphic3d.hxx>
+#include <InterfaceGraphic_Visual3d.hxx>
+
+#include <Graphic3d_CView.hxx>
+#include <Graphic3d_CGraduatedTrihedron.hxx>
+#include <Visual3d_TypeOfSurfaceDetail.hxx>
+
+#include <OpenGl_telem_view.hxx>
+
+#include <OpenGl_Light.hxx>
+#include <OpenGl_PriorityList.hxx>
+
+#include <Handle_OpenGl_Trihedron.hxx>
+#include <Handle_OpenGl_GraduatedTrihedron.hxx>
+#include <Handle_OpenGl_Workspace.hxx>
+#include <Handle_OpenGl_View.hxx>
+
+struct OPENGL_BG_TEXTURE
+{
+ Tuint TexId;
+ Tint Width;
+ Tint Height;
+ Aspect_FillMethod Style;
+};
+
+struct OPENGL_BG_GRADIENT
+{
+ TEL_COLOUR color1;
+ TEL_COLOUR color2;
+ Aspect_GradientFillMethod type;
+};
+
+struct OPENGL_EXTRA_REP
+{
+ Tfloat vrp[3];
+ Tfloat vpn[3];
+ Tfloat vup[3];
+ TEL_VIEW_MAPPING map;
+ Tfloat scaleFactors[3];
+};
+
+struct OPENGL_CLIP_REP
+{
+ Standard_Real equation[4];
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+struct OPENGL_ZCLIP
+{
+ struct {
+ Standard_Boolean IsOn;
+ Standard_ShortReal Limit; /* in the range [0., 1.] */
+ } Back;
+ struct {
+ Standard_Boolean IsOn;
+ Standard_ShortReal Limit; /* in the range [0., 1.] */
+ } Front;
+};
+
+struct OPENGL_FOG
+{
+ Standard_Boolean IsOn;
+ Standard_ShortReal Front; /* in the range [0., 1.] */
+ Standard_ShortReal Back; /* in the range [0., 1.] */
+ TEL_COLOUR Color;
+};
+
+class OpenGl_Structure;
+
+class OpenGl_View : public MMgt_TShared
+{
+ public:
+ OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext);
+ virtual ~OpenGl_View ();
+
+ void SetTextureEnv (const Standard_Integer AId) { myTextureEnv = AId; }
+ void SetSurfaceDetail (const Visual3d_TypeOfSurfaceDetail AMode) { mySurfaceDetail = AMode; }
+ void SetBackfacing (const Standard_Integer AMode);
+ void SetLights (const CALL_DEF_VIEWCONTEXT &AContext);
+ void SetAntiAliasing (const Standard_Boolean AMode) { myAntiAliasing = AMode; }
+ void SetClippingPlanes (const CALL_DEF_VIEWCONTEXT &AContext);
+ void SetVisualisation (const CALL_DEF_VIEWCONTEXT &AContext);
+
+ void SetClipLimit (const CALL_DEF_VIEW &ACView);
+ void SetMapping (const CALL_DEF_VIEW &ACView);
+ void SetOrientation (const CALL_DEF_VIEW &ACView);
+
+ void SetFog (const CALL_DEF_VIEW &ACView, const Standard_Boolean AFlag);
+
+ void TriedronDisplay (const Aspect_TypeOfTriedronPosition APosition, const Quantity_NameOfColor AColor, const Standard_Real AScale, const Standard_Boolean AsWireframe);
+ void TriedronErase ();
+
+ void GraduatedTrihedronDisplay (const Graphic3d_CGraduatedTrihedron &ACubic);
+ void GraduatedTrihedronErase ();
+
+ Standard_Boolean ProjectObjectToRaster (const Standard_Integer w, const Standard_Integer h,
+ const Standard_ShortReal x, const Standard_ShortReal y, const Standard_ShortReal z,
+ Standard_ShortReal &xr, Standard_ShortReal &yr);
+ Standard_Boolean ProjectRasterToObject (const Standard_Integer w, const Standard_Integer h,
+ const Standard_Integer xr, const Standard_Integer yr,
+ Standard_ShortReal &x, Standard_ShortReal &y, Standard_ShortReal &z);
+ Standard_Boolean ProjectRasterToObjectWithRay (const Standard_Integer w, const Standard_Integer h,
+ const Standard_Integer xr, const Standard_Integer yr,
+ Standard_ShortReal &x, Standard_ShortReal &y, Standard_ShortReal &z,
+ Standard_ShortReal &dx, Standard_ShortReal &dy, Standard_ShortReal &dz);
+ void GetMatrices (TColStd_Array2OfReal& theMatOrient,
+ TColStd_Array2OfReal& theMatMapping,
+ const Standard_Boolean theIsCustom) const;
+
+ Standard_Real Height () const { return (myExtra.map.window.xmax - myExtra.map.window.xmin); }
+ Standard_Real Width () const { return (myExtra.map.window.ymax - myExtra.map.window.ymin); }
+
+ Standard_Integer Backfacing () const { return myBackfacing; }
+
+ const TEL_TRANSFORM_PERSISTENCE * BeginTransformPersistence ( const TEL_TRANSFORM_PERSISTENCE *ATransPers );
+ void EndTransformPersistence ();
+
+ void DisplayStructure (const OpenGl_Structure *AStructure, const Standard_Integer APriority) { myStructures.Add(AStructure,APriority); }
+ void EraseStructure (const OpenGl_Structure *AStructure) { myStructures.Remove(AStructure); }
+
+ void CreateBackgroundTexture (const Standard_CString AFileName, const Aspect_FillMethod AFillStyle);
+ void SetBackgroundTextureStyle (const Aspect_FillMethod FillStyle);
+ void SetBackgroundGradient (const Quantity_Color& AColor1, const Quantity_Color& AColor2, const Aspect_GradientFillMethod AType);
+ void SetBackgroundGradientType (const Aspect_GradientFillMethod AType);
+
+ void Render (const Handle(OpenGl_Workspace) &AWorkspace,
+ const Graphic3d_CView& ACView,
+ const Aspect_CLayer2d& ACUnderLayer,
+ const Aspect_CLayer2d& ACOverLayer);
+
+ // Type definition
+ //
+ DEFINE_STANDARD_RTTI(OpenGl_View)
+
+ protected:
+
+ void RenderStructs (const Handle(OpenGl_Workspace) &AWorkspace);
+ void RedrawLayer2d (const Handle(OpenGl_Workspace) &AWorkspace, const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACLayer);
+
+ Standard_Integer myTextureEnv; //WSTextureEnv
+ Visual3d_TypeOfSurfaceDetail mySurfaceDetail; //WSSurfaceDetail
+ Standard_Integer myBackfacing; //WSBackfacing
+
+ OPENGL_BG_TEXTURE myBgTexture; //WSBgTexture
+ OPENGL_BG_GRADIENT myBgGradient; //WSBgGradient
+
+ //{ myViewRep
+ Tmatrix3 myOrientationMatrix;
+ Tmatrix3 myMappingMatrix;
+
+ //Tint shield_indicator;
+ //TEL_COLOUR shield_colour;
+ //Tint border_indicator;
+ //TEL_COLOUR border_colour;
+ //Tint active_status;
+
+ OPENGL_ZCLIP myZClip;
+ NCollection_List<OPENGL_CLIP_REP> myClippingPlanes;
+
+ OPENGL_EXTRA_REP myExtra;
+ //}
+
+ OPENGL_FOG myFog;
+ Handle(OpenGl_Trihedron) myTrihedron;
+ Handle(OpenGl_GraduatedTrihedron) myGraduatedTrihedron;
+
+ //View_LABViewContext
+ int myVisualization;
+ int myIntShadingMethod;
+
+ //View_LABLight
+ OpenGl_ListOfLight myLights;
+
+ //View_LABPlane
+ //View_LABAliasing
+ Standard_Boolean myAntiAliasing;
+
+ //View_LABDepthCueing - fixed index used
+
+ OpenGl_PriorityList myStructures;
+
+ int myAnimationListIndex;
+ Standard_Boolean myAnimationListReady;
+
+ const TEL_TRANSFORM_PERSISTENCE *myTransPers;
+ Standard_Boolean myIsTransPers;
+
+ Standard_Boolean myResetFLIST;
+
+ public:
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+#endif //_OpenGl_View_Header
--- /dev/null
+// File: OpenGl_View_1.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_View.hxx>
+
+#include <Visual3d_Layer.hxx>
+
+#include <OpenGl_tgl_all.hxx>
+#include <OpenGl_tgl_funcs.hxx>
+
+#include <OpenGl_PrinterContext.hxx>
+#include <OpenGl_Workspace.hxx>
+
+/*----------------------------------------------------------------------*/
+
+//TelProjectionRaster in OpenGl_telem_util.cxx
+Standard_Boolean OpenGl_View::ProjectObjectToRaster (const Standard_Integer w, const Standard_Integer h,
+ const Standard_ShortReal x, const Standard_ShortReal y, const Standard_ShortReal z,
+ Standard_ShortReal &xr, Standard_ShortReal &yr)
+{
+ int i, j, k;
+
+ GLdouble modelMatrix[16];
+ for (k = 0, i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++, k++)
+ modelMatrix[k] = ( GLdouble )myOrientationMatrix[i][j];
+
+ GLdouble projMatrix[16];
+ for (k = 0, i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++, k++)
+ projMatrix[k] = ( GLdouble )myMappingMatrix[i][j];
+
+ GLint viewport[4];
+ viewport[0] = 0;
+ viewport[1] = 0;
+ viewport[2] = w;
+ viewport[3] = h;
+
+ /*
+ * glGetIntegerv (GL_VIEWPORT, viewport);
+ * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
+ * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
+ */
+
+ GLdouble winx, winy, winz;
+ if (gluProject (( GLdouble )x, ( GLdouble )y, ( GLdouble )z, modelMatrix, projMatrix, viewport, &winx, &winy, &winz))
+ {
+ xr = ( Standard_ShortReal )winx;
+ yr = ( Standard_ShortReal )winy;
+ return Standard_True;
+ }
+
+ xr = 0.F;
+ yr = 0.F;
+ return Standard_False;
+}
+
+/*----------------------------------------------------------------------*/
+//TelUnProjectionRaster
+Standard_Boolean OpenGl_View::ProjectRasterToObject (const Standard_Integer w, const Standard_Integer h,
+ const Standard_Integer xr, const Standard_Integer yr,
+ Standard_ShortReal &x, Standard_ShortReal &y, Standard_ShortReal &z)
+{
+ int i, j, k;
+
+ GLdouble modelMatrix[16];
+ for (k = 0, i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++, k++)
+ modelMatrix[k] = ( GLdouble )myOrientationMatrix[i][j];
+
+ GLdouble projMatrix[16];
+ for (k = 0, i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++, k++)
+ projMatrix[k] = ( GLdouble )myMappingMatrix[i][j];
+
+ GLint viewport[4];
+ viewport[0] = 0;
+ viewport[1] = 0;
+ viewport[2] = w;
+ viewport[3] = h;
+
+ /*
+ * glGetIntegerv (GL_VIEWPORT, viewport);
+ * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
+ * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
+ */
+
+ GLdouble objx, objy, objz;
+ if (gluUnProject (( GLdouble )xr, ( GLdouble )yr, 0.0, modelMatrix, projMatrix, viewport, &objx, &objy, &objz))
+ {
+ x = ( Standard_ShortReal )objx;
+ y = ( Standard_ShortReal )objy;
+ z = ( Standard_ShortReal )objz;
+ return Standard_True;
+ }
+
+ x = 0.F;
+ y = 0.F;
+ z = 0.F;
+ return Standard_False;
+}
+
+/*----------------------------------------------------------------------*/
+//TelUnProjectionRasterWithRay
+Standard_Boolean OpenGl_View::ProjectRasterToObjectWithRay (const Standard_Integer w, const Standard_Integer h,
+ const Standard_Integer xr, const Standard_Integer yr,
+ Standard_ShortReal &x, Standard_ShortReal &y, Standard_ShortReal &z,
+ Standard_ShortReal &dx, Standard_ShortReal &dy, Standard_ShortReal &dz)
+{
+ int i, j, k;
+
+ GLdouble modelMatrix[16];
+ for (k = 0, i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++, k++)
+ modelMatrix[k] = ( GLdouble )myOrientationMatrix[i][j];
+
+ GLdouble projMatrix[16];
+ for (k = 0, i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++, k++)
+ projMatrix[k] = ( GLdouble )myMappingMatrix[i][j];
+
+ GLint viewport[4];
+ viewport[0] = 0;
+ viewport[1] = 0;
+ viewport[2] = w;
+ viewport[3] = h;
+
+ /*
+ * glGetIntegerv (GL_VIEWPORT, viewport);
+ * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
+ * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
+ */
+
+ const GLdouble winx = ( GLdouble )xr;
+ const GLdouble winy = ( GLdouble )yr;
+
+ GLdouble objx, objy, objz;
+ if (gluUnProject (winx, winy, 0.0, modelMatrix, projMatrix, viewport, &objx, &objy, &objz))
+ {
+ GLdouble objx1, objy1, objz1;
+ if (gluUnProject (winx, winy, -10.0, modelMatrix, projMatrix, viewport, &objx1, &objy1, &objz1))
+ {
+ x = ( Standard_ShortReal )objx;
+ y = ( Standard_ShortReal )objy;
+ z = ( Standard_ShortReal )objz;
+ dx = ( Standard_ShortReal )(objx-objx1);
+ dy = ( Standard_ShortReal )(objy-objy1);
+ dz = ( Standard_ShortReal )(objz-objz1);
+ return Standard_True;
+ }
+ }
+
+ x = 0.F;
+ y = 0.F;
+ z = 0.F;
+ dx = 0.F;
+ dy = 0.F;
+ dz = 0.F;
+ return Standard_False;
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_inquiremat
+void OpenGl_View::GetMatrices (TColStd_Array2OfReal& theMatOrient,
+ TColStd_Array2OfReal& theMatMapping,
+ const Standard_Boolean theIsCustom) const
+{
+ int i, j;
+ if (theIsCustom)
+ {
+ // OCC18942: Trying to return the current matrices instead of calculating them anew.
+ // This in particular allows using application-defined matrices.
+ for (i = 0; i < 4; ++i)
+ {
+ for (j = 0; j < 4; ++j)
+ {
+ theMatOrient (i, j) = myOrientationMatrix[j][i];
+ theMatMapping (i, j) = myMappingMatrix[j][i];
+ }
+ }
+ return;
+ }
+
+ int anErr = 0;
+ Tmatrix3 aMatOri;
+ Tmatrix3 aMatMapping;
+
+ view_map3 aViewMap;
+ memcpy (&aViewMap.win, &myExtra.map.window, sizeof(Tlimit));
+ memcpy (&aViewMap.proj_vp, &myExtra.map.viewport, sizeof(Tlimit3));
+ switch (myExtra.map.proj)
+ {
+ default:
+ case TelParallel: aViewMap.proj_type = TYPE_PARAL; break;
+ case TelPerspective: aViewMap.proj_type = TYPE_PERSPECT; break;
+ }
+ aViewMap.proj_ref_point.x = myExtra.map.prp[0];
+ aViewMap.proj_ref_point.y = myExtra.map.prp[1];
+ aViewMap.proj_ref_point.z = myExtra.map.prp[2];
+ aViewMap.view_plane = myExtra.map.vpd;
+ aViewMap.back_plane = myExtra.map.bpd;
+ aViewMap.front_plane = myExtra.map.fpd;
+
+ call_func_eval_ori_matrix3 ((const point3* )myExtra.vrp,
+ (const vec3* )myExtra.vpn,
+ (const vec3* )myExtra.vup,
+ &anErr, aMatOri);
+ if (anErr == 0)
+ call_func_eval_map_matrix3 (&aViewMap, &anErr, aMatMapping);
+
+ if (anErr == 0)
+ {
+ for (i = 0; i < 4; ++i)
+ {
+ for (j = 0; j < 4; ++j)
+ {
+ theMatOrient (i, j) = aMatOri[j][i];
+ theMatMapping (i, j) = aMatMapping[j][i];
+ }
+ }
+ return;
+ }
+
+ // return just identity matrices
+ for (i = 0; i < 4; ++i)
+ {
+ for (j = 0; j < 4; ++j)
+ {
+ if (i == j) {
+ theMatMapping (i, j) = 1.0;
+ theMatOrient (i, j) = 1.0;
+ }
+ else {
+ theMatMapping (i, j) = 0.0;
+ theMatOrient (i, j) = 0.0;
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_View_2.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#define G003 /* EUG 20-09-99 ; Animation management
+*/
+
+/*----------------------------------------------------------------------*/
+/*
+* Includes
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <OpenGl_tgl_all.hxx>
+#include <OpenGl_tgl_funcs.hxx>
+#include <OpenGl_TextureBox.hxx>
+
+#include <AlienImage.hxx>
+#include <Image_Image.hxx>
+#include <Visual3d_Layer.hxx>
+
+#if defined(WNT)
+#include <GL/glu.h>
+#endif
+
+#include <OpenGl_AspectLine.hxx>
+#include <OpenGl_Display.hxx>
+#include <OpenGl_Workspace.hxx>
+#include <OpenGl_View.hxx>
+#include <OpenGl_Trihedron.hxx>
+#include <OpenGl_GraduatedTrihedron.hxx>
+#include <OpenGl_PrinterContext.hxx>
+
+/*----------------------------------------------------------------------*/
+/*
+* Constantes
+*/
+
+#define EPSI 0.0001
+
+#ifndef M_PI
+# define M_PI 3.14159265358979323846
+#endif
+
+static const GLfloat default_amb[4] = { 0.F, 0.F, 0.F, 1.F };
+static const GLfloat default_sptdir[3] = { 0.F, 0.F, -1.F };
+static const GLfloat default_sptexpo = 0.F;
+static const GLfloat default_sptcutoff = 180.F;
+
+extern void InitLayerProp (const int AListId); //szvgl: defined in OpenGl_GraphicDriver_Layer.cxx
+
+/*----------------------------------------------------------------------*/
+
+struct OPENGL_CLIP_PLANE
+{
+ GLboolean isEnabled;
+ GLdouble Equation[4];
+ IMPLEMENT_MEMORY_OPERATORS
+};
+
+/*----------------------------------------------------------------------*/
+/*
+* Fonctions privees
+*/
+
+/*-----------------------------------------------------------------*/
+/*
+* Set des lumieres
+*/
+static void bind_light(const OpenGl_Light *lptr, int *gl_lid)
+{
+ // Only 8 lights in OpenGL...
+ if (*gl_lid > GL_LIGHT7) return;
+
+ // the light is a headlight ?
+ GLint cur_matrix;
+ if (lptr->HeadLight)
+ {
+ glGetIntegerv(GL_MATRIX_MODE, &cur_matrix);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ }
+
+ GLfloat data_amb[4];
+ GLfloat data_diffu[4];
+ GLfloat data_pos[4];
+ GLfloat data_sptdir[3];
+ GLfloat data_sptexpo;
+ GLfloat data_sptcutoff;
+ GLfloat data_constantattenuation;
+ GLfloat data_linearattenuation;
+
+ /* set la light en fonction de son type */
+ switch (lptr->type)
+ {
+ case TLightAmbient:
+ data_amb[0] = lptr->col.rgb[0];
+ data_amb[1] = lptr->col.rgb[1];
+ data_amb[2] = lptr->col.rgb[2];
+ data_amb[3] = 1.0;
+
+ /*------------------------- Ambient ---------------------------*/
+ /*
+ * The GL_AMBIENT parameter refers to RGBA intensity of the ambient
+ * light.
+ */
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, data_amb);
+ break;
+
+
+ case TLightDirectional:
+ data_diffu[0] = lptr->col.rgb[0];
+ data_diffu[1] = lptr->col.rgb[1];
+ data_diffu[2] = lptr->col.rgb[2];
+ data_diffu[3] = 1.0;
+
+ /*------------------------- Direction ---------------------------*/
+ /* From Open GL Programming Rev 1 Guide Chapt 6 :
+ Lighting The Mathematics of Lighting ( p 168 )
+
+ Directional Light Source ( Infinite ) :
+ if the last parameter of GL_POSITION , w , is zero, the
+ corresponding light source is a Directional one.
+
+ GL_SPOT_CUTOFF a 180 signifie que ce n'est pas un spot.
+ To create a realistic effect, set the GL_SPECULAR parameter
+ to the same value as the GL_DIFFUSE.
+ */
+
+ data_pos[0] = -lptr->dir[0];
+ data_pos[1] = -lptr->dir[1];
+ data_pos[2] = -lptr->dir[2];
+ data_pos[3] = 0.0;
+
+ glLightfv(*gl_lid, GL_AMBIENT, default_amb);
+ glLightfv(*gl_lid, GL_DIFFUSE, data_diffu);
+ glLightfv(*gl_lid, GL_SPECULAR, data_diffu);
+
+ glLightfv(*gl_lid, GL_POSITION, data_pos);
+ glLightfv(*gl_lid, GL_SPOT_DIRECTION, default_sptdir);
+ glLightf(*gl_lid, GL_SPOT_EXPONENT, default_sptexpo);
+ glLightf(*gl_lid, GL_SPOT_CUTOFF, default_sptcutoff);
+ break;
+
+
+ case TLightPositional:
+ data_diffu[0] = lptr->col.rgb[0];
+ data_diffu[1] = lptr->col.rgb[1];
+ data_diffu[2] = lptr->col.rgb[2];
+ data_diffu[3] = 1.0;
+
+ /*------------------------- Position -----------------------------*/
+ /* From Open GL Programming Rev 1 Guide Chapt 6 :
+ Lighting The Mathematics of Lighting ( p 168 )
+ Positional Light Source :
+ if the last parameter of GL_POSITION , w , is nonzero,
+ the corresponding light source is a Positional one.
+
+ GL_SPOT_CUTOFF a 180 signifie que ce n'est pas un spot.
+
+ To create a realistic effect, set the GL_SPECULAR parameter
+ to the same value as the GL_DIFFUSE.
+ */
+
+ data_pos[0] = lptr->pos[0];
+ data_pos[1] = lptr->pos[1];
+ data_pos[2] = lptr->pos[2];
+ data_pos[3] = 1.0;
+
+ data_constantattenuation = lptr->atten[0];
+ data_linearattenuation = lptr->atten[1];
+
+ glLightfv(*gl_lid, GL_AMBIENT, default_amb);
+ glLightfv(*gl_lid, GL_DIFFUSE, data_diffu);
+ glLightfv(*gl_lid, GL_SPECULAR, data_diffu);
+
+ glLightfv(*gl_lid, GL_POSITION, data_pos);
+ glLightfv(*gl_lid, GL_SPOT_DIRECTION, default_sptdir);
+ glLightf(*gl_lid, GL_SPOT_EXPONENT, default_sptexpo);
+ glLightf(*gl_lid, GL_SPOT_CUTOFF, default_sptcutoff);
+ glLightf(*gl_lid, GL_CONSTANT_ATTENUATION, data_constantattenuation);
+ glLightf(*gl_lid, GL_LINEAR_ATTENUATION, data_linearattenuation);
+ glLightf(*gl_lid, GL_QUADRATIC_ATTENUATION, 0.0);
+ break;
+
+
+ case TLightSpot:
+ data_diffu[0] = lptr->col.rgb[0];
+ data_diffu[1] = lptr->col.rgb[1];
+ data_diffu[2] = lptr->col.rgb[2];
+ data_diffu[3] = 1.0;
+
+ data_pos[0] = lptr->pos[0];
+ data_pos[1] = lptr->pos[1];
+ data_pos[2] = lptr->pos[2];
+ data_pos[3] = 1.0;
+
+ data_sptdir[0] = lptr->dir[0];
+ data_sptdir[1] = lptr->dir[1];
+ data_sptdir[2] = lptr->dir[2];
+
+ data_sptexpo = ( float )lptr->shine * 128.0F;
+ data_sptcutoff = ( float )(lptr->angle * 180.0F)/( float )M_PI;
+
+ data_constantattenuation = lptr->atten[0];
+ data_linearattenuation = lptr->atten[1];
+
+ glLightfv(*gl_lid, GL_AMBIENT, default_amb);
+ glLightfv(*gl_lid, GL_DIFFUSE, data_diffu);
+ glLightfv(*gl_lid, GL_SPECULAR, data_diffu);
+
+ glLightfv(*gl_lid, GL_POSITION, data_pos);
+ glLightfv(*gl_lid, GL_SPOT_DIRECTION, data_sptdir);
+ glLightf(*gl_lid, GL_SPOT_EXPONENT, data_sptexpo);
+ glLightf(*gl_lid, GL_SPOT_CUTOFF, data_sptcutoff);
+ glLightf(*gl_lid, GL_CONSTANT_ATTENUATION, data_constantattenuation);
+ glLightf(*gl_lid, GL_LINEAR_ATTENUATION, data_linearattenuation);
+ glLightf(*gl_lid, GL_QUADRATIC_ATTENUATION, 0.0);
+ break;
+ }
+
+ if (lptr->type != TLightAmbient)
+ {
+ glEnable(*gl_lid);
+ (*gl_lid)++;
+ }
+
+ /* si la light etait une headlight alors restaure la matrice precedente */
+ if (lptr->HeadLight)
+ {
+ glPopMatrix();
+ glMatrixMode(cur_matrix);
+ }
+}
+
+/*----------------------------------------------------------------------*/
+/*
+* Prototypes
+*/
+
+static void call_util_apply_trans2( float ix, float iy, float iz, matrix3 mat,
+ float *ox, float *oy, float *oz );
+static void call_util_mat_mul( matrix3 mat_a, matrix3 mat_b, matrix3 mat_c);
+
+/*----------------------------------------------------------------------*/
+/*
+* Fonctions externes
+*/
+
+/*
+* Evaluates orientation matrix.
+*/
+/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */
+void call_func_eval_ori_matrix3 (const point3* vrp, // view reference point
+ const vec3* vpn, // view plane normal
+ const vec3* vup, // view up vector
+ int* err_ind,
+ float mout[4][4]) // OUT view orientation matrix
+{
+
+ /* Translate to VRP then change the basis.
+ * The old basis is: e1 = < 1, 0, 0>, e2 = < 0, 1, 0>, e3 = < 0, 0, 1>.
+ * The new basis is: ("x" means cross product)
+ * e3' = VPN / |VPN|
+ * e1' = VUP x VPN / |VUP x VPN|
+ * e2' = e3' x e1'
+ * Therefore the transform from old to new is x' = TAx, where:
+ *
+ * | e1'x e2'x e3'x 0 | | 1 0 0 0 |
+ * A = | e1'y e2'y e3'y 0 |, T = | 0 1 0 0 |
+ * | e1'z e2'z e3'z 0 | | 0 0 1 0 |
+ * | 0 0 0 1 | | -vrp.x -vrp.y -vrp.z 1 |
+ *
+ */
+
+ /*
+ * These ei's are really ei primes.
+ */
+ register float (*m)[4][4];
+ point3 e1, e2, e3, e4;
+ double s, v;
+
+ /*
+ * e1' = VUP x VPN / |VUP x VPN|, but do the division later.
+ */
+ e1.x = vup->delta_y * vpn->delta_z - vup->delta_z * vpn->delta_y;
+ e1.y = vup->delta_z * vpn->delta_x - vup->delta_x * vpn->delta_z;
+ e1.z = vup->delta_x * vpn->delta_y - vup->delta_y * vpn->delta_x;
+ s = sqrt( e1.x * e1.x + e1.y * e1.y + e1.z * e1.z);
+ e3.x = vpn->delta_x;
+ e3.y = vpn->delta_y;
+ e3.z = vpn->delta_z;
+ v = sqrt( e3.x * e3.x + e3.y * e3.y + e3.z * e3.z);
+ /*
+ * Check for vup and vpn colinear (zero dot product).
+ */
+ if ((s > -EPSI) && (s < EPSI))
+ *err_ind = 2;
+ else
+ /*
+ * Check for a normal vector not null.
+ */
+ if ((v > -EPSI) && (v < EPSI))
+ *err_ind = 3;
+ else {
+ /*
+ * Normalize e1
+ */
+ e1.x /= ( float )s;
+ e1.y /= ( float )s;
+ e1.z /= ( float )s;
+ /*
+ * e3 = VPN / |VPN|
+ */
+ e3.x /= ( float )v;
+ e3.y /= ( float )v;
+ e3.z /= ( float )v;
+ /*
+ * e2 = e3 x e1
+ */
+ e2.x = e3.y * e1.z - e3.z * e1.y;
+ e2.y = e3.z * e1.x - e3.x * e1.z;
+ e2.z = e3.x * e1.y - e3.y * e1.x;
+ /*
+ * Add the translation
+ */
+ e4.x = -( e1.x * vrp->x + e1.y * vrp->y + e1.z * vrp->z);
+ e4.y = -( e2.x * vrp->x + e2.y * vrp->y + e2.z * vrp->z);
+ e4.z = -( e3.x * vrp->x + e3.y * vrp->y + e3.z * vrp->z);
+ /*
+ * Homogeneous entries
+ *
+ * | e1.x e2.x e3.x 0.0 | | 1 0 0 0 |
+ * | e1.y e2.y e3.y 0.0 | * | 0 1 0 0 |
+ * | e1.z e2.z e3.z 0.0 | | a b 1 c |
+ * | e4.x e4.y e4.z 1.0 | | 0 0 0 1 |
+ */
+
+ m = (float (*)[4][4])mout;
+
+ (*m)[0][0] = e1.x;
+ (*m)[0][1] = e2.x;
+ (*m)[0][2] = e3.x;
+ (*m)[0][3] = ( float )0.0;
+
+ (*m)[1][0] = e1.y;
+ (*m)[1][1] = e2.y;
+ (*m)[1][2] = e3.y;
+ (*m)[1][3] = ( float )0.0;
+
+ (*m)[2][0] = e1.z;
+ (*m)[2][1] = e2.z;
+ (*m)[2][2] = e3.z;
+ (*m)[2][3] = ( float )0.0;
+
+ (*m)[3][0] = e4.x;
+ (*m)[3][1] = e4.y;
+ (*m)[3][2] = e4.z;
+ (*m)[3][3] = ( float )1.0;
+
+ *err_ind = 0;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+/*
+* Evaluates mapping matrix.
+*/
+/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */
+void call_func_eval_map_matrix3(
+ view_map3 *Map,
+ int *err_ind,
+ matrix3 mat)
+{
+ int i, j;
+ matrix3 Tpar, Spar;
+ matrix3 Tper, Sper;
+ matrix3 Shear;
+ matrix3 Scale;
+ matrix3 Tprp;
+ matrix3 aux_mat1, aux_mat2, aux_mat3;
+ point3 Prp;
+
+ *err_ind = 0;
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ Spar[i][j] = Sper[i][j] = aux_mat1[i][j] = aux_mat2[i][j] =
+ aux_mat3[i][j] = Tper[i][j] = Tpar[i][j] = Tprp[i][j] =
+ Shear[i][j] = Scale[i][j] = ( float )(i == j);
+
+ Prp.x = Map->proj_ref_point.x;
+ Prp.y = Map->proj_ref_point.y;
+ Prp.z = Map->proj_ref_point.z;
+
+ /*
+ * Type Parallele
+ */
+ if (Map->proj_type == TYPE_PARAL)
+ {
+ float umid, vmid;
+ point3 temp;
+
+#ifdef FMN
+ float cx, cy, gx, gy, xsf, ysf, zsf;
+ float fpd, bpd;
+ float dopx, dopy, dopz;
+ matrix3 tmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
+ matrix3 smat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
+ matrix3 shmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
+ matrix3 tshmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
+
+ /* centers */
+ cx = Map->win.x_min + Map->win.x_max, cx /= ( float )2.0;
+ cy = Map->win.y_min + Map->win.y_max, cy /= ( float )2.0;
+
+ gx = 2.0/ (Map->win.x_max - Map->win.x_min);
+ gy = 2.0/ (Map->win.y_max - Map->win.y_min);
+
+ tmat[0][3] = -cx;
+ tmat[1][3] = -cy;
+ tmat[2][3] = (Map->front_plane + Map->back_plane)/(Map->front_plane - Map->back_plane);
+
+ smat[0][0] = gx;
+ smat[1][1] = gy;
+ smat[2][2] = -2./(Map->front_plane - Map->back_plane);
+
+ /* scale factors */
+ dopx = cx - Prp.x;
+ dopy = cy - Prp.y;
+ dopz = - Prp.z;
+
+ /* map matrix */
+ shmat[0][2] = -(dopx/dopz);
+ shmat[1][2] = -(dopy/dopz);
+
+ /* multiply to obtain mapping matrix */
+ call_util_mat_mul( tmat, shmat, tshmat );
+ call_util_mat_mul( smat, tshmat, mat );
+
+ return;
+#endif
+
+ /* CAL */
+ Map->proj_vp.z_min = ( float )0.0;
+ Map->proj_vp.z_max = ( float )1.0;
+ /* CAL */
+
+ /* Shear matrix calculation */
+ umid = ( float )(Map->win.x_min+Map->win.x_max)/( float )2.0;
+ vmid = ( float )(Map->win.y_min+Map->win.y_max)/( float )2.0;
+ if(Prp.z == Map->view_plane){
+ /* Projection reference point is on the view plane */
+ *err_ind = 1;
+ return;
+ }
+ Shear[2][0] = ( float )(-1.0) * ((Prp.x-umid)/(Prp.z-Map->view_plane));
+ Shear[2][1] = ( float )(-1.0) * ((Prp.y-vmid)/(Prp.z-Map->view_plane));
+
+ /*
+ * Calculate the lower left coordinate of the view plane
+ * after the Shearing Transformation.
+ */
+ call_util_apply_trans2(Map->win.x_min, Map->win.y_min,
+ Map->view_plane, Shear, &(temp.x), &(temp.y), &(temp.z));
+
+ /* Translate the back plane to the origin */
+ Tpar[3][0] = ( float )(-1.0) * temp.x;
+ Tpar[3][1] = ( float )(-1.0) * temp.y;
+ Tpar[3][2] = ( float )(-1.0) * Map->back_plane;
+
+ call_util_mat_mul(Shear, Tpar, aux_mat1);
+
+ /* Calculation of Scaling transformation */
+ Spar[0][0] = ( float )1.0 / (Map->win.x_max - Map->win.x_min);
+ Spar[1][1] = ( float )1.0 / (Map->win.y_max - Map->win.y_min);
+ Spar[2][2] = ( float )1.0 / (Map->front_plane - Map->back_plane );
+ call_util_mat_mul (aux_mat1, Spar, aux_mat2);
+ /* Atlast we transformed view volume to NPC */
+
+ /* Translate and scale the view plane to projection view port */
+ if(Map->proj_vp.x_min < 0.0 || Map->proj_vp.y_min < 0.0 ||
+ Map->proj_vp.z_min < 0.0 || Map->proj_vp.x_max > 1.0 ||
+ Map->proj_vp.y_max > 1.0 || Map->proj_vp.z_max > 1.0 ||
+ Map->proj_vp.x_min > Map->proj_vp.x_max ||
+ Map->proj_vp.y_min > Map->proj_vp.y_max ||
+ Map->proj_vp.z_min > Map->proj_vp.z_max){
+ *err_ind = 1;
+ return;
+ }
+ for(i=0; i<4; i++)
+ for(j=0; j<4; j++)
+ aux_mat1[i][j] = (float)(i==j);
+ aux_mat1[0][0] = Map->proj_vp.x_max-Map->proj_vp.x_min;
+ aux_mat1[1][1] = Map->proj_vp.y_max-Map->proj_vp.y_min;
+ aux_mat1[2][2] = Map->proj_vp.z_max-Map->proj_vp.z_min;
+ aux_mat1[3][0] = Map->proj_vp.x_min;
+ aux_mat1[3][1] = Map->proj_vp.y_min;
+ aux_mat1[3][2] = Map->proj_vp.z_min;
+ call_util_mat_mul (aux_mat2, aux_mat1, mat);
+
+ return;
+ }
+
+ /*
+ * Type Perspective
+ */
+ else if (Map->proj_type == TYPE_PERSPECT)
+ {
+ float umid, vmid;
+ float B, F, V;
+ float Zvmin;
+
+ /* CAL */
+ Map->proj_vp.z_min = ( float )0.0;
+ Map->proj_vp.z_max = ( float )1.0;
+ /* CAL */
+
+ B = Map->back_plane;
+ F = Map->front_plane;
+ V = Map->view_plane;
+
+ if(Prp.z == Map->view_plane){
+ /* Centre of Projection is on the view plane */
+ *err_ind = 1;
+ return;
+ }
+ if(Map->proj_vp.x_min < 0.0 || Map->proj_vp.y_min < 0.0 ||
+ Map->proj_vp.z_min < 0.0 || Map->proj_vp.x_max > 1.0 ||
+ Map->proj_vp.y_max > 1.0 || Map->proj_vp.z_max > 1.0 ||
+ Map->proj_vp.x_min > Map->proj_vp.x_max ||
+ Map->proj_vp.y_min > Map->proj_vp.y_max ||
+ Map->proj_vp.z_min > Map->proj_vp.z_max ||
+ F < B){
+ *err_ind = 1;
+ return;
+ }
+
+ /* This is the transformation to move VRC to Center Of Projection */
+ Tprp[3][0] = ( float )(-1.0)*Prp.x;
+ Tprp[3][1] = ( float )(-1.0)*Prp.y;
+ Tprp[3][2] = ( float )(-1.0)*Prp.z;
+
+ /* Calculation of Shear matrix */
+ umid = ( float )(Map->win.x_min+Map->win.x_max)/( float )2.0-Prp.x;
+ vmid = ( float )(Map->win.y_min+Map->win.y_max)/( float )2.0-Prp.y;
+ Shear[2][0] = ( float )(-1.0)*umid/(Map->view_plane-Prp.z);
+ Shear[2][1] = ( float )(-1.0)*vmid/(Map->view_plane-Prp.z);
+ call_util_mat_mul(Tprp, Shear, aux_mat3);
+
+ /* Scale the view volume to canonical view volume
+ * Centre of projection at origin.
+ * 0 <= N <= -1, -0.5 <= U <= 0.5, -0.5 <= V <= 0.5
+ */
+ Scale[0][0] = (( float )(-1.0)*Prp.z+V)/
+ ((Map->win.x_max-Map->win.x_min)*(( float )(-1.0)*Prp.z+B));
+ Scale[1][1] = (( float )(-1.0)*Prp.z+V)/
+ ((Map->win.y_max-Map->win.y_min)*(( float )(-1.0)*Prp.z+B));
+ Scale[2][2] = ( float )(-1.0) / (( float )(-1.0)*Prp.z+B);
+
+ call_util_mat_mul(aux_mat3, Scale, aux_mat1);
+
+ /*
+ * Transform the Perspective view volume into
+ * Parallel view volume.
+ * Lower left coordinate: (-0.5,-0.5, -1)
+ * Upper right coordinate: (0.5, 0.5, 1.0)
+ */
+ Zvmin = ( float )(-1.0*(-1.0*Prp.z+F)/(-1.0*Prp.z+B));
+ aux_mat2[2][2] = ( float )1.0/(( float )1.0+Zvmin);
+ aux_mat2[2][3] = ( float )(-1.0);
+ aux_mat2[3][2] = ( float )(-1.0)*Zvmin*aux_mat2[2][2];
+ aux_mat2[3][3] = ( float )0.0;
+ call_util_mat_mul(aux_mat1, aux_mat2, Shear);
+
+ for(i=0; i<4; i++)
+ for(j=0; j<4; j++)
+ aux_mat1[i][j] = aux_mat2[i][j] = (float)(i==j);
+
+ /* Translate and scale the view plane to projection view port */
+ aux_mat2[0][0] = (Map->proj_vp.x_max-Map->proj_vp.x_min);
+ aux_mat2[1][1] = (Map->proj_vp.y_max-Map->proj_vp.y_min);
+ aux_mat2[2][2] = (Map->proj_vp.z_max-Map->proj_vp.z_min);
+ aux_mat2[3][0] = aux_mat2[0][0]/( float )2.0+Map->proj_vp.x_min;
+ aux_mat2[3][1] = aux_mat2[1][1]/( float )2.0+Map->proj_vp.y_min;
+ aux_mat2[3][2] = aux_mat2[2][2]+Map->proj_vp.z_min;
+ call_util_mat_mul (Shear, aux_mat2, mat);
+
+ return;
+ }
+ else
+ *err_ind = 1;
+}
+
+/*----------------------------------------------------------------------*/
+
+static void
+call_util_apply_trans2( float ix, float iy, float iz, matrix3 mat,
+ float *ox, float *oy, float *oz )
+{
+ float temp;
+ *ox = ix*mat[0][0]+iy*mat[1][0]+iz*mat[2][0]+mat[3][0];
+ *oy = ix*mat[0][1]+iy*mat[1][1]+iz*mat[2][1]+mat[3][1];
+ *oz = ix*mat[0][2]+iy*mat[1][2]+iz*mat[2][2]+mat[3][2];
+ temp = ix * mat[0][3]+iy * mat[1][3]+iz * mat[2][3]+mat[3][3];
+ *ox /= temp;
+ *oy /= temp;
+ *oz /= temp;
+}
+
+/*----------------------------------------------------------------------*/
+
+static void
+call_util_mat_mul( matrix3 mat_a, matrix3 mat_b, matrix3 mat_c)
+{
+ int i, j, k;
+
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ for (mat_c[i][j] = ( float )0.0,k=0; k<4; k++)
+ mat_c[i][j] += mat_a[i][k] * mat_b[k][j];
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_func_redraw_all_structs_proc
+void OpenGl_View::Render (const Handle(OpenGl_Workspace) &AWorkspace,
+ const Graphic3d_CView& ACView,
+ const Aspect_CLayer2d& ACUnderLayer,
+ const Aspect_CLayer2d& ACOverLayer)
+{
+ // Reset FLIST status after modification of myBackfacing
+ if (myResetFLIST)
+ {
+ AWorkspace->NamedStatus &= ~OPENGL_NS_FLIST;
+ myResetFLIST = Standard_False;
+ }
+
+ // Store and disable current clipping planes
+ GLint maxplanes;
+ glGetIntegerv(GL_MAX_CLIP_PLANES, &maxplanes);
+ const GLenum lastid = GL_CLIP_PLANE0 + maxplanes;
+ OPENGL_CLIP_PLANE *oldPlanes = new OPENGL_CLIP_PLANE[maxplanes];
+ OPENGL_CLIP_PLANE *ptrPlane = oldPlanes;
+ GLenum planeid = GL_CLIP_PLANE0;
+ for ( ; planeid < lastid; planeid++, ptrPlane++ )
+ {
+ glGetClipPlane( planeid, ptrPlane->Equation );
+ if ( ptrPlane->isEnabled )
+ {
+ glDisable( planeid );
+ ptrPlane->isEnabled = GL_TRUE;
+ }
+ else
+ ptrPlane->isEnabled = GL_FALSE;
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+ // Step 1: Prepare for redraw
+
+ // Render background
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_WHITEBACK) == 0 &&
+ ( myBgTexture.TexId != 0 || myBgGradient.type != Aspect_GFM_NONE ) )
+ {
+ const Standard_Integer aViewWidth = AWorkspace->Width();
+ const Standard_Integer aViewHeight = AWorkspace->Height();
+
+ glPushAttrib( GL_ENABLE_BIT | GL_TEXTURE_BIT );
+
+ glMatrixMode( GL_PROJECTION );
+ glPushMatrix();
+ glLoadIdentity();
+ glMatrixMode( GL_MODELVIEW );
+ glPushMatrix();
+ glLoadIdentity();
+
+ if ( glIsEnabled( GL_DEPTH_TEST ) )
+ glDisable( GL_DEPTH_TEST ); //push GL_ENABLE_BIT
+
+ // drawing bg image if defined
+ if ( myBgTexture.TexId != 0 )
+ {
+ GLfloat texX_range = 1.F; // texture <s> coordinate
+ GLfloat texY_range = 1.F; // texture <t> coordinate
+
+ // Set up for stretching or tiling
+ GLfloat x_offset, y_offset;
+ if ( myBgTexture.Style == Aspect_FM_CENTERED )
+ {
+ x_offset = (GLfloat)myBgTexture.Width / (GLfloat)aViewWidth;
+ y_offset = (GLfloat)myBgTexture.Height / (GLfloat)aViewHeight;
+ }
+ else
+ {
+ x_offset = 1.F;
+ y_offset = 1.F;
+ if ( myBgTexture.Style == Aspect_FM_TILED )
+ {
+ texX_range = (GLfloat)aViewWidth / (GLfloat)myBgTexture.Width;
+ texY_range = (GLfloat)aViewHeight / (GLfloat)myBgTexture.Height;
+ }
+ }
+
+ glEnable( GL_TEXTURE_2D ); //push GL_ENABLE_BIT
+ glBindTexture( GL_TEXTURE_2D, myBgTexture.TexId ); //push GL_TEXTURE_BIT
+
+ glDisable( GL_BLEND ); //push GL_ENABLE_BIT
+
+ glColor3fv( AWorkspace->BackgroundColor().rgb );
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); //push GL_TEXTURE_BIT
+
+ glBegin( GL_QUADS );
+ glTexCoord2f(0.F, 0.F); glVertex2f( -x_offset, -y_offset );
+ glTexCoord2f(texX_range, 0.F); glVertex2f( x_offset, -y_offset );
+ glTexCoord2f(texX_range, texY_range); glVertex2f( x_offset, y_offset );
+ glTexCoord2f(0.F, texY_range); glVertex2f( -x_offset, y_offset );
+ glEnd();
+ }
+ else //if( myBgGradient.type != Aspect_GFM_NONE )
+ {
+ Tfloat* corner1 = 0;/* -1,-1*/
+ Tfloat* corner2 = 0;/* 1,-1*/
+ Tfloat* corner3 = 0;/* 1, 1*/
+ Tfloat* corner4 = 0;/* -1, 1*/
+ Tfloat dcorner1[3];
+ Tfloat dcorner2[3];
+
+ switch( myBgGradient.type )
+ {
+ case Aspect_GFM_HOR:
+ corner1 = myBgGradient.color2.rgb;
+ corner2 = myBgGradient.color2.rgb;
+ corner3 = myBgGradient.color1.rgb;
+ corner4 = myBgGradient.color1.rgb;
+ break;
+ case Aspect_GFM_VER:
+ corner1 = myBgGradient.color2.rgb;
+ corner2 = myBgGradient.color1.rgb;
+ corner3 = myBgGradient.color1.rgb;
+ corner4 = myBgGradient.color2.rgb;
+ break;
+ case Aspect_GFM_DIAG1:
+ corner2 = myBgGradient.color2.rgb;
+ corner4 = myBgGradient.color1.rgb;
+ dcorner1 [0] = dcorner2[0] = 0.5F * (corner2[0] + corner4[0]);
+ dcorner1 [1] = dcorner2[1] = 0.5F * (corner2[1] + corner4[1]);
+ dcorner1 [2] = dcorner2[2] = 0.5F * (corner2[2] + corner4[2]);
+ corner1 = dcorner1;
+ corner3 = dcorner2;
+ break;
+ case Aspect_GFM_DIAG2:
+ corner1 = myBgGradient.color2.rgb;
+ corner3 = myBgGradient.color1.rgb;
+ dcorner1 [0] = dcorner2[0] = 0.5F * (corner1[0] + corner3[0]);
+ dcorner1 [1] = dcorner2[1] = 0.5F * (corner1[1] + corner3[1]);
+ dcorner1 [2] = dcorner2[2] = 0.5F * (corner1[2] + corner3[2]);
+ corner2 = dcorner1;
+ corner4 = dcorner2;
+ break;
+ case Aspect_GFM_CORNER1:
+ corner1 = myBgGradient.color1.rgb;
+ corner2 = myBgGradient.color2.rgb;
+ corner3 = myBgGradient.color2.rgb;
+ corner4 = myBgGradient.color2.rgb;
+ break;
+ case Aspect_GFM_CORNER2:
+ corner1 = myBgGradient.color2.rgb;
+ corner2 = myBgGradient.color1.rgb;
+ corner3 = myBgGradient.color2.rgb;
+ corner4 = myBgGradient.color2.rgb;
+ break;
+ case Aspect_GFM_CORNER3:
+ corner1 = myBgGradient.color2.rgb;
+ corner2 = myBgGradient.color2.rgb;
+ corner3 = myBgGradient.color1.rgb;
+ corner4 = myBgGradient.color2.rgb;
+ break;
+ case Aspect_GFM_CORNER4:
+ corner1 = myBgGradient.color2.rgb;
+ corner2 = myBgGradient.color2.rgb;
+ corner3 = myBgGradient.color2.rgb;
+ corner4 = myBgGradient.color1.rgb;
+ break;
+ default:
+ //printf("gradient background type not right\n");
+ break;
+ }
+
+ // Save GL parameters
+ glDisable( GL_LIGHTING ); //push GL_ENABLE_BIT
+
+ GLint curSM;
+ glGetIntegerv( GL_SHADE_MODEL, &curSM );
+ if ( curSM != GL_SMOOTH )
+ glShadeModel( GL_SMOOTH ); //push GL_LIGHTING_BIT
+
+ glBegin(GL_TRIANGLE_FAN);
+ if( myBgGradient.type != Aspect_GFM_CORNER2 && myBgGradient.type != Aspect_GFM_CORNER4 )
+ {
+ glColor3f(corner1[0],corner1[1],corner1[2]); glVertex2f(-1.,-1.);
+ glColor3f(corner2[0],corner2[1],corner2[2]); glVertex2f( 1.,-1.);
+ glColor3f(corner3[0],corner3[1],corner3[2]); glVertex2f( 1., 1.);
+ glColor3f(corner4[0],corner4[1],corner4[2]); glVertex2f(-1., 1.);
+ }
+ else //if ( myBgGradient.type == Aspect_GFM_CORNER2 || myBgGradient.type == Aspect_GFM_CORNER4 )
+ {
+ glColor3f(corner2[0],corner2[1],corner2[2]); glVertex2f( 1.,-1.);
+ glColor3f(corner3[0],corner3[1],corner3[2]); glVertex2f( 1., 1.);
+ glColor3f(corner4[0],corner4[1],corner4[2]); glVertex2f(-1., 1.);
+ glColor3f(corner1[0],corner1[1],corner1[2]); glVertex2f(-1.,-1.);
+ }
+ glEnd();
+
+ // Restore GL parameters
+ if ( curSM != GL_SMOOTH )
+ glShadeModel( curSM );
+ }
+
+ glPopMatrix();
+ glMatrixMode( GL_PROJECTION );
+ glPopMatrix();
+ glMatrixMode( GL_MODELVIEW );
+
+ glPopAttrib(); //GL_ENABLE_BIT | GL_TEXTURE_BIT
+
+ if ( AWorkspace->UseZBuffer() )
+ glEnable( GL_DEPTH_TEST );
+
+ /* GL_DITHER on/off pour le trace */
+ if (AWorkspace->Dither())
+ glEnable (GL_DITHER);
+ else
+ glDisable (GL_DITHER);
+ }
+
+ // Switch off lighting by default
+ glDisable(GL_LIGHTING);
+
+ /////////////////////////////////////////////////////////////////////////////
+ // Step 2: Draw underlayer
+ RedrawLayer2d(AWorkspace, ACView, ACUnderLayer);
+
+ /////////////////////////////////////////////////////////////////////////////
+ // Step 3: Redraw main plane
+
+ // Setup face culling
+ GLboolean isCullFace = GL_FALSE;
+ if ( myBackfacing )
+ {
+ isCullFace = glIsEnabled( GL_CULL_FACE );
+ if ( myBackfacing < 0 )
+ {
+ glEnable( GL_CULL_FACE );
+ glCullFace( GL_BACK );
+ }
+ else
+ glDisable( GL_CULL_FACE );
+ }
+
+ //TsmPushAttri(); /* save previous graphics context */
+
+ // if the view is scaled normal vectors are scaled to unit length for correct displaying of shaded objects
+ if(myExtra.scaleFactors[0] != 1.F ||
+ myExtra.scaleFactors[1] != 1.F ||
+ myExtra.scaleFactors[2] != 1.F)
+ glEnable(GL_NORMALIZE);
+ else if(glIsEnabled(GL_NORMALIZE))
+ glDisable(GL_NORMALIZE);
+
+ // Apply View Projection
+ // This routine activates the Projection matrix for a view.
+
+ glMatrixMode( GL_PROJECTION );
+
+#ifdef WNT
+ // add printing scale/tiling transformation
+ OpenGl_PrinterContext* aPrinterContext = OpenGl_PrinterContext::GetPrinterContext(AWorkspace->GetGContext());
+
+ if (aPrinterContext)
+ {
+ GLfloat aProjMatrix[16];
+ aPrinterContext->GetProjTransformation(aProjMatrix);
+ glLoadMatrixf((GLfloat*) aProjMatrix);
+ }
+ else
+#endif
+ glLoadIdentity();
+
+ glMultMatrixf( (const GLfloat *) myMappingMatrix );
+
+ // Add translation necessary for the environnement mapping
+ if (mySurfaceDetail != Visual3d_TOD_NONE)
+ {
+ // OCC280: FitAll work incorrect for perspective view if the SurfaceDetail mode is V3d_TEX_ENVIRONMENT or V3d_TEX_ALL
+ // const GLfloat dep = vptr->vrep.extra.map.fpd * 0.5F;
+ const GLfloat dep = (myExtra.map.fpd + myExtra.map.bpd) * 0.5F;
+ glTranslatef(-dep*myExtra.vpn[0],-dep*myExtra.vpn[1],-dep*myExtra.vpn[2]);
+ }
+
+ // Apply matrix
+ AWorkspace->SetViewMatrix((const OpenGl_Matrix *)myOrientationMatrix);
+
+/*
+While drawing after a clipplane has been defined and enabled, each vertex
+is transformed to eye-coordinates, where it is dotted with the transformed
+clipping plane equation. Eye-coordinate vertexes whose dot product with
+the transformed clipping plane equation is positive or zero are in, and
+require no clipping. Those eye-coordinate vertexes whose dot product is
+negative are clipped. Because clipplane clipping is done in eye-
+coordinates, changes to the projection matrix have no effect on its
+operation.
+
+A point and a normal are converted to a plane equation in the following manner:
+
+point = [Px,Py,Pz]
+
+normal = |Nx|
+|Ny|
+|Nz|
+
+plane equation = |A|
+|B|
+|C|
+|D|
+A = Nx
+B = Ny
+C = Nz
+D = -[Px,Py,Pz] dot |Nx|
+|Ny|
+|Nz|
+
+*/
+
+ glPushAttrib( GL_FOG_BIT | GL_LIGHTING_BIT );
+
+ // Apply Fog
+ if ( myFog.IsOn )
+ {
+ const GLfloat ramp = myExtra.map.fpd - myExtra.map.bpd;
+ const GLfloat fog_start = myFog.Front * ramp - myExtra.map.fpd;
+ const GLfloat fog_end = myFog.Back * ramp - myExtra.map.fpd;
+
+ glFogi(GL_FOG_MODE, GL_LINEAR);
+ glFogf(GL_FOG_START, fog_start);
+ glFogf(GL_FOG_END, fog_end);
+ glFogfv(GL_FOG_COLOR, myFog.Color.rgb);
+ glEnable(GL_FOG);
+ }
+ else
+ glDisable(GL_FOG);
+
+ // Apply Lights
+ {
+ int i;
+
+ // Switch off all lights
+ for (i = GL_LIGHT0; i <= GL_LIGHT7; i++)
+ glDisable(i);
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, default_amb);
+
+ /* set les lights */
+ int gl_lid = GL_LIGHT0;
+ OpenGl_ListOfLight::Iterator itl(myLights);
+ for (; itl.More(); itl.Next())
+ {
+ const OpenGl_Light &alight = itl.Value();
+ bind_light(&alight, &gl_lid);
+ }
+
+ if (gl_lid != GL_LIGHT0) glEnable(GL_LIGHTING);
+ }
+
+ // Apply InteriorShadingMethod
+ glShadeModel( myIntShadingMethod == TEL_SM_FLAT ? GL_FLAT : GL_SMOOTH );
+
+ // Apply clipping planes
+ {
+ // Define starting plane id
+ planeid = GL_CLIP_PLANE0;
+
+ GLdouble equation[4];
+
+ if ( myZClip.Back.IsOn || myZClip.Front.IsOn )
+ {
+ // Apply front and back clipping planes
+ GLfloat mat[4][4];
+ glMatrixMode( GL_MODELVIEW );
+ glGetFloatv( GL_MODELVIEW_MATRIX,(GLfloat *) mat );
+ glLoadIdentity();
+
+ const GLdouble ramp = myExtra.map.fpd - myExtra.map.bpd;
+
+ if ( myZClip.Back.IsOn )
+ {
+ const GLdouble back = ramp * myZClip.Back.Limit + myExtra.map.bpd;
+ equation[0] = 0.0; /* Nx */
+ equation[1] = 0.0; /* Ny */
+ equation[2] = 1.0; /* Nz */
+ equation[3] = -back; /* P dot N */
+ glClipPlane( planeid, equation );
+ glEnable( planeid );
+ planeid++;
+ }
+
+ if ( myZClip.Front.IsOn )
+ {
+ const GLdouble front = ramp * myZClip.Front.Limit + myExtra.map.bpd;
+ equation[0] = 0.0; /* Nx */
+ equation[1] = 0.0; /* Ny */
+ equation[2] = -1.0; /* Nz */
+ equation[3] = front; /* P dot N */
+ glClipPlane( planeid, equation );
+ glEnable( planeid );
+ planeid++;
+ }
+
+ glLoadMatrixf( (GLfloat *) mat );
+ }
+
+ // Apply user clipping planes
+ NCollection_List<OPENGL_CLIP_REP>::Iterator planeIter(myClippingPlanes);
+ for ( ; planeIter.More(); planeIter.Next() )
+ {
+ glClipPlane( planeid, planeIter.Value().equation );
+ glEnable( planeid );
+ planeid++;
+ }
+ }
+
+ // Apply AntiAliasing
+ {
+ if (myAntiAliasing)
+ AWorkspace->NamedStatus |= OPENGL_NS_ANTIALIASING;
+ else
+ AWorkspace->NamedStatus &= ~OPENGL_NS_ANTIALIASING;
+ }
+
+ Standard_Boolean isAnimationListOpen = Standard_False;
+
+ // Request for update of animation mode?
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_UPDATEAM) != 0 )
+ {
+ // Request to rebuild display list
+ myAnimationListReady = Standard_False;
+ // Reset request for update of animation mode
+ AWorkspace->NamedStatus &= ~OPENGL_NS_UPDATEAM;
+ }
+
+ // Is in animation mode?
+ if ( AWorkspace->NamedStatus & OPENGL_NS_ANIMATION )
+ {
+ // Is the animation list ready?
+ if (myAnimationListReady)
+ {
+ // Execute the animation list
+ glCallList(myAnimationListIndex);
+ }
+ else
+ {
+ // Update the animation list
+ if ( AWorkspace->NamedStatus & OPENGL_NS_FLIST )
+ {
+ if (myAnimationListIndex == 0)
+ myAnimationListIndex = glGenLists(1);
+
+ if (myAnimationListIndex != 0)
+ {
+ glNewList(myAnimationListIndex, GL_COMPILE_AND_EXECUTE);
+ isAnimationListOpen = Standard_True;
+ }
+ }
+ else
+ AWorkspace->NamedStatus |= OPENGL_NS_FLIST;
+ }
+ }
+ else
+ myAnimationListReady = Standard_False;
+
+ if (!myAnimationListReady)
+ {
+ // Clear status bitfields
+ AWorkspace->NamedStatus &= ~(OPENGL_NS_2NDPASSNEED | OPENGL_NS_2NDPASSDO);
+
+ // Added PCT for handling of textures
+ switch (mySurfaceDetail)
+ {
+ case Visual3d_TOD_NONE:
+ AWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
+ DisableTexture();
+ // Render the view
+ RenderStructs(AWorkspace);
+ break;
+
+ case Visual3d_TOD_ENVIRONMENT:
+ AWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
+ SetCurrentTexture(myTextureEnv);
+ EnableTexture();
+ // Render the view
+ RenderStructs(AWorkspace);
+ DisableTexture();
+ break;
+
+ case Visual3d_TOD_ALL:
+ // First pass
+ AWorkspace->NamedStatus &= ~OPENGL_NS_FORBIDSETTEX;
+ // Render the view
+ RenderStructs(AWorkspace);
+ DisableTexture();
+
+ // Second pass
+ if (AWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED)
+ {
+ AWorkspace->NamedStatus |= OPENGL_NS_2NDPASSDO;
+ SetCurrentTexture(myTextureEnv);
+ EnableTexture();
+
+ /* sauvegarde de quelques parametres OpenGL */
+ GLint blend_dst, blend_src;
+ GLint zbuff_f;
+ GLboolean zbuff_w;
+ glGetBooleanv(GL_DEPTH_WRITEMASK, &zbuff_w);
+ glGetIntegerv(GL_DEPTH_FUNC, &zbuff_f);
+ glGetIntegerv(GL_BLEND_DST, &blend_dst);
+ glGetIntegerv(GL_BLEND_SRC, &blend_src);
+ GLboolean zbuff_state = glIsEnabled(GL_DEPTH_TEST);
+ GLboolean blend_state = glIsEnabled(GL_BLEND);
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+
+ glDepthFunc(GL_EQUAL);
+ glDepthMask(GL_FALSE);
+ glEnable(GL_DEPTH_TEST);
+
+ AWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
+
+ // Render the view
+ RenderStructs(AWorkspace);
+ DisableTexture();
+
+ /* restauration des parametres OpenGL */
+ glBlendFunc(blend_src, blend_dst);
+ if (!blend_state) glDisable(GL_BLEND);
+
+ glDepthFunc(zbuff_f);
+ glDepthMask(zbuff_w);
+ if (!zbuff_state) glDisable(GL_DEPTH_FUNC);
+ }
+ break;
+ }
+
+ if (isAnimationListOpen)
+ {
+ glEndList();
+ myAnimationListReady = Standard_True;
+ }
+ }
+
+ /* restore previous graphics context; before update lights */
+ //TsmPopAttri();
+
+ // Disable current clipping planes
+ for ( planeid = GL_CLIP_PLANE0; planeid < lastid; planeid++ )
+ glDisable( planeid );
+
+ /* affichage de Triedre Non Zoomable de la vue s'il existe */
+ if (!myTrihedron.IsNull())
+ myTrihedron->Render(AWorkspace);
+ if (!myGraduatedTrihedron.IsNull())
+ myGraduatedTrihedron->Render(AWorkspace);
+
+ glPopAttrib(); // GL_FOG_BIT | GL_LIGHTING_BIT
+
+ // Restore face culling
+ if ( myBackfacing )
+ {
+ if ( isCullFace )
+ {
+ glEnable ( GL_CULL_FACE );
+ glCullFace ( GL_BACK );
+ }
+ else
+ glDisable ( GL_CULL_FACE );
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+ // Step 6: Draw overlayer
+ // Redrawing to bitmap or window?
+ const int amode = (AWorkspace->NamedStatus & OPENGL_NS_ISBITMAP)? OCC_REDRAW_BITMAP : OCC_REDRAW_WINDOW;
+
+ AWorkspace->DisplayCallback(ACView,(amode | OCC_PRE_OVERLAY));
+
+ RedrawLayer2d(AWorkspace, ACView, ACOverLayer);
+
+ AWorkspace->DisplayCallback(ACView,amode);
+
+ // Restore clipping planes
+ for ( ptrPlane = oldPlanes, planeid = GL_CLIP_PLANE0; planeid < lastid; planeid++, ptrPlane++ )
+ {
+ glClipPlane( planeid, ptrPlane->Equation );
+ if ( ptrPlane->isEnabled )
+ glEnable( planeid );
+ else
+ glDisable( planeid );
+ }
+ delete[] oldPlanes;
+}
+
+/*----------------------------------------------------------------------*/
+
+//ExecuteViewDisplay
+void OpenGl_View::RenderStructs (const Handle(OpenGl_Workspace) &AWorkspace)
+{
+ if ( myStructures.NbStructures() <= 0 ) return;
+
+ glPushAttrib ( GL_DEPTH_BUFFER_BIT );
+
+ const OpenGl_AspectLine *aspect_line = AWorkspace->AspectLine( Standard_True );
+
+ //TsmPushAttri(); /* save previous graphics context */
+
+ if ( (AWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED) == 0 )
+ {
+ const int antiAliasingMode = AWorkspace->GetDisplay()->AntiAliasingMode();
+
+ if ( !myAntiAliasing )
+ {
+ glDisable(GL_POINT_SMOOTH);
+ glDisable(GL_LINE_SMOOTH);
+ if( antiAliasingMode & 2 ) glDisable(GL_POLYGON_SMOOTH);
+ glBlendFunc (GL_ONE, GL_ZERO);
+ glDisable (GL_BLEND);
+ }
+ else
+ {
+ glEnable(GL_POINT_SMOOTH);
+ glEnable(GL_LINE_SMOOTH);
+ if( antiAliasingMode & 2 ) glEnable(GL_POLYGON_SMOOTH);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable (GL_BLEND);
+ }
+ }
+
+ myStructures.Render(AWorkspace);
+
+ //TsmPopAttri(); /* restore previous graphics context; before update lights */
+
+ if ( AWorkspace->DegenerateModel > 1 )
+ {
+ glLineWidth ( aspect_line->Width() );
+ if ( aspect_line->Type() != Aspect_TOL_SOLID ) glEnable ( GL_LINE_STIPPLE );
+ }
+
+ glPopAttrib ();
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_redraw_layer2d
+void OpenGl_View::RedrawLayer2d (const Handle(OpenGl_Workspace) &AWorkspace, const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACLayer)
+{
+ if (&ACLayer == NULL
+ || ACLayer.ptrLayer == NULL
+ || ACLayer.ptrLayer->listIndex == 0) return;
+
+ GLsizei dispWidth, dispHeight;
+ if ( ACView.DefBitmap.bitmap ) {
+ dispWidth = ACView.DefBitmap.width;
+ dispHeight = ACView.DefBitmap.height;
+ }
+ else {
+ dispWidth = (GLsizei) ACLayer.viewport[0];
+ dispHeight = (GLsizei) ACLayer.viewport[1];
+ }
+
+ const GLboolean isl = glIsEnabled(GL_LIGHTING); /*OCC6247*/
+ if (isl)
+ glDisable(GL_LIGHTING); /*OCC6247*/
+
+ /*
+ * On positionne la projection
+ */
+ glMatrixMode( GL_MODELVIEW );
+ glPushMatrix ();
+ glLoadIdentity ();
+
+ glMatrixMode (GL_PROJECTION);
+ glPushMatrix ();
+ glLoadIdentity ();
+
+ if (!ACLayer.sizeDependent)
+ glViewport (0, 0, dispWidth, dispHeight);
+
+ float left = ACLayer.ortho[0];
+ float right = ACLayer.ortho[1];
+ float bottom = ACLayer.ortho[2];
+ float top = ACLayer.ortho[3];
+
+ int attach = ACLayer.attach;
+
+ float ratio;
+ if (!ACLayer.sizeDependent)
+ ratio = (float) dispWidth/dispHeight;
+ else
+ ratio = ACView.DefWindow.dx/ACView.DefWindow.dy;
+
+ float delta;
+ if (ratio >= 1.0) { /* fenetre horizontale */
+ delta = (float )((top - bottom)/2.0);
+ switch (attach) {
+ case 0: /* Aspect_TOC_BOTTOM_LEFT */
+ top = bottom + 2*delta/ratio;
+ break;
+ case 1: /* Aspect_TOC_BOTTOM_RIGHT */
+ top = bottom + 2*delta/ratio;
+ break;
+ case 2: /* Aspect_TOC_TOP_LEFT */
+ bottom = top - 2*delta/ratio;
+ break;
+ case 3: /* Aspect_TOC_TOP_RIGHT */
+ bottom = top - 2*delta/ratio;
+ break;
+ }
+ }
+ else { /* fenetre verticale */
+ delta = (float )((right - left)/2.0);
+ switch (attach) {
+ case 0: /* Aspect_TOC_BOTTOM_LEFT */
+ right = left + 2*delta*ratio;
+ break;
+ case 1: /* Aspect_TOC_BOTTOM_RIGHT */
+ left = right - 2*delta*ratio;
+ break;
+ case 2: /* Aspect_TOC_TOP_LEFT */
+ right = left + 2*delta*ratio;
+ break;
+ case 3: /* Aspect_TOC_TOP_RIGHT */
+ left = right - 2*delta*ratio;
+ break;
+ }
+ }
+
+#ifdef WNT
+ // Check printer context that exists only for print operation
+ OpenGl_PrinterContext* aPrinterContext = OpenGl_PrinterContext::GetPrinterContext (AWorkspace->GetGContext());
+
+ if (aPrinterContext)
+ {
+ // additional transformation matrix could be applied to
+ // render only those parts of viewport that will be
+ // passed to a printer as a current "frame" to provide
+ // tiling; scaling of graphics by matrix helps render a
+ // part of a view (frame) in same viewport, but with higher
+ // resolution
+ GLfloat aProjMatrix[16];
+ aPrinterContext->GetProjTransformation (aProjMatrix);
+ glLoadMatrixf ((GLfloat*) aProjMatrix);
+
+ // printing operation also assumes other viewport dimension
+ // to comply with transformation matrix or graphics scaling
+ // factors for tiling for layer redraw
+ GLsizei anViewportX = 0;
+ GLsizei anViewportY = 0;
+ aPrinterContext->GetLayerViewport (anViewportX, anViewportY);
+ if (anViewportX != 0 && anViewportY != 0)
+ glViewport (0, 0, anViewportX, anViewportY);
+ }
+#endif
+
+ glOrtho (left, right, bottom, top, -1.0, 1.0);
+
+ /*
+ * On trace la display-list associee au layer.
+ */
+ glPushAttrib (
+ GL_LIGHTING_BIT | GL_LINE_BIT | GL_POLYGON_BIT |
+ GL_DEPTH_BUFFER_BIT | GL_CURRENT_BIT | GL_TEXTURE_BIT );
+ glDisable (GL_DEPTH_TEST);
+ glCallList (ACLayer.ptrLayer->listIndex);
+
+ //calling dynamic render of LayerItems
+ if ( ACLayer.ptrLayer->layerData )
+ {
+ InitLayerProp(ACLayer.ptrLayer->listIndex);
+ ((Visual3d_Layer*)ACLayer.ptrLayer->layerData)->RenderLayerItems();
+ InitLayerProp(0);
+ }
+
+ glPopAttrib ();
+
+ /*
+ * On retire la projection
+ */
+ glMatrixMode (GL_PROJECTION);
+ glPopMatrix ();
+
+ glMatrixMode( GL_MODELVIEW );
+ glPopMatrix ();
+
+ /*
+ * Restauration du Viewport en cas de modification
+ */
+ if (!ACLayer.sizeDependent)
+ glViewport (0, 0, (GLsizei) ACView.DefWindow.dx, (GLsizei) ACView.DefWindow.dy);
+
+ glFlush ();
+
+ if (isl)
+ glEnable(GL_LIGHTING); /*OCC6247*/
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_create_bg_texture
+void OpenGl_View::CreateBackgroundTexture (const Standard_CString AFileName, const Aspect_FillMethod AFillStyle)
+{
+ // Delete existing texture
+ if ( myBgTexture.TexId != 0 )
+ {
+ glDeleteTextures( 1, (GLuint*)&(myBgTexture.TexId) );
+ myBgTexture.TexId = 0;
+ }
+
+ Standard_Integer width, height;
+ Handle(Image_Image) image;
+ if ( AlienImage::LoadImageFile( AFileName, image, width, height ) )
+ {
+ const int nbbytes = width * height * 3;
+ GLubyte *data = new GLubyte[nbbytes];
+ GLubyte *pdata = data;
+ Standard_Integer i, j;
+ for ( j = height - 1; j >= 0; j-- )
+ for ( i = 0; i < width; i++ )
+ {
+ const Quantity_Color &color = image->PixelColor( i, j );
+ *pdata++ = (GLubyte)( 255 * color.Red() );
+ *pdata++ = (GLubyte)( 255 * color.Green() );
+ *pdata++ = (GLubyte)( 255 * color.Blue() );
+ }
+
+ GLuint texture = 0;
+ glGenTextures( 1, &texture );
+ glBindTexture( GL_TEXTURE_2D, texture );
+
+ /* Create MipMapped Texture */
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+
+ gluBuild2DMipmaps( GL_TEXTURE_2D, 3/*4*/, width, height, GL_RGB, GL_UNSIGNED_BYTE, data );
+
+ delete[] data;
+
+ myBgTexture.TexId = texture;
+ myBgTexture.Width = width;
+ myBgTexture.Height = height;
+ switch ( AFillStyle )
+ {
+ case Aspect_FM_NONE :
+ myBgTexture.Style = Aspect_FM_CENTERED;
+ break;
+ default :
+ myBgTexture.Style = AFillStyle;
+ break;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_set_bg_texture_style
+void OpenGl_View::SetBackgroundTextureStyle (const Aspect_FillMethod AFillStyle)
+{
+ /* check if background texture is already created */
+ if ( myBgTexture.TexId != 0 )
+ {
+ switch ( AFillStyle )
+ {
+ case Aspect_FM_NONE :
+ myBgTexture.Style = Aspect_FM_CENTERED;
+ break;
+ default :
+ myBgTexture.Style = AFillStyle;
+ break;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_gradient_background
+void OpenGl_View::SetBackgroundGradient (const Quantity_Color& AColor1,
+ const Quantity_Color& AColor2,
+ const Aspect_GradientFillMethod AType)
+{
+ Standard_Real R,G,B;
+ AColor1.Values( R, G, B, Quantity_TOC_RGB );
+ myBgGradient.color1.rgb[0] = ( Tfloat )R;
+ myBgGradient.color1.rgb[1] = ( Tfloat )G;
+ myBgGradient.color1.rgb[2] = ( Tfloat )B;
+ myBgGradient.color1.rgb[3] = 0.F;
+
+ AColor2.Values( R, G, B, Quantity_TOC_RGB );
+ myBgGradient.color2.rgb[0] = ( Tfloat )R;
+ myBgGradient.color2.rgb[1] = ( Tfloat )G;
+ myBgGradient.color2.rgb[2] = ( Tfloat )B;
+ myBgGradient.color2.rgb[3] = 0.F;
+
+ myBgGradient.type = AType;
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_set_gradient_type
+void OpenGl_View::SetBackgroundGradientType (const Aspect_GradientFillMethod AType)
+{
+ // check if gradient background is already created
+ if ( myBgGradient.type != Aspect_GFM_NONE )
+ myBgGradient.type = AType;
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Window.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <InterfaceGraphic.hxx>
+
+#include <OpenGl_Window.hxx>
+
+#include <OpenGl_Context.hxx>
+#include <OpenGl_Display.hxx>
+#include <OpenGl_ResourceCleaner.hxx>
+#include <OpenGl_ResourceTexture.hxx>
+
+#include <Aspect_GraphicDeviceDefinitionError.hxx>
+#include <TCollection_AsciiString.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(OpenGl_Window,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Window,MMgt_TShared)
+
+namespace
+{
+ static const TEL_COLOUR THE_DEFAULT_BG_COLOR = { { 0.F, 0.F, 0.F, 1.F } };
+
+ static GLCONTEXT ThePreviousCtx = 0; // to share GL resources
+#if (!defined(_WIN32) && !defined(__WIN32__))
+ static GLXContext TheDeadGlxCtx; // Context to be destroyed
+ static Display* TheDeadGlxDpy; // Display associated with TheDeadGlxCtx
+#endif
+
+#if (defined(_WIN32) || defined(__WIN32__))
+ static int find_pixel_format (HDC hDC, PIXELFORMATDESCRIPTOR* pfd, const Standard_Boolean dbuff)
+ {
+ PIXELFORMATDESCRIPTOR pfd0;
+ memset (&pfd0, 0, sizeof (PIXELFORMATDESCRIPTOR));
+ pfd0.nSize = sizeof (PIXELFORMATDESCRIPTOR);
+ pfd0.nVersion = 1;
+ pfd0.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | (dbuff ? PFD_DOUBLEBUFFER : PFD_SUPPORT_GDI);
+ pfd0.iPixelType = PFD_TYPE_RGBA;
+ pfd0.iLayerType = PFD_MAIN_PLANE;
+
+ int iPixelFormat = 0;
+ int iGood = 0;
+ const int cBits[] = { 32, 24 };
+ const int dBits[] = { 32, 24, 16 };
+
+ int i, j;
+ for (i = 0; i < sizeof(dBits) / sizeof(int); i++)
+ {
+ pfd0.cDepthBits = dBits[i];
+ iGood = 0;
+ for (j = 0; j < sizeof(cBits) / sizeof(int); j++)
+ {
+ pfd0.cColorBits = cBits[j];
+ iPixelFormat = ChoosePixelFormat (hDC, &pfd0);
+ if (iPixelFormat)
+ {
+ pfd->cDepthBits = 0;
+ pfd->cColorBits = 0;
+ DescribePixelFormat (hDC, iPixelFormat, sizeof (PIXELFORMATDESCRIPTOR), pfd);
+ if (pfd->cColorBits >= cBits[j] && pfd->cDepthBits >= dBits[i])
+ break;
+ if (iGood == 0)
+ iGood = iPixelFormat;
+ }
+ }
+ if (j < sizeof(cBits) / sizeof(int))
+ break;
+ }
+
+ if (iPixelFormat == 0)
+ iPixelFormat = iGood;
+
+ return iPixelFormat;
+ }
+#else
+ static Bool WaitForNotify (Display* theDisp, XEvent* theEv, char* theArg)
+ {
+ return (theEv->type == MapNotify) && (theEv->xmap.window == (Window )theArg);
+ }
+#endif
+
+};
+
+// =======================================================================
+// function : OpenGl_Window
+// purpose :
+// =======================================================================
+OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
+ const CALL_DEF_WINDOW& theCWindow,
+ Aspect_RenderingContext theGContext)
+: myDisplay (theDisplay),
+ myWindow (0),
+ myGContext ((GLCONTEXT )theGContext),
+ myGlContext (new OpenGl_Context()),
+ myOwnGContext (theGContext == 0),
+#if (defined(_WIN32) || defined(__WIN32__))
+ myWindowDC (0),
+ mySysPalInUse (FALSE),
+#endif
+ myWidth ((Standard_Integer )theCWindow.dx),
+ myHeight ((Standard_Integer )theCWindow.dy),
+ myBgColor (THE_DEFAULT_BG_COLOR),
+ myDither (theDisplay->Dither()),
+ myBackDither (theDisplay->BackDither())
+{
+ myBgColor.rgb[0] = theCWindow.Background.r;
+ myBgColor.rgb[1] = theCWindow.Background.g;
+ myBgColor.rgb[2] = theCWindow.Background.b;
+
+ WINDOW aParent = (WINDOW )theCWindow.XWindow;
+ DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay();
+
+#if (!defined(_WIN32) && !defined(__WIN32__))
+ XWindowAttributes wattr;
+ XGetWindowAttributes (aDisp, aParent, &wattr);
+ const int scr = DefaultScreen (aDisp);
+
+ XVisualInfo* aVis = NULL;
+ {
+ unsigned long aVisInfoMask = VisualIDMask | VisualScreenMask;
+ XVisualInfo aVisInfo;
+ aVisInfo.visualid = wattr.visual->visualid;
+ aVisInfo.screen = scr;
+ int aNbItems;
+ aVis = XGetVisualInfo (aDisp, aVisInfoMask, &aVisInfo, &aNbItems);
+ }
+
+ WINDOW win;
+
+ if (!myOwnGContext)
+ {
+ if (aVis != NULL)
+ {
+ Aspect_GraphicDeviceDefinitionError::Raise ("OpenGl_Window::CreateWindow: XGetVisualInfo failed.");
+ return;
+ }
+
+ win = aParent;
+ }
+ else
+ {
+ GLCONTEXT ctx;
+
+ #if defined(__linux) || defined(Linux)
+ if (aVis != NULL)
+ {
+ // check Visual for OpenGl context's parameters compability
+ int isGl = 0, isDoubleBuffer = 0, isRGBA = 0, aDepthSize = 0;
+
+ if (glXGetConfig (aDisp, aVis, GLX_USE_GL, &isGl) != 0)
+ isGl = 0;
+
+ if (glXGetConfig (aDisp, aVis, GLX_RGBA, &isRGBA) != 0)
+ isRGBA = 0;
+
+ if (glXGetConfig (aDisp, aVis, GLX_DOUBLEBUFFER, &isDoubleBuffer) != 0)
+ isDoubleBuffer = 0;
+
+ if (glXGetConfig (aDisp, aVis, GLX_DEPTH_SIZE, &aDepthSize) != 0)
+ aDepthSize = 0;
+
+ if (!isGl || !aDepthSize || !isRGBA || (isDoubleBuffer ? 1 : 0) != (myDisplay->DBuffer()? 1 : 0))
+ {
+ XFree (aVis);
+ aVis = NULL;
+ }
+ }
+ #endif
+
+ if (aVis == NULL)
+ {
+ int anIter = 0;
+ int anAttribs[11];
+ anAttribs[anIter++] = GLX_RGBA;
+
+ anAttribs[anIter++] = GLX_DEPTH_SIZE;
+ anAttribs[anIter++] = 1;
+
+ anAttribs[anIter++] = GLX_RED_SIZE;
+ anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1;
+
+ anAttribs[anIter++] = GLX_GREEN_SIZE;
+ anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1;
+
+ anAttribs[anIter++] = GLX_BLUE_SIZE;
+ anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1;
+
+ if (myDisplay->DBuffer())
+ anAttribs[anIter++] = GLX_DOUBLEBUFFER;
+
+ anAttribs[anIter++] = None;
+
+ aVis = glXChooseVisual (aDisp, scr, anAttribs);
+ if (aVis == NULL)
+ {
+ Aspect_GraphicDeviceDefinitionError::Raise ("OpenGl_Window::CreateWindow: glXChooseVisual failed.");
+ return;
+ }
+ }
+
+ if (TheDeadGlxCtx)
+ {
+ // recover display lists from TheDeadGlxCtx, then destroy it
+ ctx = glXCreateContext (aDisp, aVis, TheDeadGlxCtx, GL_TRUE);
+
+ OpenGl_ResourceCleaner::GetInstance()->RemoveContext (TheDeadGlxCtx);
+ glXDestroyContext (TheDeadGlxDpy, TheDeadGlxCtx);
+
+ TheDeadGlxCtx = 0;
+ }
+ else if (ThePreviousCtx == 0)
+ {
+ ctx = glXCreateContext (aDisp, aVis, NULL, GL_TRUE);
+ }
+ else
+ {
+ // ctx est une copie du previous
+ ctx = glXCreateContext (aDisp, aVis, ThePreviousCtx, GL_TRUE);
+ }
+
+ if (!ctx)
+ {
+ Aspect_GraphicDeviceDefinitionError::Raise ("OpenGl_Window::CreateWindow: glXCreateContext failed.");
+ return;
+ }
+
+ OpenGl_ResourceCleaner::GetInstance()->AppendContext (ctx, true);
+
+ ThePreviousCtx = ctx;
+
+ Colormap cmap = XCreateColormap (aDisp, aParent, aVis->visual, AllocNone);
+
+ XColor color;
+ color.red = (unsigned short) (myBgColor.rgb[0] * 0xFFFF);
+ color.green = (unsigned short) (myBgColor.rgb[1] * 0xFFFF);
+ color.blue = (unsigned short) (myBgColor.rgb[2] * 0xFFFF);
+ color.flags = DoRed | DoGreen | DoBlue;
+ XAllocColor (aDisp, cmap, &color);
+
+ XSetWindowAttributes cwa;
+ cwa.colormap = cmap;
+ cwa.event_mask = StructureNotifyMask;
+ cwa.border_pixel = color.pixel;
+ cwa.background_pixel = color.pixel;
+
+ if (aVis->visualid == wattr.visual->visualid)
+ {
+ win = aParent;
+ }
+ else
+ {
+ unsigned long mask = CWBackPixel | CWColormap | CWBorderPixel | CWEventMask;
+ win = XCreateWindow (aDisp, aParent, 0, 0, myWidth, myHeight, 0/*bw*/, aVis->depth, InputOutput, aVis->visual, mask, &cwa);
+ }
+
+ XSetWindowBackground (aDisp, win, cwa.background_pixel);
+ XClearWindow (aDisp, win);
+
+ if (win != aParent)
+ {
+ XEvent anEvent;
+ XMapWindow (aDisp, win);
+ XIfEvent (aDisp, &anEvent, WaitForNotify, (char* )win);
+ }
+
+ myGContext = ctx;
+ }
+
+ /*
+ * Le BackDitherProp est utilise pour le clear du background
+ * Pour eviter une difference de couleurs avec la couleur choisie
+ * par l'application (XWindow) il faut desactiver le dithering
+ * au dessus de 8 plans.
+ *
+ * Pour le DitherProp:
+ * On cherchera a activer le Dithering que si le Visual a au moins
+ * 8 plans pour le GLX_RED_SIZE. Le test est plus sur car on peut
+ * avoir une profondeur superieure a 12 mais avoir besoin du dithering.
+ * (Carte Impact avec GLX_RED_SIZE a 5 par exemple)
+ */
+
+ int value;
+ glXGetConfig (aDisp, aVis, GLX_RED_SIZE, &value);
+
+ if (myDither)
+ myDither = (value < 8);
+
+ if (myBackDither)
+ myBackDither = (aVis->depth <= 8);
+
+ XFree ((char* )aVis);
+
+ myWindow = win;
+
+#else
+
+ myWindowDC = GetDC (aParent);
+
+ PIXELFORMATDESCRIPTOR pfd;
+ int iPixelFormat = find_pixel_format (myWindowDC, &pfd, myDisplay->DBuffer());
+ if (iPixelFormat == 0)
+ {
+ ReleaseDC (aParent, myWindowDC);
+ myWindowDC = 0;
+
+ TCollection_AsciiString msg ("OpenGl_Window::CreateWindow: ChoosePixelFormat failed. Error code: ");
+ msg += (int )GetLastError();
+ Aspect_GraphicDeviceDefinitionError::Raise (msg.ToCString());
+ return;
+ }
+
+ if (pfd.dwFlags & PFD_NEED_PALETTE)
+ {
+ WINDOW_DATA* wd = (WINDOW_DATA* )GetWindowLongPtr (aParent, GWLP_USERDATA);
+
+ mySysPalInUse = (pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE) ? TRUE : FALSE;
+ InterfaceGraphic_RealizePalette (myWindowDC, wd->hPal, FALSE, mySysPalInUse);
+ }
+
+ if (myDither)
+ myDither = (pfd.cColorBits <= 8);
+
+ if (myBackDither)
+ myBackDither = (pfd.cColorBits <= 8);
+
+ if (!SetPixelFormat (myWindowDC, iPixelFormat, &pfd))
+ {
+ ReleaseDC (aParent, myWindowDC);
+ myWindowDC = NULL;
+
+ TCollection_AsciiString msg("OpenGl_Window::CreateWindow: SetPixelFormat failed. Error code: ");
+ msg += (int)GetLastError();
+ Aspect_GraphicDeviceDefinitionError::Raise (msg.ToCString());
+ return;
+ }
+
+ if (!myOwnGContext)
+ {
+ ThePreviousCtx = myGContext;
+ }
+ else
+ {
+ myGContext = wglCreateContext (myWindowDC);
+ if (myGContext == NULL)
+ {
+ ReleaseDC (aParent, myWindowDC);
+ myWindowDC = NULL;
+
+ TCollection_AsciiString msg ("OpenGl_Window::CreateWindow: wglCreateContext failed. Error code: ");
+ msg += (int )GetLastError();
+ Aspect_GraphicDeviceDefinitionError::Raise (msg.ToCString());
+ return;
+ }
+
+ Standard_Boolean isShared = Standard_True;
+ if (ThePreviousCtx == NULL)
+ {
+ ThePreviousCtx = myGContext;
+ }
+ else
+ {
+ // if we already have some shared context
+ GLCONTEXT shareCtx = OpenGl_ResourceCleaner::GetInstance()->GetSharedContext();
+ if (shareCtx != NULL)
+ {
+ // try to share context with one from resource cleaner list
+ isShared = (Standard_Boolean )wglShareLists (shareCtx, myGContext);
+ }
+ else
+ {
+ isShared = (Standard_Boolean )wglShareLists (ThePreviousCtx, myGContext);
+ // add shared ThePreviousCtx to a control list if it's not there
+ if (isShared)
+ OpenGl_ResourceCleaner::GetInstance()->AppendContext (ThePreviousCtx, isShared);
+ }
+ }
+
+ // add the context to OpenGl_ResourceCleaner control list
+ OpenGl_ResourceCleaner::GetInstance()->AppendContext (myGContext, isShared);
+ }
+
+ myWindow = aParent;
+#endif
+
+ Init();
+ myGlContext->Init();
+}
+
+// =======================================================================
+// function : ~OpenGl_Window
+// purpose :
+// =======================================================================
+OpenGl_Window::~OpenGl_Window()
+{
+ DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay();
+ if (aDisp == NULL || !myOwnGContext)
+ return;
+
+#if (defined(_WIN32) || defined(__WIN32__))
+ OpenGl_ResourceCleaner::GetInstance()->RemoveContext (myGContext);
+
+ if (wglGetCurrentContext() != NULL)
+ wglDeleteContext (myGContext);
+ ReleaseDC (myWindow, myWindowDC);
+
+ if (myDisplay->myMapOfWindows.Size() == 0)
+ ThePreviousCtx = 0;
+#else
+ // FSXXX sync necessary if non-direct rendering
+ glXWaitGL();
+
+ if (ThePreviousCtx == myGContext)
+ {
+ ThePreviousCtx = NULL;
+ if (myDisplay->myMapOfWindows.Size() > 0)
+ {
+ NCollection_DataMap<Standard_Integer, Handle(OpenGl_Window)>::Iterator it (myDisplay->myMapOfWindows);
+ ThePreviousCtx = it.Value()->myGContext;
+ }
+
+ // if this is the last remaining context, do not destroy it yet, to avoid
+ // losing any shared display lists (fonts...)
+ if (ThePreviousCtx)
+ {
+ OpenGl_ResourceCleaner::GetInstance()->RemoveContext(myGContext);
+ glXDestroyContext(aDisp, myGContext);
+ }
+ else
+ {
+ TheDeadGlxCtx = myGContext;
+ TheDeadGlxDpy = aDisp;
+ }
+ }
+ else
+ {
+ OpenGl_ResourceCleaner::GetInstance()->RemoveContext (myGContext);
+ glXDestroyContext (aDisp, myGContext);
+ }
+#endif
+}
+
+// =======================================================================
+// function : Activate
+// purpose :
+// =======================================================================
+Standard_Boolean OpenGl_Window::Activate()
+{
+ DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay();
+ if (aDisp == NULL)
+ return Standard_False;
+
+#if (defined(_WIN32) || defined(__WIN32__))
+ if (!wglMakeCurrent (myWindowDC, myGContext))
+ {
+ //GLenum errorcode = glGetError();
+ //const GLubyte *errorstring = gluErrorString(errorcode);
+ //printf("wglMakeCurrent failed: %d %s\n", errorcode, errorstring);
+ return Standard_False;
+ }
+#else
+ if (!glXMakeCurrent (aDisp, myWindow, myGContext))
+ {
+ // if there is no current context it might be impossible to use glGetError correctly
+ //printf("glXMakeCurrent failed!\n");
+ return Standard_False;
+ }
+#endif
+
+ return Standard_True;
+}
+
+// =======================================================================
+// function : Resize
+// purpose : call_subr_resize
+// =======================================================================
+void OpenGl_Window::Resize (const CALL_DEF_WINDOW& theCWindow)
+{
+ DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay();
+ if (aDisp == NULL)
+ return;
+
+ // If the size is not changed - do nothing
+ if ((myWidth == theCWindow.dx) && (myHeight == theCWindow.dy))
+ return;
+
+ myWidth = (Standard_Integer )theCWindow.dx;
+ myHeight = (Standard_Integer )theCWindow.dy;
+
+#if (!defined(_WIN32) && !defined(__WIN32__))
+ XResizeWindow (aDisp, myWindow, (unsigned int )myWidth, (unsigned int )myHeight);
+ XSync (aDisp, False);
+#endif
+
+ Init();
+}
+
+// =======================================================================
+// function : ReadDepths
+// purpose : TelReadDepths
+// =======================================================================
+void OpenGl_Window::ReadDepths (const Standard_Integer theX, const Standard_Integer theY,
+ const Standard_Integer theWidth, const Standard_Integer theHeight,
+ float* theDepths)
+{
+ if (theDepths == NULL || !Activate())
+ return;
+
+ glMatrixMode (GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D (0.0, (GLdouble )myWidth, 0.0, (GLdouble )myHeight);
+ glMatrixMode (GL_MODELVIEW);
+ glLoadIdentity();
+
+ glRasterPos2i (theX, theY);
+ DisableFeatures();
+ glReadPixels (theX, theY, theWidth, theHeight, GL_DEPTH_COMPONENT, GL_FLOAT, theDepths);
+ EnableFeatures();
+}
+
+// =======================================================================
+// function : SetBackgroundColor
+// purpose : call_subr_set_background
+// =======================================================================
+void OpenGl_Window::SetBackgroundColor (const Standard_ShortReal theR,
+ const Standard_ShortReal theG,
+ const Standard_ShortReal theB)
+{
+ myBgColor.rgb[0] = theR;
+ myBgColor.rgb[1] = theG;
+ myBgColor.rgb[2] = theB;
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void OpenGl_Window::Init()
+{
+ if (!Activate())
+ return;
+
+#if (defined(_WIN32) || defined(__WIN32__))
+ RECT cr;
+ GetClientRect (myWindow, &cr);
+ myWidth = cr.right - cr.left;
+ myHeight = cr.bottom - cr.top;
+#else
+ Window aRootWin;
+ int aDummy;
+ unsigned int aDummyU;
+ unsigned int aNewWidth = 0;
+ unsigned int aNewHeight = 0;
+ DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay();
+ XGetGeometry (aDisp, myWindow, &aRootWin, &aDummy, &aDummy, &aNewWidth, &aNewHeight, &aDummyU, &aDummyU);
+ myWidth = aNewWidth;
+ myHeight = aNewHeight;
+#endif
+
+ glMatrixMode (GL_MODELVIEW);
+ glViewport (0, 0, myWidth, myHeight);
+
+ glDisable (GL_SCISSOR_TEST);
+ glDrawBuffer (GL_BACK);
+}
+
+// =======================================================================
+// function : EnablePolygonOffset
+// purpose : call_subr_enable_polygon_offset
+// =======================================================================
+void OpenGl_Window::EnablePolygonOffset() const
+{
+ Standard_ShortReal aFactor, aUnits;
+ myDisplay->PolygonOffset (aFactor, aUnits);
+ glPolygonOffset (aFactor, aUnits);
+ glEnable (GL_POLYGON_OFFSET_FILL);
+}
+
+// =======================================================================
+// function : DisablePolygonOffset
+// purpose : call_subr_disable_polygon_offset
+// =======================================================================
+void OpenGl_Window::DisablePolygonOffset() const
+{
+ glDisable (GL_POLYGON_OFFSET_FILL);
+}
+
+// =======================================================================
+// function : EnableFeatures
+// purpose :
+// =======================================================================
+void OpenGl_Window::EnableFeatures() const
+{
+ /*glPixelTransferi (GL_MAP_COLOR, GL_TRUE);*/
+
+ if (myDither)
+ glEnable (GL_DITHER);
+ else
+ glDisable (GL_DITHER);
+}
+
+// =======================================================================
+// function : DisableFeatures
+// purpose :
+// =======================================================================
+void OpenGl_Window::DisableFeatures() const
+{
+ glDisable (GL_DITHER);
+ glPixelTransferi (GL_MAP_COLOR, GL_FALSE);
+
+ /*
+ * Disable stuff that's likely to slow down glDrawPixels.
+ * (Omit as much of this as possible, when you know in advance
+ * that the OpenGL state will already be set correctly.)
+ */
+ glDisable(GL_ALPHA_TEST);
+ glDisable(GL_BLEND);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_FOG);
+ glDisable(GL_LIGHTING);
+
+ glDisable(GL_LOGIC_OP);
+ glDisable(GL_STENCIL_TEST);
+ glDisable(GL_TEXTURE_1D);
+ glDisable(GL_TEXTURE_2D);
+ glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
+ glPixelTransferi(GL_RED_SCALE, 1);
+ glPixelTransferi(GL_RED_BIAS, 0);
+ glPixelTransferi(GL_GREEN_SCALE, 1);
+ glPixelTransferi(GL_GREEN_BIAS, 0);
+ glPixelTransferi(GL_BLUE_SCALE, 1);
+ glPixelTransferi(GL_BLUE_BIAS, 0);
+ glPixelTransferi(GL_ALPHA_SCALE, 1);
+ glPixelTransferi(GL_ALPHA_BIAS, 0);
+
+ /*
+ * Disable extensions that could slow down glDrawPixels.
+ * (Actually, you should check for the presence of the proper
+ * extension before making these calls. I've omitted that
+ * code for simplicity.)
+ */
+
+#ifdef GL_EXT_convolution
+ glDisable(GL_CONVOLUTION_1D_EXT);
+ glDisable(GL_CONVOLUTION_2D_EXT);
+ glDisable(GL_SEPARABLE_2D_EXT);
+#endif
+
+#ifdef GL_EXT_histogram
+ glDisable(GL_HISTOGRAM_EXT);
+ glDisable(GL_MINMAX_EXT);
+#endif
+
+#ifdef GL_EXT_texture3D
+ glDisable(GL_TEXTURE_3D_EXT);
+#endif
+}
+
+// =======================================================================
+// function : MakeFrontBufCurrent
+// purpose : TelMakeFrontBufCurrent
+// =======================================================================
+void OpenGl_Window::MakeFrontBufCurrent() const
+{
+ glDrawBuffer (GL_FRONT);
+}
+
+// =======================================================================
+// function : MakeBackBufCurrent
+// purpose : TelMakeBackBufCurrent
+// =======================================================================
+void OpenGl_Window::MakeBackBufCurrent() const
+{
+ glDrawBuffer (GL_BACK);
+}
+
+// =======================================================================
+// function : MakeFrontAndBackBufCurrent
+// purpose : TelMakeFrontAndBackBufCurrent
+// =======================================================================
+void OpenGl_Window::MakeFrontAndBackBufCurrent() const
+{
+ glDrawBuffer (GL_FRONT_AND_BACK);
+}
--- /dev/null
+// File: OpenGl_Window.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_Window_Header
+#define _OpenGl_Window_Header
+
+#include <Handle_OpenGl_Window.hxx>
+#include <MMgt_TShared.hxx>
+
+#include <InterfaceGraphic.hxx>
+#include <InterfaceGraphic_Aspect.hxx>
+#include <InterfaceGraphic_telem.hxx>
+
+#include <Handle_OpenGl_Display.hxx>
+#include <Handle_OpenGl_Context.hxx>
+
+//! This class represents low-level wrapper over window with GL context.
+//! The window itself should be provided to constructor.
+class OpenGl_Window : public MMgt_TShared
+{
+public:
+
+ //! Main constructor - prepare GL context for specified window.
+ OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
+ const CALL_DEF_WINDOW& theCWindow,
+ Aspect_RenderingContext theGContext);
+
+ //! Destructor
+ virtual ~OpenGl_Window();
+
+ //! Resizes the window.
+ void Resize (const CALL_DEF_WINDOW& theCWindow);
+
+ //! Reads depth component for current scene into specified buffer.
+ void ReadDepths (const Standard_Integer theX, const Standard_Integer theY,
+ const Standard_Integer theWidth, const Standard_Integer theHeight,
+ float* theDepths);
+
+ void SetBackgroundColor (const Standard_ShortReal theR,
+ const Standard_ShortReal theG,
+ const Standard_ShortReal theB);
+
+ void EnablePolygonOffset() const;
+ void DisablePolygonOffset() const;
+
+ Standard_Integer Width() const { return myWidth; }
+ Standard_Integer Height() const { return myHeight; }
+ const TEL_COLOUR& BackgroundColor() const { return myBgColor; }
+ Standard_Boolean Dither() const { return myDither; }
+ Standard_Boolean BackDither() const { return myBackDither; }
+
+ const Handle(OpenGl_Display)& GetDisplay() const { return myDisplay; }
+
+ const Handle(OpenGl_Context)& GetGlContext() const { return myGlContext; }
+
+ WINDOW GetWindow() const { return myWindow; }
+ GLCONTEXT GetGContext() const { return myGContext; }
+
+protected:
+
+ //! Activates GL context and setup viewport.
+ void Init();
+
+ //! Makes GL context for this window active in current thread
+ virtual Standard_Boolean Activate();
+
+ void EnableFeatures() const;
+ void DisableFeatures() const;
+
+ //! Draw directly to the FRONT buffer. Can cause artifacts on the screen.
+ void MakeFrontBufCurrent() const;
+
+ //! Draw to BACK buffer. Normal and default state.
+ void MakeBackBufCurrent() const;
+
+ //! Draw simultaneously to BACK and FRONT buffers. Abnormal usage.
+ void MakeFrontAndBackBufCurrent() const;
+
+protected:
+
+ Handle(OpenGl_Display) myDisplay;
+ WINDOW myWindow; //!< native window handle, system-specific
+ Handle(OpenGl_Context) myGlContext;
+ GLCONTEXT myGContext; //!< native GL context bound to this window, system-specific
+ Standard_Boolean myOwnGContext; //!< set to TRUE if GL context was not created by this class
+#if (defined(_WIN32) || defined(__WIN32__))
+ HDC myWindowDC;
+ BOOL mySysPalInUse;
+#endif
+
+ Standard_Integer myWidth; // WSWidth
+ Standard_Integer myHeight; // WSHeight
+ TEL_COLOUR myBgColor; // WSBackground
+ Standard_Boolean myDither;
+ Standard_Boolean myBackDither;
+
+public:
+
+ DEFINE_STANDARD_RTTI(OpenGl_Window) // Type definition
+ IMPLEMENT_MEMORY_OPERATORS
+
+};
+
+#endif //_OpenGl_Window_Header
--- /dev/null
+// File: OpenGl_Workspace.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <InterfaceGraphic.hxx>
+
+#include <OpenGl_Workspace.hxx>
+
+#include <OpenGl_AspectLine.hxx>
+#include <OpenGl_AspectFace.hxx>
+#include <OpenGl_AspectMarker.hxx>
+#include <OpenGl_AspectText.hxx>
+
+#include <OpenGl_tgl_all.hxx>
+#include <OpenGl_TextureBox.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(OpenGl_Workspace,OpenGl_Window)
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Workspace,OpenGl_Window)
+
+namespace
+{
+ static const TEL_COLOUR myDefaultHighlightColor = { { 1.F, 1.F, 1.F, 1.F } };
+
+ static const OpenGl_AspectLine myDefaultAspectLine;
+ static const OpenGl_AspectFace myDefaultAspectFace;
+ static const OpenGl_AspectMarker myDefaultAspectMarker;
+ static const OpenGl_AspectText myDefaultAspectText;
+
+ static const OpenGl_TextParam myDefaultTextParam =
+ {
+ 16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM
+ };
+
+ static const OpenGl_Matrix myDefaultMatrix =
+ {
+ {{ 1.0F, 0.0F, 0.0F, 0.0F },
+ { 0.0F, 1.0F, 0.0F, 0.0F },
+ { 0.0F, 0.0F, 1.0F, 0.0F },
+ { 0.0F, 0.0F, 0.0F, 1.0F }}
+ };
+};
+
+// =======================================================================
+// function : OpenGl_Workspace
+// purpose :
+// =======================================================================
+OpenGl_Workspace::OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
+ const CALL_DEF_WINDOW& theCWindow,
+ Aspect_RenderingContext theGContext)
+: OpenGl_Window (theDisplay, theCWindow, theGContext),
+ myIsUpdated (Standard_False),
+ myTransientList (0),
+ myIsTransientOpen (Standard_False),
+ myRetainMode (Standard_False),
+ myUseTransparency (Standard_False),
+ myUseZBuffer (Standard_False),
+ myUseDepthTest (Standard_True),
+ myUseGLLight (Standard_True),
+ myBackBufferRestored (Standard_False),
+ //
+ NamedStatus (0),
+ DegenerateModel (0),
+ SkipRatio (0.F),
+ HighlightColor (&myDefaultHighlightColor),
+ AspectLine_set (&myDefaultAspectLine),
+ AspectLine_applied (NULL),
+ AspectFace_set (&myDefaultAspectFace),
+ AspectFace_applied (NULL),
+ AspectMarker_set (&myDefaultAspectMarker),
+ AspectMarker_applied (NULL),
+ AspectText_set (&myDefaultAspectText),
+ AspectText_applied (NULL),
+ TextParam_set (&myDefaultTextParam),
+ TextParam_applied (NULL),
+ ViewMatrix_applied (&myDefaultMatrix),
+ StructureMatrix_applied (&myDefaultMatrix),
+ PolygonOffset_applied (NULL)
+{
+ theDisplay->InitAttributes();
+
+ // General initialization of the context
+
+ // Eviter d'avoir les faces mal orientees en noir.
+ // Pourrait etre utiliser pour detecter les problemes d'orientation
+ glLightModeli ((GLenum )GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+
+ // Optimisation pour le Fog et l'antialiasing
+ glHint (GL_FOG_HINT, GL_FASTEST);
+ glHint (GL_POINT_SMOOTH_HINT, GL_FASTEST);
+ glHint (GL_LINE_SMOOTH_HINT, GL_FASTEST);
+ glHint (GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
+
+ // Polygon Offset
+ EnablePolygonOffset();
+}
+
+// =======================================================================
+// function : ~OpenGl_Workspace
+// purpose :
+// =======================================================================
+OpenGl_Workspace::~OpenGl_Workspace()
+{
+}
+
+// =======================================================================
+// function : Activate
+// purpose :
+// =======================================================================
+Standard_Boolean OpenGl_Workspace::Activate()
+{
+ if (!OpenGl_Window::Activate())
+ return Standard_False;
+
+ NamedStatus = IsTextureEnabled() ? OPENGL_NS_TEXTURE : 0;
+ DegenerateModel = 0;
+ SkipRatio = 0.0f;
+ HighlightColor = &myDefaultHighlightColor;
+ AspectLine_set = &myDefaultAspectLine;
+ AspectLine_applied = NULL;
+ AspectFace_set = &myDefaultAspectFace;
+ AspectFace_applied = NULL;
+ AspectMarker_set = &myDefaultAspectMarker;
+ AspectMarker_applied = NULL;
+ AspectText_set = &myDefaultAspectText;
+ AspectText_applied = NULL;
+ TextParam_set = &myDefaultTextParam;
+ TextParam_applied = NULL;
+ ViewMatrix_applied = &myDefaultMatrix;
+ StructureMatrix_applied = &myDefaultMatrix;
+ PolygonOffset_applied = NULL;
+ return Standard_True;
+}
+
+// =======================================================================
+// function : UseTransparency
+// purpose : call_togl_transparency
+// =======================================================================
+void OpenGl_Workspace::UseTransparency (const Standard_Boolean theFlag)
+{
+ if ((myUseTransparency ? 1 : 0) != (theFlag ? 1 : 0))
+ {
+ myUseTransparency = theFlag;
+ EraseAnimation();
+ myIsUpdated = Standard_False;
+ }
+}
--- /dev/null
+// File: OpenGl_Workspace.hxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#ifndef _OpenGl_Workspace_Header
+#define _OpenGl_Workspace_Header
+
+#include <Handle_OpenGl_Workspace.hxx>
+#include <OpenGl_Window.hxx>
+
+#include <TColStd_Array2OfReal.hxx>
+#include <Quantity_Color.hxx>
+#include <Graphic3d_TypeOfComposition.hxx>
+
+#include <Graphic3d_CView.hxx>
+#include <Aspect_CLayer2d.hxx>
+#include <Aspect_Handle.hxx>
+#include <Aspect_PrintAlgo.hxx>
+#include <Graphic3d_PtrFrameBuffer.hxx>
+#include <Image_CRawBufferData.hxx>
+
+#include <InterfaceGraphic_Graphic3d.hxx>
+#include <InterfaceGraphic_Visual3d.hxx>
+
+#include <OpenGl_tsm.hxx>
+
+#include <OpenGl_Display.hxx>
+#include <OpenGl_Matrix.hxx>
+#include <OpenGl_NamedStatus.hxx>
+#include <OpenGl_TextParam.hxx>
+
+#include <Handle_OpenGl_View.hxx>
+
+class OpenGl_AspectLine;
+class OpenGl_AspectFace;
+class OpenGl_AspectMarker;
+class OpenGl_AspectText;
+class OpenGl_FrameBuffer;
+class OpenGl_Structure;
+
+//! Reprepsents window with GL context.
+//! Provides methods to render primitives and maintan GL state.
+class OpenGl_Workspace : public OpenGl_Window
+{
+public:
+
+ //! Main constructor - prepare GL context for specified window.
+ OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
+ const CALL_DEF_WINDOW& theCWindow,
+ Aspect_RenderingContext theGContext);
+
+ //! Destructor
+ virtual ~OpenGl_Workspace();
+
+ void SetActiveView (const Handle(OpenGl_View)& theView) { myView = theView; }
+ const Handle(OpenGl_View)& ActiveView () const { return myView; }
+
+ //! Redraw the window.
+ void Redraw (const Graphic3d_CView& theCView,
+ const Aspect_CLayer2d& theCUnderLayer,
+ const Aspect_CLayer2d& theCOverLayer);
+
+ //! Redraw window only if needed.
+ void Update (const Graphic3d_CView& theCView,
+ const Aspect_CLayer2d& theCUnderLayer,
+ const Aspect_CLayer2d& theCOverLayer)
+ {
+ if (!myIsUpdated)
+ Redraw (theCView, theCUnderLayer, theCOverLayer);
+ }
+
+ //! Special method to perform printing.
+ //! System-specific and currently only Win platform implemented.
+ Standard_Boolean Print (const Graphic3d_CView& theCView,
+ const Aspect_CLayer2d& theCUnderLayer,
+ const Aspect_CLayer2d& theCOverLayer,
+ const Aspect_Handle theHPrintDC,
+ const Standard_Boolean theToShowBackground,
+ const Standard_CString theFileName,
+ const Aspect_PrintAlgo thePrintAlgorithm,
+ const Standard_Real theScaleFactor);
+
+ void DisplayCallback (const Graphic3d_CView& theCView, int theReason);
+
+ // szvgl: defined in OpenGl_Workspace_1.cxx
+ void BeginAnimation (const Standard_Boolean theUseDegeneration,
+ const Standard_Boolean theUpdateAM);
+ void EndAnimation();
+ void EraseAnimation();
+
+ Standard_Boolean BeginAddMode();
+ void EndAddMode();
+ void ClearImmediatMode (const Graphic3d_CView& theCView,
+ const Standard_Boolean theToFlush);
+ void RedrawImmediatMode();
+ Standard_Boolean BeginImmediatMode (const Graphic3d_CView& theCView,
+ const Standard_Boolean theUseDepthTest,
+ const Standard_Boolean theRetainMode);
+ void EndImmediatMode();
+ void Transform (const TColStd_Array2OfReal& theMatrix, const Graphic3d_TypeOfComposition theType);
+ void DrawStructure (const OpenGl_Structure* theStructure);
+ void BeginPolyline();
+ void EndPolyline();
+ void Draw (const Standard_ShortReal theX, const Standard_ShortReal theY, const Standard_ShortReal theZ);
+ void Move (const Standard_ShortReal theX, const Standard_ShortReal theY, const Standard_ShortReal theZ);
+ void SetLineColor (const Standard_ShortReal theR, const Standard_ShortReal theG, const Standard_ShortReal theB);
+ void SetLineType (const Standard_Integer theType);
+ void SetLineWidth (const Standard_ShortReal theWidth);
+ void SetMinMax (const Standard_ShortReal X1, const Standard_ShortReal Y1, const Standard_ShortReal Z1,
+ const Standard_ShortReal X2, const Standard_ShortReal Y2, const Standard_ShortReal Z2);
+
+ Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight);
+ void FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr);
+ Standard_Boolean BufferDump (OpenGl_FrameBuffer *theFBOPtr, Image_CRawBufferData& theBuffer);
+
+ //! Mark this window to be redrawn on next update.
+ void Invalidate() { myIsUpdated = Standard_False; }
+
+ void UseTransparency (const Standard_Boolean theFlag);
+ Standard_Boolean& UseZBuffer() { return myUseZBuffer; }
+ Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
+ Standard_Boolean& UseGLLight() { return myUseGLLight; }
+
+ //// RELATED TO STATUS ////
+
+ Standard_Integer NamedStatus;
+
+ Standard_Integer DegenerateModel;
+ Standard_ShortReal SkipRatio;
+
+ const TEL_COLOUR* HighlightColor;
+
+ const OpenGl_Matrix* SetViewMatrix (const OpenGl_Matrix* );
+ const OpenGl_Matrix* SetStructureMatrix (const OpenGl_Matrix* );
+
+ const OpenGl_AspectLine* SetAspectLine (const OpenGl_AspectLine* theAspect);
+ const OpenGl_AspectFace* SetAspectFace (const OpenGl_AspectFace* theAspect);
+ const OpenGl_AspectMarker* SetAspectMarker (const OpenGl_AspectMarker* theAspect);
+ const OpenGl_AspectText* SetAspectText (const OpenGl_AspectText* theAspect);
+
+ void SetTextParam (const OpenGl_TextParam* theParam) { TextParam_set = theParam; }
+
+ const OpenGl_AspectLine* AspectLine (const Standard_Boolean theWithApply);
+ const OpenGl_AspectFace* AspectFace (const Standard_Boolean theWithApply);
+ const OpenGl_AspectMarker* AspectMarker (const Standard_Boolean theWithApply);
+ const OpenGl_AspectText* AspectText (const Standard_Boolean theWithApply);
+
+ //// RELATED TO FONTS ////
+
+ int FindFont (const char* theFontName,
+ const OSD_FontAspect theFontAspect,
+ const int theBestSize = -1,
+ const float theXScale = 1.0f,
+ const float theYScale = 1.0f)
+ {
+ return myDisplay->FindFont (theFontName, theFontAspect, theBestSize, theXScale, theYScale);
+ }
+
+ void StringSize (const wchar_t* theText, int& theWidth, int& theAscent, int& theDescent)
+ {
+ myDisplay->StringSize (theText, theWidth, theAscent, theDescent);
+ }
+
+ void RenderText (const wchar_t* theText, const int theIs2d,
+ const float theX, const float theY, const float theZ)
+ {
+ const OpenGl_AspectText* anAspect = AspectText (Standard_True);
+ myDisplay->RenderText (theText, theIs2d, theX, theY, theZ, anAspect, TextParam_applied);
+ }
+
+protected:
+
+ void CopyBuffers (Tint vid, int FrontToBack,
+ Tfloat xm, Tfloat ym, Tfloat zm,
+ Tfloat XM, Tfloat YM, Tfloat ZM,
+ Tint flag);
+
+ virtual Standard_Boolean Activate();
+
+ // TEMPORARY!!!
+ void Redraw1 (const Graphic3d_CView& theCView,
+ const Aspect_CLayer2d& theCUnderLayer,
+ const Aspect_CLayer2d& theCOverLayer,
+ const int theToSwap);
+
+protected:
+
+ Handle(OpenGl_View) myView; // WSViews - now just one view is supported
+ Standard_Boolean myIsUpdated; // WSUpdateState
+ Tint myTransientList; // WSTransient
+ Standard_Boolean myIsTransientOpen; // transientOpen
+ Tint myRetainMode; // WSRetainMode
+
+ Standard_Boolean myUseTransparency;
+ Standard_Boolean myUseZBuffer;
+ Standard_Boolean myUseDepthTest;
+ Standard_Boolean myUseGLLight;
+ Standard_Boolean myBackBufferRestored;
+
+ //// RELATED TO STATUS ////
+
+ void UpdateMaterial (const int flag);
+
+ const OpenGl_AspectLine *AspectLine_set, *AspectLine_applied;
+ const OpenGl_AspectFace *AspectFace_set, *AspectFace_applied;
+ const OpenGl_AspectMarker *AspectMarker_set, *AspectMarker_applied;
+ const OpenGl_AspectText *AspectText_set, *AspectText_applied;
+
+ const OpenGl_TextParam *TextParam_set, *TextParam_applied;
+
+ const OpenGl_Matrix* ViewMatrix_applied;
+ const OpenGl_Matrix* StructureMatrix_applied;
+
+ const TEL_POFFSET_PARAM* PolygonOffset_applied;
+
+public:
+
+ DEFINE_STANDARD_RTTI(OpenGl_Workspace) // Type definition
+ IMPLEMENT_MEMORY_OPERATORS
+
+};
+
+#endif //_OpenGl_Workspace_Header
--- /dev/null
+// File: OpenGl_Workspace_1.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Workspace.hxx>
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <InterfaceGraphic_Labels.hxx>
+#include <InterfaceGraphic_Graphic3d.hxx>
+#include <InterfaceGraphic_Visual3d.hxx>
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_begin_animation
+void OpenGl_Workspace::BeginAnimation (const Standard_Boolean UseDegeneration, const Standard_Boolean UpdateAM)
+{
+ NamedStatus |= OPENGL_NS_ANIMATION;
+ if (UseDegeneration)
+ NamedStatus |= OPENGL_NS_DEGENERATION;
+ else
+ NamedStatus &= ~OPENGL_NS_DEGENERATION;
+ if (UpdateAM)
+ NamedStatus |= OPENGL_NS_UPDATEAM;
+ else
+ NamedStatus &= ~OPENGL_NS_UPDATEAM;
+ NamedStatus &= ~OPENGL_NS_FLIST;
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_end_animation
+void OpenGl_Workspace::EndAnimation ()
+{
+ if( (NamedStatus & OPENGL_NS_ANIMATION) == 0 ) return;
+
+ NamedStatus &= ~(OPENGL_NS_ANIMATION | OPENGL_NS_DEGENERATION | OPENGL_NS_UPDATEAM);
+ myIsUpdated = Standard_False;
+}
+
+/*----------------------------------------------------------------------*/
+/*
+* Permet de terminer effectivement le mode Animation.
+* Ceci est realise des qu'une structure a ete modifiee.
+*/
+
+//call_togl_erase_animation_mode
+void OpenGl_Workspace::EraseAnimation ()
+{
+ NamedStatus &= ~(OPENGL_NS_ANIMATION | OPENGL_NS_DEGENERATION | OPENGL_NS_UPDATEAM | OPENGL_NS_FLIST);
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Workspace_2.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#define RIC120302 /* GG Enable to use the application display
+// callback at end of traversal
+*/
+
+#include <OpenGl_tgl_all.hxx>
+#include <OpenGl_FrameBuffer.hxx>
+#include <TColStd_Array2OfReal.hxx>
+#include <string.h>
+#include <OpenGl_telem_util.hxx>
+
+#ifdef HAVE_FREEIMAGE
+ #include <NCollection_Handle.hxx>
+ #include <FreeImagePlus.h>
+ #ifdef _MSC_VER
+ #pragma comment( lib, "FreeImage.lib" )
+ #pragma comment( lib, "FreeImagePlus.lib" )
+ #endif
+ typedef NCollection_Handle<fipImage> FipHandle;
+#endif
+
+#include <OpenGl_PrinterContext.hxx>
+#include <OpenGl_Workspace.hxx>
+#include <OpenGl_View.hxx>
+#include <OpenGl_Display.hxx>
+
+//10-05-96 : CAL ; Ajout d'un nouveau delta dans les copies de pixels (voir CALL_DEF_DELTA)
+#define CALL_DEF_DELTA 10
+
+// ---------------------------------------------------------------
+// Function: getNearestPowOfTwo
+// Purpose: get the nearest power of two for theNumber
+// ---------------------------------------------------------------
+static GLsizei getNearestPowOfTwo (const GLsizei theNumber)
+{
+ GLsizei aLast = 1;
+ for (GLsizei p2 = 1; p2 <= theNumber; aLast = p2, p2 <<= 1);
+ return aLast;
+}
+
+// ---------------------------------------------------------------
+// Function: getMaxFrameSize
+// Purpose: get the maximum possible frame size
+// ---------------------------------------------------------------
+static void getMaxFrameSize(Standard_Integer& theWidth,
+ Standard_Integer& theHeight)
+{
+ GLsizei aMaxX, aMaxY;
+ GLint aVpDim[2];
+ GLint aTexDim = 2048;
+ glGetIntegerv (GL_MAX_VIEWPORT_DIMS, (GLint*) &aVpDim);
+ glGetIntegerv (GL_MAX_TEXTURE_SIZE, &aTexDim);
+ (aVpDim[0] >= aTexDim) ? aMaxX = (GLsizei) aTexDim :
+ aMaxX = getNearestPowOfTwo((GLsizei)aVpDim[0]);
+ (aVpDim[1] >= aTexDim) ? aMaxY = (GLsizei) aTexDim :
+ aMaxY = getNearestPowOfTwo((GLsizei)aVpDim[1]);
+
+ theWidth = (Standard_Integer)aMaxX;
+ theHeight = (Standard_Integer)aMaxY;
+}
+
+// ---------------------------------------------------------------
+// Function: fitDimensionsRatio
+// Purpose: calculate correct width/height ratio for theWidth and
+// theHeight parameters
+// ---------------------------------------------------------------
+static void fitDimensionsRatio (Standard_Integer& theWidth,
+ Standard_Integer& theHeight,
+ const Standard_Real theViewRatio)
+{
+ // set dimensions in accordance with the viewratio
+ if (theHeight < theWidth/theViewRatio)
+ theWidth = (Standard_Integer)(theHeight*theViewRatio);
+
+ if (theWidth < theHeight*theViewRatio)
+ theHeight = (Standard_Integer)(theWidth/theViewRatio);
+}
+
+// ---------------------------------------------------------------
+// Function: getDimensionsTiling
+// Purpose: calculate maximum possible dimensions for framebuffer
+// in tiling mode according to the view size
+// ---------------------------------------------------------------
+static void getDimensionsTiling (Standard_Integer& theFrameWidth,
+ Standard_Integer& theFrameHeight,
+ const int theViewWidth,
+ const int theViewHeight)
+{
+ // fit the maximum dimensions into the printing area
+ if (theFrameWidth > theViewWidth)
+ theFrameWidth = theViewWidth;
+
+ if (theFrameHeight > theViewHeight)
+ theFrameHeight = theViewHeight;
+}
+
+// ---------------------------------------------------------------
+// Function: initBufferStretch
+// Purpose: calculate initialization sizes for frame buffer
+// when the stretch algorithm is selected
+// ---------------------------------------------------------------
+static void initBufferStretch (Standard_Integer& theFrameWidth,
+ Standard_Integer& theFrameHeight,
+ const int theViewWidth,
+ const int theViewHeight)
+{
+
+ // Calculate correct width/height for framebuffer
+ Standard_Real aViewRatio = (Standard_Real)theViewWidth/theViewHeight;
+ fitDimensionsRatio (theFrameWidth, theFrameHeight, aViewRatio);
+
+ // downscale the framebuffer if it is too large
+ Standard_Real aWidthRate = (Standard_Real)theFrameWidth /theViewWidth;
+ Standard_Real aHeightRate = (Standard_Real)theFrameHeight/theViewHeight;
+
+ if ((aWidthRate > 1 && aHeightRate > 1 && aWidthRate >= aHeightRate) ||
+ (aWidthRate > 1 && aHeightRate <= 1))
+ {
+ theFrameWidth = (Standard_Integer)(theFrameWidth /aWidthRate);
+ theFrameHeight = (Standard_Integer)(theFrameHeight/aWidthRate);
+ }
+ else if ((aWidthRate > 1 && aHeightRate > 1 && aWidthRate < aHeightRate) ||
+ (aWidthRate <= 1 && aHeightRate > 1))
+ {
+ theFrameWidth = (Standard_Integer)(theFrameWidth /aHeightRate);
+ theFrameHeight = (Standard_Integer)(theFrameHeight/aHeightRate);
+ }
+
+}
+
+// ---------------------------------------------------------------
+// Function: initBufferTiling
+// Purpose: calculate initialization sizes for frame buffer
+// when the tile algorithm is selected
+// ---------------------------------------------------------------
+static void initBufferTiling (Standard_Integer& theFrameWidth,
+ Standard_Integer &theFrameHeight,
+ const int theViewWidth,
+ const int theViewHeight)
+{
+ // fit framebuffer into the printing area
+ if (theFrameWidth > theViewWidth)
+ theFrameWidth = theViewWidth;
+
+ if (theFrameHeight > theViewHeight)
+ theFrameHeight = theViewHeight;
+}
+
+// ---------------------------------------------------------------
+// Function: initBitmapBuffer
+// Purpose: init device independent bitmap to hold printing data
+// ---------------------------------------------------------------
+#ifdef WNT
+#ifndef HAVE_FREEIMAGE
+static void initBitmapBuffer (const HDC theMemoryDC,
+ HBITMAP &theMemoryBmp,
+ const Standard_Integer theBmpWidth,
+ const Standard_Integer theBmpHeight,
+ VOID* &theBufferPtr)
+{
+ // define compatible bitmap
+ BITMAPINFO aBitmapData;
+ memset (&aBitmapData, 0, sizeof (BITMAPINFOHEADER));
+ aBitmapData.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
+ aBitmapData.bmiHeader.biWidth = theBmpWidth;
+ aBitmapData.bmiHeader.biHeight = theBmpHeight;
+ aBitmapData.bmiHeader.biPlanes = 1;
+ aBitmapData.bmiHeader.biBitCount = 24;
+ aBitmapData.bmiHeader.biXPelsPerMeter = 0;
+ aBitmapData.bmiHeader.biYPelsPerMeter = 0;
+ aBitmapData.bmiHeader.biClrUsed = 0;
+ aBitmapData.bmiHeader.biClrImportant = 0;
+ aBitmapData.bmiHeader.biCompression = BI_RGB;
+ aBitmapData.bmiHeader.biSizeImage = 0;
+
+ // Create Device Independent Bitmap
+ theMemoryBmp = CreateDIBSection (theMemoryDC, &aBitmapData, DIB_RGB_COLORS,
+ &theBufferPtr, NULL, 0);
+}
+#else
+// ---------------------------------------------------------------
+// Function: imagePasteDC
+// Purpose: copy the data from image buffer to the device context
+// ---------------------------------------------------------------
+static bool imagePasteDC(HDC theDstDC, FipHandle theImage, int theOffsetX,
+ int theOffsetY, int theWidth, int theHeight,
+ int theLeft = 0, int theTop = 0)
+{
+ // get image parameters
+ BITMAPINFO* aBitmapData = theImage->getInfo ();
+ SetStretchBltMode (theDstDC, STRETCH_HALFTONE);
+
+ // organize blocks data passing if memory isn't enough to pass all the data
+ // at once
+ int aLinesComplete = 0, aMaxBlockWidth = theHeight, aBlockWidth = 0,
+ aPassed = 0, aInverseLine = 0, aScan = 0;
+ BYTE *aDataPtr = 0;
+ while (aMaxBlockWidth >= 1 && aLinesComplete < theHeight)
+ {
+ // how much lines still to pass
+ aBlockWidth = theHeight - aLinesComplete;
+
+ // normalize count of lines to pass to maximum lines count at one pass.
+ if (aBlockWidth > aMaxBlockWidth)
+ aBlockWidth = aMaxBlockWidth;
+
+ // access image data at the start scan line, we need to calculate scan from
+ // the bottom of image (image is bottom-left, the src coord is top-left)
+ aInverseLine = theTop + aBlockWidth + aLinesComplete;
+ aScan = theImage->getHeight() - aInverseLine;
+ aDataPtr = theImage->getScanLine (aScan);
+ if (!aDataPtr)
+ return false;
+
+ // try to pass block to the device
+ if (aBlockWidth > 0)
+ {
+ // instead of banded output we provide blocked as it isn't always passed
+ // to printer as it is expected
+ aPassed = SetDIBitsToDevice (theDstDC, theOffsetX,
+ theOffsetY + aLinesComplete,
+ theWidth, aBlockWidth, theLeft, 0,
+ 0, aBlockWidth,
+ aDataPtr, aBitmapData, DIB_RGB_COLORS);
+
+ // if result is bad, try to decrease band width
+ if (aPassed != aBlockWidth)
+ {
+ aMaxBlockWidth = aMaxBlockWidth >> 1;
+ aLinesComplete = 0;
+ }
+ else
+ aLinesComplete += aBlockWidth;
+ }
+ }
+
+ // check for total failure
+ if (aMaxBlockWidth < 1)
+ return false;
+
+ return true;
+}
+
+// ---------------------------------------------------------------
+// Function: imageStretchDC
+// Purpose: copy pixels from image to dc by stretching them
+// ---------------------------------------------------------------
+static bool imageStretchDC(HDC theDstDC, FipHandle theImage, int theOffsetX,
+ int theOffsetY, int theWidth, int theHeight)
+{
+ // access to raw image data
+ BYTE *aDataPtr = theImage->accessPixels ();
+ if (!aDataPtr)
+ return false;
+
+ // get image parameters
+ unsigned int widthPx = theImage->getWidth ();
+ unsigned int heightPx = theImage->getHeight ();
+ BITMAPINFO* aBitmapData = theImage->getInfo ();
+ SetStretchBltMode (theDstDC, STRETCH_HALFTONE);
+
+ // pass lines and check if operation is succesfull
+ int aPassed = 0;
+ aPassed = StretchDIBits (theDstDC, theOffsetX, theOffsetY, theWidth,
+ theHeight, 0, 0, widthPx, heightPx, aDataPtr,
+ aBitmapData, DIB_RGB_COLORS, SRCCOPY);
+
+ if (aPassed != heightPx)
+ return false;
+
+ return true;
+}
+#endif
+#endif
+
+// ---------------------------------------------------------------
+// ---------------------------------------------------------------
+
+//call_togl_print
+Standard_Boolean OpenGl_Workspace::Print
+ (const Graphic3d_CView& ACView,
+ const Aspect_CLayer2d& ACUnderLayer,
+ const Aspect_CLayer2d& ACOverLayer,
+ const Aspect_Handle hPrintDC,// const Aspect_Drawable hPrintDC,
+ const Standard_Boolean showBackground,
+ const Standard_CString filename,
+ const Aspect_PrintAlgo printAlgorithm,
+ const Standard_Real theScaleFactor)
+{
+#ifdef WNT
+
+ if (!Activate())
+ {
+ //MessageBox (NULL, "Print failed: can't setup the view for printing.",
+ // "The operation couldn't be completed.", MB_OK);
+ return Standard_False;
+ }
+
+ // printer page dimensions
+ HDC hPrnDC = (HDC) hPrintDC;
+ int devWidth = GetDeviceCaps (hPrnDC, HORZRES);
+ int devHeight = GetDeviceCaps (hPrnDC, VERTRES);
+
+ // if context is actually a memory dc, try to retrieve bitmap dimensions
+ // (memory dc could be used for testing purposes)
+ if (GetObjectType (hPrnDC) == OBJ_MEMDC)
+ {
+ // memory dc dimensions
+ BITMAP aBitmapInfo;
+ HBITMAP aMemoryBitmap = (HBITMAP) GetCurrentObject (hPrnDC, OBJ_BITMAP);
+ if (aMemoryBitmap)
+ if (GetObject (aMemoryBitmap, sizeof (BITMAP), &aBitmapInfo))
+ {
+ devWidth = aBitmapInfo.bmWidth;
+ devHeight = aBitmapInfo.bmHeight;
+ }
+ }
+
+ Standard_Integer tempWidth = (Standard_Integer) devWidth;
+ Standard_Integer tempHeight = (Standard_Integer) devHeight;
+
+ // view dimensions
+ int viewWidth = myWidth;
+ int viewHeight = myHeight;
+ if (viewWidth == 0 || viewHeight == 0)
+ {
+ //MessageBox (NULL, "Print failed: can't setup the view for printing.",
+ // "The operation couldn't be completed.", MB_OK);
+ return Standard_False;
+ }
+
+ // calculate correct width/height ratio
+ Standard_Real viewRatio = (Standard_Real)viewWidth/viewHeight;
+ fitDimensionsRatio(tempWidth, tempHeight, viewRatio);
+
+ // width and height for printing area
+ int width = (int) (tempWidth * theScaleFactor);
+ int height = (int) (tempHeight * theScaleFactor);
+
+ // device independent bitmap for the whole view
+#ifdef HAVE_FREEIMAGE
+ FipHandle aViewImage = NULL;
+ BYTE* aViewBuffer = NULL;
+#else
+ HDC hMemDC = CreateCompatibleDC (hPrnDC);
+ HBITMAP hViewBitmap = NULL;
+ HGDIOBJ hViewBitmapOld = NULL;
+ VOID* aViewBuffer = NULL;
+#endif
+
+ // Frame buffer initialization
+ OpenGl_FrameBuffer* aFrameBuffer = NULL;
+ OpenGl_FrameBuffer* aPrevBuffer = (OpenGl_FrameBuffer*) ACView.ptrFBO;
+ Standard_Integer aFrameWidth (0), aFrameHeight (0),
+ aPrevBufferX (0), aPrevBufferY (0);
+
+ bool IsTiling = (printAlgorithm == 1);
+
+ // try to use existing frame buffer
+ if (aPrevBuffer)
+ {
+ GLsizei aPrevWidth = aPrevBuffer->GetSizeX();
+ GLsizei aPrevHeight = aPrevBuffer->GetSizeY();
+ bool isUsable = false;
+
+ // check if its possible to use previous frame buffer
+ if (!IsTiling && aPrevWidth >= width && aPrevHeight >= height)
+ {
+ aFrameWidth = (Standard_Integer) width;
+ aFrameHeight = (Standard_Integer) height;
+ isUsable = true;
+ }
+ else if (IsTiling)
+ {
+ getDimensionsTiling (aFrameWidth, aFrameHeight, width, height);
+ if (aPrevWidth >= aFrameWidth && aPrevHeight >= aFrameHeight)
+ isUsable = true;
+ }
+
+ // if it is enough memory for image paste dc operation
+ if (isUsable)
+ {
+#ifdef HAVE_FREEIMAGE
+ // try to allocate fipImage and necessary resources
+ fipImage* anImagePtr = new fipImage (FIT_BITMAP, aFrameWidth,
+ aFrameHeight, 24);
+
+ // if allocated succesfully
+ if (anImagePtr->isValid())
+ {
+ aViewImage = anImagePtr;
+ aViewBuffer = aViewImage->accessPixels ();
+ }
+ else
+ delete anImagePtr;
+
+ if (!aViewBuffer)
+ {
+ isUsable = false;
+ aViewBuffer = NULL;
+ aViewImage = NULL;
+ }
+#else
+ // try to allocate compatible bitmap and necessary resources
+ initBitmapBuffer (hMemDC, hViewBitmap,
+ aFrameWidth, aFrameHeight, aViewBuffer);
+ if (!aViewBuffer)
+ {
+ isUsable = false;
+ if (hViewBitmap)
+ DeleteObject (hViewBitmap);
+ hViewBitmap = NULL;
+ }
+ else
+ hViewBitmapOld = SelectObject (hMemDC, hViewBitmap);
+#endif
+ }
+
+ // use previous frame buffer
+ if (isUsable)
+ {
+ aPrevBufferX = aPrevWidth;
+ aPrevBufferY = aPrevHeight;
+ aFrameBuffer = aPrevBuffer;
+ aFrameBuffer->ChangeViewport (aFrameWidth, aFrameHeight);
+ }
+ }
+
+ // if previous buffer cannot be used, try to init a new one
+ if (!aFrameBuffer)
+ {
+ aFrameBuffer = new OpenGl_FrameBuffer();
+
+ // try to create the framebuffer with the best possible size
+ Standard_Integer aMaxWidth(0), aMaxHeight(0);
+ getMaxFrameSize (aMaxWidth, aMaxHeight);
+ while (aMaxWidth > 1 && aMaxHeight > 1)
+ {
+ aFrameWidth = aMaxWidth;
+ aFrameHeight = aMaxHeight;
+
+ // calculate dimensions for different printing algorithms
+ if (!IsTiling)
+ initBufferStretch (aFrameWidth, aFrameHeight, width, height);
+ else
+ initBufferTiling (aFrameWidth, aFrameHeight, width, height);
+
+ // try to initialize framebuffer
+ if (aFrameBuffer->Init (GetGlContext(), aFrameWidth, aFrameHeight))
+ {
+#ifdef HAVE_FREEIMAGE
+ // try to allocate fipImage and necessary resources
+ fipImage* anImagePtr = new fipImage (FIT_BITMAP, aFrameWidth,
+ aFrameHeight, 24);
+
+ // if allocated succesfully
+ if (anImagePtr->isValid())
+ {
+ aViewImage = anImagePtr;
+ aViewBuffer = aViewImage->accessPixels ();
+ }
+ else
+ delete anImagePtr;
+
+ if (!aViewBuffer)
+ {
+ aFrameBuffer->Release (GetGlContext());
+ aViewBuffer = NULL;
+ aViewImage = NULL;
+ }
+ else
+ break;
+#else
+ // try to allocate compatible bitmap and necessary resources
+ initBitmapBuffer (hMemDC, hViewBitmap,
+ aFrameWidth, aFrameHeight, aViewBuffer);
+ if (!aViewBuffer)
+ {
+ if (hViewBitmap)
+ DeleteObject (hViewBitmap);
+ aFrameBuffer->Release ();
+ hViewBitmap = NULL;
+ }
+ else
+ {
+ hViewBitmapOld = SelectObject (hMemDC, hViewBitmap);
+ break;
+ }
+#endif
+ }
+
+ // not initialized, decrease dimensions
+ aMaxWidth = aMaxWidth >> 1;
+ aMaxHeight = aMaxHeight >> 1;
+ }
+
+ // check if there are proper dimensions
+ if (aMaxWidth <= 1 || aMaxHeight <= 1)
+ {
+ MessageBox (NULL, "Print failed: can't allocate buffer for printing.",
+ "The operation couldn't be completed.", MB_OK);
+
+ if (aFrameBuffer)
+ delete aFrameBuffer;
+#ifndef HAVE_FREEIMAGE
+ if (hMemDC)
+ DeleteDC (hMemDC);
+#endif
+
+ return Standard_False;
+ }
+ }
+
+ // setup printing context and viewport
+ GLint aViewPortBack[4];
+ GLint aReadBufferPrev = GL_BACK;
+ GLint anAlignBack = 1;
+
+ OpenGl_PrinterContext aPrinterContext (myGContext);
+ aPrinterContext.SetLayerViewport ((GLsizei)aFrameWidth,
+ (GLsizei)aFrameHeight);
+ glGetIntegerv (GL_VIEWPORT, aViewPortBack);
+ glGetIntegerv (GL_PACK_ALIGNMENT, &anAlignBack);
+ glPixelStorei (GL_PACK_ALIGNMENT, 4);
+
+ // start document if the printer context is not actually a memory dc
+ // (memory dc could be used for testing purposes)
+ DOCINFO di;
+ if (GetObjectType (hPrnDC) == OBJ_DC)
+ {
+ // Initalize printing procedure
+ di.cbSize = sizeof(DOCINFO);
+ di.lpszDocName = "Open Cascade Document - print v3d view";
+ di.lpszOutput = filename;
+
+ // if can't print the document
+ if (StartDoc (hPrnDC, &di) <= 0 || StartPage (hPrnDC) <= 0)
+ {
+ MessageBox (NULL, "Print failed: printer can't start operation.",
+ "The operation couldn't be completed.", MB_OK);
+#ifndef HAVE_FREEIMAGE
+ if (hViewBitmap)
+ {
+ SelectObject (hMemDC, hViewBitmapOld);
+ DeleteObject (hViewBitmap);
+ }
+ DeleteDC (hMemDC);
+#endif
+
+ return Standard_False;
+ }
+ }
+
+ // activate the offscreen buffer
+ aFrameBuffer->BindBuffer (GetGlContext());
+
+ // calculate offset for centered printing
+ int aDevOffx = (int)(devWidth - width) /2;
+ int aDevOffy = (int)(devHeight - height)/2;
+
+ // operation complete flag
+ bool isDone = true;
+
+ // Set up status for printing
+ NamedStatus |= OPENGL_NS_ISBITMAP;
+ if (!showBackground)
+ NamedStatus |= OPENGL_NS_WHITEBACK;
+
+ if (!IsTiling)
+ {
+ aPrinterContext.SetScale ((GLfloat)aFrameWidth /viewWidth,
+ (GLfloat)aFrameHeight/viewHeight);
+ aFrameBuffer->SetupViewport ();
+ Redraw1(ACView, ACUnderLayer, ACOverLayer, 0);
+ RedrawImmediatMode();
+ glReadPixels (0, 0, aFrameWidth, aFrameHeight,
+ GL_BGR_EXT, GL_UNSIGNED_BYTE, (GLvoid* )aViewBuffer);
+
+ // copy result to the printer device and check for errors
+#ifdef HAVE_FREEIMAGE
+ if (!aViewImage->rescale(width, height, FILTER_BICUBIC) ||
+ !imagePasteDC (hPrnDC, aViewImage, aDevOffx, aDevOffy, width, height))
+ isDone = imageStretchDC (hPrnDC, aViewImage, aDevOffx, aDevOffy,
+ width, height);
+#else
+ if (width > aFrameWidth && height > aFrameHeight)
+ {
+ SetStretchBltMode (hPrnDC, STRETCH_HALFTONE);
+ isDone = StretchBlt (hPrnDC, aDevOffx, aDevOffy, width, height,
+ hMemDC, 0, 0, aFrameWidth, aFrameHeight, SRCCOPY);
+ }
+ else
+ {
+ isDone = BitBlt (hPrnDC, aDevOffx, aDevOffy, width, height,
+ hMemDC, 0, 0, SRCCOPY);
+ }
+#endif
+ }
+ else
+ {
+ // calculate total count of frames and cropping size
+ Standard_Integer aPxCropx = 0;
+ Standard_Integer aPxCropy = 0;
+ Standard_Integer aTotalx =
+ (Standard_Integer)floor ((float)width /aFrameWidth);
+ Standard_Integer aTotaly =
+ (Standard_Integer)floor ((float)height/aFrameHeight);
+ if (width %aFrameWidth != 0)
+ {
+ aPxCropx = (aFrameWidth - width%aFrameWidth)/2;
+ aTotalx++;
+ }
+ if (height%aFrameHeight != 0)
+ {
+ aPxCropy = (aFrameHeight - height%aFrameHeight)/2;
+ aTotaly++;
+ }
+
+ int anOddPixelx = (width %aFrameWidth) %2;
+ int anOddPixely = (height%aFrameHeight)%2;
+
+ // calculate scale factor for full frames
+ Standard_Real aScalex = (Standard_Real)width /aFrameWidth;
+ Standard_Real aScaley = (Standard_Real)height/aFrameHeight;
+
+ // calculate and set the text scaling factor for printing context
+ GLfloat aScaleRatex = (GLfloat)aFrameWidth /viewWidth;
+ GLfloat aScaleRatey = (GLfloat)aFrameHeight/viewHeight;
+ aPrinterContext.SetScale (aScaleRatex*(GLfloat)aScalex,
+ aScaleRatey*(GLfloat)aScaley);
+
+ // initialize projection matrix for printer context
+ TColStd_Array2OfReal aProj (0, 3, 0, 3);
+ Standard_Real aDef = 0;
+ aProj.Init (aDef);
+ aProj(2,2) = 1.0;
+ aProj(3,3) = 1.0;
+
+ // projection matrix offsets for printer context
+ // offsets are even numbers
+ Standard_Real aOffsetx(0), aOffsety(0);
+ aOffsetx = -(aTotalx-1);
+ aOffsety = -(aTotaly-1);
+
+ // rect of frame image that will be copied
+ // and coordinates in view image where to put it
+ Standard_Integer aLeft = 0, aRight = 0, aBottom = 0, aTop = 0;
+ Standard_Integer aSubLeft = (Standard_Integer)aDevOffx;
+ Standard_Integer aSubTop = (Standard_Integer)aDevOffy;
+
+ // draw sequence of full frames
+ for (int i = 0; i < aTotalx; i++)
+ {
+ // offsets are even numbers
+ aOffsety = -(aTotaly-1);
+ aSubTop = (Standard_Integer)aDevOffy;
+
+ // calculate cropped frame rect
+ aLeft = (i == 0) ? aPxCropx : 0;
+ aRight = (i == aTotalx-1) ? aFrameWidth-(aPxCropx+anOddPixelx) :
+ aFrameWidth;
+
+ for (int j = 0; j < aTotaly; j++)
+ {
+ // no offset for single frames
+ aProj(3,0) = (aTotalx == 1) ? 0 : -aOffsetx;
+ aProj(3,1) = (aTotaly == 1) ? 0 : aOffsety;
+
+ // set projection matrix
+ aProj(0,0) = aScalex;
+ aProj(1,1) = aScaley;
+ aPrinterContext.SetProjTransformation (aProj);
+
+ // calculate cropped frame rect
+ aTop = (j == 0) ? aPxCropy : 0;
+ aBottom = (j == aTotaly-1) ? aFrameHeight-(aPxCropy+anOddPixely) :
+ aFrameHeight;
+
+ // draw to the offscreen buffer and capture the result
+ aFrameBuffer->SetupViewport ();
+ Redraw1(ACView, ACUnderLayer, ACOverLayer, 0);
+ RedrawImmediatMode();
+ glReadPixels (0, 0, aFrameWidth, aFrameHeight,
+ GL_BGR_EXT, GL_UNSIGNED_BYTE, (GLvoid* )aViewBuffer);
+#ifdef HAVE_FREEIMAGE
+ // cut out pixels that are out of printing area
+ isDone = imagePasteDC (hPrnDC, aViewImage, aSubLeft, aSubTop,
+ aRight-aLeft, aBottom-aTop, aLeft, aTop);
+#else
+ isDone = BitBlt (hPrnDC, aSubLeft, aSubTop, aRight-aLeft, aBottom-aTop,
+ hMemDC, aLeft, aTop, SRCCOPY);
+#endif
+
+ // stop operation if errors
+ if (!isDone)
+ break;
+
+ // calculate new view offset for y-coordinate
+ aOffsety += 2.0;
+ aSubTop += aBottom-aTop;
+ }
+
+ // stop operation if errors
+ if (!isDone)
+ break;
+
+ // calculate new view offset for x-coordinate
+ aOffsetx += 2.0;
+ aSubLeft += aRight-aLeft;
+ }
+ }
+
+ // complete printing or indicate an error
+ if (GetObjectType (hPrnDC) == OBJ_DC && isDone == true)
+ {
+ EndPage (hPrnDC);
+ EndDoc (hPrnDC);
+ }
+ else if (isDone == false)
+ {
+ MessageBox (NULL, "Print failed: insufficient memory or spool error.\nPlease use smaller printer resolution.",
+ "The opeartion couldn't be completed.", MB_OK);
+ if (GetObjectType (hPrnDC) == OBJ_DC)
+ AbortDoc (hPrnDC);
+ }
+
+ // return OpenGl to the previous state
+ aPrinterContext.Deactivate ();
+ glPixelStorei (GL_PACK_ALIGNMENT, anAlignBack);
+ aFrameBuffer->UnbindBuffer (GetGlContext());
+ glViewport (aViewPortBack[0], aViewPortBack[1],
+ aViewPortBack[2], aViewPortBack[3]);
+ if (aPrevBuffer)
+ aPrevBuffer->ChangeViewport (aPrevBufferX, aPrevBufferY);
+ else
+ delete aFrameBuffer;
+
+ // delete resources
+#ifndef HAVE_FREEIMAGE
+ if (hViewBitmap)
+ {
+ SelectObject (hMemDC, hViewBitmapOld);
+ DeleteObject (hViewBitmap);
+ }
+ DeleteDC (hMemDC);
+#endif
+
+ // Reset status after printing
+ NamedStatus &= ~(OPENGL_NS_WHITEBACK | OPENGL_NS_ISBITMAP);
+
+ return (Standard_Boolean) isDone;
+
+#else // not WNT
+ return Standard_False;
+#endif
+}
+
+/*----------------------------------------------------------------------*/
+
+//redrawView
+void OpenGl_Workspace::Redraw1 (const Graphic3d_CView& ACView,
+ const Aspect_CLayer2d& ACUnderLayer,
+ const Aspect_CLayer2d& ACOverLayer,
+ const int aswap)
+{
+ if (myDisplay.IsNull() || myView.IsNull())
+ return;
+
+ myDisplay->UpdateUserMarkers();
+
+ // Request reset of material
+ NamedStatus |= OPENGL_NS_RESMAT;
+
+ /* GL_DITHER on/off pour le background */
+ if (myBackDither)
+ glEnable (GL_DITHER);
+ else
+ glDisable (GL_DITHER);
+
+ GLbitfield toClear = GL_COLOR_BUFFER_BIT;
+ if ( myUseZBuffer )
+ {
+ glDepthFunc(GL_LEQUAL);
+ glDepthMask(GL_TRUE);
+
+ // SAV checking if depth test was deprecated somewhere outside
+ if ( myUseDepthTest )
+ glEnable(GL_DEPTH_TEST);
+ else
+ glDisable(GL_DEPTH_TEST);
+
+ glClearDepth(1.0);
+ toClear |= GL_DEPTH_BUFFER_BIT;
+ }
+ else
+ {
+ glDisable(GL_DEPTH_TEST);
+ }
+
+ if ( NamedStatus & OPENGL_NS_WHITEBACK )
+ {
+ // Set background to white
+ glClearColor (1.F, 1.F, 1.F, 1.F);
+ toClear |= GL_DEPTH_BUFFER_BIT;
+ }
+ else
+ {
+ glClearColor (myBgColor.rgb[0], myBgColor.rgb[1], myBgColor.rgb[2], 0.F);
+ }
+ glClear (toClear);
+
+ Handle(OpenGl_Workspace) aWS(this);
+ myView->Render(aWS,ACView,ACUnderLayer,ACOverLayer);
+
+ // Swap the buffers
+ if ( aswap )
+ {
+#ifndef WNT
+ glXSwapBuffers ((Display*)myDisplay->GetDisplay (), myWindow );
+#else
+ SwapBuffers ( wglGetCurrentDC () );
+ glFlush();
+#endif /* WNT */
+ myBackBufferRestored = Standard_False;
+ }
+ else
+ glFlush();
+
+ myIsUpdated = Standard_True;
+}
+
+/*----------------------------------------------------------------------*/
+
+//TelCopyBuffers
+void OpenGl_Workspace::CopyBuffers (Tint vid, int FrontToBack, Tfloat xm, Tfloat ym, Tfloat zm, Tfloat XM, Tfloat YM, Tfloat ZM, Tint flag)
+{
+ if (FrontToBack) myBackBufferRestored = Standard_False;
+
+ glMatrixMode (GL_PROJECTION);
+ glPushMatrix ();
+ glLoadIdentity ();
+ gluOrtho2D ((GLdouble) 0., (GLdouble) myWidth, 0., (GLdouble) myHeight);
+ glMatrixMode (GL_MODELVIEW);
+ glPushMatrix ();
+ glLoadIdentity ();
+
+ DisableFeatures();
+
+ GLsizei width = myWidth+1, height = myHeight+1;
+ Tfloat xmr = 0, ymr = 0;
+
+ if (flag)
+ {
+ if (!myView.IsNull()) //szvgl: use vid here!
+ {
+ // Calculate bounding box and store the projected rectangle
+ Tfloat xr[8], yr[8];
+ // Project bounding box
+ if (myView->ProjectObjectToRaster (myWidth, myHeight, xm, ym, zm, xr[0], yr[0]) &&
+ myView->ProjectObjectToRaster (myWidth, myHeight, xm, YM, zm, xr[1], yr[1]) &&
+ myView->ProjectObjectToRaster (myWidth, myHeight, XM, YM, zm, xr[2], yr[2]) &&
+ myView->ProjectObjectToRaster (myWidth, myHeight, XM, ym, zm, xr[3], yr[3]) &&
+ myView->ProjectObjectToRaster (myWidth, myHeight, xm, ym, ZM, xr[4], yr[4]) &&
+ myView->ProjectObjectToRaster (myWidth, myHeight, xm, YM, ZM, xr[5], yr[5]) &&
+ myView->ProjectObjectToRaster (myWidth, myHeight, XM, YM, ZM, xr[6], yr[6]) &&
+ myView->ProjectObjectToRaster (myWidth, myHeight, XM, ym, ZM, xr[7], yr[7]))
+ {
+ Tfloat XMR, YMR;
+ xmr = ymr = (float ) shortreallast ();
+ XMR = YMR = (float ) shortrealfirst ();
+ /*
+ * Recherche du rectangle projete
+ */
+ Tint i;
+ for (i=0; i<8; i++) {
+ if (xmr > xr[i]) xmr = xr[i];
+ if (ymr > yr[i]) ymr = yr[i];
+ if (XMR < xr[i]) XMR = xr[i];
+ if (YMR < yr[i]) YMR = yr[i];
+ }
+ /* pour eviter les bavures de pixels ! */
+ xmr--;ymr--;
+ XMR++;YMR++;
+
+ /*
+ * Ajout CAL : 10/05/96
+ * Si les MinMax viennent d'un ensemble de markers
+ * on ne tient pas compte du scale factor de ceux-ci
+ * dans les valeurs de MinMax. En effet, ce facteur
+ * est dans l'espace pixel et les MinMax dans l'espace
+ * du modele. Donc ajout d'un delta de pixels
+ * en esperant que les applis n'utilisent pas des
+ * markers tres gros !
+ */
+ xmr -= CALL_DEF_DELTA; ymr -= CALL_DEF_DELTA;
+ XMR += CALL_DEF_DELTA; YMR += CALL_DEF_DELTA;
+
+ /*
+ * Le rectangle projete peut-etre clippe
+ */
+ width = (GLsizei) (XMR-xmr+1);
+ height = (GLsizei) (YMR-ymr+1);
+ /*
+ * (xmr,ymr) coin inferieur gauche
+ * (XMR,YMR) coin superieur droit
+ */
+ /* cas ou 1 coin est en dehors de la fenetre */
+ if (xmr < 0) { width = (GLsizei) (XMR+1); xmr = 0; }
+ if (ymr < 0) { height = (GLsizei) (YMR+1); ymr = 0; }
+ if (XMR > myWidth) { width = (GLsizei) (myWidth-xmr+1); }
+ if (YMR > myHeight) { height = (GLsizei) (myHeight-ymr+1); }
+
+ /* cas ou les 2 coins sont en dehors de la fenetre */
+ if (XMR < 0) { xmr = 0; width = height = 1; }
+ if (YMR < 0) { ymr = 0; width = height = 1; }
+ if (xmr > myWidth) { xmr = 0; width = height = 1; }
+ if (ymr > myHeight) { ymr = 0; width = height = 1; }
+ }
+ }
+ }
+
+ glDrawBuffer (FrontToBack? GL_BACK : GL_FRONT);
+ glReadBuffer (FrontToBack? GL_FRONT : GL_BACK);
+ /* copie complete */
+ glRasterPos2i ((GLint) xmr, (GLint) ymr);
+ glCopyPixels ((GLint) xmr, (GLint) ymr, width, height, GL_COLOR);
+
+ EnableFeatures();
+
+ glMatrixMode (GL_PROJECTION);
+ glPopMatrix ();
+ glMatrixMode (GL_MODELVIEW);
+ glPopMatrix ();
+
+ glDrawBuffer (GL_BACK);
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_subr_displayCB
+void OpenGl_Workspace::DisplayCallback (const Graphic3d_CView& ACView, int reason)
+{
+ if( ACView.GDisplayCB )
+ {
+ Aspect_GraphicCallbackStruct callData;
+ callData.reason = reason;
+ callData.display = (DISPLAY*)myDisplay->GetDisplay();
+ callData.window = (WINDOW)myWindow;
+ callData.wsID = ACView.WsId;
+ callData.viewID = ACView.ViewId;
+ callData.gcontext = myGContext;
+
+ int status = (*ACView.GDisplayCB)( ACView.DefWindow.XWindow, ACView.GClientData, &callData );
+ }
+}
+
+/*----------------------------------------------------------------------*/
--- /dev/null
+// File: OpenGl_Workspace_3.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#define BUC60863 /*GG_100401 After any view update, made identical
+// the front and back buffer to avoid ghost drawing.
+// Minimize flicking.
+*/
+
+#define IMP150501 /*GG_150501 CADPAK_V2 Enable/Disable Zbuffer
+NOTE that the previous and unused "double-buffer"
+arg is changed to "zbuffer" and enable/disable
+to use the OpenGl zbuffer capabilities during immediat
+drawing
+*/
+
+#define IMP260601 /*GG Enable correct backing store between 2 different views.
+*/
+
+/*----------------------------------------------------------------------*/
+
+#define RIC120302 /* GG Enable to use the application display
+// callback at end of traversal
+*/
+
+/*
+* Includes
+*/
+#include <math.h>
+#include <stdio.h>
+
+#ifdef HAVE_GL2PS
+ #include <gl2ps.h>
+#endif
+
+#include <OpenGl_Context.hxx>
+#include <OpenGl_telem_util.hxx>
+#include <OpenGl_AspectLine.hxx>
+#include <OpenGl_Structure.hxx>
+
+/*----------------------------------------------------------------------*/
+/*
+* Prototypes Private functions
+*/
+
+static void call_util_transform_pt (float *x, float *y, float *z);
+static void call_util_transpose_mat (float tmat[16], float mat[4][4]);
+
+/*----------------------------------------------------------------------*/
+/*
+* Variables statiques
+*/
+
+static int openglNumberOfPoints = 0;
+
+static int myImmediateMatIsIdentity = 1;
+
+static int partial = -1; /* -1 init, 0 complete, 1 partielle */
+
+static float xm, ym, zm, XM, YM, ZM;
+
+static float myImmediateMat[4][4] = {
+ {1., 0., 0., 0.},
+ {0., 1., 0., 0.},
+ {0., 0., 1., 0.},
+ {0., 0., 0., 1.},
+};
+
+/*----------------------------------------------------------------------*/
+/* Mode Ajout */
+/*----------------------------------------------------------------------*/
+
+//call_togl_begin_ajout_mode
+Standard_Boolean OpenGl_Workspace::BeginAddMode ()
+{
+ if (!Activate())
+ return Standard_False;
+
+ NamedStatus |= OPENGL_NS_ADD;
+
+ MakeFrontAndBackBufCurrent();
+
+ //TsmPushAttri();
+
+ return Standard_True;
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_end_ajout_mode
+void OpenGl_Workspace::EndAddMode ()
+{
+ if (NamedStatus & OPENGL_NS_ADD)
+ {
+ OpenGl_Workspace::MakeBackBufCurrent();
+
+ // Clear add mode flag
+ NamedStatus &= ~OPENGL_NS_ADD;
+ }
+
+ myImmediateMatIsIdentity = 1;
+
+ /* FMN necessaire pour l'affichage sur WNT */
+ glFlush();
+
+ //TsmPopAttri();
+}
+
+/*----------------------------------------------------------------------*/
+/* Mode Transient */
+/*----------------------------------------------------------------------*/
+
+//call_togl_clear_immediat_mode
+void OpenGl_Workspace::ClearImmediatMode (const Graphic3d_CView& ACView, const Standard_Boolean AFlush)
+{
+ if ( myIsTransientOpen )
+ EndImmediatMode();
+
+ if (!Activate()) return;
+
+ if ( !myBackBufferRestored )
+ {
+ EraseAnimation();
+
+ Redraw1(ACView,*((CALL_DEF_LAYER *)ACView.ptrUnderLayer),*((CALL_DEF_LAYER *)ACView.ptrOverLayer),AFlush);
+
+ // After a redraw,
+ // Made the back identical to the front buffer.
+ // Always perform full copy (partial update optimization is useless on mordern hardware)!
+ if (myRetainMode)
+ CopyBuffers (ACView.ViewId, 1 /* GL_FRONT -> GL_BACK */, xm, ym, zm, XM, YM, ZM, 0);
+
+ myBackBufferRestored = Standard_True;
+ }
+ else if ( partial >= 0 )
+ {
+ // Restore pixels from the back buffer.
+ // Always perform full copy (partial update optimization is useless on mordern hardware)!
+ CopyBuffers (ACView.ViewId, 0 /* GL_BACK -> GL_FRONT */, xm, ym, zm, XM, YM, ZM, 0);
+ }
+
+ if (myTransientList)
+ {
+ /* Clear current list contents */
+ glNewList( (GLuint) myTransientList, GL_COMPILE_AND_EXECUTE);
+ glEndList();
+ }
+ partial = -1;
+ XM = YM = ZM = (float ) shortrealfirst ();
+ xm = ym = zm = (float ) shortreallast ();
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_redraw_immediat_mode
+void OpenGl_Workspace::RedrawImmediatMode ()
+{
+ if (myRetainMode)
+ {
+ if (myTransientList)
+ {
+ MakeFrontBufCurrent();
+ glDisable(GL_LIGHTING);
+ glCallList((GLuint) myTransientList);
+ /* FMN necessaire pour l'affichage sur WNT */
+ glFlush();
+ MakeBackBufCurrent();
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_begin_immediat_mode
+Standard_Boolean OpenGl_Workspace::BeginImmediatMode (const Graphic3d_CView& ACView, const Standard_Boolean UseDepthTest, const Standard_Boolean RetainMode)
+{
+ if (!Activate())
+ return Standard_False;
+
+ OpenGl_Workspace::ClearImmediatMode(ACView,1);
+
+ NamedStatus |= OPENGL_NS_IMMEDIATE;
+ myRetainMode = RetainMode;
+
+ MakeFrontBufCurrent();
+
+ //TsmPushAttri();
+
+ if ( myRetainMode )
+ {
+ GLuint listid = (GLuint) myTransientList;
+ if (!listid)
+ listid = glGenLists(1);
+ if (!listid) return Standard_False;
+
+ glNewList(listid, GL_COMPILE_AND_EXECUTE);
+ myTransientList = listid;
+ myIsTransientOpen = Standard_True;
+ }
+
+ if ( UseDepthTest )
+ glEnable(GL_DEPTH_TEST);
+ else
+ glDisable(GL_DEPTH_TEST);
+
+ return Standard_True;
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_end_immediat_mode
+void OpenGl_Workspace::EndImmediatMode ()
+{
+ if (NamedStatus & OPENGL_NS_IMMEDIATE)
+ {
+ if (myIsTransientOpen)
+ {
+ glEndList();
+ myIsTransientOpen = Standard_False;
+ }
+ MakeBackBufCurrent();
+
+ // Clear immediate mode flag
+ NamedStatus &= ~OPENGL_NS_IMMEDIATE;
+ }
+
+ // Ajout CAL : pour voir quelque chose avant le prochain begin_immediat_mode
+ glFinish ();
+
+ myImmediateMatIsIdentity = 1;
+
+ //TsmPopAttri();
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_transform
+void OpenGl_Workspace::Transform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType)
+{
+ //call_togl_transform in OpenGl_togl_begin_immediat_mode.cxx
+ const Standard_Integer lr = AMatrix.LowerRow ();
+ const Standard_Integer lc = AMatrix.LowerCol ();
+
+ Standard_Integer i, j;
+ if ((AType == Graphic3d_TOC_REPLACE) || myImmediateMatIsIdentity)
+ {
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ myImmediateMat[i][j] = float (AMatrix (i+lr, j+lc));
+ }
+ else
+ {
+ float theMatrix[4][4];
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ theMatrix[i][j] = float (AMatrix (i+lr, j+lc));
+
+ TelMultiplymat3 (myImmediateMat, myImmediateMat, theMatrix);
+ }
+
+ myImmediateMatIsIdentity = 1;
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++)
+ if (myImmediateMat[i][j] != (i == j? 1. : 0.))
+ {
+ myImmediateMatIsIdentity = 0;
+ return;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_begin_polyline
+void OpenGl_Workspace::BeginPolyline ()
+{
+ if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE))
+ {
+ openglNumberOfPoints = 0;
+ glDisable(GL_LIGHTING);
+ glBegin(GL_LINE_STRIP);
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_end_polyline
+void OpenGl_Workspace::EndPolyline ()
+{
+ if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE))
+ glEnd();
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_draw
+void OpenGl_Workspace::Draw (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z)
+{
+ if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE))
+ {
+ openglNumberOfPoints++;
+ float x = X, y = Y, z = Z;
+ if (!myImmediateMatIsIdentity)
+ call_util_transform_pt (&x, &y, &z);
+ if (x > XM) XM = x;
+ if (y > YM) YM = y;
+ if (z > ZM) ZM = z;
+ if (x < xm) xm = x;
+ if (y < ym) ym = y;
+ if (z < zm) zm = z;
+ glVertex3f (x, y, z);
+ partial = 1;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_move
+void OpenGl_Workspace::Move (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z)
+{
+ if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE))
+ {
+ if (openglNumberOfPoints != 0)
+ {
+ OpenGl_Workspace::EndPolyline();
+ OpenGl_Workspace::BeginPolyline();
+ }
+ OpenGl_Workspace::Draw(X,Y,Z);
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_set_linecolor
+void OpenGl_Workspace::SetLineColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B)
+{
+ if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE))
+ {
+ GLfloat color[3];
+ color[0] = R;
+ color[1] = G;
+ color[2] = B;
+ glColor3fv(color);
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_set_linetype
+void OpenGl_Workspace::SetLineType (const Standard_Integer Type)
+{
+ if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE))
+ {
+ myDisplay->SetTypeOfLine((Aspect_TypeOfLine)Type);
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_set_linewidth
+void OpenGl_Workspace::SetLineWidth (const Standard_ShortReal Width)
+{
+ if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE))
+ {
+ glLineWidth( (GLfloat)Width );
+#ifdef HAVE_GL2PS
+ gl2psLineWidth( (GLfloat)Width );
+#endif
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_draw_structure
+void OpenGl_Workspace::DrawStructure (const OpenGl_Structure *AStructure)
+{
+ if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE))
+ {
+ float mat16[16];
+ GLint mode1;
+
+ //TsmPushAttri();
+
+ /* mise en place de la matrice de transformation du trace transient */
+ if (!myImmediateMatIsIdentity)
+ {
+ call_util_transpose_mat (mat16, myImmediateMat);
+ glGetIntegerv (GL_MATRIX_MODE, &mode1);
+ glMatrixMode (GL_MODELVIEW);
+ glPushMatrix ();
+ glScalef (1.F, 1.F, 1.F);
+ glMultMatrixf (mat16);
+ }
+
+ // Render structure
+ Handle(OpenGl_Workspace) aWS(this);
+ AStructure->Render(aWS);
+
+ //TsmPopAttri();
+
+ if (!myImmediateMatIsIdentity)
+ {
+ glPopMatrix ();
+ glMatrixMode (mode1);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+//call_togl_set_minmax
+void OpenGl_Workspace::SetMinMax (const Standard_ShortReal X1, const Standard_ShortReal Y1, const Standard_ShortReal Z1, const Standard_ShortReal X2, const Standard_ShortReal Y2, const Standard_ShortReal Z2)
+{
+ if ((X1 > shortreallast ()) || (Y1 > shortreallast ()) || (Z1 > shortreallast ()) ||
+ (X2 > shortreallast ()) || (Y2 > shortreallast ()) || (Z2 > shortreallast ()) ||
+ (X1 < shortrealfirst ()) || (Y1 < shortrealfirst ()) || (Z1 < shortrealfirst ()) ||
+ (X2 < shortrealfirst ()) || (Y2 < shortrealfirst ()) || (Z2 < shortrealfirst ()))
+ {
+ XM = YM = ZM = (float ) shortreallast ();
+ xm = ym = zm = (float ) shortrealfirst ();
+ partial = 0;
+ }
+ else
+ {
+ float x1=X1,y1=Y1,z1=Z1,x2=X2,y2=Y2,z2=Z2;
+ if (!myImmediateMatIsIdentity)
+ {
+ call_util_transform_pt (&x1, &y1, &z1);
+ call_util_transform_pt (&x2, &y2, &z2);
+ }
+ if (x1 > XM) XM = x1;
+ if (x1 < xm) xm = x1;
+ if (y1 > YM) YM = y1;
+ if (y1 < ym) ym = y1;
+ if (z1 > ZM) ZM = z1;
+ if (z1 < zm) zm = z1;
+
+ if (x2 > XM) XM = x2;
+ if (x2 < xm) xm = x2;
+ if (y2 > YM) YM = y2;
+ if (y2 < ym) ym = y2;
+ if (z2 > ZM) ZM = z2;
+ if (z2 < zm) zm = z2;
+ if (partial != 0) partial = 1;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+/*
+* Private functions
+*/
+
+/*----------------------------------------------------------------------*/
+/*
+Transform the point pt
+*/
+static void call_util_transform_pt ( float *x, float *y, float *z )
+{
+ float tpt[4], pt[4];
+ pt[0] = *x, pt[1] = *y, pt[2] = *z, pt[3] = 1.0;
+
+ int i, j;
+ for (i = 0; i < 4; i++)
+ {
+ float sum = 0.;
+ for (j = 0; j < 4; j++)
+ sum += myImmediateMat[i][j] * pt[j];
+ tpt[i] = sum;
+ }
+
+ *x = tpt[0], *y = tpt[1], *z = tpt[2];
+}
+
+/*----------------------------------------------------------------------*/
+/*
+void call_util_transpose_mat (tmat, mat)
+float tmat[16];
+float mat[4][4];
+
+Transpose mat and returns tmat.
+*/
+
+static void call_util_transpose_mat (float tmat[16], float mat[4][4])
+{
+ int i, j;
+
+ for (i=0; i<4; i++)
+ for (j=0; j<4; j++)
+ tmat[j*4+i] = mat[i][j];
+}
--- /dev/null
+// File: OpenGl_Workspace_3.cxx
+// Created: 20 September 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#if (defined(_WIN32) || defined(__WIN32__))
+ #include <OpenGl_AVIWriter.hxx>
+#else
+ #define CALL_DEF_STRING_LENGTH 132
+#endif
+#include <OpenGl_tgl_all.hxx>
+
+#include <OpenGl_FrameBuffer.hxx>
+#include <OpenGl_ResourceCleaner.hxx>
+#include <InterfaceGraphic_Graphic3d.hxx>
+#include <InterfaceGraphic_Visual3d.hxx>
+
+#include <OpenGl_Workspace.hxx>
+
+//call_togl_redraw
+void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView,
+ const Aspect_CLayer2d& theCUnderLayer,
+ const Aspect_CLayer2d& theCOverLayer)
+{
+ if (!Activate())
+ return;
+
+ // release pending GL resources
+ OpenGl_ResourceCleaner::GetInstance()->Cleanup (GetGlContext());
+
+ Tint toSwap = 1; // swap buffers
+ GLint aViewPortBack[4];
+ OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )theCView.ptrFBO;
+ if (aFrameBuffer != NULL)
+ {
+ glGetIntegerv (GL_VIEWPORT, aViewPortBack);
+ aFrameBuffer->SetupViewport();
+ aFrameBuffer->BindBuffer (GetGlContext());
+ toSwap = 0; // no need to swap buffers
+ }
+
+ Redraw1 (theCView, theCUnderLayer, theCOverLayer, toSwap);
+ RedrawImmediatMode();
+
+ if (aFrameBuffer != NULL)
+ {
+ aFrameBuffer->UnbindBuffer (GetGlContext());
+ // move back original viewport
+ glViewport (aViewPortBack[0], aViewPortBack[1], aViewPortBack[2], aViewPortBack[3]);
+ }
+
+#if (defined(_WIN32) || defined(__WIN32__))
+ if (OpenGl_AVIWriter_AllowWriting (theCView.DefWindow.XWindow))
+ {
+ GLint params[4];
+ glGetIntegerv (GL_VIEWPORT, params);
+ int nWidth = params[2] & ~0x7;
+ int nHeight = params[3] & ~0x7;
+
+ const int nBitsPerPixel = 24;
+ GLubyte* aDumpData = new GLubyte[nWidth * nHeight * nBitsPerPixel / 8];
+
+ glPixelStorei (GL_PACK_ALIGNMENT, 1);
+ glReadPixels (0, 0, nWidth, nHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, aDumpData);
+ OpenGl_AVIWriter_AVIWriter (aDumpData, nWidth, nHeight, nBitsPerPixel);
+ delete[] aDumpData;
+ }
+#endif
+}
--- /dev/null
+// File: OpenGl_Workspace_5.cxx
+// Created: 5 August 2011
+// Author: Sergey ZERCHANINOV
+// Copyright: OPEN CASCADE 2011
+
+#include <OpenGl_Workspace.hxx>
+
+#include <OpenGl_AspectLine.hxx>
+#include <OpenGl_AspectFace.hxx>
+#include <OpenGl_AspectMarker.hxx>
+#include <OpenGl_AspectText.hxx>
+
+/* OCC22218 NOTE: project dependency on gl2ps is specified by macro */
+#ifdef HAVE_GL2PS
+ #include <gl2ps.h>
+ /* OCC22216 NOTE: linker dependency can be switched off by undefining macro.
+ Pragma comment for gl2ps.lib is defined only here. */
+ #ifdef _MSC_VER
+ #pragma comment( lib, "gl2ps.lib" )
+ #endif
+#endif
+
+#include <OpenGl_tgl_all.hxx>
+#include <GL/gl.h>
+
+#include <OpenGl_TextureBox.hxx>
+
+#include <Aspect_PolygonOffsetMode.hxx>
+
+#include <OpenGl_View.hxx>
+
+/*----------------------------------------------------------------------*/
+
+static void TelUpdatePolygonOffsets( const TEL_POFFSET_PARAM *pdata )
+{
+ if ( ( pdata->mode & Aspect_POM_Fill ) == Aspect_POM_Fill )
+ glEnable ( GL_POLYGON_OFFSET_FILL );
+ else
+ glDisable ( GL_POLYGON_OFFSET_FILL );
+
+ if ( ( pdata->mode & Aspect_POM_Line ) == Aspect_POM_Line )
+ glEnable ( GL_POLYGON_OFFSET_LINE );
+ else
+ glDisable( GL_POLYGON_OFFSET_LINE );
+
+ if ( ( pdata->mode & Aspect_POM_Point ) == Aspect_POM_Point )
+ glEnable ( GL_POLYGON_OFFSET_POINT );
+ else
+ glDisable( GL_POLYGON_OFFSET_POINT );
+
+ glPolygonOffset( pdata->factor, pdata->units );
+}
+
+/*----------------------------------------------------------------------*/
+
+void OpenGl_Workspace::UpdateMaterial( const int flag )
+{
+ // Case of Hiddenline
+ if (AspectFace_set->Context().InteriorStyle == Aspect_IS_HIDDENLINE)
+ {
+ /* szvgl - IMPORTANT!!! */
+ static TEL_CONTEXT_FACE hl_context_face;
+ static OpenGl_AspectFace hl_aspect_face;
+
+ hl_context_face = AspectFace_set->Context();
+
+ hl_context_face.IntFront.matcol = BackgroundColor();
+ hl_context_face.IntFront.color_mask = 0;
+ hl_context_face.IntBack.color_mask = 0;
+
+ hl_aspect_face.SetContext(hl_context_face);
+ hl_aspect_face.SetAspectEdge(AspectFace_set->AspectEdge());
+
+ AspectFace_set = &hl_aspect_face;
+ return;
+ }
+
+ const OPENGL_SURF_PROP *prop = NULL;
+ GLenum face = 0;
+ if ( flag == TEL_FRONT_MATERIAL )
+ {
+ prop = &AspectFace_set->Context().IntFront;
+ face = GL_FRONT_AND_BACK;
+ }
+ else
+ {
+ prop = &AspectFace_set->Context().IntBack;
+ face = GL_BACK;
+ }
+
+ const unsigned int rm = prop->color_mask;
+
+ if ( !rm ) return;
+
+ // Handling transparency
+ if ( (NamedStatus & OPENGL_NS_2NDPASSDO) == 0 )
+ {
+ if ( myUseTransparency && prop->trans != 1.0F )
+ {
+ // Render transparent
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable (GL_BLEND);
+ glDepthMask (GL_FALSE);
+ }
+ else
+ {
+ // Render opaque
+ if ( (NamedStatus & OPENGL_NS_ANTIALIASING) == 0 )
+ {
+ glBlendFunc (GL_ONE, GL_ZERO);
+ glDisable (GL_BLEND);
+ }
+ glDepthMask (GL_TRUE);
+ }
+ }
+
+ static float mAmb[4];
+ static float mDiff[4];
+ static float mSpec[4];
+ static float mEmsv[4];
+ static float mShin;
+
+ static const float defspeccol[4] = { 1.F, 1.F, 1.F, 1.F };
+
+ // Reset material
+ if ( NamedStatus & OPENGL_NS_RESMAT )
+ {
+ // Ambient component
+ if( rm & OPENGL_AMBIENT_MASK )
+ {
+ const float *c = prop->isphysic? prop->ambcol.rgb : prop->matcol.rgb;
+
+ mAmb[0] = prop->amb * c[0];
+ mAmb[1] = prop->amb * c[1];
+ mAmb[2] = prop->amb * c[2];
+ }
+ else
+ {
+ mAmb[0] = 0.F;
+ mAmb[1] = 0.F;
+ mAmb[2] = 0.F;
+ }
+ mAmb[3] = 1.F;
+
+ // Diffusion component
+ if( rm & OPENGL_DIFFUSE_MASK )
+ {
+ const float *c = prop->isphysic? prop->difcol.rgb : prop->matcol.rgb;
+
+ mDiff[0] = prop->diff * c[0];
+ mDiff[1] = prop->diff * c[1];
+ mDiff[2] = prop->diff * c[2];
+ }
+ else
+ {
+ mDiff[0] = 0.F;
+ mDiff[1] = 0.F;
+ mDiff[2] = 0.F;
+ }
+ mDiff[3] = 1.F;
+
+ if (NamedStatus & OPENGL_NS_2NDPASSDO)
+ {
+ mDiff[3] = prop->env_reflexion;
+ }
+ else
+ {
+ if (myUseTransparency) mDiff[3] = prop->trans;
+ // If the material reflects the environment scene, the second pass is needed
+ if (prop->env_reflexion != 0.0) NamedStatus |= OPENGL_NS_2NDPASSNEED;
+ }
+
+ // Specular component
+ if( rm & OPENGL_SPECULAR_MASK )
+ {
+ const float *c = prop->isphysic? prop->speccol.rgb : defspeccol;
+
+ mSpec[0] = prop->spec * c[0];
+ mSpec[1] = prop->spec * c[1];
+ mSpec[2] = prop->spec * c[2];
+ }
+ else {
+ mSpec[0] = 0.F;
+ mSpec[1] = 0.F;
+ mSpec[2] = 0.F;
+ }
+ mSpec[3] = 1.F;
+
+ // Emissive component
+ if( rm & OPENGL_EMISSIVE_MASK )
+ {
+ const float *c = prop->isphysic? prop->emscol.rgb : prop->matcol.rgb;
+
+ mEmsv[0] = prop->emsv * c[0];
+ mEmsv[1] = prop->emsv * c[1];
+ mEmsv[2] = prop->emsv * c[2];
+ }
+ else {
+ mEmsv[0] = 0.F;
+ mEmsv[1] = 0.F;
+ mEmsv[2] = 0.F;
+ }
+ mEmsv[3] = 1.F;
+
+ /* Coeficient de brillance */
+ mShin = prop->shine;
+
+ glMaterialfv(face, GL_AMBIENT, mAmb );
+ glMaterialfv(face, GL_DIFFUSE, mDiff );
+ glMaterialfv(face, GL_SPECULAR, mSpec);
+ glMaterialfv(face, GL_EMISSION, mEmsv);
+ glMaterialf(face, GL_SHININESS, mShin);
+
+ NamedStatus &= ~OPENGL_NS_RESMAT;
+ }
+
+ // Set Material Optimize
+ else
+ {
+ // Ambient component
+ if( rm & OPENGL_AMBIENT_MASK )
+ {
+ const float *c = prop->isphysic? prop->ambcol.rgb : prop->matcol.rgb;
+
+ if (mAmb[0] != prop->amb * c[0] ||
+ mAmb[1] != prop->amb * c[1] ||
+ mAmb[2] != prop->amb * c[2] )
+ {
+ mAmb[0] = prop->amb * c[0];
+ mAmb[1] = prop->amb * c[1];
+ mAmb[2] = prop->amb * c[2];
+ mAmb[3] = 1.F;
+
+ glMaterialfv(face, GL_AMBIENT, mAmb);
+ }
+ }
+ else
+ {
+ if ( mAmb[0] != 0.F || mAmb[1] != 0.F || mAmb[2] != 0.F )
+ {
+ mAmb[0] = 0.F;
+ mAmb[1] = 0.F;
+ mAmb[2] = 0.F;
+ mAmb[3] = 1.F;
+
+ glMaterialfv(face, GL_AMBIENT, mAmb);
+ }
+ }
+
+ // Diffusion component
+ if( rm & OPENGL_DIFFUSE_MASK )
+ {
+ const float *c = prop->isphysic? prop->difcol.rgb : prop->matcol.rgb;
+
+ if (mDiff[0] != prop->diff * c[0] ||
+ mDiff[1] != prop->diff * c[1] ||
+ mDiff[2] != prop->diff * c[2] ||
+ mDiff[3] != ((NamedStatus & OPENGL_NS_2NDPASSDO)? prop->env_reflexion : (myUseTransparency? prop->trans : 1.0F)))
+ {
+ mDiff[0] = prop->diff * c[0];
+ mDiff[1] = prop->diff * c[1];
+ mDiff[2] = prop->diff * c[2];
+ mDiff[3] = 1.F;
+
+ if (NamedStatus & OPENGL_NS_2NDPASSDO)
+ {
+ mDiff[3] = prop->env_reflexion;
+ }
+ else
+ {
+ if (myUseTransparency) mDiff[3] = prop->trans;
+ // If the material reflects the environment scene, the second pass is needed
+ if (prop->env_reflexion != 0.0) NamedStatus |= OPENGL_NS_2NDPASSNEED;
+ }
+
+ glMaterialfv(face, GL_DIFFUSE, mDiff );
+ }
+ }
+ else
+ {
+ Tfloat newDiff3 = 1.F;
+
+ if (NamedStatus & OPENGL_NS_2NDPASSDO)
+ {
+ newDiff3 = prop->env_reflexion;
+ }
+ else
+ {
+ if (myUseTransparency) newDiff3 = prop->trans;
+ // If the material reflects the environment scene, the second pass is needed
+ if (prop->env_reflexion != 0.0) NamedStatus |= OPENGL_NS_2NDPASSNEED;
+ }
+
+ /* OCC19915: Even if diffuse reflectance is disabled,
+ still trying to update the current transparency if it
+ differs from the previous value */
+ if ( mDiff[0] != 0.F || mDiff[1] != 0.F || mDiff[2] != 0.F || fabs(mDiff[3] - newDiff3) > 0.01F )
+ {
+ mDiff[0] = 0.F;
+ mDiff[1] = 0.F;
+ mDiff[2] = 0.F;
+ mDiff[3] = newDiff3;
+
+ glMaterialfv(face, GL_DIFFUSE, mDiff);
+ }
+ }
+
+ // Specular component
+ if( rm & OPENGL_SPECULAR_MASK )
+ {
+ const float *c = prop->isphysic? prop->speccol.rgb : defspeccol;
+
+ if (mSpec[0] != prop->spec * c[0] ||
+ mSpec[1] != prop->spec * c[1] ||
+ mSpec[2] != prop->spec * c[2])
+ {
+ mSpec[0] = prop->spec * c[0];
+ mSpec[1] = prop->spec * c[1];
+ mSpec[2] = prop->spec * c[2];
+ mSpec[3] = 1.F;
+
+ glMaterialfv(face, GL_SPECULAR, mSpec);
+ }
+ }
+ else
+ {
+ if ( mSpec[0] != 0.F || mSpec[1] != 0.F || mSpec[2] != 0.F )
+ {
+ mSpec[0] = 0.F;
+ mSpec[1] = 0.F;
+ mSpec[2] = 0.F;
+ mSpec[3] = 1.F;
+
+ glMaterialfv(face, GL_SPECULAR, mSpec);
+ }
+ }
+
+ // Emissive component
+ if( rm & OPENGL_EMISSIVE_MASK )
+ {
+ const float *c = prop->isphysic? prop->emscol.rgb : prop->matcol.rgb;
+
+ if (mEmsv[0] != prop->emsv * c[0] ||
+ mEmsv[1] != prop->emsv * c[1] ||
+ mEmsv[2] != prop->emsv * c[2])
+ {
+ mEmsv[0] = prop->emsv * c[0];
+ mEmsv[1] = prop->emsv * c[1];
+ mEmsv[2] = prop->emsv * c[2];
+ mEmsv[3] = 1.F;
+
+ glMaterialfv(face, GL_EMISSION, mEmsv);
+ }
+ }
+ else
+ {
+ if ( mEmsv[0] != 0.F || mEmsv[1] != 0.F || mEmsv[2] != 0.F )
+ {
+ mEmsv[0] = 0.F;
+ mEmsv[1] = 0.F;
+ mEmsv[2] = 0.F;
+ mEmsv[3] = 1.F;
+
+ glMaterialfv(face, GL_EMISSION, mEmsv);
+ }
+ }
+
+ // Shining coefficient
+ if( mShin != prop->shine )
+ {
+ mShin = prop->shine;
+ glMaterialf(face, GL_SHININESS, mShin);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+const OpenGl_AspectLine * OpenGl_Workspace::SetAspectLine(const OpenGl_AspectLine *AnAspect)
+{
+ const OpenGl_AspectLine *AspectLine_old = AspectLine_set;
+ AspectLine_set = AnAspect;
+ return AspectLine_old;
+}
+
+/*----------------------------------------------------------------------*/
+
+const OpenGl_AspectFace * OpenGl_Workspace::SetAspectFace(const OpenGl_AspectFace *AnAspect)
+{
+ const OpenGl_AspectFace *AspectFace_old = AspectFace_set;
+ AspectFace_set = AnAspect;
+ return AspectFace_old;
+}
+
+/*----------------------------------------------------------------------*/
+
+const OpenGl_AspectMarker * OpenGl_Workspace::SetAspectMarker(const OpenGl_AspectMarker *AnAspect)
+{
+ const OpenGl_AspectMarker *AspectMarker_old = AspectMarker_set;
+ AspectMarker_set = AnAspect;
+ return AspectMarker_old;
+}
+
+/*----------------------------------------------------------------------*/
+
+const OpenGl_AspectText * OpenGl_Workspace::SetAspectText(const OpenGl_AspectText *AnAspect)
+{
+ const OpenGl_AspectText *AspectText_old = AspectText_set;
+ AspectText_set = AnAspect;
+ return AspectText_old;
+}
+
+/*----------------------------------------------------------------------*/
+
+const OpenGl_Matrix * OpenGl_Workspace::SetViewMatrix(const OpenGl_Matrix *AMatrix)
+{
+ const OpenGl_Matrix *ViewMatrix_old = ViewMatrix_applied;
+ ViewMatrix_applied = AMatrix;
+
+ OpenGl_Matrix lmat;
+ OpenGl_Transposemat3( &lmat, StructureMatrix_applied );
+
+ glMatrixMode (GL_MODELVIEW);
+
+ if ( (NamedStatus & OPENGL_NS_ANIMATION) == 0 )
+ {
+ OpenGl_Matrix rmat;
+ OpenGl_Multiplymat3( &rmat, &lmat, ViewMatrix_applied );
+ glLoadMatrixf((const GLfloat *) rmat.mat);
+ }
+
+ return ViewMatrix_old;
+}
+
+/*----------------------------------------------------------------------*/
+
+const OpenGl_Matrix * OpenGl_Workspace::SetStructureMatrix(const OpenGl_Matrix *AMatrix)
+{
+ const OpenGl_Matrix *StructureMatrix_old = StructureMatrix_applied;
+ StructureMatrix_applied = AMatrix;
+
+ OpenGl_Matrix lmat;
+ OpenGl_Transposemat3( &lmat, AMatrix );
+
+ glMatrixMode (GL_MODELVIEW);
+
+ if ( (NamedStatus & OPENGL_NS_ANIMATION) == 0 )
+ {
+ OpenGl_Matrix rmat;
+ OpenGl_Multiplymat3( &rmat, &lmat, ViewMatrix_applied );
+ glLoadMatrixf((const GLfloat *) rmat.mat);
+ }
+ else
+ {
+ glMultMatrixf((const GLfloat *) lmat.mat);
+ }
+
+ return StructureMatrix_old;
+}
+
+/*----------------------------------------------------------------------*/
+
+const OpenGl_AspectLine * OpenGl_Workspace::AspectLine(const Standard_Boolean WithApply)
+{
+ if ( WithApply && (AspectLine_set != AspectLine_applied) )
+ {
+ glColor3fv(AspectLine_set->Color().rgb);
+
+ if ( !AspectLine_applied || (AspectLine_set->Type() != AspectLine_applied->Type() ) )
+ {
+ myDisplay->SetTypeOfLine(AspectLine_set->Type());
+ }
+
+ if ( !AspectLine_applied || ( AspectLine_set->Width() != AspectLine_applied->Width() ) )
+ {
+ glLineWidth( (GLfloat)AspectLine_set->Width() );
+#ifdef HAVE_GL2PS
+ gl2psLineWidth( (GLfloat)AspectLine_set->Width() );
+#endif
+ }
+
+ AspectLine_applied = AspectLine_set;
+ }
+ return AspectLine_set;
+}
+
+/*----------------------------------------------------------------------*/
+
+const OpenGl_AspectFace * OpenGl_Workspace::AspectFace(const Standard_Boolean WithApply)
+{
+ if ( WithApply && (AspectFace_set != AspectFace_applied) )
+ {
+ const Aspect_InteriorStyle intstyle = AspectFace_set->Context().InteriorStyle;
+ if ( !AspectFace_applied || AspectFace_applied->Context().InteriorStyle != intstyle )
+ {
+ switch( intstyle )
+ {
+ case Aspect_IS_EMPTY:
+ case Aspect_IS_HOLLOW:
+ glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
+ break;
+
+ case Aspect_IS_HATCH:
+ glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
+ myDisplay->SetTypeOfHatch(AspectFace_applied? AspectFace_applied->Context().Hatch : TEL_HS_SOLID);
+ break;
+
+ case Aspect_IS_SOLID:
+ case Aspect_IS_HIDDENLINE:
+ glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
+ glDisable(GL_POLYGON_STIPPLE);
+ break;
+
+ case 5: //szvgl - no corresponding enumeration item Aspect_IS_POINT
+ glPolygonMode(GL_FRONT_AND_BACK,GL_POINT);
+ break;
+ }
+ }
+ if( intstyle == Aspect_IS_HATCH )
+ {
+ const Tint hatchstyle = AspectFace_set->Context().Hatch;
+ if( !AspectFace_applied || AspectFace_applied->Context().Hatch != hatchstyle )
+ {
+ myDisplay->SetTypeOfHatch(hatchstyle);
+ }
+ }
+ if ( !ActiveView()->Backfacing() )
+ {
+ const Tint mode = AspectFace_set->Context().CullingMode;
+ if( !AspectFace_applied || AspectFace_applied->Context().CullingMode != mode )
+ {
+ switch( (TelCullMode)mode )
+ {
+ case TelCullNone:
+ glDisable(GL_CULL_FACE);
+ break;
+
+ case TelCullFront:
+ glCullFace(GL_FRONT);
+ glEnable(GL_CULL_FACE);
+ break;
+
+ case TelCullBack:
+ glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
+ break;
+ }
+ }
+ }
+
+ // Aspect_POM_None means: do not change current settings
+ if ( ( AspectFace_set->Context().PolygonOffset.mode & Aspect_POM_None ) != Aspect_POM_None )
+ {
+ if ( !PolygonOffset_applied ||
+ PolygonOffset_applied->mode != AspectFace_set->Context().PolygonOffset.mode ||
+ PolygonOffset_applied->factor != AspectFace_set->Context().PolygonOffset.factor ||
+ PolygonOffset_applied->units != AspectFace_set->Context().PolygonOffset.units )
+ {
+ PolygonOffset_applied = &AspectFace_set->Context().PolygonOffset;
+ TelUpdatePolygonOffsets( PolygonOffset_applied );
+ }
+ }
+
+ UpdateMaterial( TEL_FRONT_MATERIAL );
+ if (AspectFace_set->Context().DistinguishingMode == TOn)
+ UpdateMaterial( TEL_BACK_MATERIAL );
+
+ if ((NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0)
+ {
+ DisableTexture();
+ if (AspectFace_set->Context().doTextureMap)
+ {
+ SetCurrentTexture(AspectFace_set->Context().TexId);
+ EnableTexture();
+ }
+ }
+
+ AspectFace_applied = AspectFace_set;
+ }
+ return AspectFace_set;
+}
+
+/*----------------------------------------------------------------------*/
+
+const OpenGl_AspectMarker * OpenGl_Workspace::AspectMarker(const Standard_Boolean WithApply)
+{
+ if ( WithApply && (AspectMarker_set != AspectMarker_applied) )
+ {
+ AspectMarker_applied = AspectMarker_set;
+ }
+ return AspectMarker_set;
+}
+
+/*----------------------------------------------------------------------*/
+
+const OpenGl_AspectText * OpenGl_Workspace::AspectText(const Standard_Boolean WithApply)
+{
+ if ( WithApply )
+ {
+ Standard_Boolean toApply = Standard_False;
+ if ( AspectText_set != AspectText_applied )
+ {
+ if ( !AspectText_applied )
+ toApply = Standard_True;
+ else if ( strcmp( AspectText_set->Font(), AspectText_applied->Font() ) ||
+ ( AspectText_set->FontAspect() != AspectText_applied->FontAspect() ) )
+ toApply = Standard_True;
+
+ AspectText_applied = AspectText_set;
+ }
+ if ( TextParam_set != TextParam_applied )
+ {
+ if ( !TextParam_applied )
+ toApply = Standard_True;
+ else if ( TextParam_set->Height != TextParam_applied->Height )
+ toApply = Standard_True;
+
+ TextParam_applied = TextParam_set;
+ }
+ if ( toApply )
+ {
+ FindFont(AspectText_applied->Font(), AspectText_applied->FontAspect(), TextParam_applied->Height);
+ }
+ }
+ return AspectText_set;
+}
+
+/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_telem_filters.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus AddNamesetDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus AddNamesetAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus AddNamesetDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus AddNamesetPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus AddNamesetInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- AddNamesetDisplay, /* PickTraverse */
- AddNamesetDisplay,
- AddNamesetAdd,
- AddNamesetDelete,
- AddNamesetPrint,
- AddNamesetInquire
-};
-
-MtblPtr
-TelAddNamesetInitClass( TelType* el )
-{
- *el = TelAddNameset;
- return MtdTbl;
-}
-
-static TStatus
-AddNamesetAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tint i, num, *ptr;
- tel_tint_data data;
-
- num = k[0]->id;
- data = new TEL_TINT_DATA();
- if( !data )
- return TFailure;
-
- data->data = new int[num];
- if( !data->data )
- return TFailure;
-
- for( i=0, ptr=(Tint*)(k[0]->data.pdata); i<num; i++ )
- {
- data->data[i] = ptr[i];
- }
- data->num = num;
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-AddNamesetDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_tint_data d;
-
- d = (tel_tint_data)data.pdata;
- TglNamesetAdd( d->num, d->data );
- return TSuccess;
-}
-
-static TStatus
-AddNamesetDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-AddNamesetPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_tint_data p;
-
- p = (tel_tint_data)data.pdata;
-
- fprintf( stdout, "TelAddNameset. Number: %d\n", p->num );
- for( i = 0; i < p->num; i++ )
- {
- fprintf( stdout, "\n\t\t v[%d] = %d", i, p->data[i] );
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-AddNamesetInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_tint_data d;
- Tint size_reqd = 0;
- TStatus status = TSuccess;
-
- d = (tel_tint_data)data.pdata;
-
- size_reqd = d->num * sizeof( Tint );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- w->name_set.number = d->num;
- if( c->size >= size_reqd )
- {
- w->name_set.integers = (Tint *)(c->buf);
- //cmn_memcpy(w->name_set.integers, d->data, d->num);
- memcpy( w->name_set.integers, d->data, d->num*sizeof(int) );
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_animation.h :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-17-03-98 : FMN ; Creation.
-08-07-98 : FMN ; Changement du nom de la primitive call_togl_erase_immediat_mode()
--> call_togl_erase_animation_mode.
-15-07-98 : FMN ; Portage Optimizer
-
-************************************************************************/
-
-#ifndef OPENGL_ANIMATION_H
-#define OPENGL_ANIMATION_H
-
-/*----------------------------------------------------------------------*/
-/*
-* Include
-*/
-
-#include <GL/gl.h>
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions externes
-*/
-
-extern void call_togl_erase_animation_mode(void);
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-/* La display-list utilisee pour le mode animation */
-extern GLuint listIndex;
-
-/* La vue de reference pour le mode animation */
-extern int listIndexView;
-
-/* Flag si la display-list a ete initialise*/
-extern GLboolean listIndexFlag;
-
-/* Flag mode animation en cours */
-extern GLboolean animationFlag;
-
-/* Flag si le mode animation est disponible
-* (cf. var environnement CALL_ANIMATION) */
-extern GLboolean animationUseFlag;
-
-/*----------------------------------------------------------------------*/
-
-#endif /* OPENGL_ANIMATION_H */
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_antialias :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-01-04-96 : CAL ; Integration MINSK portage WNT
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-/*----------------------------------------------------------------------*/
-
-static TStatus AntiAliasingAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus AntiAliasingDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus AntiAliasingPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus AntiAliasingInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*----------------------------------------------------------------------*/
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- AntiAliasingDisplay,
- AntiAliasingAdd,
- 0, /* Delete */
- AntiAliasingPrint,
- AntiAliasingInquire
-};
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr
-TelAntiAliasingInitClass( TelType *el )
-{
- *el = TelAntiAliasing;
- return MtdTbl;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-AntiAliasingAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-AntiAliasingDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelAntiAliasing;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-AntiAliasingPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if( data.ldata == TOn )
- fprintf( stdout, "TelAntiAliasing. Value = ON\n" );
- else
- fprintf( stdout, "TelAntiAliasing. Value = OFF\n" );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-AntiAliasingInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus ApplicationDataAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ApplicationDataPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ApplicationDataInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- 0, /* Display */
- ApplicationDataAdd,
- 0, /* Delete */
- ApplicationDataPrint,
- ApplicationDataInquire
-};
-
-
-MtblPtr
-TelApplicationDataInitClass( TelType *el )
-{
- *el = TelApplicationData;
- return MtdTbl;
-}
-
-static TStatus
-ApplicationDataAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->pdata = k[0]->data.pdata;
-
- return TSuccess;
-}
-
-
-static TStatus
-ApplicationDataPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelApplicationData. Value = %lx\n",(long ) data.pdata);
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-ApplicationDataInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->data = (Tchar*)data.pdata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_attri :
-
-
-REMARQUES:
-----------
-
-ATTENTION: Actuellement les materiaux ont le Front et Back identiques.
-(cf PRO6327). On met temporairement de cote le mode Distinguish.
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-06-03-96 : FMN ; Ajout OpenGl_tgl_tox.h pour call_thedisplay
-01-04-96 : CAL ; Integration MINSK portage WNT
-12-04-96 : CAL ; Travail sur les materiaux
-07-05-96 : CAL ; Debug temporaire pour ROB, TelRobSetRGB ()
-10-06-96 : CAL ; Transparence dans TsmSetAttri
-13-06-96 : CAL ; Introduction de TsmPushAttriLight et TsmPopAttriLight
-28-06-96 : FMN ; Amelioration des performances sur les materiaux
-01-07-96 : FMN ; Correction + performance antialiasing;
-03-07-96 : FMN ; Test sur ZBuffer avant appel a TelUpdateMaterial.
-17-07-96 : FMN ; Suppression de HLHSRMode.
-07-10-96 : FMN ; Suppression appel TelUpdateMaterial et define TELCO.
-08-11-96 : FMN ; Suppression code CAL_OPTIM
-21-11-96 : FMN ; Correction PRO6181 et PRO4138 Suppression (balise FMN)
-05-12-96 : FMN ; PRO6327: Pas defaut on positionne les materiaux pour
-le front et le back.
-15-02-97 : FMN ; Suppression OpenGl_gl_compat.h
-25-02-97 : FMN ; Ajout print informations
-30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox.
-03-07-97 : PCT ; Modif material.
-05-08-97 : PCT ; support texture mapping
-21-08-97 : PCT ; ajout deuxieme passe pour les textures
-08-12-97 : FMN ; Correction Flat/Gouraud
-09-12-97 : FMN ; Correction Antialing + Textures + Transparence
-22-12-97 : FMN ; Suppression DEBUG_TEMPO_FOR_ROB
-Correction PRO10217 sur le mode Transient
-23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
-et TelBackInteriorShadingMethod
-30-12-97 : FMN ; CTS18312: Correction back material
-31-12-97 : FMN ; Optimisation gestion material
-15-01-98 : FMN ; Ajout Hidden line
-08-04-98 : FGU ; Ajout emission
-30-06-98 : FMN ; Correction init des materiaux dans TelUpdateMateriaux.
-08-07-98 : FMN ; PRO14399: Meilleure gestion de la matrice locale sur
-une structure.
-21-07-98 : FMN ; Correction init attri_default et du hatch
-30-11-98 : FMN ; S4069 : Textes toujours visibles
-05-01-99 : CAL ; Warning WNT
-22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets
-
-************************************************************************/
-
-#define BUC60577 /*GG_101099 Enable to compute correctly
-// transparency with more than one object in the view.
-*/
-
-#define IMP190100 /*GG Push and Pop polyline type and width
-// attributes correctly.
-*/
-
-#define G003 /*EUG degeneration mode management
-*/
-
-#define GER61394 /*GG 26/05/00 Enable AntiAliasing also on polygons.*/
-
-#define BUC60742 /*GG 18/09/00 Enable to use both animation and
-graphic structure transformation
-*/
-
-#define IMP250401 /*GG Sets always the current polyline colour
-used in immediat mode context.
-*/
-
-/*OCC8568 changes made by GG rolled back due to regression*/
-/*#define BUC60918*/ /*GG CADPAK_V2/RINA Enable transparency using Zbuffer
- */
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define NO_TRACE
-#define NO_TRACE_UPMATERIAL
-#define NO_TRACE_MATERIAL
-#define NO_TRACE_LIGHT
-#define NO_TRACE_MATRIX
-#define NO_TRACE_TEXT
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-/* OCC22218 NOTE: project dependency on gl2ps is specified by macro */
-#ifdef HAVE_GL2PS
- #include <gl2ps.h>
- /* OCC22216 NOTE: linker dependency can be switched off by undefining macro.
- Pragma comment for gl2ps.lib is defined only here. */
- #ifdef _MSC_VER
- #pragma comment( lib, "gl2ps.lib" )
- #endif
-#endif
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stdio.h>
-#include <string.h>
-
-#include <GL/gl.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_telem_depthcue.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_util.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_animation.hxx>
-
-#include <OpenGl_trsf_stack.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-#include <OpenGl_TextureBox.hxx>
-
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-#include <Aspect_PolygonOffsetMode.hxx>
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-#include <OpenGl_transform_persistence.hxx>
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
-#include <OpenGl_Memory.hxx>
-
-#include <OpenGl_TextRender.hxx>
-#include <OSD_FontAspect.hxx>
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Definitions type
-*/
-
-struct TSM_ATTRI_BLK_STRUCT {
- //struct TSM_ATTRI_BLK_STRUCT *next;
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- /*Tint TransPersFlag;*/
- TEL_TRANSFORM_PERSISTENCE TransPers;
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- TEL_COLOUR PolylineColour;
- Tfloat PolylineWidth;
- Tint PolylineType;
- TEL_COLOUR EdgeColour;
- Tfloat EdgeWidth;
- Tint EdgeType;
- Tint AntiAliasing;
- TEL_COLOUR InteriorColour;
- Tint EdgeFlag;
- Tint InteriorStyle;
- Tint InteriorStyleIndex;
- Tfloat PolymarkerSize;
- TEL_COLOUR PolymarkerColour;
- TEL_COLOUR BackInteriorColour;
- Tint FaceDistinguishingMode;
- TEL_COLOUR TextColour;
- TEL_COLOUR TextColourSubTitle;
- Tint TextStyle;
- Tint TextDisplayType;
- Tchar *TextFont;
- Tfloat TextHeight;
- Tfloat CharacterSpacing;
- Tfloat CharacterExpansionFactor;
- Tint TextZoomable;
- Tfloat TextAngle;
- OSD_FontAspect TextFontAspect;
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- TEL_ALIGN_DATA TextAlign;
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- Tint PolymarkerType;
- Tint InteriorReflectanceEquation;
- Tint BackInteriorReflectanceEquation;
- TEL_SURF_PROP SurfaceAreaProperties;
- TEL_SURF_PROP BackSurfaceAreaProperties;
- TelCullMode FaceCullingMode;
- Tint DepthCueIndex;
- Tint InteriorShadingMethod;
- Tint ViewIndex;
- Tint HighlightIndex;
- Tmatrix3 LocalTran3;
- Tint DoTextureMap;
- Tint TextureId;
-#ifdef G003
- Tint DegenerationMode;
-#endif /* G003 */
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- TEL_POFFSET_PARAM PolygonOffsetParams;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TSM_ATTRI_BLK_STRUCT TSM_ATTRI_BLK;
-typedef TSM_ATTRI_BLK_STRUCT* tsm_attri_blk;
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-typedef NCollection_Stack<tsm_attri_blk> Attri_Stack;
-static Attri_Stack attri_stk;
-
-/* FSXXX */
-static Tint need_reset = 0;
-
-/* Est-il necessaire de faire de la transparence ? */
-static Tint need_trans = 0;
-
-static TSM_ATTRI_BLK attri_default =
-{
- {0 , 0.0F, 0.0F, 0.0F },
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- {{ 1.0F, 1.0F, 1.0F }}, /* PolylineColour */
- 1.0F, /* PolylineWidth */
- TEL_LS_SOLID, /* PolylineType */
- {{ 1.0F, 1.0F, 1.0F }}, /* EdgeColour */
- 1.0F, /* EdgeWidth */
- 0, /* EdgeType */
- TOff, /* AntiAliasing */
- {{ 1.0F, 1.0F, 1.0F }}, /* InteriorColour */
- TOn, /* EdgeFlag */
- TSM_SOLID, /* InteriorStyle */
- TEL_HS_SOLID, /* InteriorStyleIndex */
- 1.0F, /* PolymarkerSize */
- {{ 1.0F, 1.0F, 1.0F }}, /* PolymarkerColour */
- {{ 1.0F, 1.0F, 1.0F }}, /* BackInteriorColour */
- TOn, /* FaceDistinguishingMode */
- {{ 1.0F, 1.0F, 1.0F }}, /* TextColour */
- {{ 1.0F, 1.0F, 1.0F }}, /* TextColourSubTitle */
- ASPECT_TOST_NORMAL, /* TextStyle */
- ASPECT_TODT_NORMAL, /* TextDisplayType */
- (Tchar*)"Courier", /* TextFont */
- 16.0F, /* TextHeight */
- 0.3F, /* CharacterSpacing */
- 1.0F, /* CharacterExpansionFactor */
- 0, /*TextZoomable*/
- 0, /*TextAngle*/
- OSD_FA_Regular, /*TextFontAspect - OSD_FA_Regular*/
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- { 0, /*Horizontal Text Alignment*/
- 0 }, /*Vertical Text Alignment*/
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- TEL_PM_PLUS, /* PolymarkerType */
- CALL_PHIGS_REFL_NONE, /* InteriorReflectanceEquation */
- CALL_PHIGS_REFL_NONE, /* BackInteriorReflectanceEquation */
- { 0.2F, 0.8F, 0.1F, 0.0F, /* Coef d eclairage */
- 1.0F, 10.0F, 0.0F,
- 1, 1, 1, 0, 0, /* Etat des eclairage */
- {{ 1.0F, 1.0F, 1.0F }}, /* ambient color */
- {{ 1.0F, 1.0F, 1.0F }}, /* diffuse color */
- {{ 1.0F, 1.0F, 1.0F }}, /* specular color */
- {{ 1.0F, 1.0F, 1.0F }}, /* emissive color */
- {{ 1.0F, 1.0F, 1.0F }}}, /* material color */ /* SurfaceAreaProperties */
- { 0.2F, 0.8F, 0.1F, 0.0F, /* Coef d eclairage */
- 1.0F, 10.0F, 0.0F,
- 1, 1, 1, 0, 0, /* Etat des eclairage */
- {{ 1.0F, 1.0F, 1.0F }}, /* ambient color */
- {{ 1.0F, 1.0F, 1.0F }}, /* diffuse color */
- {{ 1.0F, 1.0F, 1.0F }}, /* specular color */
- {{ 1.0F, 1.0F, 1.0F }}, /* emissive color */
- {{ 1.0F, 1.0F, 1.0F }}}, /* material color */ /* BackSurfaceAreaProperties */
- TelCullNone, /* FaceCullingMode */
- 0, /* DepthCueIndex */
- TEL_SM_GOURAUD, /* InteriorShadingMethod */
- 0, /* ViewIndex */
- 0, /* HighlightIndex */
- {
- { 1.0F, 0.0F, 0.0F, 0.0F },
- { 0.0F, 1.0F, 0.0F, 0.0F },
- { 0.0F, 0.0F, 1.0F, 0.0F },
- { 0.0F, 0.0F, 0.0F, 1.0F }
- }, /* LocalTran3 */
- TEL_SD_SHADING,
- -1
-#ifdef G003
- , 0 /* DegenerationMode */
-#endif /* G003 */
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- , { Aspect_POM_Fill, 1.0F, 0.0F }
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-};
-
-#ifdef G003
-extern int g_nBackfacing;
-#endif /* G003 */
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes
-*/
-
-static void TelUpdateFog( Tint, Tint, Tint ); /* ws, vid, dcid */
-static void TelSetViewMatrix( Tmatrix3, Tint ); /* mat, vid */
-static void call_util_transpose_mat (float tmat[16], float mat[4][4]);
-static void TelUpdatePolygonOffsets( tel_poffset_param );
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-extern tsm_trsf_stack cur_trsf_stack;
-
-GLuint fontBase;
-extern GLuint linestyleBase;
-extern GLuint patternBase;
-
-extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */
-extern Tint SecondPassNeeded; /* currently defined in tsm/tsm.c */
-extern Tint SecondPassDo; /* currently defined in tsm/tsm.c */
-
-/*----------------------------------------------------------------------*/
-
-
-TStatus
-TsmPushAttri( void )
-{
- tsm_attri_blk node;
-
- node = new TSM_ATTRI_BLK();
-
- if( !attri_stk.IsEmpty() )
- {
- *node = *attri_stk.Top();
-#ifdef TRACE
- printf("TsmPushAttri %x\n",attri_tail);
-#endif
- }
- else
- {
- *node = attri_default;
-#ifdef TRACE
- printf("TsmPushAttri attri_default %x\n",attri_tail);
-#endif
-
- /* Register all default attributes with gl */
-
- glLineWidth( ( GLfloat )attri_default.PolylineWidth );
-#ifdef HAVE_GL2PS
- gl2psLineWidth( ( GLfloat )attri_default.PolylineWidth );
-#endif
-
- OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
- textRender->FindFont(node->TextFont, node->TextFontAspect, node->TextHeight,1,1);
-
-#ifdef G003
- if ( !g_nBackfacing )
-#endif /* G003 */
- switch (node->FaceCullingMode) {
-case TelCullNone:
- glDisable (GL_CULL_FACE);
- break;
-
-case TelCullFront:
- glCullFace (GL_FRONT);
- glEnable (GL_CULL_FACE);
- break;
-
-case TelCullBack:
- glCullFace (GL_BACK);
- glEnable (GL_CULL_FACE);
- break;
- }
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- transform_persistence_begin( 0, 0.0, 0.0, 0.0 );
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
- }
- attri_stk.Push( node );
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmPopAttri( void )
-{
- tsm_attri_blk node;
-
- if ( attri_stk.IsEmpty() )
- return TFailure; /* Underflow */
-
- node = attri_stk.ChangeTop();
- attri_stk.Pop();
-
-#ifdef TRACE
- printf("TsmPopAttri %x\n",attri_tail);
-#endif
-
- if( !attri_stk.IsEmpty() )
- {
- tsm_attri_blk attri_tail = attri_stk.Top();
-
- /* Reset the attributes */
- Tint i;
- Tfloat f;
-
- f = attri_tail->PolylineWidth;
- if( node->PolylineWidth != f ) {
-#ifdef TRACE
- printf("TsmPopAttri.linewidth %f\n",f);
-#endif
-
- glLineWidth( (GLfloat)f );
-#ifdef HAVE_GL2PS
- gl2psLineWidth( (GLfloat)f );
-#endif
- }
-
- i = attri_tail->InteriorStyle;
- if( node->InteriorStyle != i )
- {
- switch( i )
- {
- case TSM_SOLID:
- case TSM_HIDDENLINE:
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
- glDisable(GL_POLYGON_STIPPLE);
- break;
-
- case TSM_HOLLOW:
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
- break;
-
- case TSM_EMPTY:
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
- break;
-
- case TSM_HATCH:
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
- if( node->InteriorStyleIndex ) {
- glCallList( patternBase + node->InteriorStyleIndex );
- glEnable(GL_POLYGON_STIPPLE);
- } else
- glDisable(GL_POLYGON_STIPPLE);
- break;
-
- case TSM_POINT:
- glPolygonMode(GL_FRONT_AND_BACK, GL_POINT );
- break;
- }
- }
-
- i = attri_tail->PolylineType;
- if( node->PolylineType != i ) {
-#ifdef TRACE
- printf("TsmPopAttri.linetype %d\n",i);
-#endif
- if (i) {
- glCallList( linestyleBase+i );
-
- glEnable( GL_LINE_STIPPLE );
-#ifdef HAVE_GL2PS
- gl2psEnable( GL2PS_LINE_STIPPLE );
-#endif
- } else {
-
- glDisable( GL_LINE_STIPPLE );
-#ifdef HAVE_GL2PS
- gl2psDisable( GL2PS_LINE_STIPPLE );
-#endif
- }
- }
-
- if( strcmp( (char*)attri_tail->TextFont, (char*)node->TextFont ) ||
- ( attri_tail->TextHeight != node->TextHeight ) )
- {
-
- OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
- textRender->FindFont(attri_tail -> TextFont, attri_tail->TextFontAspect, attri_tail -> TextHeight);
- }
-#ifdef G003
- if ( !g_nBackfacing )
-#endif /* G003 */
- {
- if( attri_tail->FaceCullingMode != node->FaceCullingMode )
- {
- switch( attri_tail->FaceCullingMode )
- {
- case TelCullNone:
- glDisable(GL_CULL_FACE);
- break;
-
- case TelCullFront:
- glCullFace(GL_FRONT) ;
- glEnable(GL_CULL_FACE);
- break;
-
- case TelCullBack:
- glCullFace(GL_BACK);
- glEnable(GL_CULL_FACE);
- break;
- }
- }
- }
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- if( attri_tail->PolygonOffsetParams.mode != node->PolygonOffsetParams.mode ||
- attri_tail->PolygonOffsetParams.factor != node->PolygonOffsetParams.factor ||
- attri_tail->PolygonOffsetParams.units != node->PolygonOffsetParams.units )
- {
- TelUpdatePolygonOffsets( &attri_tail->PolygonOffsetParams );
- }
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- if( attri_tail->TransPers.mode != node->TransPers.mode ||
- attri_tail->TransPers.pointX != node->TransPers.pointX ||
- attri_tail->TransPers.pointY != node->TransPers.pointY ||
- attri_tail->TransPers.pointZ != node->TransPers.pointZ )
-
- {
- transform_persistence_begin( attri_tail->TransPers.mode,
- attri_tail->TransPers.pointX,
- attri_tail->TransPers.pointY,
- attri_tail->TransPers.pointZ );
- }
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
- if( attri_tail->ViewIndex != node->ViewIndex )
- {
- TelSetViewProjection( TglActiveWs, attri_tail->ViewIndex );
-#ifdef TRACE_MATRIX
- printf("TsmPopAttri::TelSetViewMatrix::attri_tail->ViewIndex != node->ViewIndex \n");
-#endif
- TelSetViewMatrix( attri_tail->LocalTran3, attri_tail->ViewIndex );
- TelUpdateFog( TglActiveWs, attri_tail->ViewIndex, attri_tail->DepthCueIndex );
- }
- else
- {
- if( attri_tail->DepthCueIndex != node->DepthCueIndex )
- TelUpdateFog( TglActiveWs, attri_tail->ViewIndex, attri_tail->DepthCueIndex );
- if( memcmp( node->LocalTran3, attri_tail->LocalTran3, sizeof(Tmatrix3) ) )
- {
-#ifdef TRACE_MATRIX
- printf("TsmPopAttri::TelSetViewMatrix::memcmp( node->LocalTran3, attri_tail->LocalTran3, sizeof(Tmatrix3) ) \n");
-#endif
- TelSetViewMatrix(attri_tail->LocalTran3,attri_tail->ViewIndex);
- }
- }
- }
-#ifdef IMP190100 /* Reset default attribs at the top */
- else {
- Tint i;
- Tfloat f;
-
- f = attri_default.PolylineWidth;
- if( node->PolylineWidth != f ) {
-
-
- glLineWidth( (GLfloat)f );
-#ifdef HAVE_GL2PS
- gl2psLineWidth( (GLfloat)f );
-#endif
-
-#ifdef TRACE
- printf("TsmPopAttri.defaultlinewidth %f\n",f);
-#endif
- }
-
- i = attri_default.PolylineType;
- if( node->PolylineType != i ) {
- if (i) {
- glCallList( linestyleBase+i );
-
- glEnable( GL_LINE_STIPPLE );
-#ifdef HAVE_GL2PS
- gl2psEnable( GL2PS_LINE_STIPPLE );
-#endif
- } else {
-
- glDisable( GL_LINE_STIPPLE );
-#ifdef HAVE_GL2PS
- gl2psDisable( GL2PS_LINE_STIPPLE );
-#endif
- }
-
-
-#ifdef TRACE
- printf("TsmPopAttri.defaultlinetype %d\n",i);
-#endif
- }
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- TelUpdatePolygonOffsets( &attri_default.PolygonOffsetParams );
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- /*transform_persistence_begin( attri_default.TransPersFlag );*/
- transform_persistence_begin( attri_default.TransPers.mode,
- attri_default.TransPers.pointX,
- attri_default.TransPers.pointY,
- attri_default.TransPers.pointZ );
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- }
-#endif /*IMP190100*/
-
- /* abd
- cmn_stg_tbl_free( (void *) node );*/
- delete node;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmSetAttri( Tint n, ... )
-{
- Tint i;
-
-#if defined (SOLARIS) || defined (IRIXO32)
- cmn_key *k;
-#else
- cmn_key k[TMaxArgs];
-#endif
-
-#ifdef GER61394
- static int antiAliasingMode = -1;
- if( antiAliasingMode < 0 ) {
- char string[64];
- if (call_util_osd_getenv("CALL_OPENGL_ANTIALIASING_MODE", string, 64) ) {
- int v;
- if( sscanf(string,"%d",&v) > 0 ) antiAliasingMode = v;
- printf(".OpenGl driver.AntiAliasing mode is %d\n",antiAliasingMode);
- } else {
- antiAliasingMode = 3;
- }
- }
-#endif
-
- if (attri_stk.IsEmpty())
- return TFailure;
-
- tsm_attri_blk attri_tail = attri_stk.ChangeTop();
-
- CMN_GET_STACK( n, k );
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case TelTextureId:
- attri_tail->TextureId = k[i]->data.ldata;
-
- if (!ForbidSetTextureMapping) {
- if (attri_tail->DoTextureMap)
- {
- DisableTexture();
- SetCurrentTexture(attri_tail->TextureId);
- EnableTexture();
- }
- else
- DisableTexture();
- }
- break;
-
- case TelDoTextureMap:
- attri_tail->DoTextureMap = k[i]->data.ldata;
- break;
-
- case TelTextStyle:
- attri_tail->TextStyle = k[i]->data.ldata;
- break;
-
- case TelTextDisplayType:
- attri_tail->TextDisplayType = k[i]->data.ldata;
- break;
-
- case TelPolylineColour:
- attri_tail->PolylineColour = *(tel_colour)(k[i]->data.pdata);
-#ifdef IMP250401
- glColor3f(attri_tail->PolylineColour.rgb[0],
- attri_tail->PolylineColour.rgb[1],
- attri_tail->PolylineColour.rgb[2]);
-#endif
- break;
-
- case TelPolylineWidth:
- {
- Tfloat w;
-
- w = k[i]->data.fdata;
- if( attri_tail->PolylineWidth != w )
- {
-#ifdef TRACE
- printf("TsmSetAttri.linewidth %f\n",w);
-#endif
- attri_tail->PolylineWidth = w;
-
- glLineWidth( (GLfloat)w );
-#ifdef HAVE_GL2PS
- gl2psLineWidth( (GLfloat)w );
-#endif
- }
- break;
- }
-
- case TelPolylineType:
- {
- Tint ls;
-
- ls = k[i]->data.ldata;
- if( attri_tail->PolylineType != ls )
- {
-#ifdef TRACE
- printf("TsmSetAttri.linetype %d\n",ls);
-#endif
- attri_tail->PolylineType = ls;
- if (ls) {
- glCallList(linestyleBase+ls);
-
- glEnable( GL_LINE_STIPPLE );
-#ifdef HAVE_GL2PS
- gl2psEnable( GL2PS_LINE_STIPPLE );
-#endif
- } else {
-
- glDisable( GL_LINE_STIPPLE );
-#ifdef HAVE_GL2PS
- gl2psDisable( GL2PS_LINE_STIPPLE );
-#endif
- }
- }
- break;
- }
-
- case TelEdgeType:
- attri_tail->EdgeType = k[i]->data.ldata;
- break;
-
- case TelEdgeWidth:
- attri_tail->EdgeWidth = k[i]->data.fdata;
- break;
-
- case TelEdgeColour:
- attri_tail->EdgeColour = *(tel_colour)(k[i]->data.pdata);
- break;
-
- case TelAntiAliasing:
- {
- attri_tail->AntiAliasing = k[i]->data.ldata;
-
- if (!SecondPassNeeded)
- {
- if( attri_tail->AntiAliasing == TOff )
- {
- glDisable(GL_POINT_SMOOTH);
- glDisable(GL_LINE_SMOOTH);
-#ifdef GER61394
- if( antiAliasingMode & 2 ) glDisable(GL_POLYGON_SMOOTH);
-#endif
- glBlendFunc (GL_ONE, GL_ZERO);
- glDisable (GL_BLEND);
- }
- else /* TOn */
- {
- glEnable(GL_POINT_SMOOTH);
- glEnable(GL_LINE_SMOOTH);
-#ifdef GER61394
- if( antiAliasingMode & 2 ) glEnable(GL_POLYGON_SMOOTH);
-#endif
- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable (GL_BLEND);
- }
- }
- break;
- }
-
- case TelInteriorColour:
- {
- attri_tail->InteriorColour = *(tel_colour)(k[i]->data.pdata);
- break;
- }
-
- case TelEdgeFlag:
- {
- attri_tail->EdgeFlag = k[i]->data.ldata;
- break;
- }
-
- case TelInteriorStyle:
- {
- Tint s;
-
- s = k[i]->data.ldata;
- if( attri_tail->InteriorStyle != s )
- {
- attri_tail->InteriorStyle = s;
- switch( s )
- {
- case TSM_SOLID:
- case TSM_HIDDENLINE:
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
- glDisable(GL_POLYGON_STIPPLE);
- break;
-
- case TSM_HOLLOW:
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
- break;
-
- case TSM_EMPTY:
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
- break;
-
- case TSM_HATCH:
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
- if( attri_tail->InteriorStyleIndex ) {
- glCallList( patternBase + attri_tail->InteriorStyleIndex );
- glEnable(GL_POLYGON_STIPPLE);
- } else
- glDisable(GL_POLYGON_STIPPLE);
- break;
-
- case TSM_POINT:
- glPolygonMode(GL_FRONT_AND_BACK, GL_POINT );
- break;
- }
- }
- break;
- }
-
- case TelInteriorStyleIndex:
- {
- Tint is = k[i]->data.ldata;
- if( attri_tail->InteriorStyleIndex != is )
- {
- attri_tail->InteriorStyleIndex = is;
- if( attri_tail->InteriorStyle == TSM_HATCH )
- {
- if (is)
- {
- glCallList( patternBase + is );
- glEnable(GL_POLYGON_STIPPLE);
- } else
- glDisable(GL_POLYGON_STIPPLE);
- }
- }
- break;
- }
-
- case TelPolymarkerColour:
- attri_tail->PolymarkerColour = *(tel_colour)(k[i]->data.pdata);
- break;
-
- case TelPolymarkerSize:
- attri_tail->PolymarkerSize = k[i]->data.fdata;
- break;
-
- case TelLocalTran3:
- {
- tel_matrix3_data d = ((tel_matrix3_data)(k[i]->data.pdata));
- switch(d->mode)
- {
- case TPreConcatenate: /* not used */
- TelMultiplymat3( attri_tail->LocalTran3,
- d->mat, attri_tail->LocalTran3 );
- break;
-
- case TPostConcatenate: /* not used */
- TelMultiplymat3( attri_tail->LocalTran3,
- attri_tail->LocalTran3, d->mat );
- break;
-
- case TReplace:
-#ifdef BUC60742
- matcpy( attri_tail->LocalTran3, d->mat );
- TelTransposemat3( attri_tail->LocalTran3 );
-#else
- /*
- * On multiplie la trsf courante par la trsf
- * de la structure que l'on est en train de
- * parcourir.
- */
- TelMultiplymat3( cur_trsf_stack->LocalTran3,
- cur_trsf_stack->LocalTran3, d->mat );
- /*
- * On copie de resultat dans la queue d'attributs
- * pour pouvoir changer l'orientation du reste
- * du trace.
- */
- matcpy( attri_tail->LocalTran3,
- cur_trsf_stack->LocalTran3 );
- /*
- * Transformation definie dans un repere direct
- * a appliquer dans un repere indirect
- */
- TelTransposemat3( attri_tail->LocalTran3 );
-#endif /*BUC60742*/
- break;
- }
-#ifdef TRACE_MATRIX
- printf("TsmSetAttri::TelSetViewMatrix::TelLocalTran3 \n");
-#endif
- TelSetViewMatrix(attri_tail->LocalTran3,attri_tail->ViewIndex);
- break;
- }
-
- case TelBackInteriorColour:
- {
- attri_tail->BackInteriorColour = *(tel_colour)(k[i]->data.pdata);
- break;
- }
-
- case TelFaceDistinguishingMode:
- {
- attri_tail->FaceDistinguishingMode = (Tint) k[i]->data.ldata;
- break;
- }
-
- case TelTextColour:
- attri_tail->TextColour = *(tel_colour)(k[i]->data.pdata);
- break;
-
- case TelTextColourSubTitle:
- attri_tail->TextColourSubTitle = *(tel_colour)(k[i]->data.pdata);
- break;
-
- case TelTextFont:
- {
- Tchar *fn = (Tchar*)k[i]->data.pdata;
-#ifdef TRACE_TEXT
- printf ("TelTextFont:: %s %s \n", fn, attri_tail->TextFont);
-#endif
- if( strcmp( (char*)fn, (char*)attri_tail->TextFont ) )
- {
- OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
- textRender->FindFont ( fn, attri_tail->TextFontAspect, attri_tail -> TextHeight );
- attri_tail->TextFont = fn;
- }
- break;
- }
-
- case TelTextHeight:
- {
- Tfloat h;
-
- h = k[i]->data.fdata;
-#ifdef TRACE_TEXT
- printf ("TelTextHeight:: %f %f \n", h, attri_tail->TextHeight);
-#endif
- if( h != attri_tail->TextHeight )
- {
- OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
- textRender->FindFont (attri_tail->TextFont, attri_tail->TextFontAspect,h );
- attri_tail->TextHeight = h;
- }
- break;
- }
-
- case TelCharacterSpacing:
- attri_tail->CharacterSpacing = k[i]->data.fdata;
- break;
-
- case TelCharacterExpansionFactor:
- {
- attri_tail->CharacterExpansionFactor = k[i]->data.fdata;
- break;
- }
-
- case TelTextZoomable:
- attri_tail->TextZoomable = k[i]->data.ldata;
- break;
- case TelTextAngle:
- attri_tail->TextAngle = k[i]->data.ldata;
- break;
- case TelTextFontAspect:
- attri_tail->TextFontAspect = OSD_FontAspect(k[i]->data.ldata);
- break;
-
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- case TelTextAlign:
- attri_tail->TextAlign = *(tel_align_data)k[i]->data.pdata;
- break;
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
-
- case TelPolymarkerType:
- attri_tail->PolymarkerType = k[i]->data.ldata;
- break;
-
- case TelInteriorReflectanceEquation:
- attri_tail->InteriorReflectanceEquation =
- (Tint) k[i]->data.ldata;
- break;
-
- case TelBackInteriorReflectanceEquation:
- attri_tail->BackInteriorReflectanceEquation =
- (Tint) k[i]->data.ldata;
- break;
-
- case TelSurfaceAreaProperties:
- attri_tail->SurfaceAreaProperties =
- *(tel_surf_prop)(k[i]->data.pdata);
-#ifdef TRACE_UPMATERIAL
- printf("TsmSetAttri::TelSurfaceAreaProperties:TelUpdateMaterial (TEL_FRONT_MATERIAL)\n");
-#endif
- TelUpdateMaterial( TEL_FRONT_MATERIAL );
- break;
-
- case TelBackSurfaceAreaProperties:
- attri_tail->BackSurfaceAreaProperties =
- *(tel_surf_prop)(k[i]->data.pdata);
-#ifdef TRACE_UPMATERIAL
- printf("TsmSetAttri::TelBackSurfaceAreaProperties:TelUpdateMaterial (TEL_BACK_MATERIAL)\n");
-#endif
- if (attri_tail->FaceDistinguishingMode == TOn)
- TelUpdateMaterial( TEL_BACK_MATERIAL );
- break;
-
- case TelFaceCullingMode:
-#ifdef G003
- if ( !g_nBackfacing )
-#endif /* G003 */
- {
- TelCullMode mode = (TelCullMode) k[i]->data.ldata;
- if( mode != attri_tail->FaceCullingMode )
- {
- attri_tail->FaceCullingMode = mode;
- switch( mode )
- {
- case TelCullNone:
- glDisable(GL_CULL_FACE);
- break;
-
- case TelCullFront:
- glCullFace(GL_FRONT);
- glEnable(GL_CULL_FACE);
- break;
-
- case TelCullBack:
- glCullFace(GL_BACK);
- glEnable(GL_CULL_FACE);
- break;
- }
- }
- }
- break;
-
- case TelDepthCueIndex:
- {
- Tint dc;
-
- dc = k[i]->data.ldata;
- if( dc != attri_tail->DepthCueIndex )
- {
- attri_tail->DepthCueIndex = dc;
- TelUpdateFog( TglActiveWs, attri_tail->ViewIndex, dc );
- }
- break;
- }
-
- case TelInteriorShadingMethod:
- {
- Tint a;
-
- a = k[i]->data.ldata;
- attri_tail->InteriorShadingMethod = a;
- a == TEL_SM_FLAT ? glShadeModel( GL_FLAT ) :
- glShadeModel( GL_SMOOTH );
- break;
- }
-
- case TelViewIndex:
- {
- Tint vid = k[i]->data.ldata;
-
- if( vid != attri_tail->ViewIndex )
- {
- attri_tail->ViewIndex = vid;
- TelUpdateFog( TglActiveWs, vid, attri_tail->DepthCueIndex );
- }
- break;
- }
-
- case TelHighlightIndex:
- attri_tail->HighlightIndex = k[i]->data.ldata;
- break;
-#ifdef G003
- case TelDegenerationMode:
- attri_tail -> DegenerationMode = k[ i ] -> data.ldata;
- break;
-#endif /* G003 */
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- case TelPolygonOffset:
- {
- tel_poffset_param pdata = (tel_poffset_param)(k[i]->data.pdata);
- /* Aspect_POM_None means: do not change current settings */
- if ( ( pdata->mode & Aspect_POM_None ) == Aspect_POM_None )
- break;
- attri_tail->PolygonOffsetParams = *pdata;
- TelUpdatePolygonOffsets( pdata );
- break;
- }
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
-
- case TelTransformPersistence:
- {
- attri_tail->TransPers = *(tel_transform_persistence)(k[i]->data.pdata);
- transform_persistence_begin( attri_tail->TransPers.mode,
- attri_tail->TransPers.pointX,
- attri_tail->TransPers.pointY,
- attri_tail->TransPers.pointZ );
-
- break;
- }
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
- default:
- break;
- }
- }
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmGetAttri( Tint n, ... )
-{
- Tint i;
-#if defined (SOLARIS) || defined (IRIXO32)
- cmn_key *k;
-#else
- cmn_key k[TMaxArgs];
-#endif
-
- tsm_attri_blk attri_tail = NULL;
-
- if (attri_stk.IsEmpty())
- {
-#ifdef TRACE
- printf ("TsmGetAttri with attri_tail == NULL\n");
-#endif
- attri_tail = &attri_default;
- } else {
- attri_tail = attri_stk.Top();
- }
-
- CMN_GET_STACK( n, k );
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case TelTextureId:
- k[i]->data.ldata = attri_tail->TextureId;
- break;
-
- case TelDoTextureMap:
- k[i]->data.ldata = attri_tail->DoTextureMap;
- break;
-
- case TelTextStyle:
- k[i]->data.ldata = attri_tail->TextStyle;
- break;
-
- case TelTextDisplayType:
- k[i]->data.ldata = attri_tail->TextDisplayType;
- break;
-
- case TelPolylineColour:
- *(tel_colour)(k[i]->data.pdata) = attri_tail->PolylineColour;
- break;
-
- case TelPolylineWidth:
- k[i]->data.fdata = attri_tail->PolylineWidth;
- break;
-
- case TelPolylineType:
- k[i]->data.ldata = attri_tail->PolylineType;
- break;
-
- case TelEdgeType:
- k[i]->data.ldata = attri_tail->EdgeType;
- break;
-
- case TelEdgeWidth:
- k[i]->data.fdata = attri_tail->EdgeWidth;
- break;
-
- case TelEdgeColour:
- *(tel_colour)(k[i]->data.pdata) = attri_tail->EdgeColour;
- break;
-
- case TelAntiAliasing:
- k[i]->data.ldata = attri_tail->AntiAliasing;
- break;
-
- case TelInteriorColour:
- *(tel_colour)(k[i]->data.pdata) = attri_tail->InteriorColour;
- break;
-
- case TelEdgeFlag:
- k[i]->data.ldata = attri_tail->EdgeFlag;
- break;
-
- case TelInteriorStyle:
- k[i]->data.ldata = attri_tail->InteriorStyle;
- break;
-
- case TelInteriorStyleIndex:
- k[i]->data.ldata = attri_tail->InteriorStyleIndex;
- break;
-
- case TelPolymarkerColour:
- *(tel_colour)(k[i]->data.pdata) = attri_tail->PolymarkerColour;
- break;
-
- case TelPolymarkerSize:
- k[i]->data.fdata = attri_tail->PolymarkerSize;
- break;
-
- case TelLocalTran3:
- matcpy( k[i]->data.pdata, attri_tail->LocalTran3 );
- break;
-
- case TelBackInteriorColour:
- *(tel_colour)(k[i]->data.pdata) = attri_tail->BackInteriorColour;
- break;
-
- case TelFaceDistinguishingMode:
- k[i]->data.ldata = attri_tail->FaceDistinguishingMode;
- break;
-
- case TelTextColour:
- *(tel_colour)(k[i]->data.pdata) = attri_tail->TextColour;
- break;
-
- case TelTextColourSubTitle:
- *(tel_colour)(k[i]->data.pdata) = attri_tail->TextColourSubTitle;
- break;
-
- case TelTextFont:
- k[i]->data.pdata = attri_tail->TextFont;
- break;
-
- case TelTextHeight:
- k[i]->data.fdata = attri_tail->TextHeight;
- break;
-
- case TelCharacterSpacing:
- k[i]->data.fdata = attri_tail->CharacterSpacing;
- break;
-
- case TelCharacterExpansionFactor:
- k[i]->data.fdata = attri_tail->CharacterExpansionFactor;
- break;
-
- case TelTextZoomable:
- k[i]->data.ldata = attri_tail->TextZoomable;
- break;
- case TelTextAngle:
- k[i]->data.ldata = attri_tail->TextAngle;
- break;
- case TelTextFontAspect:
- k[i]->data.ldata = attri_tail->TextFontAspect;
- break;
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- case TelTextAlign:
- *(tel_align_data)(k[i]->data.pdata) = attri_tail->TextAlign;
- break;
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- case TelPolymarkerType:
- k[i]->data.ldata = attri_tail->PolymarkerType;
- break;
-
- case TelInteriorReflectanceEquation:
- k[i]->data.ldata = attri_tail->InteriorReflectanceEquation;
- break;
-
- case TelBackInteriorReflectanceEquation:
- k[i]->data.ldata = attri_tail->BackInteriorReflectanceEquation;
- break;
-
- case TelSurfaceAreaProperties:
- *(tel_surf_prop)(k[i]->data.pdata) =
- attri_tail->SurfaceAreaProperties;
- break;
-
- case TelBackSurfaceAreaProperties:
- *(tel_surf_prop)(k[i]->data.pdata) =
- attri_tail->BackSurfaceAreaProperties;
- break;
-
- case TelFaceCullingMode:
- k[i]->data.ldata = attri_tail->FaceCullingMode;
- break;
-
- case TelDepthCueIndex:
- k[i]->data.ldata = attri_tail->DepthCueIndex;
- break;
-
- case TelInteriorShadingMethod:
- k[i]->data.ldata = attri_tail->InteriorShadingMethod;
- break;
-
- case TelViewIndex:
- k[i]->data.ldata = attri_tail->ViewIndex;
- break;
-
- case TelHighlightIndex:
- k[i]->data.ldata = attri_tail->HighlightIndex;
- break;
-
-#ifdef G003
- case TelDegenerationMode:
- k[ i ] -> data.ldata = attri_tail -> DegenerationMode;
- break;
-#endif /* G003 */
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- case TelPolygonOffset:
- *(tel_poffset_param)(k[i]->data.pdata) = attri_tail->PolygonOffsetParams;
- break;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- case TelTransformPersistence:
- *(tel_transform_persistence)(k[i]->data.pdata) = attri_tail->TransPers;
- break;
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
- default:
- break;
- }
- }
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-void TelUpdateMaterial( Tint flag )
-{
- GLenum face=0;
- tel_colour col=NULL;
- tel_surf_prop prop=NULL;
- Tint rm=CALL_PHIGS_REFL_NONE;
- static float mAmb[4];
- static float mDiff[4];
- static float mSpec[4];
- static float mEmsv[4];
- static float mShin;
- static float r, g, b;
- static int physic;
- CMN_KEY_DATA key;
- Tfloat *rgb;
- Tfloat newDiff3;
-
- if (attri_stk.IsEmpty())
- return;
-
- tsm_attri_blk attri_tail = attri_stk.ChangeTop();
-
- /* Hors Hiddenline */
- if (attri_tail->InteriorStyle != TSM_HIDDENLINE)
- {
- if( flag == TEL_FRONT_MATERIAL ) {
- col = &attri_tail->InteriorColour;
- rm = attri_tail->InteriorReflectanceEquation;
- prop = &attri_tail->SurfaceAreaProperties;
- face = GL_FRONT_AND_BACK;
- }
- if( flag == TEL_BACK_MATERIAL ) {
- col = &attri_tail->BackInteriorColour;
- rm = attri_tail->BackInteriorReflectanceEquation;
- prop = &attri_tail->BackSurfaceAreaProperties;
- face = GL_BACK;
- }
- }
- /* Cas HiddenLine */
- else
- {
-#ifdef TRACE_UPMATERIAL
- printf("OpenGl_attri::TelUpdateMaterial HiddenLine\n");
-#endif
- TsmGetWSAttri (TglActiveWs, WSBackground, &key);
- rgb = (Tfloat*)key.pdata;
-
- attri_tail->InteriorColour.rgb[0]=rgb[0];
- attri_tail->InteriorColour.rgb[1]=rgb[1];
- attri_tail->InteriorColour.rgb[2]=rgb[2];
- attri_tail->InteriorReflectanceEquation = CALL_PHIGS_REFL_NONE;
- attri_tail->BackInteriorReflectanceEquation = CALL_PHIGS_REFL_NONE;
- return;
- }
-
- /* Type material */
- physic = prop->isphysic;
-
-#ifdef TRACE_UPMATERIAL
- if( flag == TEL_FRONT_MATERIAL ) printf("OpenGl_attri::TelUpdateMaterial TEL_FRONT_MATERIAL\n");
- else printf("OpenGl_attri::TelUpdateMaterial TEL_BACK_MATERIAL\n");
-#endif
-#ifdef TRACE_MATERIAL
- printf(" InteriorReflectanceEquation: %d\n", attri_tail->InteriorReflectanceEquation);
- printf(" controle mode rm == CALL_PHIGS_REFL_NONE : %d\n", rm == CALL_PHIGS_REFL_NONE);
-#endif
-
- if( rm == CALL_PHIGS_REFL_NONE ) return;
-
- /*
- * Gestion de la transparence
- */
-
- if (!SecondPassDo) {
- /* Passage en transparence */
- if (need_trans && prop->trans != 1.0F) {
- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable (GL_BLEND);
- glDepthMask (GL_FALSE);
- }
-
- /* Passage en opaque */
-#ifdef BUC60577
- else
-#else
- if (need_trans && prop->trans == 1.0F)
-#endif
- {
- if( attri_tail->AntiAliasing == TOff )
- {
- glBlendFunc (GL_ONE, GL_ZERO);
- glDisable (GL_BLEND);
- }
- glDepthMask (GL_TRUE);
- }
- }
-
- /*
- * Reset Material
- */
- if( need_reset )
- {
- /* Composant ambient */
- if( rm & AMBIENT_MASK )
- {
- /* Type materiau */
- if( physic )
- {r=prop->ambcol.rgb[0];g=prop->ambcol.rgb[1];b=prop->ambcol.rgb[2];}
- else
- {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
-
- mAmb[0] = prop->amb * r;
- mAmb[1] = prop->amb * g;
- mAmb[2] = prop->amb * b;
- mAmb[3] = 1.0F;
- }
- else
- {
- mAmb[0] = 0.0;
- mAmb[1] = 0.0;
- mAmb[2] = 0.0;
- mAmb[3] = 1.0F;
- }
-
- /* Composant diffus */
- if( rm & DIFFUSE_MASK )
- {
- /* Type materiau */
- if( physic )
- {r=prop->difcol.rgb[0];g=prop->difcol.rgb[1];b=prop->difcol.rgb[2];}
- else
- {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
-
- mDiff[0] = prop->diff * r;
- mDiff[1] = prop->diff * g;
- mDiff[2] = prop->diff * b;
- mDiff[3] = 1.0F;
- }
- else
- {
- mDiff[0] = 0.0;
- mDiff[1] = 0.0;
- mDiff[2] = 0.0;
- mDiff[3] = 1.0F;
- }
-
- if (SecondPassDo)
- {
- mDiff[3] = prop->env_reflexion;
- }
- else
- {
- if (need_trans) mDiff[3] = prop->trans;
- /* si le materiau reflechi la scene environnante,
- alors il faudra faire une seconde passe */
- if (prop->env_reflexion != 0.0) SecondPassNeeded = 1;
- }
-
- /* Composant speculaire */
- if( rm & SPECULAR_MASK )
- {
- if( physic )
- {r=prop->speccol.rgb[0];g=prop->speccol.rgb[1];b=prop->speccol.rgb[2];}
- else
- {r=1.0;g=1.0;b=1.0;} /* cas des generiques */
-
- mSpec[0] = prop->spec * r;
- mSpec[1] = prop->spec * g;
- mSpec[2] = prop->spec * b;
- mSpec[3] = 1.0F;
- }
- else {
- mSpec[0] = 0.0F;
- mSpec[1] = 0.0F;
- mSpec[2] = 0.0F;
- mSpec[3] = 1.0F;
- }
-
-
- /* Composant emission */
- if( rm & EMISSIVE_MASK )
- {
- if( physic )
- {r=prop->emscol.rgb[0];g=prop->emscol.rgb[1];b=prop->emscol.rgb[2];}
- else
- {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
-
- mEmsv[0] = prop->emsv * r;
- mEmsv[1] = prop->emsv * g;
- mEmsv[2] = prop->emsv * b;
- mEmsv[3] = 1.0F;
- }
- else {
- mEmsv[0] = 0.0F;
- mEmsv[1] = 0.0F;
- mEmsv[2] = 0.0F;
- mEmsv[3] = 1.0F;
- }
-
- /* Coeficient de brillance */
- mShin = prop -> shine;
-
- glMaterialfv(face, GL_AMBIENT, mAmb );
- glMaterialfv(face, GL_DIFFUSE, mDiff );
- glMaterialfv(face, GL_SPECULAR, mSpec);
- glMaterialfv(face, GL_EMISSION, mEmsv);
- glMaterialf(face, GL_SHININESS, mShin);
-
-#ifdef TRACE_MATERIAL
- printf(" Material Properties are need_reset:\n") ;
- printf(" Ambient color is (%f, %f, %f)\n", mAmb[0], mAmb[1], mAmb[2]);
- printf(" Diffuse color is (%f, %f, %f, %f)\n", mDiff[0], mDiff[1], mDiff[2], mDiff[3]);
- printf(" Specular color is (%f, %f, %f)\n", mSpec[0], mSpec[1], mSpec[2]);
- printf(" Emission color is (%f, %f, %f)\n", mEmsv[0], mEmsv[1], mEmsv[2]);
- printf(" Shininess: %f Transparency: %f EnvReflexion: %f \n", mShin, prop->trans, prop->env_reflexion);
- printf(" Prop Specular %f Prop Emissive %f \n", prop->spec, prop->emsv);
- printf(" materiel de type physic : %d\n", prop->isphysic);
-#endif
-
- need_reset = 0;
- }
-
- /*
- * Set Material Optimize
- */
-
- else
- {
- physic = prop->isphysic;
- /* Composant ambient */
- if( rm & AMBIENT_MASK )
- {
- /* Type materiau */
- if( physic )
- {r=prop->ambcol.rgb[0];g=prop->ambcol.rgb[1];b=prop->ambcol.rgb[2];}
- else
- {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
-
- if (mAmb[0] != prop->amb * r ||
- mAmb[1] != prop->amb * g ||
- mAmb[2] != prop->amb * b )
- {
- mAmb[0] = prop->amb * r;
- mAmb[1] = prop->amb * g;
- mAmb[2] = prop->amb * b;
- mAmb[3] = 1.0F;
-
- glMaterialfv(face, GL_AMBIENT, mAmb );
-#ifdef TRACE_MATERIAL
- printf(" Ambient color is (%f, %f, %f)\n", mAmb[0], mAmb[1], mAmb[2]);
-#endif
- }
- }
- else
- {
- if ( mAmb[0] != 0.0 || mAmb[1] != 0.0 || mAmb[2] != 0.0 )
- {
- mAmb[0] = 0.0F;
- mAmb[1] = 0.0F;
- mAmb[2] = 0.0F;
- mAmb[3] = 1.0F;
-
- glMaterialfv(face, GL_AMBIENT, mAmb);
-#ifdef TRACE_MATERIAL
- printf(" Ambient color is (%f, %f, %f)\n", mAmb[0], mAmb[1], mAmb[2]);
-#endif
- }
- }
-
- /* Composant diffus */
- if( rm & DIFFUSE_MASK )
- {
- /* Type materiau */
- if( physic )
- {r=prop->difcol.rgb[0];g=prop->difcol.rgb[1];b=prop->difcol.rgb[2];}
- else
- {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
-
- if (mDiff[0] != prop->diff * r ||
- mDiff[1] != prop->diff * g ||
- mDiff[2] != prop->diff * b ||
-#ifdef BUC60577
- mDiff[3] != (SecondPassDo ? prop->env_reflexion :
- (need_trans ? prop->trans : 1.0F)) )
-#else
- mDiff[3] != (SecondPassDo ? prop->env_reflexion : 1.0F) )
-#endif
- {
- mDiff[0] = prop->diff * r;
- mDiff[1] = prop->diff * g;
- mDiff[2] = prop->diff * b;
- mDiff[3] = 1.0F;
-
- if (SecondPassDo)
- {
- mDiff[3] = prop->env_reflexion;
- }
- else
- {
- if (need_trans) mDiff[3] = prop->trans;
- /* si le materiau reflechi la scene environnante,
- alors il faudra faire une seconde passe */
- if (prop->env_reflexion != 0.0) SecondPassNeeded = 1;
- }
-
- glMaterialfv(face, GL_DIFFUSE, mDiff );
-#ifdef TRACE_MATERIAL
- printf(" Diffuse color is (%f, %f, %f, %f)\n", mDiff[0], mDiff[1], mDiff[2], mDiff[3]);
-#endif
- }
- }
- else
- {
- newDiff3 = 1.0F;
- if (SecondPassDo)
- {
- newDiff3 = prop->env_reflexion;
- }
- else
- {
- if (need_trans) newDiff3 = prop->trans;
- /* si le materiau reflechi la scene environnante,
- alors il faudra faire une seconde passe */
- if (prop->env_reflexion != 0.0) SecondPassNeeded = 1;
- }
-
- /* OCC19915: Even if diffuse reflectance is disabled,
- still trying to update the current transparency if it
- differs from the previous value */
- if ( mDiff[0] != 0.0 || mDiff[1] != 0.0 || mDiff[2] != 0.0
- || fabs(mDiff[3] - newDiff3) > 0.01 )
- {
- mDiff[0] = 0.0F;
- mDiff[1] = 0.0F;
- mDiff[2] = 0.0F;
- mDiff[3] = newDiff3;
-
- glMaterialfv(face, GL_DIFFUSE, mDiff);
-#ifdef TRACE_MATERIAL
- printf(" Diffuse color is (%f, %f, %f, %f)\n", mDiff[0], mDiff[1], mDiff[2], mDiff[3]);
-#endif
- }
- }
-
- /* composant speculaire */
- if( rm & SPECULAR_MASK )
- {
- /* Type materiau */
- if( physic )
- {r=prop->speccol.rgb[0];g=prop->speccol.rgb[1];b=prop->speccol.rgb[2];}
- else
- {r=1.0;g=1.0;b=1.0;} /* cas des generiques */
-
- if (mSpec[0] != prop->spec * r ||
- mSpec[1] != prop->spec * g ||
- mSpec[2] != prop->spec * b)
- {
- mSpec[0] = prop->spec * r;
- mSpec[1] = prop->spec * g;
- mSpec[2] = prop->spec * b;
- mSpec[3] = 1.0F;
- glMaterialfv(face, GL_SPECULAR, mSpec);
-
-#ifdef TRACE_MATERIAL
- printf(" Specular color is (%f, %f, %f)\n", mSpec[0], mSpec[1], mSpec[2]);
-#endif
- }
- }
- else
- {
- if ( mSpec[0] != 0.0 || mSpec[1] != 0.0 || mSpec[2] != 0.0 )
- {
- mSpec[0] = 0.0F;
- mSpec[1] = 0.0F;
- mSpec[2] = 0.0F;
- mSpec[3] = 1.0F;
-
- glMaterialfv(face, GL_SPECULAR, mSpec);
-#ifdef TRACE_MATERIAL
- printf(" Specular color is (%f, %f, %f)\n", mSpec[0], mSpec[1], mSpec[2]);
-#endif
- }
- }
-
- /* Composant emission */
- if( rm & EMISSIVE_MASK )
- {
- /* type materiau */
- if( physic )
- {r=prop->emscol.rgb[0];g=prop->emscol.rgb[1];b=prop->emscol.rgb[2];}
- else
- {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];}
-
- if ( mEmsv[0] != prop->emsv * r ||
- mEmsv[1] != prop->emsv * g ||
- mEmsv[2] != prop->emsv * b )
- {
- mEmsv[0] = prop->emsv * r;
- mEmsv[1] = prop->emsv * g;
- mEmsv[2] = prop->emsv * b;
- mEmsv[3] = 1.0F;
- glMaterialfv(face, GL_EMISSION, mEmsv);
-#ifdef TRACE_MATERIAL
- printf(" Emissive color is (%f, %f, %f)\n", mEmsv[0], mEmsv[1], mEmsv[2]);
-#endif
- }
- }
- else
- {
- if ( mEmsv[0] != 0.0 || mEmsv[1] != 0.0 || mEmsv[2] != 0.0 )
- {
- mEmsv[0] = 0.0F;
- mEmsv[1] = 0.0F;
- mEmsv[2] = 0.0F;
- mEmsv[3] = 1.0F;
-
- glMaterialfv(face, GL_EMISSION, mEmsv);
-#ifdef TRACE_MATERIAL
- printf(" Emissive surface is (%f, %f, %f)\n", mEmsv[0], mEmsv[1], mEmsv[2]);
-#endif
- }
- }
-
- /* coef de brillance */
- if( mShin != prop->shine )
- {
- mShin = prop->shine;
- glMaterialf(face, GL_SHININESS, mShin);
-#ifdef TRACE_MATERIAL
- printf(" Shininess factor is %f\n", mShin);
-#endif
- }
- } /* need_reset */
-}
-
-/*----------------------------------------------------------------------*/
-void TelResetMaterial() /* force material definition, called by TelClearViews */
-{
- need_reset = 1;
-}
-
-/*----------------------------------------------------------------------*/
-void TelSetTransparency( Tint tag )
-/* force transparency managment, called by redraw_all_structs */
-{
- need_trans = tag;
-}
-
-/*----------------------------------------------------------------------*/
-
-static void
-TelUpdateFog( Tint ws, Tint vid, Tint dcid )
-{
- TEL_GL_DEPTHCUE dcrep;
- float params[5];
-
- if( TelGetGLDepthCue( ws, vid, dcid, &dcrep ) == TSuccess )
- {
- if( dcrep.dcrep.mode == TelDCAllowed )
- {
- params[0] = dcrep.dcrep.col.rgb[0],
- params[1] = dcrep.dcrep.col.rgb[1],
- params[2] = dcrep.dcrep.col.rgb[2];
- params[3] = 1.0F;
- glFogi(GL_FOG_MODE, GL_LINEAR);
- glFogf(GL_FOG_START, dcrep.dist[0]);
- glFogf(GL_FOG_END, dcrep.dist[1]);
- glFogfv(GL_FOG_COLOR, params);
- glEnable(GL_FOG);
-#ifdef TRACE
- printf(" *** TelUpdateFog START %f END %f\n",dcrep.dist[0],dcrep.dist[1]);
-#endif
- return;
- }
- }
- glDisable(GL_FOG);
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-static void TelSetViewMatrix( Tmatrix3 mat, Tint vid )
-{
- TEL_VIEW_REP vrep;
- Tmatrix3 rmat;
- float mat16[16];
-#ifdef TRACE_MATRIX
- int i, j;
- GLfloat pmat[4][4];
-#endif
-
- if( TelGetViewRepresentation( TglActiveWs, vid, &vrep ) == TSuccess )
- {
-#ifdef TRACE_MATRIX
- printf ("LocalTran3 :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", mat[i][j]);
- printf ("\n");
- }
-#endif
- if ((!animationUseFlag) || (animationUseFlag && !animationFlag))
- {
-#ifdef TRACE_MATRIX
- printf ("vrep.orientation_matrix :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", vrep.orientation_matrix[i][j]);
- printf ("\n");
- }
-#endif
- TelMultiplymat3( rmat, mat, vrep.orientation_matrix );
-#ifdef TRACE_MATRIX
- printf("OpenGl_attri.c::TelSetViewMatrix::glLoadMatrixf \n");
-#endif
- glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf((GLfloat *) rmat);
-#ifdef TRACE_MATRIX
- printf ("GL_MODELVIEW_MATRIX set :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", rmat[i][j]);
- printf ("\n");
- }
-#endif
- }
- else /* animationUseFlag */
- {
- call_util_transpose_mat (mat16, mat);
- glMatrixMode (GL_MODELVIEW);
-#ifdef TRACE_MATRIX
- glGetFloatv( GL_MODELVIEW_MATRIX,(GLfloat *) pmat );
- printf ("GL_MODELVIEW_MATRIX :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", pmat[i][j]);
- printf ("\n");
- }
-#endif
-#ifdef TRACE_MATRIX
- printf("OpenGl_attri.c::TelSetViewMatrix::glMultMatrixf \n");
-#endif
- glMultMatrixf ((GLfloat *)mat);
-#ifdef TRACE_MATRIX
- glGetFloatv( GL_MODELVIEW_MATRIX,(GLfloat *) pmat );
- printf ("GL_MODELVIEW_MATRIX set :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", pmat[i][j]);
- printf ("\n");
- }
-#endif
- }
- }
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmPushAttriLight( void )
-{
- tsm_attri_blk node;
-
- node = new TSM_ATTRI_BLK();
-
- if( !attri_stk.IsEmpty() )
- *node = *attri_stk.Top();
- else
- *node = attri_default;
-
- attri_stk.Push( node );
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmPopAttriLight( void )
-{
- tsm_attri_blk node;
-
- if ( attri_stk.IsEmpty() )
- return TFailure; /* Underflow */
-
- node = attri_stk.ChangeTop();
- attri_stk.Pop();
- delete node;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static void call_util_transpose_mat (float tmat[16], float mat[4][4]) {
- int i, j;
-
- for (i=0; i<4; i++)
- for (j=0; j<4; j++)
- tmat[j*4+i] = mat[i][j];
-
-#ifdef TRACE
- printf ("Transposee :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", tmat[i*4+j]);
- printf ("\n");
- }
-#endif
-}
-/*----------------------------------------------------------------------*/
-
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-static void TelUpdatePolygonOffsets( tel_poffset_param pdata )
-{
-#ifdef TRACE
- printf(" *** TelUpdatePolygonOffsets: mode = %x, factor = %f, units = %f",
- pdata->mode, pdata->factor, pdata->units );
-#endif
- if ( ( pdata->mode & Aspect_POM_Fill ) == Aspect_POM_Fill )
- glEnable ( GL_POLYGON_OFFSET_FILL );
- else
- glDisable ( GL_POLYGON_OFFSET_FILL );
-
- if ( ( pdata->mode & Aspect_POM_Line ) == Aspect_POM_Line )
- glEnable ( GL_POLYGON_OFFSET_LINE );
- else
- glDisable( GL_POLYGON_OFFSET_LINE );
-
- if ( ( pdata->mode & Aspect_POM_Point ) == Aspect_POM_Point )
- glEnable ( GL_POLYGON_OFFSET_POINT );
- else
- glDisable( GL_POLYGON_OFFSET_POINT );
-
- glPolygonOffset( pdata->factor, pdata->units );
-}
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus BackInteriorColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackInteriorColourAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackInteriorColourDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackInteriorColourPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackInteriorColourInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- BackInteriorColourDisplay,
- BackInteriorColourAdd,
- BackInteriorColourDelete,
- BackInteriorColourPrint,
- BackInteriorColourInquire
-};
-
-
-MtblPtr
-TelBackInteriorColourInitClass( TelType *el )
-{
- *el = TelBackInteriorColour;
- return MtdTbl;
-}
-
-static TStatus
-BackInteriorColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_colour data = new TEL_COLOUR();
-
- if( !data )
- return TFailure;
-
- *data = *(tel_colour)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-BackInteriorColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour d;
- CMN_KEY key;
-
- d = (tel_colour)data.pdata;
-
- key.id = TelBackInteriorColour;
- key.data.pdata = d;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-BackInteriorColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-BackInteriorColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour p;
-
- p = (tel_colour)data.pdata;
-
- fprintf( stdout, "TelBackInteriorColour. R = %g, G = %g, B = %g\n",
- p->rgb[0], p->rgb[1], p->rgb[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-BackInteriorColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_colour col = (tel_colour)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
-
- w->gnl_colour.rgb[0] = col->rgb[0];
- w->gnl_colour.rgb[1] = col->rgb[1];
- w->gnl_colour.rgb[2] = col->rgb[2];
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/* 08-04-98 : FGU ; Ajout emission */
-/* 05-01-99 : CAL ; Warning WNT */
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-static TStatus BackInteriorReflectanceEquationAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackInteriorReflectanceEquationDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackInteriorReflectanceEquationPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackInteriorReflectanceEquationInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- BackInteriorReflectanceEquationDisplay,
- BackInteriorReflectanceEquationAdd,
- 0, /* Delete */
- BackInteriorReflectanceEquationPrint,
- BackInteriorReflectanceEquationInquire
-};
-
-
-MtblPtr
-TelBackInteriorReflectanceEquationInitClass( TelType *el )
-{
- *el = TelBackInteriorReflectanceEquation;
- return MtdTbl;
-}
-
-static TStatus
-BackInteriorReflectanceEquationAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-BackInteriorReflectanceEquationDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelBackInteriorReflectanceEquation;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-
-static TStatus
-BackInteriorReflectanceEquationPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- switch( data.ldata )
- {
- case CALL_PHIGS_REFL_NONE:
- fprintf( stdout, "TelBackInteriorReflectanceEquation. Value = \
- NONE\n" );
- break;
-
- default :
- /* affichage du flag d etat des composants lumineux du materiel */
- fprintf( stdout, "TelBackInteriorReflectanceEquation. Value = %d\n", data.ldata );
- break;
-
- /*case TelLModelAmbient:
- fprintf( stdout, "TelBackInteriorReflectanceEquation. Value = \
- GL_AMBIENT\n" );
- break;
-
- case TelLModelDiffuse:
- fprintf( stdout, "TelBackInteriorReflectanceEquation. Value = \
- GL_AMBIENT_AND_DIFFUSE\n" );
- break;*/
-
- /* FSXXX */
- /*case TelLModelSpecular:
- fprintf( stdout, "TelBackInteriorReflectanceEquation. Value = \
- GL_SPECULAR\n" );
- break;*/
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-BackInteriorReflectanceEquationInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus BackSurfaceAreaPropertiesDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackSurfaceAreaPropertiesAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackSurfaceAreaPropertiesDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackSurfaceAreaPropertiesPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus BackSurfaceAreaPropertiesInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- BackSurfaceAreaPropertiesDisplay,
- BackSurfaceAreaPropertiesAdd,
- BackSurfaceAreaPropertiesDelete,
- BackSurfaceAreaPropertiesPrint,
- BackSurfaceAreaPropertiesInquire
-};
-
-
-MtblPtr
-TelBackSurfaceAreaPropertiesInitClass( TelType *el )
-{
- *el = TelBackSurfaceAreaProperties;
- return MtdTbl;
-}
-
-static TStatus
-BackSurfaceAreaPropertiesAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_surf_prop data = new TEL_SURF_PROP();
- if( !data )
- return TFailure;
-
- *data = *(tel_surf_prop)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-BackSurfaceAreaPropertiesDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelBackSurfaceAreaProperties;
- key.data.pdata = data.pdata;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-BackSurfaceAreaPropertiesDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-BackSurfaceAreaPropertiesPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_surf_prop p = (tel_surf_prop)data.pdata;
-
- fprintf( stdout, "TelBackSurfaceAreaProperties\n" );
- fprintf( stdout, "\tAmbient Coeff: %f\n", p->amb );
- fprintf( stdout, "\tDiffuse Coeff: %f\n", p->diff );
- fprintf( stdout, "\tSpecular Coeff: %f\n", p->spec );
- fprintf( stdout, "\tTransparency Coeff: %f\n", p->trans );
- fprintf( stdout, "\tShininess: %f\n", p->shine );
- fprintf( stdout, "\tSpecular colour: R = %f, G = %f, B = %f\n",
- p->speccol.rgb[0], p->speccol.rgb[1], p->speccol.rgb[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-BackSurfaceAreaPropertiesInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_surf_prop p = (tel_surf_prop)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->surf_prop = *p;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/*
-// File: OpenGl_callback.h
-// Created: Thu Mar 3 12:34:02 2005
-// Author: Sergey ZERTCHANINOV
-// <sergey.zertchaninov@opencascade.com>
-// Copyright: Open CASCADE 2005
-*/
-
-#ifndef _OpenGl_callback_HeaderFile
-#define _OpenGl_callback_HeaderFile
-
-#include <OpenGl_tsm.hxx>
-
-MtblPtr EXPORT GetCallbackTable ();
-
-#endif /*_OpenGl_callback_HeaderFile*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus CharacterExpansionFactorDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CharacterExpansionFactorAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CharacterExpansionFactorDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CharacterExpansionFactorPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CharacterExpansionFactorInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- CharacterExpansionFactorDisplay, /* PickTraverse */
- CharacterExpansionFactorDisplay,
- CharacterExpansionFactorAdd,
- CharacterExpansionFactorDelete,
- CharacterExpansionFactorPrint,
- CharacterExpansionFactorInquire
-};
-
-
-MtblPtr
-TelCharacterExpansionFactorInitClass( TelType *el )
-{
- *el = TelCharacterExpansionFactor;
- return MtdTbl;
-}
-
-static TStatus
-CharacterExpansionFactorAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tfloat *data = new Tfloat();
- if( !data )
- return TFailure;
-
- *data = k[0]->data.fdata;
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-CharacterExpansionFactorDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelCharacterExpansionFactor;
- key.data.fdata = *(Tfloat*)(data.pdata);
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-CharacterExpansionFactorDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-static TStatus
-CharacterExpansionFactorPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelCharacterExpansionFactor. Value = %g\n", *(Tfloat *)(data.pdata));
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-CharacterExpansionFactorInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- Tfloat *f = (Tfloat*)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->fdata = *f;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus CharacterSpacingDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CharacterSpacingAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CharacterSpacingDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CharacterSpacingPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CharacterSpacingInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- CharacterSpacingDisplay, /* PickTraverse */
- CharacterSpacingDisplay,
- CharacterSpacingAdd,
- CharacterSpacingDelete,
- CharacterSpacingPrint,
- CharacterSpacingInquire
-};
-
-
-MtblPtr
-TelCharacterSpacingInitClass( TelType *el )
-{
- *el = TelCharacterSpacing;
- return MtdTbl;
-}
-
-static TStatus
-CharacterSpacingAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tfloat *data = new Tfloat();
- if( !data )
- return TFailure;
-
- *data = k[0]->data.fdata;
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-CharacterSpacingDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelCharacterSpacing;
- key.data.fdata = *(Tfloat*)(data.pdata);
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-CharacterSpacingDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-static TStatus
-CharacterSpacingPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelCharacterSpacing. Value = %g\n", *(Tfloat *)(data.pdata));
- fprintf( stdout, "\n" );
- return TSuccess;
-}
-
-
-static TStatus
-CharacterSpacingInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- Tfloat *f = (Tfloat*)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->fdata = *f;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-#ifndef OPENGL_CMN_VARARGS_H
-#define OPENGL_CMN_VARARGS_H
-
-#if !defined(__STDC__)
-# define __STDC__ 1
-#endif
-
-#include <stdarg.h>
-
-#if !defined(WNT)
-# include <X11/Xlib.h>
-# include <GL/glx.h>
-#endif
-
-typedef union CMN_KEY_DATA_UNION
-{
- Tint ldata;
-#if !defined(WNT)
- Pixmap pixmap;
- GLXPixmap
- glxpixmap;
-#endif
- Tfloat fdata;
- void *pdata;
-} CMN_KEY_DATA, *cmn_key_data;
-
-typedef struct
-{
- int id;
- CMN_KEY_DATA data;
-} CMN_KEY, *cmn_key;
-
-#if defined (SOLARIS) || defined (IRIXO32)
-
-#define CMN_GET_STACK(n,k) { \
- va_list p; \
- va_start (p, n); \
- if (n>=0) { \
- k = (cmn_key *)p; \
- } \
- else { \
- n = -n; \
- k = *(cmn_key **)p; \
- } \
-}
-
-#else /* DECOSF1 || HPUX || IRIX avec n32 */
-
-#define TMaxArgs 128
-
-#define CMN_GET_STACK(n,k) { \
- int i; \
- va_list ap; \
- cmn_key * args; \
- va_start (ap,n); \
- if (n>=0) { \
- for (i=0; i<n && i<TMaxArgs; i++) \
- k[i] = va_arg (ap, cmn_key); \
- } \
- else { \
- n = -n; \
- args = va_arg (ap, cmn_key *); \
- for (i=0; i<n && i<TMaxArgs; i++) \
- k[i] = args[i]; \
- } \
- va_end (ap); \
-}
-#endif /* DECOSF1 || HPUX || IRIX avec n32 */
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-Include OpenGl_context :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-05-08-97 : PCT ; support texture mapping
-augmentation de la taille de CONTEXTFILLAREA_SIZE
-car ajout de champs pour le texture mapping
-23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
-30-11-98 : FMN ; S3819 : Textes toujours visibles
-22-01-04 : SAN ; OCC2934 Texture mapped fonts on WNT
-22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-
-#ifndef OPENGL_CONTEXT_H
-#define OPENGL_CONTEXT_H
-
-#define CALL_DEF_CONTEXTLINE_SIZE 3
-
-/* 22-03-04 : SAN ; OCC4895 TelPolygonOffset element added to fill area context (size++) */
-#define CALL_DEF_CONTEXTFILLAREA_SIZE 17
-/* 22-03-04 : SAN ; OCC4895 TelPolygonOffset element added to fill area context (size++) */
-
-#define CALL_DEF_CONTEXTMARKER_SIZE 3
-
-
-/* TelTextZoomable, TelTextAngle, TelTextAspect element added to text context (size++) */
-#define CALL_DEF_CONTEXTTEXT_SIZE 10
-
-#endif
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus CurveDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CurveAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CurveDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CurvePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus CurveInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- CurveDisplay,
- CurveDisplay,
- CurveAdd,
- CurveDelete,
- CurvePrint,
- CurveInquire
-};
-
-struct TEL_CURVE_DATA
-{
- TelCurveType type; /* curve type : Bezier, Cardinal, BSpline */
- Tint num_points;
- TEL_POINT vertices[4]; /* vertices array */
- IMPLEMENT_MEMORY_OPERATORS
-};
-
-typedef TEL_CURVE_DATA* tel_curve_data;
-
-MtblPtr
-TelCurveInitClass( TelType* el )
-{
- *el = TelCurve;
- return MtdTbl;
-}
-
-static TStatus
-CurveAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-/* accepts the keys CURVE_TYPE_ID,
-CURVE_VERTICES_ID */
-{
- Tint i, j;
- tel_curve_data p;
-
- /* Recherche du type de la courbe. Presence obligatoire. */
- for( i = 0; i < n; i++ )
- {
- if( k[i]->id == CURVE_TYPE_ID )
- break;
- }
-
- /* Type de la courbe non fourni. */
- if( i == n )
- return TFailure;
-
- /* Recherche du nombre de points par courbe. Presence obligatoire. */
- for( j = 0; j < n; j++ )
- {
- if( k[j]->id == CURVE_NUM_POINTS_ID )
- break;
- }
-
- /* Nombre de points par courbe non fourni. */
- if( j == n )
- return TFailure;
-
- /* Nombre de points par courbe ridicule */
- if( k[j]->data.ldata < 2 )
- return TFailure;
-
- //cmn_memreserve( p, 1, 1 );
- p = new TEL_CURVE_DATA();
- p->type = (TelCurveType)k[i]->data.ldata;
- p->num_points = (TelCurveType)k[j]->data.ldata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case CURVE_VERTICES_ID:
- //cmn_memcpy<TEL_POINT>(p->vertices, k[i]->data.pdata, 4);
- memcpy(p->vertices, k[i]->data.pdata, 4*sizeof(TEL_POINT));
- break;
- }
- }
-
- ((tsm_elem_data)(d.pdata))->pdata = p;
-
- return TSuccess;
-}
-
-
-static TStatus
-CurveDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_curve_data d;
- CMN_KEY key;
- TEL_COLOUR colour;
- int i, j;
- GLfloat reseau[4][3];
-
- d = (tel_curve_data)data.pdata;
-
- /* Mode highlight en cours */
- if( k[0]->id == TOn )
- { /* Use highlight colours */
- TEL_HIGHLIGHT hrep;
-
- key.id = TelHighlightIndex;
- TsmGetAttri( 1, &key );
- if( TelGetHighlightRep( TglActiveWs, key.data.ldata, &hrep )
- == TSuccess )
- colour = hrep.col;
- else
- {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- colour = hrep.col;
- }
- }
- else
- {
- key.id = TelPolylineColour;
- key.data.pdata = &colour;
- TsmGetAttri( 1, &key );
- }
-
- /* Recopie des points du reseau : Pb prototypage en c ansi */
- for( i = 0; i < 4; i++ )
- for( j = 0; i < 3; i++ )
- reseau[i][j] = d->vertices[i].xyz[j];
-
- /* Determination du type de courbe */
- switch( d->type )
- {
- case TelBezierCurve:
- /* OGLXXX curvebasis: see man pages
- glMap1();glMap2();glMapGrid();
- */
- break;
- case TelCardinalCurve:
- /* OGLXXX curvebasis: see man pages
- glMap1();glMap2();glMapGrid();
- */
- break;
- case TelBSplineCurve:
- /* OGLXXX curvebasis: see man pages
- glMap1();glMap2();glMapGrid();
- */
- break;
- default:
- printf( "\n\tCurveDisplay : INVALID KEY" );
- break;
- }
-
- /* Determination du type de courbe */
- /* OGLXXX curveprecision:see man pages
- glMap1();glMap2();glMapGrid();
- */
-
- /* Couleur */
- glColor3fv( colour.rgb );
- /* OGLXXX replace u with domain coordinate
- glEvalCoord1f( u );
- */
-
- return TSuccess;
-}
-
-
-static TStatus
-CurveDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_curve_data p = (tel_curve_data)data.pdata;
- //cmn_freemem( p );
- delete p;
-
- return TSuccess;
-}
-
-
-
-
-static TStatus
-CurvePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_curve_data p = (tel_curve_data)data.pdata;
-
- fprintf( stdout, "TelCurve. \n" );
-
- fprintf( stdout, "\n\t\tVertices : " );
- for( i = 0; i < 4; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, p->vertices[i].xyz[0],
- p->vertices[i].xyz[1],
- p->vertices[i].xyz[2] );
-
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-static TStatus
-CurveInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_curve_data d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
-
- d = (tel_curve_data)data.pdata;
-
- size_reqd = sizeof( TEL_CURVE_DATA );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- if( c->size >= size_reqd )
- {
- w->pts3 = (tel_point) c->buf;
- //cmn_memcpy<TEL_POINT>( w->pts3, d->vertices, 4 );
- memcpy( w->pts3, d->vertices, 4*sizeof(TEL_POINT) );
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
+++ /dev/null
-/*
-File OpenGl_degeneration.c
-
-Created by EUG
-Modified 16/06/2000 : ATS : G005 : Move declarations to InterfaceGraphic_degeneration.h
-*/
-
-#ifndef __OPENGL_DEGENERATION_H
-# define __OPENGL_DEGENERATION_H
-
-#include <InterfaceGraphic_degeneration.hxx>
-
-#endif /* __OPENGL_DEGENERATION_H */
+++ /dev/null
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_degeneration.hxx>
-
-#include <stdio.h>
-
-static TStatus DegenerateModelAdd ( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus DegenerateModelDelete ( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus DegenerateModelPrint ( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus DegenerateModelInquire ( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus ( *MtdTbl[] ) ( TSM_ELEM_DATA, Tint, cmn_key* ) = {
-
- NULL, /* PickTraverse */
- NULL, /* DisplayTraverse */
- DegenerateModelAdd, /* Add */
- DegenerateModelDelete, /* Delete */
- DegenerateModelPrint, /* Print */
- DegenerateModelInquire /* Inquire */
-
-};
-
-
-MtblPtr TelDegenerateModelInitClass ( TelType* el ) {
-
- *el = TelDegenerationMode;
-
- return MtdTbl;
-
-} /* end TelDegenerateModelInitClass */
-
-static TStatus DegenerateModelAdd ( TSM_ELEM_DATA d, Tint n, cmn_key* k ) {
-
- PDEGENERATION p = new DEGENERATION();
- //( PDEGENERATION )cmn_getmem ( 1, sizeof( DEGENERATION ), 1 );
- //cmn_memcpy<DEGENERATION> ( p, k[ 0 ] -> data.pdata, 1 );
- memcpy( p, k[ 0 ] -> data.pdata, sizeof(DEGENERATION) );
-
- ( ( tsm_elem_data )( d.pdata ) ) -> pdata = p;
-
- return TSuccess;
-
-} /* end DegenerateModelAdd */
-
-static TStatus DegenerateModelDelete ( TSM_ELEM_DATA d, Tint n, cmn_key* k ) {
-
- //cmn_freemem ( d.pdata );
- delete d.pdata;
-
- return TSuccess;
-
-} /* end DegenerateModelDelete */
-
-static TStatus DegenerateModelPrint ( TSM_ELEM_DATA data, Tint n, cmn_key* k ) {
-
- char* ptr;
-
- switch ( data.ldata ) {
-
- case 0:
-
- ptr = "TelDegenerateModel. Value = NONE\n";
-
- break;
-
- case 1:
-
- ptr = "TelDegenerateModel. Value = TINY\n";
-
- break;
-
- case 2:
-
- ptr = "TelDegenerateModel. Value = WIREFRAME\n";
-
- break;
-
- case 3:
-
- ptr = "TelDegenerateModel. Value = MARKER\n";
-
- break;
-
- case 4:
-
- ptr = "TelDegenerateModel. Value = BBOX\n";
-
- break;
-
- case 5:
-
- ptr = "TelDegenerateModel. Value = AUTO\n";
-
- default:
-
- ptr = "TelDegenerateModel. Value = <invalid>\n";
-
- } /* end switch */
-
- fprintf ( stdout, ptr );
-
- return TSuccess;
-
-} /* end DegenerateModelPrint */
-
-
-static TStatus DegenerateModelInquire ( TSM_ELEM_DATA data, Tint n, cmn_key* k ) {
-
- Tint i;
-
- for ( i = 0; i < n; ++i )
-
- switch ( k[ i ] -> id ) {
-
- case INQ_GET_SIZE_ID:
-
- k[ i ] -> data.ldata = sizeof( Tint );
-
- break;
-
- case INQ_GET_CONTENT_ID: {
-
- TEL_INQ_CONTENT* c;
- Teldata* w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c -> data;
- c -> act_size = 0;
- w -> idata = data.ldata;
-
- } break;
-
- } /* end switch */
-
- return TSuccess;
-
-} /* end DegenerateModelInquire */
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_depthcue :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-12-02-97 : FMN ; Suppression de TelGetDepthCueRep
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stddef.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_telem_depthcue.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Definition des types
-*/
-
-struct TEL_DEPTHCUE_DATA
-{
- Tint dcid;
- TEL_DEPTHCUE dc;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_DEPTHCUE_DATA* tel_depthcue_data;
-
-struct TEL_WS_DEPTHCUES
-{
- Tint num; /* number of depthcues for a workstation */
- Tint siz; /* size allocated */
- tel_depthcue_data data; /* depthcue definitions for the workstation */
-};
-typedef TEL_WS_DEPTHCUES* tel_ws_depthcues;
-
-#define GROW_SIZE 25
-
-/*----------------------------------------------------------------------*/
-
-static Tint
-b_s( Tint id, tel_depthcue_data tbl, Tint low, Tint high )
-{
- register Tint mid, i;
-
- if( low > high )
- return -1;
-
- mid = low+high, mid /= 2;
- i = id - tbl[mid].dcid;
-
- return i == 0 ? mid : i < 0 ? b_s( id, tbl, low, mid-1 ) :
- b_s( id, tbl, mid+1, high );
-}
-
-/*----------------------------------------------------------------------*/
-
-static int
-lnumcomp( const void *a, const void *b )
-{
- return *( ( int* )a )- *( ( int* )b );
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TelSetDepthCueRep( Tint Wsid, Tint dcid, tel_depthcue dc )
-{
- CMN_KEY_DATA key;
- tel_depthcue_data dcptr;
- tel_ws_depthcues ws_dcues;
- register Tint i;
-
- TsmGetWSAttri( Wsid, WSDepthCues, &key );
- ws_dcues = (tel_ws_depthcues)key.pdata ; /* Obtain list of defined depthcues*/
-
- if( !ws_dcues ) /* no depthcues defined yet */
- { /* allocate */
- //cmn_memreserve( ws_dcues, 1, 0 );
- ws_dcues = new TEL_WS_DEPTHCUES();
- if( !ws_dcues )
- return TFailure;
-
- ws_dcues->data = new TEL_DEPTHCUE_DATA[GROW_SIZE];
- if( !ws_dcues->data )
- return TFailure;
-
- ws_dcues->siz = GROW_SIZE;
- ws_dcues->num = 0;
-
- key.pdata = ws_dcues;/* Set list for the workstation */
- TsmSetWSAttri( Wsid, WSDepthCues, &key );
- }
- else if( ws_dcues->num == ws_dcues->siz ) /* insufficient memory */
- { /* realloc */
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- ws_dcues->data = (TEL_DEPTHCUE_DATA*)realloc( ws_dcues->data, (ws_dcues->siz
- + GROW_SIZE)*sizeof(TEL_DEPTHCUE_DATA) );
-#else
- ws_dcues->data = cmn_resizemem<TEL_DEPTHCUE_DATA>( ws_dcues->data, ws_dcues->siz
- + GROW_SIZE );
-#endif
- if( !ws_dcues )
- return TFailure;
-
- ws_dcues->siz += GROW_SIZE;
-
- key.pdata = ws_dcues; /* Reset list for the workstation */
- TsmSetWSAttri( Wsid, WSDepthCues, &key );
- }
- dcptr = 0; /* Locate depthcue if already defined */
- i = b_s( dcid, ws_dcues->data, 0, ws_dcues->num-1 );
- if( i != -1 )
- dcptr = &ws_dcues->data[i]; /* depthcue already defined */
-
- if( !dcptr ) /* new depthcue */
- {
- dcptr = &ws_dcues->data[ws_dcues->num];
- dcptr->dcid = dcid; /* depthcues for the workstation */
- ws_dcues->num++; /* and sort the entries */
- qsort( ws_dcues->data, ws_dcues->num,
- sizeof(TEL_DEPTHCUE_DATA), lnumcomp );
- }
-
- dcptr->dc = *dc; /* copy depthcue definition */
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TelGetGLDepthCue( Tint Wsid, Tint Vid, Tint dcid, tel_gl_depthcue gldc )
-{
- CMN_KEY_DATA key;
- tel_depthcue_data dcptr;
- tel_ws_depthcues ws_dcues;
- TEL_VIEW_REP vrep;
- register Tint i;
- Tfloat ramp;
-
- TsmGetWSAttri( Wsid, WSDepthCues, &key );
- ws_dcues = (tel_ws_depthcues)key.pdata ; /* Obtain list of defined depthcues */
-
- if( !ws_dcues )
- return TFailure; /* no depthcues defined */
-
- dcptr = 0; /* Locate depthcue if already defined */
- i = b_s( dcid, ws_dcues->data, 0, ws_dcues->num-1 );
- if( i == -1 )
- return TFailure; /* dcid undefined */
-
- if( TelGetViewRepresentation( Wsid, Vid, &vrep ) == TFailure )
- return TFailure; /* Bad View Rep */
-
- dcptr = &ws_dcues->data[i];
- gldc->dcrep = dcptr->dc;
- if( dcptr->dc.mode == TelDCAllowed )
- {
- ramp = (dcptr->dc.planes[1] - dcptr->dc.planes[0]) /
- (dcptr->dc.scales[1] - dcptr->dc.scales[0]) ;
- gldc->dist[0] = dcptr->dc.planes[0] - (1-dcptr->dc.scales[0]) * ramp;
- gldc->dist[1] = dcptr->dc.planes[1] + dcptr->dc.scales[1] * ramp;
- ramp = vrep.extra.map.fpd - vrep.extra.map.bpd;
- gldc->dist[0] = gldc->dist[0]*ramp - vrep.extra.map.fpd;
- gldc->dist[1] = gldc->dist[1]*ramp - vrep.extra.map.fpd;
-#ifdef TRACE
- printf( "Dist: Near: %f\tFar: %f\n", gldc->dist[0], gldc->dist[1] );
- printf( "Scal: Near: %f\tFar: %f ramp %f\n",dcptr->dc.scales[0], dcptr->dc.scales[1],ramp );
- printf( "map Near: %f\tFar: %f\n",vrep.extra.map.fpd,vrep.extra.map.bpd);
-#endif
- }
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-TelPrintDepthCueRep( Tint Wsid, Tint dcid )
-{
- CMN_KEY_DATA key;
- tel_depthcue_data dcptr;
- tel_ws_depthcues ws_dcues;
- register Tint i;
-
- TsmGetWSAttri( Wsid, WSDepthCues, &key );
- ws_dcues = (tel_ws_depthcues)key.pdata ; /* Obtain list of defined depthcues */
-
- if( !ws_dcues )
- return; /* no depthcues defined */
-
- dcptr = 0; /* Locate depthcue if already defined */
- i = b_s( dcid, ws_dcues->data, 0, ws_dcues->num-1 );
- if( i == -1 )
- {
- fprintf( stdout, "\nBad DepthCue %d\n", dcid );
- return; /* dcid undefined */
- }
-
- dcptr = &ws_dcues->data[i];
- fprintf( stdout, "\nDepthCue Id: %d", dcid );
- fprintf( stdout, "\nDepthCue mode: %s", dcptr->dc.mode == TelDCAllowed ?
- "TelDCAllowed" : "TelDCSuppressed" );
- fprintf( stdout, "\n\tPlanes: Near %f\tFar %f",
- dcptr->dc.planes[0], dcptr->dc.planes[1] );
- fprintf( stdout, "\n\tScales: Near %f\tFar %f",
- dcptr->dc.scales[0], dcptr->dc.scales[1] );
- fprintf( stdout, "\n\tColour: %f %f %f",
- dcptr->dc.col.rgb[0],
- dcptr->dc.col.rgb[1],
- dcptr->dc.col.rgb[2] );
- fprintf( stdout, "\n" );
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TelDeleteDepthCuesForWS( Tint wsid )
-{
- CMN_KEY_DATA key;
- tel_ws_depthcues d;
-
- TsmGetWSAttri( wsid, WSDepthCues, &key );
- d = (tel_ws_depthcues)key.pdata;
-
- if( !d )
- return TSuccess;
-
- //cmn_freemem( d );
- delete d;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus DepthCueIndexAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus DepthCueIndexDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus DepthCueIndexPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus DepthCueIndexInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- DepthCueIndexDisplay, /* PickTraverse */
- DepthCueIndexDisplay,
- DepthCueIndexAdd,
- 0, /* Delete */
- DepthCueIndexPrint,
- DepthCueIndexInquire
-};
-
-
-MtblPtr
-TelDepthCueIndexInitClass( TelType *el )
-{
- *el = TelDepthCueIndex;
- return MtdTbl;
-}
-
-static TStatus
-DepthCueIndexAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-DepthCueIndexDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelDepthCueIndex;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-
-static TStatus
-DepthCueIndexPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelDepthCueIndex. Value = %d\n", data.ldata);
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-DepthCueIndexInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_dotexturemap.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-19-08-97 : FMN ; ajout texture mapping
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-/*----------------------------------------------------------------------*/
-
-static TStatus DoTextureMapMethodAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus DoTextureMapMethodDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus DoTextureMapMethodPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus DoTextureMapMethodInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- DoTextureMapMethodDisplay,
- DoTextureMapMethodAdd,
- 0, /* Delete */
- DoTextureMapMethodPrint,
- DoTextureMapMethodInquire
-};
-
-
-MtblPtr
-TelDoTextureMapInitClass( TelType *el )
-{
- *el = TelDoTextureMap;
- return MtdTbl;
-}
-
-static TStatus
-DoTextureMapMethodAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-DoTextureMapMethodDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelDoTextureMap;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-
-static TStatus
-DoTextureMapMethodPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- switch( data.ldata )
- {
- case TEL_SD_SHADING:
- fprintf( stdout, "TelDoTextureMap. Value = TEL_SD_SHADING\n" );
- break;
-
- case TEL_SD_TEXTURE:
- fprintf( stdout, "TelDoTextureMap. Value = TEL_SD_TEXTURE\n" );
- break;
- }
-
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-DoTextureMapMethodInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus EdgeColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeColourAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeColourDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeColourPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeColourInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- EdgeColourDisplay,
- EdgeColourAdd,
- EdgeColourDelete,
- EdgeColourPrint,
- EdgeColourInquire
-};
-
-
-MtblPtr
-TelEdgeColourInitClass( TelType *el )
-{
- *el = TelEdgeColour;
- return MtdTbl;
-}
-
-static TStatus
-EdgeColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_colour data = new TEL_COLOUR();
-
- //cmn_memreserve( data, 1, 0 );
- if( !data )
- return TFailure;
-
- *data = *(tel_colour)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-EdgeColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour d;
- CMN_KEY key;
-
- d = (tel_colour)data.pdata;
-
- key.id = TelEdgeColour;
- key.data.pdata = d;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-EdgeColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-EdgeColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour p;
-
- p = (tel_colour)data.pdata;
-
- fprintf( stdout, "TelEdgeColour. R = %g, G = %g, B = %g\n",
- p->rgb[0], p->rgb[1], p->rgb[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-EdgeColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_colour col = (tel_colour)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->gnl_colour = *col;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus EdgeFlagAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeFlagDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeFlagPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeFlagInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- EdgeFlagDisplay,
- EdgeFlagAdd,
- 0, /* Delete */
- EdgeFlagPrint,
- EdgeFlagInquire
-};
-
-
-MtblPtr
-TelEdgeFlagInitClass( TelType *el )
-{
- *el = TelEdgeFlag;
- return MtdTbl;
-}
-
-static TStatus
-EdgeFlagAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-EdgeFlagDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelEdgeFlag;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-
-static TStatus
-EdgeFlagPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- data.ldata == TOn ? fprintf( stdout, "TelEdgeFlag. Value = ON\n" ) :
-fprintf( stdout, "TelEdgeFlag. Value = OFF\n" );
-fprintf( stdout, "\n" );
-
-return TSuccess;
-}
-
-
-static TStatus
-EdgeFlagInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus EdgeTypeDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeTypeAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeTypePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeTypeInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- EdgeTypeDisplay,
- EdgeTypeAdd,
- 0, /* Delete */
- EdgeTypePrint,
- EdgeTypeInquire
-};
-
-
-MtblPtr
-TelEdgeTypeInitClass( TelType *el )
-{
- *el = TelEdgeType;
- return MtdTbl;
-}
-
-static TStatus
-EdgeTypeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-EdgeTypeDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- /* Yet to be coded */
- return TSuccess;
-}
-
-
-static TStatus
-EdgeTypePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- switch( data.ldata )
- {
- case TEL_LS_SOLID:
- fprintf( stdout, "TelEdgeType. Value = SOLID\n" );
- break;
-
- case TEL_LS_DOT:
- fprintf( stdout, "TelEdgeType. Value = DOT\n" );
- break;
-
- case TEL_LS_DASH_DOT:
- fprintf( stdout, "TelEdgeType. Value = DASH_DOT\n" );
- break;
-
- case TEL_LS_DASH:
- fprintf( stdout, "TelEdgeType. Value = DASH\n" );
- break;
-
- case TEL_LS_DOUBLE_DOT_DASH:
- fprintf( stdout, "TelEdgeType. Value = DOUBLE_DOT_DASH\n" );
- break;
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-EdgeTypeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus EdgeWidthDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeWidthAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeWidthDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeWidthPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus EdgeWidthInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- EdgeWidthDisplay,
- EdgeWidthAdd,
- EdgeWidthDelete,
- EdgeWidthPrint,
- EdgeWidthInquire
-};
-
-
-MtblPtr
-TelEdgeWidthInitClass( TelType *el )
-{
- *el = TelEdgeWidth;
- return MtdTbl;
-}
-
-static TStatus
-EdgeWidthAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tfloat *data = new Tfloat();
-
- //cmn_memreserve( data, 1, 0 );
- if( !data )
- return TFailure;
-
- *data = k[0]->data.fdata;
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-EdgeWidthDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelEdgeWidth;
- key.data.fdata = *(Tfloat*)(data.pdata);
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-EdgeWidthDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- //cmn_freemem( data.pdata );
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-static TStatus
-EdgeWidthPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelEdgeWidth. Value = %g\n", *(Tfloat *)(data.pdata));
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-EdgeWidthInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- Tfloat *f = (Tfloat *)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->fdata = *f;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_execstruct :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-22-04-96 : FMN ; Suppression prototype inutile.
-30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox.
-18-07-97 : FMN ; Meilleure gestion de la desactivation des lights
-10-09-97 : FMN ; Meilleure gestion de la desactivation des lights
-05-08-97 : PCT ; ajout descativation texture sur line etc...
-19-08-97 : PCT ; ajout pourcentage de reflexion des objets avec textues environnante
-22-12-97 : FMN ; Correction PRO10217 sur le mode Transient
-13-03-98 : FMN ; Suppression variable externe TglUpdateView0
-17-03-98 : FMN ; Ajout mode animation
-- deplacement TelSetViewIndex vers OpenGl_execstruct.c.
-- gestion du mode animation.
-16-06-2000 : ATS,GG : G005 : Some conditions for execution of PARRAY primitives
-
-************************************************************************/
-#ifdef DEBUG
-#define TRACE
-#define TRACE_EXEC
-#endif
-
-#define G003 /* EUG 16-09-99 G003 ZBufferAuto treatment
-*/
-
-#define BUC60742 /* GG 18/09/00 Enable to use both animation and
-graphic structure transformation
-*/
-
-#define G005 /* ATS,GG 11/01/00 Using arrays of primitives
-*/
-
-#define IMP051001 /* GG Enable/Disable polygon offset for
-highlighted graphic structures
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <OpenGl_tgl_subrvis.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_telem_filters.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_TextureBox.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_telem_pick.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_telem_util.hxx> /* for matcpy */
-
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_TextureBox.hxx>
-
-#include <OpenGl_trsf_stack.hxx>
-
-#ifdef G003
-# include <OpenGl_degeneration.hxx>
-#endif /* G003 */
-#ifdef G005
-#include <InterfaceGraphic_PrimitiveArray.hxx>
-#endif
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-extern tsm_trsf_stack cur_trsf_stack;
-#ifdef G003
-#define D_MODE( d ) ( int )( ( ( PDEGENERATION )( d.data.pdata ) ) -> mode )
-#define S_RATIO( d ) ( float )( ( ( PDEGENERATION )( d.data.pdata ) ) -> skipRatio )
-extern GLboolean g_fAnimation;
-extern GLboolean g_fDegeneration;
-int g_nDegenerateModel;
-float g_fSkipRatio;
-#endif /* G003 */
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-static TEL_PACKED_NAME pn;
-
-#define PUSHNAME( a ) pn.i = a, glPushName( pn.s[0] ), glPushName( pn.s[1] )
-#define LOADNAME( a ) pn.i = a, glPopName(), glLoadName( pn.s[0] ), \
- glPushName( pn.s[1] )
-#define POPNAME() glPopName(), glPopName()
-
-#define NO_TRACE_LIGHT
-#define NO_TRACE_EXEC
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes fonctions
-*/
-
-static TStatus ExecuteStructurePick( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ExecuteStructureDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ExecuteStructureAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ExecuteStructurePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ExecuteStructureInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables locales
-*/
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- ExecuteStructurePick,
- ExecuteStructureDisplay,
- ExecuteStructureAdd,
- 0, /* Delete : may be provided for deleting structure
- network */
- ExecuteStructurePrint,
- ExecuteStructureInquire
-};
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr
-TelExecuteStructureInitClass( TelType *el )
-{
- *el = TelExecuteStructure;
- return MtdTbl;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ExecuteStructureAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ExecuteStructurePick( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i, num;
- tsm_node node;
- register Tint display = 1;
- register Tint pickfl = 0;
- register TelType elem;
- Tint vp;
- Tint view = 0;
- CMN_KEY key;
-
- if( TsmGetStructure( data.ldata, &num, &node ) == TFailure )
- return TFailure;
-
- if( !num )
- return TSuccess;
-
- PUSHNAME( data.ldata ); /* Struct id */
- PUSHNAME( -1 ); /* Pick id; dummy */
- PUSHNAME( -1 ); /* Elem no.; dummy */
-
- TsmPushAttri(); /* save previous graphics context */
- TglNamesetPush();
- if( TglFilterNameset( k[0]->id, InvisFilter ) == TSuccess )
- display = 0;
- if( TglFilterNameset( k[0]->id, PickFilter ) == TSuccess )
- pickfl = 1;
- key.id = TelViewIndex;
- TsmGetAttri( 1, &key );
- vp = key.data.ldata;
- if( TglVpBeingPicked == vp )
- view = 1;
- for( i = 0; i < num; i++, node = node->next )
- {
- elem = node->elem.el;
- switch( elem )
- {
- case TelAddNameset:
- case TelRemoveNameset:
- {
- TsmSendMessage( elem, PickTraverse, node->elem.data, 0 );
- if( TglFilterNameset( k[0]->id, InvisFilter ) == TSuccess )
- display = 0;
- else
- display = 1;
- if( TglFilterNameset( k[0]->id, PickFilter ) == TSuccess )
- pickfl = 1;
- else
- pickfl = 0;
- break;
- }
- case TelExecuteStructure:
- {
- LOADNAME( i+1 ); /* Elem no. */
- TsmSendMessage( elem, PickTraverse, node->elem.data, -1, k );
- break;
- }
- case TelPickId:
- {
- POPNAME(); /* Elem no. */
- LOADNAME( node->elem.data.ldata ); /* Pick id */
- PUSHNAME( -1 ); /* Elem no.; dummy */
- break;
- }
- case TelViewIndex:
- {
- vp = node->elem.data.ldata;
- if( vp == TglVpBeingPicked )
- {
- view = 1;
- key.id = TOn;
- }
- else
- {
- view = 0;
- key.id = TOff;
- }
- TsmSendMessage( elem, PickTraverse, node->elem.data, 1, &key );
- break;
- }
- case TelCurve:
- case TelPolygon:
- case TelPolygonSet:
- case TelPolygonHoles:
- case TelPolygonIndices:
- case TelQuadrangle:
- case TelPolyline:
- case TelMarker:
- case TelMarkerSet:
- case TelText:
- case TelTriangleMesh:
-#ifdef G005
- case TelParray:
- /* do not send Pick message to */
- { /* primitives if they are not pickable */
- if( pickfl && view && display )
- {
- key.id = TOff; /* dummy key for highlight flag */
- LOADNAME( i+1 ); /* Elem no. */
- TsmSendMessage( elem, PickTraverse, node->elem.data, 1, &key );
- }
- break;
- }
-#endif
-
- default:
- {
- TsmSendMessage( elem, PickTraverse, node->elem.data, 0 );
- break;
- }
- }
- }
- TglNamesetPop();
- TsmPopAttri(); /* restore previous graphics context */
-
- POPNAME(); /* Elem no. */
- POPNAME(); /* Pick id */
- POPNAME(); /* Struct id */
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ExecuteStructureDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i, num;
- tsm_node node;
- register Tint display = 1;
- register Tint highl = TOff;
- register TelType elem;
- Tint vp;
- CMN_KEY key;
-#ifdef G003
- static GLboolean s_fWire = GL_FALSE;
- static Tint s_depth = 0;
- static Tint save_texture_state = 0;
- static CMN_KEY s_kLineWidth;
- static CMN_KEY s_kPolyType;
- TStatus retVal = TSuccess;
-#else
- int save_texture_state;
-#endif
-
- if( TsmGetStructure( data.ldata, &num, &node ) == TFailure )
-#ifdef G003
- { retVal = TFailure; goto ret; }
-#else
- return TFailure;
-#endif
-
- if( !num )
-#ifdef G003
- goto ret;
-#else
- return TSuccess;
-#endif
-
-#ifdef G003
- ++s_depth;
-#ifdef TRACE
- printf(" .. ExecuteStructureDisplay.s_depth = %d\n",s_depth);
-#endif
-#endif /*G003*/
-
- TsmPushAttri(); /* save previous graphics context */
- TglNamesetPush();
- if( TglFilterNameset( k[0]->id, InvisFilter ) == TSuccess )
- display = 0;
- if( TglFilterNameset( k[0]->id, HighlFilter ) == TSuccess )
- highl = TOn;
- key.id = TelViewIndex;
- TsmGetAttri( 1, &key );
-#ifdef G003
- if ( s_depth == 1 ) {
- glPushAttrib ( GL_DEPTH_BUFFER_BIT );
- s_kLineWidth.id = TelPolylineWidth;
- s_kPolyType.id = TelPolylineType;
-#ifdef BUG
- TsmGetAttri ( 1, &s_kLineWidth, &s_kPolyType );
-#else
- TsmGetAttri ( 2, &s_kLineWidth, &s_kPolyType );
-#endif
- g_nDegenerateModel = 0;
- g_fSkipRatio = 0.0F;
- } /* end if */
-#endif /* G003 */
-
- vp = key.data.ldata;
- for( i = 0; i < num; i++, node = node->next )
- {
- elem = node->elem.el;
-#ifdef TRACE_EXEC
-#include <OpenGl_traces.hxx>
-#endif
- switch( elem )
- {
-#ifdef G003
- case TelDegenerationMode:
-
- if ( g_fDegeneration )
-
- switch ( g_nDegenerateModel = D_MODE( node->elem ) )
- {
-
- case 0:
-
- break;
-
- default:
-
- glLineWidth ( 1.0 );
- glDisable ( GL_LINE_STIPPLE );
-
- case 1:
-
- g_fSkipRatio = S_RATIO( node->elem );
-
- } /* end switch */
-
- break;
-#endif /* G003 */
- case TelAddNameset:
- case TelRemoveNameset:
- {
- TsmSendMessage( elem, DisplayTraverse, node->elem.data, 0 );
- if( TglFilterNameset( k[0]->id, InvisFilter ) == TSuccess )
- display = 0;
- else
- display = 1;
- if( TglFilterNameset( k[0]->id, HighlFilter ) == TSuccess )
- highl = TOn;
- else
- highl = TOff;
- break;
- }
- case TelExecuteStructure:
- {
- tsm_trsf_stack new_trsf_stack = NULL;
-
- new_trsf_stack = (tsm_trsf_stack) malloc (sizeof (TSM_TRSF_STACK));
- cur_trsf_stack->next = new_trsf_stack;
- new_trsf_stack->prev = cur_trsf_stack;
- new_trsf_stack->next = NULL;
- matcpy(new_trsf_stack->LocalTran3, cur_trsf_stack->LocalTran3);
- cur_trsf_stack = new_trsf_stack;
-
-#ifdef TRACE
- printf(" .. ExecuteStructureDisplay.TelExecuteStructure.s_depth = %d\n",s_depth);
-#endif
-#ifdef BUC60742
- glMatrixMode (GL_MODELVIEW);
- glPushMatrix();
-#endif
- TsmSendMessage( elem, DisplayTraverse, node->elem.data, -1, k );
-#ifdef BUC60742
- glMatrixMode (GL_MODELVIEW);
- glPopMatrix();
-#endif
- cur_trsf_stack = new_trsf_stack->prev;
- cur_trsf_stack->next = NULL;
- free (new_trsf_stack);
- break;
- }
- case TelViewIndex:
- {
- break;
- }
-
- case TelPolyline:
- case TelMarker:
- case TelMarkerSet:
- case TelText:
- { /* primitives if they are invisible */
- if( display )
- {
- LightOff();
-#ifdef G003
- if ( g_fAnimation && !s_fWire && g_nDegenerateModel ) {
- glDisable ( GL_DEPTH_TEST );
-#endif /* G003 */
- save_texture_state = IsTextureEnabled();
- if( save_texture_state ) DisableTexture();
-#ifdef G003
- s_fWire = GL_TRUE;
- } /* end if */
-#endif /* G003 */
-
- key.id = highl;
- TsmSendMessage( elem, DisplayTraverse, node->elem.data, 1, &key );
- if (save_texture_state) EnableTexture();
- }
- break;
- }
- case TelCurve:
- case TelPolygon:
- case TelPolygonSet:
- case TelPolygonIndices:
- case TelQuadrangle:
- case TelTriangleMesh:
- case TelPolygonHoles: /* do not send Display message to */
- { /* primitives if they are invisible */
- if( display )
- {
-#ifdef G003
- if ( g_fAnimation && s_fWire && g_nDegenerateModel < 2 ) {
- if ( save_texture_state ) EnableTexture ();
- glEnable ( GL_DEPTH_TEST );
- s_fWire = GL_FALSE;
- } /* end if */
-#endif /* G003 */
-#ifdef IMP051001
- if( highl )
- call_subr_disable_polygon_offset();
-#endif
- key.id = highl;
- TsmSendMessage( elem, DisplayTraverse, node->elem.data, 1, &key );
-#ifdef IMP051001
- if( highl )
- call_subr_enable_polygon_offset();
-#endif
- }
- break;
- }
-#ifdef G005
- case TelParray:
- if( display ) {
- CALL_DEF_PARRAY *pa = (CALL_DEF_PARRAY *)node->elem.data.pdata;
- switch ( pa->type )
- {
- case TelPointsArrayType:
- case TelPolylinesArrayType:
- case TelSegmentsArrayType:
- LightOff();
-#ifdef G003
- if ( g_fAnimation && !s_fWire && g_nDegenerateModel ) {
- glDisable ( GL_DEPTH_TEST );
-#endif /* G003 */
- save_texture_state = IsTextureEnabled();
- if( save_texture_state ) DisableTexture();
-#ifdef G003
- s_fWire = GL_TRUE;
- } /* end if */
-#endif /* G003 */
-
- key.id = highl;
- TsmSendMessage( elem, DisplayTraverse, node->elem.data, 1, &key );
- if (save_texture_state) EnableTexture();
- break;
- case TelPolygonsArrayType:
- case TelTrianglesArrayType:
- case TelQuadranglesArrayType:
- case TelTriangleStripsArrayType:
- case TelTriangleFansArrayType:
- case TelQuadrangleStripsArrayType:
-#ifdef G003
- if ( g_fAnimation && s_fWire && g_nDegenerateModel < 2 ) {
- if ( save_texture_state ) EnableTexture ();
- glEnable ( GL_DEPTH_TEST );
- s_fWire = GL_FALSE;
- } /* end if */
-#endif /* G003 */
- key.id = highl;
- TsmSendMessage( elem, DisplayTraverse, node->elem.data, 1, &key );
- break;
- default:
- break;
- }
- }
- break;
-#endif /*G005*/
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- case TelTransformPersistence:
- {
- /*CALL_DEF_TRANSFORM_PERSISTENCE*/
- TEL_TRANSFORM_PERSISTENCE *tp
- = (tel_transform_persistence)node->elem.data.pdata;
- if( tp->mode != 0 )
- TsmSendMessage (elem, DisplayTraverse, node->elem.data, 1, &key);
- break;
- }
- /*ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- case TelUserdraw:
- {
- if( display )
- {
- key.id = highl;
- TsmSendMessage( elem, DisplayTraverse, node->elem.data, 1, &key );
- }
- break;
- }
- default:
- {
- TsmSendMessage( elem, DisplayTraverse, node->elem.data, 0 );
- break;
- }
- }
- }
- TglNamesetPop();
- TsmPopAttri(); /* restore previous graphics context; before update lights */
-#ifdef G003
-ret:
- if ( s_depth == 1 ) {
- s_fWire = GL_FALSE;
-
- if ( g_nDegenerateModel > 1 ) {
- glLineWidth ( s_kLineWidth.data.fdata );
- if ( s_kPolyType.data.ldata != TEL_LS_SOLID ) glEnable ( GL_LINE_STIPPLE );
- } /* end if */
-
- glPopAttrib ();
- } /* end if */
-
- --s_depth;
- return retVal;
-#else
- return TSuccess;
-#endif
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ExecuteStructurePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelExecuteStructure. Value = %d\n", data.ldata);
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ExecuteStructureInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus FaceCullingModeDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus FaceCullingModeAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus FaceCullingModePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus FaceCullingModeInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- FaceCullingModeDisplay, /* PickTraverse */
- FaceCullingModeDisplay,
- FaceCullingModeAdd,
- 0, /* Delete */
- FaceCullingModePrint,
- FaceCullingModeInquire
-};
-
-
-MtblPtr
-TelFaceCullingModeInitClass( TelType *el )
-{
- *el = TelFaceCullingMode;
- return MtdTbl;
-}
-
-static TStatus
-FaceCullingModeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-FaceCullingModeDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelFaceCullingMode;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-FaceCullingModePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- switch( data.ldata )
- {
- case TelCullNone:
- fprintf( stdout, "TelFaceCullingMode. Value = CULL_NONE\n" );
- break;
-
- case TelCullFront:
- fprintf( stdout, "TelFaceCullingMode. Value = CULL_FRONT\n" );
- break;
-
- case TelCullBack:
- fprintf( stdout, "TelFaceCullingMode. Value = CULL_BACK\n" );
- break;
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-FaceCullingModeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- /* w->face_processing_mode.cull = data.ldata; */
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus FaceDistinguishingModeAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus FaceDistinguishingModeDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus FaceDistinguishingModePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus FaceDistinguishingModeInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- FaceDistinguishingModeDisplay,
- FaceDistinguishingModeAdd,
- 0, /* Delete */
- FaceDistinguishingModePrint,
- FaceDistinguishingModeInquire,
-};
-
-
-MtblPtr
-TelFaceDistinguishingModeInitClass( TelType *el )
-{
- *el = TelFaceDistinguishingMode;
- return MtdTbl;
-}
-
-static TStatus
-FaceDistinguishingModeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-FaceDistinguishingModeDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelFaceDistinguishingMode;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-
-static TStatus
-FaceDistinguishingModePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- data.ldata == TOn ?
- fprintf( stdout, "TelFaceDistinguishingMode. Value = ON\n" ) :
- fprintf( stdout, "TelFaceDistinguishingMode. Value = OFF\n" );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-FaceDistinguishingModeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- /* w->face_processing_mode.distinguish = data.ldata; */
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_filters :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stdlib.h>
-#include <stddef.h>
-
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_filters.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Definition des types
-*/
-
-struct TGL_FILTERS
-{
- Tint invis_incl_num,
- invis_excl_num,
- pick_incl_num,
- pick_excl_num,
- highl_incl_num,
- highl_excl_num;
-
- Tint invis_incl_siz,
- invis_excl_siz,
- pick_incl_siz,
- pick_excl_siz,
- highl_incl_siz,
- highl_excl_siz;
-
- Tint *invis_incl_lis,
- *invis_excl_lis,
- *pick_incl_lis,
- *pick_excl_lis,
- *highl_incl_lis,
- *highl_excl_lis;
-
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TGL_FILTERS* tgl_filters;
-
-struct TGL_NAMESET_NODE_STRUCT
-{
- Tint num, siz, *ptr;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TGL_NAMESET_NODE_STRUCT TGL_NAMESET_NODE;
-typedef TGL_NAMESET_NODE_STRUCT* tgl_nameset_node;
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables locales
-*/
-
-typedef NCollection_Stack<TGL_NAMESET_NODE*> NodeStack;
-typedef NCollection_List<TGL_FILTERS*> FilterList;
-
-static NodeStack _NodeStack;
-static FilterList _FilterList;
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define LIST_GROW_SIZE 25
-#define FIL_STBL_SIZE 23
-
-/*----------------------------------------------------------------------*/
-
-static int
-num_comp( const void* a, const void* b )
-{
- return *( Tint* )a - *( Tint* )b;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-set_filter( Tint n, Tint *ls, Tint *num, Tint *siz, Tint **list )
-{
- Tint size;
-
- size = n,
- size %= LIST_GROW_SIZE,
- size += 1,
- size *= LIST_GROW_SIZE;
- if( !*siz )
- {
- //cmn_memreserve( *list, size, 0 );
- *list = new Tint[size];
- if( !*list )
- return TFailure;
-
- *siz = size;
- }
- else if( *siz < n )
- {
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- *list = (Tint*)realloc( *list, size*sizeof(Tint) );
-#else
- *list = cmn_resizemem<Tint>( *list, size );
-#endif
- if( !*list )
- return TFailure;
-
- *siz = size;
- }
- //cmn_memcpy<Tint>( *list, ls, n );
- memcpy( *list, ls, n*sizeof(Tint) );
- qsort( *list, n, sizeof(Tint), num_comp );
- *num = TelRemdupnames( *list, n );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static tgl_filters
-getfiltrec( Tint wsid )
-{
- tgl_filters filt;
- CMN_KEY_DATA data;
-
- if( TsmGetWSAttri( wsid, WSFilters, &data ) == TFailure )
- return 0;
-
- filt = (tgl_filters)data.pdata;
- if( !filt )
- {
- filt = new TGL_FILTERS();
- data.pdata = filt;
- TsmSetWSAttri( wsid, WSFilters, &data );
- }
-
- return filt;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TglSetHighlFilter( Tint wsid, Tint in_num, Tint *in_lis,
- Tint ex_num, Tint *ex_lis )
-{
- TStatus ret;
- tgl_filters filter;
-
- filter = getfiltrec( wsid );
- if( !filter )
- return TFailure;
-
- ret = set_filter( in_num, in_lis, &filter->highl_incl_num,
- &filter->highl_incl_siz, &filter->highl_incl_lis );
- if( ret == TSuccess )
- ret = set_filter( ex_num, ex_lis, &filter->highl_excl_num,
- &filter->highl_excl_siz, &filter->highl_excl_lis );
- return ret;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TglSetPickFilter( Tint wsid, Tint in_num, Tint *in_lis,
- Tint ex_num, Tint *ex_lis )
-{
- TStatus ret;
- tgl_filters filter;
-
- filter = getfiltrec( wsid );
- if( !filter )
- return TFailure;
-
- ret = set_filter( in_num, in_lis, &filter->pick_incl_num,
- &filter->pick_incl_siz, &filter->pick_incl_lis );
- if( ret == TSuccess )
- ret = set_filter( ex_num, ex_lis, &filter->pick_excl_num,
- &filter->pick_excl_siz, &filter->pick_excl_lis );
- return ret;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TglSetInvisFilter( Tint wsid, Tint in_num, Tint *in_lis,
- Tint ex_num, Tint *ex_lis )
-{
- TStatus ret;
- tgl_filters filter;
-
- filter = getfiltrec( wsid );
- if( !filter )
- return TFailure;
-
- ret = set_filter( in_num, in_lis, &filter->invis_incl_num,
- &filter->invis_incl_siz, &filter->invis_incl_lis );
- if( ret == TSuccess )
- ret = set_filter( ex_num, ex_lis, &filter->invis_excl_num,
- &filter->invis_excl_siz, &filter->invis_excl_lis );
- return ret;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TglNamesetPush( void )
-{
- tgl_nameset_node node;
-
- node = new TGL_NAMESET_NODE();
- if ( _NodeStack.IsEmpty() || !_NodeStack.Top() || !_NodeStack.Top()->ptr )
- /* abd
- if( !name_tail || !name_tail->ptr )*/
- {
- node->ptr = 0, node->num = node->siz = 0;
- }
- else /* copy previous stack entry to new one */
- {
- Tint size = _NodeStack.Top()->siz;
-
- node->ptr = new Tint[size];
- if( !node->ptr )
- return TFailure;
-
- node->siz = size;
- node->num = _NodeStack.Top()->num;
- memcpy( node->ptr, _NodeStack.Top()->ptr, node->num*sizeof(Tint) );
- }
-
- _NodeStack.Push( node );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-
-TStatus
-TglNamesetPop( void )
-{
- tgl_nameset_node node =
- _NodeStack.ChangeTop();
-
- _NodeStack.Pop();
- if( node->ptr )
- {
- /* Remove entries from sorted list*/
- delete[] node->ptr;
- }
- delete node;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TglNamesetAdd( Tint num, Tint *set )
-{
- if (_NodeStack.IsEmpty())
- return TFailure;
-
- Tint size;
- tgl_nameset_node name_tail = _NodeStack.ChangeTop();
-
- size = num,
- size %= LIST_GROW_SIZE,
- size++,
- size *= LIST_GROW_SIZE;
-
- if( !name_tail->ptr )
- {
- name_tail->ptr = new Tint[size];
- if( !name_tail->ptr )
- return TFailure;
-
- name_tail->siz = size;
- }
- else if( name_tail->siz < name_tail->num + num )
- {
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- name_tail->ptr = (Tint*)realloc( name_tail->ptr, size*sizeof(Tint) );
-#else
- name_tail->ptr = cmn_resizemem<Tint>( name_tail->ptr, size );
-#endif
- if( !name_tail->ptr )
- return TFailure;
-
- name_tail->siz = size;
- }
- memcpy( &name_tail->ptr[name_tail->num], set, num*sizeof(Tint) );
- name_tail->num += num;
-
- /* sort new set */
- qsort( name_tail->ptr, name_tail->num, sizeof(Tint), num_comp );
- name_tail->num = TelRemdupnames( name_tail->ptr, name_tail->num );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TglNamesetRemove( Tint num, Tint *set )
-{
- Tint size, *ptr, *temp;
- register Tint i, j, k, *prev;
-
- if (_NodeStack.IsEmpty())
- return TFailure;
-
- tgl_nameset_node name_tail = _NodeStack.ChangeTop();
-
- if( !name_tail || !name_tail->ptr || !num )
- return TFailure;
-
- ptr = new Tint[name_tail->siz];
- if( !ptr )
- return TFailure;
-
- size = num, size %= LIST_GROW_SIZE, size++, size *= LIST_GROW_SIZE;
- temp = new Tint[size];
- if( !temp )
- return TFailure;
- memcpy( temp, set, num*sizeof(Tint) );
-
- /* sort new set */
- qsort( temp, num, sizeof(Tint), num_comp );
- num = TelRemdupnames( temp, num );
-
- prev = name_tail->ptr;
- i = j = k = 0;
- while(1)
- {
- if( prev[i] < temp[j] )
- ptr[k++] = prev[i++];
- else if( prev[i] > temp[j] )
- j++;
- else /* prev[i] == temp[j] */
- i++, j++;
- if( i == name_tail->num )
- break;
- if( j == num )
- {
- while( i < name_tail->num )
- ptr[k++] = prev[i++];
- break;
- }
- }
- //cmn_freemem( temp );
- delete[] temp;
- //cmn_freemem( name_tail->ptr );
- delete[] name_tail->ptr;
-
- name_tail->ptr = ptr;
- name_tail->num = k;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static Tint
-find( Tint num1, Tint *array1, Tint num2, Tint *array2 )
-{
- Tint i=0, j=0;
-
- while(num1 && num2)
- {
- if( array1[i] < array2[j] )
- i++;
- else if( array1[i] > array2[j] )
- j++;
- else
- return 1;
-
- if( i == num1 || j == num2 )
- return 0;
- }
- return 0;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TglFilterNameset( Tint wsid, TFilterSet set )
-{
- tgl_filters filter;
- if (_NodeStack.IsEmpty())
- return TFailure;
-
- tgl_nameset_node name_tail = _NodeStack.ChangeTop();
-
- filter = getfiltrec( wsid );
- if( !filter )
- return TFailure;
-
- switch( set )
- {
- case InvisFilter:
- {
- if( find( filter->invis_excl_num, filter->invis_excl_lis,
- name_tail->num, name_tail->ptr ) )
- return TFailure;
-
- if( find( filter->invis_incl_num, filter->invis_incl_lis,
- name_tail->num, name_tail->ptr ) )
- return TSuccess;
-
- break;
- }
-
- case HighlFilter:
- {
- if( find( filter->highl_excl_num, filter->highl_excl_lis,
- name_tail->num, name_tail->ptr ) )
- return TFailure;
-
- if( find( filter->highl_incl_num, filter->highl_incl_lis,
- name_tail->num, name_tail->ptr ) )
- return TSuccess;
-
- break;
- }
-
- case PickFilter:
- {
- if( find( filter->pick_excl_num, filter->pick_excl_lis,
- name_tail->num, name_tail->ptr ) )
- return TFailure;
-
- if( find( filter->pick_incl_num, filter->pick_incl_lis,
- name_tail->num, name_tail->ptr ) )
- return TSuccess;
-
- break;
- }
- }
-
- return TFailure;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TglDeleteFiltersForWS( Tint wsid )
-{
- CMN_KEY_DATA key;
- tgl_filters f;
-
- TsmGetWSAttri( wsid, WSFilters, &key );
- f = (tgl_filters)key.pdata;
-
- if( !f )
- return TSuccess;
-
- if( f->invis_incl_siz )
- //cmn_freemem( f->invis_incl_lis );
- delete[] f->invis_incl_lis;
- if( f->pick_incl_siz )
- //cmn_freemem( f->pick_incl_lis );
- delete[] f->pick_incl_lis;
- if( f->highl_incl_siz )
- //cmn_freemem( f->highl_incl_lis );
- delete[] f->highl_incl_lis;
- if( f->invis_excl_siz )
- //cmn_freemem( f->invis_excl_lis );
- delete[] f->invis_excl_lis;
- if( f->pick_excl_siz )
- //cmn_freemem( f->pick_excl_lis );
- delete[] f->pick_excl_lis;
- if( f->highl_excl_siz )
- //cmn_freemem( f->highl_excl_lis );
- delete[] f->highl_excl_lis;
-
- //cmn_stg_tbl_free( f );
- delete f;
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_funcs :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-13-06-96 : CAL ; Gestion de la transparence dans redraw_all_structs
-09-07-97 : FMN ; Verification calcul matrice orientation et projection.
-Je n'ai verifie que le mode parallele pas le mode perspective.
-18-07-97 : FMN ; Desactivation des lights au demarrage
-05-08-97 : PCT ; Support texture mapping
-19-08-97 : PCT ; ajout reflexion
-23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
-et TelBackInteriorShadingMethod
-13-01-98 : FMN ; Oublie printf
-03-03-98 : FMN ; Suppression variable externe TglWhetherPerspective
-13-03-98 : FMN ; Suppression variable externe TglUpdateView0
-17-03-98 : FMN ; Ajout mode animation
-- deplacement TelSetViewIndex de OpenGl_execstruct.c ici.
-- gestion du mode animation.
-29-04-98 : FMN ; Mode animation
-- ajout TsmPushAttri et TsmPopAttri necessaire pour
-sauvegarder la point de vue.
-- ajout init de la var TglActiveWs
-08-07-98 : FMN ; Mode animation: ajout print debug
-27-11-98 : CAL ; S4062. AJout des layers.
-30-11-98 : FMN ; S3819 : Textes toujours visibles
-14-12-98 : BGN ; (S3989, Phase "triedre") ajout du reaffichage
-du triedre .
-05-01-99 : CAL ; Warning WNT
-22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets
-
-************************************************************************/
-
-#define G003 /* EUG 20-09-99 ; Animation management
-*/
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_TextureBox.hxx>
-#include <OpenGl_animation.hxx>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_telem.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_trsf_stack.hxx>
-#include <OpenGl_triedron.hxx>
-#include <OpenGl_graduatedtrihedron.hxx>
-
-#ifdef G003
-# include <OpenGl_degeneration.hxx>
-#endif /* G003 */
-
-#if defined(WNT)
-#include <GL/glu.h>
-#endif
-
-#include <OSD_FontAspect.hxx>
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define NO_PRINT
-#define NO_DEBUG
-#define NO_DEBUG_ANIMATION
-
-#define EPSI 0.0001
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-tsm_trsf_stack trsf_stack = NULL;
-tsm_trsf_stack cur_trsf_stack = NULL;
-
-Tint ForbidSetTextureMapping; /* valid only during traversal */
-Tint SecondPassNeeded; /* valid only during traversal */
-Tint SecondPassDo; /* valid only during traversal */
-
-#ifdef G003
-extern GLboolean g_fUpdateAM;
-extern GLboolean g_fList;
-int g_nBackfacing;
-#endif /* G003 */
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes
-*/
-
-static void call_util_apply_trans2( float ix, float iy, float iz, matrix3 mat,
- float *ox, float *oy, float *oz );
-static void call_util_mat_mul( matrix3 mat_a, matrix3 mat_b, matrix3 mat_c);
-
-#ifdef DEBUG
-static void pr_matrix( matrix3 mat );
-#endif
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions externes
-*/
-
-void
-call_func_set_text_style(int lid)
-{
- CMN_KEY key;
-
- key.data.ldata = lid;
- TsmAddToStructure( TelTextStyle, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_text_display_type(int lid)
-{
- CMN_KEY key;
-
- key.data.ldata = lid;
- TsmAddToStructure( TelTextDisplayType, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_label(Tint lid)
-{
- CMN_KEY key;
-
- key.data.ldata = lid;
- TsmAddToStructure( TelLabel, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_appl_data(void *ptr)
-{
- CMN_KEY key;
-
- key.data.pdata = ptr;
- TsmAddToStructure( TelApplicationData, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_view_ind(Tint vid)
-{
- CMN_KEY key;
-
- key.data.ldata = vid;
- TsmAddToStructure( TelViewIndex, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_local_tran3( Tmatrix3 mat, TComposeType mode )
-{
- CMN_KEY key;
-
- key.id = mode;
- key.data.pdata = mat;
- TsmAddToStructure( TelLocalTran3, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_linewidth( Tfloat lw )
-{
- CMN_KEY key;
-
- key.data.fdata = lw;
- TsmAddToStructure( TelPolylineWidth, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_linetype( Tint lt )
-{
- CMN_KEY key;
-
- key.data.ldata = lt;
- TsmAddToStructure( TelPolylineType, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_edge_type( Tint lt )
-{
- CMN_KEY key;
-
- key.data.ldata = lt;
- TsmAddToStructure( TelEdgeType, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_int_style( Tint is )
-{
- CMN_KEY key;
-
- key.data.ldata = is;
- TsmAddToStructure( TelInteriorStyle, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_edge_flag( Tint st )
-{
- CMN_KEY key;
-
- key.data.ldata = st;
- TsmAddToStructure( TelEdgeFlag, 1, &key );
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_edgewidth( Tfloat ew )
-{
- CMN_KEY key;
-
- key.data.fdata = ew;
- TsmAddToStructure( TelEdgeWidth, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_int_style_ind( Tint ind )
-{
- CMN_KEY key;
-
- key.data.ldata = ind;
- TsmAddToStructure( TelInteriorStyleIndex, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_face_disting_mode( Tint mode )
-{
- CMN_KEY key;
-
- key.data.ldata = mode;
- TsmAddToStructure( TelFaceDistinguishingMode, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_face_cull_mode( Tint mode )
-{
- CMN_KEY key;
-
- key.data.ldata = mode;
- TsmAddToStructure( TelFaceCullingMode, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_marker_type( Tint type )
-{
- CMN_KEY key;
-
- key.data.ldata = type;
- TsmAddToStructure( TelPolymarkerType, 1, &key );
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_marker_size( Tfloat size )
-{
- CMN_KEY key;
-
- key.data.fdata = size;
- TsmAddToStructure( TelPolymarkerSize, 1, &key );
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_exec_struct(Tint stid)
-{
- CMN_KEY key;
-
- key.data.ldata = stid;
- TsmAddToStructure( TelExecuteStructure, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_init_tgl()
-{
- TelHookOnAllClasses();
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void /* Ignoring priority */
-call_func_post_struct( Tint ws, Tint stid, Tfloat priority )
-{
- CMN_KEY_DATA k;
-
- k.ldata = stid;
- TsmSetWSAttri( ws, WSViewStid, &k );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_int_shad_meth(Tint mtd)
-{
- CMN_KEY key;
-
- key.data.ldata = mtd;
- TsmAddToStructure( TelInteriorShadingMethod, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_refl_eqn( Tint eqn )
-{
- CMN_KEY key;
-
- key.data.ldata = eqn;
- TsmAddToStructure( TelInteriorReflectanceEquation, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_back_refl_eqn( Tint eqn )
-{
- CMN_KEY key;
-
- key.data.ldata = eqn;
- TsmAddToStructure( TelBackInteriorReflectanceEquation, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_text_font( Tchar *font )
-{
- CMN_KEY key;
-
-
- key.data.pdata = font;
- TsmAddToStructure( TelTextFont, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_char_space( Tfloat sp )
-{
- CMN_KEY key;
-
- key.data.fdata = sp;
- TsmAddToStructure( TelCharacterSpacing, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_char_expan( Tfloat exp )
-{
- CMN_KEY key;
-
- key.data.fdata = exp;
- TsmAddToStructure( TelCharacterExpansionFactor, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-
-
-void
-call_func_set_text_zoomable( Tint flag )
-{
- CMN_KEY key;
-
- key.data.ldata = flag;
- TsmAddToStructure( TelTextZoomable, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-
-void
-call_func_set_text_angle( Tfloat angl )
-{
- CMN_KEY key;
-
- key.data.ldata = angl;
- TsmAddToStructure( TelTextAngle, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-
-void
-call_func_set_text_fontaspect( OSD_FontAspect fontaspect )
-{
- CMN_KEY key;
-
- key.data.ldata = fontaspect;
- TsmAddToStructure( TelTextFontAspect, 1, &key );
- return;
-}
-
-
-
-/*----------------------------------------------------------------------*/
-
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-void call_func_set_polygon_offset_params( Tint mode, Tfloat factor, Tfloat units )
-{
- CMN_KEY key;
- TEL_POFFSET_PARAM param;
-
- param.mode = mode;
- param.factor = factor;
- param.units = units;
-
- key.data.pdata = ¶m;
- TsmAddToStructure( TelPolygonOffset, 1, &key );
-}
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_pick_id(Tint pid)
-{
- CMN_KEY key;
-
- key.data.ldata = pid;
- TsmAddToStructure( TelPickId, 1, &key );
- return;
-}
-/*----------------------------------------------------------------------*/
-
-static void redraw_all_structs( Tint wsid, Tint vstid )
-{
- CMN_KEY_DATA k;
- GLint blend_dst, blend_src;
- GLboolean blend_state;
- GLint zbuff_f;
- GLboolean zbuff_state, zbuff_w;
-
- /* Est-il necessaire de faire de la transparence ? */
- TsmGetWSAttri( wsid, WSTransparency, &k );
- TelSetTransparency( k.ldata );
-
- /* ajout PCT pour gestion des textures */
- TsmGetWSAttri(wsid, WSSurfaceDetail, &k);
- switch (k.ldata)
- {
- /* TOD_NONE */
- case 0:
- ForbidSetTextureMapping = 1;
- SecondPassNeeded = 0;
- SecondPassDo = 0;
- DisableTexture();
- TsmDisplayStructure( vstid, wsid );
- break;
-
- /* TOD_ENVIRONMENT */
- case 1:
- ForbidSetTextureMapping = 1;
- SecondPassNeeded = 0;
- SecondPassDo = 0;
- TsmGetWSAttri(wsid, WSTextureEnv, &k);
- SetCurrentTexture(k.ldata);
- EnableTexture();
- TsmDisplayStructure( vstid, wsid );
- DisableTexture();
- break;
-
- /* TOD_ALL */
- case 2:
- /* premiere passe */
- ForbidSetTextureMapping = 0;
- SecondPassNeeded = 0;
- SecondPassDo = 0;
- TsmDisplayStructure( vstid, wsid );
- DisableTexture();
-
- /* deuxieme passe */
- if (SecondPassNeeded)
- {
- SecondPassDo = 1;
- TsmGetWSAttri(wsid, WSTextureEnv, &k);
- SetCurrentTexture(k.ldata);
- EnableTexture();
-
- /* sauvegarde de quelques parametres OpenGL */
- glGetBooleanv(GL_DEPTH_WRITEMASK, &zbuff_w);
- glGetIntegerv(GL_DEPTH_FUNC, &zbuff_f);
- glGetIntegerv(GL_BLEND_DST, &blend_dst);
- glGetIntegerv(GL_BLEND_SRC, &blend_src);
- zbuff_state = glIsEnabled(GL_DEPTH_TEST);
- blend_state = glIsEnabled(GL_BLEND);
-
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- glDepthFunc(GL_EQUAL);
- glDepthMask(GL_FALSE);
- glEnable(GL_DEPTH_TEST);
-
- ForbidSetTextureMapping = 1;
- TsmDisplayStructure(vstid, wsid );
- DisableTexture();
-
- /* restauration des parametres OpenGL */
- glBlendFunc(blend_src, blend_dst);
- if (!blend_state) glDisable(GL_BLEND);
-
- glDepthFunc(zbuff_f);
- glDepthMask(zbuff_w);
- if (!zbuff_state) glDisable(GL_DEPTH_FUNC);
- }
- break;
- }
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_redraw_all_structs( Tint wsid, Tint swap )
-{
- call_func_redraw_all_structs_begin (wsid);
- call_func_redraw_all_structs_proc (wsid);
- call_func_redraw_all_structs_end (wsid, swap);
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_anno_char_ht( Tfloat h )
-{
- CMN_KEY key;
-
- key.data.fdata = h;
- TsmAddToStructure( TelTextHeight, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void /* unimplemented */
-call_func_set_anno_char_up_vec( Tfloat path[2] )
-{
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void /* unimplemented */
-call_func_set_anno_path( Tint path )
-{
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-
-void /* unimplemented */
-call_func_set_anno_align( Tint hor, Tint ver )
-{
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- CMN_KEY k;
- TEL_ALIGN_DATA data;
- data.Hmode = hor;
- data.Vmode = ver;
- k.data.pdata = &data;
-
- TsmAddToStructure( TelTextAlign, 1, &k );
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_anno_text_rel3( tel_point pt, Techar *str )
-{
- CMN_KEY k[2];
-
- k[0].id = TEXT_ATTACH_PT_ID;
- k[0].data.pdata = pt;
- k[1].id = TEXT_STRING_ID;
- k[1].data.pdata = str;
- TsmAddToStructure( TelText, 2, &k[0], &k[1] );
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_dcue_ind(Tint dcid)
-{
- CMN_KEY key;
-
- key.data.ldata = dcid;
- TsmAddToStructure( TelDepthCueIndex, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_texture_id(Tint dcid)
-{
- CMN_KEY key;
-
- key.data.ldata = dcid;
- TsmAddToStructure( TelTextureId, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_set_do_texturemap(Tint dcid)
-{
- CMN_KEY key;
-
- key.data.ldata = dcid;
- TsmAddToStructure( TelDoTextureMap, 1, &key );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-#define EPSI 0.0001
-
-#ifdef DEBUG
-static void
-pr_matrix( matrix3 mat )
-{
- printf( "%1.12f %1.12f %1.12f %1.12f\n", mat[0][0], mat[0][1], mat[0][2], mat[0][3] );
- printf( "%1.12f %1.12f %1.12f %1.12f\n", mat[1][0], mat[1][1], mat[1][2], mat[1][3] );
- printf( "%1.12f %1.12f %1.12f %1.12f\n", mat[2][0], mat[2][1], mat[2][2], mat[2][3] );
- printf( "%1.12f %1.12f %1.12f %1.12f\n", mat[3][0], mat[3][1], mat[3][2], mat[3][3] );
- printf( "\n" );
- return;
-}
-#endif
-
-/*
-* Evaluates orientation matrix.
-*/
-/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */
-void call_func_eval_ori_matrix3 (
- point3 *vrp, /* view reference point */
- vec3 *vpn, /* view plane normal */
- vec3 *vup, /* view up vector */
- int *err_ind,
- float mout[4][4]) /* OUT view orientation matrix */
-{
-
- /* Translate to VRP then change the basis.
- * The old basis is: e1 = < 1, 0, 0>, e2 = < 0, 1, 0>, e3 = < 0, 0, 1>.
- * The new basis is: ("x" means cross product)
- * e3' = VPN / |VPN|
- * e1' = VUP x VPN / |VUP x VPN|
- * e2' = e3' x e1'
- * Therefore the transform from old to new is x' = TAx, where:
- *
- * | e1'x e2'x e3'x 0 | | 1 0 0 0 |
- * A = | e1'y e2'y e3'y 0 |, T = | 0 1 0 0 |
- * | e1'z e2'z e3'z 0 | | 0 0 1 0 |
- * | 0 0 0 1 | | -vrp.x -vrp.y -vrp.z 1 |
- *
- */
-
- /*
- * These ei's are really ei primes.
- */
- register float (*m)[4][4];
- point3 e1, e2, e3, e4;
- double s, v;
-
- /*
- * e1' = VUP x VPN / |VUP x VPN|, but do the division later.
- */
- e1.x = vup->delta_y * vpn->delta_z - vup->delta_z * vpn->delta_y;
- e1.y = vup->delta_z * vpn->delta_x - vup->delta_x * vpn->delta_z;
- e1.z = vup->delta_x * vpn->delta_y - vup->delta_y * vpn->delta_x;
- s = sqrt( e1.x * e1.x + e1.y * e1.y + e1.z * e1.z);
- e3.x = vpn->delta_x;
- e3.y = vpn->delta_y;
- e3.z = vpn->delta_z;
- v = sqrt( e3.x * e3.x + e3.y * e3.y + e3.z * e3.z);
- /*
- * Check for vup and vpn colinear (zero dot product).
- */
- if ((s > -EPSI) && (s < EPSI))
- *err_ind = 2;
- else
- /*
- * Check for a normal vector not null.
- */
- if ((v > -EPSI) && (v < EPSI))
- *err_ind = 3;
- else {
- /*
- * Normalize e1
- */
- e1.x /= ( float )s;
- e1.y /= ( float )s;
- e1.z /= ( float )s;
- /*
- * e3 = VPN / |VPN|
- */
- e3.x /= ( float )v;
- e3.y /= ( float )v;
- e3.z /= ( float )v;
- /*
- * e2 = e3 x e1
- */
- e2.x = e3.y * e1.z - e3.z * e1.y;
- e2.y = e3.z * e1.x - e3.x * e1.z;
- e2.z = e3.x * e1.y - e3.y * e1.x;
- /*
- * Add the translation
- */
- e4.x = -( e1.x * vrp->x + e1.y * vrp->y + e1.z * vrp->z);
- e4.y = -( e2.x * vrp->x + e2.y * vrp->y + e2.z * vrp->z);
- e4.z = -( e3.x * vrp->x + e3.y * vrp->y + e3.z * vrp->z);
- /*
- * Homogeneous entries
- *
- * | e1.x e2.x e3.x 0.0 | | 1 0 0 0 |
- * | e1.y e2.y e3.y 0.0 | * | 0 1 0 0 |
- * | e1.z e2.z e3.z 0.0 | | a b 1 c |
- * | e4.x e4.y e4.z 1.0 | | 0 0 0 1 |
- */
-
- m = (float (*)[4][4])mout;
-
- (*m)[0][0] = e1.x;
- (*m)[0][1] = e2.x;
- (*m)[0][2] = e3.x;
- (*m)[0][3] = ( float )0.0;
-
- (*m)[1][0] = e1.y;
- (*m)[1][1] = e2.y;
- (*m)[1][2] = e3.y;
- (*m)[1][3] = ( float )0.0;
-
- (*m)[2][0] = e1.z;
- (*m)[2][1] = e2.z;
- (*m)[2][2] = e3.z;
- (*m)[2][3] = ( float )0.0;
-
- (*m)[3][0] = e4.x;
- (*m)[3][1] = e4.y;
- (*m)[3][2] = e4.z;
- (*m)[3][3] = ( float )1.0;
-
- *err_ind = 0;
-
-#ifdef DEBUG
- printf( "\n->call_func_eval_ori_matrix3 \n" );
- printf( "orientation_matrix :\n" );
- pr_matrix(mout);
-#endif
- }
-}
-
-/*----------------------------------------------------------------------*/
-/*
-* Evaluates mapping matrix.
-*/
-/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */
-void call_func_eval_map_matrix3(
- view_map3 *Map,
- int *err_ind,
- matrix3 mat)
-{
- int i, j;
- matrix3 Tpar, Spar;
- matrix3 Tper, Sper;
- matrix3 Shear;
- matrix3 Scale;
- matrix3 Tprp;
- matrix3 aux_mat1, aux_mat2, aux_mat3;
- point3 Prp;
-
- *err_ind = 0;
- for (i=0; i<4; i++)
- for (j=0; j<4; j++)
- Spar[i][j] = Sper[i][j] = aux_mat1[i][j] = aux_mat2[i][j] =
- aux_mat3[i][j] = Tper[i][j] = Tpar[i][j] = Tprp[i][j] =
- Shear[i][j] = Scale[i][j] = ( float )(i == j);
-
- Prp.x = Map->proj_ref_point.x;
- Prp.y = Map->proj_ref_point.y;
- Prp.z = Map->proj_ref_point.z;
-
- /*
- * Type Parallele
- */
- if (Map->proj_type == TYPE_PARAL)
- {
- float umid, vmid;
- point3 temp;
-
-#ifdef FMN
- float cx, cy, gx, gy, xsf, ysf, zsf;
- float fpd, bpd;
- float dopx, dopy, dopz;
- matrix3 tmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
- matrix3 smat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
- matrix3 shmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
- matrix3 tshmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
-
- /* centers */
- cx = Map->win.x_min + Map->win.x_max, cx /= ( float )2.0;
- cy = Map->win.y_min + Map->win.y_max, cy /= ( float )2.0;
-
- gx = 2.0/ (Map->win.x_max - Map->win.x_min);
- gy = 2.0/ (Map->win.y_max - Map->win.y_min);
-
- tmat[0][3] = -cx;
- tmat[1][3] = -cy;
- tmat[2][3] = (Map->front_plane + Map->back_plane)/(Map->front_plane - Map->back_plane);
-
- smat[0][0] = gx;
- smat[1][1] = gy;
- smat[2][2] = -2./(Map->front_plane - Map->back_plane);
-
- /* scale factors */
- dopx = cx - Prp.x;
- dopy = cy - Prp.y;
- dopz = - Prp.z;
-
- /* map matrix */
- shmat[0][2] = -(dopx/dopz);
- shmat[1][2] = -(dopy/dopz);
-
- /* multiply to obtain mapping matrix */
- call_util_mat_mul( tmat, shmat, tshmat );
- call_util_mat_mul( smat, tshmat, mat );
-
-#ifdef DEBUG
- printf( "\n->call_func_eval_map_matrix3 FMN\n" );
- printf("prp %f %f %f \n", Prp.x, Prp.y, Prp.z);
- printf("vpd fpd bpd %f %f %f \n", Map->view_plane, Map->front_plane, Map->back_plane);
- printf("window limits %f %f %f %f\n", Map->win.x_min, Map->win.x_max,
- Map->win.y_min, Map->win.y_max);
- printf( "mapping_matrix :\n" );
- pr_matrix(mat);
-#endif
- return;
-#endif
-
- /* CAL */
- Map->proj_vp.z_min = ( float )0.0;
- Map->proj_vp.z_max = ( float )1.0;
- /* CAL */
-
- /* Shear matrix calculation */
- umid = ( float )(Map->win.x_min+Map->win.x_max)/( float )2.0;
- vmid = ( float )(Map->win.y_min+Map->win.y_max)/( float )2.0;
- if(Prp.z == Map->view_plane){
- /* Projection reference point is on the view plane */
- *err_ind = 1;
- return;
- }
- Shear[2][0] = ( float )(-1.0) * ((Prp.x-umid)/(Prp.z-Map->view_plane));
- Shear[2][1] = ( float )(-1.0) * ((Prp.y-vmid)/(Prp.z-Map->view_plane));
-
- /*
- * Calculate the lower left coordinate of the view plane
- * after the Shearing Transformation.
- */
- call_util_apply_trans2(Map->win.x_min, Map->win.y_min,
- Map->view_plane, Shear, &(temp.x), &(temp.y), &(temp.z));
-
- /* Translate the back plane to the origin */
- Tpar[3][0] = ( float )(-1.0) * temp.x;
- Tpar[3][1] = ( float )(-1.0) * temp.y;
- Tpar[3][2] = ( float )(-1.0) * Map->back_plane;
-
- call_util_mat_mul(Shear, Tpar, aux_mat1);
-
- /* Calculation of Scaling transformation */
- Spar[0][0] = ( float )1.0 / (Map->win.x_max - Map->win.x_min);
- Spar[1][1] = ( float )1.0 / (Map->win.y_max - Map->win.y_min);
- Spar[2][2] = ( float )1.0 / (Map->front_plane - Map->back_plane );
- call_util_mat_mul (aux_mat1, Spar, aux_mat2);
- /* Atlast we transformed view volume to NPC */
-
- /* Translate and scale the view plane to projection view port */
- if(Map->proj_vp.x_min < 0.0 || Map->proj_vp.y_min < 0.0 ||
- Map->proj_vp.z_min < 0.0 || Map->proj_vp.x_max > 1.0 ||
- Map->proj_vp.y_max > 1.0 || Map->proj_vp.z_max > 1.0 ||
- Map->proj_vp.x_min > Map->proj_vp.x_max ||
- Map->proj_vp.y_min > Map->proj_vp.y_max ||
- Map->proj_vp.z_min > Map->proj_vp.z_max){
- *err_ind = 1;
- return;
- }
- for(i=0; i<4; i++)
- for(j=0; j<4; j++)
- aux_mat1[i][j] = (float)(i==j);
- aux_mat1[0][0] = Map->proj_vp.x_max-Map->proj_vp.x_min;
- aux_mat1[1][1] = Map->proj_vp.y_max-Map->proj_vp.y_min;
- aux_mat1[2][2] = Map->proj_vp.z_max-Map->proj_vp.z_min;
- aux_mat1[3][0] = Map->proj_vp.x_min;
- aux_mat1[3][1] = Map->proj_vp.y_min;
- aux_mat1[3][2] = Map->proj_vp.z_min;
- call_util_mat_mul (aux_mat2, aux_mat1, mat);
-
-#ifdef DEBUG
- printf( "\n->call_func_eval_map_matrix3 - ORTHOGRAPHIC projection\n" );
- printf("prp %f %f %f \n", Prp.x, Prp.y, Prp.z);
- printf("vpd fpd bpd %f %f %f \n", Map->view_plane, Map->front_plane, Map->back_plane);
- printf("window limits %f %f %f %f\n", Map->win.x_min, Map->win.x_max,
- Map->win.y_min, Map->win.y_max);
- printf( "mapping_matrix :\n" );
- pr_matrix(mat);
-#endif
-
- return;
- }
-
- /*
- * Type Perspective
- */
- else if (Map->proj_type == TYPE_PERSPECT)
- {
- float umid, vmid;
- float B, F, V;
- float Zvmin;
-
- /* CAL */
- Map->proj_vp.z_min = ( float )0.0;
- Map->proj_vp.z_max = ( float )1.0;
- /* CAL */
-
- B = Map->back_plane;
- F = Map->front_plane;
- V = Map->view_plane;
-
- if(Prp.z == Map->view_plane){
- /* Centre of Projection is on the view plane */
- *err_ind = 1;
- return;
- }
- if(Map->proj_vp.x_min < 0.0 || Map->proj_vp.y_min < 0.0 ||
- Map->proj_vp.z_min < 0.0 || Map->proj_vp.x_max > 1.0 ||
- Map->proj_vp.y_max > 1.0 || Map->proj_vp.z_max > 1.0 ||
- Map->proj_vp.x_min > Map->proj_vp.x_max ||
- Map->proj_vp.y_min > Map->proj_vp.y_max ||
- Map->proj_vp.z_min > Map->proj_vp.z_max ||
- F < B){
- *err_ind = 1;
- return;
- }
-
- /* This is the transformation to move VRC to Center Of Projection */
- Tprp[3][0] = ( float )(-1.0)*Prp.x;
- Tprp[3][1] = ( float )(-1.0)*Prp.y;
- Tprp[3][2] = ( float )(-1.0)*Prp.z;
-
- /* Calculation of Shear matrix */
- umid = ( float )(Map->win.x_min+Map->win.x_max)/( float )2.0-Prp.x;
- vmid = ( float )(Map->win.y_min+Map->win.y_max)/( float )2.0-Prp.y;
- Shear[2][0] = ( float )(-1.0)*umid/(Map->view_plane-Prp.z);
- Shear[2][1] = ( float )(-1.0)*vmid/(Map->view_plane-Prp.z);
- call_util_mat_mul(Tprp, Shear, aux_mat3);
-
- /* Scale the view volume to canonical view volume
- * Centre of projection at origin.
- * 0 <= N <= -1, -0.5 <= U <= 0.5, -0.5 <= V <= 0.5
- */
- Scale[0][0] = (( float )(-1.0)*Prp.z+V)/
- ((Map->win.x_max-Map->win.x_min)*(( float )(-1.0)*Prp.z+B));
- Scale[1][1] = (( float )(-1.0)*Prp.z+V)/
- ((Map->win.y_max-Map->win.y_min)*(( float )(-1.0)*Prp.z+B));
- Scale[2][2] = ( float )(-1.0) / (( float )(-1.0)*Prp.z+B);
-
- call_util_mat_mul(aux_mat3, Scale, aux_mat1);
-
- /*
- * Transform the Perspective view volume into
- * Parallel view volume.
- * Lower left coordinate: (-0.5,-0.5, -1)
- * Upper right coordinate: (0.5, 0.5, 1.0)
- */
- Zvmin = ( float )(-1.0*(-1.0*Prp.z+F)/(-1.0*Prp.z+B));
- aux_mat2[2][2] = ( float )1.0/(( float )1.0+Zvmin);
- aux_mat2[2][3] = ( float )(-1.0);
- aux_mat2[3][2] = ( float )(-1.0)*Zvmin*aux_mat2[2][2];
- aux_mat2[3][3] = ( float )0.0;
- call_util_mat_mul(aux_mat1, aux_mat2, Shear);
-
- for(i=0; i<4; i++)
- for(j=0; j<4; j++)
- aux_mat1[i][j] = aux_mat2[i][j] = (float)(i==j);
-
- /* Translate and scale the view plane to projection view port */
- aux_mat2[0][0] = (Map->proj_vp.x_max-Map->proj_vp.x_min);
- aux_mat2[1][1] = (Map->proj_vp.y_max-Map->proj_vp.y_min);
- aux_mat2[2][2] = (Map->proj_vp.z_max-Map->proj_vp.z_min);
- aux_mat2[3][0] = aux_mat2[0][0]/( float )2.0+Map->proj_vp.x_min;
- aux_mat2[3][1] = aux_mat2[1][1]/( float )2.0+Map->proj_vp.y_min;
- aux_mat2[3][2] = aux_mat2[2][2]+Map->proj_vp.z_min;
- call_util_mat_mul (Shear, aux_mat2, mat);
-
-#ifdef DEBUG
- printf( "\n->call_func_eval_map_matrix3 - PERSPECTIVE projection\n" );
- printf("prp %f %f %f \n", Prp.x, Prp.y, Prp.z);
- printf("vpd fpd bpd %f %f %f \n", Map->view_plane, Map->front_plane, Map->back_plane);
- printf("window limits %f %f %f %f\n", Map->win.x_min, Map->win.x_max,
- Map->win.y_min, Map->win.y_max);
- printf("viewport limits %f %f %f %f %f %f\n", Map->proj_vp.x_min, Map->proj_vp.x_max,
- Map->proj_vp.y_min, Map->proj_vp.y_max,
- Map->proj_vp.z_min, Map->proj_vp.z_max);
- printf( "mapping_matrix :\n" );
- pr_matrix(mat);
-#endif
-
- return;
- }
- else
- *err_ind = 1;
-}
-
-/*----------------------------------------------------------------------*/
-
-static void
-call_util_apply_trans2( float ix, float iy, float iz, matrix3 mat,
- float *ox, float *oy, float *oz )
-{
- float temp;
- *ox = ix*mat[0][0]+iy*mat[1][0]+iz*mat[2][0]+mat[3][0];
- *oy = ix*mat[0][1]+iy*mat[1][1]+iz*mat[2][1]+mat[3][1];
- *oz = ix*mat[0][2]+iy*mat[1][2]+iz*mat[2][2]+mat[3][2];
- temp = ix * mat[0][3]+iy * mat[1][3]+iz * mat[2][3]+mat[3][3];
- *ox /= temp;
- *oy /= temp;
- *oz /= temp;
-}
-
-/*----------------------------------------------------------------------*/
-
-static void
-call_util_mat_mul( matrix3 mat_a, matrix3 mat_b, matrix3 mat_c)
-{
- int i, j, k;
-
- for (i=0; i<4; i++)
- for (j=0; j<4; j++)
- for (mat_c[i][j] = ( float )0.0,k=0; k<4; k++)
- mat_c[i][j] += mat_a[i][k] * mat_b[k][j];
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_redraw_all_structs_begin( Tint wsid )
-{
-
- static Tmatrix3 identity = {
- {( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0},
- {( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0},
- {( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0},
- {( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0}
- };
-
- /*
- * Gestion de la pile des transformations pour les structures
- * connectees dans la vue <wsid>
- */
- if (trsf_stack == NULL) {
- trsf_stack = (tsm_trsf_stack) malloc (sizeof (TSM_TRSF_STACK));
- trsf_stack->next = NULL;
- trsf_stack->prev = NULL;
- matcpy (trsf_stack->LocalTran3, identity);
- cur_trsf_stack = trsf_stack;
- }
-
- TelClearViews(wsid);
-
- /* Par defaut on desactive les lumieres */
- LightOff();
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_redraw_all_structs_proc( Tint wsid )
-{
-
- CMN_KEY kk;
- CMN_KEY_DATA k;
-#ifdef G003
- CMN_KEY_DATA kbf;
-#endif /* G003 */
- Tint vstid;
-
- TsmGetWSAttri( wsid, WSViewStid, &k );
-#ifdef G003
- TsmGetWSAttri ( wsid, WSBackfacing, &kbf );
- g_nBackfacing = kbf.ldata;
-
- if ( g_nBackfacing > 0 )
-
- glDisable ( GL_CULL_FACE );
-
- else if ( g_nBackfacing < 0 ) {
-
- glEnable ( GL_CULL_FACE );
- glCullFace ( GL_BACK );
-
- } /* end if */
-#endif /* G003 */
- vstid = k.ldata;
- if( vstid != -1 )
- {
-
-#ifdef PRINT
- printf("OpenGl_funcs::call_func_redraw_all_structs:TsmPushAttri \n");
-#endif
- TsmPushAttri(); /* save previous graphics context */
-
- TglActiveWs = wsid; /* Indispensable precedemment dans TsmDisplayStructure */
- /* Avec le mode Ajout cette init n'etait plus faite */
-
- /* mise en place des matrices de projection et de mapping */
- kk.id = TelViewIndex;
- kk.data.ldata = vstid;
- TsmSetAttri( 1, &kk );
- TelSetViewIndex (wsid, vstid);
-#ifdef G003
- if ( g_fUpdateAM ) goto forceRedraw;
-#endif /* G003 */
- /* Mode animation */
- if (animationFlag)
- {
- if ((listIndexFlag) && (listIndexView == vstid))
- {
-#ifdef DEBUG_ANIMATION
- printf("call_func_redraw_all_structs::glCallList1 \n");
-#endif
- glCallList(listIndex);
- }
- else
- {
-#ifdef G003
- if ( !g_fList ) {
-
- g_fList = GL_TRUE;
- goto forceRedraw;
-
- } /* end if */
-#endif /* G003 */
-
-#ifdef DEBUG_ANIMATION
- printf("call_func_redraw_all_structs::glNewList \n");
-#endif
- glNewList(listIndex, GL_COMPILE_AND_EXECUTE);
- redraw_all_structs( wsid, vstid );
-#ifdef DEBUG_ANIMATION
- printf("call_func_redraw_all_structs::glEndList \n");
-#endif
- glEndList();
- listIndexFlag = GL_TRUE;
- listIndexView = vstid;
- }
- }
- /* Mode normal */
- else
- {
- /* Optimisation si displaylist est toujours valable */
- if ((listIndexFlag) && (listIndexView == vstid))
- {
-#ifdef DEBUG_ANIMATION
- printf("call_func_redraw_all_structs::glCallList2 \n");
-#endif
- glCallList(listIndex);
- }
- else
- {
-#ifdef DEBUG_ANIMATION
- printf("call_func_redraw_all_structs::redraw_all_structs \n");
-#endif
-
-#ifdef G003
-forceRedraw:
-#endif /* G003 */
- redraw_all_structs( wsid, vstid );
- }
- } /* Mode Animation */
-
-#ifdef PRINT
- printf("OpenGl_funcs::call_func_redraw_all_structs:TsmPopAttri \n");
-#endif
- /* restore previous graphics context; before update lights */
- TsmPopAttri();
-
-
-
- /* affichage de Triedre Non Zoomable de la vue s'il existe */
-#ifdef PRINT
- printf("call_func_redraw_all_structS => CALL_TRIEDRON... \n");
-#endif
- call_triedron_redraw_from_wsid (wsid);
- call_graduatedtrihedron_redraw(wsid);
-
-
- } /* Test vue valide */
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_func_redraw_all_structs_end( Tint wsid, Tint swap )
-{
-
- /* CMN_KEY kk;*/
- CMN_KEY_DATA k;
- Tint vstid;
-
- TsmGetWSAttri( wsid, WSViewStid, &k );
- vstid = k.ldata;
- if( vstid != -1 )
- {
-
- /* On swap les buffers */
- TsmGetWSAttri( wsid, WSDbuff, &k );
- if( (k.ldata == TOn) && (swap) )
- TelSwapBuffers( wsid );
- else
- TelFlush(0);
-
- } /* Test vue valide */
-
- /*
- * Mise a jour de l'update_state
- */
- k.ldata = TDone;
- TsmSetWSAttri( wsid, WSUpdateState, &k );
-
- return;
-}
-
-#ifdef G003
-void call_func_set_degenerate_model ( Tint model, Tfloat skipRatio ) {
-
- CMN_KEY key;
- DEGENERATION deg;
-
- deg.mode = model;
- deg.skipRatio = skipRatio;
-
- key.data.pdata = °
- TsmAddToStructure ( TelDegenerationMode, 1, &key );
-
-} /* end call_func_set_degenerate_model */
-#endif /* G003 */
-
-
-void
-call_func_set_transform_persistence( Tint mode, Tfloat x, Tfloat y, Tfloat z )
-{
- CMN_KEY key;
- TEL_TRANSFORM_PERSISTENCE pers;
-
- pers.mode = mode;
-
- pers.pointX = x;
- pers.pointY = y;
- pers.pointZ = z;
-
- key.data.pdata = &pers;
- TsmAddToStructure( TelTransformPersistence, 1, &key );
- return;
-}
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
+++ /dev/null
-// File: OpenGl_graduatedtrihedron.cxx
-// Created: 6 March 2011
-// Author: Sergey ZERCHANINOV
-// Copyright: OPEN CASCADE SA 2011
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_graduatedtrihedron.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Aspect.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_TextRender.hxx>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-struct TEL_GRADUATEDTRIHEDRON_DATA
-{
- int WsId;
- wchar_t *xname, *yname, *zname;
- unsigned char xdrawname, ydrawname, zdrawname;
- unsigned char xdrawvalues, ydrawvalues, zdrawvalues;
- unsigned char drawgrid;
- unsigned char drawaxes;
- unsigned int nbx, nby, nbz;
- int xoffset, yoffset, zoffset;
- int xaxisoffset, yaxisoffset, zaxisoffset;
- unsigned char xdrawtickmarks, ydrawtickmarks, zdrawtickmarks;
- unsigned int xtickmarklength, ytickmarklength, ztickmarklength;
- float gridcolor[3];
- float xnamecolor[3];
- float ynamecolor[3];
- float znamecolor[3];
- float xcolor[3];
- float ycolor[3];
- float zcolor[3];
- char* fontOfNames;
- OSD_FontAspect styleOfNames;
- int sizeOfNames;
- char* fontOfValues;
- OSD_FontAspect styleOfValues;
- int sizeOfValues;
- minMaxValuesCallback cbCubicAxes;
- void* ptrVisual3dView;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_GRADUATEDTRIHEDRON_DATA* tel_graduatedtrihedron_data;
-
-/* Graduated trihedron data */
-static int nbWsIds = 0; /* Number of the views (size of the arrays below */
-static tel_graduatedtrihedron_data* graduatedTrihedronData = 0; /* The array contains graduated trihedron data of all views */
-
-/* Bounding box */
-float xmin = 0.0f, ymin = 0.0f, zmin = 0.0f, xmax = 100.0f, ymax = 100.0f, zmax = 100.0f;
-
-static void copyData(const Graphic3d_CGraduatedTrihedron *fromData, TEL_GRADUATEDTRIHEDRON_DATA* toData)
-{
- int len;
-
- /* Names of axes */
- /* X-name */
- len = fromData->xname.Length();
- if (len)
- {
- Standard_ExtString iname = fromData->xname.ToExtString();
- toData->xname = new wchar_t[len+1];
- len = 0; while (toData->xname[len] = (wchar_t)(iname[len])) len++;
- }
- else
- toData->xname = NULL;
- /* Y-name */
- len = fromData->yname.Length();
- if (len)
- {
- Standard_ExtString iname = fromData->yname.ToExtString();
- toData->yname = new wchar_t[len+1];
- len = 0; while (toData->yname[len] = (wchar_t)(iname[len])) len++;
- }
- else
- toData->yname = NULL;
- /* Z-name */
- len = fromData->zname.Length();
- if (len)
- {
- Standard_ExtString iname = fromData->zname.ToExtString();
- toData->zname = new wchar_t[len+1];
- len = 0; while (toData->zname[len] = (wchar_t)(iname[len])) len++;
- }
- else
- toData->zname = NULL;
- /* Draw names */
- toData->xdrawname = fromData->xdrawname;
- toData->ydrawname = fromData->ydrawname;
- toData->zdrawname = fromData->zdrawname;
- /* Draw values */
- toData->xdrawvalues = fromData->xdrawvalues;
- toData->ydrawvalues = fromData->ydrawvalues;
- toData->zdrawvalues = fromData->zdrawvalues;
- /* Draw grid */
- toData->drawgrid = fromData->drawgrid;
- /* Draw axes */
- toData->drawaxes = fromData->drawaxes;
- /* Number of splits along axes */
- toData->nbx = fromData->nbx;
- toData->nby = fromData->nby;
- toData->nbz = fromData->nbz;
- /* Offset for drawing values */
- toData->xoffset = fromData->xoffset;
- toData->yoffset = fromData->yoffset;
- toData->zoffset = fromData->zoffset;
- /* Offset for drawing names of axes */
- toData->xaxisoffset = fromData->xaxisoffset;
- toData->yaxisoffset = fromData->yaxisoffset;
- toData->zaxisoffset = fromData->zaxisoffset;
- /* Draw tickmarks */
- toData->xdrawtickmarks = fromData->xdrawtickmarks;
- toData->ydrawtickmarks = fromData->ydrawtickmarks;
- toData->zdrawtickmarks = fromData->zdrawtickmarks;
- /* Length of tickmarks */
- toData->xtickmarklength = fromData->xtickmarklength;
- toData->ytickmarklength = fromData->ytickmarklength;
- toData->ztickmarklength = fromData->ztickmarklength;
- /* Grid color */
- toData->gridcolor[0] = (float) fromData->gridcolor.Red();
- toData->gridcolor[1] = (float) fromData->gridcolor.Green();
- toData->gridcolor[2] = (float) fromData->gridcolor.Blue();
- /* X name color */
- toData->xnamecolor[0] = (float) fromData->xnamecolor.Red();
- toData->xnamecolor[1] = (float) fromData->xnamecolor.Green();
- toData->xnamecolor[2] = (float) fromData->xnamecolor.Blue();
- /* Y name color */
- toData->ynamecolor[0] = (float) fromData->ynamecolor.Red();
- toData->ynamecolor[1] = (float) fromData->ynamecolor.Green();
- toData->ynamecolor[2] = (float) fromData->ynamecolor.Blue();
- /* Z name color */
- toData->znamecolor[0] = (float) fromData->znamecolor.Red();
- toData->znamecolor[1] = (float) fromData->znamecolor.Green();
- toData->znamecolor[2] = (float) fromData->znamecolor.Blue();
- /* X color of axis and values */
- toData->xcolor[0] = (float) fromData->xcolor.Red();
- toData->xcolor[1] = (float) fromData->xcolor.Green();
- toData->xcolor[2] = (float) fromData->xcolor.Blue();
- /* Y color of axis and values */
- toData->ycolor[0] = (float) fromData->ycolor.Red();
- toData->ycolor[1] = (float) fromData->ycolor.Green();
- toData->ycolor[2] = (float) fromData->ycolor.Blue();
- /* Z color of axis and values */
- toData->zcolor[0] = (float) fromData->zcolor.Red();
- toData->zcolor[1] = (float) fromData->zcolor.Green();
- toData->zcolor[2] = (float) fromData->zcolor.Blue();
- /* Font name of names of axes: Courier, Arial, ... */
- len = fromData->fontOfNames.Length();
- toData->fontOfNames = new char[len+1];
- if (len)
- strcpy(toData->fontOfNames, fromData->fontOfNames.ToCString());
- else
- toData->fontOfNames[0] = L'\0';
- /* Style of names of axes: OSD_FA_Regular, OSD_FA_Bold, ... */
- toData->styleOfNames = fromData->styleOfNames;
- /* Size of names of axes: 8, 10, 12, 14, ... */
- toData->sizeOfNames = fromData->sizeOfNames;
- /* Font name of values: Courier, Arial, ... */
- len = fromData->fontOfValues.Length();
- toData->fontOfValues = new char[len+1];
- if (len)
- strcpy(toData->fontOfValues, fromData->fontOfValues.ToCString());
- else
- toData->fontOfValues[0] = L'\0';
- /* Style of values: OSD_FA_Regular, OSD_FA_Bold, ... */
- toData->styleOfValues = fromData->styleOfValues;
- /* Size of values: 8, 10, 12, 14, ... */
- toData->sizeOfValues = fromData->sizeOfValues;
- /* Callback - updater of boundary box */
- toData->cbCubicAxes = fromData->cbCubicAxes;
- toData->ptrVisual3dView = fromData->ptrVisual3dView;
-}
-
-static void freeData()
-{
- if (nbWsIds)
- {
- int i = 0;
- tel_graduatedtrihedron_data gtdata;
- for (i = 0; i < nbWsIds; i++)
- {
- gtdata = graduatedTrihedronData[i];
-
- // Names of axes
- if (gtdata->xname)
- delete[] gtdata->xname;
- if (gtdata->yname)
- delete[] gtdata->yname;
- if (gtdata->zname)
- delete[] gtdata->zname;
-
- // Fonts
- if (gtdata->fontOfNames)
- delete[] gtdata->fontOfNames;
- if (gtdata->fontOfValues)
- delete[] gtdata->fontOfValues;
-
- delete gtdata;
- }
- delete graduatedTrihedronData;
- graduatedTrihedronData = 0;
- nbWsIds = 0;
- }
-}
-
-static int getGraduatedTrihedronDataIndex(int WsId)
-{
- int i = 0;
- for (; i < nbWsIds; i++)
- {
- if (graduatedTrihedronData[i]->WsId == WsId)
- return i;
- }
- return -1;
-}
-
-/* Normal of the view (not normalized!) */
-static float getNormal(float* normal)
-{
- GLint viewport[4];
- GLdouble model_matrix[16], proj_matrix[16];
- double x1, y1, z1, x2, y2, z2, x3, y3, z3;
- double dx1, dy1, dz1, dx2, dy2, dz2, width;
-
- glGetDoublev(GL_MODELVIEW_MATRIX, model_matrix);
- glGetDoublev(GL_PROJECTION_MATRIX, proj_matrix);
- glGetIntegerv(GL_VIEWPORT, viewport);
-
- gluUnProject(viewport[0], viewport[1], 0., model_matrix, proj_matrix, viewport, &x1, &y1, &z1);
- gluUnProject(viewport[0] + viewport[2], viewport[1], 0., model_matrix, proj_matrix, viewport, &x2, &y2, &z2);
- gluUnProject(viewport[0], viewport[1] + viewport[3], 0., model_matrix, proj_matrix, viewport, &x3, &y3, &z3);
-
- /* Normal out of user is p1p3^p1p2 */
- dx1 = x3 - x1; dy1 = y3 - y1; dz1 = z3 - z1;
- dx2 = x2 - x1; dy2 = y2 - y1; dz2 = z2 - z1;
- normal[0] = (float) (dy1 * dz2 - dz1 * dy2);
- normal[1] = (float) (dz1 * dx2 - dx1 * dz2);
- normal[2] = (float) (dx1 * dy2 - dy1 * dx2);
-
- /* Distance corresponding to 1 pixel */
- width = sqrt(dx2 * dx2 + dy2 * dy2 + dz2 * dz2);
- return (float) width / (float) viewport[2];
-}
-
-static float getDistance2Corner(float* normal, float* center, float x, float y, float z)
-{
- return normal[0] * (x - center[0]) + normal[1] * (y - center[1]) + normal[2] * (z - center[2]);
-}
-
-static char getFarestCorner(float d000, float d100, float d010, float d001,
- float d110, float d101, float d011, float d111)
-{
- if (d000 > 0.0f &&
- d000 > d100 && d000 > d010 && d000 > d001 && d000 > d110 &&
- d000 > d101 && d000 > d011 && d000 > d111)
- {
- return 1;
- }
- else if (d100 > 0.0f &&
- d100 > d000 && d100 > d010 && d100 > d001 && d100 > d110 &&
- d100 > d101 && d100 > d011 && d100 > d111)
- {
- return 2;
- }
- else if (d010 > 0.0f &&
- d010 > d000 && d010 > d100 && d010 > d001 && d010 > d110 &&
- d010 > d101 && d010 > d011 && d010 > d111)
- {
- return 3;
- }
- else if (d001 > 0.0f &&
- d001 > d000 && d001 > d100 && d001 > d010 && d001 > d110 &&
- d001 > d101 && d001 > d011 && d001 > d111)
- {
- return 4;
- }
- else if (d110 > 0.0f &&
- d110 > d000 && d110 > d100 && d110 > d010 && d110 > d001 &&
- d110 > d101 && d110 > d011 && d110 > d111)
- {
- return 5;
- }
- else if (d101 > 0.0f &&
- d101 > d000 && d101 > d100 && d101 > d010 && d101 > d001 &&
- d101 > d110 && d101 > d011 && d101 > d111)
- {
- return 6;
- }
- else if (d011 > 0.0f &&
- d011 > d000 && d011 > d100 && d011 > d010 && d011 > d001 &&
- d011 > d110 && d011 > d101 && d011 > d111)
- {
- return 7;
- }
- return 8; /* d111 */
-}
-
-static void drawText(const wchar_t* text, char* font, OSD_FontAspect style, int size, float x, float y, float z)
-{
- OpenGl_TextRender* textRenderer = OpenGl_TextRender::instance();
- const GLuint fontBase = textRenderer->FindFont((Tchar*) font, style, (float) size);
- textRenderer->RenderText(text, fontBase, 0, x, y, z);
-
-/* 4 OCC 6.3.1 and older:
- GLuint fontBase;
-
-#ifndef WNT
- fontBase = tXfmsetfont (1.0F, 1.0F);
-#else
- fontBase = WNTSetFont (1.0F, 1.0F);
-#endif
-
-#ifndef WNT
- tXfmprstr(text, fontBase, x, y, z);
-#else
- WNTPuts(text, fontBase, 0, x, y, z);
-#endif
-*/
-}
-
-static void drawArrow(float x1, float y1, float z1,
- float x2, float y2, float z2,
- float xn, float yn, float zn)
-{
- float h, r;
- float xa, ya, za;
- float x0, y0, z0;
- float xr, yr, zr;
- float xa1, ya1, za1, xa2, ya2, za2;
-
- /* Start of arrow: at 10% from the end */
- x0 = x1 + 0.9f * (x2 - x1); y0 = y1 + 0.9f * (y2 - y1); z0 = z1 + 0.9f * (z2 - z1);
-
- /* Base of the arrow */
- xa = (x2 - x0); ya = (y2 - y0); za = (z2 - z0);
-
- /* Height of the arrow */
- h = sqrtf(xa * xa + ya * ya + za * za);
- if (h <= 0.0f)
- return;
- xa = xa / h; ya = ya / h; za = za / h;
-
- /* Radial direction to the arrow */
- xr = ya * zn - za * yn;
- yr = za * xn - xa * zn;
- zr = xa * yn - ya * xn;
-
- /* Normalize the radial vector */
- r = sqrtf(xr * xr + yr * yr + zr * zr);
- if (r <= 0.0f)
- return;
- xr = xr / r; yr = yr / r; zr = zr / r;
-
- /* First point of the base of the arrow */
- r = 0.2f * h;
- xr = r * xr; yr = r * yr; zr = r * zr;
- xa1 = x0 + xr; ya1 = y0 + yr; za1 = z0 + zr;
-
- /* Second point of the base of the arrow */
- xa2 = x0 - xr; ya2 = y0 - yr; za2 = z0 - zr;
-
- /* Draw a line to the arrow */
- glBegin(GL_LINES);
- glVertex3f(x1, y1, z1);
- glVertex3f(x0, y0, z0);
- glEnd();
-
- /* Draw a triangle of the arrow */
- glBegin(GL_LINE_LOOP);
- glVertex3f(xa1, ya1, za1);
- glVertex3f(xa2, ya2, za2);
- glVertex3f(x2, y2, z2);
- glEnd();
-}
-
-TStatus call_graduatedtrihedron_display(int WsId, const Graphic3d_CGraduatedTrihedron &data)
-{
- /* Initialize data for a new view */
- int index = getGraduatedTrihedronDataIndex(WsId);
- if (index == -1)
- {
- /* Extend array for +1 */
- tel_graduatedtrihedron_data* newGraduatedTrihedronData = new tel_graduatedtrihedron_data[nbWsIds+1];
-
- /* Copy existing contents */
- int i;
- for (i = 0; i < nbWsIds; i++)
- newGraduatedTrihedronData[i] = graduatedTrihedronData[i];
-
- /* Add new item */
- index = nbWsIds++;
- newGraduatedTrihedronData[index] = new TEL_GRADUATEDTRIHEDRON_DATA;
- newGraduatedTrihedronData[index]->WsId = WsId;
-
- /* Switch to new array */
- delete graduatedTrihedronData;
- graduatedTrihedronData = newGraduatedTrihedronData;
- }
- copyData(&data, graduatedTrihedronData[index]);
- return call_graduatedtrihedron_redraw(WsId);
-}
-
-TStatus call_graduatedtrihedron_erase(int WsId)
-{
- int index = getGraduatedTrihedronDataIndex(WsId);
- if (index == -1)
- return TSuccess; /* Nothing to remove */
-
- /* If trihedron is displayed only in one view, just free the array and set nbWsIds equal to 0. */
- if (nbWsIds == 1)
- {
- freeData();
- return TSuccess;
- }
-
- /* Reduce array for -1 */
- tel_graduatedtrihedron_data* newGraduatedTrihedronData = new tel_graduatedtrihedron_data[nbWsIds-1];
-
- /* Copy existing contents */
- int i, j;
- for (i = 0, j = 0; i < nbWsIds; i++)
- {
- if (graduatedTrihedronData[i]->WsId != WsId)
- newGraduatedTrihedronData[j++] = graduatedTrihedronData[i];
- }
- nbWsIds--;
-
- /* Switch to new array */
- delete graduatedTrihedronData;
- graduatedTrihedronData = newGraduatedTrihedronData;
-
- return TSuccess;
-}
-
-TStatus call_graduatedtrihedron_redraw(int WsId)
-{
- /* Get index of the trihedron data */
- int index = getGraduatedTrihedronDataIndex(WsId);
- if (index == -1)
- return TFailure;
-
- tel_graduatedtrihedron_data data = graduatedTrihedronData[index];
-
- /* Update boundary box */
- if (data->cbCubicAxes)
- data->cbCubicAxes(data->ptrVisual3dView);
-
- /* Disable lighting for lines */
- GLboolean light = glIsEnabled(GL_LIGHTING);
- if (light)
- glDisable(GL_LIGHTING);
-
- /* Find the farest point of bounding box */
-
- /* Get normal of the view out of user. */
- /* Also, the method return distance corresponding to 1 pixel */
- float normal[3];
- float dpix = getNormal(normal);
-
- /* Normalize normal */
- float d = sqrtf(normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2]);
- normal[0] /= d;
- normal[1] /= d;
- normal[2] /= d;
-
- /* Get central point of bounding box */
- float center[3];
- center[0] = 0.5f * (xmin + xmax);
- center[1] = 0.5f * (ymin + ymax);
- center[2] = 0.5f * (zmin + zmax);
-
- /* Check distance to corners of bounding box along the normal */
- float d000 = getDistance2Corner(normal, center, xmin, ymin, zmin);
- float d100 = getDistance2Corner(normal, center, xmax, ymin, zmin);
- float d010 = getDistance2Corner(normal, center, xmin, ymax, zmin);
- float d001 = getDistance2Corner(normal, center, xmin, ymin, zmax);
- float d110 = getDistance2Corner(normal, center, xmax, ymax, zmin);
- float d101 = getDistance2Corner(normal, center, xmax, ymin, zmax);
- float d011 = getDistance2Corner(normal, center, xmin, ymax, zmax);
- float d111 = getDistance2Corner(normal, center, xmax, ymax, zmax);
- unsigned char farestCorner = getFarestCorner(d000, d100, d010, d001, d110, d101, d011, d111);
-
- /* Choose axes for the grid. */
- float LX1[6], LX2[6], LX3[6]; /* Lines along X direction */
- float LY1[6], LY2[6], LY3[6]; /* Lines along Y direction */
- float LZ1[6], LZ2[6], LZ3[6]; /* Lines along Z direction */
- unsigned char LX1draw, LX2draw, LX3draw; /* Allows drawing of X-line (000 - 100 is forbidden) */
- unsigned char LY1draw, LY2draw, LY3draw; /* Allows drawing of Y-line (000 - 010 is forbidden) */
- unsigned char LZ1draw, LZ2draw, LZ3draw; /* Allows drawing of Z-line (000 - 001 is forbidden) */
-
- /* The first axis will be used for drawing the text and the values. */
- switch (farestCorner)
- {
- case 1: /* d000 */
- {
- /* 001 - 101 */
- LX1draw = 1;
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
- /* 000 - 100 */
- LX2draw = 0; /* forbidden! */
- LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmin;
- /* 010 - 110 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
-
- /* 100 - 110 */
- LY1draw = 1;
- LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
- /* 000 - 010 */
- LY2draw = 0; /* forbidden! */
- LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmin;
- /* 001 - 011 */
- LY3draw = 1;
- LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 100 - 101 */
- LZ1draw = 1;
- LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 000 - 001 */
- LZ2draw = 0; /* forbidden! */
- LZ2[0] = xmin; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymin; LZ2[5] = zmax;
- /* 010 - 011 */
- LZ3draw = 1;
- LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 2: /* d100 */
- {
- /* 001 - 101 */
- LX1draw = 1;
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
- /* 000 - 100 */
- LX2draw = 0; /* forbidden! */
- LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmin;
- /* 010 - 110 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
-
- /* 000 - 010 */
- LY1draw = 0; /* forbidden! */
- LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
- /* 100 - 110 */
- LY2draw = 1;
- LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmin;
- /* 101 - 111 */
- LY3draw = 1;
- LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 000 - 001 */
- LZ1draw = 0; /* forbidden! */
- LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 100 - 101 */
- LZ2draw = 1;
- LZ2[0] = xmax; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymin; LZ2[5] = zmax;
- /* 110 - 111 */
- LZ3draw = 1;
- LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 3: /* d010 */
- {
- /* 000 - 100 */
- LX1draw = 0; /* forbidden */
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
- /* 010 - 110 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmin;
- /* 011 - 111 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
-
- /* 100 - 110 */
- LY1draw = 1;
- LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
- /* 000 - 010 */
- LY2draw = 0; /* forbidden */
- LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmin;
- /* 001 - 011 */
- LY3draw = 1;
- LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 110 - 111 */
- LZ1draw = 1;
- LZ1[0] = xmax; LZ1[1] = ymax; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymax; LZ1[5] = zmax;
- /* 010 - 011 */
- LZ2draw = 1;
- LZ2[0] = xmin; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymax; LZ2[5] = zmax;
- /* 000 - 001 */
- LZ3draw = 0; /* forbidden */
- LZ3[0] = xmin; LZ3[1] = ymin; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymin; LZ3[5] = zmax;
-
- break;
- }
- case 4: /* d001 */
- {
- /* 000 - 100 */
- LX1draw = 0; /* forbidden */
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
- /* 001 - 101 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmax;
- /* 011 - 111 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
-
- /* 000 - 010 */
- LY1draw = 0; /* forbidden */
- LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
- /* 001 - 011 */
- LY2draw = 1;
- LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmax;
- /* 101 - 111 */
- LY3draw = 1;
- LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 100 - 101 */
- LZ1draw = 1;
- LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 000 - 001 */
- LZ2draw = 0; /* forbidden */
- LZ2[0] = xmin; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymin; LZ2[5] = zmax;
- /* 010 - 011 */
- LZ3draw = 1;
- LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 5: /* d110 */
- {
- /* 000 - 100 */
- LX1draw = 0; /* forbidden */
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
- /* 010 - 110 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmin; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmin;
- /* 011 - 111 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
-
- /* 000 - 010 */
- LY1draw = 0; /* forbidden */
- LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
- /* 100 - 110 */
- LY2draw = 1;
- LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmin; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmin;
- /* 101 - 111 */
- LY3draw = 1;
- LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 100 - 101 */
- LZ1draw = 1;
- LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 110 - 111 */
- LZ2draw = 1;
- LZ2[0] = xmax; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymax; LZ2[5] = zmax;
- /* 010 - 011 */
- LZ3draw = 1;
- LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 6: /* d101 */
- {
- /* 000 - 100 */
- LX1draw = 0; /* forbidden */
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmin;
- /* 001 - 101 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymin; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymin; LX2[5] = zmax;
- /* 011 - 111 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmax;
-
- /* 100 - 110 */
- LY1draw = 1;
- LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
- /* 101 - 111 */
- LY2draw = 1;
- LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmax;
- /* 001 - 011 */
- LY3draw = 1;
- LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 000 - 001 */
- LZ1draw = 0; /* forbidden */
- LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 100 - 101 */
- LZ2draw = 1;
- LZ2[0] = xmax; LZ2[1] = ymin; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymin; LZ2[5] = zmax;
- /* 110 - 111 */
- LZ3draw = 1;
- LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 7: /* d011 */
- {
- /* 001 - 101 */
- LX1draw = 1;
- LX1[0] = xmin; LX1[1] = ymin; LX1[2] = zmax; LX1[3] = xmax; LX1[4] = ymin; LX1[5] = zmax;
- /* 011 - 111 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmax;
- /* 010 - 110 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymax; LX3[2] = zmin; LX3[3] = xmax; LX3[4] = ymax; LX3[5] = zmin;
-
- /* 000 - 010 */
- LY1draw = 0; /* forbidden */
- LY1[0] = xmin; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmin; LY1[4] = ymax; LY1[5] = zmin;
- /* 001 - 011 */
- LY2draw = 1;
- LY2[0] = xmin; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmin; LY2[4] = ymax; LY2[5] = zmax;
- /* 101 - 111 */
- LY3draw = 1;
- LY3[0] = xmax; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmax; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 000 - 001 */
- LZ1draw = 0; /* forbidden */
- LZ1[0] = xmin; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmin; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 010 - 011 */
- LZ2draw = 1;
- LZ2[0] = xmin; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmin; LZ2[4] = ymax; LZ2[5] = zmax;
- /* 110 - 111 */
- LZ3draw = 1;
- LZ3[0] = xmax; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmax; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- case 8: /* d111 */
- {
- /* 010 - 110 */
- LX1draw = 1;
- LX1[0] = xmin; LX1[1] = ymax; LX1[2] = zmin; LX1[3] = xmax; LX1[4] = ymax; LX1[5] = zmin;
- /* 011 - 111 */
- LX2draw = 1;
- LX2[0] = xmin; LX2[1] = ymax; LX2[2] = zmax; LX2[3] = xmax; LX2[4] = ymax; LX2[5] = zmax;
- /* 001 - 101 */
- LX3draw = 1;
- LX3[0] = xmin; LX3[1] = ymin; LX3[2] = zmax; LX3[3] = xmax; LX3[4] = ymin; LX3[5] = zmax;
-
- /* 100 - 110 */
- LY1draw = 1;
- LY1[0] = xmax; LY1[1] = ymin; LY1[2] = zmin; LY1[3] = xmax; LY1[4] = ymax; LY1[5] = zmin;
- /* 101 - 111 */
- LY2draw = 1;
- LY2[0] = xmax; LY2[1] = ymin; LY2[2] = zmax; LY2[3] = xmax; LY2[4] = ymax; LY2[5] = zmax;
- /* 001 - 011 */
- LY3draw = 1;
- LY3[0] = xmin; LY3[1] = ymin; LY3[2] = zmax; LY3[3] = xmin; LY3[4] = ymax; LY3[5] = zmax;
-
- /* 100 - 101 */
- LZ1draw = 1;
- LZ1[0] = xmax; LZ1[1] = ymin; LZ1[2] = zmin; LZ1[3] = xmax; LZ1[4] = ymin; LZ1[5] = zmax;
- /* 110 - 111 */
- LZ2draw = 1;
- LZ2[0] = xmax; LZ2[1] = ymax; LZ2[2] = zmin; LZ2[3] = xmax; LZ2[4] = ymax; LZ2[5] = zmax;
- /* 010 - 011 */
- LZ3draw = 1;
- LZ3[0] = xmin; LZ3[1] = ymax; LZ3[2] = zmin; LZ3[3] = xmin; LZ3[4] = ymax; LZ3[5] = zmax;
-
- break;
- }
- }
-
- /* Draw the graduated trihedron */
- unsigned int i, j, offset;
- float m1[3], m2[3];
- float step, dx, dy, dz;
-
- /* Grid */
- if (data->drawgrid)
- {
- glColor3fv(data->gridcolor);
- glBegin(GL_LINES);
- /* Boundary grid-lines */
- if (LX1draw == 1)
- {
- glVertex3fv(&(LX1[0]));
- glVertex3fv(&(LX1[3]));
- }
- if (LX2draw == 1)
- {
- glVertex3fv(&(LX2[0]));
- glVertex3fv(&(LX2[3]));
- }
- if (LX3draw == 1)
- {
- glVertex3fv(&(LX3[0]));
- glVertex3fv(&(LX3[3]));
- }
- if (LY1draw == 1)
- {
- glVertex3fv(&(LY1[0]));
- glVertex3fv(&(LY1[3]));
- }
- if (LY2draw == 1)
- {
- glVertex3fv(&(LY2[0]));
- glVertex3fv(&(LY2[3]));
- }
- if (LY3draw == 1)
- {
- glVertex3fv(&(LY3[0]));
- glVertex3fv(&(LY3[3]));
- }
- if (LZ1draw == 1)
- {
- glVertex3fv(&(LZ1[0]));
- glVertex3fv(&(LZ1[3]));
- }
- if (LZ2draw == 1)
- {
- glVertex3fv(&(LZ2[0]));
- glVertex3fv(&(LZ2[3]));
- }
- if (LZ3draw == 1)
- {
- glVertex3fv(&(LZ3[0]));
- glVertex3fv(&(LZ3[3]));
- }
- glEnd();
-
- /* Intermediate grid-lines */
- /* X-Grid lines */
- if (data->nbx > 0)
- {
- i = data->drawaxes ? 1 : 0;
- step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx;
- while (i < data->nbx)
- {
- glBegin(GL_LINE_STRIP);
- glVertex3f(LX1[0] + i * step, LX1[1], LX1[2]);
- glVertex3f(LX2[0] + i * step, LX2[1], LX2[2]);
- glVertex3f(LX3[0] + i * step, LX3[1], LX3[2]);
- glEnd();
- i++;
- }
- }
- /* Y-Grid lines */
- if (data->nby > 0)
- {
- i = data->drawaxes ? 1 : 0;
- step = fabsf(LY1[4] - LY1[1]) / (float) data->nby;
- while (i < data->nby)
- {
- glBegin(GL_LINE_STRIP);
- glVertex3f(LY1[0], LY1[1] + i * step, LY1[2]);
- glVertex3f(LY2[0], LY2[1] + i * step, LY2[2]);
- glVertex3f(LY3[0], LY3[1] + i * step, LY3[2]);
- glEnd();
- i++;
- }
- }
- /* Z-Grid lines */
- if (data->nbz > 0)
- {
- i = data->drawaxes ? 1 : 0;
- step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz;
- while (i < data->nbz)
- {
- glBegin(GL_LINE_STRIP);
- glVertex3f(LZ1[0], LZ1[1], LZ1[2] + i * step);
- glVertex3f(LZ2[0], LZ2[1], LZ2[2] + i * step);
- glVertex3f(LZ3[0], LZ3[1], LZ3[2] + i * step);
- glEnd();
- i++;
- }
- }
- }
-
- /* Axes (arrows) */
- if (data->drawaxes)
- {
- /* X-axis */
- glColor3fv(data->xcolor);
- drawArrow(xmin, ymin, zmin, xmax, ymin, zmin, normal[0], normal[1], normal[2]);
-
- /* Y-axis */
- glColor3fv(data->ycolor);
- drawArrow(xmin, ymin, zmin, xmin, ymax, zmin, normal[0], normal[1], normal[2]);
-
- /* Z-axis */
- glColor3fv(data->zcolor);
- drawArrow(xmin, ymin, zmin, xmin, ymin, zmax, normal[0], normal[1], normal[2]);
- }
-
- /* Names of axes & values */
- char textValue[128];
- wchar_t wtextValue[128];
-
- if (data->xdrawname || data->xdrawvalues)
- {
- /* Middle point of the first X-axis */
- m1[0] = 0.5f * (LX1[0] + LX1[3]);
- m1[1] = 0.5f * (LX1[1] + LX1[4]);
- m1[2] = 0.5f * (LX1[2] + LX1[5]);
-
- /* Middle point of the second X-axis */
- m2[0] = 0.5f * (LX2[0] + LX2[3]);
- m2[1] = 0.5f * (LX2[1] + LX2[4]);
- m2[2] = 0.5f * (LX2[2] + LX2[5]);
-
- /* Apply offset to m1 */
- dy = m1[1] - m2[1];
- if (fabsf(dy) > 1.e-7f)
- {
- dy = (dy > 0.0f)? 1.0f : -1.0f;
- }
- dz = m1[2] - m2[2];
- if (fabsf(dz) > 1.e-7f)
- {
- dz = (dz > 0.0f)? 1.0f : -1.0f;
- }
- m2[1] = dpix * dy;
- m2[2] = dpix * dz;
-
- /* Name of X-axis */
- if (data->xdrawname)
- {
- glColor3fv(data->xnamecolor);
- offset = data->xaxisoffset + data->xtickmarklength;
- drawText(data->xname, data->fontOfNames, data->styleOfNames, data->sizeOfNames,
- m1[0], m1[1] + offset * m2[1], m1[2] + offset * m2[2]);
- }
-
- /* X-values */
- if (data->xdrawvalues && data->nbx > 0)
- {
- glColor3fv(data->xcolor);
-
- i = 0;
- step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx;
- offset = data->xoffset + data->xtickmarklength;
- while (i <= data->nbx)
- {
- sprintf(textValue, "%g", LX1[0] + i * step);
- j = 0; while (wtextValue[j] = textValue[j]) j++;
- drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
- LX1[0] + i * step, m1[1] + offset * m2[1], m1[2] + offset * m2[2]);
- i++;
- }
- }
-
- /* X-tickmark */
- if (data->xdrawtickmarks && data->nbx > 0)
- {
- glColor3fv(data->gridcolor);
-
- i = 0;
- step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx;
- while (i <= data->nbx)
- {
- glBegin(GL_LINES);
- glVertex3f(LX1[0] + i * step, m1[1], m1[2]);
- glVertex3f(LX1[0] + i * step, m1[1] + data->xtickmarklength * m2[1], m1[2] + data->xtickmarklength * m2[2]);
- glEnd();
- i++;
- }
- }
- }
-
- if (data->ydrawname || data->ydrawvalues)
- {
- /* Middle point of the first Y-axis */
- m1[0] = 0.5f * (LY1[0] + LY1[3]);
- m1[1] = 0.5f * (LY1[1] + LY1[4]);
- m1[2] = 0.5f * (LY1[2] + LY1[5]);
-
- /* Middle point of the second Y-axis */
- m2[0] = 0.5f * (LY2[0] + LY2[3]);
- m2[1] = 0.5f * (LY2[1] + LY2[4]);
- m2[2] = 0.5f * (LY2[2] + LY2[5]);
-
- /* Apply offset to m1 */
- dx = m1[0] - m2[0];
- if (fabsf(dx) > 1.e-7f)
- {
- dx = (dx > 0.0f)? 1.0f : -1.0f;
- }
- dz = m1[2] - m2[2];
- if (fabsf(dz) > 1.e-7f)
- {
- dz = (dz > 0.0f)? 1.0f : -1.0f;
- }
-
- m2[0] = dpix * dx;
- m2[2] = dpix * dz;
-
- /* Name of Y-axis */
- if (data->ydrawname)
- {
- glColor3fv(data->ynamecolor);
- offset = data->yaxisoffset + data->ytickmarklength;
- drawText(data->yname, data->fontOfNames, data->styleOfNames, data->sizeOfNames,
- m1[0] + offset * m2[0], m1[1], m1[2] + offset * m2[2]);
- }
-
- /* Y-values */
- if (data->ydrawvalues && data->nby > 0)
- {
- glColor3fv(data->ycolor);
-
- i = 0;
- step = fabsf(LY1[4] - LY1[1]) / (float) data->nby;
- offset = data->yoffset + data->ytickmarklength;
- while (i <= data->nby)
- {
- sprintf(textValue, "%g", LY1[1] + i * step);
- j = 0; while (wtextValue[j] = textValue[j]) j++;
- drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
- m1[0] + offset * m2[0], LY1[1] + i * step, m1[2] + offset * m2[2]);
- i++;
- }
- }
-
- /* Y-tickmark */
- if (data->ydrawtickmarks && data->nby > 0)
- {
- glColor3fv(data->gridcolor);
-
- i = 0;
- step = fabsf(LY1[4] - LY1[1]) / (float) data->nby;
- while (i <= data->nby)
- {
- glBegin(GL_LINES);
- glVertex3f(m1[0], LY1[1] + i * step, m1[2]);
- glVertex3f(m1[0] + data->ytickmarklength * m2[0], LY1[1] + i * step, m1[2] + data->ytickmarklength * m2[2]);
- glEnd();
- i++;
- }
- }
- }
-
- if (data->zdrawname || data->zdrawvalues)
- {
- /* Middle point of the first Z-axis */
- m1[0] = 0.5f * (LZ1[0] + LZ1[3]);
- m1[1] = 0.5f * (LZ1[1] + LZ1[4]);
- m1[2] = 0.5f * (LZ1[2] + LZ1[5]);
-
- /* Middle point of the second Z-axis */
- m2[0] = 0.5f * (LZ2[0] + LZ2[3]);
- m2[1] = 0.5f * (LZ2[1] + LZ2[4]);
- m2[2] = 0.5f * (LZ2[2] + LZ2[5]);
-
- /* Apply offset to m1 */
- dx = m1[0] - m2[0];
- if (fabsf(dx) > 1.e-7f)
- {
- dx = (dx > 0.0f)? 1.0f : -1.0f;
- }
- dy = m1[1] - m2[1];
- if (fabsf(dy) > 1.e-7f)
- {
- dy = (dy > 0.0f)? 1.0f : -1.0f;
- }
-
- m2[0] = dpix * dx;
- m2[1] = dpix * dy;
-
- /* Name of Z-axis */
- if (data->zdrawname)
- {
- glColor3fv(data->znamecolor);
- offset = data->zaxisoffset + data->ztickmarklength;
- drawText(data->zname, data->fontOfNames, data->styleOfNames, data->sizeOfNames,
- m1[0] + offset * m2[0], m1[1] + offset * m2[1], m1[2]);
- }
-
- /* Z-values */
- if (data->zdrawvalues && data->nbz > 0)
- {
- glColor3fv(data->zcolor);
-
- i = 0;
- step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz;
- offset = data->zoffset + data->ztickmarklength;
- while (i <= data->nbz)
- {
- sprintf(textValue, "%g", LZ1[2] + i * step);
- j = 0; while (wtextValue[j] = textValue[j]) j++;
- drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues,
- m1[0] + offset * m2[0], m1[1] + offset * m2[1], LZ1[2] + i * step);
- i++;
- }
- }
-
- /* Z-tickmark */
- if (data->zdrawtickmarks && data->nbz > 0)
- {
- glColor3fv(data->gridcolor);
-
- i = 0;
- step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz;
- while (i <= data->nbz)
- {
- glBegin(GL_LINES);
- glVertex3f(m1[0], m1[1], LZ1[2] + i * step);
- glVertex3f(m1[0] + data->ztickmarklength * m2[0], m1[1] + data->ztickmarklength * m2[1], LZ1[2] + i * step);
- glEnd();
- i++;
- }
- }
- }
-
- /* Activate the lighting if it was turned off by this method call */
- if (light)
- glEnable(GL_LIGHTING);
-
- return TSuccess;
-}
-
-TStatus call_graduatedtrihedron_minmaxvalues(const float xMin,
- const float yMin,
- const float zMin,
- const float xMax,
- const float yMax,
- const float zMax)
-{
- xmin = xMin;
- ymin = yMin;
- zmin = zMin;
- xmax = xMax;
- ymax = yMax;
- zmax = zMax;
- return TSuccess;
-}
+++ /dev/null
-// File: OpenGl_graduatedtrihedron.hxx
-// Created: 6 March 2011
-// Author: Sergey ZERCHANINOV
-// Copyright: OPEN CASCADE SA 2011
-
-#ifndef __OPENGL_GRADUATEDTRIHEDRON_H_
-#define __OPENGL_GRADUATEDTRIHEDRON_H_
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_telem_view.hxx>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Aspect.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <Graphic3d_CGraduatedTrihedron.hxx>
-
-extern TStatus call_graduatedtrihedron_display(int WsId, const Graphic3d_CGraduatedTrihedron &data);
-extern TStatus call_graduatedtrihedron_redraw(int WsId);
-extern TStatus call_graduatedtrihedron_erase(int WsId);
-extern TStatus call_graduatedtrihedron_minmaxvalues(const float xMin,
- const float yMin,
- const float zMin,
- const float xMax,
- const float yMax,
- const float zMax);
-
-#endif /* __OPENGL_GRADUATEDTRIHEDRON_H_ */
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_highlight :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_Memory.hxx>
-
-struct TEL_HIGHLIGHT_DATA
-{
- Tint hid;
- TEL_HIGHLIGHT highl;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_HIGHLIGHT_DATA* tel_highlight_data;
-
-struct TEL_WS_HIGHLIGHTS
-{
- Tint num; /* number of highlights for a workstation */
- Tint siz; /* size allocated */
- TEL_HIGHLIGHT_DATA* data; /* highlight definitions for the workstation */
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_WS_HIGHLIGHTS* tel_ws_highlights;
-
-#define GROW_SIZE 25
-
-static tel_ws_highlights ws_hlights;
-
-static Tint
-b_s( Tint id, tel_highlight_data tbl, Tint low, Tint high )
-{
- register Tint mid, i;
-
- if( low > high )
- return -1;
-
- mid = low+high, mid /= 2;
- i = id - tbl[mid].hid;
-
- return i == 0 ? mid : i < 0 ? b_s( id, tbl, low, mid-1 ) :
- b_s( id, tbl, mid+1, high );
-}
-
-
-static int
-lnumcomp( const void* a, const void* b )
-{
- return *( Tint* )a - *( Tint* )b;
-}
-
-
-TStatus
-TelSetHighlightRep( Tint Wsid, Tint hid, tel_highlight highl )
-{
-#if 0
- CMN_KEY_DATA key;
-#endif
- tel_highlight_data hptr;
- register Tint i;
-#if 0
- TsmGetWSAttri( Wsid, WSHighlights, &key );
- ws_hlights = key.pdata ; /* Obtain list of defined highlights */
-#endif
- if( !ws_hlights ) /* no highlights defined yet */
- { /* allocate */
- //cmn_memreserve( ws_hlights, 1, 0 );
- ws_hlights = new TEL_WS_HIGHLIGHTS();
- if( !ws_hlights )
- return TFailure;
- //cmn_memreserve( ws_hlights->data, GROW_SIZE, 0 );
- ws_hlights->data = new TEL_HIGHLIGHT_DATA[GROW_SIZE];
- if( !ws_hlights )
- return TFailure;
-
- ws_hlights->siz = GROW_SIZE;
- ws_hlights->num = 0;
-#if 0
- key.pdata = ws_hlights;/* Set list for the workstation */
- TsmSetWSAttri( Wsid, WSHighlights, &key );
-#endif
- }
- else if( ws_hlights->num == ws_hlights->siz ) /* insufficient memory */
- { /* realloc */
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- ws_hlights->data = (TEL_HIGHLIGHT_DATA*)realloc( ws_hlights->data, (ws_hlights->siz
- + GROW_SIZE)*sizeof(TEL_HIGHLIGHT_DATA) );
-#else
- ws_hlights->data = cmn_resizemem<TEL_HIGHLIGHT_DATA>( ws_hlights->data, ws_hlights->siz
- + GROW_SIZE );
-#endif
- if( !ws_hlights )
- return TFailure;
-
- ws_hlights->siz += GROW_SIZE;
-#if 0
- key.pdata = ws_hlights; /* Reset list for the workstation */
- TsmSetWSAttri( Wsid, WSHighlights, &key );
-#endif
- }
- hptr = 0; /* Locate highlight if already defined */
- i = b_s( hid, ws_hlights->data, 0, ws_hlights->num-1 );
- if( i != -1 )
- {
- hptr = &ws_hlights->data[i]; /* highlight already defined */
- hptr->highl = *highl; /* copy highlight definition */
- }
-
- if( !hptr ) /* new highlight */
- {
- hptr = &ws_hlights->data[ws_hlights->num];
- hptr->highl = *highl; /* copy highlight definition */
- hptr->hid = hid; /* highlights for the workstation */
- ws_hlights->num++; /* and sort the entries */
- qsort( ws_hlights->data, ws_hlights->num,
- sizeof(TEL_HIGHLIGHT_DATA), lnumcomp );
- }
-
-
- return TSuccess;
-}
-
-
-TStatus
-TelGetHighlightRep( Tint Wsid, Tint hid, tel_highlight highl )
-{
-#if 0
- CMN_KEY_DATA key;
-#endif
- tel_highlight_data hptr;
- register Tint i;
-#if 0
- TsmGetWSAttri( Wsid, WSHighlights, &key );
- ws_hlights = key.pdata ; /* Obtain list of defined highlights */
-#endif
- if( !ws_hlights )
- return TFailure; /* no highlights defined */
-
- hptr = 0; /* Locate highlight if already defined */
- i = b_s( hid, ws_hlights->data, 0, ws_hlights->num-1 );
- if( i == -1 )
- return TFailure; /* hid undefined */
-
- hptr = &ws_hlights->data[i];
- *highl = hptr->highl;
-
- return TSuccess;
-}
-
-
-void
-TelPrintHighlightRep( Tint Wsid, Tint hid )
-{
-#if 0
- CMN_KEY_DATA key;
-#endif
- tel_highlight_data hptr;
- register Tint i;
-
-#if 0
- TsmGetWSAttri( Wsid, WSHighlights, &key );
- ws_hlights = key.pdata ; /* Obtain list of defined highlights */
-#endif
- if( !ws_hlights )
- return; /* no highlights defined */
-
- hptr = 0; /* Locate highlight if already defined */
- i = b_s( hid, ws_hlights->data, 0, ws_hlights->num-1 );
- if( i == -1 )
- {
- fprintf( stdout, "\nBad Highlight %d\n", hid );
- return; /* hid undefined */
- }
-
- hptr = &ws_hlights->data[i];
- fprintf( stdout, "\nHighlight Id: %d", hid );
- switch( hptr->highl.type )
- {
- case TelHLColour:
- fprintf( stdout, "\nHighlight type: TelHLColour" );
- fprintf( stdout, "\n\tColour: %f %f %f",
- hptr->highl.col.rgb[0],
- hptr->highl.col.rgb[1],
- hptr->highl.col.rgb[2] );
- break;
-
- case TelHLForcedColour:
- fprintf( stdout, "\nHighlight type: TelHLForcedColour" );
- fprintf( stdout, "\n\tColour: %f %f %f",
- hptr->highl.col.rgb[0],
- hptr->highl.col.rgb[1],
- hptr->highl.col.rgb[2] );
- break;
- }
- fprintf( stdout, "\n" );
-
- return;
-}
-
-TStatus
-TelDeleteHighlightsForWS( Tint wsid )
-{
- CMN_KEY_DATA key;
- tel_ws_highlights h;
-
- TsmGetWSAttri( wsid, WSHighlights, &key );
- h = (tel_ws_highlights)key.pdata;
-
- if( !h )
- return TSuccess;
-
- //cmn_freemem( h );
- if ( h->data )
- delete[] h->data;
- delete h;
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus HighlightIndexDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus HighlightIndexAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus HighlightIndexPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus HighlightIndexInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- HighlightIndexDisplay,
- HighlightIndexAdd,
- 0, /* Delete */
- HighlightIndexPrint,
- HighlightIndexInquire
-};
-
-
-MtblPtr
-TelHighlightIndexInitClass( TelType *el )
-{
- *el = TelHighlightIndex;
- return MtdTbl;
-}
-
-static TStatus
-HighlightIndexAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-HighlightIndexDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY kk;
-
- kk.id = TelHighlightIndex;
- kk.data.ldata = data.ldata;
- TsmSetAttri( 1, &kk );
- return TSuccess;
-}
-
-
-static TStatus
-HighlightIndexPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelHighlightIndex. Value = %d\n", data.ldata);
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-static TStatus
-HighlightIndexInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c =(tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_indexpolygons :
-
-
-REMARQUES:
-----------
-
-Le culling et le backfacing ne marchent pas.
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-09-08-96 : FMN ; Suppression appel glMatrixMode() avant glGetFloatv()
-21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
-30-06-97 : FMN ; Suppression OpenGl_telem_light.h
-18-07-97 : FMN ; Ajout desactivation des lights suivant front_lighting_model
-21-07-97 : FMN ; Amelioration des performances OPTIMISATION_FMN
-- suppression calcul inutile sur les front faces
-- utilisation de GL_TRIANGLES et GL_QUADS
-27-08-97 : FMN ; Correction affichage des edges
-On n'affiche que les edges dans le mode IS_EMPTY
-27-08-97 : FMN ; Correction affichage des edges visibility [PRO9859]
-10-09-97 : FMN ; Amelioration des perfs liees aux lights.
-15-09-97 : PCT ; Ajout coordonnees textures
-24-09-97 : FMN ; Suppression OPTIMISATION_FMN.
-08-12-97 : FMN ; Suppression appel TsmGetAttri inutile.
-31-12-97 : FMN ; Simplification pour le highlight
-15-01-98 : FMN ; Ajout Hidden line
-08-03-01 : GG ; BUC60823 Avoid crash in the normal computation method
-on confuse point.
-
-************************************************************************/
-
-#define xPRINT
-
-#define G003 /* EUG 07-10-99 Degeneration mode support
-*/
-
-#define G004 /* VKH 25-01-00 View dump management
-Disable animation during dump
-*/
-
-#define BUC60876 /* GG 5/4/2001 Disable local display list
-// when animation is not required
-*/
-
-#define OCC749 /* SAV 19/09/02 added processing of colored vertices */
-#define OCC7824 /* ASL 26/01/05 transparency of polygon with colors assigned to vertices */
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-//#include <OpenGl_cmn_memory.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_TextureBox.hxx>
-
-#ifdef G003
-# include <float.h>
-# define DEF_DS_INTERNAL
-# include <OpenGl_degeneration.hxx>
-# ifdef G004
-extern GLboolean g_fBitmap;
-# endif /* G004 */
-#endif /* G003 */
-
-static long s_Rand = 1L;
-# define OPENGL_RAND() ( ( unsigned )( s_Rand = s_Rand * 214013L + 2531011L ))
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes
-*/
-
-static TStatus PolygonIndicesDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonIndicesAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonIndicesDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonIndicesPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonIndicesInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*static GLboolean lighting_mode;*/
-
-struct TEL_INDEXPOLY_DATA
-{
- Tint num_vertices; /* Number of vertices */
- Tint num_bounds; /* Number of bounds */
- Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */
- Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */
- Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or
- TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */
- Tint *edge_vis; /* Edge visibility indicators for each edge */
- Tint *bounds; /* Bounds array */
- Tint *indices; /* Connectivity array */
- tel_point fnormals; /* Facet normals */
- tel_colour fcolours; /* Facet colour values */
- tel_point vertices; /* Vertices */
- tel_colour vcolours; /* Vertex colour values */
- tel_point vnormals; /* Vertex normals */
- tel_texture_coord vtexturecoord; /* Texture Coordinates */
- Tint edge_count; /* Internal field */
-#ifdef G003
- DS_INTERNAL d;
-#endif /* G003 */
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_INDEXPOLY_DATA* tel_indexpoly_data;
-
-static TEL_INDEXPOLY_DATA indexpoly_defaults =
-{
- 0, /* num_vertices */
- 0, /* num_bounds */
- TEL_FA_NONE, /* facet_flag */
- TEL_VT_NONE, /* vertex_flag */
- TEL_SHAPE_UNKNOWN, /* shape_flag */
- 0, /* edge_vis */
- 0, /* bounds */
- 0, /* indices */
- 0, /* fnormal */
- 0, /* fcolour */
- 0, /* vertices */
- 0, /* vcolours */
- 0, /* vnormals */
- 0, /* vtexturecoord */
- 0 /* edge_count */
-#ifdef G003
- , { 0, 0, 0, -1, 0.0F, NULL }
-#endif /* G003 */
-};
-
-static void draw_indexpoly(
- tel_indexpoly_data,
- Tint, /* highlight_flag */
- Tint, /* front_lighting_model, */
- Tint, /* interior_style, */
- tel_colour /* edge_colour, */
-#ifdef OCC749
- , tel_surf_prop
-#endif
- );
-
-#ifdef G003
-static void draw_edges ( tel_indexpoly_data, tel_colour, Tint, Tint );
-static void draw_degenerates_as_points ( tel_indexpoly_data );
-static void draw_degenerates_as_bboxs ( tel_indexpoly_data );
-void set_drawable_items ( GLboolean*, int );
-#else
-static void draw_edges( tel_indexpoly_data,tel_colour, Tint);
-#endif
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- PolygonIndicesDisplay, /* PickTraverse */
- PolygonIndicesDisplay,
- PolygonIndicesAdd,
- PolygonIndicesDelete,
- PolygonIndicesPrint,
- PolygonIndicesInquire
-};
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */
-extern int g_nDegenerateModel;
-
-#ifdef G003
-extern float g_fSkipRatio;
-extern GLboolean g_fAnimation;
-#endif /* G003 */
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr
-TelPolygonIndicesInitClass( TelType* el )
-{
- *el = TelPolygonIndices;
- return MtdTbl;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-PolygonIndicesAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tint i, j, a, b, edge_count=0;
- tel_indexpoly_data data;
-
- for( i = 0; i < n; i++ )
- {
- if( k[i]->id == NUM_VERTICES_ID )
- break;
- }
- if( i == n )
- return TFailure;
-
- if( !(k[i]->data.ldata) )
- return TFailure;
-
- for( j = 0; j < n; j++ )
- {
- if( k[j]->id == VERTICES_ID )
- break;
- }
- if( j == n )
- return TFailure;
-
- for( a = 0; a < n; a++ )
- {
- if( k[a]->id == NUM_FACETS_ID )
- break;
- }
- if( a == n )
- return TFailure;
-
- //cmn_memreserve( data, 1, 1 );
- data = new TEL_INDEXPOLY_DATA();
- if( !data )
- return TFailure;
-
- /* load defaults */
- //cmn_memcpy<TEL_INDEXPOLY_DATA>( data, &indexpoly_defaults, 1 );
- memcpy( data, &indexpoly_defaults, sizeof(TEL_INDEXPOLY_DATA) );
-
- data->num_vertices = k[i]->data.ldata;
- //cmn_memreserve( data->vertices, data->num_vertices, 0 );
- data->vertices = new TEL_POINT[data->num_vertices];
- //cmn_memcpy<TEL_POINT>( data->vertices, k[j]->data.pdata, data->num_vertices );
- memcpy( data->vertices, k[j]->data.pdata, data->num_vertices*sizeof(TEL_POINT) );
- data->num_bounds = k[a]->data.ldata;
-
- for( b = 0; b < n; b++ )
- {
- if( k[b]->id == BOUNDS_DATA_ID )
- break;
- }
- if( b == n )
- {
- //cmn_freemem( data->vertices );
- delete[] data->vertices;
- return TFailure;
- }
- //cmn_memreserve( data->bounds, data->num_bounds, 0 );
- data->bounds = new Tint[data->num_bounds];
- //cmn_memcpy<Tint>( data->bounds, k[b]->data.pdata, data->num_bounds );
- memcpy( data->bounds, k[b]->data.pdata, data->num_bounds*sizeof(Tint) );
-
- for( b = 0; b < data->num_bounds; b++ )
- edge_count += data->bounds[b];
-
- data->edge_count = edge_count;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case EDGE_DATA_ID:
- data->edge_vis = new Tint[edge_count];
- memcpy( data->edge_vis, k[i]->data.pdata, edge_count*sizeof(Tint) );
- break;
-
- case CONNECTIVITY_ID:
- data->indices = new Tint[edge_count];
- memcpy( data->indices, k[i]->data.pdata, edge_count*sizeof(Tint) );
- break;
-
- case FNORMALS_ID:
- data->facet_flag = TEL_FA_NORMAL;
- data->fnormals = new TEL_POINT[data->num_bounds];
- memcpy( data->fnormals, k[i]->data.pdata, data->num_bounds*sizeof(TEL_POINT) );
- for( a = 0; a < data->num_bounds; a++ )
- vecnrm( data->fnormals[a].xyz );
- break;
-
- case FACET_COLOUR_VALS_ID:
- data->fcolours = new TEL_COLOUR[data->num_bounds];
- memcpy( data->fcolours, k[i]->data.pdata, data->num_bounds*sizeof(TEL_COLOUR) );
- break;
-
- case VERTEX_COLOUR_VALS_ID:
- data->vcolours = new TEL_COLOUR[data->num_vertices];
- memcpy( data->vcolours, k[i]->data.pdata, data->num_vertices*sizeof(TEL_COLOUR) );
- break;
-
- case VNORMALS_ID:
- data->vertex_flag = TEL_VT_NORMAL;
- data->vnormals = new TEL_POINT[data->num_vertices];
- memcpy( data->vnormals, k[i]->data.pdata, data->num_vertices*sizeof(TEL_POINT) );
- for( j = 0; j < data->num_vertices; j++ )
- vecnrm( data->vnormals[j].xyz );
- break;
-
- case SHAPE_FLAG_ID:
- data->shape_flag = k[i]->data.ldata;
- break;
-
- case VTEXTURECOORD_ID:
- data->vtexturecoord = new TEL_TEXTURE_COORD[data->num_vertices];
- memcpy( data->vtexturecoord, k[i]->data.pdata, data->num_vertices*sizeof(TEL_TEXTURE_COORD) );
- break;
- }
- }
-
- if( data->facet_flag != TEL_FA_NORMAL )
- {
- data->fnormals = new TEL_POINT[data->num_bounds];
- for( i = 0, a = 0; i < data->num_bounds; i++ ) {
-#ifdef BUC60823
- TelGetPolygonNormal( data->vertices, &data->indices[a],
- data->bounds[i], data->fnormals[i].xyz );
-#else
- TelGetNormal( data->vertices[data->indices[a]].xyz,
- data->vertices[data->indices[a+1]].xyz,
- data->vertices[data->indices[a+j]].xyz,
- data->fnormals[i].xyz );
- vecnrm(data->fnormals[i].xyz);
-#endif
- a += data->bounds[i];
- }
- }
-#ifdef G003
- data->d.bDraw = new unsigned char[data->num_bounds];
-#endif /* G003 */
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-PolygonIndicesDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY k11, k12, k17, k111, k114;
-#ifdef OCC749
- CMN_KEY k117;
-#endif
-
- Tint front_lighting_model;
- Tint interior_style;
- TEL_COLOUR interior_colour;
- TEL_COLOUR edge_colour;
-#ifdef OCC749
- TEL_SURF_PROP prop;
-#endif
-
- tel_indexpoly_data d;
-
- k12.id = TelInteriorReflectanceEquation;
- k17.id = TelInteriorStyle;
- k111.id = TelInteriorColour;
- k111.data.pdata = &interior_colour;
- k114.id = TelEdgeColour;
- k114.data.pdata = &edge_colour;
-#ifdef OCC749
- k117.id = TelSurfaceAreaProperties;
- k117.data.pdata = ∝
-#endif
-
-#ifdef OCC749
- TsmGetAttri( 5, &k12, &k17, &k111, &k114, &k117);
-#else
- TsmGetAttri( 4, &k12, &k17, &k111, &k114);
-#endif
-
- front_lighting_model = k12.data.ldata;
- interior_style = k17.data.ldata;
-
-#ifdef PRINT
- printf("PolygonIndicesDisplay \n");
-#endif
-
- /*
- * Use highlight colours
- */
-
- if( k[0]->id == TOn )
- {
- TEL_HIGHLIGHT hrep;
-
- k11.id = TelHighlightIndex;
- TsmGetAttri( 1, &k11 );
- if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep ) == TSuccess )
- {
- if( hrep.type == TelHLForcedColour )
- {
- edge_colour = interior_colour = hrep.col;
- front_lighting_model = CALL_PHIGS_REFL_NONE;
- }
- else if( hrep.type == TelHLColour )
- {
- edge_colour = hrep.col;
- k[0]->id = TOff;
- }
- }
- else
- {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- if( hrep.type == TelHLForcedColour )
- {
- edge_colour = interior_colour = hrep.col;
- front_lighting_model = CALL_PHIGS_REFL_NONE;
- }
- else if( hrep.type == TelHLColour )
- {
- edge_colour = hrep.col;
- k[0]->id = TOff;
- }
- }
- }
-
- d = (tel_indexpoly_data)data.pdata;
-
- glColor3fv( interior_colour.rgb );
-#ifdef PRINT
- printf("PolygonIndicesDisplay.interior_colour %f,%f,%f \n",
- interior_colour.rgb[0],interior_colour.rgb[1],interior_colour.rgb[2]);
-#endif
-
- draw_indexpoly( d, k[0]->id,
- front_lighting_model,
- interior_style,
- &edge_colour
-#ifdef OCC749
- , &prop
-#endif
- );
-
- return TSuccess;
-
-}
-
-/*----------------------------------------------------------------------*/
-
-static void
-draw_indexpoly( tel_indexpoly_data p, Tint hflag,
- Tint front_lighting_model,
- Tint interior_style,
- tel_colour edge_colour
-#ifdef OCC749
- , tel_surf_prop prop
-#endif
- )
-{
- Tint i, j, k, a, newList = 0;
- Tint lighting_model;
-
- /* Following pointers have been provided for performance improvement */
- Tint *ind;
- tel_point pfn, pvn, pv;
- tel_colour pvc, pfc;
- tel_texture_coord pvt;
-
- ind = p->indices;
- pfn = p->fnormals;
- pvn = p->vnormals;
- pvc = p->vcolours;
- pfc = p->fcolours;
- pv = p->vertices;
- pvt = p->vtexturecoord;
-#ifdef G003
- if ( g_nDegenerateModel < 2 && interior_style != TSM_EMPTY )
-#else
- if ( interior_style != TSM_EMPTY )
-#endif /* G003 */
- {
- if( hflag == TOn )
- {
- pvc = 0;
- pfc = 0;
- }
-
- if ( interior_style == TSM_HIDDENLINE)
- {
- pvc = 0;
- pfc = 0;
- }
-
- if (front_lighting_model == CALL_PHIGS_REFL_NONE)
- LightOff();
- else LightOn();
-
- lighting_model = front_lighting_model;
-
-#ifdef G003
-#ifdef BUC60876
- if ( !g_fAnimation )
- goto doDraw; /* Disable object display list out of animation */
-#endif
-#ifdef G004
- if ( g_fBitmap )
- goto doDraw; /* dipsplay lists are NOT shared between */
- /* window's context and bitmap's one */
-#endif /* G004 */
-
- if ( p -> d.model != lighting_model || !p -> d.list ||
- p -> d.model == -1 ||( g_nDegenerateModel && p -> d.skipRatio != g_fSkipRatio )) {
-
- p -> d.skipRatio = g_fSkipRatio;
- p -> d.model = lighting_model;
- p -> d.degMode = g_nDegenerateModel;
-#endif /* G003 */
-#ifdef G003
- if ( g_fSkipRatio == 0.0 ) {
- if ( !p -> d.list ) p -> d.list = glGenLists ( 1 );
-
- glNewList ( p -> d.list, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-doDraw:
-#endif /* G003 */
-
- if ( lighting_model == CALL_PHIGS_REFL_NONE ) {
- if ( p -> bounds[ 0 ] == 3 )
- glBegin ( GL_TRIANGLES );
- else if ( p -> bounds[ 0 ] == 4 )
- glBegin ( GL_QUADS );
- else glBegin ( GL_POLYGON );
-
- if ( pvc ) {
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- for ( ; j < a; ++j ) {
- glColor3fv ( pvc[ ind[ j ] ].rgb );
- glVertex3fv ( pv[ ind[ j ] ].xyz );
- } /* end for ( j . . . ) */
- } /* end for ( i . . . ) */
- } else if ( pfc ) {
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- glColor3fv ( pfc[ i ].rgb );
- for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
- } /* end for */
- } else {
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
- } /* end for */
- } /* end else */
- glEnd ();
- } else { /* lighting_model != TelLModelNone */
- if ( p -> bounds[ 0 ] == 3 )
- glBegin ( GL_TRIANGLES );
- else if ( p -> bounds[ 0 ] == 4 )
- glBegin ( GL_QUADS );
- else glBegin ( GL_POLYGON );
-
-#ifdef OCC749
- for ( i = a = 0; i < p -> num_bounds; ++i ) {
- j = a; a += p -> bounds[ i ];
- if( pfn ) glNormal3fv ( pfn[ i ].xyz );
- if( pfc && !prop->isphysic ) {
- GLfloat diff[4], ambi[4], emsv[4], r, g, b;
-
-#ifdef OCC7824
- ambi[3] = diff[3] = emsv[3] = prop->trans;
-#else
- ambi[3] = 1.0f; diff[3] = 1.0f; emsv[3] = 1.0f;
-#endif
-
- r = pfc[ i ].rgb[0]; g = pfc[ i ].rgb[1]; b = pfc[ i ].rgb[2];
-
- if( prop->isamb ) {
- ambi[0] = prop->amb * r;
- ambi[1] = prop->amb * g;
- ambi[2] = prop->amb * b;
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambi);
- }
- if( prop->isdiff ) {
- diff[0] = prop->diff * r;
- diff[1] = prop->diff * g;
- diff[2] = prop->diff * b;
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff);
- }
- if( prop->isemsv ) {
- emsv[0] = prop->emsv * r;
- emsv[1] = prop->emsv * g;
- emsv[2] = prop->emsv * b;
- glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, emsv);
- }
- }
- for ( ; j < a; ++j ) {
- k = ind[ j ];
- if( pvn ) glNormal3fv ( pvn[ k ].xyz );
- if( pvc && !prop->isphysic ) {
- GLfloat diff[4], ambi[4], emsv[4], r, g, b;
-
-#ifdef OCC7824
- ambi[3] = diff[3] = emsv[3] = prop->trans;
-#else
- ambi[3] = 1.0f; diff[3] = 1.0f; emsv[3] = 1.0f;
-#endif
-
- r = pvc[ k ].rgb[0]; g = pvc[ k ].rgb[1]; b = pvc[ k ].rgb[2];
-
- if( prop->isamb ) {
- ambi[0] = prop->amb * r;
- ambi[1] = prop->amb * g;
- ambi[2] = prop->amb * b;
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambi);
- }
- if( prop->isdiff ) {
- diff[0] = prop->diff * r;
- diff[1] = prop->diff * g;
- diff[2] = prop->diff * b;
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff);
- }
- if( prop->isemsv ) {
- emsv[0] = prop->emsv * r;
- emsv[1] = prop->emsv * g;
- emsv[2] = prop->emsv * b;
- glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, emsv);
- }
- }
- if( pvt && !ForbidSetTextureMapping ) glTexCoord2fv ( pvt[ k ].xy );
- glVertex3fv ( pv[ k ].xyz );
- } /* end for ( j . . . ) */
- } /* end for ( i . . . ) */
- glEnd ();
-#else
- if ( pvn ) {
- if ( pvt && !ForbidSetTextureMapping )
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- for ( ; j < a; ++j ) {
- glNormal3fv ( pvn[ ind[ j ] ].xyz );
- glTexCoord2fv ( pvt[ ind[ j ] ].xy );
- glVertex3fv ( pv[ ind[ j ] ].xyz );
- } /* end for ( j . . . ) */
- } /* end for ( i . . . ) */
- else
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- for ( ; j < a; ++j ) {
- glNormal3fv ( pvn[ ind[ j ] ].xyz );
- glVertex3fv ( pv[ ind[ j ] ].xyz );
- } /* end for ( j . . . ) */
- } /* end for ( i . . . ) */
- } else { /* !pvn */
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- glNormal3fv ( pfn[ i ].xyz );
- for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
- } /* end for */
- } /* end else */
- glEnd ();
-#endif /* OCC749 */
-
- } /* end else */
-#ifdef G003
- } else if ( g_fSkipRatio != 1.0 ) {
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
- set_drawable_items ( p -> d.bDraw, p -> num_bounds );
- if ( lighting_model == CALL_PHIGS_REFL_NONE ) {
- if ( p -> bounds[ 0 ] == 3 )
- glBegin ( GL_TRIANGLES );
- else if ( p -> bounds[ 0 ] == 4 )
- glBegin ( GL_QUADS );
- else glBegin ( GL_POLYGON );
-
- if ( pvc ) {
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- if ( p -> d.bDraw[ i ] )
- for ( ; j < a; ++j ) {
- glColor3fv ( pvc[ ind[ j ] ].rgb );
- glVertex3fv ( pv[ ind[ j ] ].xyz );
- } /* end for ( j . . . ) */
- else j = a;
- } /* end for ( i . . . ) */
- } else if ( pfc ) {
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- if ( p -> d.bDraw[ i ] ) {
- glColor3fv ( pfc[ i ].rgb );
- for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
- } else j = a;
- } /* end for */
- } else {
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- if ( p -> d.bDraw[ i ] )
- for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
- else j = a;
- } /* end for */
- } /* end else */
- glEnd ();
- } else { /* lighting_model != TelLModelNone */
- if ( p -> bounds[ 0 ] == 3 )
- glBegin ( GL_TRIANGLES );
- else if ( p -> bounds[ 0 ] == 4 )
- glBegin ( GL_QUADS );
- else glBegin ( GL_POLYGON );
-
- if ( pvn ) {
- if ( pvt && !ForbidSetTextureMapping )
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p->bounds[ i ];
- if ( p -> d.bDraw[ i ] )
- for ( ; j < a; ++j ) {
- glNormal3fv ( pvn[ ind[ j ] ].xyz );
- glTexCoord2fv ( pvt[ ind[ j ] ].xy );
- glVertex3fv ( pv[ ind[ j ] ].xyz );
- } /* end for ( j . . . ) */
- else j = a;
- } /* end for ( i . . . ) */
- else
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- if ( p -> d.bDraw[ i ] )
- for ( ; j < a; ++j ) {
- glNormal3fv ( pvn[ ind[ j ] ].xyz );
- glVertex3fv ( pv[ ind[ j ] ].xyz );
- } /* end for ( j . . . ) */
- else j = a;
- } /* end for ( i . . . ) */
- } else { /* !pvn */
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
- a = j + p -> bounds[ i ];
- if ( p -> d.bDraw[ i ] ) {
- glNormal3fv ( pfn[ i ].xyz );
- for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
- } else j = a;
- } /* end for */
- } /* end else */
- glEnd ();
- } /* end else */
- } else {
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
- } /* end else */
-#endif /* G003 */
-#ifdef G003
- if ( newList ) glEndList ();
- if ( g_nDegenerateModel ) return;
- } else {
- glCallList ( g_fSkipRatio == 0.0 ? p -> d.list : p -> d.dlist );
- if ( g_nDegenerateModel ) return;
- } /* end else */
-#endif /* G003 */
- }
-#ifdef G003
- i = 0;
-
- switch ( g_nDegenerateModel ) {
-
-default:
- break;
-
-case 2: /* XXX_TDM_WIREFRAME */
- i = 1;
- break;
-
-case 3: /* XXX_TDM_MARKER */
- draw_degenerates_as_points ( p );
- return;
-
-case 4: /* XXX_TDM_BBOX */
- draw_degenerates_as_bboxs ( p );
- return;
-
- } /* end switch */
-
- draw_edges ( p, edge_colour, interior_style, i );
-#else
- draw_edges( p, edge_colour, interior_style );
-#endif
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-PolygonIndicesDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_indexpoly_data p;
-
- p = (tel_indexpoly_data)data.pdata;
- if( p->edge_vis )
- //cmn_freemem( p->edge_vis );
- delete[] p->edge_vis;
- if( p->bounds )
- //cmn_freemem( p->bounds );
- delete[] p->bounds;
- if( p->indices )
- //cmn_freemem( p->indices );
- delete[] p->indices;
- if( p->fcolours )
- //cmn_freemem( p->fcolours );
- delete[] p->fcolours;
- if( p->fnormals )
- //cmn_freemem( p->fnormals );
- delete[] p->fnormals;
- if( p->vertices )
- //cmn_freemem( p->vertices );
- delete[] p->vertices;
- if( p->vcolours )
- //cmn_freemem( p->vcolours );
- delete[] p->vcolours;
- if( p->vnormals )
- //cmn_freemem( p->vnormals );
- delete[] p->vnormals;
- if (p->vtexturecoord)
- //cmn_freemem( p->vtexturecoord );
- delete[] p->vtexturecoord;
-#ifdef G003
- if ( GET_GL_CONTEXT() != NULL ) {
-
- if ( p -> d.list ) glDeleteLists ( p -> d.list, 1 );
- if ( p -> d.dlist ) glDeleteLists ( p -> d.dlist, 1 );
-
- } /* end if */
-
- if ( p -> d.bDraw )
- //cmn_freemem ( p -> d.bDraw );
- delete[] p -> d.bDraw;
-#endif /* G003 */
-
- //cmn_freemem( data.pdata );
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-PolygonIndicesPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_indexpoly_data p;
-
- p = (tel_indexpoly_data)data.pdata;
-
- fprintf( stdout, "TelPolygonIndices. Number of Vertices: %d\n", p->num_vertices );
- switch( p->shape_flag )
- {
- case TEL_SHAPE_UNKNOWN:
- fprintf( stdout, "\t\tShape Flag : UNKNOWN\n" );
- break;
-
- case TEL_SHAPE_COMPLEX:
- fprintf( stdout, "\t\tShape Flag : COMPLEX\n" );
- break;
-
- case TEL_SHAPE_CONCAVE:
- fprintf( stdout, "\t\tShape Flag : CONCAVE\n" );
- break;
-
- case TEL_SHAPE_CONVEX:
- fprintf( stdout, "\t\tShape Flag : CONVEX\n" );
- break;
-
- }
- switch( p->facet_flag )
- {
- case TEL_FA_NONE:
- if( p->fcolours )
- fprintf( stdout, "\t\tFacet Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tFacet Flag : NONE\n" );
- break;
-
- case TEL_FA_NORMAL:
- if( p->fcolours )
- fprintf( stdout, "\t\tFacet Flag : COLOURNORMAL\n" );
- else
- fprintf( stdout, "\t\tFacet Flag : NORMAL\n" );
- break;
- }
- switch( p->vertex_flag )
- {
- case TEL_VT_NONE:
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NONE\n" );
- break;
-
- case TEL_VT_NORMAL:
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOURNORMAL\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NORMAL\n" );
- break;
- }
- if( p->edge_vis )
- {
- fprintf( stdout, "\t\tEdge Visibility Data :\n" );
- for( i = 0; i < p->edge_count; i++ )
- fprintf( stdout, "\t\t%d ", p->edge_vis[i] );
- fprintf( stdout, "\n" );
- }
- if( p->bounds )
- {
- fprintf( stdout, "\t\tBounds array :\n" );
- for( i = 0; i < p->num_bounds; i++ )
- fprintf( stdout, "\t\tb[%d] %d \n", i, p->bounds[i] );
- }
- if( p->indices )
- {
- fprintf( stdout, "\t\tConnectivity array :\n" );
- for( i = 0; i < p->edge_count; i++ )
- fprintf( stdout, "\t\tI[%d] %d \n", i, p->indices[i] );
- }
- if( p->fnormals )
- {
- fprintf( stdout, "\n\t\tFacet Normals : " );
- for( i = 0; i < p->num_bounds; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->fnormals[i].xyz[0],
- p->fnormals[i].xyz[1],
- p->fnormals[i].xyz[2] );
- fprintf( stdout, "\n" );
- }
- else
- fprintf( stdout, "\n\t\tFacet Normals not specified\n" );
-
- if( p->fcolours )
- {
- fprintf( stdout, "\n\t\tFacet Colours : " );
- for( i = 0; i < p->num_bounds; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->fcolours[i].rgb[0],
- p->fcolours[i].rgb[1],
- p->fcolours[i].rgb[2] ); }
- else
- fprintf( stdout, "\n\t\tFacet Colours not specified\n" );
-
- if( p->vertices )
- {
- fprintf( stdout, "\n\t\tVertices : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vertices[i].xyz[0],
- p->vertices[i].xyz[1],
- p->vertices[i].xyz[2] );
- }
-
- fprintf( stdout, "\n" );
- if( p->vcolours )
- {
- fprintf( stdout, "\n\t\tVertex Colours : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vcolours[i].rgb[0],
- p->vcolours[i].rgb[1],
- p->vcolours[i].rgb[2] );
- }
- else
- fprintf( stdout, "\n\t\tVertex Colours not specified\n" );
-
- if( p->vnormals )
- {
- fprintf( stdout, "\n\t\tVertex Normals : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vnormals[i].xyz[0],
- p->vnormals[i].xyz[1],
- p->vnormals[i].xyz[2] );
- }
- else
- fprintf( stdout, "\n\t\tVertex Normals not specified\n" );
-
- if (p->vtexturecoord)
- {
- fprintf(stdout, "\n\t\tTexture Coordinates : ");
- for (i=0; i<p->num_vertices; i++)
- fprintf(stdout, "\n\t\t v[%d] = %g %g", i,
- p->vtexturecoord[i].xy[0],
- p->vtexturecoord[i].xy[1]);
- }
- else
- fprintf( stdout, "\n\t\tTexture Coordinates not specified\n");
-
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-PolygonIndicesInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i, j;
- tel_indexpoly_data d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
- Tchar *cur_ptr = 0;
-
- d = (tel_indexpoly_data)data.pdata;
-
- if( d->edge_vis )
- size_reqd += ( d->edge_count * sizeof( Tint ) );
-
- size_reqd += ( d->num_bounds * sizeof( Tint ) ); /* bounds */
- size_reqd += ( d->edge_count * sizeof( Tint ) ); /* connectivity */
-
- if( d->fcolours )
- size_reqd += ( d->num_bounds * sizeof( TEL_COLOUR ) );
-
- if( d->facet_flag == TEL_FA_NORMAL )
- size_reqd += ( d->num_bounds * sizeof( TEL_POINT ) );
-
- size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- if( d->vcolours )
- size_reqd += ( d->num_vertices * sizeof( TEL_COLOUR ) );
-
- if( d->vertex_flag == TEL_VT_NORMAL )
- size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- cur_ptr = c->buf;
- w->indexedpolygons3data.shpflag = d->shape_flag;
- w->indexedpolygons3data.num_bounds = d->num_bounds;
- w->indexedpolygons3data.num_vertices = d->num_vertices;
- if( d->edge_vis )
- w->indexedpolygons3data.edgflag = TOn;
- else
- w->indexedpolygons3data.edgflag = TOff;
-
- if( c->size >= size_reqd )
- {
- if( d->facet_flag == TEL_FA_NORMAL )
- {
- if( d->fcolours )
- {
- w->indexedpolygons3data.fctflag = TEL_FAFLAG_COLOURNORMAL;
- w->indexedpolygons3data.gnormals = (tel_point)(c->buf);
- for( j = 0; j < d->num_bounds; j++ )
- {
- w->indexedpolygons3data.gnormals[j] = d->fnormals[j];
- }
- cur_ptr += ( d->num_bounds * sizeof( TEL_POINT ) );
-
- w->indexedpolygons3data.facet_colour_vals =
- (tel_colour)(cur_ptr);
- for( j = 0; j < d->num_bounds; j++ )
- {
- w->indexedpolygons3data.facet_colour_vals[j] =
- d->fcolours[j];
- }
- cur_ptr += ( d->num_bounds * sizeof( TEL_COLOUR ) );
- }
- else
- {
- w->indexedpolygons3data.fctflag = TEL_FAFLAG_NORMAL;
- w->indexedpolygons3data.facet_colour_vals = 0;
- w->indexedpolygons3data.gnormals = (tel_point)(c->buf);
- for( j = 0; j < d->num_bounds; j++ )
- {
- w->indexedpolygons3data.gnormals[j] = d->fnormals[j];
- }
- cur_ptr += ( d->num_bounds * sizeof( TEL_POINT ) );
- }
- }
- else
- {
- w->indexedpolygons3data.gnormals = 0;
- if( d->fcolours )
- {
- w->indexedpolygons3data.fctflag = TEL_FAFLAG_COLOUR;
- w->indexedpolygons3data.facet_colour_vals =
- (tel_colour)(c->buf );
- for( j = 0; j < d->num_bounds; j++ )
- {
- w->indexedpolygons3data.facet_colour_vals[j] =
- d->fcolours[j];
- }
- cur_ptr += ( d->num_bounds * sizeof( TEL_COLOUR ) );
- }
- else
- {
- w->indexedpolygons3data.fctflag = TEL_FAFLAG_NONE;
- w->indexedpolygons3data.facet_colour_vals = 0;
- }
- }
-
- if( d->edge_vis )
- {
- w->indexedpolygons3data.edgvis = (Tint *)(cur_ptr);
- // cmn_memcpy<Tint>( w->indexedpolygons3data.edgvis,
- // d->edge_vis,
- // d->edge_count );
- memcpy( w->indexedpolygons3data.edgvis, d->edge_vis, d->edge_count*sizeof(Tint) );
- cur_ptr += (d->edge_count * sizeof( Tint ) );
- }
-
- w->indexedpolygons3data.points = (tel_point)cur_ptr;
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->indexedpolygons3data.points[j] = d->vertices[j];
- }
- cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- w->indexedpolygons3data.bounds = (Tint *)cur_ptr;
- // cmn_memcpy<Tint>( w->indexedpolygons3data.bounds,
- // d->bounds,
- // d->num_bounds );
- memcpy( w->indexedpolygons3data.bounds, d->bounds, d->num_bounds*sizeof(Tint) );
- cur_ptr += ( d->num_bounds * sizeof( Tint ) );
-
- w->indexedpolygons3data.indices = (Tint *)cur_ptr;
- // cmn_memcpy<Tint>( w->indexedpolygons3data.indices,
- // d->indices,
- // d->edge_count );
- memcpy( w->indexedpolygons3data.indices, d->indices, d->edge_count*sizeof(Tint) );
- cur_ptr += ( d->edge_count * sizeof( Tint ) );
-
- if( d->vertex_flag == TEL_VT_NORMAL )
- {
- if( d->vcolours )
- {
- w->indexedpolygons3data.vrtflag = TEL_VTFLAG_COLOURNORMAL;
- w->indexedpolygons3data.vnormals = (tel_point)(cur_ptr);
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->indexedpolygons3data.vnormals[j] = d->vnormals[i];
- }
- cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- w->indexedpolygons3data.colours = (tel_colour)(cur_ptr);
-
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->indexedpolygons3data.colours[j] = d->vcolours[i];
- }
- }
- else
- {
- w->indexedpolygons3data.vrtflag = TEL_VTFLAG_NORMAL;
- w->indexedpolygons3data.colours = 0;
- w->indexedpolygons3data.vnormals = (tel_point)(cur_ptr);
-
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->indexedpolygons3data.vnormals[j] = d->vnormals[i];
- }
- }
- }
- else
- {
- w->indexedpolygons3data.vnormals = 0;
- if( d->vcolours )
- {
- w->indexedpolygons3data.vrtflag = TEL_VTFLAG_COLOUR;
- w->indexedpolygons3data.colours = (tel_colour)(cur_ptr);
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->indexedpolygons3data.colours[j] = d->vcolours[i];
- }
- }
- else
- {
- w->indexedpolygons3data.vrtflag = TEL_VTFLAG_NONE;
- w->indexedpolygons3data.colours = 0;
- }
- }
-
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
-
-/*----------------------------------------------------------------------*/
-
-static void
-#ifdef G003
-draw_edges ( tel_indexpoly_data p, tel_colour edge_colour,
- Tint interior_style, Tint forceDraw )
-#else
-draw_edges( tel_indexpoly_data p, tel_colour edge_colour, Tint interior_style )
-#endif
-{
- CMN_KEY k, k1, k2, k3, k4;
- Tint *ind, *vis;
- Tint i, j, a, newList = 0;
- Tint edge_type, line_type_preserve;
- Tfloat edge_width, line_width_preserve;
- GLboolean texture_on;
-
- tel_point pv;
-
-#ifdef G003
- if ( interior_style != TSM_HIDDENLINE && !forceDraw )
-#else
- if (interior_style != TSM_HIDDENLINE)
-#endif
- {
- k.id = TelEdgeFlag;
- TsmGetAttri( 1, &k );
- if( k.data.ldata == TOff )return;
- }
-
- pv = p->vertices;
- ind = p->indices;
- vis = p->edge_vis;
-
- LightOff();
- texture_on = IsTextureEnabled();
- if (texture_on) DisableTexture();
-
- k1.id = TelPolylineWidth;
- k2.id = TelPolylineType;
- k3.id = TelEdgeType;
- k4.id = TelEdgeWidth;
-
- TsmGetAttri( 4, &k1, &k2, &k3, &k4 );
-
- line_width_preserve = k1.data.fdata;
- line_type_preserve = k2.data.ldata;
- edge_type = k3.data.ldata;
- edge_width = k4.data.fdata;
-
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
-
-#ifdef G003
- if ( !forceDraw ) {
-
- glColor3fv ( edge_colour -> rgb );
- glPushAttrib ( GL_POLYGON_BIT );
- glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE );
-
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
-
- a = j + p -> bounds[ i ];
-
- glBegin ( GL_POLYGON );
-
- for ( ; j < a; ++j ) {
-
- glEdgeFlag ( ( GLboolean )( vis[ j ] == 1 ? GL_TRUE : GL_FALSE ) );
- glVertex3fv ( pv[ ind[ j ] ].xyz );
-
- } /* end for */
-
- glEnd();
-
- glEdgeFlag ( GL_TRUE );
-
- } /* end for */
-
- glPopAttrib ();
-
- } else {
-
-#ifdef BUC60876
- if ( !g_fAnimation )
- goto doDraw; /* Disable object display list out of animation */
-#endif
-#ifdef G004
- if ( g_fBitmap )
- goto doDraw;
-#endif /* G004 */
-
- if ( p -> d.degMode != 2 || p -> d.skipRatio != g_fSkipRatio || !p -> d.dlist ) {
-
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
-
- p -> d.degMode = 2;
- p -> d.skipRatio = g_fSkipRatio;
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-
-doDraw:
- glPushAttrib ( GL_POLYGON_BIT | GL_DEPTH_BUFFER_BIT );
-
- glEdgeFlag ( GL_TRUE );
- glDisable ( GL_DEPTH_TEST );
- glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE );
-
- if ( g_fSkipRatio == 0.0F )
-
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
-
- a = j + p -> bounds[ i ];
-
- glBegin ( GL_POLYGON );
-
- for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
-
- glEnd();
-
- } /* end for */
-
- else if ( g_fSkipRatio != 1.0F ) {
-
- set_drawable_items ( p -> d.bDraw, p -> num_bounds );
-
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
-
- a = j + p -> bounds[ i ];
-
- if ( p -> d.bDraw[ i ] ) {
-
- glBegin ( GL_POLYGON );
-
- for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz );
-
- glEnd();
-
- } else j = a;
-
- } /* end for */
-
- } /* end if */
-
- glPopAttrib ();
- if ( newList ) glEndList ();
-
- } else glCallList ( p -> d.dlist );
-
- } /* end else */
-#else
- glColor3fv( edge_colour->rgb );
- glPushAttrib(GL_POLYGON_BIT);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- for( i = 0, j = 0, a = 0; i < p->num_bounds; i++ )
- {
- a = j + p->bounds[i];
- glBegin(GL_POLYGON);
- for( ; j < a; j++ )
- {
- if( vis[j] == 1) glEdgeFlag( GL_TRUE );
- else glEdgeFlag( GL_FALSE );
- glVertex3fv( pv[ ind[j] ].xyz );
- }
- glEnd();
- glEdgeFlag(GL_TRUE);
- }
-
- glPopAttrib();
-#endif /* G003 */
-
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
- }
- if (texture_on) EnableTexture();
-}
-/*----------------------------------------------------------------------*/
-#ifdef G003
-static void draw_degenerates_as_points ( tel_indexpoly_data p ) {
-
- Tint* ind, *vis;
- Tint i, j, n, a, newList = 0;
- GLfloat pt[ 3 ];
- tel_point pv;
-
- pv = p -> vertices;
- ind = p -> indices;
- vis = p -> edge_vis;
-
- LightOff ();
-
-#ifdef G004
- if ( g_fBitmap ) goto doDraw;
-#endif /* G004 */
-
- if ( p -> d.degMode != 3 || p -> d.skipRatio != g_fSkipRatio || !p -> d.dlist ) {
-
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
-
- p -> d.degMode = 3;
- p -> d.skipRatio = g_fSkipRatio;
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-doDraw:
- if ( g_fSkipRatio == 0.0F ) {
-
- glBegin ( GL_POINTS );
-
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
-
- n = p -> bounds[ i ];
- a = j + n;
-
- for ( pt [ 0 ] = pt[ 1 ] = pt[ 2 ] = 0.; j < a; ++j ) {
-
- pt[ 0 ] += pv[ ind[ j ] ].xyz[ 0 ];
- pt[ 1 ] += pv[ ind[ j ] ].xyz[ 1 ];
- pt[ 2 ] += pv[ ind[ j ] ].xyz[ 2 ];
-
- } /* end for ( j ) */
-
- pt[ 0 ] /= n;
- pt[ 1 ] /= n;
- pt[ 2 ] /= n;
-
- glVertex3fv ( pt );
-
- } /* end for ( i ) */
-
- glEnd ();
-
- } else if ( g_fSkipRatio != 1.0 ) {
-
- set_drawable_items ( p -> d.bDraw, p -> num_bounds );
-
- glBegin ( GL_POINTS );
-
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
-
- n = p -> bounds[ i ];
- a = j + n;
-
- if ( p -> d.bDraw[ i ] ) {
-
- for ( pt [ 0 ] = pt[ 1 ] = pt[ 2 ] = 0.; j < a; ++j ) {
-
- pt[ 0 ] += pv[ ind[ j ] ].xyz[ 0 ];
- pt[ 1 ] += pv[ ind[ j ] ].xyz[ 1 ];
- pt[ 2 ] += pv[ ind[ j ] ].xyz[ 2 ];
-
- } /* end for ( j ) */
-
- pt[ 0 ] /= n;
- pt[ 1 ] /= n;
- pt[ 2 ] /= n;
-
- glVertex3fv ( pt );
-
- } else j = a;
-
- } /* end for ( i ) */
-
- glEnd ();
-
- } /* end if */
-
-#ifdef G004
- if ( !g_fBitmap )
-#endif /* G004 */
- glEndList ();
-
- } else glCallList ( p -> d.dlist );
-
-} /* end draw_degenerates_as_points */
-
-static void draw_degenerates_as_bboxs ( tel_indexpoly_data p ) {
-
- Tint* ind, *vis;
- Tint i, j, n, a, newList = 0;
- GLfloat minp[ 3 ] = { FLT_MAX, FLT_MAX, FLT_MAX };
- GLfloat maxp[ 3 ] = { FLT_MIN, FLT_MIN, FLT_MIN };
- tel_point pv;
-
- pv = p -> vertices;
- ind = p -> indices;
- vis = p -> edge_vis;
-
- LightOff ();
-
-#ifdef G004
- if ( g_fBitmap ) goto doDraw;
-#endif /* G004 */
-
- if ( p -> d.degMode != 4 || !p -> d.dlist ) {
-
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
-
- p -> d.degMode = 4;
-
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-doDraw:
- for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) {
-
- n = p -> bounds[ i ];
- a = j + n;
-
- for ( ; j < a; ++j ) {
-
- if ( pv[ ind[ j ] ].xyz[ 0 ] < minp[ 0 ] )
- minp[ 0 ] = pv[ ind[ j ] ].xyz[ 0 ] ;
- if ( pv[ ind[ j ] ].xyz[ 1 ] < minp[ 1 ] )
- minp[ 1 ] = pv[ ind[ j ] ].xyz[ 1 ] ;
- if ( pv[ ind[ j ] ].xyz[ 2 ] < minp[ 2 ] )
- minp[ 2 ] = pv[ ind[ j ] ].xyz[ 2 ] ;
-
- if ( pv[ ind[ j ] ].xyz[ 0 ] > maxp[ 0 ] )
- maxp[ 0 ] = pv[ ind[ j ] ].xyz[ 0 ] ;
- if ( pv[ ind[ j ] ].xyz[ 1 ] > maxp[ 1 ] )
- maxp[ 1 ] = pv[ ind[ j ] ].xyz[ 1 ] ;
- if ( pv[ ind[ j ] ].xyz[ 2 ] > maxp[ 2 ] )
- maxp[ 2 ] = pv[ ind[ j ] ].xyz[ 2 ] ;
-
- } /* end for ( j ) */
-
- } /* end for ( i ) */
-
- /* OCC11904 -- Temporarily disable environment mapping */
- glPushAttrib(GL_ENABLE_BIT);
- glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
-
- glBegin ( GL_LINE_STRIP );
-
- glVertex3fv ( minp );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], minp[ 1 ], minp[ 2 ] );
-
- glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] );
- glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] );
- glVertex3f ( maxp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
- glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] );
-
- glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
- glVertex3fv ( maxp );
- glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] );
-
- glEnd();
- glPopAttrib();
-#ifdef G004
- if ( !g_fBitmap )
-#endif /* G004 */
- glEndList ();
-
- } else glCallList ( p -> d.dlist );
-
-} /* end draw_degenerates_as_bboxs */
-#endif /* G003 */
-
-void set_drawable_items ( GLboolean* pbDraw, int n ) {
-
- int i;
-
- memset ( pbDraw, 0, sizeof ( GLboolean ) * n );
-
- i = ( int )( ( 1.0F - g_fSkipRatio ) * n );
-
- while ( i-- ) pbDraw[ OPENGL_RAND() % n ] = 1;
-
-} /* end set_drawable_items */
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_initelem :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-01-04-96 : CAL ; Integration MINSK portage WNT
-25-06-96 : FMN ; Suppression utilisation de glScissor.
-03-07-96 : FMN ; Suppression definition des materiaux (InitMaterial).
-08-07-96 : BGN ; (PRO4768)les dessins des markers echelle 1 sont
-grossis (on reprend les bitmaps de l'echelle 2)
-=> creation des markers des echelles 6.5 et 7;
-creation des bitmaps du marker point par cercles
-pleins (=> meilleur affichage et suppression du
-cas particulier).
-17-07-96 : FMN ; Suppression utilisation de HLHSRMode.
-InitMaterial, InitLM sont inutilisees
-05-12-96 : FMN ; PRO6327: Pas defaut on met la lumiere
-GL_LIGHT_MODEL_TWO_SIDE a True.
-13-02-97 : FMN ; Suppression variables inutiles
-15-02-97 : FMN ; Suppression OpenGl_gl_compat.h
-15-02-97 : FMN ; Ajout glHint pour le fog et l'antialiasing
-11-04-97 : FMN ; Ajout glPolygonOffsetEXT
-30-06-97 : FMN ; Les init generales par contexte sont faites dans OpenGl_subrvis.
-05-08-07 : PCT ; ajout support texture mapping
-23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
-et TelBackInteriorShadingMethod
-30-11-98 : FMN ; S3819 : Textes toujours visibles
-26-10-99 : VTN ; BUC60599 : Enable to have contiguous horizontal or
-vertical hatching.
-16-06-2000 : ATS : G005 : Init functions for PARRAY and DARRAY primitives
-22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets
-
-************************************************************************/
-
-#define G003 /* EUG 06-10-99 Degeneration mode support
-*/
-
-#define G005
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <GL/gl.h>
-#include <stdio.h>
-
-#include <OpenGl_telem.hxx>
-#include <OpenGl_tsm.hxx>
-
-//#include <OpenGl_cmn_memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define DOT_LS 0xCCCC
-#define DASH_DOT_LS 0xFF18
-#define DASH_LS 0xFFC0
-#define DASH_DDOT_LS 0xFF24
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes
-*/
-
-static void InitPMFont(void);
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-GLuint linestyleBase;
-GLuint patternBase;
-GLuint markerBase;
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes des fonctions appele par TsmSendMessage()
-*/
-
-extern MtblPtr TelLabelInitClass( TelType* );
-extern MtblPtr TelPolylineInitClass( TelType* );
-extern MtblPtr TelPolylineColourInitClass( TelType* );
-extern MtblPtr TelPolylineWidthInitClass( TelType* );
-extern MtblPtr TelExecuteStructureInitClass( TelType* );
-extern MtblPtr TelPickIdInitClass( TelType* );
-extern MtblPtr TelPolylineTypeInitClass( TelType* );
-extern MtblPtr TelEdgeColourInitClass( TelType* );
-extern MtblPtr TelEdgeTypeInitClass( TelType* );
-extern MtblPtr TelEdgeWidthInitClass( TelType* );
-extern MtblPtr TelAntiAliasingInitClass( TelType* );
-extern MtblPtr TelPolygonInitClass( TelType* );
-extern MtblPtr TelInteriorColourInitClass( TelType* );
-extern MtblPtr TelInteriorStyleInitClass( TelType* );
-extern MtblPtr TelEdgeFlagInitClass( TelType* );
-extern MtblPtr TelPolymarkerColourInitClass( TelType* );
-extern MtblPtr TelPolymarkerSizeInitClass( TelType* );
-extern MtblPtr TelMarkerInitClass( TelType* );
-extern MtblPtr TelMarkerSetInitClass( TelType* );
-extern MtblPtr TelLocalTran3InitClass( TelType* );
-extern MtblPtr TelAddNamesetInitClass( TelType* );
-extern MtblPtr TelRemoveNamesetInitClass( TelType* );
-extern MtblPtr TelBackInteriorColourInitClass( TelType* );
-extern MtblPtr TelInteriorStyleIndexInitClass( TelType* );
-extern MtblPtr TelFaceDistinguishingModeInitClass( TelType* );
-extern MtblPtr TelTextColourInitClass( TelType* );
-extern MtblPtr TelTextInitClass( TelType* );
-extern MtblPtr TelTextColourSubTitleInitClass( TelType* );
-extern MtblPtr TelTextStyleInitClass( TelType* );
-extern MtblPtr TelTextDisplayTypeInitClass( TelType* );
-extern MtblPtr TelTextFontInitClass( TelType* );
-extern MtblPtr TelTextHeightInitClass( TelType* );
-/*OCC7456 abd 14.12.2004 Text alingnment attributes */
-extern MtblPtr TelTextAlignInitClass( TelType* );
-/*OCC7456 abd 14.12.2004 Text alingnment attributes */
-extern MtblPtr TelCharacterSpacingInitClass( TelType* );
-extern MtblPtr TelCharacterExpansionFactorInitClass( TelType* );
-extern MtblPtr TelPolymarkerTypeInitClass( TelType* );
-extern MtblPtr TelLightSrcStateInitClass( TelType* );
-extern MtblPtr TelInteriorReflectanceEquationInitClass( TelType* );
-extern MtblPtr TelBackInteriorReflectanceEquationInitClass( TelType* );
-extern MtblPtr TelSurfaceAreaPropertiesInitClass( TelType* );
-extern MtblPtr TelBackSurfaceAreaPropertiesInitClass( TelType* );
-extern MtblPtr TelFaceCullingModeInitClass( TelType* );
-extern MtblPtr TelDepthCueIndexInitClass( TelType* );
-extern MtblPtr TelInteriorShadingMethodInitClass( TelType* );
-extern MtblPtr TelViewIndexInitClass( TelType* );
-extern MtblPtr TelTriangleMeshInitClass( TelType* );
-extern MtblPtr TelApplicationDataInitClass( TelType* );
-extern MtblPtr TelQuadrangleInitClass( TelType* );
-extern MtblPtr TelPolygonIndicesInitClass( TelType* );
-extern MtblPtr TelHighlightIndexInitClass( TelType* );
-extern MtblPtr TelPolygonHolesInitClass( TelType* );
-extern MtblPtr TelCurveInitClass( TelType* );
-extern MtblPtr TelTextureIdInitClass( TelType* );
-extern MtblPtr TelDoTextureMapInitClass( TelType* );
-/*
-extern MtblPtr TelNilInitClass( TelType* );
-extern MtblPtr TelBlinkInitClass( TelType* );
-extern MtblPtr TelPolygonSetInitClass( TelType* );
-extern MtblPtr TelClippingPlaneInitClass( TelType* );
-*/
-#ifdef G003
-extern MtblPtr TelDegenerateModelInitClass( TelType* );
-#endif /* G003 */
-extern MtblPtr TelTextZoomableInitClass( TelType* );
-
-extern MtblPtr TelTextAngleInitClass( TelType* );
-
-extern MtblPtr TelTextFontAspectInitClass( TelType* );
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-extern MtblPtr TelPolygonOffsetInitClass( TelType* );
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-extern MtblPtr TelTransformPersistentInitClass( TelType* );
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
-extern MtblPtr TelParrayInitClass( TelType* );
-/* OCC???? SZV 11/08/05 Implementation of callbacks */
-extern MtblPtr TelUserdrawInitClass( TelType* );
-/* OCC???? SZV 11/08/05 Implementation of callbacks */
-
-static MtblPtr (*TsmInitClassTable[])(TelType*) =
-{
- TelLabelInitClass,
- TelExecuteStructureInitClass,
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- TelTransformPersistentInitClass,
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- TelPolylineColourInitClass,
- TelPolylineWidthInitClass,
- TelPolylineInitClass,
- TelPickIdInitClass,
- TelPolylineTypeInitClass,
- TelEdgeColourInitClass,
- TelEdgeTypeInitClass,
- TelEdgeWidthInitClass,
- TelAntiAliasingInitClass,
- TelPolygonInitClass,
- TelInteriorColourInitClass,
- TelInteriorStyleInitClass,
- TelEdgeFlagInitClass,
- TelPolymarkerColourInitClass,
- TelPolymarkerSizeInitClass,
- TelMarkerInitClass,
- TelMarkerSetInitClass,
- TelLocalTran3InitClass,
- TelAddNamesetInitClass,
- TelRemoveNamesetInitClass,
- TelBackInteriorColourInitClass,
- TelInteriorStyleIndexInitClass,
- TelFaceDistinguishingModeInitClass,
- TelTextColourInitClass,
- TelTextInitClass,
- TelTextFontInitClass,
- TelTextHeightInitClass,
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- TelTextAlignInitClass,
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- TelCharacterSpacingInitClass,
- TelCharacterExpansionFactorInitClass,
- TelPolymarkerTypeInitClass,
- TelInteriorReflectanceEquationInitClass,
- TelBackInteriorReflectanceEquationInitClass,
- TelLightSrcStateInitClass,
- TelSurfaceAreaPropertiesInitClass,
- TelBackSurfaceAreaPropertiesInitClass,
- TelFaceCullingModeInitClass,
- TelDepthCueIndexInitClass,
- TelInteriorShadingMethodInitClass,
- TelViewIndexInitClass,
- TelTriangleMeshInitClass,
- TelApplicationDataInitClass,
- TelQuadrangleInitClass,
- TelPolygonIndicesInitClass,
- TelHighlightIndexInitClass,
- TelPolygonHolesInitClass,
- TelCurveInitClass,
- TelTextureIdInitClass,
- TelDoTextureMapInitClass,
- TelTextColourSubTitleInitClass,
- TelTextStyleInitClass,
- TelTextDisplayTypeInitClass
-#ifdef G003
- , TelDegenerateModelInitClass
-#endif /* G003 */
-#ifdef G005
- , TelParrayInitClass
-#endif /* G005 */
- , TelTextZoomableInitClass
- , TelTextAngleInitClass
- , TelTextFontAspectInitClass
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- , TelPolygonOffsetInitClass
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- /* OCC???? SZV 11/08/05 Implementation of callbacks */
- , TelUserdrawInitClass
- /* OCC???? SZV 11/08/05 Implementation of callbacks */
-};
-
-#define ClassTableSize sizeof(TsmInitClassTable)/sizeof(TStatus (*)())
-
-
-/*----------------------------------------------------------------------*/
-
-void
-TelHookOnAllClasses(void)
-{
- TsmInitAllClasses( TsmInitClassTable, ClassTableSize );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-TsmInitAttributes()
-{
- unsigned int interiors[TEL_HS_USER_DEF_START][32];
- Tint i;
- /* static int nombre;*/
-
- linestyleBase = glGenLists(5);
-
- /* Line */
-
- glNewList( linestyleBase+TEL_LS_DOT, GL_COMPILE);
- glLineStipple(1, DOT_LS );
- glEndList();
-
- glNewList( linestyleBase+TEL_LS_DASH_DOT, GL_COMPILE);
- glLineStipple(1, DASH_DOT_LS );
- glEndList();
-
- glNewList( linestyleBase+TEL_LS_DASH, GL_COMPILE);
- glLineStipple(1, DASH_LS );
- glEndList();
-
- glNewList( linestyleBase+TEL_LS_DOUBLE_DOT_DASH, GL_COMPILE);
- glLineStipple(1, DASH_DDOT_LS );
- glEndList();
-
- /* FSXXX
- * GL_POLYGON_STIPPLE
- * need 32x32 stipple patterns
- */
- memset( interiors, 0xFF, sizeof(interiors) );
-
-
- /* modified by NIZHNY-VTN Tue Oct 26 09:54:20 1999 ___BEGIN___ */
- interiors[TEL_HS_CROSS][1] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][2] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][3] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][4] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][5] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][6] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][7] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][8] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][9] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][10] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][11] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][12] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][13] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][14] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][15] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][16] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][17] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][18] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][19] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][20] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][21] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][22] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][23] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][24] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][25] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][26] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][27] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][28] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][29] = 0xBBBBBBBB,
- interiors[TEL_HS_CROSS][30] = 0xEEEEEEEE,
- interiors[TEL_HS_CROSS][31] = 0xBBBBBBBB;
-
- interiors[TEL_HS_CROSS_SPARSE][0] = 0x81818181,
- interiors[TEL_HS_CROSS_SPARSE][1] = 0x24242424,
- interiors[TEL_HS_CROSS_SPARSE][2] = 0x18181818,
- interiors[TEL_HS_CROSS_SPARSE][3] = 0x42424242,
- interiors[TEL_HS_CROSS_SPARSE][4] = 0x81818181,
- interiors[TEL_HS_CROSS_SPARSE][5] = 0x24242424,
- interiors[TEL_HS_CROSS_SPARSE][6] = 0x18181818,
- interiors[TEL_HS_CROSS_SPARSE][7] = 0x42424242,
- interiors[TEL_HS_CROSS_SPARSE][8] = 0x81818181,
- interiors[TEL_HS_CROSS_SPARSE][9] = 0x24242424,
- interiors[TEL_HS_CROSS_SPARSE][10] = 0x18181818,
- interiors[TEL_HS_CROSS_SPARSE][11] = 0x42424242,
- interiors[TEL_HS_CROSS_SPARSE][12] = 0x81818181,
- interiors[TEL_HS_CROSS_SPARSE][13] = 0x24242424,
- interiors[TEL_HS_CROSS_SPARSE][14] = 0x18181818,
- interiors[TEL_HS_CROSS_SPARSE][15] = 0x42424242,
- interiors[TEL_HS_CROSS_SPARSE][16] = 0x81818181,
- interiors[TEL_HS_CROSS_SPARSE][17] = 0x24242424,
- interiors[TEL_HS_CROSS_SPARSE][18] = 0x18181818,
- interiors[TEL_HS_CROSS_SPARSE][19] = 0x42424242,
- interiors[TEL_HS_CROSS_SPARSE][20] = 0x81818181,
- interiors[TEL_HS_CROSS_SPARSE][21] = 0x24242424,
- interiors[TEL_HS_CROSS_SPARSE][22] = 0x18181818,
- interiors[TEL_HS_CROSS_SPARSE][23] = 0x42424242,
- interiors[TEL_HS_CROSS_SPARSE][24] = 0x81818181,
- interiors[TEL_HS_CROSS_SPARSE][25] = 0x24242424,
- interiors[TEL_HS_CROSS_SPARSE][26] = 0x18181818,
- interiors[TEL_HS_CROSS_SPARSE][27] = 0x42424242,
- interiors[TEL_HS_CROSS_SPARSE][28] = 0x81818181,
- interiors[TEL_HS_CROSS_SPARSE][29] = 0x24242424,
- interiors[TEL_HS_CROSS_SPARSE][30] = 0x18181818,
- interiors[TEL_HS_CROSS_SPARSE][31] = 0x42424242;
-
-
- interiors[TEL_HS_GRID][0] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][1] = 0x88888888,
- interiors[TEL_HS_GRID][2] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][3] = 0x88888888,
- interiors[TEL_HS_GRID][4] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][5] = 0x88888888,
- interiors[TEL_HS_GRID][6] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][7] = 0x88888888,
- interiors[TEL_HS_GRID][8] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][9] = 0x88888888,
- interiors[TEL_HS_GRID][10] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][11] = 0x88888888,
- interiors[TEL_HS_GRID][12] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][13] = 0x88888888,
- interiors[TEL_HS_GRID][14] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][15] = 0x88888888,
- interiors[TEL_HS_GRID][16] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][17] = 0x88888888,
- interiors[TEL_HS_GRID][18] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][19] = 0x88888888,
- interiors[TEL_HS_GRID][20] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][21] = 0x88888888,
- interiors[TEL_HS_GRID][22] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][23] = 0x88888888,
- interiors[TEL_HS_GRID][24] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][25] = 0x88888888,
- interiors[TEL_HS_GRID][26] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][27] = 0x88888888,
- interiors[TEL_HS_GRID][28] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][29] = 0x88888888,
- interiors[TEL_HS_GRID][30] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID][31] = 0x88888888;
-
- interiors[TEL_HS_GRID_SPARSE][0] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID_SPARSE][1] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][2] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][3] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][4] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID_SPARSE][5] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][6] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][7] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][8] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID_SPARSE][9] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][10] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][11] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][12] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID_SPARSE][13] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][14] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][15] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][16] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID_SPARSE][17] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][18] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][19] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][20] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID_SPARSE][21] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][22] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][23] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][24] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID_SPARSE][25] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][26] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][27] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][28] = 0xFFFFFFFF,
- interiors[TEL_HS_GRID_SPARSE][29] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][30] = 0x80808080,
- interiors[TEL_HS_GRID_SPARSE][31] = 0x80808080;
-
- interiors[TEL_HS_DIAG_45][0] = 0x88888888,
- interiors[TEL_HS_DIAG_45][1] = 0x22222222,
- interiors[TEL_HS_DIAG_45][2] = 0x88888888,
- interiors[TEL_HS_DIAG_45][3] = 0x22222222,
- interiors[TEL_HS_DIAG_45][4] = 0x88888888,
- interiors[TEL_HS_DIAG_45][5] = 0x22222222,
- interiors[TEL_HS_DIAG_45][6] = 0x88888888,
- interiors[TEL_HS_DIAG_45][7] = 0x22222222,
- interiors[TEL_HS_DIAG_45][8] = 0x88888888,
- interiors[TEL_HS_DIAG_45][9] = 0x22222222,
- interiors[TEL_HS_DIAG_45][10] = 0x88888888,
- interiors[TEL_HS_DIAG_45][11] = 0x22222222,
- interiors[TEL_HS_DIAG_45][12] = 0x88888888,
- interiors[TEL_HS_DIAG_45][13] = 0x22222222,
- interiors[TEL_HS_DIAG_45][14] = 0x88888888,
- interiors[TEL_HS_DIAG_45][15] = 0x22222222,
- interiors[TEL_HS_DIAG_45][16] = 0x88888888,
- interiors[TEL_HS_DIAG_45][17] = 0x22222222,
- interiors[TEL_HS_DIAG_45][18] = 0x88888888,
- interiors[TEL_HS_DIAG_45][19] = 0x22222222,
- interiors[TEL_HS_DIAG_45][20] = 0x88888888,
- interiors[TEL_HS_DIAG_45][21] = 0x22222222,
- interiors[TEL_HS_DIAG_45][22] = 0x88888888,
- interiors[TEL_HS_DIAG_45][23] = 0x22222222,
- interiors[TEL_HS_DIAG_45][24] = 0x88888888,
- interiors[TEL_HS_DIAG_45][25] = 0x22222222,
- interiors[TEL_HS_DIAG_45][26] = 0x88888888,
- interiors[TEL_HS_DIAG_45][27] = 0x22222222,
- interiors[TEL_HS_DIAG_45][28] = 0x88888888,
- interiors[TEL_HS_DIAG_45][29] = 0x22222222,
- interiors[TEL_HS_DIAG_45][30] = 0x88888888,
- interiors[TEL_HS_DIAG_45][31] = 0x22222222;
-
- interiors[TEL_HS_DIAG_135][0] = 0x11111111,
- interiors[TEL_HS_DIAG_135][1] = 0x44444444,
- interiors[TEL_HS_DIAG_135][2] = 0x11111111,
- interiors[TEL_HS_DIAG_135][3] = 0x44444444,
- interiors[TEL_HS_DIAG_135][4] = 0x11111111,
- interiors[TEL_HS_DIAG_135][5] = 0x44444444,
- interiors[TEL_HS_DIAG_135][6] = 0x11111111,
- interiors[TEL_HS_DIAG_135][7] = 0x44444444,
- interiors[TEL_HS_DIAG_135][8] = 0x11111111,
- interiors[TEL_HS_DIAG_135][9] = 0x44444444,
- interiors[TEL_HS_DIAG_135][10] = 0x11111111,
- interiors[TEL_HS_DIAG_135][11] = 0x44444444,
- interiors[TEL_HS_DIAG_135][12] = 0x11111111,
- interiors[TEL_HS_DIAG_135][13] = 0x44444444,
- interiors[TEL_HS_DIAG_135][14] = 0x11111111,
- interiors[TEL_HS_DIAG_135][15] = 0x44444444,
- interiors[TEL_HS_DIAG_135][16] = 0x11111111,
- interiors[TEL_HS_DIAG_135][17] = 0x44444444,
- interiors[TEL_HS_DIAG_135][18] = 0x11111111,
- interiors[TEL_HS_DIAG_135][19] = 0x44444444,
- interiors[TEL_HS_DIAG_135][20] = 0x11111111,
- interiors[TEL_HS_DIAG_135][21] = 0x44444444,
- interiors[TEL_HS_DIAG_135][22] = 0x11111111,
- interiors[TEL_HS_DIAG_135][23] = 0x44444444,
- interiors[TEL_HS_DIAG_135][24] = 0x11111111,
- interiors[TEL_HS_DIAG_135][25] = 0x44444444,
- interiors[TEL_HS_DIAG_135][26] = 0x11111111,
- interiors[TEL_HS_DIAG_135][27] = 0x44444444,
- interiors[TEL_HS_DIAG_135][28] = 0x11111111,
- interiors[TEL_HS_DIAG_135][29] = 0x44444444,
- interiors[TEL_HS_DIAG_135][30] = 0x11111111,
- interiors[TEL_HS_DIAG_135][31] = 0x44444444;
-
- interiors[TEL_HS_HORIZONTAL][0] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][1] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][2] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][3] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][4] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][5] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][6] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][7] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][8] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][9] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][10] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][11] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][12] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][13] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][14] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][15] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][16] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][17] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][18] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][19] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][20] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][21] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][22] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][23] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][24] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][25] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][26] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][27] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][28] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][29] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL][30] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL][31] = 0x00000000;
-
- interiors[TEL_HS_VERTICAL][0] = 0x11111111,
- interiors[TEL_HS_VERTICAL][1] = 0x11111111,
- interiors[TEL_HS_VERTICAL][2] = 0x11111111,
- interiors[TEL_HS_VERTICAL][3] = 0x11111111,
- interiors[TEL_HS_VERTICAL][4] = 0x11111111,
- interiors[TEL_HS_VERTICAL][5] = 0x11111111,
- interiors[TEL_HS_VERTICAL][6] = 0x11111111,
- interiors[TEL_HS_VERTICAL][7] = 0x11111111,
- interiors[TEL_HS_VERTICAL][8] = 0x11111111,
- interiors[TEL_HS_VERTICAL][9] = 0x11111111,
- interiors[TEL_HS_VERTICAL][10] = 0x11111111,
- interiors[TEL_HS_VERTICAL][11] = 0x11111111,
- interiors[TEL_HS_VERTICAL][12] = 0x11111111,
- interiors[TEL_HS_VERTICAL][13] = 0x11111111,
- interiors[TEL_HS_VERTICAL][14] = 0x11111111,
- interiors[TEL_HS_VERTICAL][15] = 0x11111111,
- interiors[TEL_HS_VERTICAL][16] = 0x11111111,
- interiors[TEL_HS_VERTICAL][17] = 0x11111111,
- interiors[TEL_HS_VERTICAL][18] = 0x11111111,
- interiors[TEL_HS_VERTICAL][19] = 0x11111111,
- interiors[TEL_HS_VERTICAL][20] = 0x11111111,
- interiors[TEL_HS_VERTICAL][21] = 0x11111111,
- interiors[TEL_HS_VERTICAL][22] = 0x11111111,
- interiors[TEL_HS_VERTICAL][23] = 0x11111111,
- interiors[TEL_HS_VERTICAL][24] = 0x11111111,
- interiors[TEL_HS_VERTICAL][25] = 0x11111111,
- interiors[TEL_HS_VERTICAL][26] = 0x11111111,
- interiors[TEL_HS_VERTICAL][27] = 0x11111111,
- interiors[TEL_HS_VERTICAL][28] = 0x11111111,
- interiors[TEL_HS_VERTICAL][29] = 0x11111111,
- interiors[TEL_HS_VERTICAL][30] = 0x11111111,
- interiors[TEL_HS_VERTICAL][31] = 0x11111111;
-
- interiors[TEL_HS_DIAG_45_SPARSE][0] = 0x80808080,
- interiors[TEL_HS_DIAG_45_SPARSE][1] = 0x20202020,
- interiors[TEL_HS_DIAG_45_SPARSE][2] = 0x08080808,
- interiors[TEL_HS_DIAG_45_SPARSE][3] = 0x02020202,
- interiors[TEL_HS_DIAG_45_SPARSE][4] = 0x80808080,
- interiors[TEL_HS_DIAG_45_SPARSE][5] = 0x20202020,
- interiors[TEL_HS_DIAG_45_SPARSE][6] = 0x08080808,
- interiors[TEL_HS_DIAG_45_SPARSE][7] = 0x02020202,
- interiors[TEL_HS_DIAG_45_SPARSE][8] = 0x80808080,
- interiors[TEL_HS_DIAG_45_SPARSE][9] = 0x20202020,
- interiors[TEL_HS_DIAG_45_SPARSE][10] = 0x08080808,
- interiors[TEL_HS_DIAG_45_SPARSE][11] = 0x02020202,
- interiors[TEL_HS_DIAG_45_SPARSE][12] = 0x80808080,
- interiors[TEL_HS_DIAG_45_SPARSE][13] = 0x20202020,
- interiors[TEL_HS_DIAG_45_SPARSE][14] = 0x08080808,
- interiors[TEL_HS_DIAG_45_SPARSE][15] = 0x02020202,
- interiors[TEL_HS_DIAG_45_SPARSE][16] = 0x80808080,
- interiors[TEL_HS_DIAG_45_SPARSE][17] = 0x20202020,
- interiors[TEL_HS_DIAG_45_SPARSE][18] = 0x08080808,
- interiors[TEL_HS_DIAG_45_SPARSE][19] = 0x02020202,
- interiors[TEL_HS_DIAG_45_SPARSE][20] = 0x80808080,
- interiors[TEL_HS_DIAG_45_SPARSE][21] = 0x20202020,
- interiors[TEL_HS_DIAG_45_SPARSE][22] = 0x08080808,
- interiors[TEL_HS_DIAG_45_SPARSE][23] = 0x02020202,
- interiors[TEL_HS_DIAG_45_SPARSE][24] = 0x80808080,
- interiors[TEL_HS_DIAG_45_SPARSE][25] = 0x20202020,
- interiors[TEL_HS_DIAG_45_SPARSE][26] = 0x08080808,
- interiors[TEL_HS_DIAG_45_SPARSE][27] = 0x02020202,
- interiors[TEL_HS_DIAG_45_SPARSE][28] = 0x80808080,
- interiors[TEL_HS_DIAG_45_SPARSE][29] = 0x20202020,
- interiors[TEL_HS_DIAG_45_SPARSE][30] = 0x08080808,
- interiors[TEL_HS_DIAG_45_SPARSE][31] = 0x02020202;
-
- interiors[TEL_HS_DIAG_135_SPARSE][0] = 0x01010101,
- interiors[TEL_HS_DIAG_135_SPARSE][1] = 0x04040404,
- interiors[TEL_HS_DIAG_135_SPARSE][2] = 0x10101010,
- interiors[TEL_HS_DIAG_135_SPARSE][3] = 0x40404040,
- interiors[TEL_HS_DIAG_135_SPARSE][4] = 0x01010101,
- interiors[TEL_HS_DIAG_135_SPARSE][5] = 0x04040404,
- interiors[TEL_HS_DIAG_135_SPARSE][6] = 0x10101010,
- interiors[TEL_HS_DIAG_135_SPARSE][7] = 0x40404040,
- interiors[TEL_HS_DIAG_135_SPARSE][8] = 0x01010101,
- interiors[TEL_HS_DIAG_135_SPARSE][9] = 0x04040404,
- interiors[TEL_HS_DIAG_135_SPARSE][10] = 0x10101010,
- interiors[TEL_HS_DIAG_135_SPARSE][11] = 0x40404040,
- interiors[TEL_HS_DIAG_135_SPARSE][12] = 0x01010101,
- interiors[TEL_HS_DIAG_135_SPARSE][13] = 0x04040404,
- interiors[TEL_HS_DIAG_135_SPARSE][14] = 0x10101010,
- interiors[TEL_HS_DIAG_135_SPARSE][15] = 0x40404040,
- interiors[TEL_HS_DIAG_135_SPARSE][16] = 0x01010101,
- interiors[TEL_HS_DIAG_135_SPARSE][17] = 0x04040404,
- interiors[TEL_HS_DIAG_135_SPARSE][18] = 0x10101010,
- interiors[TEL_HS_DIAG_135_SPARSE][19] = 0x40404040,
- interiors[TEL_HS_DIAG_135_SPARSE][20] = 0x01010101,
- interiors[TEL_HS_DIAG_135_SPARSE][21] = 0x04040404,
- interiors[TEL_HS_DIAG_135_SPARSE][22] = 0x10101010,
- interiors[TEL_HS_DIAG_135_SPARSE][23] = 0x40404040,
- interiors[TEL_HS_DIAG_135_SPARSE][24] = 0x01010101,
- interiors[TEL_HS_DIAG_135_SPARSE][25] = 0x04040404,
- interiors[TEL_HS_DIAG_135_SPARSE][26] = 0x10101010,
- interiors[TEL_HS_DIAG_135_SPARSE][27] = 0x40404040,
- interiors[TEL_HS_DIAG_135_SPARSE][28] = 0x01010101,
- interiors[TEL_HS_DIAG_135_SPARSE][29] = 0x04040404,
- interiors[TEL_HS_DIAG_135_SPARSE][30] = 0x10101010,
- interiors[TEL_HS_DIAG_135_SPARSE][31] = 0x40404040;
-
- interiors[TEL_HS_HORIZONTAL_SPARSE][0] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL_SPARSE][1] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][2] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][3] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][4] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL_SPARSE][5] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][6] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][7] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][8] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL_SPARSE][9] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][10] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][11] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][12] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL_SPARSE][13] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][14] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][15] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][16] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL_SPARSE][17] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][18] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][19] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][20] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL_SPARSE][21] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][22] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][23] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][24] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL_SPARSE][25] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][26] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][27] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][28] = 0xFFFFFFFF,
- interiors[TEL_HS_HORIZONTAL_SPARSE][29] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][30] = 0x00000000,
- interiors[TEL_HS_HORIZONTAL_SPARSE][31] = 0x00000000;
- /* modified by NIZHNY-VTN Tue Oct 26 09:55:42 1999 ___END___ */
-
- interiors[TEL_HS_VERTICAL_SPARSE][0] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][1] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][2] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][3] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][4] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][5] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][6] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][7] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][8] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][9] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][10] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][11] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][12] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][13] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][14] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][15] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][16] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][17] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][18] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][19] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][20] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][21] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][22] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][23] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][24] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][25] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][26] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][27] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][28] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][29] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][30] = 0x10101010,
- interiors[TEL_HS_VERTICAL_SPARSE][31] = 0x10101010;
-
- patternBase = glGenLists(TEL_HS_USER_DEF_START);
- for( i = 1; i < TEL_HS_USER_DEF_START; i++ )
- {
- glNewList( patternBase+i, GL_COMPILE);
- glPolygonStipple((const GLubyte *) (interiors[i]));
- glEndList();
- }
-
- /* Init des fontes */
- (void) InitPMFont();
-
- return;
-}
-
-/* Following Section relates to POLYMARKER */
-
-#define TEL_NO_OF_SIZES (long)13
-#define TEL_NB_OF_MARKERS (int)5
-
-struct PM_FONT_INFO
-{
- Tchar *str;
- Tfloat width, height; /* FSXXX Tint -> Tfloat */
- Tint offset;
-};
-typedef PM_FONT_INFO* pm_font_info;
-
-#define PM_PLUS_10_NUM 9*2
-#define PM_PLUS_15_NUM 11*2
-#define PM_PLUS_20_NUM 13*2
-#define PM_PLUS_25_NUM 15*2
-#define PM_PLUS_30_NUM 17*3
-#define PM_PLUS_35_NUM 19*3
-#define PM_PLUS_40_NUM 21*3
-#define PM_PLUS_45_NUM 23*3
-#define PM_PLUS_50_NUM 25*4
-#define PM_PLUS_55_NUM 27*4
-#define PM_PLUS_60_NUM 29*4
-#define PM_PLUS_65_NUM 31*4
-#define PM_PLUS_70_NUM 32*4
-
-#define PM_STAR_10_NUM 9
-#define PM_STAR_15_NUM 11*2
-#define PM_STAR_20_NUM 13*2
-#define PM_STAR_25_NUM 15*2
-#define PM_STAR_30_NUM 17*2
-#define PM_STAR_35_NUM 19*2
-#define PM_STAR_40_NUM 21*3
-#define PM_STAR_45_NUM 23*3
-#define PM_STAR_50_NUM 25*3
-#define PM_STAR_55_NUM 27*3
-#define PM_STAR_60_NUM 29*4
-#define PM_STAR_65_NUM 32*4
-#define PM_STAR_70_NUM 32*4
-
-#define PM_CROSS_10_NUM 7
-#define PM_CROSS_15_NUM 9*2
-#define PM_CROSS_20_NUM 11*2
-#define PM_CROSS_25_NUM 13*2
-#define PM_CROSS_30_NUM 15*2
-#define PM_CROSS_35_NUM 17*3
-#define PM_CROSS_40_NUM 19*3
-#define PM_CROSS_45_NUM 21*3
-#define PM_CROSS_50_NUM 23*3
-#define PM_CROSS_55_NUM 25*4
-#define PM_CROSS_60_NUM 27*4
-#define PM_CROSS_65_NUM 32*4
-#define PM_CROSS_70_NUM 32*4
-
-#define PM_CIRC_10_NUM 7
-#define PM_CIRC_15_NUM 9*2
-#define PM_CIRC_20_NUM 9*2
-#define PM_CIRC_25_NUM 11*2
-#define PM_CIRC_30_NUM 13*2
-#define PM_CIRC_35_NUM 15*2
-#define PM_CIRC_40_NUM 17*3
-#define PM_CIRC_45_NUM 19*3
-#define PM_CIRC_50_NUM 21*3
-#define PM_CIRC_55_NUM 23*3
-#define PM_CIRC_60_NUM 25*4
-#define PM_CIRC_65_NUM 27*4
-#define PM_CIRC_70_NUM 29*4
-
-#define PM_DOT_10_NUM 5
-#define PM_DOT_15_NUM 5
-#define PM_DOT_20_NUM 7
-#define PM_DOT_25_NUM 7
-#define PM_DOT_30_NUM 9*2
-#define PM_DOT_35_NUM 9*2
-#define PM_DOT_40_NUM 9*2
-#define PM_DOT_45_NUM 9*2
-#define PM_DOT_50_NUM 9*2
-#define PM_DOT_55_NUM 9*2
-#define PM_DOT_60_NUM 11*2
-#define PM_DOT_65_NUM 11*2
-#define PM_DOT_70_NUM 11*2
-
-#define PM_PLUS_10_OFT 0
-#define PM_PLUS_15_OFT PM_PLUS_10_OFT + PM_PLUS_10_NUM
-#define PM_PLUS_20_OFT PM_PLUS_15_OFT + PM_PLUS_15_NUM
-#define PM_PLUS_25_OFT PM_PLUS_20_OFT + PM_PLUS_20_NUM
-#define PM_PLUS_30_OFT PM_PLUS_25_OFT + PM_PLUS_25_NUM
-#define PM_PLUS_35_OFT PM_PLUS_30_OFT + PM_PLUS_30_NUM
-#define PM_PLUS_40_OFT PM_PLUS_35_OFT + PM_PLUS_35_NUM
-#define PM_PLUS_45_OFT PM_PLUS_40_OFT + PM_PLUS_40_NUM
-#define PM_PLUS_50_OFT PM_PLUS_45_OFT + PM_PLUS_45_NUM
-#define PM_PLUS_55_OFT PM_PLUS_50_OFT + PM_PLUS_50_NUM
-#define PM_PLUS_60_OFT PM_PLUS_55_OFT + PM_PLUS_55_NUM
-#define PM_PLUS_65_OFT PM_PLUS_60_OFT + PM_PLUS_60_NUM
-#define PM_PLUS_70_OFT PM_PLUS_65_OFT + PM_PLUS_65_NUM
-
-#define PM_STAR_10_OFT PM_PLUS_70_OFT + PM_PLUS_70_NUM
-#define PM_STAR_15_OFT PM_STAR_10_OFT + PM_STAR_10_NUM
-#define PM_STAR_20_OFT PM_STAR_15_OFT + PM_STAR_15_NUM
-#define PM_STAR_25_OFT PM_STAR_20_OFT + PM_STAR_20_NUM
-#define PM_STAR_30_OFT PM_STAR_25_OFT + PM_STAR_25_NUM
-#define PM_STAR_35_OFT PM_STAR_30_OFT + PM_STAR_30_NUM
-#define PM_STAR_40_OFT PM_STAR_35_OFT + PM_STAR_35_NUM
-#define PM_STAR_45_OFT PM_STAR_40_OFT + PM_STAR_40_NUM
-#define PM_STAR_50_OFT PM_STAR_45_OFT + PM_STAR_45_NUM
-#define PM_STAR_55_OFT PM_STAR_50_OFT + PM_STAR_50_NUM
-#define PM_STAR_60_OFT PM_STAR_55_OFT + PM_STAR_55_NUM
-#define PM_STAR_65_OFT PM_STAR_60_OFT + PM_STAR_60_NUM
-#define PM_STAR_70_OFT PM_STAR_65_OFT + PM_STAR_65_NUM
-
-#define PM_CROSS_10_OFT PM_STAR_70_OFT + PM_STAR_70_NUM
-#define PM_CROSS_15_OFT PM_CROSS_10_OFT + PM_CROSS_10_NUM
-#define PM_CROSS_20_OFT PM_CROSS_15_OFT + PM_CROSS_15_NUM
-#define PM_CROSS_25_OFT PM_CROSS_20_OFT + PM_CROSS_20_NUM
-#define PM_CROSS_30_OFT PM_CROSS_25_OFT + PM_CROSS_25_NUM
-#define PM_CROSS_35_OFT PM_CROSS_30_OFT + PM_CROSS_30_NUM
-#define PM_CROSS_40_OFT PM_CROSS_35_OFT + PM_CROSS_35_NUM
-#define PM_CROSS_45_OFT PM_CROSS_40_OFT + PM_CROSS_40_NUM
-#define PM_CROSS_50_OFT PM_CROSS_45_OFT + PM_CROSS_45_NUM
-#define PM_CROSS_55_OFT PM_CROSS_50_OFT + PM_CROSS_50_NUM
-#define PM_CROSS_60_OFT PM_CROSS_55_OFT + PM_CROSS_55_NUM
-#define PM_CROSS_65_OFT PM_CROSS_60_OFT + PM_CROSS_60_NUM
-#define PM_CROSS_70_OFT PM_CROSS_65_OFT + PM_CROSS_65_NUM
-
-#define PM_CIRC_10_OFT PM_CROSS_70_OFT + PM_CROSS_70_NUM
-#define PM_CIRC_15_OFT PM_CIRC_10_OFT + PM_CIRC_10_NUM
-#define PM_CIRC_20_OFT PM_CIRC_15_OFT + PM_CIRC_15_NUM
-#define PM_CIRC_25_OFT PM_CIRC_20_OFT + PM_CIRC_20_NUM
-#define PM_CIRC_30_OFT PM_CIRC_25_OFT + PM_CIRC_25_NUM
-#define PM_CIRC_35_OFT PM_CIRC_30_OFT + PM_CIRC_30_NUM
-#define PM_CIRC_40_OFT PM_CIRC_35_OFT + PM_CIRC_35_NUM
-#define PM_CIRC_45_OFT PM_CIRC_40_OFT + PM_CIRC_40_NUM
-#define PM_CIRC_50_OFT PM_CIRC_45_OFT + PM_CIRC_45_NUM
-#define PM_CIRC_55_OFT PM_CIRC_50_OFT + PM_CIRC_50_NUM
-#define PM_CIRC_60_OFT PM_CIRC_55_OFT + PM_CIRC_55_NUM
-#define PM_CIRC_65_OFT PM_CIRC_60_OFT + PM_CIRC_60_NUM
-#define PM_CIRC_70_OFT PM_CIRC_65_OFT + PM_CIRC_65_NUM
-
-#define PM_DOT_10_OFT PM_CIRC_70_OFT + PM_CIRC_70_NUM
-#define PM_DOT_15_OFT PM_DOT_10_OFT + PM_DOT_10_NUM
-#define PM_DOT_20_OFT PM_DOT_15_OFT + PM_DOT_15_NUM
-#define PM_DOT_25_OFT PM_DOT_20_OFT + PM_DOT_20_NUM
-#define PM_DOT_30_OFT PM_DOT_25_OFT + PM_DOT_25_NUM
-#define PM_DOT_35_OFT PM_DOT_30_OFT + PM_DOT_30_NUM
-#define PM_DOT_40_OFT PM_DOT_35_OFT + PM_DOT_35_NUM
-#define PM_DOT_45_OFT PM_DOT_40_OFT + PM_DOT_40_NUM
-#define PM_DOT_50_OFT PM_DOT_45_OFT + PM_DOT_45_NUM
-#define PM_DOT_55_OFT PM_DOT_50_OFT + PM_DOT_50_NUM
-#define PM_DOT_60_OFT PM_DOT_55_OFT + PM_DOT_55_NUM
-#define PM_DOT_65_OFT PM_DOT_60_OFT + PM_DOT_60_NUM
-#define PM_DOT_70_OFT PM_DOT_65_OFT + PM_DOT_65_NUM
-
-static PM_FONT_INFO array[TEL_NB_OF_MARKERS][TEL_NO_OF_SIZES] =
-{
- { {(Tchar*)"\101", ( float )9, ( float )9, PM_PLUS_10_OFT},
- {(Tchar*)"\102", ( float )11, ( float )11, PM_PLUS_15_OFT},
- {(Tchar*)"\103", ( float )13, ( float )13, PM_PLUS_20_OFT},
- {(Tchar*)"\003", ( float )15, ( float )15, PM_PLUS_25_OFT},
- {(Tchar*)"\004", ( float )17, ( float )17, PM_PLUS_30_OFT},
- {(Tchar*)"\005", ( float )19, ( float )19, PM_PLUS_35_OFT},
- {(Tchar*)"\006", ( float )21, ( float )21, PM_PLUS_40_OFT},
- {(Tchar*)"\007", ( float )23, ( float )23, PM_PLUS_45_OFT},
- {(Tchar*)"\010", ( float )25, ( float )25, PM_PLUS_50_OFT},
- {(Tchar*)"\011", ( float )27, ( float )27, PM_PLUS_55_OFT},
- {(Tchar*)"\012", ( float )29, ( float )29, PM_PLUS_60_OFT},
- {(Tchar*)"\013", ( float )31, ( float )31, PM_PLUS_65_OFT},
- {(Tchar*)"\014", ( float )32, ( float )32, PM_PLUS_70_OFT} },
-
- { {(Tchar*)"\015", ( float )7, ( float )9, PM_STAR_10_OFT},
- {(Tchar*)"\016", ( float )9, ( float )11, PM_STAR_15_OFT},
- {(Tchar*)"\017", ( float )11, ( float )13, PM_STAR_20_OFT},
- {(Tchar*)"\020", ( float )13, ( float )15, PM_STAR_25_OFT},
- {(Tchar*)"\021", ( float )13, ( float )17, PM_STAR_30_OFT},
- {(Tchar*)"\022", ( float )15, ( float )19, PM_STAR_35_OFT},
- {(Tchar*)"\023", ( float )17, ( float )21, PM_STAR_40_OFT},
- {(Tchar*)"\024", ( float )19, ( float )23, PM_STAR_45_OFT},
- {(Tchar*)"\025", ( float )21, ( float )25, PM_STAR_50_OFT},
- {(Tchar*)"\026", ( float )23, ( float )27, PM_STAR_55_OFT},
- {(Tchar*)"\027", ( float )25, ( float )29, PM_STAR_60_OFT},
- {(Tchar*)"\030", ( float )32, ( float )32, PM_STAR_65_OFT},
- {(Tchar*)"\031", ( float )32, ( float )32, PM_STAR_70_OFT} },
-
- { {(Tchar*)"\032", ( float )7, ( float )7, PM_CROSS_10_OFT},
- {(Tchar*)"\033", ( float )9, ( float )9, PM_CROSS_15_OFT},
- {(Tchar*)"\034", ( float )11, ( float )11, PM_CROSS_20_OFT},
- {(Tchar*)"\035", ( float )13, ( float )13, PM_CROSS_25_OFT},
- {(Tchar*)"\036", ( float )15, ( float )15, PM_CROSS_30_OFT},
- {(Tchar*)"\037", ( float )17, ( float )17, PM_CROSS_35_OFT},
- {(Tchar*)"\040", ( float )19, ( float )19, PM_CROSS_40_OFT},
- {(Tchar*)"\041", ( float )21, ( float )21, PM_CROSS_45_OFT},
- {(Tchar*)"\042", ( float )23, ( float )23, PM_CROSS_50_OFT},
- {(Tchar*)"\043", ( float )25, ( float )25, PM_CROSS_55_OFT},
- {(Tchar*)"\044", ( float )27, ( float )27, PM_CROSS_60_OFT},
- {(Tchar*)"\045", ( float )32, ( float )32, PM_CROSS_65_OFT},
- {(Tchar*)"\046", ( float )32, ( float )32, PM_CROSS_70_OFT} },
-
- { {(Tchar*)"\047", ( float )7, ( float )7, PM_CIRC_10_OFT},
- {(Tchar*)"\050", ( float )9, ( float )9, PM_CIRC_15_OFT},
- {(Tchar*)"\051", ( float )9, ( float )9, PM_CIRC_20_OFT},
- {(Tchar*)"\052", ( float )11, ( float )11, PM_CIRC_25_OFT},
- {(Tchar*)"\053", ( float )13, ( float )13, PM_CIRC_30_OFT},
- {(Tchar*)"\054", ( float )15, ( float )15, PM_CIRC_35_OFT},
- {(Tchar*)"\055", ( float )17, ( float )17, PM_CIRC_40_OFT},
- {(Tchar*)"\056", ( float )19, ( float )19, PM_CIRC_45_OFT},
- {(Tchar*)"\057", ( float )21, ( float )21, PM_CIRC_50_OFT},
- {(Tchar*)"\060", ( float )23, ( float )23, PM_CIRC_55_OFT},
- {(Tchar*)"\061", ( float )25, ( float )25, PM_CIRC_60_OFT},
- {(Tchar*)"\062", ( float )27, ( float )27, PM_CIRC_65_OFT},
- {(Tchar*)"\063", ( float )29, ( float )29, PM_CIRC_70_OFT} },
-
- { {(Tchar*)"\064", ( float )5, ( float )5, PM_DOT_10_OFT},
- {(Tchar*)"\065", ( float )5, ( float )5, PM_DOT_15_OFT},
- {(Tchar*)"\066", ( float )7, ( float )7, PM_DOT_20_OFT},
- {(Tchar*)"\067", ( float )7, ( float )7, PM_DOT_25_OFT},
- {(Tchar*)"\070", ( float )9, ( float )9, PM_DOT_30_OFT},
- {(Tchar*)"\071", ( float )9, ( float )9, PM_DOT_35_OFT},
- {(Tchar*)"\072", ( float )9, ( float )9, PM_DOT_40_OFT},
- {(Tchar*)"\073", ( float )9, ( float )9, PM_DOT_45_OFT},
- {(Tchar*)"\074", ( float )9, ( float )9, PM_DOT_50_OFT},
- {(Tchar*)"\075", ( float )9, ( float )9, PM_DOT_55_OFT},
- {(Tchar*)"\076", ( float )11, ( float )11, PM_DOT_60_OFT},
- {(Tchar*)"\077", ( float )11, ( float )11, PM_DOT_65_OFT},
- {(Tchar*)"\100", ( float )11, ( float )11, PM_DOT_70_OFT} }
-};
-
-#define TEL_PM_START_SIZE 1.0
-#define TEL_PM_END_SIZE 7.0
-
-#define TEL_PM_SIZE_STEP 0.5
-
-/*----------------------------------------------------------------------*/
-
-static void
-InitPMFont(void)
-{
- Tint i, k1, k2, offset;
- unsigned char raster[] = {
-
- 0x08,0x00,
- 0x08,0x00,
- 0x08,0x00,
- 0x08,0x00,
- 0xff,0x80,
- 0x08,0x00,
- 0x08,0x00,
- 0x08,0x00,
- 0x08,0x00, /* PLUS 9x9 = 1.0 */
-
- 0x04,0x00,
- 0x04,0x00,
- 0x04,0x00,
- 0x04,0x00,
- 0x04,0x00,
- 0xff,0xe0,
- 0x04,0x00,
- 0x04,0x00,
- 0x04,0x00,
- 0x04,0x00,
- 0x04,0x00, /* PLUS 11x11 = 1.5 */
-
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0xff,0xf8,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,/* PLUS 13x13 = 2.0 */
-
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0xff,0xfe,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,/* PLUS 15x15 = 2.5 */
-
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0xff,0xff, 0x80,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,/* PLUS 17x17 = 3.0 */
-
-
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0xff,0xff, 0xe0,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,/* PLUS 19x19 = 3.5 */
-
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0xff,0xff, 0xf8,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,/* PLUS 21x21 = 4.0 */
-
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0xff,0xff, 0xfe,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,/* PLUS 23x23 = 4.5 */
-
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0xff,0xff, 0xff,0x80,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,/* PLUS 25x25 = 5.0 */
-
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0xff,0xff, 0xff,0xe0,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,/* PLUS 27x27 = 5.5 */
-
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0xff,0xff, 0xff,0xf8,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,
- 0x00,0x02, 0x00,0x00,/* PLUS 29x29 = 6.0 */
-
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0xff,0xff, 0xff,0xfd,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,
- 0x00,0x01, 0x00,0x00,/* PLUS 31x31 = 6.5 */
-
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0xff,0xff, 0xff,0xff,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,/* PLUS 32x32 = 7.0 */
-
- 0x10,
- 0x10,
- 0xd6,
- 0x38,
- 0x10,
- 0x38,
- 0xd6,
- 0x10,
- 0x10,/* STAR 7x9 = 1.0 */
-
- 0x08,0x00,
- 0x08,0x00,
- 0x08,0x00,
- 0xc9,0x80,
- 0x3e,0x00,
- 0x08,0x00,
- 0x3e,0x00,
- 0xc9,0x80,
- 0x08,0x00,
- 0x08,0x00,
- 0x08,0x00,/* STAR 9x11 = 1.5 */
-
- 0x04,0x00,
- 0x04,0x00,
- 0x04,0x00,
- 0x84,0x20,
- 0x64,0xc0,
- 0x1f,0x00,
- 0x04,0x00,
- 0x1f,0x00,
- 0x64,0xc0,
- 0x84,0x20,
- 0x04,0x00,
- 0x04,0x00,
- 0x04,0x00,/* STAR 11x13 = 2.0 */
-
-
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x82,0x18,
- 0x62,0x60,
- 0x1b,0x80,
- 0x06,0x00,
- 0x1b,0x80,
- 0x62,0x60,
- 0x82,0x18,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,/* STAR 13x15 = 2.5 */
-
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x82,0x08,
- 0x62,0x30,
- 0x12,0x40,
- 0x0f,0x80,
- 0x02,0x00,
- 0x0f,0x80,
- 0x12,0x40,
- 0x62,0x30,
- 0x82,0x08,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,
- 0x02,0x00,/* STAR 13x17 = 3.0 */
-
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0xc1,0x06,
- 0x21,0x18,
- 0x19,0x20,
- 0x07,0xc0,
- 0x01,0x00,
- 0x07,0xc0,
- 0x19,0x20,
- 0x21,0x18,
- 0xc1,0x06,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,
- 0x01,0x00,/* STAR 15x19 = 3.5 */
-
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x80,0x80, 0x80,
- 0x60,0x83, 0x00,
- 0x10,0x8c, 0x00,
- 0x0c,0x90, 0x00,
- 0x03,0xe0, 0x00,
- 0x00,0x80, 0x00,
- 0x03,0xe0, 0x00,
- 0x0c,0x90, 0x00,
- 0x10,0x8c, 0x00,
- 0x60,0x83, 0x00,
- 0x80,0x80, 0x80,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,
- 0x00,0x80, 0x00,/* STAR 17x21 = 4.0 */
-
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0xc0,0x40, 0x60,
- 0x30,0x41, 0x80,
- 0x08,0x42, 0x00,
- 0x06,0x4c, 0x00,
- 0x01,0xf0, 0x00,
- 0x00,0x40, 0x00,
- 0x01,0xf0, 0x00,
- 0x06,0x4c, 0x00,
- 0x08,0x42, 0x00,
- 0x30,0x41, 0x80,
- 0xc0,0x40, 0x60,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0x40, 0x00,/* STAR 19x23 = 4.5 */
-
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x80,0x20, 0x08,
- 0x60,0x20, 0x30,
- 0x18,0x20, 0xc0,
- 0x04,0x21, 0x00,
- 0x03,0x26, 0x00,
- 0x00,0xf8, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0xf8, 0x00,
- 0x03,0x26, 0x00,
- 0x04,0x21, 0x00,
- 0x18,0x20, 0xc0,
- 0x60,0x20, 0x30,
- 0x80,0x20, 0x08,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x20, 0x00,/* STAR 21x25 = 5.0 */
-
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0xc0,0x10, 0x06,
- 0x30,0x10, 0x18,
- 0x08,0x10, 0x60,
- 0x06,0x10, 0x80,
- 0x01,0x93, 0x00,
- 0x00,0x7c, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x7c, 0x00,
- 0x01,0x93, 0x00,
- 0x06,0x10, 0x80,
- 0x08,0x10, 0x60,
- 0x30,0x10, 0x18,
- 0xc0,0x10, 0x06,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x10, 0x00,/* STAR 23x27 = 5.5 */
-
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x80,0x08, 0x00,0x80,
- 0x60,0x08, 0x03,0x00,
- 0x18,0x08, 0x0c,0x00,
- 0x04,0x08, 0x30,0x00,
- 0x03,0x08, 0x40,0x00,
- 0x00,0xc9, 0x80,0x00,
- 0x00,0x3e, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x3e, 0x00,0x00,
- 0x00,0xc9, 0x80,0x00,
- 0x03,0x08, 0x40,0x00,
- 0x04,0x08, 0x30,0x00,
- 0x18,0x08, 0x0c,0x00,
- 0x60,0x08, 0x03,0x00,
- 0x80,0x08, 0x00,0x80,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,/* STAR 25x29 = 6.0 */
-
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x30,0x00, 0x80,0x06,
- 0x0c,0x00, 0x80,0x18,
- 0x03,0x00, 0x80,0x60,
- 0x00,0xc0, 0x81,0x80,
- 0x00,0x30, 0x86,0x00,
- 0x00,0x0c, 0x98,0x00,
- 0x00,0x03, 0xe0,0x00,
- 0x00,0x03, 0xe0,0x00,
- 0x00,0x0c, 0x98,0x00,
- 0x00,0x30, 0x86,0x00,
- 0x00,0xc0, 0x81,0x80,
- 0x03,0x00, 0x80,0x60,
- 0x0c,0x00, 0x80,0x18,
- 0x30,0x00, 0x80,0x06,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x80,0x00,
- 0x00,0x00, 0x00,0x00,
- 0x00,0x00, 0x00,0x00,/* STAR 32x32 = 6.5 */
-
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x10, 0x00, 0x80, 0x04,
- 0x0c, 0x00, 0x80, 0x18,
- 0x02, 0x00, 0x80, 0x20,
- 0x01, 0x80, 0x80, 0xc0,
- 0x00, 0x40, 0x81, 0x00,
- 0x00, 0x30, 0x86, 0x00,
- 0x00, 0x08, 0x88, 0x00,
- 0x00, 0x06, 0xb0, 0x00,
- 0x00, 0x01, 0xc0, 0x00,
- 0x00, 0x06, 0xb0, 0x00,
- 0x00, 0x08, 0x88, 0x00,
- 0x00, 0x30, 0x86, 0x00,
- 0x00, 0x40, 0x81, 0x00,
- 0x01, 0x80, 0x80, 0xc0,
- 0x02, 0x00, 0x80, 0x20,
- 0x0c, 0x00, 0x80, 0x18,
- 0x10, 0x00, 0x80, 0x04,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00, 0x80, 0x00,/* STAR 32x32 = 7.0 */
-
-
- 0x82,
- 0x44,
- 0x28,
- 0x10,
- 0x28,
- 0x44,
- 0x82,/* CROSS 7x7 = 1.0 */
-
- 0x80,0x80,
- 0x41,0x00,
- 0x22,0x00,
- 0x14,0x00,
- 0x08,0x00,
- 0x14,0x00,
- 0x22,0x00,
- 0x41,0x00,
- 0x80,0x80,/* CROSS 9x9 = 1.5 */
-
- 0x80,0x20,
- 0x40,0x40,
- 0x20,0x80,
- 0x11,0x00,
- 0x0a,0x00,
- 0x04,0x00,
- 0x0a,0x00,
- 0x11,0x00,
- 0x20,0x80,
- 0x40,0x40,
- 0x80,0x20,/* CROSS 11x11 = 2.0 */
-
- 0x80,0x08,
- 0x40,0x10,
- 0x20,0x20,
- 0x10,0x40,
- 0x08,0x80,
- 0x05,0x00,
- 0x02,0x00,
- 0x05,0x00,
- 0x08,0x80,
- 0x10,0x40,
- 0x20,0x20,
- 0x40,0x10,
- 0x80,0x08,/* CROSS 13x13 = 2.5 */
-
- 0x80,0x02,
- 0x40,0x04,
- 0x20,0x08,
- 0x10,0x10,
- 0x08,0x20,
- 0x04,0x40,
- 0x02,0x80,
- 0x01,0x00,
- 0x02,0x80,
- 0x04,0x40,
- 0x08,0x20,
- 0x10,0x10,
- 0x20,0x08,
- 0x40,0x04,
- 0x80,0x02,/* CROSS 15x15 = 3.0 */
-
- 0x80,0x00, 0x80,
- 0x40,0x01, 0x00,
- 0x20,0x02, 0x00,
- 0x10,0x04, 0x00,
- 0x08,0x08, 0x00,
- 0x04,0x10, 0x00,
- 0x02,0x20, 0x00,
- 0x01,0x40, 0x00,
- 0x00,0x80, 0x00,
- 0x01,0x40, 0x00,
- 0x02,0x20, 0x00,
- 0x04,0x10, 0x00,
- 0x08,0x08, 0x00,
- 0x10,0x04, 0x00,
- 0x20,0x02, 0x00,
- 0x40,0x01, 0x00,
- 0x80,0x00, 0x80,/* CROSS 17x17 = 3.5 */
-
- 0x80,0x00, 0x20,
- 0x40,0x00, 0x40,
- 0x20,0x00, 0x80,
- 0x10,0x01, 0x00,
- 0x08,0x02, 0x00,
- 0x04,0x04, 0x00,
- 0x02,0x08, 0x00,
- 0x01,0x10, 0x00,
- 0x00,0xa0, 0x00,
- 0x00,0x40, 0x00,
- 0x00,0xa0, 0x00,
- 0x01,0x10, 0x00,
- 0x02,0x08, 0x00,
- 0x04,0x04, 0x00,
- 0x08,0x02, 0x00,
- 0x10,0x01, 0x00,
- 0x20,0x00, 0x80,
- 0x40,0x00, 0x40,
- 0x80,0x00, 0x20,/* CROSS 19x19 = 4.0 */
-
- 0x80,0x00, 0x08,
- 0x40,0x00, 0x10,
- 0x20,0x00, 0x20,
- 0x10,0x00, 0x40,
- 0x08,0x00, 0x80,
- 0x04,0x01, 0x00,
- 0x02,0x02, 0x00,
- 0x01,0x04, 0x00,
- 0x00,0x88, 0x00,
- 0x00,0x50, 0x00,
- 0x00,0x20, 0x00,
- 0x00,0x50, 0x00,
- 0x00,0x88, 0x00,
- 0x01,0x04, 0x00,
- 0x02,0x02, 0x00,
- 0x04,0x01, 0x00,
- 0x08,0x00, 0x80,
- 0x10,0x00, 0x40,
- 0x20,0x00, 0x20,
- 0x40,0x00, 0x10,
- 0x80,0x00, 0x08,/* CROSS 21x21 = 4.5 */
-
- 0x80,0x00, 0x02,
- 0x40,0x00, 0x04,
- 0x20,0x00, 0x08,
- 0x10,0x00, 0x10,
- 0x08,0x00, 0x20,
- 0x04,0x00, 0x40,
- 0x02,0x00, 0x80,
- 0x01,0x01, 0x00,
- 0x00,0x82, 0x00,
- 0x00,0x44, 0x00,
- 0x00,0x28, 0x00,
- 0x00,0x10, 0x00,
- 0x00,0x28, 0x00,
- 0x00,0x44, 0x00,
- 0x00,0x82, 0x00,
- 0x01,0x01, 0x00,
- 0x02,0x00, 0x80,
- 0x04,0x00, 0x40,
- 0x08,0x00, 0x20,
- 0x10,0x00, 0x10,
- 0x20,0x00, 0x08,
- 0x40,0x00, 0x04,
- 0x80,0x00, 0x02,/* CROSS 23x23 = 5.0 */
-
- 0x80,0x00, 0x00,0x80,
- 0x40,0x00, 0x01,0x00,
- 0x20,0x00, 0x02,0x00,
- 0x10,0x00, 0x04,0x00,
- 0x08,0x00, 0x08,0x00,
- 0x04,0x00, 0x10,0x00,
- 0x02,0x00, 0x20,0x00,
- 0x01,0x00, 0x40,0x00,
- 0x00,0x80, 0x80,0x00,
- 0x00,0x41, 0x00,0x00,
- 0x00,0x22, 0x00,0x00,
- 0x00,0x14, 0x00,0x00,
- 0x00,0x08, 0x00,0x00,
- 0x00,0x14, 0x00,0x00,
- 0x00,0x22, 0x00,0x00,
- 0x00,0x41, 0x00,0x00,
- 0x00,0x80, 0x80,0x00,
- 0x01,0x00, 0x40,0x00,
- 0x02,0x00, 0x20,0x00,
- 0x04,0x00, 0x10,0x00,
- 0x08,0x00, 0x08,0x00,
- 0x10,0x00, 0x04,0x00,
- 0x20,0x00, 0x02,0x00,
- 0x40,0x00, 0x01,0x00,
- 0x80,0x00, 0x00,0x80,/* CROSS 25x25 = 5.5 */
-
- 0x80,0x00, 0x00,0x20,
- 0x40,0x00, 0x00,0x40,
- 0x20,0x00, 0x00,0x80,
- 0x10,0x00, 0x01,0x00,
- 0x08,0x00, 0x02,0x00,
- 0x04,0x00, 0x04,0x00,
- 0x02,0x00, 0x08,0x00,
- 0x01,0x00, 0x10,0x00,
- 0x00,0x80, 0x20,0x00,
- 0x00,0x40, 0x40,0x00,
- 0x00,0x20, 0x80,0x00,
- 0x00,0x11, 0x00,0x00,
- 0x00,0x0a, 0x00,0x00,
- 0x00,0x04, 0x00,0x00,
- 0x00,0x0a, 0x00,0x00,
- 0x00,0x11, 0x00,0x00,
- 0x00,0x20, 0x80,0x00,
- 0x00,0x40, 0x40,0x00,
- 0x00,0x80, 0x20,0x00,
- 0x01,0x00, 0x10,0x00,
- 0x02,0x00, 0x08,0x00,
- 0x04,0x00, 0x04,0x00,
- 0x08,0x00, 0x02,0x00,
- 0x10,0x00, 0x01,0x00,
- 0x20,0x00, 0x00,0x80,
- 0x40,0x00, 0x00,0x40,
- 0x80,0x00, 0x00,0x20,/* CROSS 27x27 = 6.0 */
-
- 0x00,0x00, 0x00,0x00,
- 0x00,0x00, 0x00,0x00,
- 0x20,0x00, 0x00,0x04,
- 0x10,0x00, 0x00,0x08,
- 0x08,0x00, 0x00,0x10,
- 0x04,0x00, 0x00,0x20,
- 0x02,0x00, 0x00,0x40,
- 0x01,0x00, 0x00,0x80,
- 0x00,0x80, 0x01,0x00,
- 0x00,0x40, 0x02,0x00,
- 0x00,0x20, 0x04,0x00,
- 0x00,0x10, 0x08,0x00,
- 0x00,0x08, 0x10,0x00,
- 0x00,0x04, 0x20,0x00,
- 0x00,0x02, 0x40,0x00,
- 0x00,0x01, 0x80,0x00,
- 0x00,0x01, 0x80,0x00,
- 0x00,0x02, 0x40,0x00,
- 0x00,0x04, 0x20,0x00,
- 0x00,0x08, 0x10,0x00,
- 0x00,0x10, 0x08,0x00,
- 0x00,0x20, 0x04,0x00,
- 0x00,0x40, 0x02,0x00,
- 0x00,0x80, 0x01,0x00,
- 0x01,0x00, 0x00, 0x80,
- 0x02,0x00, 0x00,0x40,
- 0x04,0x00, 0x00,0x20,
- 0x08,0x00, 0x00,0x10,
- 0x10,0x00, 0x00,0x08,
- 0x20,0x00, 0x00,0x04,
- 0x00,0x00, 0x00,0x00,
- 0x00,0x00, 0x00,0x00,/* CROSS 32x32 = 6.5 */
-
- 0x00,0x00, 0x00,0x00,
- 0x40,0x00, 0x00,0x02,
- 0x20,0x00, 0x00,0x04,
- 0x10,0x00, 0x00,0x08,
- 0x08,0x00, 0x00,0x10,
- 0x04,0x00, 0x00,0x20,
- 0x02,0x00, 0x00,0x40,
- 0x01,0x00, 0x00,0x80,
- 0x00,0x80, 0x01,0x00,
- 0x00,0x40, 0x02,0x00,
- 0x00,0x20, 0x04,0x00,
- 0x00,0x10, 0x08,0x00,
- 0x00,0x08, 0x10,0x00,
- 0x00,0x04, 0x20,0x00,
- 0x00,0x02, 0x40,0x00,
- 0x00,0x01, 0x80,0x00,
- 0x00,0x01, 0x80,0x00,
- 0x00,0x02, 0x40,0x00,
- 0x00,0x04, 0x20,0x00,
- 0x00,0x08, 0x10,0x00,
- 0x00,0x10, 0x08,0x00,
- 0x00,0x20, 0x04,0x00,
- 0x00,0x40, 0x02,0x00,
- 0x00,0x80, 0x01,0x00,
- 0x01,0x00, 0x00,0x80,
- 0x02,0x00, 0x00,0x40,
- 0x04,0x00, 0x00,0x20,
- 0x08,0x00, 0x00,0x10,
- 0x10,0x00, 0x00,0x08,
- 0x20,0x00, 0x00,0x04,
- 0x40,0x00, 0x00,0x02,
- 0x00,0x00, 0x00,0x00,/* CROSS 32x32 = 7.0 */
-
- 0x38,
- 0x44,
- 0x82,
- 0x82,
- 0x82,
- 0x44,
- 0x38,/* CIRC 7x7 = 1.0 */
-
- 0x3c,0x00,
- 0x42,0x00,
- 0x81,0x00,
- 0x81,0x00,
- 0x81,0x00,
- 0x81,0x00,
- 0x42,0x00,
- 0x3c,0x00,
- 0x00,0x00,/*CIRC 9x9 = 1.5 */
-
- 0x3e, 0x00,
- 0x41, 0x00,
- 0x81, 0x80,
- 0x80,0x80,
- 0x80,0x80,
- 0x80,0x80,
- 0x81, 0x80,
- 0x41, 0x00,
- 0x3e,0x00,/* CIRC 9x9 = 2.0 */
-
- 0x1f,0x00,
- 0x20,0x80,
- 0x40,0x40,
- 0x80,0x20,
- 0x80,0x20,
- 0x80,0x20,
- 0x80,0x20,
- 0x80,0x20,
- 0x40,0x40,
- 0x20,0x80,
- 0x1f,0x00,/* CIRC 11x11 = 2.5 */
-
- 0x0f,0x80,
- 0x10,0x40,
- 0x20,0x20,
- 0x40,0x10,
- 0x80,0x08,
- 0x80,0x08,
- 0x80,0x08,
- 0x80,0x08,
- 0x80,0x08,
- 0x40,0x10,
- 0x20,0x20,
- 0x10,0x40,
- 0x0f,0x80,/* CIRC 13x13 = 3.0 */
-
- 0x07,0xc0,
- 0x18,0x30,
- 0x20,0x08,
- 0x40,0x04,
- 0x40,0x04,
- 0x80,0x02,
- 0x80,0x02,
- 0x80,0x02,
- 0x80,0x02,
- 0x80,0x02,
- 0x40,0x04,
- 0x40,0x04,
- 0x20,0x08,
- 0x18,0x30,
- 0x07,0xc0,/* CIRC 15x15 = 3.5 */
-
- 0x03,0xe0, 0x00,
- 0x0c,0x18, 0x00,
- 0x10,0x04, 0x00,
- 0x20,0x02, 0x00,
- 0x40,0x01, 0x00,
- 0x40,0x01, 0x00,
- 0x80,0x00, 0x80,
- 0x80,0x00, 0x80,
- 0x80,0x00, 0x80,
- 0x80,0x00, 0x80,
- 0x80,0x00, 0x80,
- 0x40,0x01, 0x00,
- 0x40,0x01, 0x00,
- 0x20,0x02, 0x00,
- 0x10,0x04, 0x00,
- 0x0c,0x18, 0x00,
- 0x03,0xe0, 0x00,/* CIRC 17x17 = 4.0 */
-
- 0x03,0xf8, 0x00,
- 0x0e,0x0e, 0x00,
- 0x18,0x03, 0x00,
- 0x20,0x00, 0x80,
- 0x60,0x00, 0xc0,
- 0x40,0x00, 0x40,
- 0xc0,0x00, 0x60,
- 0x80,0x00, 0x20,
- 0x80,0x00, 0x20,
- 0x80,0x00, 0x20,
- 0x80,0x00, 0x20,
- 0x80,0x00, 0x20,
- 0xc0,0x00, 0x60,
- 0x40,0x00, 0x40,
- 0x60,0x00, 0xc0,
- 0x20,0x00, 0x80,
- 0x18,0x03, 0x00,
- 0x0e,0x0e, 0x00,
- 0x03,0xf8, 0x00,/* CIRC 19x19 = 4.5 */
-
-
- 0x01,0xfc, 0x00,
- 0x06,0x03, 0x00,
- 0x08,0x00, 0x80,
- 0x10,0x00, 0x40,
- 0x20,0x00, 0x20,
- 0x40,0x00, 0x10,
- 0x40,0x00, 0x10,
- 0x80,0x00, 0x08,
- 0x80,0x00, 0x08,
- 0x80,0x00, 0x08,
- 0x80,0x00, 0x08,
- 0x80,0x00, 0x08,
- 0x80,0x00, 0x08,
- 0x80,0x00, 0x08,
- 0x40,0x00, 0x10,
- 0x40,0x00, 0x10,
- 0x20,0x00, 0x20,
- 0x10,0x00, 0x40,
- 0x08,0x00, 0x80,
- 0x06,0x03, 0x00,
- 0x01,0xfc, 0x00,/* CIRC 21x21 = 5.0 */
-
- 0x00,0xfe, 0x00,
- 0x03,0x01, 0x80,
- 0x0c,0x00, 0x60,
- 0x18,0x00, 0x30,
- 0x30,0x00, 0x18,
- 0x20,0x00, 0x08,
- 0x40,0x00, 0x04,
- 0x40,0x00, 0x04,
- 0x80,0x00, 0x02,
- 0x80,0x00, 0x02,
- 0x80,0x00, 0x02,
- 0x80,0x00, 0x02,
- 0x80,0x00, 0x02,
- 0x80,0x00, 0x02,
- 0x80,0x00, 0x02,
- 0x40,0x00, 0x04,
- 0x40,0x00, 0x04,
- 0x20,0x00, 0x08,
- 0x30,0x00, 0x18,
- 0x18,0x00, 0x30,
- 0x0c,0x00, 0x60,
- 0x03,0x01, 0x80,
- 0x00,0xfe, 0x00,/* CIRC 23x23 = 5.5 */
-
- 0x00,0x7f, 0x00,0x00,
- 0x01,0x80, 0xc0,0x00,
- 0x06,0x00, 0x30,0x00,
- 0x08,0x00, 0x08,0x00,
- 0x10,0x00, 0x04,0x00,
- 0x20,0x00, 0x02,0x00,
- 0x20,0x00, 0x02,0x00,
- 0x40,0x00, 0x01,0x00,
- 0x40,0x00, 0x01,0x00,
- 0x80,0x00, 0x00,0x80,
- 0x80,0x00, 0x00,0x80,
- 0x80,0x00, 0x00,0x80,
- 0x80,0x00, 0x00,0x80,
- 0x80,0x00, 0x00,0x80,
- 0x80,0x00, 0x00,0x80,
- 0x80,0x00, 0x00,0x80,
- 0x40,0x00, 0x01,0x00,
- 0x40,0x00, 0x01,0x00,
- 0x20,0x00, 0x02,0x00,
- 0x20,0x00, 0x02,0x00,
- 0x10,0x00, 0x04,0x00,
- 0x08,0x00, 0x08,0x00,
- 0x06,0x00, 0x30,0x00,
- 0x01,0x80, 0xc0,0x00,
- 0x00,0x7f, 0x00,0x00,/* CIRC 25x25 = 6.0 */
-
- 0x00,0x3f, 0x80,0x00,
- 0x01,0xc0, 0x70,0x00,
- 0x03,0x00, 0x18,0x00,
- 0x0c,0x00, 0x06,0x00,
- 0x18,0x00, 0x03,0x00,
- 0x10,0x00, 0x01,0x00,
- 0x20,0x00, 0x00,0x80,
- 0x60,0x00, 0x00,0xc0,
- 0x40,0x00, 0x00,0x40,
- 0x40,0x00, 0x00,0x40,
- 0x80,0x00, 0x00,0x20,
- 0x80,0x00, 0x00,0x20,
- 0x80,0x00, 0x00,0x20,
- 0x80,0x00, 0x00,0x20,
- 0x80,0x00, 0x00,0x20,
- 0x80,0x00, 0x00,0x20,
- 0x80,0x00, 0x00,0x20,
- 0x40,0x00, 0x00,0x40,
- 0x40,0x00, 0x00,0x40,
- 0x60,0x00, 0x00,0xc0,
- 0x20,0x00, 0x00,0x80,
- 0x10,0x00, 0x01,0x00,
- 0x18,0x00, 0x03,0x00,
- 0x0c,0x00, 0x06,0x00,
- 0x03,0x00, 0x18,0x00,
- 0x01,0xc0, 0x70,0x00,
- 0x00,0x3f, 0x80,0x00,/* CIRC 27x27 = 6.5 */
-
- 0x00,0x1f, 0xc0,0x00,
- 0x00,0xe0, 0x38,0x00,
- 0x01,0x00, 0x04,0x00,
- 0x06,0x00, 0x03,0x00,
- 0x08,0x00, 0x00,0x80,
- 0x10,0x00, 0x00,0x40,
- 0x10,0x00, 0x00,0x40,
- 0x20,0x00, 0x00,0x20,
- 0x40,0x00, 0x00,0x10,
- 0x40,0x00, 0x00,0x10,
- 0x40,0x00, 0x00,0x10,
- 0x80,0x00, 0x00,0x08,
- 0x80,0x00, 0x00,0x08,
- 0x80,0x00, 0x00,0x08,
- 0x80,0x00, 0x00,0x08,
- 0x80,0x00, 0x00,0x08,
- 0x80,0x00, 0x00,0x08,
- 0x80,0x00, 0x00,0x08,
- 0x40,0x00, 0x00,0x10,
- 0x40,0x00, 0x00,0x10,
- 0x40,0x00, 0x00,0x10,
- 0x20,0x00, 0x00,0x20,
- 0x10,0x00, 0x00,0x40,
- 0x10,0x00, 0x00,0x40,
- 0x08,0x00, 0x00,0x80,
- 0x06,0x00, 0x03,0x00,
- 0x01,0x00, 0x04,0x00,
- 0x00,0xe0, 0x38,0x00,
- 0x00,0x1f, 0xc0,0x00, /* CIRC 29x29 = 7.0 */
-
- 0x00,
- 0x18,
- 0x18,
- 0x00,
- 0x00,/* DOT 5x5 = 1.0 */
-
- 0x70,
- 0xf8,
- 0xf8,
- 0xf8,
- 0x70,/* DOT 5x5 = 1.5 = 1.0 */
-
- 0x38,
- 0x7c,
- 0xfe,
- 0xfe,
- 0xfe,
- 0x7c,
- 0x38,/* DOT 7x7 = 2.0 */
-
- 0x38,
- 0x7c,
- 0xfe,
- 0xfe,
- 0xfe,
- 0x7c,
- 0x38,/* DOT 7x7 = 2.5 = 2.0 */
-
- 0x00,0x00,
- 0x3c,0x00,
- 0x7e,0x00,
- 0xff,0x00,
- 0xff,0x00,
- 0xff,0x00,
- 0x7e,0x00,
- 0x3c,0x00,
- 0x00,0x00,/* DOT 9x9 = 3.0 */
-
- 0x00,0x00,
- 0x3c,0x00,
- 0x7e,0x00,
- 0xff,0x00,
- 0xff,0x00,
- 0xff,0x00,
- 0x7e,0x00,
- 0x3c,0x00,
- 0x00,0x00,/* DOT 9x9 = 3.5 = 3.0 */
-
- 0x1c,0x00,
- 0x7f,0x00,
- 0x7f,0x00,
- 0xff,0x80,
- 0xff,0x80,
- 0xff,0x80,
- 0x7f,0x00,
- 0x7f,0x00,
- 0x1c,0x00,/* DOT 9x9 = 4.0 */
-
- 0x1c,0x00,
- 0x7f,0x00,
- 0x7f,0x00,
- 0xff,0x80,
- 0xff,0x80,
- 0xff,0x80,
- 0x7f,0x00,
- 0x7f,0x00,
- 0x1c,0x00,/* DOT 9x9 = 4.5 = 4.0 */
-
- 0x3e,0x00,
- 0x7f,0x00,
- 0xff,0x80,
- 0xff,0x80,
- 0xff,0x80,
- 0xff,0x80,
- 0xff,0x80,
- 0x7f,0x00,
- 0x3e,0x00,/* DOT 9x9 = 5.0 */
-
- 0x3e,0x00,
- 0x7f,0x00,
- 0xff,0x80,
- 0xff,0x80,
- 0xff,0x80,
- 0xff,0x80,
- 0xff,0x80,
- 0x7f,0x00,
- 0x3e,0x00,/* DOT 9x9 = 5.5 = 5.0 */
-
- 0x1e, 0x00,
- 0x3f, 0x80,
- 0xff, 0xc0,
- 0xff, 0xe1,
- 0xff, 0xe1,
- 0xff, 0xf1,
- 0xff, 0xe1,
- 0xff, 0xe1,
- 0xff, 0xc0,
- 0x3f, 0x80,
- 0x1e, 0x00,/* DOT 11x11 = 6.0 */
-
- 0x1e, 0x00,
- 0x3f, 0x80,
- 0xff, 0xc0,
- 0xff, 0xe1,
- 0xff, 0xe1,
- 0xff, 0xf1,
- 0xff, 0xe1,
- 0xff, 0xe1,
- 0xff, 0xc0,
- 0x3f, 0x80,
- 0x1e, 0x00,/* DOT 11x11 = 6.5 = 6.0 */
-
- 0x1e, 0x00,
- 0x3f, 0x80,
- 0xff, 0xc0,
- 0xff, 0xe1,
- 0xff, 0xe1,
- 0xff, 0xf1,
- 0xff, 0xe1,
- 0xff, 0xe1,
- 0xff, 0xc0,
- 0x3f, 0x80,
- 0x1e, 0x00 /* DOT 11x11 = 7.0 = 6.0 */
- };
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- markerBase = glGenLists (80);
-
- for( i = 0; i < TEL_NO_OF_SIZES*TEL_NB_OF_MARKERS; i++ )
- {
- GLsizei w, h, size, j;
-
- k1 = i / TEL_NO_OF_SIZES;
- k2 = i % TEL_NO_OF_SIZES;
- offset = array[k1][k2].offset;
-
- w = ( GLsizei ) array[k1][k2].width;
- h = ( GLsizei ) array[k1][k2].height;
-
- glNewList( (GLuint) array[k1][k2].str[0]+markerBase, GL_COMPILE);
-
- glBitmap( w, h, (float)(array[k1][k2].width) / ( float )2.0,
- (float)(array[k1][k2].height) / ( float )2.0,
- ( float )30.0, ( float )30.0, (const GLubyte *) &raster[offset]);
-
- glEndList();
-
- }
-
-}
-
-/*----------------------------------------------------------------------*/
-
-Tchar *
-TelGetStringForPM( Tint mrkr_type, Tfloat val )
-{
- Tint id;
- Tfloat index;
-
- if( val < TEL_PM_START_SIZE )
- val = ( float )1.0;
- if( val > TEL_PM_END_SIZE )
- val = ( float )7.0;
-
- index = ( float )(TEL_NO_OF_SIZES-1) * (val - ( float )TEL_PM_START_SIZE )
- / ( float )(TEL_PM_END_SIZE - TEL_PM_START_SIZE);
- id = (Tint)(index + 0.5 );
-
- return array[mrkr_type][id].str;
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-TStatus
-TelInqCurElemTypeSize( TelType *element, Tint *size )
-{
- CMN_KEY key;
- TSM_ELEM elem;
- TStatus status;
-
- if( TsmGetCurElem( &elem ) == TFailure )
- return TFailure;
-
- *element = elem.el;
- key.id = INQ_GET_SIZE_ID;
- status = TsmSendMessage( elem.el, Inquire, elem.data, 1, &key );
- *size = key.data.ldata;
-
- return status;
-}
-
-TStatus
-TelInqCurElemContent( Tint size, Tchar *buf, Tint *act_size, Teldata *data )
-{
- CMN_KEY key;
- TSM_ELEM elem;
- TStatus status;
- TEL_INQ_CONTENT content;
-
- if( TsmGetCurElem( &elem ) == TFailure )
- return TFailure;
-
- content.size = size;
- content.buf = buf;
- content.data = data;
-
- key.data.pdata = &content;
-
- key.id = INQ_GET_CONTENT_ID;
- status = TsmSendMessage( elem.el, Inquire, elem.data, 1, &key );
- *act_size = content.act_size;
-
- return status;
-}
+++ /dev/null
-#ifndef OPENGL_INQUIRE_H
-#define OPENGL_INQUIRE_H
-
-typedef struct {
- int AntiAliasing;
- int DepthCueing;
- int DoubleBuffer;
- int ZBuffer;
- int MaxLights;
- int MaxPlanes;
- int MaxViews;
-} CALL_DEF_INQUIRE;
-
-extern CALL_DEF_INQUIRE call_facilities_list; /* defined in tgl/tgl1 */
-
-#endif
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus InteriorColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorColourAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorColourDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorColourPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorColourInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- InteriorColourDisplay,
- InteriorColourAdd,
- InteriorColourDelete,
- InteriorColourPrint,
- InteriorColourInquire
-};
-
-
-MtblPtr
-TelInteriorColourInitClass( TelType *el )
-{
- *el = TelInteriorColour;
- return MtdTbl;
-}
-
-static TStatus
-InteriorColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_colour data = new TEL_COLOUR();
-
- //cmn_memreserve( data, 1, 0 );
- if( !data )
- return TFailure;
-
- *data = *(tel_colour)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour d;
- CMN_KEY key;
-
- d = (tel_colour)data.pdata;
-
- key.id = TelInteriorColour;
- key.data.pdata = d;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- //cmn_freemem( data.pdata );
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-InteriorColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour p;
-
- p = (tel_colour)data.pdata;
-
- fprintf( stdout, "TelInteriorColour. R = %g, G = %g, B = %g\n",
- p->rgb[0], p->rgb[1], p->rgb[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_colour col;
-
- col = (tel_colour)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->gnl_colour = *col;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/* 08-04-98 : FGU ; Ajout emission */
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-static TStatus InteriorReflectanceEquationAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorReflectanceEquationDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorReflectanceEquationPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorReflectanceEquationInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- InteriorReflectanceEquationDisplay,
- InteriorReflectanceEquationAdd,
- 0, /* Delete */
- InteriorReflectanceEquationPrint,
- InteriorReflectanceEquationInquire
-};
-
-
-MtblPtr
-TelInteriorReflectanceEquationInitClass( TelType *el )
-{
- *el = TelInteriorReflectanceEquation;
- return MtdTbl;
-}
-
-static TStatus
-InteriorReflectanceEquationAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorReflectanceEquationDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelInteriorReflectanceEquation;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-
-static TStatus
-InteriorReflectanceEquationPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- switch( data.ldata )
- {
- case CALL_PHIGS_REFL_NONE:
- fprintf( stdout, "TelInteriorReflectanceEquation. Value = NONE\n" );
- break;
- default :
- fprintf( stdout, "TelInteriorReflectanceEquation. Value = %d\n", data.ldata );
- break;
-
- /* case TelLModelAmbient:
- fprintf( stdout, "TelInteriorReflectanceEquation. Value = \
- GL_AMBIENT\n" );
- break;
-
- case TelLModelDiffuse:
- fprintf( stdout, "TelInteriorReflectanceEquation. Value = \
- GL_AMBIENT_AND_DIFFUSE\n" );
- break;
-
- case TelLModelSpecular:
- fprintf( stdout, "TelInteriorReflectanceEquation. Value = \
- GL_SPECULAR\n" );
- break;*/
- }
-
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorReflectanceEquationInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus InteriorShadingMethodAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorShadingMethodDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorShadingMethodPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorShadingMethodInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- InteriorShadingMethodDisplay,
- InteriorShadingMethodAdd,
- 0, /* Delete */
- InteriorShadingMethodPrint,
- InteriorShadingMethodInquire
-};
-
-
-MtblPtr
-TelInteriorShadingMethodInitClass( TelType *el )
-{
- *el = TelInteriorShadingMethod;
- return MtdTbl;
-}
-
-static TStatus
-InteriorShadingMethodAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorShadingMethodDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelInteriorShadingMethod;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-
-static TStatus
-InteriorShadingMethodPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- switch( data.ldata )
- {
- case TEL_SM_FLAT:
- fprintf( stdout, "TelInteriorShadingMethod. Value = GL_FLAT\n" );
- break;
-
- case TEL_SM_GOURAUD:
- fprintf( stdout, "TelInteriorShadingMethod. Value = GL_SMOOTH\n" );
- break;
- }
-
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorShadingMethodInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-Fichier OpenGl_intstyle.c
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-??-??-?? : PCT ; creation
-15-01-98 : FMN ; Ajout Hidden line
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-/*----------------------------------------------------------------------*/
-
-static TStatus InteriorStyleDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorStyleAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorStylePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorStyleInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- InteriorStyleDisplay,
- InteriorStyleAdd,
- 0, /* Delete */
- InteriorStylePrint,
- InteriorStyleInquire
-};
-
-
-MtblPtr
-TelInteriorStyleInitClass( TelType *el )
-{
- *el = TelInteriorStyle;
- return MtdTbl;
-}
-
-static TStatus
-InteriorStyleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorStyleDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelInteriorStyle;
- key.data.ldata = data.ldata;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorStylePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- switch( data.ldata )
- {
- case TSM_SOLID:
- fprintf( stdout, "TelInteriorStyle. Value = SOLID\n" );
- break;
-
- case TSM_HOLLOW:
- fprintf( stdout, "TelInteriorStyle. Value = HOLLOW\n" );
- break;
-
- case TSM_EMPTY:
- fprintf( stdout, "TelInteriorStyle. Value = EMPTY\n" );
- break;
-
- case TSM_HATCH:
- fprintf( stdout, "TelInteriorStyle. Value = HATCH\n" );
- break;
-
- case TSM_POINT:
- fprintf( stdout, "TelInteriorStyle. Value = POINT\n" );
- break;
-
- case TSM_HIDDENLINE:
- fprintf( stdout, "TelInteriorStyle. Value = HIDDENLINE\n" );
- break;
-
-
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorStyleInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus InteriorStyleIndexDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorStyleIndexAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorStyleIndexPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus InteriorStyleIndexInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- InteriorStyleIndexDisplay,
- InteriorStyleIndexAdd,
- 0, /* Delete */
- InteriorStyleIndexPrint,
- InteriorStyleIndexInquire
-};
-
-
-MtblPtr
-TelInteriorStyleIndexInitClass( TelType *el )
-{
- *el = TelInteriorStyleIndex;
- return MtdTbl;
-}
-
-static TStatus
-InteriorStyleIndexAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorStyleIndexDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelInteriorStyleIndex;
- key.data.ldata = data.ldata;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorStyleIndexPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- switch( data.ldata )
- {
- case TEL_HS_SOLID:
- fprintf( stdout, "TelInteriorStyleIndex. Value = SOLID\n" );
- break;
-
- case TEL_HS_CROSS:
- fprintf( stdout, "TelInteriorStyleIndex. Value = CROSS\n" );
- break;
-
- case TEL_HS_CROSS_SPARSE:
- fprintf( stdout, "TelInteriorStyleIndex. Value = CROSS_SPARSE\n");
- break;
-
- case TEL_HS_GRID:
- fprintf( stdout, "TelInteriorStyleIndex. Value = GRID\n" );
- break;
-
- case TEL_HS_GRID_SPARSE:
- fprintf( stdout, "TelInteriorStyleIndex. Value = GRID_SPARSE\n" );
- break;
-
- case TEL_HS_DIAG_45:
- fprintf( stdout, "TelInteriorStyleIndex. Value = DIAG_45\n" );
- break;
-
- case TEL_HS_DIAG_135:
- fprintf( stdout, "TelInteriorStyleIndex. Value = DIAG_135\n" );
- break;
-
- case TEL_HS_HORIZONTAL:
- fprintf( stdout, "TelInteriorStyleIndex. Value = HORIZONTAL\n" );
- break;
-
- case TEL_HS_VERTICAL:
- fprintf( stdout, "TelInteriorStyleIndex. Value = VERTICAL\n" );
- break;
-
- case TEL_HS_DIAG_45_SPARSE:
- fprintf(stdout,"TelInteriorStyleIndex. Value = DIAG_45_SPARSE\n");
- break;
-
- case TEL_HS_DIAG_135_SPARSE:
- fprintf( stdout, "TelInteriorStyleIndex. Value = DIAG_135_SPARSE\n" );
- break;
-
- case TEL_HS_HORIZONTAL_SPARSE:
- fprintf( stdout,"TelInteriorStyleIndex. Value = HORIZONTAL_SPARSE\n");
- break;
-
- case TEL_HS_VERTICAL_SPARSE:
- fprintf( stdout, "TelInteriorStyleIndex. Value = VERTICAL_SPARSE\n" );
- break;
-
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-InteriorStyleIndexInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus LabelAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus LabelPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus LabelInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- 0, /* Display */
- LabelAdd,
- 0, /* Delete */
- LabelPrint,
- LabelInquire
-};
-
-
-MtblPtr
-TelLabelInitClass( TelType *el )
-{
- *el = TelLabel;
- return MtdTbl;
-}
-
-static TStatus
-LabelAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-LabelPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelLabel. Value = %d\n", data.ldata);
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-static TStatus
-LabelInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_qstrip :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus LightSrcStateDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus LightSrcStateAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus LightSrcStateDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus LightSrcStatePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus LightSrcStateInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- LightSrcStateDisplay,
- LightSrcStateAdd,
- LightSrcStateDelete,
- LightSrcStatePrint,
- LightSrcStateInquire
-};
-
-#define NO_TRACE_LIGHT
-
-MtblPtr
-TelLightSrcStateInitClass( TelType* el )
-{
- *el = TelLightSrcState;
- return MtdTbl;
-}
-
-static TStatus
-LightSrcStateAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tint i, num, *ptr;
- tel_tint_data data;
-
- num = k[0]->id;
- data = new TEL_TINT_DATA();
- if( !data )
- return TFailure;
- data->data = new int[num];
- if( !data->data )
- return TFailure;
-
- for( i=0, ptr=(Tint*)(k[0]->data.pdata); i<num; i++ )
- {
- data->data[i] = ptr[i];
- }
- data->num = num;
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-LightSrcStateDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_tint_data d = (tel_tint_data)data.pdata;
-
-#ifdef TRACE_LIGHT
- printf("OpenGl_lightstate::LightSrcStateDisplay:UpdateLight(%d)\n", TglActiveWs);
-#endif
- UpdateLight( TglActiveWs);
- return TSuccess;
-}
-
-static TStatus
-LightSrcStateDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- delete [] data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-LightSrcStatePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_tint_data p;
-
- p = (tel_tint_data)data.pdata;
-
- fprintf( stdout, "TelLightSrcState. Number: %d\n", p->num );
- for( i = 0; i < p->num; i++ )
- {
- fprintf( stdout, "\n\t\t v[%d] = %d", i, p->data[i] );
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-LightSrcStateInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_tint_data d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
-
- d = (tel_tint_data)data.pdata;
-
- size_reqd = d->num * sizeof( Tint );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- if( c->size >= size_reqd )
- {
- w->light_source_state.on.number = d->num;
- w->light_source_state.off.number = 0;
- w->light_source_state.on.integers = (Tint *)(c->buf);
- w->light_source_state.off.integers = 0;
-
- memcpy( w->light_source_state.on.integers, d->data, d->num*sizeof(Tint) );
- }
-
- break;
- }
- }
- }
- return status;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus LocalTran3Display( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus LocalTran3Add( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus LocalTran3Delete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus LocalTran3Print( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus LocalTran3Inquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- LocalTran3Display, /* PickTraverse */
- LocalTran3Display,
- LocalTran3Add,
- LocalTran3Delete,
- LocalTran3Print,
- LocalTran3Inquire
-};
-
-
-MtblPtr
-TelLocalTran3InitClass( TelType *el )
-{
- *el = TelLocalTran3;
- return MtdTbl;
-}
-
-static TStatus
-LocalTran3Add( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_matrix3_data data = new TEL_MATRIX3_DATA();
-
- //cmn_memreserve( data, 1, 0 );
-
- if( !data )
- return TFailure;
-
- data->mode = (TComposeType)(k[0]->id);
- matcpy( data->mat, k[0]->data.pdata );
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-LocalTran3Display( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_matrix3_data d;
- CMN_KEY key;
-
- d = (tel_matrix3_data)data.pdata;
-
- key.id = TelLocalTran3;
- key.data.pdata = d;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-LocalTran3Delete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- //cmn_freemem( data.pdata );
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-LocalTran3Print( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_matrix3_data d;
- Tint i;
-
- d = (tel_matrix3_data)data.pdata;
-
- fprintf( stdout, "TelLocalTran3. \n" );
- for( i=0; i<4; i++ )
- fprintf( stdout, "\t\t%12.7f %12.7f %12.7f %12.7f\n", d->mat[i][0],
- d->mat[i][1], d->mat[i][2], d->mat[i][3] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-LocalTran3Inquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_matrix3_data d;
-
- d = (tel_matrix3_data)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = 0;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = 0;
- w = c->data;
-
- w->local_xform_3.compose_type = d->mode;
- //cmn_memcpy( w->local_xform_3.mat3, d->mat, sizeof( Tmatrix3), 1 );
- memcpy( w->local_xform_3.mat3, d->mat, sizeof( Tmatrix3) );
- }
- }
- }
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_mrkr :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-08-07-96 : BGN ; (PRO4768) suppression du cas particulier TEL_PM_DOT.
-21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
-19-10-96 : CAL ; Restauration du cas particulier TEL_PM_DOT mais
-avec la correction sur la mise a jour du pointSize.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-extern GLuint GetListIndex(int);
-
-
-static TStatus MarkerDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus MarkerAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus MarkerDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus MarkerPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus MarkerInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*static GLboolean lighting_mode;*/
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- MarkerDisplay, /* PickTraverse */
- MarkerDisplay,
- MarkerAdd,
- MarkerDelete,
- MarkerPrint,
- MarkerInquire
-};
-
-
-MtblPtr
-TelMarkerInitClass( TelType *el )
-{
- *el = TelMarker;
- return MtdTbl;
-}
-
-static TStatus
-MarkerAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_point data = new TEL_POINT;
-
- if( !data )
- return TFailure;
-
- *data = *(tel_point)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-extern GLuint markerBase;
-static TStatus
-MarkerDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_point p;
- CMN_KEY key1, key2, key3;
- TEL_COLOUR colour;
- Tchar *str;
-
- key1.id = TelPolymarkerColour;
- key1.data.pdata = &colour;
-
- key2.id = TelPolymarkerType;
- key3.id = TelPolymarkerSize;
-
- TsmGetAttri( 3, &key1, &key2, &key3 );
-
- if( k[0]->id == TOn )
- { /* Use highlight colours */
- TEL_HIGHLIGHT hrep;
-
- key1.id = TelHighlightIndex;
- TsmGetAttri( 1, &key1 );
- if( TelGetHighlightRep( TglActiveWs, key1.data.ldata, &hrep )
- == TSuccess )
- colour = hrep.col;
- else
- {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- colour = hrep.col;
- }
- }
-
- glColor3fv( colour.rgb );
- p = (tel_point)data.pdata;
- if( key2.data.ldata == TEL_PM_DOT )
- {
- glPointSize( key3.data.fdata );
- glBegin( GL_POINTS );
- glVertex3fv( p->xyz );
- glEnd();
- }
- else
- {
- GLint mode;
- glGetIntegerv( GL_RENDER_MODE, &mode );
- if( key2.data.ldata == TEL_PM_USERDEFINED )
- {
- glRasterPos3f( (GLfloat)(p->xyz[0]),
- (GLfloat)(p->xyz[1]),
- (GLfloat)(p->xyz[2]) );
- glCallList( GetListIndex( (int)key3.data.fdata ) );
- }
- else
- {
- str = TelGetStringForPM( key2.data.ldata, key3.data.fdata );
- glRasterPos3f( (GLfloat)(p->xyz[0]), (GLfloat)(p->xyz[1]),
- (GLfloat)(p->xyz[2]) );
- glListBase(markerBase);
- glCallLists(strlen( (char*)str ), GL_UNSIGNED_BYTE, (GLubyte *) str );
- }
-
- if( mode==GL_FEEDBACK )
- {
- glBegin( GL_POINTS );
- glVertex3f( p->xyz[0], p->xyz[1], p->xyz[2] );
- glEnd();
- /* it is necessary to indicate end of marker information*/
- }
- }
-
- return TSuccess;
-}
-
-
-static TStatus
-MarkerDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-MarkerPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_point p;
-
- p = (tel_point)data.pdata;
-
- fprintf( stdout, "TelMarker. Value = %g, %g, %g\n",
- p->xyz[0], p->xyz[1], p->xyz[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-MarkerInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_point d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
-
- d = (tel_point)data.pdata;
-
- size_reqd = sizeof( TEL_POINT );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- if( c->size >= size_reqd )
- {
- w->pts3 = (tel_point)(c->buf);
- *(w->pts3) = *d;
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus PolymarkerColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerColourAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerColourDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerColourPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerColourInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- PolymarkerColourDisplay,
- PolymarkerColourAdd,
- PolymarkerColourDelete,
- PolymarkerColourPrint,
- PolymarkerColourInquire
-};
-
-
-MtblPtr
-TelPolymarkerColourInitClass( TelType *el )
-{
- *el = TelPolymarkerColour;
- return MtdTbl;
-}
-
-static TStatus
-PolymarkerColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_colour data = new TEL_COLOUR();
-
- //cmn_memreserve( data, 1, 0 );
- if( !data )
- return TFailure;
-
- *data = *(tel_colour)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-PolymarkerColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour d;
- CMN_KEY key;
-
- d = (tel_colour)data.pdata;
-
- key.id = TelPolymarkerColour;
- key.data.pdata = d;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolymarkerColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- //cmn_freemem( data.pdata );
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-PolymarkerColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour p;
-
- p = (tel_colour)data.pdata;
-
- fprintf( stdout, "TelPolymarkerColour. R = %g, G = %g, B = %g\n",
- p->rgb[0], p->rgb[1], p->rgb[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolymarkerColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_colour col;
-
- col = (tel_colour)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
-
- w->gnl_colour.rgb[0] = col->rgb[0];
- w->gnl_colour.rgb[1] = col->rgb[1];
- w->gnl_colour.rgb[2] = col->rgb[2];
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_mrkrset :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-08-07-96 : BGN ; (PRO4768) suppression du cas particulier TEL_PM_DOT.
-21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
-19-10-96 : CAL ; Restauration du cas particulier TEL_PM_DOT mais
-avec la correction sur la mise a jour du pointSize.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus MarkerSetDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus MarkerSetAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus MarkerSetDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus MarkerSetPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus MarkerSetInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-
-extern GLuint GetListIndex(int);
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- MarkerSetDisplay, /* PickTraverse */
- MarkerSetDisplay,
- MarkerSetAdd,
- MarkerSetDelete,
- MarkerSetPrint,
- MarkerSetInquire
-};
-
-
-MtblPtr
-TelMarkerSetInitClass( TelType* el )
-{
- *el = TelMarkerSet;
- return MtdTbl;
-}
-
-extern GLuint markerBase;
-static TStatus
-MarkerSetAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tint i, num;
- tel_point_data data;
- tel_point ptr;
-
- num = k[0]->id;
- data = new TEL_POINT_DATA();
- if( !data )
- return TFailure;
-
- data->data = new TEL_POINT[num];
- if( !data->data )
- return TFailure;
-
- for( i=0, ptr=(tel_point)(k[0]->data.pdata); i<num; i++ )
- {
- data->data[i] = ptr[i];
- }
- data->num = num;
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-MarkerSetDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_point_data d;
- tel_point ptr;
- Tint i;
- CMN_KEY key1, key2, key3;
- TEL_COLOUR colour;
- Tchar *str;
-
- key1.id = TelPolymarkerColour;
- key1.data.pdata = &colour;
-
- key2.id = TelPolymarkerType;
- key3.id = TelPolymarkerSize;
- TsmGetAttri( 3, &key1, &key2, &key3 );
-
- if( k[0]->id == TOn )
- { /* Use highlight colours */
- TEL_HIGHLIGHT hrep;
-
- key1.id = TelHighlightIndex;
- TsmGetAttri( 1, &key1 );
- if( TelGetHighlightRep( TglActiveWs, key1.data.ldata, &hrep )
- == TSuccess )
- colour = hrep.col;
- else
- {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- colour = hrep.col;
- }
- }
-
- glColor3fv( colour.rgb );
- d = (tel_point_data)data.pdata;
- ptr = d->data;
-
- if( key2.data.ldata == TEL_PM_DOT )
- {
- glPointSize( key3.data.fdata );
- glBegin( GL_POINTS );
- for( i=0; i<d->num; i++, ptr++ )
- glVertex3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] );
- glEnd();
- }
- else
- {
- GLint mode;
- glGetIntegerv( GL_RENDER_MODE, &mode );
-
- if( key2.data.ldata == TEL_PM_USERDEFINED )
- {
- for( i=0; i<d->num; i++, ptr++ )
- {
- glRasterPos3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] );
- glCallList( GetListIndex( (int)key3.data.fdata ) );
- if( mode==GL_FEEDBACK )
- {
- glBegin( GL_POINTS );
- glVertex3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] );
- glEnd();
- /* it is necessary to indicate end of marker information */
- }
- }
- }
- else
- {
- str = TelGetStringForPM( key2.data.ldata, key3.data.fdata );
- glListBase(markerBase);
- for( i=0; i<d->num; i++, ptr++ )
- {
- glRasterPos3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] );
- glCallLists(strlen( (char*)str ), GL_UNSIGNED_BYTE, (GLubyte *) str );
-
- if( mode==GL_FEEDBACK )
- {
- glBegin( GL_POINTS );
- glVertex3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] );
- glEnd();
- }
- }
- }
- }
-
- return TSuccess;
-}
-
-
-static TStatus
-MarkerSetDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-MarkerSetPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_point_data p;
-
- p = (tel_point_data)data.pdata;
-
- fprintf( stdout, "TelMarkerSet. Number of points: %d\n", p->num );
- for( i = 0; i < p->num; i++ )
- {
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, p->data[i].xyz[0],
- p->data[i].xyz[1], p->data[i].xyz[2] );
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-MarkerSetInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i, j;
- tel_point_data d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
-
- d = (tel_point_data)data.pdata;
-
- size_reqd = d->num * sizeof( TEL_POINT );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- if( c->size >= size_reqd )
- {
- w->pts3 = (tel_point)(c->buf);
-
- for( j = 0; j < d->num; j++ )
- w->pts3[j] = d->data[j];
-
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus PolymarkerSizeDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerSizeAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerSizeDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerSizePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerSizeInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- PolymarkerSizeDisplay,
- PolymarkerSizeAdd,
- PolymarkerSizeDelete,
- PolymarkerSizePrint,
- PolymarkerSizeInquire
-};
-
-
-MtblPtr
-TelPolymarkerSizeInitClass( TelType *el )
-{
- *el = TelPolymarkerSize;
- return MtdTbl;
-}
-
-static TStatus
-PolymarkerSizeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tfloat *data = new Tfloat();
- if( !data )
- return TFailure;
-
- *data = k[0]->data.fdata;
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-PolymarkerSizeDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelPolymarkerSize;
- key.data.fdata = *(Tfloat*)(data.pdata);
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolymarkerSizeDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-static TStatus
-PolymarkerSizePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelPolymarkerSize. Value = %g\n", *(Tfloat *)(data.pdata));
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolymarkerSizeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- Tfloat *f = (Tfloat *)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->fdata = *f;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus PolymarkerTypeDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerTypeAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerTypePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolymarkerTypeInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- PolymarkerTypeDisplay, /* PickTraverse */
- PolymarkerTypeDisplay,
- PolymarkerTypeAdd,
- 0, /* Delete */
- PolymarkerTypePrint,
- PolymarkerTypeInquire
-};
-
-
-MtblPtr
-TelPolymarkerTypeInitClass( TelType *el )
-{
- *el = TelPolymarkerType;
- return MtdTbl;
-}
-
-static TStatus
-PolymarkerTypeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-PolymarkerTypeDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelPolymarkerType;
- key.data.ldata = data.ldata;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolymarkerTypePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- switch( data.ldata )
- {
- case TEL_PM_PLUS:
- fprintf( stdout, "TelPolymarkerType. Value = PLUS\n" );
- break;
-
- case TEL_PM_STAR:
- fprintf( stdout, "TelPolymarkerType. Value = STAR\n" );
- break;
-
- case TEL_PM_CROSS:
- fprintf( stdout, "TelPolymarkerType. Value = CROSS\n" );
- break;
-
- case TEL_PM_CIRC:
- fprintf( stdout, "TelPolymarkerType. Value = CIRC\n" );
- break;
-
- case TEL_PM_DOT:
- fprintf( stdout, "TelPolymarkerType. Value = DOT\n" );
- break;
-
- case TEL_PM_USERDEFINED:
- fprintf( stdout, "TelPolymarkerType. Value = USERDEFINED\n" );
- break;
-
- default:
- fprintf( stdout, "TelPolymarkerType. Value = %d (UNKNOWN)",
- data.ldata );
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-static TStatus
-PolymarkerTypeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_pick :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-25-06-96 : FMN ; Suppression utilisation de glScissor.
-03-07-96 : FMN ; Suppression TelGetViewportAtLocation.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stdio.h>
-
-#include <GL/gl.h>
-
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_telem_pick.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_Memory.hxx>
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define ARRAY_GROW_SIZE 10
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-static GLuint *tgl_pick_buffer; /* buffer to be given to GL */
-static Tint tgl_pick_bufsize;
-
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-allocate( Tint *cur_size, Tint size_reqd, void **arr, Tint elem_size )
-{
- size_reqd = ( ( size_reqd / ARRAY_GROW_SIZE ) + 1 ) * ARRAY_GROW_SIZE;
-
- if( !( *cur_size ) ) {
- *arr = malloc( size_reqd * elem_size );
- memset( *arr, 0, size_reqd * elem_size );
- }
- else
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- *arr = realloc( *arr, size_reqd * elem_size );
-#else
- *arr = (void*)cmn_resizemem<char>( (char*)*arr, size_reqd * elem_size );
-#endif
-
- if( !(*arr) )
- return TFailure;
-
- *cur_size = size_reqd;
- return TSuccess;
-}
-
-static TStatus
-Initialize( Tint wsid, Tint *view_stid )
-{
- Tint depth;
- CMN_KEY_DATA key;
- Tint buf_siz_reqd = 0;
-
- TsmGetWSAttri( wsid, WSViewStid, &key );
- if( key.ldata == -1 )
- return TFailure;
-
- *view_stid = key.ldata;
- TsmGetStructureDepth( *view_stid, &depth );
-
- buf_siz_reqd = depth*6 + 2;
-
- if( tgl_pick_bufsize < buf_siz_reqd )
- {
- if( allocate( &tgl_pick_bufsize, buf_siz_reqd, (void **)&tgl_pick_buffer,
- sizeof( int ) ) == TFailure )
- return TFailure;
- }
-
- return TSuccess;
-}
-/*----------------------------------------------------------------------*/
-
-static void
-fill_pick_report( tel_pick_report rep, TPickOrder order, Tint depth )
-{
- Tint i, j;
- TEL_PACKED_NAME pn;
-
- rep->depth = tgl_pick_buffer[0]/6;
-
- if( order == TTopFirst )
- {
- for( i = 0, j = 3; i < ( Tint )(tgl_pick_buffer[0]/6) && i < depth; i++ )
- { /* skip hit numb. zmin, zmax -> j = 3 */
- pn.s[0] = tgl_pick_buffer[j++];
- pn.s[1] = tgl_pick_buffer[j++];
- rep->pick_path[i].struct_id = pn.i;
- pn.s[0] = tgl_pick_buffer[j++];
- pn.s[1] = tgl_pick_buffer[j++];
- rep->pick_path[i].pick_id = pn.i;
- pn.s[0] = tgl_pick_buffer[j++];
- pn.s[1] = tgl_pick_buffer[j++];
- rep->pick_path[i].el_num = pn.i;
- }
- }
- else
- {
- Tint is, js;
-
- is = rep->depth < depth ? rep->depth : depth;
- js = 3 + ( rep->depth - is )*6; /* skip hit numb. zmin, zmax -> j = 3 */
- is--;
-
- for( i = is, j = js; i >= 0; i-- )
- {
- pn.s[0] = tgl_pick_buffer[j++];
- pn.s[1] = tgl_pick_buffer[j++];
- rep->pick_path[i].struct_id = pn.i;
- pn.s[0] = tgl_pick_buffer[j++];
- pn.s[1] = tgl_pick_buffer[j++];
- rep->pick_path[i].pick_id = pn.i;
- pn.s[0] = tgl_pick_buffer[j++];
- pn.s[1] = tgl_pick_buffer[j++];
- rep->pick_path[i].el_num = pn.i;
- }
- }
-
- return;
-}
-/*----------------------------------------------------------------------*/
-
-Tint TglVpBeingPicked = -1;
-
-TStatus
-TPick( Tint Wsid, Tint x, Tint y, Tfloat apw, Tfloat aph,
- TPickOrder order, Tint depth, tel_pick_report rep )
-{
- Tint vid;
- TSM_ELEM_DATA data;
- CMN_KEY key;
- CMN_KEY_DATA key1;
- TEL_VIEW_REP ovrep, vrep;
-
- if( Initialize( Wsid, &(data.ldata) ) == TFailure )
- return TFailure;
-
- TglActiveWs = Wsid;
- key.id = Wsid;
-
- {
- /* TStatus stat; */
- Tfloat xsf, ysf, x1, x2, y1, y2, W, H, xm, xp, ym, yp, cx, cy;
- Tint err;
- TEL_VIEW_MAPPING map;
-
- vid = Wsid;
- TglVpBeingPicked = vid;
- TelGetViewRepresentation( Wsid, vid, &vrep );
- ovrep = vrep;
-
- TsmGetWSAttri( Wsid, WSWidth, &key1 );
- W = ( float )key1.ldata;
- TsmGetWSAttri( Wsid, WSHeight, &key1 );
- H = ( float )key1.ldata;
-
- xm = vrep.extra.map.window.xmax, xp = vrep.extra.map.window.xmin;
- ym = vrep.extra.map.window.ymax, yp = vrep.extra.map.window.ymin;
- cx = xm + xp, cx /= 2;
- cy = ym + yp, cy /= 2;
- x1 = x - apw/2, x2 = x1 + apw, y1 = y - aph/2, y2 = y1 + aph;
- xsf = xm - xp, xsf /= W;
- ysf = ym - yp, ysf /= H;
- x1 = xsf * x1 + xp;
- y1 = ysf * y1 + yp;
- x2 = xsf * x2 + xp;
- y2 = ysf * y2 + yp;
-
- map = vrep.extra.map;
- map.window.xmin = x1, map.window.xmax = x2;
- map.window.ymin = y1, map.window.ymax = y2;
- TelEvalViewMappingMatrixPick( &map, &err, vrep.mapping_matrix, cx, cy );
- if( err )
- printf( "Error in Mapping pick\n" );
-
- if( TelSetViewRepresentation( Wsid, vid, &vrep ) == TFailure )
- printf( "Error in Set vrep for pick\n" );
- }
-
- glMatrixMode(GL_MODELVIEW);
- tgl_pick_buffer[0] = 0;
- glSelectBuffer( tgl_pick_bufsize , tgl_pick_buffer);
- glRenderMode(GL_SELECT);
- glLoadName(55);
- TsmSendMessage( TelExecuteStructure, PickTraverse, data, 1, &key );
- glRenderMode(GL_RENDER);
- TglVpBeingPicked = -1;
-
- /* print( ); */
- fill_pick_report( rep, order, depth );
- TelSetViewRepresentation( Wsid, vid, &ovrep );
-
- return TSuccess;
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus PickIdAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PickIdPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PickIdInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- 0, /* Display */
- PickIdAdd,
- 0, /* Delete */
- PickIdPrint,
- PickIdInquire
-};
-
-
-MtblPtr
-TelPickIdInitClass( TelType *el )
-{
- *el = TelPickId;
- return MtdTbl;
-}
-
-
-static TStatus
-PickIdAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-PickIdPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelPickId. Value = %d\n", data.ldata);
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-static TStatus
-PickIdInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_polygon :
-
-
-REMARQUES:
-----------
-
-Le culling et le backfacing ne marchent pas.
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-28-06-96 : GG ; Auto checking of the polygon facet normal with
-the order of the points (OPTIM)
-09-08-96 : FMN ; Suppression appel glMatrixMode() avant glGetFloatv()
-28-02-97 : FMN ; Suppression OpenGl_telem_light.h
-18-07-97 : FMN ; Ajout desactivation des lights suivant front_lighting_model
-21-07-97 : FMN ; Amelioration des performances OPTIMISATION_FMN
-- suppression calcul inutile sur les front faces
-27-08-97 : FMN ; Correction affichage des edges
-On n'affiche que les edges dans le mode IS_EMPTY
-10-09-97 : FMN ; Amelioration des perfs liees aux lights.
-15-09-97 : PCT ; Ajout coordonnees textures
-24-09-97 : FMN ; Suppression OPTIMISATION_FMN.
-08-12-97 : FMN ; Suppression appel TsmGetAttri inutile.
-31-12-97 : FMN ; Simplification pour le highlight
-15-01-98 : FMN ; Ajout Hidden line
-18-06-98 : CAL ; Correction PRO14340. Patch K4198 et K4199
-08-03-01 : GG ; BUC60823 Avoid crash in the normal computation method
-on confuse point.
-
-************************************************************************/
-
-#define G003 /* EUG 22-09-99 Degeneration management
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_Extension.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_TextureBox.hxx>
-#include <OpenGl_Memory.hxx>
-
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#ifndef WNT
-# define CALLBACK
-#if !defined(APIENTRY)
-# define APIENTRY
-#endif // APIENTRY
-# define STATIC static
-#else
-# include <GL\GLU.H>
-#define STATIC
-typedef double GLUcoord;
-#endif /* WNT */
-
-#ifdef G003
-extern int g_nDegenerateModel;
-#endif /* G003 */
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions statiques
-*/
-
-static TStatus PolygonDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */
-
-/*----------------------------------------------------------------------*/
-/*
-* Definition de types
-*/
-
-struct EXTRA_VERTEX
-{
- GLfloat vert[3];
- int ind;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef EXTRA_VERTEX* extra_vertex;
-
-struct SEQ_
-{
- Tint ts_num, ts_alloc;
- void **tmesh_sequence;
- GLenum triangle_type; /* FSXXX OPTI */
- IMPLEMENT_MEMORY_OPERATORS
-};
-
-struct DISPLAY_
-{
- Tint num_of_seq;
- Tint num_alloc;
- SEQ_ *seq;
- IMPLEMENT_MEMORY_OPERATORS
-};
-
-struct TEL_POLYGON_DATA
-{
- Tint num_vertices; /* Number of vertices */
- Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */
- Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */
- Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or
- TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */
- GLboolean reverse_order; /* GL_TRUE if polygon vertex must be display in reverse order */
- TEL_POINT fnormal; /* Facet normal */
- tel_colour fcolour; /* Facet colour */
- tel_point vertices; /* Vertices */
- tel_colour vcolours; /* Vertex colour values */
- tel_point vnormals; /* Vertex normals */
- tel_texture_coord vtexturecoord; /* Texture Coordinates */
- DISPLAY_ *display; /* FSXXX OPTI */
- GLuint triangle_dl1; /* triangle display list 1 */
- GLuint triangle_dl2; /* triangle display list 2 */
- GLuint triangle_dl3; /* triangle display list 3 */
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_POLYGON_DATA *tel_polygon_data;
-
-static TEL_POLYGON_DATA polygon_defaults =
-{
- 0, /* num_vertices */
- TEL_FA_NONE, /* facet_flag */
- TEL_VT_NONE, /* vertex_flag */
- TEL_SHAPE_UNKNOWN, /* shape_flag */
- GL_FALSE, /* reverse_order */
- {{ ( float )0.0, ( float )0.0, ( float )0.0 }}, /* fnormal */
- 0, /* fcolour */
- 0, /* vertices */
- 0, /* vcolours */
- 0, /* vnormals */
- 0, /* vtexturecoord */
- 0, /* display */
- 0, /* triangle_dl1 */
- 0, /* triangle_dl2 */
- 0 /* triangle_dl3 */
-};
-
-
-static void bgntriangulate( tel_polygon_data, void (APIENTRY*)() );
-static void endtriangulate(void);
-static void draw_tmesh( tel_polygon_data, Tint );
-static void draw_polygon( tel_polygon_data, Tint, Tint );
-static void draw_polygon_concav( tel_polygon_data, Tint, Tint );
-
-#if !defined(GLU_VERSION_1_2)
-#define GLUtesselator GLUtriangulatorObj
-void gluTessBeginContour();
-void gluTessBeginPolygon();
-void gluTessEndPolygon();
-void gluTessEndContour();
-#endif
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- PolygonDisplay, /* PickTraverse */
- PolygonDisplay,
- PolygonAdd,
- PolygonDelete,
- PolygonPrint,
- PolygonInquire
-};
-
-static void draw_edges( tel_polygon_data, tel_colour, Tint);
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr
-TelPolygonInitClass( TelType* el )
-{
- *el = TelPolygon;
- return MtdTbl;
-}
-/*----------------------------------------------------------------------*/
-
-static TStatus
-PolygonAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tint i, j;
- tel_polygon_data data;
-
- for( i = 0; i < n; i++ )
- {
- if( k[i]->id == NUM_VERTICES_ID )
- break;
- }
- if( i == n )
- return TFailure;
-
- if( !(k[i]->data.ldata) )
- return TFailure;
-
- for( j = 0; j < n; j++ )
- {
- if( k[j]->id == VERTICES_ID )
- break;
- }
- if( j == n )
- return TFailure;
-
- data = new TEL_POLYGON_DATA();
- if( !data )
- return TFailure;
-
- /* load defaults */
- memcpy( data, &polygon_defaults, sizeof(TEL_POLYGON_DATA) );
-
- data->num_vertices = k[i]->data.ldata;
- data->vertices = new TEL_POINT[data->num_vertices];
- memcpy( data->vertices, k[j]->data.pdata, data->num_vertices*sizeof(TEL_POINT) );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case FNORMALS_ID:
- data->facet_flag = TEL_FA_NORMAL;
- memcpy( &data->fnormal, k[i]->data.pdata, sizeof(TEL_POINT) );
- vecnrm( data->fnormal.xyz );
- break;
-
- case FACET_COLOUR_VALS_ID:
- data->fcolour = new TEL_COLOUR();
- memcpy( data->fcolour, k[i]->data.pdata, sizeof(TEL_COLOUR) );
- break;
-
- case VERTEX_COLOUR_VALS_ID:
- data->vcolours = new TEL_COLOUR[data->num_vertices];
- memcpy( data->vcolours, k[i]->data.pdata, data->num_vertices*sizeof(TEL_COLOUR) );
- break;
-
- case VNORMALS_ID:
- data->vertex_flag = TEL_VT_NORMAL;
- data->vnormals = new TEL_POINT[data->num_vertices];
- memcpy( data->vnormals, k[i]->data.pdata, data->num_vertices*sizeof(TEL_POINT) );
- for( j = 0; j < data->num_vertices; j++ )
- vecnrm( data->vnormals[j].xyz );
- break;
-
- case SHAPE_FLAG_ID:
- data->shape_flag = k[i]->data.ldata;
- break;
-
- case VTEXTURECOORD_ID:
- data->vtexturecoord = new TEL_TEXTURE_COORD[data->num_vertices];
- memcpy( data->vtexturecoord, k[i]->data.pdata, data->num_vertices*sizeof(TEL_TEXTURE_COORD) );
- break;
- }
- }
-
- if( data->facet_flag != TEL_FA_NORMAL ) {
-#ifdef BUC60823
- TelGetPolygonNormal( data->vertices, NULL,
- data->num_vertices, data->fnormal.xyz );
-#else
- TelGetNormal( data->vertices[0].xyz, data->vertices[1].xyz,
- data->vertices[2].xyz, data->fnormal.xyz );
- vecnrm( data->fnormal.xyz );
-#endif
- }
- else
- {
- TEL_POINT fnormal; /* Facet normal */
- Tfloat sens;
-#ifdef BUC60823
- TelGetPolygonNormal( data->vertices, NULL,
- data->num_vertices, fnormal.xyz );
-#else
- TelGetNormal( data->vertices[0].xyz, data->vertices[1].xyz,
- data->vertices[2].xyz, fnormal.xyz );
-#endif
- sens = fnormal.xyz[0]*data->fnormal.xyz[0] +
- fnormal.xyz[1]*data->fnormal.xyz[1] +
- fnormal.xyz[2]*data->fnormal.xyz[2];
- if( sens < 0. ) data->reverse_order = GL_TRUE;
- }
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- /* s'il n'est pas convexe, le polygone est triangule de la meme maniere
- que les polygones a trous */
- /* Pourrait etre place en tete de routine pour optimisation si je
- savais recuperer le shape_flag a partir de d sans reconstruire data (!) */
-
- /* FSXXX
- if( data->shape_flag != TEL_SHAPE_CONVEX )
- return(PolygonHolesAdd( d, n, k ));
- */
-
- return TSuccess;
-}
-/*----------------------------------------------------------------------*/
-
-static TStatus
-PolygonDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- /* Tint front_face = 1;*/
- CMN_KEY k11, k12, k17, k111, k114;
-
- Tint front_lighting_model;
- Tint interior_style;
- TEL_COLOUR interior_colour;
- TEL_COLOUR edge_colour;
-
- tel_polygon_data d;
-
- k12.id = TelInteriorReflectanceEquation;
- k17.id = TelInteriorStyle;
- k111.id = TelInteriorColour;
- k111.data.pdata = &interior_colour;
- k114.id = TelEdgeColour;
- k114.data.pdata = &edge_colour;
-
- TsmGetAttri( 4, &k12, &k17, &k111, &k114);
-
- front_lighting_model = k12.data.ldata;
- interior_style = k17.data.ldata;
-
-#ifdef PRINT
- printf("PolygonDisplay \n");
-#endif
-
- /*
- * Use highlight colours
- */
-
- if( k[0]->id == TOn )
- {
- TEL_HIGHLIGHT hrep;
-
- k11.id = TelHighlightIndex;
- TsmGetAttri( 1, &k11 );
- if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep ) == TSuccess )
- {
- if( hrep.type == TelHLForcedColour )
- {
- interior_colour = hrep.col;
- edge_colour = hrep.col;
- front_lighting_model = CALL_PHIGS_REFL_NONE;
- }
- else
- k[0]->id = TOff;
- }
- else
- {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- if( hrep.type == TelHLForcedColour )
- {
- interior_colour = hrep.col;
- edge_colour = hrep.col;
- front_lighting_model = CALL_PHIGS_REFL_NONE;
- }
- else
- k[0]->id = TOff;
- }
- }
-
- d = (tel_polygon_data)data.pdata;
-#ifdef G003
-
- if( interior_style != TSM_EMPTY && g_nDegenerateModel < 2 )
-#else
- if( interior_style != TSM_EMPTY )
-#endif /*G003*/
- {
- if (front_lighting_model == CALL_PHIGS_REFL_NONE)
- LightOff();
- else LightOn();
-
- glColor3fv( interior_colour.rgb );
-
- if( d->shape_flag != TEL_SHAPE_CONVEX )
- draw_polygon_concav( d, front_lighting_model, k[0]->id );
- else
- draw_polygon( d, front_lighting_model, k[0]->id );
- }
-
-#ifdef G003
- /* OCC11904 -- Temporarily disable environment mapping */
- glPushAttrib(GL_ENABLE_BIT);
- glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
-
- switch ( g_nDegenerateModel ) {
-
-default:
-case 0: /* no degeneration */
- draw_edges ( d, &edge_colour, interior_style );
- break;
-case 2: /* wireframe degeneration */
-
-#ifdef xG003 /* GG260100 use interior color instead edge color */
- draw_edges ( d, &interior_colour, interior_style );
-#else
- draw_edges ( d, &edge_colour, interior_style );
-#endif
- break;
-
-case 3: /* marker degeneration */
-
- break;
-
- } /* end switch */
-
- glPopAttrib(); /* skt: GL_ENABLE_BIT*/
-#else
- draw_edges( d, &edge_colour, interior_style );
- /*skt: It is not correct to pop attributes here*/
- /*glPopAttrib();*/
-#endif /*G003*/
- return TSuccess;
-
-}
-/*----------------------------------------------------------------------*/
-
-static void
-draw_polygon( tel_polygon_data d, Tint front_lighting_model, Tint hflag )
-{
- Tint i;
-
- tel_point ptr;
- tel_point pvn;
- tel_colour pfc, pvc;
- tel_texture_coord pvt;
-
- pfc = d->fcolour;
- pvc = d->vcolours;
- pvn = d->vnormals;
- pvt = d->vtexturecoord;
-
- if( hflag ) pvc = pfc = NULL;
-
- ptr = d->vertices;
- if( pfc )
- glColor3fv( pfc->rgb );
- if( front_lighting_model != CALL_PHIGS_REFL_NONE )
- glNormal3fv( d->fnormal.xyz );
-
- if( d->reverse_order ) glFrontFace( GL_CW );
-
- if (d->num_vertices == 3) glBegin(GL_TRIANGLES);
- else if(d->num_vertices == 4) glBegin(GL_QUADS);
- else glBegin(GL_POLYGON);
- if( front_lighting_model == CALL_PHIGS_REFL_NONE )
- {
- if( pvc )
- {
- for( i=0; i<d->num_vertices; i++, ptr++ )
- {
- glColor3fv( pvc[i].rgb );
- glVertex3fv( ptr->xyz );
- }
- }
- else
- {
- for( i=0; i<d->num_vertices; i++, ptr++ )
- {
- glVertex3fv( ptr->xyz );
- }
- }
- }
- else
- {
- if( pvn )
- {
- if (pvt && !ForbidSetTextureMapping)
- for( i=0; i<d->num_vertices; i++, ptr++ )
- {
- glNormal3fv( pvn[i].xyz );
- glTexCoord2fv( pvt[i].xy );
- glVertex3fv( ptr->xyz );
- }
- else
- for( i=0; i<d->num_vertices; i++, ptr++ )
- {
- glNormal3fv( pvn[i].xyz );
- glVertex3fv( ptr->xyz );
- }
- }
- else
- {
- for( i=0; i<d->num_vertices; i++, ptr++ )
- {
- glVertex3fv( ptr->xyz );
- }
- }
- }
- glEnd();
- if( d->reverse_order ) glFrontFace( GL_CCW );
-
-}
-
-/*----------------------------------------------------------------------*/
-
-/* JWR - allow varying the size */
-
-#define INCREMENT 8
-
-static int seq_increment = INCREMENT;
-
-tel_polygon_data DaTa;
-static GLUtesselator *tripak = 0;
-
-STATIC void APIENTRY
-out_bgntmesh( GLenum triangle_type )
-{
- DISPLAY_ *dis;
- dis = DaTa->display;
-
- dis->num_of_seq++;
- if( dis->num_alloc < dis->num_of_seq )
- {
- dis->num_alloc += seq_increment;
-
- if( dis->seq == 0 )
- {
- dis->seq = new SEQ_[dis->num_alloc];
- }
- else
- {
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- dis->seq = (SEQ_*)realloc( dis->seq, dis->num_alloc*sizeof(SEQ_) );
-#else
- dis->seq = cmn_resizemem<SEQ_>( dis->seq, dis->num_alloc );
-#endif
- }
- }
- dis->seq[ dis->num_of_seq - 1 ].ts_num = 0;
- dis->seq[ dis->num_of_seq - 1 ].ts_alloc = 0;
- dis->seq[ dis->num_of_seq - 1 ].tmesh_sequence = 0;
-
-#ifdef JWR_DEC_TRIFAN_BUG
- dis->seq[ dis->num_of_seq - 1 ].triangle_type = GL_POLYGON;
- glBegin(GL_POLYGON);
-#else
- dis->seq[ dis->num_of_seq - 1 ].triangle_type = triangle_type;
- glBegin(triangle_type);
-#endif
-}
-
-/*----------------------------------------------------------------------*/
-
-STATIC void APIENTRY
-out_vert1( void *data )
-{
- SEQ_ *s;
-
- s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] );
-
- s->ts_num++;
- if( s->ts_alloc < s->ts_num )
- {
- s->ts_alloc += seq_increment;
-
- if( s->tmesh_sequence == 0 )
- {
- s->tmesh_sequence = new void*[s->ts_alloc];
- }
- else
- {
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- s->tmesh_sequence = (void**)realloc( s->tmesh_sequence, s->ts_alloc*sizeof(void*));
-#else
- s->tmesh_sequence = cmn_resizemem<void*>( s->tmesh_sequence, s->ts_alloc);
-#endif
- }
- }
- s->tmesh_sequence[ s->ts_num - 1 ] = data;
-
-
- if ( data < (void *)0xffff ) {
- long a = (long)data;
-
- glVertex3fv( DaTa->vertices[a].xyz );
- }
- else {
- extra_vertex b = (extra_vertex) data;
-
-#ifdef TRACE
- printf("combine1 %e %e %e %d\n",
- b->vert[0], b->vert[1], b->vert[2], (b->ind));
-#endif
- glVertex3fv( b->vert );
- }
-
-}
-
-/*----------------------------------------------------------------------*/
-
-STATIC void APIENTRY
-out_vert2( void *data )
-{
- SEQ_ *s;
-
- s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] );
-
- s->ts_num++;
- if( s->ts_alloc < s->ts_num )
- {
- s->ts_alloc += seq_increment;
-
- if( s->tmesh_sequence == 0 )
- {
- s->tmesh_sequence = new void*[s->ts_alloc];
- }
- else
- {
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- s->tmesh_sequence = (void**)( s->tmesh_sequence,
- s->ts_alloc*sizeof(void*) );
-#else
- s->tmesh_sequence = cmn_resizemem<void*>( s->tmesh_sequence,
- s->ts_alloc );
-#endif
- }
- }
- s->tmesh_sequence[ s->ts_num - 1 ] = data;
-
- if ( data < (void *)0xffff ) {
- long a = (long)data;
-
- glColor3fv( DaTa->vcolours[a].rgb );
- glVertex3fv( DaTa->vertices[a].xyz );
- }
- else {
- extra_vertex b = (extra_vertex) data;
-
- printf("combine2 %e %e %e %d\n",b->vert[0], b->vert[1], b->vert[2], (b->ind));
- glColor3fv( DaTa->vcolours[(b->ind)].rgb );
- glVertex3fv( b->vert );
- }
-
-}
-
-/*----------------------------------------------------------------------*/
-
-STATIC void APIENTRY
-out_vert3( void *data )
-{
- SEQ_ *s;
-
- s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] );
-
- s->ts_num++;
- if( s->ts_alloc < s->ts_num )
- {
- s->ts_alloc += seq_increment;
-
- if( s->tmesh_sequence == 0 )
- {
- s->tmesh_sequence = new void*[s->ts_alloc];
- }
- else
- {
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- s->tmesh_sequence = (void**)realloc( s->tmesh_sequence,
- s->ts_alloc*sizeof(void*) );
-#else
- s->tmesh_sequence = cmn_resizemem<void*>( s->tmesh_sequence,
- s->ts_alloc );
-#endif
- }
- }
- s->tmesh_sequence[ s->ts_num - 1 ] = data;
-
- if ( data <= (void *)0xffff ) {
- long a = (long)data;
-
- glNormal3fv( DaTa->vnormals[a].xyz );
- glVertex3fv( DaTa->vertices[a].xyz);
- }
- else {
- extra_vertex b = (extra_vertex) data;
-
- printf("combine3 %e %e %e %d\n", b->vert[0], b->vert[1], b->vert[2], (b->ind));
- glNormal3fv( DaTa->vnormals[(b->ind)].xyz );
- glVertex3fv( b->vert );
- }
-
-}
-
-/*----------------------------------------------------------------------*/
-
-STATIC void APIENTRY
-mycombine( GLdouble coords[3], int *data, GLfloat w[4], void **dataout)
-{
- extra_vertex new_vertex;
-
- new_vertex = (extra_vertex) malloc(sizeof(EXTRA_VERTEX));
-
- new_vertex->vert[0] = ( float )coords[0];
- new_vertex->vert[1] = ( float )coords[1];
- new_vertex->vert[2] = ( float )coords[2];
- new_vertex->ind = *data;
- *dataout = new_vertex;
-#ifdef TRACE
- printf("mycombine3 %e %e %e\n",
- new_vertex->vert[0],
- new_vertex->vert[1],
- new_vertex->vert[2],
- new_vertex->ind);
- printf("weights: %f %f %f %f\n",
- w[0], w[1], w[2], w[3]);
-#endif
-}
-
-/*----------------------------------------------------------------------*/
-
-STATIC void APIENTRY
-out_endtmesh( void )
-{
- glEnd();
-}
-
-/*----------------------------------------------------------------------*/
-
-STATIC void APIENTRY
-out_error( GLenum error )
-{
- printf( "POLYGON : %s\n", (char *) gluErrorString(error) );
-}
-
-/*----------------------------------------------------------------------*/
-
-static void
-bgntriangulate(tel_polygon_data d, void ( APIENTRY * out_ver)() )
-{
- DaTa = d;
- if( !DaTa->display )
- DaTa->display = new DISPLAY_();
-
- tripak = gluNewTess();
-
-#if defined(linux) && !defined(NOGLUfuncptr)
- gluTessCallback( tripak, GLU_TESS_BEGIN, (_GLUfuncptr)(out_bgntmesh) );
- gluTessCallback( tripak, GLU_TESS_VERTEX, out_ver );
- gluTessCallback( tripak, GLU_TESS_END, out_endtmesh );
- gluTessCallback( tripak, GLU_TESS_ERROR, (_GLUfuncptr)(out_error) );
- gluTessCallback( tripak, GLU_TESS_COMBINE, (_GLUfuncptr)(mycombine) );
-#else
- gluTessCallback( tripak, GLU_TESS_BEGIN, (void (APIENTRY*)())out_bgntmesh );
- gluTessCallback( tripak, GLU_TESS_VERTEX, (void (APIENTRY*)())out_ver );
- gluTessCallback( tripak, GLU_TESS_END, (void (APIENTRY*)())out_endtmesh );
- gluTessCallback( tripak, GLU_TESS_ERROR, (void (APIENTRY*)())out_error );
- gluTessCallback( tripak, GLU_TESS_COMBINE, (void (APIENTRY*)())mycombine );
-#endif
-}
-
-/*----------------------------------------------------------------------*/
-
-static void
-endtriangulate()
-{
- DaTa = 0;
- gluDeleteTess(tripak);
-}
-
-/*----------------------------------------------------------------------*/
-
-static void
-draw_polygon_concav( tel_polygon_data d, Tint front_lighting_model, Tint hflag )
-{
- long i;
-
- tel_point pvn;
- tel_point ptr;
- tel_colour pfc, pvc;
- GLdouble xyz[3];
-
- pfc = d->fcolour;
- pvc = d->vcolours;
- pvn = d->vnormals;
-
- if( hflag )
- {
- pvc = pfc = NULL;
- }
-
- ptr = d->vertices;
- DaTa = d;
-
- if( pfc )
- glColor3fv( pfc->rgb );
- if( front_lighting_model != CALL_PHIGS_REFL_NONE )
- glNormal3fv( d->fnormal.xyz );
-
- if( d->reverse_order ) glFrontFace( GL_CW );
-
- if( d->display == 0 )
- {
-
- if( front_lighting_model == CALL_PHIGS_REFL_NONE )
- {
- if( pvc )
- {
- bgntriangulate(d, (void (APIENTRY*)())out_vert2);
- }
- else
- {
- bgntriangulate(d, (void (APIENTRY*)())out_vert1);
- }
- }
- else
- {
- if( pvn )
- {
- bgntriangulate(d, (void (APIENTRY*)())out_vert3);
- }
- else
- {
- bgntriangulate(d, (void (APIENTRY*)())out_vert1);
- }
- }
- gluTessBeginPolygon( tripak, NULL );
- gluTessBeginContour( tripak);
-
- for( i=0; i<d->num_vertices; i++, ptr++ )
- {
- xyz[0] = ptr->xyz[0];
- xyz[1] = ptr->xyz[1];
- xyz[2] = ptr->xyz[2];
-#ifndef WNT
- gluTessVertex( tripak, xyz,(void * ) i );
-#else
- {
- double v[ 3 ] = {ptr -> xyz[ 0 ], ptr -> xyz[ 1 ], ptr -> xyz[ 2 ]};
- gluTessVertex ( tripak, v, ( void* )i );
- }
-#endif /* WNT */
- }
- gluTessEndContour( tripak);
- gluTessEndPolygon( tripak );
- endtriangulate();
- }
- else
- {
- if( front_lighting_model == CALL_PHIGS_REFL_NONE )
- {
- if( pvc ) draw_tmesh( d, 2 );
- else draw_tmesh( d, 1 );
- }
- else
- {
- if( pvn ) draw_tmesh( d, 3 );
- else draw_tmesh( d, 1 );
- }
- }
-
- if( d->reverse_order ) glFrontFace( GL_CCW );
-}
-
-/*----------------------------------------------------------------------*/
-
-static void
-draw_tmesh( tel_polygon_data d, Tint v )
-{
- Tint i, j, k;
- DISPLAY_ *dis;
- SEQ_ *s;
- extra_vertex b;
-
- dis = d->display;
- for( i = 0; i < dis->num_of_seq; i++ )
- {
- s = &(dis->seq[i]);
-
- glBegin(s->triangle_type);
- switch( v )
- {
- case 1:
- {
- for( j = 0, k = 0; j < s->ts_num; j++ )
- {
- if ( s->tmesh_sequence[j] < (void *)0xffff )
- glVertex3fv( d->vertices[ (long)s->tmesh_sequence[ j ] ].xyz );
- else {
- extra_vertex b = (extra_vertex)s->tmesh_sequence[j];
- glVertex3fv( b->vert );
- }
-
- }
- break;
- }
- case 2:
- {
- for( j = 0, k = 0; j < s->ts_num; j++ )
- {
- if ( s->tmesh_sequence[j] < (void *)0xffff ) {
- glColor3fv( d->vcolours[ (long) s->tmesh_sequence[ j ] ].rgb );
- glVertex3fv( d->vertices[ (long) s->tmesh_sequence[ j ] ].xyz );
- } else {
- b = (extra_vertex) s->tmesh_sequence[j];
- glColor3fv( d->vcolours[(b->ind)].rgb);
- glVertex3fv( b->vert );
- }
- }
- break;
- }
- case 3:
- {
- for( j = 0, k = 0; j < s->ts_num; j++ )
- {
- if ( s->tmesh_sequence[j] < (void *)0xffff ) {
- glNormal3fv( d->vnormals[ (long) s->tmesh_sequence[ j ] ].xyz);
- glVertex3fv( d->vertices[ (long) s->tmesh_sequence[ j ] ].xyz);
- } else {
- b = (extra_vertex) s->tmesh_sequence[j];
- glNormal3fv( d->vnormals[(b->ind)].xyz);
- glVertex3fv( b->vert );
- }
- }
- break;
- }
- }
- glEnd();
- }
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-PolygonDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_polygon_data p = (tel_polygon_data)data.pdata;
- if( p->fcolour ) //cmn_freemem( p->fcolour );
- delete p->fcolour;
- if( p->vertices )// cmn_freemem( p->vertices );
- delete[] p->vertices;
- if( p->vcolours ) //cmn_freemem( p->vcolours );
- delete[] p->vcolours;
- if( p->vnormals ) //cmn_freemem( p->vnormals );
- delete[] p->vnormals;
- if (p->vtexturecoord) //cmn_freemem( p->vtexturecoord);
- delete p->vtexturecoord;
-
- if(p->display)
- {
- Tint i, j;
-
- for( i = 0; i < p->display->num_of_seq; i++ )
- {
- if(p->display->seq[i].tmesh_sequence) {
- for ( j = 0; j < p->display->seq[i].ts_num ; j++ ) {
- if ( p->display->seq[i].tmesh_sequence[j] >= (void *)0xffff )
- free(p->display->seq[i].tmesh_sequence[j]);
- }
- }
- delete[] p->display->seq[i].tmesh_sequence;
- }
- delete[] p->display->seq;
- delete p->display;
- }
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-PolygonPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_polygon_data p = (tel_polygon_data)data.pdata;
-
- fprintf( stdout, "TelPolygon. Number of points: %d\n", p->num_vertices );
- switch( p->shape_flag )
- {
- case TEL_SHAPE_UNKNOWN:
- fprintf( stdout, "\t\tShape Flag : UNKNOWN\n" );
- break;
-
- case TEL_SHAPE_COMPLEX:
- fprintf( stdout, "\t\tShape Flag : COMPLEX\n" );
- break;
-
- case TEL_SHAPE_CONCAVE:
- fprintf( stdout, "\t\tShape Flag : CONCAVE\n" );
- break;
-
- case TEL_SHAPE_CONVEX:
- fprintf( stdout, "\t\tShape Flag : CONVEX\n" );
- break;
-
- }
- switch( p->facet_flag )
- {
- case TEL_FA_NONE:
- if( p->fcolour )
- fprintf( stdout, "\t\tFacet Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tFacet Flag : NONE\n" );
- break;
-
- case TEL_FA_NORMAL:
- if( p->fcolour )
- fprintf( stdout, "\t\tFacet Flag : COLOURNORMAL\n" );
- else
- fprintf( stdout, "\t\tFacet Flag : NORMAL\n" );
- break;
- }
- switch( p->vertex_flag )
- {
- case TEL_VT_NONE:
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NONE\n" );
- break;
-
- case TEL_VT_NORMAL:
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOURNORMAL\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NORMAL\n" );
- break;
- }
- fprintf( stdout, "\t\tFacet Normal : %g %g %g\n", p->fnormal.xyz[0],
- p->fnormal.xyz[1],
- p->fnormal.xyz[2] );
- fprintf( stdout, "\t\tReverse order : %d\n", p->reverse_order);
-
- if( p->fcolour )
- fprintf( stdout, "\t\tFacet Colour : %g %g %g\n", p->fcolour->rgb[0],
- p->fcolour->rgb[1],
- p->fcolour->rgb[2] );
- else
- fprintf( stdout, "\n\t\tFacet Colour not specified\n" );
-
- if( p->vertices )
- {
- fprintf( stdout, "\n\t\tVertices : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vertices[i].xyz[0],
- p->vertices[i].xyz[1],
- p->vertices[i].xyz[2] );
- }
-
- fprintf( stdout, "\n" );
- if( p->vcolours )
- {
- fprintf( stdout, "\n\t\tVertex Colours : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vcolours[i].rgb[0],
- p->vcolours[i].rgb[1],
- p->vcolours[i].rgb[2] );
- }
- else
- fprintf( stdout, "\n\t\tVertex Colours not specified\n" );
-
- if( p->vnormals )
- {
- fprintf( stdout, "\n\t\tVertex Normals : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vnormals[i].xyz[0],
- p->vnormals[i].xyz[1],
- p->vnormals[i].xyz[2] );
- }
- else
- fprintf( stdout, "\n\t\tVertex Normals not specified\n" );
-
- if (p->vtexturecoord)
- {
- fprintf(stdout, "\n\t\tTexture Coordinates : ");
- for (i=0; i<p->num_vertices; i++)
- fprintf(stdout, "\n\t\t v[%d] = %g %g", i,
- p->vtexturecoord[i].xy[0],
- p->vtexturecoord[i].xy[1]);
- }
- else
- fprintf( stdout, "\n\t\tTexture Coordinates not specified\n");
-
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-PolygonInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i, j;
- tel_polygon_data d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
- Tchar *cur_ptr = 0;
-
- d = (tel_polygon_data)data.pdata;
-
- if( d->fcolour )
- size_reqd += sizeof( TEL_COLOUR );
-
- if( d->facet_flag == TEL_FA_NORMAL )
- size_reqd += sizeof( TEL_POINT );
-
- size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- if( d->vcolours )
- size_reqd += ( d->num_vertices * sizeof( TEL_COLOUR ) );
-
- if( d->vertex_flag == TEL_VT_NORMAL )
- size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- cur_ptr = c->buf;
- w->fillarea3data.num_points = d->num_vertices;
- w->fillarea3data.shpflag = d->shape_flag;
-
- if( c->size >= size_reqd )
- {
- if( d->facet_flag == TEL_FA_NORMAL )
- {
- if( d->fcolour )
- {
- w->fillarea3data.faflag = TEL_FAFLAG_COLOURNORMAL;
- w->fillarea3data.gnormal = (tel_point)(c->buf);
- *(w->fillarea3data.gnormal) = d->fnormal;
- w->fillarea3data.facet_colour_val =
- (tel_colour)(c->buf + sizeof( TEL_POINT ) );
- *(w->fillarea3data.facet_colour_val) = *(d->fcolour);
- cur_ptr = c->buf + sizeof( TEL_POINT ) +
- sizeof( TEL_COLOUR );
- }
- else
- {
- w->fillarea3data.faflag = TEL_FAFLAG_NORMAL;
- w->fillarea3data.facet_colour_val = 0;
- w->fillarea3data.gnormal = (tel_point)(c->buf);
- *(w->fillarea3data.gnormal) = d->fnormal;
- cur_ptr = c->buf + sizeof( TEL_POINT );
- }
- }
- else
- {
- w->fillarea3data.gnormal = 0;
- if( d->fcolour )
- {
- w->fillarea3data.faflag = TEL_FAFLAG_COLOUR;
- w->fillarea3data.facet_colour_val = (tel_colour)(c->buf );
- *(w->fillarea3data.facet_colour_val) = *(d->fcolour);
- cur_ptr = c->buf + sizeof( TEL_COLOUR );
- }
- else
- {
- w->fillarea3data.faflag = TEL_FAFLAG_NONE;
- w->fillarea3data.facet_colour_val = 0;
- }
- }
-
- w->fillarea3data.points = (tel_point)cur_ptr;
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->fillarea3data.points[j] = d->vertices[j];
- }
- cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- if( d->vertex_flag == TEL_VT_NORMAL )
- {
- if( d->vcolours )
- {
- w->fillarea3data.vrtflag = TEL_VTFLAG_COLOURNORMAL;
- w->fillarea3data.vnormals = (tel_point)(cur_ptr);
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->fillarea3data.vnormals[j] = d->vnormals[i];
- }
- cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- w->fillarea3data.colours = (tel_colour)(cur_ptr);
-
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->fillarea3data.colours[j] = d->vcolours[i];
- }
- }
- else
- {
- w->fillarea3data.vrtflag = TEL_VTFLAG_NORMAL;
- w->fillarea3data.colours = 0;
- w->fillarea3data.vnormals = (tel_point)(cur_ptr);
-
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->fillarea3data.vnormals[j] = d->vnormals[i];
- }
- }
- }
- else
- {
- w->fillarea3data.vnormals = 0;
- if( d->vcolours )
- {
- w->fillarea3data.vrtflag = TEL_VTFLAG_COLOUR;
- w->fillarea3data.colours = (tel_colour)(cur_ptr);
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->fillarea3data.colours[j] = d->vcolours[i];
- }
- }
- else
- {
- w->fillarea3data.vrtflag = TEL_VTFLAG_NONE;
- w->fillarea3data.colours = 0;
- }
- }
-
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
-/*----------------------------------------------------------------------*/
-
-static void
-draw_edges( tel_polygon_data p, tel_colour edge_colour, Tint interior_style )
-{
- CMN_KEY k, k1, k2, k3, k4;
- tel_point ptr;
- Tint i;
- Tint edge_type, line_type_preserve;
- Tfloat edge_width, line_width_preserve;
- GLboolean texture_on;
-
- if (interior_style != TSM_HIDDENLINE)
- {
- k.id = TelEdgeFlag;
- TsmGetAttri( 1, &k );
- if( k.data.ldata == TOff )return;
- }
-
- ptr = p->vertices;
-
- LightOff();
- texture_on = IsTextureEnabled();
- if (texture_on) DisableTexture();
-
- k1.id = TelPolylineWidth;
- k2.id = TelPolylineType;
- k3.id = TelEdgeType;
- k4.id = TelEdgeWidth;
-
- TsmGetAttri( 4, &k1, &k2, &k3, &k4 );
-
- line_width_preserve = k1.data.fdata;
- line_type_preserve = k2.data.ldata;
- edge_type = k3.data.ldata;
- edge_width = k4.data.fdata;
-
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
-
- glColor3fv( edge_colour->rgb );
-
- glBegin(GL_LINE_LOOP);
- for( i=0; i<p->num_vertices; i++, ptr++ )
- {
- glVertex3fv( ptr->xyz );
- }
- glEnd();
-
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
- }
-
- if (texture_on) EnableTexture();
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_polygonholes :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-09-08-96 : FMN ; Suppression appel glMatrixMode() avant glGetFloatv()
-21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
-23-12-97 : FMN ; Suppression TelSetFrontFaceAttri et TelSetBackFaceAttri
-Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
-et TelBackInteriorShadingMethod
-03-03-98 : FMN ; Suppression variable externe TglWhetherPerspective
-08-03-01 : GG ; BUC60823 Avoid crash in the normal computation method
-on confuse point.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_Extension.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_Memory.hxx>
-
-#ifndef WNT
-#if !defined(APIENTRY)
-# define APIENTRY
-#endif // APIENTRY
-# define STATIC static
-#else
-# include <GL\GLU.H>
-# define STATIC
-typedef double GLUcoord;
-#endif /* WNT */
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-static TStatus PolygonHolesDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonHolesAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonHolesDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonHolesPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonHolesInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-#if !defined(GLU_VERSION_1_2)
-#define GLUtesselator GLUtriangulatorObj
-void gluTessBeginContour();
-void gluTessBeginPolygon();
-void gluTessEndPolygon();
-void gluTessEndContour();
-#endif
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Typedef
-*/
-
-struct EXTRA_VERTEX
-{
- GLfloat vert[3];
- int ind;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef EXTRA_VERTEX* extra_vertex;
-
-struct SEQ_
-{
- Tint ts_num, ts_alloc;
- void **tmesh_sequence;
- GLenum triangle_type; /* FSXXX OPTI */
- IMPLEMENT_MEMORY_OPERATORS
-};
-
-struct DISPLAY_
-{
- Tint num_of_seq;
- Tint num_alloc;
- SEQ_ *seq;
- IMPLEMENT_MEMORY_OPERATORS
-};
-
-struct TEL_POLYGON_HOLES_DATA
-{
- Tint num_vertices; /* Number of vertices */
- Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */
- Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */
- Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or
- TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */
- TEL_POINT fnormal; /* Facet normal */
- Tint *edgevis; /* edge visibility flags */
- tel_colour fcolour; /* Facet colour */
- Tint num_bounds; /* number of bounds */
- Tint *bounds; /* Array of length num_bounds */
- tel_point vertices; /* Vertices */
- tel_colour vcolours; /* Vertex colour values */
- tel_point vnormals; /* Vertex normals */
- DISPLAY_ *display; /* FSXXX plus utilise ? */
- GLuint triangle_dl1; /* triangle display list 1 */
- GLuint triangle_dl2; /* triangle display list 2 */
- GLuint triangle_dl3; /* triangle display list 3 */
-};
-typedef TEL_POLYGON_HOLES_DATA* tel_polygon_holes_data;
-
-static TEL_POLYGON_HOLES_DATA polygon_holes_defaults =
-{
- 0, /* num_vertices */
- TEL_FA_NONE, /* facet_flag */
- TEL_VT_NONE, /* vertex_flag */
- TEL_SHAPE_UNKNOWN, /* shape_flag */
- {{ ( float )0.0, ( float )0.0, ( float )0.0 }}, /* fnormal */
- 0, /* edgevis */
- 0, /* fcolour */
- 0, /* num_bounds */
- 0, /* bounds */
- 0, /* vertices */
- 0, /* vcolours */
- 0, /* vnormals */
- 0, /* display */
- 0, /* triangle_dl1 */
- 0, /* triangle_dl2 */
- 0 /* triangle_dl3 */
-};
-
-static void bgntriangulate( tel_polygon_holes_data, void (APIENTRY*)() );
-static void endtriangulate(void);
-STATIC void APIENTRY out_vertex1( void* );
-STATIC void APIENTRY out_vertex2( void* );
-STATIC void APIENTRY out_vertex3( void* );
-static void draw_tmesh( tel_polygon_holes_data, Tint );
-static void draw_polygon_holes( tel_polygon_holes_data, Tint,
- Tint, Tint );
-static void draw_edges( tel_polygon_holes_data, Tmatrix3, tel_colour, Tint,
- TelCullMode, Tint, Tint );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- PolygonHolesDisplay, /* PickTraverse */
- PolygonHolesDisplay,
- PolygonHolesAdd,
- PolygonHolesDelete,
- PolygonHolesPrint,
- PolygonHolesInquire
-};
-
-
-MtblPtr
-TelPolygonHolesInitClass( TelType* el )
-{
- *el = TelPolygonHoles;
- return MtdTbl;
-}
-
-static TStatus
-PolygonHolesAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tint i, j, m;
- tel_polygon_holes_data data;
-
- for( i = 0; i < n; i++ )
- {
- if( k[i]->id == NUM_FACETS_ID )
- break;
- }
- if( i == n )
- return TFailure;
-
- if( !(k[i]->data.ldata) )
- return TFailure;
-
- for( j = 0; j < n; j++ )
- {
- if( k[j]->id == BOUNDS_DATA_ID )
- break;
- }
- if( j == n )
- return TFailure;
-
- data = new TEL_POLYGON_HOLES_DATA();
- if( !data )
- return TFailure;
-
- /* load defaults */
- memcpy( data, &polygon_holes_defaults, sizeof(TEL_POLYGON_HOLES_DATA) );
-
- data->num_bounds = k[i]->data.ldata;
- data->bounds = new Tint[data->num_bounds];
- memcpy( data->bounds, k[j]->data.pdata, data->num_bounds*sizeof(Tint) );
-
- for( m = 0, data->num_vertices = 0; m < data->num_bounds; m++ )
- data->num_vertices += data->bounds[m];
-
- for( i = 0; i < n; i++ )
- {
- if( k[i]->id == VERTICES_ID )
- break;
- }
- if( i == n )
- return TFailure;
-
- if( !(k[i]->data.ldata) )
- return TFailure;
-
- data->vertices = new TEL_POINT[data->num_vertices];
- memcpy( data->vertices, k[i]->data.pdata, data->num_vertices*sizeof(TEL_POINT) );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case FNORMALS_ID:
- data->facet_flag = TEL_FA_NORMAL;
- memcpy( &data->fnormal, k[i]->data.pdata, sizeof(TEL_POINT) );
- vecnrm( data->fnormal.xyz );
- break;
-
- case FACET_COLOUR_VALS_ID:
- data->fcolour = new TEL_COLOUR();
- memcpy( data->fcolour, k[i]->data.pdata, sizeof(TEL_COLOUR) );
- break;
-
- case EDGE_DATA_ID:
- data->edgevis = new Tint[data->num_vertices];
- memcpy( data->edgevis, k[i]->data.pdata, sizeof(Tint) );
- break;
-
- case VERTEX_COLOUR_VALS_ID:
- data->vcolours = new TEL_COLOUR[data->num_vertices];
- memcpy( data->vcolours, k[i]->data.pdata, data->num_vertices*sizeof(TEL_COLOUR) );
- break;
-
- case VNORMALS_ID:
- data->vertex_flag = TEL_VT_NORMAL;
- data->vnormals = new TEL_POINT[data->num_vertices];
- memcpy( data->vnormals, k[i]->data.pdata, data->num_vertices*sizeof(TEL_POINT) );
- for( j = 0; j < data->num_vertices; j++ )
- vecnrm( data->vnormals[j].xyz );
- break;
-
- case SHAPE_FLAG_ID:
- data->shape_flag = k[i]->data.ldata;
- break;
- }
- }
-
- if( data->facet_flag != TEL_FA_NORMAL )
- {
-#ifdef BUC60823
- TelGetPolygonNormal( data->vertices, NULL,
- data->num_vertices, data->fnormal.xyz );
-#else
- TelGetNormal( data->vertices[0].xyz, data->vertices[1].xyz,
- data->vertices[2].xyz, data->fnormal.xyz );
- vecnrm( data->fnormal.xyz );
-#endif
- }
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-
-static TStatus
-PolygonHolesDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint front_face = 1;
- Tmatrix3 mat;
- CMN_KEY k11, k12, k13, k14, k16, k17, k19, k111,
- k112, k113, k117;
-
- Tint fl=0;
- Tint front_lighting_model, back_lighting_model;
- Tint front_lighting_model_preserve, back_lighting_model_preserve;
- Tint front_shading_method;
- Tint interior_style;
- Tint interior_index;
- TEL_COLOUR interior_colour, back_interior_colour;
- TEL_COLOUR point_colour, edge_colour;
- TelCullMode face_culling_mode;
- Tint face_distinguishing_mode;
-
- tel_polygon_holes_data d;
-
- k11.id = TelFaceDistinguishingMode;
- k12.id = TelInteriorReflectanceEquation;
- k13.id = TelInteriorShadingMethod;
- k14.id = TelBackInteriorReflectanceEquation;
- k16.id = TelFaceCullingMode;
- k17.id = TelInteriorStyle;
- k19.id = TelInteriorStyleIndex;
- k111.id = TelInteriorColour;
- k111.data.pdata = &interior_colour;
- k112.id = TelBackInteriorColour;
- k112.data.pdata = &back_interior_colour;
- k113.id = TelPolymarkerColour;
- k113.data.pdata = &point_colour;
- k117.id = TelEdgeColour;
- k117.data.pdata = &edge_colour;
-
- TsmGetAttri( 11, &k11, &k12, &k13, &k14, &k16, &k17,
- &k19, &k111, &k112, &k113, &k117 );
-
- face_distinguishing_mode = k11.data.ldata;
- front_lighting_model = k12.data.ldata;
- front_lighting_model_preserve = k12.data.ldata;
- front_shading_method = k13.data.ldata;
- back_lighting_model = k14.data.ldata;
- back_lighting_model_preserve = k14.data.ldata;
- face_culling_mode = (TelCullMode)k16.data.ldata;
- interior_style = k17.data.ldata;
- interior_index = k19.data.ldata;
-
- if( k[0]->id == TOn )
- { /* Use highlight colours */
- TEL_HIGHLIGHT hrep;
- CMN_KEY kkk, kkl;
-
- k11.id = TelHighlightIndex;
- TsmGetAttri( 1, &k11 );
- if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep )
- == TSuccess )
- {
- if( hrep.type == TelHLForcedColour )
- {
- edge_colour = back_interior_colour = interior_colour = hrep.col;
- front_lighting_model = back_lighting_model = CALL_PHIGS_REFL_NONE;
- kkk.id = TelInteriorReflectanceEquation;
- kkk.data.ldata = CALL_PHIGS_REFL_NONE;
- kkl.id = TelBackInteriorReflectanceEquation;
- kkl.data.ldata = CALL_PHIGS_REFL_NONE;
- TsmSetAttri( 2, &kkk, &kkl );
- fl = 0;
- }
- else
- {
- edge_colour = hrep.col;
- k[0]->id = TOff;
- }
- }
- else
- {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- if( hrep.type == TelHLForcedColour )
- {
- back_interior_colour = interior_colour = hrep.col;
- front_lighting_model = back_lighting_model = CALL_PHIGS_REFL_NONE;
- kkk.id = TelInteriorReflectanceEquation;
- kkk.data.ldata = CALL_PHIGS_REFL_NONE;
- kkl.id = TelBackInteriorReflectanceEquation;
- kkl.data.ldata = CALL_PHIGS_REFL_NONE;
- TsmSetAttri( 2, &kkk, &kkl );
- fl = 0;
- }
- else
- k[0]->id = TOff;
- }
- }
-
- d = (tel_polygon_holes_data)data.pdata;
-
- glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) mat);
-
- if( face_distinguishing_mode == TOn )
- {
- if( ( face_culling_mode == TelCullBack && front_face ) ||
- ( face_culling_mode == TelCullNone && front_face ) )
- {
- glColor3fv( interior_colour.rgb );
-
- draw_polygon_holes(d, interior_style, front_lighting_model, k[0]->id);
- }
- else if( ( face_culling_mode == TelCullFront && !front_face ) ||
- ( face_culling_mode == TelCullNone && !front_face ) )
- {
- /* CMN_KEY k; */
- glColor3fv( back_interior_colour.rgb );
-
- draw_polygon_holes( d, interior_style,
- back_lighting_model, k[0]->id);
- }
- }
- else
- {
- if( ( face_culling_mode == TelCullBack && front_face ) ||
- ( face_culling_mode == TelCullFront && !front_face ) ||
- ( face_culling_mode == TelCullNone ) )
- {
- glColor3fv( interior_colour.rgb );
-
- draw_polygon_holes(d, interior_style, front_lighting_model, k[0]->id);
- }
- }
-
-
- /*A remplacer par le call-back GLU_EDGE_FLAG , A TESTER */
- draw_edges( d, mat, &edge_colour, face_distinguishing_mode,
- face_culling_mode, interior_style, interior_style );
-
- if( fl )
- {
- CMN_KEY kkk, kkl;
-
- kkk.id = TelInteriorReflectanceEquation;
- kkk.data.ldata = front_lighting_model_preserve;
- kkl.id = TelBackInteriorReflectanceEquation;
- kkl.data.ldata = back_lighting_model_preserve;
- TsmSetAttri( 2, &kkk, &kkl );
- }
-
- return TSuccess;
-
-}
-
-static GLUtesselator *tripak;
-
-static void
-draw_polygon_holes( tel_polygon_holes_data d,
- Tint style, Tint u, Tint hflag )
-{
- long i, j, m;
-
- GLdouble xyz[3];
-
- tel_point pvn;
- tel_colour pfc, pvc;
-
- pfc = d->fcolour;
- pvc = d->vcolours;
- pvn = d->vnormals;
-
- if( hflag )
- {
- pvc = pfc = 0;
- }
-
- if( pfc )
- glColor3fv( pfc->rgb );
- if( u != CALL_PHIGS_REFL_NONE )
- glNormal3fv( d->fnormal.xyz );
-
- if( d->display == 0 )
- {
-
- if( u == CALL_PHIGS_REFL_NONE )
- {
- if( pvc )
- {
- bgntriangulate( d, (void (APIENTRY*)())out_vertex2 );
- }
- else
- {
- bgntriangulate( d, (void (APIENTRY*)())out_vertex1 );
- }
- }
- else
- {
- if( pvn )
- {
- bgntriangulate( d, (void (APIENTRY*)())out_vertex3 );
- }
- else
- {
- bgntriangulate( d, (void (APIENTRY*)())out_vertex1 );
- }
- }
- gluTessBeginPolygon( tripak, NULL );
- for( i = 0, m = 0; i < d->num_bounds; i++ )
- {
- gluTessBeginContour( tripak );
- for( j = 0; j < d->bounds[i]; j++ )
- {
- xyz[0] = d->vertices[m].xyz[0];
- xyz[1] = d->vertices[m].xyz[1];
- xyz[2] = d->vertices[m].xyz[2];
-#ifndef WNT
- gluTessVertex( tripak, xyz, (void *)m );
-#else
- {
- GLdouble v[ 3 ];
- v[ 0 ] = d -> vertices[ m ].xyz[ 0 ];
- v[ 1 ] = d -> vertices[ m ].xyz[ 1 ];
- v[ 2 ] = d -> vertices[ m ].xyz[ 2 ];
-
- gluTessVertex ( tripak, v, ( void* )m );
- }
-#endif /* WNT */
- m++;
- }
- gluTessEndContour( tripak );
- }
- gluTessEndPolygon( tripak );
- endtriangulate();
- }
- else
- {
- if( u == CALL_PHIGS_REFL_NONE )
- {
- if( pvc )
- draw_tmesh( d, 2 );
- else
- draw_tmesh( d, 1 );
- }
- else
- {
- if( pvn )
- draw_tmesh( d, 3 );
- else
- draw_tmesh( d, 1 );
- }
- }
-
-
-}
-
-static void
-draw_tmesh( tel_polygon_holes_data d, Tint v )
-{
- Tint i, j, k;
- DISPLAY_ *dis;
- SEQ_ *s;
-
- dis = d->display;
- for( i = 0; i < dis->num_of_seq; i++ )
- {
- s = &(dis->seq[i]);
-
- glBegin(s->triangle_type);
- switch( v )
- {
- case 1:
- {
- for( j = 0, k = 0; j < s->ts_num; j++ )
- {
- if ( s->tmesh_sequence[j] < (void *)0xffff ) {
- glVertex3fv( d->vertices[ (long)s->tmesh_sequence[ j ] ].xyz );
- }
- else {
- extra_vertex b = (extra_vertex)s->tmesh_sequence[j];
- glVertex3fv( b->vert );
- }
- }
- break;
- }
- case 2:
- {
- for( j = 0, k = 0; j < s->ts_num; j++ )
- {
- if ( s->tmesh_sequence[j] < (void *)0xffff ) {
- glColor3fv( d->vcolours[ (long) s->tmesh_sequence[ j ] ].rgb );
- glVertex3fv( d->vertices[ (long) s->tmesh_sequence[ j ] ].xyz );
- } else {
- extra_vertex b = (extra_vertex)s->tmesh_sequence[j];
- glColor3fv( d->vcolours[(b->ind)].rgb);
- glVertex3fv( b->vert );
- }
- }
- break;
- }
- case 3:
- {
- for( j = 0, k = 0; j < s->ts_num; j++ )
- {
- if ( s->tmesh_sequence[j] < (void *)0xffff) {
- glNormal3fv( d->vnormals[ (long) s->tmesh_sequence[ j ] ].xyz );
- glVertex3fv( d->vertices[ (long) s->tmesh_sequence[ j ] ].xyz );
- } else {
- extra_vertex b = (extra_vertex)s->tmesh_sequence[j];
- glNormal3fv( d->vnormals[(b->ind)].xyz);
- glVertex3fv( b->vert );
- }
- }
- break;
- }
- }
- glEnd();
- }
-}
-
-
-static TStatus
-PolygonHolesDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_polygon_holes_data p = (tel_polygon_holes_data)data.pdata;
- if( p->fcolour )
- //cmn_freemem( p->fcolour );
- delete p->fcolour;
- if( p->vertices )
- //cmn_freemem( p->vertices );
- delete[] p->vertices;
- if( p->vcolours )
- //cmn_freemem( p->vcolours );
- delete[] p->vcolours;
- if( p->vnormals )
- //cmn_freemem( p->vnormals );
- delete[] p->vnormals;
- if( p->bounds )
- //cmn_freemem( p->bounds );
- delete[] p->bounds;
- if( p->edgevis )
- //cmn_freemem( p->edgevis );
- delete[] p->edgevis;
- if( p->display )
- {
- Tint i, j;
-
- for( i = 0; i < p->display->num_of_seq; i++ )
- {
- if( p->display->seq[i].tmesh_sequence ) {
- for ( j = 0; j < p->display->seq[i].ts_num ; j++ ) {
- if ( p->display->seq[i].tmesh_sequence[j] >= (void *)0xffff )
- free(p->display->seq[i].tmesh_sequence[j]);
- }
- }
- delete[] p->display->seq[i].tmesh_sequence;
- }
- delete[] p->display->seq;
- delete p->display;
- }
-
-
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-static TStatus
-PolygonHolesPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_polygon_holes_data p = (tel_polygon_holes_data)data.pdata;
-
- fprintf( stdout, "TelPolygonHoles. Number of bounds: %d\n", p->num_bounds );
- switch( p->shape_flag )
- {
- case TEL_SHAPE_UNKNOWN:
- fprintf( stdout, "\t\tShape Flag : UNKNOWN\n" );
- break;
-
- case TEL_SHAPE_COMPLEX:
- fprintf( stdout, "\t\tShape Flag : COMPLEX\n" );
- break;
-
- case TEL_SHAPE_CONCAVE:
- fprintf( stdout, "\t\tShape Flag : CONCAVE\n" );
- break;
-
- case TEL_SHAPE_CONVEX:
- fprintf( stdout, "\t\tShape Flag : CONVEX\n" );
- break;
-
- }
- switch( p->facet_flag )
- {
- case TEL_FA_NONE:
- if( p->fcolour )
- fprintf( stdout, "\t\tFacet Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tFacet Flag : NONE\n" );
- break;
-
- case TEL_FA_NORMAL:
- if( p->fcolour )
- fprintf( stdout, "\t\tFacet Flag : COLOURNORMAL\n" );
- else
- fprintf( stdout, "\t\tFacet Flag : NORMAL\n" );
- break;
- }
- switch( p->vertex_flag )
- {
- case TEL_VT_NONE:
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NONE\n" );
- break;
-
- case TEL_VT_NORMAL:
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOURNORMAL\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NORMAL\n" );
- break;
- }
- fprintf( stdout, "\t\tFacet Normal : %g %g %g\n", p->fnormal.xyz[0],
- p->fnormal.xyz[1],
- p->fnormal.xyz[2] );
- if( p->fcolour )
- fprintf( stdout, "\t\tFacet Colour : %g %g %g\n", p->fcolour->rgb[0],
- p->fcolour->rgb[1],
- p->fcolour->rgb[2] );
- else
- fprintf( stdout, "\n\t\tFacet Colour not specified\n" );
-
- if( p->edgevis )
- {
- fprintf( stdout, "\t\tEdge Visibility Data :\n" );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\t\t%d ", p->edgevis[i] );
- fprintf( stdout, "\n" );
- }
-
- if( p->bounds )
- {
- fprintf( stdout, "\t\tBounds array :\n" );
- for( i = 0; i < p->num_bounds; i++ )
- fprintf( stdout, "\t\tb[%d] %d \n", i, p->bounds[i] );
- }
-
- if( p->vertices )
- {
- fprintf( stdout, "\n\t\tVertices : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vertices[i].xyz[0],
- p->vertices[i].xyz[1],
- p->vertices[i].xyz[2] );
- }
-
- fprintf( stdout, "\n" );
- if( p->vcolours )
- {
- fprintf( stdout, "\n\t\tVertex Colours : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vcolours[i].rgb[0],
- p->vcolours[i].rgb[1],
- p->vcolours[i].rgb[2] );
- }
- else
- fprintf( stdout, "\n\t\tVertex Colours not specified\n" );
-
- if( p->vnormals )
- {
- fprintf( stdout, "\n\t\tVertex Normals : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vnormals[i].xyz[0],
- p->vnormals[i].xyz[1],
- p->vnormals[i].xyz[2] );
- }
- else
- fprintf( stdout, "\n\t\tVertex Normals not specified\n" );
- fprintf( stdout, "\n" );
- return TSuccess;
-}
-
-
-static TStatus
-PolygonHolesInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i, j;
- Tint size_reqd=0;
- TStatus status = TSuccess;
- Tchar *cur_ptr = 0;
- tel_polygon_holes_data d = (tel_polygon_holes_data)data.pdata;
-
- if( d->fcolour )
- size_reqd += sizeof( TEL_COLOUR );
-
- if( d->facet_flag == TEL_FA_NORMAL )
- size_reqd += sizeof( TEL_POINT );
-
- if( d->edgevis )
- size_reqd += ( d->num_vertices * sizeof( Tint ) );
-
- size_reqd += ( d->num_bounds * sizeof( Tint ) );
-
- size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- if( d->vcolours )
- size_reqd += ( d->num_vertices * sizeof( TEL_COLOUR ) );
-
- if( d->vertex_flag == TEL_VT_NORMAL )
- size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- cur_ptr = c->buf;
- w->fillareaset3data.num_bounds = d->num_bounds;
- w->fillareaset3data.shpflag = d->shape_flag;
-
- if( d->edgevis )
- w->fillareaset3data.edgflag = TOn;
- else
- w->fillareaset3data.edgflag = TOff;
-
- if( c->size >= size_reqd )
- {
- if( d->facet_flag == TEL_FA_NORMAL )
- {
- if( d->fcolour )
- {
- w->fillareaset3data.faflag = TEL_FAFLAG_COLOURNORMAL;
- w->fillareaset3data.gnormal = (tel_point)(c->buf);
- *(w->fillareaset3data.gnormal) = d->fnormal;
- w->fillareaset3data.facet_colour_val =
- (tel_colour)(c->buf + sizeof( TEL_POINT ) );
- *(w->fillareaset3data.facet_colour_val) = *(d->fcolour);
- cur_ptr = c->buf + sizeof( TEL_POINT ) +
- sizeof( TEL_COLOUR );
- }
- else
- {
- w->fillareaset3data.faflag = TEL_FAFLAG_NORMAL;
- w->fillareaset3data.facet_colour_val = 0;
- w->fillareaset3data.gnormal = (tel_point)(c->buf);
- *(w->fillareaset3data.gnormal) = d->fnormal;
- cur_ptr = c->buf + sizeof( TEL_POINT );
- }
- }
- else
- {
- w->fillareaset3data.gnormal = 0;
- if( d->fcolour )
- {
- w->fillareaset3data.faflag = TEL_FAFLAG_COLOUR;
- w->fillareaset3data.facet_colour_val = (tel_colour)(c->buf );
- *(w->fillareaset3data.facet_colour_val) = *(d->fcolour);
- cur_ptr = c->buf + sizeof( TEL_COLOUR );
- }
- else
- {
- w->fillareaset3data.faflag = TEL_FAFLAG_NONE;
- w->fillareaset3data.facet_colour_val = 0;
- }
- }
-
- w->fillareaset3data.points = (tel_point)cur_ptr;
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->fillareaset3data.points[j] = d->vertices[j];
- }
- cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- if( d->edgevis )
- {
- w->fillareaset3data.edgvis = (Tint *)(cur_ptr);
- memcpy( w->fillareaset3data.edgvis, d->edgevis,
- d->num_vertices*sizeof(Tint) );
- cur_ptr += (d->num_vertices * sizeof( Tint ) );
- }
-
- w->fillareaset3data.bounds = (Tint *)cur_ptr;
- memcpy( w->fillareaset3data.bounds, d->bounds,
- d->num_bounds*sizeof(Tint) );
- cur_ptr += ( d->num_bounds * sizeof( Tint ) );
-
- if( d->vertex_flag == TEL_VT_NORMAL )
- {
- if( d->vcolours )
- {
- w->fillareaset3data.vrtflag = TEL_VTFLAG_COLOURNORMAL;
- w->fillareaset3data.vnormals = (tel_point)(cur_ptr);
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->fillareaset3data.vnormals[j] = d->vnormals[i];
- }
- cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) );
-
- w->fillareaset3data.colours = (tel_colour)(cur_ptr);
-
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->fillareaset3data.colours[j] = d->vcolours[i];
- }
- }
- else
- {
- w->fillareaset3data.vrtflag = TEL_VTFLAG_NORMAL;
- w->fillareaset3data.colours = 0;
- w->fillareaset3data.vnormals = (tel_point)(cur_ptr);
-
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->fillareaset3data.vnormals[j] = d->vnormals[i];
- }
- }
- }
- else
- {
- w->fillareaset3data.vnormals = 0;
- if( d->vcolours )
- {
- w->fillareaset3data.vrtflag = TEL_VTFLAG_COLOUR;
- w->fillareaset3data.colours = (tel_colour)(cur_ptr);
- for( j = 0; j < d->num_vertices; j++ )
- {
- w->fillareaset3data.colours[j] = d->vcolours[i];
- }
- }
- else
- {
- w->fillareaset3data.vrtflag = TEL_VTFLAG_NONE;
- w->fillareaset3data.colours = 0;
- }
- }
-
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
-
-
-
-#define INCREMENT 64
-static tel_polygon_holes_data DaTa;
-
-STATIC void APIENTRY
-out_bgntmesh_1 ( GLenum triangle_type )
-{
-
- DISPLAY_ *dis;
- dis = DaTa->display;
-
- dis->num_of_seq++;
- if( dis->num_alloc < dis->num_of_seq )
- {
- dis->num_alloc += INCREMENT;
-
- if( dis->seq == 0 )
- {
- dis->seq = new SEQ_[dis->num_alloc];
- }
- else
- {
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- dis->seq = (SEQ_*)realloc( dis->seq, dis->num_alloc*sizeof(SEQ_) );
-#else
- dis->seq = cmn_resizemem<SEQ_>( dis->seq, dis->num_alloc );
-#endif
- }
- }
- dis->seq[ dis->num_of_seq - 1 ].ts_num = 0;
- dis->seq[ dis->num_of_seq - 1 ].ts_alloc = 0;
- dis->seq[ dis->num_of_seq - 1 ].tmesh_sequence = 0;
- dis->seq[ dis->num_of_seq - 1 ].triangle_type = triangle_type;
- glBegin(triangle_type);
-}
-
-
-STATIC void APIENTRY
-out_vertex1( void *data )
-{
- SEQ_ *s;
-
- s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] );
-
- s->ts_num++;
- if( s->ts_alloc < s->ts_num )
- {
- s->ts_alloc += INCREMENT;
-
- if( s->tmesh_sequence == 0 )
- {
- s->tmesh_sequence = new void*[s->ts_alloc];
- }
- else
- {
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- s->tmesh_sequence = (void**)realloc( s->tmesh_sequence,
- s->ts_alloc*sizeof(void*));
-#else
- s->tmesh_sequence = cmn_resizemem<void*>( s->tmesh_sequence,
- s->ts_alloc);
-#endif
- }
- }
- s->tmesh_sequence[ s->ts_num - 1 ] = data;
-
- if ( data < (void *)0xffff ) {
- long int a = (long int)data;
-
- glVertex3fv( DaTa->vertices[a].xyz );
- }
- else {
- extra_vertex b = (extra_vertex)data;
-
- glVertex3fv(b->vert);
- }
-}
-
-STATIC void APIENTRY
-out_vertex2( void *data )
-{
- SEQ_ *s;
-
- s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] );
-
- s->ts_num++;
- if( s->ts_alloc < s->ts_num )
- {
- s->ts_alloc += INCREMENT;
-
- if( s->tmesh_sequence == 0 )
- {
- s->tmesh_sequence = new void*[s->ts_alloc];
- }
- else
- {
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- s->tmesh_sequence = (void**)realloc( s->tmesh_sequence,
- s->ts_alloc*sizeof(void*) );
-#else
- s->tmesh_sequence = cmn_resizemem<void*>( s->tmesh_sequence,
- s->ts_alloc );
-#endif
- }
- }
- s->tmesh_sequence[ s->ts_num - 1 ] = data;
-
- if ( data < (void *)0xffff ){
- long int a = (long int)data;
-
- glColor3fv( DaTa->vcolours[a].rgb );
- glVertex3fv( DaTa->vertices[a].xyz );
- }
- else {
- extra_vertex b = (extra_vertex)data;
-
- glColor3fv(DaTa->vcolours[b->ind].rgb );
- glVertex3fv(b->vert);
- }
-}
-
-STATIC void APIENTRY
-out_vertex3( void *data )
-{
- SEQ_ *s;
-
- s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] );
-
- s->ts_num++;
- if( s->ts_alloc < s->ts_num )
- {
- s->ts_alloc += INCREMENT;
-
- if( s->tmesh_sequence == 0 )
- {
- s->tmesh_sequence = new void*[s->ts_alloc];
- }
- else
- {
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
- s->tmesh_sequence = (void**)realloc( s->tmesh_sequence,
- s->ts_alloc*sizeof(void*) );
-#else
- s->tmesh_sequence = cmn_resizemem<void*>( s->tmesh_sequence,
- s->ts_alloc );
-#endif
- }
- }
- s->tmesh_sequence[ s->ts_num - 1 ] = data;
-
- if ( data < (void *)0xffff ) {
- long int a = (long int)data;
-
- glNormal3fv( DaTa->vnormals[a].xyz );
- glVertex3fv( DaTa->vertices[a].xyz );
- }
- else {
- extra_vertex b = (extra_vertex) data;
-
- glNormal3fv( DaTa->vnormals[b->ind].xyz );
- glVertex3fv(b->vert);
- }
-
-}
-
-STATIC void APIENTRY
-out_combine( GLdouble coords[3], int *data,
- GLfloat w[4], void **dataout )
-{
- extra_vertex new_vertex;
-
- new_vertex = (extra_vertex) malloc(sizeof(EXTRA_VERTEX));
-
- new_vertex->vert[0] = ( float )coords[0];
- new_vertex->vert[1] = ( float )coords[1];
- new_vertex->vert[2] = ( float )coords[2];
- new_vertex->ind = *data;
- *dataout = new_vertex;
-
-#ifdef TRACE
- printf("mycombine3 %e %e %e\n",
- new_vertex->vert[0],
- new_vertex->vert[1],
- new_vertex->vert[2],
- new_vertex->ind);
-#endif
-
-
-}
-
-
-
-STATIC void APIENTRY
-out_endtmesh_1( void )
-{
- glEnd();
-}
-
-STATIC void APIENTRY
-out_error_1( GLenum error )
-{
- printf( "%s\n", (char *) gluErrorString(error) );
-}
-
-static void
-bgntriangulate( tel_polygon_holes_data d, void (APIENTRY*out_ver)() )
-{
- DaTa = d;
- if( !DaTa->display )
- DaTa->display = new DISPLAY_();
-
- tripak = gluNewTess();
-#if defined(linux) && !defined(NOGLUfuncptr)
- gluTessCallback(tripak, GLU_TESS_BEGIN, (_GLUfuncptr)(out_bgntmesh_1));
- gluTessCallback(tripak, GLU_TESS_VERTEX, out_ver);
- gluTessCallback(tripak, GLU_TESS_END, out_endtmesh_1);
- gluTessCallback(tripak, GLU_TESS_ERROR, (_GLUfuncptr)(out_error_1));
- gluTessCallback(tripak, GLU_TESS_COMBINE, (_GLUfuncptr)(out_combine));
-#else
- gluTessCallback(tripak, GLU_TESS_BEGIN, (void (APIENTRY*)())out_bgntmesh_1);
- gluTessCallback(tripak, GLU_TESS_VERTEX, (void (APIENTRY*)())out_ver);
- gluTessCallback(tripak, GLU_TESS_END, (void (APIENTRY*)())out_endtmesh_1);
- gluTessCallback(tripak, GLU_TESS_ERROR, (void (APIENTRY*)())out_error_1);
- gluTessCallback(tripak, GLU_TESS_COMBINE, (void (APIENTRY*)())out_combine);
-#endif
-
-}
-
-static void
-endtriangulate(void)
-{
- DaTa = 0;
- gluDeleteTess(tripak);
-}
-
-static void
-draw_edges( tel_polygon_holes_data p, Tmatrix3 mat, tel_colour edge_colour,
- Tint face_distinguishing_mode, TelCullMode face_culling_mode,
- Tint interior_style, Tint back_interior_style )
-{
- CMN_KEY k, k1, k2, k3, k4;
- Tint i, j, a, clos;
- Tint edge_type, line_type_preserve;
- Tfloat edge_width, line_width_preserve;
- /* Following pointers have been provided for performance improvement */
- Tint *bounds;
- tel_point pv;
-
- /* OCC11904 -- Temporarily disable environment mapping */
- glPushAttrib(GL_ENABLE_BIT);
- glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
-
-
- bounds = p->bounds;
- pv = p->vertices;
-
- k.id = TelEdgeFlag;
- TsmGetAttri( 1, &k );
-
- if( !p->edgevis )
- if( k.data.ldata == TOff )
- {
- glPopAttrib();
- return;
- }
-
- k1.id = TelPolylineWidth;
- k2.id = TelPolylineType;
- k3.id = TelEdgeType;
- k4.id = TelEdgeWidth;
-
- TsmGetAttri( 4, &k1, &k2, &k3, &k4 );
-
- line_width_preserve = k1.data.fdata;
- line_type_preserve = k2.data.ldata;
- edge_type = k3.data.ldata;
- edge_width = k4.data.fdata;
-
- if( p->edgevis == 0 )
- {
- if( face_distinguishing_mode == TOff )
- {
- if( interior_style == TSM_SOLID || interior_style == TSM_HATCH )
- {
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
-
- glColor3fv( edge_colour->rgb );
- if( face_culling_mode == TelCullBack )
- {
- for( i = 0, a = 0; i < p->num_bounds; i++ )
- {
- glBegin(GL_LINE_STRIP);
- for( clos=a, j = 0; j < bounds[i]; j++ )
- {
- glVertex3fv( pv[ a++ ].xyz );
- }
- glVertex3fv( pv[ clos ].xyz );
- glEnd();
- }
- }
- else if( face_culling_mode == TelCullFront )
- {
- for( i = 0, a = 0; i < p->num_bounds; i++ )
- {
- glBegin(GL_LINE_STRIP);
- for( clos=a, j = 0; j < bounds[i]; j++ )
- {
- glVertex3fv( pv[ a++ ].xyz );
- }
- glVertex3fv( pv[ clos ].xyz );
- glEnd();
- }
- }
- else
- {
- for( i = 0, a = 0; i < p->num_bounds; i++ )
- {
- glBegin(GL_LINE_STRIP);
- for( clos=a, j = 0; j < bounds[i]; j++ )
- {
- glVertex3fv( pv[ a++ ].xyz );
- }
- glVertex3fv( pv[ clos ].xyz );
- glEnd();
- }
- }
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
- }
- }
- }
- else
- {
- if( ( interior_style == TSM_SOLID ||
- interior_style == TSM_HATCH ) ||
- ( back_interior_style == TSM_SOLID ||
- back_interior_style == TSM_HATCH ) )
- {
- if( face_culling_mode == TelCullBack )
- {
- if( interior_style == TSM_SOLID || interior_style == TSM_HATCH )
- {
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
- glColor3fv( edge_colour->rgb );
- for( i = 0, a = 0; i < p->num_bounds; i++ )
- {
- glBegin(GL_LINE_STRIP);
- for( clos=a, j = 0; j < bounds[i]; j++ )
- {
- glVertex3fv( pv[ a++ ].xyz );
- }
- glVertex3fv( pv[ clos ].xyz );
- glEnd();
- }
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
- }
- }
- }
- else if( face_culling_mode == TelCullFront )
- {
- if( back_interior_style == TSM_SOLID ||
- back_interior_style == TSM_HATCH )
- {
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
- glColor3fv( edge_colour->rgb );
- for( i = 0, a = 0; i < p->num_bounds; i++ )
- {
- glBegin(GL_LINE_STRIP);
- for( clos=a, j = 0; j < bounds[i]; j++ )
- {
- glVertex3fv( pv[ a++ ].xyz );
- }
- glVertex3fv( pv[ clos ].xyz );
- glEnd();
- }
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
- }
- }
- }
- else
- {
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
- glColor3fv( edge_colour->rgb );
- for( i = 0, a = 0; i < p->num_bounds; i++ )
- {
- glBegin(GL_LINE_STRIP);
- for( clos=a, j = 0; j < bounds[i]; j++ )
- {
- glVertex3fv( pv[ a++ ].xyz );
- }
- glVertex3fv( pv[ clos ].xyz );
- glEnd();
- }
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
- }
- }
- }
- }
- }
- else
- {
- if( face_distinguishing_mode == TOff )
- {
- if( interior_style == TSM_SOLID || interior_style == TSM_HATCH )
- {
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
-
- glColor3fv( edge_colour->rgb );
- if( face_culling_mode == TelCullBack )
- {
- glBegin(GL_LINES);
- for( i = 0, j = 0; i < p->num_bounds; i++ )
- {
- for( a = 0; a < bounds[i]-1; a++ )
- {
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j+a+1].xyz );
- }
- }
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j].xyz );
- }
- j += p->bounds[i];
- }
- glEnd();
- }
- else if( face_culling_mode == TelCullFront )
- {
- glBegin(GL_LINES);
- for( i = 0, j = 0; i < p->num_bounds; i++ )
- {
- for( a = 0; a < bounds[i]-1; a++ )
- {
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j+a+1].xyz );
- }
- }
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j].xyz );
- }
- j += p->bounds[i];
- }
- glEnd();
- }
- else
- {
- glBegin(GL_LINES);
- for( i = 0, j = 0; i < p->num_bounds; i++ )
- {
- for( a = 0; a < bounds[i]-1; a++ )
- {
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j+a+1].xyz );
- }
- }
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j].xyz );
- }
- j += p->bounds[i];
- }
- glEnd();
- }
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
- }
- }
- }
- else
- {
- if( ( interior_style == TSM_SOLID ||
- interior_style == TSM_HATCH ) ||
- ( back_interior_style == TSM_SOLID ||
- back_interior_style == TSM_HATCH ) )
- {
- if( face_culling_mode == TelCullBack )
- {
- if( interior_style == TSM_SOLID || interior_style == TSM_HATCH )
- {
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
- glColor3fv( edge_colour->rgb );
- glBegin(GL_LINES);
- for( i = 0, j = 0; i < p->num_bounds; i++ )
- {
- for( a = 0; a < bounds[i]-1; a++ )
- {
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j+a+1].xyz );
- }
- }
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j].xyz );
- }
- j += p->bounds[i];
- }
- glEnd();
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
- }
- }
- }
- else if( face_culling_mode == TelCullFront )
- {
- if( back_interior_style == TSM_SOLID ||
- back_interior_style == TSM_HATCH )
- {
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
- glColor3fv( edge_colour->rgb );
- glBegin(GL_LINES);
- for( i = 0, j = 0; i < p->num_bounds; i++ )
- {
- for( a = 0; a < bounds[i]-1; a++ )
- {
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j+a+1].xyz );
- }
- }
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j].xyz );
- }
- j += p->bounds[i];
- }
- glEnd();
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
- }
- }
- }
- else
- {
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri( 1, &k );
- }
- glColor3fv( edge_colour->rgb );
- for( i = 0, j = 0; i < p->num_bounds; i++ )
- {
- glBegin(GL_LINES);
- for( a = 0; a < bounds[i]-1; a++ )
- {
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j+a+1].xyz );
- }
- }
- if( p->edgevis[j+a] )
- {
- glVertex3fv( pv[j+a].xyz );
- glVertex3fv( pv[j].xyz );
- }
- glEnd();
- j += p->bounds[i];
- }
-
- if( line_width_preserve != edge_width )
- {
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri( 1, &k );
- }
- if( line_type_preserve != edge_type )
- {
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri( 1, &k );
- }
- }
- }
- }
- }
- glPopAttrib();
-}
+++ /dev/null
-/*
-Created : 22-03-04 : SAN : OCC4895 High-level interface for controlling polygon offsets
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-
-static TStatus PolygonOffsetDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonOffsetAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonOffsetDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolygonOffsetPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- PolygonOffsetDisplay,
- PolygonOffsetAdd,
- PolygonOffsetDelete,
- PolygonOffsetPrint,
- 0 /* Inquire */
-};
-
-
-MtblPtr
-TelPolygonOffsetInitClass( TelType *el )
-{
- *el = TelPolygonOffset;
- return MtdTbl;
-}
-
-static TStatus
-PolygonOffsetAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_poffset_param data = new TEL_POFFSET_PARAM();
-
- if( !data )
- return TFailure;
-
- *data = *(tel_poffset_param)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-PolygonOffsetDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_poffset_param d;
- CMN_KEY key;
-
- d = (tel_poffset_param)data.pdata;
-
- key.id = TelPolygonOffset;
- key.data.pdata = d;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolygonOffsetDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-static TStatus
-PolygonOffsetPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_poffset_param p;
- p = (tel_poffset_param)data.pdata;
-
- fprintf( stdout, "TelPolygonOffset. Mode = %x, Factor = %f, Units = %f\n",
- p->mode, p->factor, p->units);
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_polyl :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
-
-************************************************************************/
-
-#define G003 /* EUG 07-10-99 Degeneration mode support
-*/
-
-#define IMP190602 /* GG Avoid memory leaks after creating a polyline
-// with vertex colors primitive.
-// Thanks to Ivan Fontaine (SAMTECH) for this improvment
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-#ifdef G003
-extern int g_nDegenerateModel;
-#endif /* G003 */
-
-static TStatus PolylineDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylinePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*static GLboolean lighting_mode;*/
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- PolylineDisplay,
- PolylineDisplay,
- PolylineAdd,
- PolylineDelete,
- PolylinePrint,
- PolylineInquire
-};
-
-struct TEL_LINE_DATA
-{
- Tint num_lines; /* Number of polylines */
- Tint num_vertices; /* Number of vertices in vertices array */
- Tint *bounds; /* Array of number of points in each polyline */
- tel_colour vcolours; /* vertex colour values for each vertex */
- tel_point vertices; /* vertices array of length num_vertices */
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_LINE_DATA* tel_line_data;
-
-MtblPtr
-TelPolylineInitClass( TelType* el )
-{
- *el = TelPolyline;
- return MtdTbl;
-}
-
-static TStatus
-PolylineAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-
-{
- Tint i, j;
- tel_line_data p;
-
- for( i = 0; i < n; i++ )
- {
- if( k[i]->id == NUM_LINES_ID )
- break;
- }
-
- if( i == n )
- return TFailure;
-
- if( !(k[i]->data.ldata) )
- return TFailure;
-
- for( j = 0; j < n; j++ )
- {
- if( k[j]->id == BOUNDS_DATA_ID )
- break;
- }
-
- if( j == n )
- return TFailure;
-
- p = new TEL_LINE_DATA();
- p->num_lines = k[i]->data.ldata;
- p->bounds = new Tint[p->num_lines];
- memcpy( p->bounds, k[j]->data.pdata, p->num_lines*sizeof(Tint) );
-
- p->num_vertices = 0;
- for( i = 0; i < p->num_lines; i++ )
- {
- p->num_vertices += p->bounds[i];
- }
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case VERTEX_COLOUR_VALS_ID:
- p->vcolours = new TEL_COLOUR[p->num_vertices];
- memcpy( p->vcolours, k[i]->data.pdata, p->num_vertices*sizeof(TEL_COLOUR) );
- break;
-
- case VERTICES_ID:
- p->vertices = new TEL_POINT[p->num_vertices];
- memcpy( p->vertices, k[i]->data.pdata, p->num_vertices*sizeof(TEL_POINT) );
- break;
- }
- }
-
- ((tsm_elem_data)(d.pdata))->pdata = p;
-
- return TSuccess;
-}
-
-
-static TStatus
-PolylineDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_line_data d;
- Tint i, j, a;
- CMN_KEY key;
- TEL_COLOUR colour;
-
- d = (tel_line_data)data.pdata;
-
- /* OCC11904 -- Temporarily disable environment mapping */
- glPushAttrib(GL_ENABLE_BIT);
- glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
-
- if( k[0]->id == TOn )
- { /* Use highlight colours */
- TEL_HIGHLIGHT hrep;
-
- key.id = TelHighlightIndex;
- TsmGetAttri( 1, &key );
- if( TelGetHighlightRep( TglActiveWs, key.data.ldata, &hrep )
- == TSuccess )
- colour = hrep.col;
- else
- {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- colour = hrep.col;
- }
- }
- else
- {
- key.id = TelPolylineColour;
- key.data.pdata = &colour;
- TsmGetAttri( 1, &key );
- }
-
- if( !d->vcolours )
- {
- glColor3fv( colour.rgb );
- for( i = 0, j = 0, a = 0; i < d->num_lines; i++ )
- {
- a = j + d->bounds[i];
-#ifdef G003
- glBegin ( g_nDegenerateModel != 3 ? GL_LINE_STRIP : GL_POINTS );
-#else
- glBegin(GL_LINE_STRIP);
-#endif /* G003 */
- for( ; j < a; j++ )
- glVertex3fv( d->vertices[j].xyz );
- glEnd();
- }
- }
- else
- {
- for( i = 0, j = 0, a = 0; i < d->num_lines; i++ )
- {
- a = j + d->bounds[i];
-#ifdef G003
- glBegin ( g_nDegenerateModel != 3 ? GL_LINE_STRIP : GL_POINTS );
-#else
- glBegin(GL_LINE_STRIP);
-#endif /* G003 */
- for( ; j < a; j++ )
- {
- glColor3fv( d->vcolours[j].rgb );
- glVertex3fv( d->vertices[j].xyz );
- }
- glEnd();
- }
-
- }
-
- glPopAttrib();
- return TSuccess;
-}
-
-
-static TStatus
-PolylineDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_line_data p = (tel_line_data)data.pdata;
- if( p->bounds )
- delete[] p->bounds;
- if( p->vertices )
- delete[] p->vertices;
-#ifdef IMP190602
- if( p->vcolours )
- delete[] p->vcolours;
-#endif
- if (data.pdata)
- delete data.pdata;
-
- return TSuccess;
-}
-
-
-
-
-static TStatus
-PolylinePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_line_data p = (tel_line_data)data.pdata;
-
- fprintf( stdout, "TelPolyline. Number of Lines: %d\n", p->num_lines );
-
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NONE\n" );
-
- if( p->bounds )
- {
- fprintf( stdout, "\t\tLengths array :\n" );
- for( i = 0; i < p->num_lines; i++ )
- fprintf( stdout, "\t\tL[%d] %d \n", i, p->bounds[i] );
- }
-
- if( p->vertices )
- {
- fprintf( stdout, "\n\t\tVertices : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vertices[i].xyz[0],
- p->vertices[i].xyz[1],
- p->vertices[i].xyz[2] ); }
-
- fprintf( stdout, "\n" );
-
- if( p->vcolours )
- {
- fprintf( stdout, "\n\t\tVertex Colours : " );
- for( i = 0; i < p->num_vertices; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vcolours[i].rgb[0],
- p->vcolours[i].rgb[1],
- p->vcolours[i].rgb[2] ); }
- else
- fprintf( stdout, "\n\t\tVertex Colours not specified\n" );
-
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-static TStatus
-PolylineInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_line_data d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
-
- d = (tel_line_data)data.pdata;
-
- size_reqd = d->num_lines * sizeof( Tint );
- size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) );
- if( d->vcolours )
- {
- size_reqd += ( d->num_vertices * sizeof( TEL_COLOUR ) );
- }
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
- w->lineset3data.num_bounds = d->num_lines;
-
- if( d->vcolours )
- w->lineset3data.vrtflag = TEL_VTFLAG_COLOUR;
- else
- w->lineset3data.vrtflag = TEL_VTFLAG_NONE;
-
- if( c->size >= size_reqd )
- {
- w->lineset3data.bounds = (Tint *)(c->buf);
- memcpy( w->lineset3data.bounds, d->bounds, d->num_lines*sizeof(Tint) );
-
- w->lineset3data.points =
- (tel_point)(c->buf + d->num_lines * sizeof( Tint ) );
-
- memcpy( w->lineset3data.points, d->vertices, d->num_vertices*sizeof(TEL_POINT) );
- if( d->vcolours )
- {
- w->lineset3data.colours = (tel_colour)( c->buf +
- d->num_lines * sizeof( Tint ) +
- d->num_vertices * sizeof( TEL_POINT ));
- memcpy( w->lineset3data.colours, d->vcolours, d->num_vertices*sizeof(TEL_COLOUR) );
- }
- else
- w->lineset3data.colours = 0;
-
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-static TStatus PolylineColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineColourAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineColourDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineColourPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineColourInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- PolylineColourDisplay,
- PolylineColourAdd,
- PolylineColourDelete,
- PolylineColourPrint,
- PolylineColourInquire
-};
-
-
-MtblPtr
-TelPolylineColourInitClass( TelType *el )
-{
- *el = TelPolylineColour;
- return MtdTbl;
-}
-
-static TStatus
-PolylineColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_colour data = new TEL_COLOUR();
- if( !data )
- return TFailure;
-
- *data = *(tel_colour)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-PolylineColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour d;
- CMN_KEY key;
-
- d = (tel_colour)data.pdata;
-
- key.id = TelPolylineColour;
- key.data.pdata = d;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolylineColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-PolylineColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour p;
-
- p = (tel_colour)data.pdata;
-
- fprintf( stdout, "TelPolylineColour. R = %g, G = %g, B = %g\n",
- p->rgb[0], p->rgb[1], p->rgb[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolylineColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_colour col;
-
- col = (tel_colour)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->gnl_colour = *col;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-static TStatus PolylineTypeDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineTypeAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineTypePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineTypeInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- PolylineTypeDisplay,
- PolylineTypeAdd,
- 0, /* Delete */
- PolylineTypePrint,
- PolylineTypeInquire
-};
-
-
-MtblPtr
-TelPolylineTypeInitClass( TelType *el )
-{
- *el = TelPolylineType;
- return MtdTbl;
-}
-
-static TStatus
-PolylineTypeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-PolylineTypeDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelPolylineType;
- key.data.ldata = data.ldata;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolylineTypePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- switch( data.ldata )
- {
- case TEL_LS_SOLID:
- fprintf( stdout, "TelPolylineType. Value = SOLID\n" );
- break;
-
- case TEL_LS_DOT:
- fprintf( stdout, "TelPolylineType. Value = DOT\n" );
- break;
-
- case TEL_LS_DASH_DOT:
- fprintf( stdout, "TelPolylineType. Value = DASH_DOT\n" );
- break;
-
- case TEL_LS_DASH:
- fprintf( stdout, "TelPolylineType. Value = DASH\n" );
- break;
-
- case TEL_LS_DOUBLE_DOT_DASH:
- fprintf( stdout, "TelPolylineType. Value = DOUBLE_DOT_DASH\n" );
- break;
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolylineTypeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-static TStatus PolylineWidthDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineWidthAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineWidthDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineWidthPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus PolylineWidthInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- PolylineWidthDisplay,
- PolylineWidthAdd,
- PolylineWidthDelete,
- PolylineWidthPrint,
- PolylineWidthInquire
-};
-
-
-MtblPtr
-TelPolylineWidthInitClass( TelType *el )
-{
- *el = TelPolylineWidth;
- return MtdTbl;
-}
-
-static TStatus
-PolylineWidthAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tfloat *data = new Tfloat();
-
- if( !data )
- return TFailure;
-
- *data = k[0]->data.fdata;
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-PolylineWidthDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelPolylineWidth;
- key.data.fdata = *(Tfloat*)(data.pdata);
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolylineWidthDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-static TStatus
-PolylineWidthPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelPolylineWidth. Value = %g\n", *(Tfloat *)(data.pdata));
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-PolylineWidthInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- Tfloat *f = (Tfloat *)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->fdata = *f;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-#define G003
-#define G004
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_qstrip :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-22-04-96 : FMN ; Suppression prototype inutile.
-09-08-96 : FMN ; Suppression appel glMatrixMode() avant glGetFloatv()
-21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
-30-06-97 : FMN ; Suppression OpenGl_telem_light.h
-18-07-97 : FMN ; Ajout desactivation des lights suivant front_lighting_model
-21-07-97 : FMN ; Amelioration des performances OPTIMISATION_FMN
-- suppression calcul inutile sur les front faces
-27-08-97 : FMN ; Correction affichage des edges
-On n'affiche que les edges dans le mode IS_EMPTY
-10-09-97 : FMN ; Amelioration des perfs liees aux lights.
-15-09-97 : PCT ; Ajout coordonnees textures
-24-09-97 : FMN ; Suppression OPTIMISATION_FMN.
-08-12-97 : FMN ; Suppression appel TsmGetAttri inutile.
-31-12-97 : FMN ; Simplification pour le highlight
-15-01-98 : FMN ; Ajout Hidden line
-17-02-00 : EUG ; Degeneration support
-17-02-00 : EUG ; Bitmap drawing support
-08-03-01 : GG ; BUC60823 Avoid crash in the normal computation method
-on confuse point.
-
-************************************************************************/
-
-#define BUC60876 /* GG 5/4/2001 Disable local display list
-// when animation is not required
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_TextureBox.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */
-
-#ifdef G003
-# include <float.h>
-# define DEF_DS_INTERNAL
-# include <OpenGl_degeneration.hxx>
-
-# ifdef G004
-extern GLboolean g_fBitmap;
-# endif /* G004 */
-
-# define OPENGL_RAND() ( ( unsigned )( s_Rand = s_Rand * 214013L + 2531011L ))
-
-extern int g_nDegenerateModel;
-extern float g_fSkipRatio;
-extern GLboolean g_fAnimation;
-
-#endif /* G003 */
-
-/*----------------------------------------------------------------------*/
-
-struct TEL_QSTRIP_DATA
-{
- Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or
- TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */
- Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */
- Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */
- Tint num_rows,
- num_columns; /* Number of rows and columns */
- tel_point fnormals; /* Facet normals */
- tel_colour fcolours; /* Facet colours */
- tel_point vertices; /* Vertices */
- tel_colour vcolours; /* Vertex colour values */
- tel_point vnormals; /* Vertex normals */
- tel_texture_coord vtexturecoord; /* Texture coordinates */
-#ifdef G003
- DS_INTERNAL d;
-#endif /* G003 */
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_QSTRIP_DATA* tel_qstrip_data;
-
-static TStatus QuadrangleDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus QuadrangleAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus QuadrangleDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus QuadranglePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus QuadrangleInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static void
-draw_qstrip( tel_qstrip_data,
- Tint, /* highlight flag */
- Tint, /* front_lighting_model, */
- Tint, /* interior_style, */
- tel_colour /* edge_colour, */
- );
-
-#ifdef G003
-static void draw_edges ( tel_qstrip_data, tel_colour, Tint, Tint );
-extern void draw_degenerates_as_points ( PDS_INTERNAL, tel_point, Tint );
-extern void draw_degenerates_as_bboxs ( PDS_INTERNAL, tel_point, Tint );
-extern void set_drawable_items ( GLboolean*, int );
-#else
-static void draw_edges ( tel_qstrip_data, tel_colour, Tint );
-#endif /* G003 */
-
-static void draw_line_strip ( tel_qstrip_data, tel_colour, Tint, Tint );
-
-static TEL_QSTRIP_DATA qstrip_defaults = {
-
- TEL_SHAPE_UNKNOWN, /* shape_flag */
- TEL_FA_NONE, /* facet_flag */
- TEL_VT_NONE /* vertex_flag */
-
-};
-
-static TStatus ( *MtdTbl[] ) ( TSM_ELEM_DATA, Tint, cmn_key* ) = {
-
- QuadrangleDisplay, /* PickTraverse */
- QuadrangleDisplay,
- QuadrangleAdd,
- QuadrangleDelete,
- QuadranglePrint,
- QuadrangleInquire
-
-};
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr TelQuadrangleInitClass ( TelType* el ) {
-
- *el = TelQuadrangle;
-
- return MtdTbl;
-
-} /* end TelQuadrangleInitClass */
-
-static TStatus
-QuadrangleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-
-{
- Tint i, j;
- Tint nf, nv;
- tel_qstrip_data data;
-
- for( i = 0; i < n; i++ )
- {
- if( k[i]->id == NUM_ROWS_ID )
- break;
- }
- if( i == n )
- return TFailure;
-
- if( !(k[i]->data.ldata) )
- return TFailure;
-
- for( j = 0; j < n; j++ )
- {
- if( k[j]->id == NUM_COLUMNS_ID )
- break;
- }
- if( j == n )
- return TFailure;
-
- if( !(k[j]->data.ldata) )
- return TFailure;
-
- data = new TEL_QSTRIP_DATA();
- if( !data )
- return TFailure;
-
- /* load defaults */
- *data = qstrip_defaults;
-
- data->num_rows = k[i]->data.ldata;
- data->num_columns = k[j]->data.ldata;
- nf = data->num_rows * data->num_columns;
- nv = ( data->num_rows+1 ) * ( data->num_columns+1 );
-
- data->vtexturecoord = 0;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case SHAPE_FLAG_ID:
- {
- data->shape_flag = k[i]->data.ldata;
- break;
- }
- case FNORMALS_ID:
- {
- data->facet_flag = TEL_FA_NORMAL;
- data->fnormals = new TEL_POINT[nf];
- memcpy( data->fnormals, k[i]->data.pdata, nf*sizeof(TEL_POINT) );
- for( j = 0; j < nf; j++ )
- vecnrm( data->fnormals[j].xyz );
- break;
- }
- case FACET_COLOUR_VALS_ID:
- {
- data->fcolours = new TEL_COLOUR[nf];
- memcpy( data->fcolours, k[i]->data.pdata, nf*sizeof(TEL_COLOUR) );
- break;
- }
- case VERTICES_ID:
- {
- data->vertices = new TEL_POINT[nv];
- memcpy( data->vertices, k[i]->data.pdata, nv*sizeof(TEL_POINT) );
- break;
- }
- case VERTEX_COLOUR_VALS_ID:
- {
- data->vcolours = new TEL_COLOUR[nv];
- memcpy( data->vcolours, k[i]->data.pdata, nv*sizeof(TEL_COLOUR) );
- break;
- }
- case VNORMALS_ID:
- {
- data->vertex_flag = TEL_VT_NORMAL;
- data->vnormals = new TEL_POINT[nv];
- memcpy( data->vnormals, k[i]->data.pdata, nv*sizeof(TEL_POINT) );
- for( j = 0; j < nv; j++ )
- vecnrm( data->vnormals[j].xyz );
- break;
- }
- case VTEXTURECOORD_ID:
- {
- data->vtexturecoord = new TEL_TEXTURE_COORD[nv];
- memcpy( data->vtexturecoord, k[i]->data.pdata, nv*sizeof(TEL_TEXTURE_COORD) );
- break;
- }
- default:
- {
- break;
- }
- }
- }
-
- if( data->facet_flag != TEL_FA_NORMAL )
- {
- /* calculate the normals and store */
- data->fnormals = new TEL_POINT[nf];
- for( i = 0; i < nf; i++ )
- {
- TEL_POINT p1, p2, p3, p4;
- Tint r, c, id;
-
- r = i/data->num_columns;
- c = i%data->num_columns;
-
- id = r*(data->num_columns+1) + c;
- p1 = data->vertices[id];
- p2 = data->vertices[id+data->num_columns+1];
- p3 = data->vertices[id+data->num_columns+2];
- p4 = data->vertices[id+1];
-
- p4.xyz[0] -= p2.xyz[0];
- p4.xyz[1] -= p2.xyz[1];
- p4.xyz[2] -= p2.xyz[2];
-
- p4.xyz[0] += p1.xyz[0];
- p4.xyz[1] += p1.xyz[1];
- p4.xyz[2] += p1.xyz[2];
-
- TelGetNormal( p4.xyz, p1.xyz, p3.xyz, data->fnormals[i].xyz );
- }
-#ifndef BUC60823
- for( j = 0; j < nf; j++ )
- vecnrm( data->fnormals[j].xyz );
-#endif
- }
- if( data->vertex_flag != TEL_VT_NORMAL )
- {
- Tint r, c, id;
- /* calculate the vertex normals */
- data->vnormals = new TEL_POINT[nv];
- for( i = 0; i < nv; i++ )
- {
- if( i == 0 )
- data->vnormals[i] = data->fnormals[i];
- else if( i == (nv-1) )
- data->vnormals[i] = data->fnormals[nf-1];
- else if( i == (nv-data->num_columns-1) )
- data->vnormals[i] = data->fnormals[nf-data->num_columns];
- else if( i == data->num_columns )
- data->vnormals[i] = data->fnormals[i-1];
- else if( i%(data->num_columns+1) == 0 )
- {
- r = i/(data->num_columns+1);
- data->vnormals[i].xyz[0] =
- ( data->fnormals[(r-1)*data->num_columns].xyz[0] +
- data->fnormals[r*data->num_columns].xyz[0] ) / ( float )2.0;
- data->vnormals[i].xyz[1] =
- ( data->fnormals[(r-1)*data->num_columns].xyz[1] +
- data->fnormals[r*data->num_columns].xyz[1] ) / ( float )2.0;
- data->vnormals[i].xyz[2] =
- ( data->fnormals[(r-1)*data->num_columns].xyz[2] +
- data->fnormals[r*data->num_columns].xyz[2] ) / ( float )2.0;
- }
- else if( i <= data->num_columns )
- {
- data->vnormals[i].xyz[0] = ( data->fnormals[i-1].xyz[0] +
- data->fnormals[i].xyz[0] ) / ( float )2.0;
- data->vnormals[i].xyz[1] = ( data->fnormals[i-1].xyz[1] +
- data->fnormals[i].xyz[1] ) / ( float )2.0;
- data->vnormals[i].xyz[2] = ( data->fnormals[i-1].xyz[2] +
- data->fnormals[i].xyz[2] ) / ( float )2.0;
- }
- else if( i >= (nv-data->num_columns-1 ) )
- {
- c = i%(data->num_columns+1);
- id = nf-data->num_columns+c;
-
- data->vnormals[i].xyz[0] = ( data->fnormals[id-1].xyz[0] +
- data->fnormals[id].xyz[0] ) / ( float )2.0;
- data->vnormals[i].xyz[1] = ( data->fnormals[id-1].xyz[1] +
- data->fnormals[id].xyz[1] ) / ( float )2.0;
- data->vnormals[i].xyz[2] = ( data->fnormals[id-1].xyz[2] +
- data->fnormals[id].xyz[2] ) / ( float )2.0;
- }
- else if( (i+1)%(data->num_columns+1) == 0 )
- {
- r = (i+1)/(data->num_columns+1);
- data->vnormals[i].xyz[0] =
- ( data->fnormals[(r-1)*data->num_columns-1].xyz[0] +
- data->fnormals[r*data->num_columns-1].xyz[0] ) / ( float )2.0;
- data->vnormals[i].xyz[1] =
- ( data->fnormals[(r-1)*data->num_columns-1].xyz[1] +
- data->fnormals[r*data->num_columns-1].xyz[1] ) / ( float )2.0;
- data->vnormals[i].xyz[2] =
- ( data->fnormals[(r-1)*data->num_columns-1].xyz[2] +
- data->fnormals[r*data->num_columns-1].xyz[2] ) / ( float )2.0;
- }
- else
- {
- r = i/(data->num_columns+1);
- c = i%(data->num_columns+1);
-
- id = r*data->num_columns+c;
-
- data->vnormals[i].xyz[0] =
- ( data->fnormals[id].xyz[0] +
- data->fnormals[id-data->num_columns].xyz[0] +
- data->fnormals[id-1].xyz[0] +
- data->fnormals[id-data->num_columns-1].xyz[0] ) / ( float )4.0;
- data->vnormals[i].xyz[1] =
- ( data->fnormals[id].xyz[1] +
- data->fnormals[id-data->num_columns].xyz[1] +
- data->fnormals[id-1].xyz[1] +
- data->fnormals[id-data->num_columns-1].xyz[1] ) / ( float )4.0;
- data->vnormals[i].xyz[2] =
- ( data->fnormals[id].xyz[2] +
- data->fnormals[id-data->num_columns].xyz[2] +
- data->fnormals[id-1].xyz[2] +
- data->fnormals[id-data->num_columns-1].xyz[2] ) / ( float )4.0;
- }
- }
- }
-#ifdef G003
- data -> d.list = 0;
- data -> d.dlist = 0;
- data -> d.degMode = 0;
- data -> d.model = -1;
- data -> d.skipRatio = 0.0F;
- data->d.bDraw = new unsigned char[nv];
-#endif /* G003 */
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-/*----------------------------------------------------------------------*/
-
-static TStatus
-QuadrangleDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY k11, k12, k17, k111, k114;
-
- Tint front_lighting_model;
- Tint interior_style;
- TEL_COLOUR interior_colour;
- TEL_COLOUR edge_colour;
-
- tel_qstrip_data d;
-
- k12.id = TelInteriorReflectanceEquation;
- k17.id = TelInteriorStyle;
- k111.id = TelInteriorColour;
- k111.data.pdata = &interior_colour;
- k114.id = TelEdgeColour;
- k114.data.pdata = &edge_colour;
-
- TsmGetAttri( 4, &k12, &k17, &k111, &k114);
-
- front_lighting_model = k12.data.ldata;
- interior_style = k17.data.ldata;
-
-#ifdef PRINT
- printf("QuadrangleDisplay \n");
-#endif
-
- /*
- * Use highlight colours
- */
-
- if( k[0]->id == TOn )
- {
- TEL_HIGHLIGHT hrep;
-
- k11.id = TelHighlightIndex;
- TsmGetAttri( 1, &k11 );
- if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep )
- == TSuccess )
- {
- if( hrep.type == TelHLForcedColour )
- {
- edge_colour = interior_colour = hrep.col;
- front_lighting_model = CALL_PHIGS_REFL_NONE;
- }
- else if( hrep.type == TelHLColour )
- {
- edge_colour = hrep.col;
- k[0]->id = TOff;
- }
- }
- else
- {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- if( hrep.type == TelHLForcedColour )
- {
- edge_colour = interior_colour = hrep.col;
- front_lighting_model = CALL_PHIGS_REFL_NONE;
- }
- else if( hrep.type == TelHLColour )
- {
- edge_colour = hrep.col;
- k[0]->id = TOff;
- }
- }
- }
-
- d = (tel_qstrip_data)data.pdata;
-
- glColor3fv( interior_colour.rgb );
-
- draw_qstrip( d,
- k[0]->id,
- front_lighting_model,
- interior_style,
- &edge_colour );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static void draw_qstrip (
- tel_qstrip_data p,
- Tint hflag,
- Tint front_lighting_model,
- Tint interior_style,
- tel_colour edge_colour
- )
-{
-
- Tint i, m, newList = 0;
- Tint nf, nv, nr, nc;
- Tint lighting_model;
- tel_point pv, pfn, pvn;
- tel_colour pfc, pvc;
- tel_texture_coord pvt;
-
- pfn = p -> fnormals;
- pfc = p -> fcolours;
- pv = p -> vertices;
- pvc = p -> vcolours;
- pvn = p -> vnormals;
- pvt = p -> vtexturecoord;
-
- if ( hflag == TOn ) {
-
- pvc = 0;
- pfc = 0;
-
- } /* end if */
-
-#ifdef G003
- if ( g_nDegenerateModel < 2 && interior_style != TSM_EMPTY ) {
-#else
- if ( interior_style != TSM_EMPTY ) {
-#endif /* G003 */
- if ( front_lighting_model == CALL_PHIGS_REFL_NONE )
-
- LightOff ();
-
- else LightOn ();
-
- lighting_model = front_lighting_model;
- nr = p -> num_rows;
- nc = p -> num_columns;
- nf = nr * nc;
- nv = ( nr + 1 ) * ( nc + 1 );
-#ifdef G003
-#ifdef BUC60876
- if ( !g_fAnimation )
- goto doDraw; /* Disable object display list out of animation */
-#endif
-# ifdef G004
- if ( g_fBitmap )
- goto doDraw; /* display lists are NOT shared between */
- /* window's context and bitmap's one */
-# endif /* G004 */
- if ( p -> d.model != front_lighting_model || !p -> d.list ||
- p -> d.model == -1 ||
- ( g_nDegenerateModel && p -> d.skipRatio != g_fSkipRatio )
- ) {
-
- p -> d.skipRatio = g_fSkipRatio;
- p -> d.model = front_lighting_model;
- p -> d.degMode = g_nDegenerateModel;
-
- if ( g_fSkipRatio == 0.0 ) {
-
- if ( !p -> d.list ) p -> d.list = glGenLists ( 1 );
-
- glNewList ( p -> d.list, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-#endif /* G003 */
-#ifdef G004
-doDraw:
-#endif /* G004 */
- if ( lighting_model == CALL_PHIGS_REFL_NONE ) {
-
- if ( pvc ) {
-
- for ( m = 0; m < nr; ++m ) {
-
- glBegin ( GL_QUAD_STRIP );
- glColor3fv ( pvc[ m * ( nc + 1 ) ].rgb );
- glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
- glColor3fv ( pvc[ ( m + 1 ) * ( nc + 1 ) ].rgb );
- glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- for ( i = 1; i < nc + 1; ++i ) {
-
- glColor3fv ( pvc[ i + m * ( nc + 1 ) ].rgb );
- glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
- glColor3fv ( pvc[ i + ( m + 1 ) * ( nc + 1 ) ].rgb );
- glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- } /* end for */
-
- glEnd ();
-
- } /* end for */
-
- } else if ( pfc ) {
-
- glColor3fv ( pfc[ 0 ].rgb );
-
- for ( m = 0; m < nr; ++m ) {
-
- glBegin ( GL_QUAD_STRIP );
- glColor3fv ( pfc[ m * nc ].rgb );
- glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- for ( i = 1; i < nc + 1; ++i ) {
-
- glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
- glColor3fv ( pfc[ i - 1 + m * nc ].rgb );
- glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- } /* end for */
-
- glEnd ();
-
- } /* end for */
-
- } else {
-
- for ( m = 0; m < nr; ++m ) {
-
- glBegin ( GL_QUAD_STRIP );
- glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- for ( i = 1; i < nc + 1; ++i ) {
-
- glVertex3fv( pv[ i + m * ( nc + 1 ) ].xyz );
- glVertex3fv( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- } /* end for */
-
- glEnd ();
-
- } /* end for */
-
- } /* end else */
-
- } else { /* lighting_model != TelLModelNone */
-
- if ( pvt && !ForbidSetTextureMapping )
-
- for ( m = 0; m < nr; ++m ) {
-
- glBegin ( GL_QUAD_STRIP );
- glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz );
- glTexCoord2fv ( pvt[ m * ( nc + 1 ) ].xy );
- glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
- glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz );
- glTexCoord2fv ( pvt[ ( m + 1 ) * ( nc + 1 ) ].xy );
- glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- for ( i = 1; i < nc + 1; ++i ) {
-
- glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz );
- glTexCoord2fv ( pvt[ i + m * ( nc + 1 ) ].xy );
- glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
- glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
- glTexCoord2fv ( pvt[ i + ( m + 1 ) * ( nc + 1 ) ].xy );
- glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- } /* end for */
-
- glEnd ();
-
- } /* end for */
-
- else
-
- for ( m = 0; m < nr; ++m ) {
-
- glBegin ( GL_QUAD_STRIP );
- glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
- glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- for ( i = 1; i < nc + 1; ++i ) {
-
- glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
- glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- } /* end for */
-
- glEnd ();
-
- } /* end for */
-
- } /* end else */
-#ifdef G003
- } else if ( g_fSkipRatio != 1.0 ) {
-
- set_drawable_items ( p -> d.bDraw, nr );
-
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
-
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-
- if ( lighting_model == CALL_PHIGS_REFL_NONE ) {
-
- if ( pvc ) {
-
- for ( m = 0; m < nr; ++m )
-
- if ( p -> d.bDraw[ m ] ) {
-
- glBegin ( GL_QUAD_STRIP );
- glColor3fv ( pvc[ m * ( nc + 1 ) ].rgb );
- glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
- glColor3fv ( pvc[ ( m + 1 ) * ( nc + 1 ) ].rgb );
- glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- for ( i = 1; i < nc + 1; ++i ) {
-
- glColor3fv ( pvc[ i + ( m + 1 ) * ( nc + 1 ) ].rgb );
- glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
- glColor3fv ( pvc[ i + m * ( nc + 1 ) ].rgb );
- glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
-
- } /* end for */
-
- glEnd ();
-
- } /* end if */
-
- } else if ( pfc ) {
-
- glColor3fv ( pfc[ 0 ].rgb );
-
- for ( m = 0; m < nr; ++m )
-
- if ( p -> d.bDraw[ m ] ) {
-
- glBegin ( GL_QUADS );
- glColor3fv ( pfc[ m * nc ].rgb );
- glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- for ( i = 1; i < nc + 1; ++i ) {
-
- glColor3fv ( pfc[ i - 1 + m * nc ].rgb );
- glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
-
- } /* end for */
-
- glEnd ();
-
- } /* end if */
-
- } else {
-
- for ( m = 0; m < nr; ++m )
-
- if ( p -> d.bDraw[ m ] ) {
-
- glBegin ( GL_QUADS );
- glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- for ( i = 1; i < nc + 1; ++i ) {
-
- glVertex3fv( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
- glVertex3fv( pv[ i + m * ( nc + 1 ) ].xyz );
-
- } /* end for */
-
- glEnd ();
-
- } /* end if */
-
- } /* end else */
-
- } else { /* lighting_model != TelLModelNone */
-
- if ( pvt && !ForbidSetTextureMapping ) {
-
- for ( m = 0; m < nr; ++m )
-
- if ( p -> d.bDraw[ m ] ) {
-
- glBegin ( GL_QUADS );
- glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz );
- glTexCoord2fv ( pvt[ m * ( nc + 1 ) ].xy );
- glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
- glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz );
- glTexCoord2fv ( pvt[ ( m + 1 ) * ( nc + 1 ) ].xy );
- glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- for ( i = 1; i < nc + 1; ++i ) {
-
- glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
- glTexCoord2fv ( pvt[ i + ( m + 1 ) * ( nc + 1 ) ].xy );
- glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
- glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz );
- glTexCoord2fv ( pvt[ i + m * ( nc + 1 ) ].xy );
- glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
-
- } /* end for */
-
- glEnd ();
-
- } /* end if */
-
- } else
-
- for ( m = 0; m < nr; ++m )
-
- if ( p -> d.bDraw[ m ] ) {
-
- glBegin ( GL_QUADS );
- glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz );
- glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz );
-
- for ( i = 1; i < nc + 1; ++i ) {
-
- glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz );
- glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz );
- glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz );
-
- } /* end for */
-
- glEnd ();
-
- } /* end if */
-
- } /* end else */
-
- } else {
-
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
-
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-
- } /* end else */
- if ( newList ) glEndList ();
-
- if ( g_nDegenerateModel ) return;
-
- } else {
-
- glCallList ( g_fSkipRatio == 0.0 ? p -> d.list : p -> d.dlist );
-
- if ( g_nDegenerateModel ) return;
-
- } /* end else */
-#endif /* G003 */
- } /* end if ( interior_style != TSM_EMPTY ) */
-#ifdef G003
- i = 0;
-
- /* OCC11904 -- Temporarily disable environment mapping */
- glPushAttrib(GL_ENABLE_BIT);
- glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
-
- switch ( g_nDegenerateModel ) {
-
-default:
- break;
-
-case 2: /* XXX_TDM_WIREFRAME */
- i = 1;
- break;
-
-case 3: /* XXX_TDM_MARKER */
- draw_degenerates_as_points (
- &p -> d, p -> vertices, ( p -> num_rows + 1 ) * ( p -> num_columns + 1 )
- );
-
- glPopAttrib();
-
- return;
-
-case 4: /* XXX_TDM_BBOX */
- draw_degenerates_as_bboxs (
- &p -> d, p -> vertices, ( p -> num_rows + 1 ) * ( p -> num_columns + 1 )
- );
-
- glPopAttrib();
-
- return;
-
- } /* end switch */
-
- draw_edges ( p, edge_colour, interior_style, i );
-#else
- draw_edges ( p, edge_colour, interior_style );
-#endif /* G003 */
-
- glPopAttrib();
-} /* end draw_qstrip */
-/*----------------------------------------------------------------------*/
-static TStatus
-QuadrangleDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_qstrip_data p;
-
- p = (tel_qstrip_data)data.pdata;
- if( p->fnormals ) //cmn_freemem( p->fnormals );
- delete[] p->fnormals;
- if( p->fcolours ) //cmn_freemem( p->fcolours );
- delete[] p->fcolours;
- if( p->vertices ) //cmn_freemem( p->vertices );
- delete[] p->vertices;
- if( p->vcolours ) //cmn_freemem( p->vcolours );
- delete[] p->vcolours;
- if( p->vnormals ) //cmn_freemem( p->vnormals );
- delete[] p->vnormals;
- if (p->vtexturecoord) //cmn_freemem(p->vtexturecoord);
- delete[] p->vtexturecoord;
-
- if (data.pdata)
- delete data.pdata;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-static TStatus
-QuadranglePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_qstrip_data p = (tel_qstrip_data)data.pdata;
-
- fprintf(stdout, "TelQuadrangle. ");
- fprintf(stdout, "\n\tNumber of Rows : %d\n", p->num_rows);
- fprintf(stdout, "\n\tNumber of Columns : %d\n", p->num_columns);
- switch( p->shape_flag )
- {
- case TEL_SHAPE_UNKNOWN:
- fprintf( stdout, "\t\tShape Flag : UNKNOWN\n" );
- break;
-
- case TEL_SHAPE_COMPLEX:
- fprintf( stdout, "\t\tShape Flag : COMPLEX\n" );
- break;
-
- case TEL_SHAPE_CONCAVE:
- fprintf( stdout, "\t\tShape Flag : CONCAVE\n" );
- break;
-
- case TEL_SHAPE_CONVEX:
- fprintf( stdout, "\t\tShape Flag : CONVEX\n" );
- break;
-
- }
- switch( p->facet_flag )
- {
- case TEL_FA_NONE:
- if( p->fcolours )
- fprintf( stdout, "\t\tFacet Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tFacet Flag : NONE\n" );
- break;
-
- case TEL_FA_NORMAL:
- if( p->fcolours )
- fprintf( stdout, "\t\tFacet Flag : COLOURNORMAL\n" );
- else
- fprintf( stdout, "\t\tFacet Flag : NORMAL\n" );
- break;
- }
-
- switch( p->vertex_flag )
- {
- case TEL_VT_NONE:
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NONE\n" );
- break;
-
- case TEL_VT_NORMAL:
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOURNORMAL\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NORMAL\n" );
- break;
- }
- if( p->fnormals )
- {
- fprintf( stdout, "\n\t\tFacet Normals : " );
- for( i = 0; i < (p->num_rows * p->num_columns); i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->fnormals[i].xyz[0],
- p->fnormals[i].xyz[1],
- p->fnormals[i].xyz[2] );
- }
- else
- fprintf( stdout, "\n\t\tFacet Normals not specified\n" );
-
- if( p->fcolours )
- {
- fprintf( stdout, "\n\t\tFacet Colours : " );
- for( i = 0; i < (p->num_rows * p->num_columns+1); i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->fcolours[i].rgb[0],
- p->fcolours[i].rgb[1],
- p->fcolours[i].rgb[2] ); }
- else
- fprintf( stdout, "\n\t\tFacet Colours not specified\n" );
- if( p->vertices )
- {
- fprintf( stdout, "\n\t\tVertices : " );
- for( i = 0; i < (p->num_rows+1)*(p->num_columns+1); i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vertices[i].xyz[0],
- p->vertices[i].xyz[1],
- p->vertices[i].xyz[2] ); }
-
- fprintf( stdout, "\n" );
- if( p->vcolours )
- {
- fprintf( stdout, "\n\t\tVertex Colours : " );
- for( i = 0; i < (p->num_rows+1)*(p->num_columns+1); i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vcolours[i].rgb[0],
- p->vcolours[i].rgb[1],
- p->vcolours[i].rgb[2] ); }
- else
- fprintf( stdout, "\n\t\tVertex Colours not specified\n" );
-
- if( p->vnormals )
- {
- fprintf( stdout, "\n\t\tVertex Normals : " );
- for( i = 0; i < (p->num_rows+1)*(p->num_columns+1); i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vnormals[i].xyz[0],
- p->vnormals[i].xyz[1],
- p->vnormals[i].xyz[2] ); }
- else
- fprintf( stdout, "\n\t\tVertex Normals not specified\n" );
-
- if (p->vtexturecoord)
- {
- fprintf(stdout, "\n\t\tTexture Coordinates : ");
- for (i=0; i<(p->num_rows+1)*(p->num_columns+1); i++)
- fprintf(stdout, "\n\t\t v[%d] = %g %g", i,
- p->vtexturecoord[i].xy[0],
- p->vtexturecoord[i].xy[1]);
- }
- else
- fprintf( stdout, "\n\t\tTexture Coordinates not specified\n");
-
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-#ifdef G003
-static void draw_edges (
- tel_qstrip_data p,
- tel_colour edge_colour,
- Tint interior_style,
- Tint forceDraw
- )
-{
-#else
-static void draw_edges (
- tel_qstrip_data p,
- tel_colour edge_colour,
- Tint interior_style
- )
-{
-#endif /* G003 */
- CMN_KEY k, k1, k2, k3, k4;
- Tint nf, nc, newList = 0;
- Tint edge_type, line_type_preserve;
- Tfloat edge_width, line_width_preserve;
- GLboolean texture_on;
- tel_point pv;
-#ifdef G003
- if ( interior_style != TSM_HIDDENLINE && !forceDraw )
- {
-#else
- if ( interior_style != TSM_HIDDENLINE )
- {
-#endif /* G003 */
- k.id = TelEdgeFlag;
- TsmGetAttri ( 1, &k );
-
- if ( k.data.ldata == TOff ) return;
-
- } /* end if */
-
- pv = p -> vertices;
-
- LightOff ();
- texture_on = IsTextureEnabled ();
-
- if ( texture_on ) DisableTexture ();
-
- k1.id = TelPolylineWidth;
- k2.id = TelPolylineType;
- k3.id = TelEdgeType;
- k4.id = TelEdgeWidth;
- TsmGetAttri ( 4, &k1, &k2, &k3, &k4 );
-
- line_width_preserve = k1.data.fdata;
- line_type_preserve = k2.data.ldata;
- edge_type = k3.data.ldata;
- edge_width = k4.data.fdata;
-
- nc = p -> num_columns;
- nf = p -> num_rows * p->num_columns;
-
- if ( line_width_preserve != edge_width ) {
-
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri ( 1, &k );
-
- } /* end if */
-
- if ( line_type_preserve != edge_type ) {
-
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri ( 1, &k );
-
- } /* end if */
-#ifdef G003
- if ( !forceDraw )
-#endif /* G003 */
- draw_line_strip ( p, edge_colour, nf, nc );
-#ifdef G003
- else {
-#ifdef BUC60876
- if ( !g_fAnimation )
- goto doDraw; /* Disable object display list out of animation */
-#endif
-# ifdef G004
- if ( g_fBitmap )
- goto doDraw;
-# endif /* G004 */
- if ( p -> d.degMode != 2 || p -> d.skipRatio != g_fSkipRatio || !p -> d.dlist ) {
-
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
-
- p -> d.degMode = 2;
- p -> d.skipRatio = g_fSkipRatio;
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-doDraw:
- glPushAttrib ( GL_DEPTH_BUFFER_BIT );
- glDisable ( GL_DEPTH_TEST );
-
- if ( g_fSkipRatio == 0.0 )
-
- draw_line_strip ( p, edge_colour, nf, nc );
-
- else if ( g_fSkipRatio != 1.0 ) {
-
- int i, m1, m2, n1, n2, n3, n4;
-
- set_drawable_items ( p -> d.bDraw, nf );
-
- glColor3fv ( edge_colour -> rgb );
-
- for ( i = 0; i < nf; ++i )
-
- if ( p -> d.bDraw[ i ] ) {
-
- glBegin ( GL_LINE_STRIP );
- m1 = i / nc;
- m2 = i % nc;
- n1 = m1 * ( nc + 1 ) + m2;
- n2 = n1 + nc + 1;
- n3 = n2 + 1;
- n4 = n1 + 1;
-
- glVertex3fv ( p -> vertices[ n1 ].xyz );
- glVertex3fv ( p -> vertices[ n2 ].xyz );
- glVertex3fv ( p -> vertices[ n3 ].xyz );
- glVertex3fv ( p -> vertices[ n4 ].xyz );
- glVertex3fv ( p -> vertices[ n1 ].xyz );
- glEnd();
-
- } /* end if */
-
- } /* end if */
-
- glPopAttrib ();
- if ( newList ) glEndList ();
-
- } else glCallList ( p -> d.dlist );
-
- } /* end else */
-#endif /* G003 */
- if ( line_width_preserve != edge_width ) {
-
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri ( 1, &k );
-
- } /* end if */
-
- if ( line_type_preserve != edge_type ) {
-
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri ( 1, &k );
-
- } /* end if */
-
- if ( texture_on ) EnableTexture ();
-
-} /* end draw_edges */
-
-static void draw_line_strip ( tel_qstrip_data p, tel_colour c, Tint nf, Tint nc ) {
-
- int i, m1, m2, n1, n2, n3, n4;
-
- glColor3fv ( c -> rgb );
-
- for ( i = 0; i < nf; ++i ) {
-
- glBegin ( GL_LINE_STRIP );
- m1 = i / nc;
- m2 = i % nc;
- n1 = m1 * ( nc + 1 ) + m2;
- n2 = n1 + nc + 1;
- n3 = n2 + 1;
- n4 = n1 + 1;
-
- glVertex3fv ( p -> vertices[ n1 ].xyz );
- glVertex3fv ( p -> vertices[ n2 ].xyz );
- glVertex3fv ( p -> vertices[ n3 ].xyz );
- glVertex3fv ( p -> vertices[ n4 ].xyz );
- glVertex3fv ( p -> vertices[ n1 ].xyz );
- glEnd();
-
- } /* end for */
-
-} /* end draw_line_strip */
-/*----------------------------------------------------------------------*/
-
-static TStatus
-QuadrangleInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i, j;
- tel_qstrip_data d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
- Tchar *cur_ptr = 0;
- Tint nf, nv;
-
- d = (tel_qstrip_data)data.pdata;
- nf = d->num_rows * d->num_columns;
- nv = ( d->num_rows + 1 ) * ( d->num_columns + 1 );
-
- if( d->fcolours )
- size_reqd += ( nf * sizeof( TEL_COLOUR ) );
-
- if( d->facet_flag == TEL_FA_NORMAL )
- size_reqd += ( nf * sizeof( TEL_POINT ) );
-
- size_reqd += ( nv * sizeof( TEL_POINT ) );
-
- if( d->vcolours )
- size_reqd += ( nv * sizeof( TEL_COLOUR ) );
-
- if( d->vertex_flag == TEL_VT_NORMAL )
- size_reqd += ( nv * sizeof( TEL_POINT ) );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- cur_ptr = c->buf;
- w->quadmesh3data.shpflag = d->shape_flag;
- w->quadmesh3data.dim.x_dim = d->num_rows;
- w->quadmesh3data.dim.y_dim = d->num_columns;
-
- if( c->size >= size_reqd )
- {
- if( d->facet_flag == TEL_FA_NORMAL )
- {
- if( d->fcolours )
- {
- w->quadmesh3data.fctflag = TEL_FAFLAG_COLOURNORMAL;
- w->quadmesh3data.gnormals = (tel_point)(c->buf);
- for( j = 0; j < nf; j++ )
- {
- w->quadmesh3data.gnormals[j] = d->fnormals[j];
- }
- cur_ptr += ( nf * sizeof( TEL_POINT ) );
-
- w->quadmesh3data.facet_colour_vals =
- (tel_colour)(cur_ptr);
- for( j = 0; j < nf; j++ )
- {
- w->quadmesh3data.facet_colour_vals[j] =
- d->fcolours[j];
- }
- cur_ptr += ( nf * sizeof( TEL_COLOUR ) );
- }
- else
- {
- w->quadmesh3data.fctflag = TEL_FAFLAG_NORMAL;
- w->quadmesh3data.facet_colour_vals = 0;
- w->quadmesh3data.gnormals = (tel_point)(c->buf);
- for( j = 0; j < nf; j++ )
- {
- w->quadmesh3data.gnormals[j] = d->fnormals[j];
- }
- cur_ptr += ( nf * sizeof( TEL_POINT ) );
- }
- }
- else
- {
- w->quadmesh3data.gnormals = 0;
- if( d->fcolours )
- {
- w->quadmesh3data.fctflag = TEL_FAFLAG_COLOUR;
- w->quadmesh3data.facet_colour_vals =
- (tel_colour)(c->buf );
- for( j = 0; j < nf; j++ )
- {
- w->quadmesh3data.facet_colour_vals[j] =
- d->fcolours[j];
- }
- cur_ptr += ( nf * sizeof( TEL_COLOUR ) );
- }
- else
- {
- w->quadmesh3data.fctflag = TEL_FAFLAG_NONE;
- w->quadmesh3data.facet_colour_vals = 0;
- }
- }
-
- w->quadmesh3data.points = (tel_point)cur_ptr;
- for( j = 0; j < nv; j++ )
- {
- w->quadmesh3data.points[j] = d->vertices[j];
- }
- cur_ptr += ( nv * sizeof( TEL_POINT ) );
-
- if( d->vertex_flag == TEL_VT_NORMAL )
- {
- if( d->vcolours )
- {
- w->quadmesh3data.vrtflag = TEL_VTFLAG_COLOURNORMAL;
- w->quadmesh3data.vnormals = (tel_point)(cur_ptr);
- for( j = 0; j < nv; j++ )
- {
- w->quadmesh3data.vnormals[j] = d->vnormals[i];
- }
- cur_ptr += ( nv * sizeof( TEL_POINT ) );
-
- w->quadmesh3data.colours = (tel_colour)(cur_ptr);
-
- for( j = 0; j < nv; j++ )
- {
- w->quadmesh3data.colours[j] = d->vcolours[i];
- }
- }
- else
- {
- w->quadmesh3data.vrtflag = TEL_VTFLAG_NORMAL;
- w->quadmesh3data.colours = 0;
- w->quadmesh3data.vnormals = (tel_point)(cur_ptr);
-
- for( j = 0; j < nv; j++ )
- {
- w->quadmesh3data.vnormals[j] = d->vnormals[i];
- }
- }
- }
- else
- {
- w->quadmesh3data.vnormals = 0;
- if( d->vcolours )
- {
- w->quadmesh3data.vrtflag = TEL_VTFLAG_COLOUR;
- w->quadmesh3data.colours = (tel_colour)(cur_ptr);
- for( j = 0; j < nv; j++ )
- {
- w->quadmesh3data.colours[j] = d->vcolours[i];
- }
- }
- else
- {
- w->quadmesh3data.vrtflag = TEL_VTFLAG_NONE;
- w->quadmesh3data.colours = 0;
- }
- }
-
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_telem_filters.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-static TStatus RemoveNamesetDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus RemoveNamesetAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus RemoveNamesetDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus RemoveNamesetPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus RemoveNamesetInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- RemoveNamesetDisplay, /* PickTraverse */
- RemoveNamesetDisplay,
- RemoveNamesetAdd,
- RemoveNamesetDelete,
- RemoveNamesetPrint,
- RemoveNamesetInquire
-};
-
-
-MtblPtr
-TelRemoveNamesetInitClass( TelType* el )
-{
- *el = TelRemoveNameset;
- return MtdTbl;
-}
-
-static TStatus
-RemoveNamesetAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tint i, num, *ptr;
- tel_tint_data data;
-
- num = k[0]->id;
- data = new TEL_TINT_DATA();
- if( !data )
- return TFailure;
- data->data = new Tint[num];
- if( !data->data )
- return TFailure;
-
- for( i=0, ptr=(Tint*)(k[0]->data.pdata); i<num; i++ )
- {
- data->data[i] = ptr[i];
- }
- data->num = num;
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-RemoveNamesetDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_tint_data d = (tel_tint_data)data.pdata;
- TglNamesetRemove( d->num, d->data );
-
- return TSuccess;
-}
-
-static TStatus
-RemoveNamesetDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-RemoveNamesetPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_tint_data p;
-
- p = (tel_tint_data)data.pdata;
-
- fprintf( stdout, "TelRemoveNameset. Number: %d\n", p->num );
- for( i = 0; i < p->num; i++ )
- {
- fprintf( stdout, "\n\t\t v[%d] = %d", i, p->data[i] );
- }
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-static TStatus
-RemoveNamesetInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_tint_data d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
-
- d = (tel_tint_data)data.pdata;
-
- size_reqd = d->num * sizeof( Tint );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- w->name_set.number = d->num;
- if( c->size >= size_reqd )
- {
- w->name_set.integers = (Tint *)(c->buf);
- memcpy(w->name_set.integers, d->data, d->num*sizeof(Tint));
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_subrs :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-26-04-96 : FMN ; Correction warning compilation
-10-06-96 : CAL ; Transparence dans call_subr_set_refl_props
-17-07-96 : CAL ; Suppression de CALL_PHIGS_ELEM_HLHSR_ID
-07-10-96 : FMN ; Suppression code inutile
-21-08-97 : PCT ; ajout deuxieme passe pour les textures
-23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
-29-12-97 : FMN ; Ajout cas 4 pour call_subr_polygon_indices()
-30-12-97 : FMN ; CTS18312: Correction back material
-08-04-98 : FGU ; Ajout emission
-30-11-98 : FMN ; S3819 : Textes toujours visibles
-16-06-2000 : ATS,GG : G005 : Group of functions: call_subr_parray
-
-************************************************************************/
-
-#define IMP190602 /* GG Avoid memory leaks after creating a polyline
-// with vertex colors primitive.
-// Thanks to Ivan Fontaine (SAMTECH) for this improvment
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tgl_elems.hxx>
-#include <OpenGl_Memory.hxx>
-
-void
-call_subr_set_line_colr( Tfloat r, Tfloat g, Tfloat b )
-{
- CMN_KEY key;
- TEL_COLOUR col;
-
- col.rgb[0] = r,
- col.rgb[1] = g,
- col.rgb[2] = b;
- key.data.pdata = &col;
- TsmAddToStructure( TelPolylineColour, 1, &key );
-
- return;
-}
-
-
-void
-call_subr_polyline( CALL_DEF_LISTPOINTS * alpoints )
-{
- CMN_KEY key[4];
- cmn_key kp[4];
-
- kp[0] = &key[0], kp[1] = &key[1], kp[2] = &key[2], kp[3] = &key[3];
- key[0].id = NUM_LINES_ID;
- key[0].data.ldata = 1;
- key[1].id = VERTICES_ID;
- key[1].data.pdata = alpoints->UPoints.Points;
- key[2].id = BOUNDS_DATA_ID;
- key[2].data.pdata = &alpoints->NbPoints;
- key[3].id = NUM_VERTICES_ID;
- key[3].data.ldata = alpoints->NbPoints;
- TsmAddToStructure( TelPolyline, -4, kp );
-
- return;
-}
-
-
-void
-call_subr_polyline_data( CALL_DEF_LISTPOINTS * alpoints )
-{
- CMN_KEY key[5];
- cmn_key kp[5];
- tel_point points;
- tel_colour col;
- register Tint i;
-
- if( alpoints->TypePoints != 3 )
- return; /* Coordinates and Vertex Colour not Specified */
-
- points = new TEL_POINT[alpoints->NbPoints];
- if( !points )
- return;
-
- col = new TEL_COLOUR[alpoints->NbPoints];
- if( !col )
- {
- delete[] points;
- return;
- }
-
- for( i = 0; i < alpoints->NbPoints; i++ )
- {
- points[i].xyz[0] = alpoints->UPoints.PointsC[i].Point.x;
- points[i].xyz[1] = alpoints->UPoints.PointsC[i].Point.y;
- points[i].xyz[2] = alpoints->UPoints.PointsC[i].Point.z;
- col[i].rgb[0] = alpoints->UPoints.PointsC[i].Color.r;
- col[i].rgb[1] = alpoints->UPoints.PointsC[i].Color.g;
- col[i].rgb[2] = alpoints->UPoints.PointsC[i].Color.b;
- }
-
- key[0].id = NUM_LINES_ID;
- key[0].data.ldata = 1;
- key[1].id = VERTEX_COLOUR_VALS_ID;
- key[1].data.pdata = col;
- key[2].id = VERTICES_ID;
- key[2].data.pdata = points;
- key[3].id = BOUNDS_DATA_ID;
- key[3].data.pdata = &alpoints->NbPoints;
- key[4].id = NUM_VERTICES_ID;
- key[4].data.ldata = alpoints->NbPoints;
-
- for( i = 0; i < 5; i++ )
- kp[i] = &key[i];
-
- TsmAddToStructure( TelPolyline, -5, kp );
-
-#ifdef IMP190602
- delete[] points;
- delete col;
-#endif
-
- return;
-}
-
-
-
-void
-call_subr_remnameset( Tint num, Tint *ns )
-{
- CMN_KEY key;
-
- key.id = num;
- key.data.pdata = ns;
- TsmAddToStructure( TelRemoveNameset, 1, &key );
-
- return;
-}
-
-
-void
-call_subr_addnameset( Tint num, Tint *ns )
-{
- CMN_KEY key;
-
- key.id = num;
- key.data.pdata = ns;
- TsmAddToStructure( TelAddNameset, 1, &key );
-
- return;
-}
-
-void
-call_subr_set_back_int_colr( Tfloat r, Tfloat g, Tfloat b, Tfloat a )
-{
- CMN_KEY key;
- TEL_COLOUR col;
-
- col.rgb[0] = r,
- col.rgb[1] = g,
- col.rgb[2] = b;
- key.data.pdata = &col;
- TsmAddToStructure( TelBackInteriorColour, 1, &key );
-
- return;
-}
-
-
-
-void
-call_subr_set_int_colr( Tfloat r, Tfloat g, Tfloat b, Tfloat a )
-{
- CMN_KEY key;
- TEL_COLOUR col;
-
- col.rgb[0] = r,
- col.rgb[1] = g,
- col.rgb[2] = b;
- key.data.pdata = &col;
- TsmAddToStructure( TelInteriorColour, 1, &key );
-
- return;
-}
-
-void
-call_subr_set_edge_colr( Tfloat r, Tfloat g, Tfloat b )
-{
- CMN_KEY key;
- TEL_COLOUR col;
-
- col.rgb[0] = r,
- col.rgb[1] = g,
- col.rgb[2] = b;
- key.data.pdata = &col;
- TsmAddToStructure( TelEdgeColour, 1, &key );
-
- return;
-}
-
-
-void
-call_subr_set_refl_props( CALL_DEF_MATERIAL * material, Tint tag )
-{
- CMN_KEY key;
- TEL_SURF_PROP surface;
-
- /* Par defaut tout a 0 */
- surface.amb = ( float )0.0;
- surface.diff = ( float )0.0;
- surface.spec = ( float )0.0;
- surface.emsv = ( float )0.0;
- surface.isamb = (int)0;
- surface.isdiff = (int)0;
- surface.isspec = (int)0;
- surface.isemsv = (int)0;
- surface.isphysic = (int)0;
-
- /* Cas par cas pour l evaluation */
- if( material->IsAmbient )
- {
- surface.amb = material->Ambient;
- surface.isamb = 1;
- }
- if( material->IsDiffuse )
- {
- surface.diff = material->Diffuse;
- surface.isdiff = 1;
- }
- if( material->IsSpecular )
- {
- surface.spec = material->Specular;
- surface.isspec = 1;
- }
- if( material->IsEmission )
- {
- surface.emsv = material->Emission;
- surface.isemsv = 1;
- }
-
- /* type de materiel */
- if( material->IsPhysic )
- surface.isphysic = 1;
-
- /* Couleur du materiel */
-
- /* Couleur eclairage ambient */
- surface.ambcol.rgb[0] = material->ColorAmb.r;
- surface.ambcol.rgb[1] = material->ColorAmb.g;
- surface.ambcol.rgb[2] = material->ColorAmb.b;
-
- /* Couleur eclairage diffus */
- surface.difcol.rgb[0] = material->ColorDif.r;
- surface.difcol.rgb[1] = material->ColorDif.g;
- surface.difcol.rgb[2] = material->ColorDif.b;
-
- /* Couleur eclairage speculaire */
- surface.speccol.rgb[0] = material->ColorSpec.r;
- surface.speccol.rgb[1] = material->ColorSpec.g;
- surface.speccol.rgb[2] = material->ColorSpec.b;
-
- /* Couleur d emission */
- surface.emscol.rgb[0] = material->ColorEms.r;
- surface.emscol.rgb[1] = material->ColorEms.g;
- surface.emscol.rgb[2] = material->ColorEms.b;
-
- surface.shine = ( float )128 * material->Shininess;
- surface.env_reflexion = material->EnvReflexion;
-
- /* Dans la couche C++ :
- * prop->trans = 0. => opaque
- * prop->trans = 1. => transparent
- * en OpenGl c'est le contraire.
- */
- surface.trans = 1.0F - material->Transparency;
-
- key.data.pdata = &surface;
- TsmAddToStructure( tag ? TelBackSurfaceAreaProperties :
- TelSurfaceAreaProperties, 1, &key );
- return;
-}
-
-void
-call_subr_set_marker_colr( Tfloat r, Tfloat g, Tfloat b )
-{
- CMN_KEY key;
- TEL_COLOUR col;
-
- col.rgb[0] = r,
- col.rgb[1] = g,
- col.rgb[2] = b;
- key.data.pdata = &col;
- TsmAddToStructure( TelPolymarkerColour, 1, &key );
-
- return;
-}
-
-
-TStatus
-call_subr_get_exec_struct( Tint afather, Tint ason, Tint *ind )
-{
- tsm_node node;
- Tint i, num;
-
- if( TsmGetStructure( afather, &num, &node ) == TSuccess )
- {
- for( i = 0; i < num; i++, node = node->next )
- {
- if( node->elem.el == TelExecuteStructure )
- if( node->elem.data.ldata == ason )
- {
- *ind = (i+1);
- return TSuccess;
- }
- }
- }
- return TFailure;
-}
-
-
-void
-call_subr_marker( CALL_DEF_MARKER * amarker )
-{
- CMN_KEY key;
- TEL_POINT pt;
-
- key.id = 1;
- pt.xyz[0] = amarker->x,
- pt.xyz[1] = amarker->y,
- pt.xyz[2] = amarker->z;
- key.data.pdata = &pt;
- TsmAddToStructure( TelMarkerSet, 1, &key );
-
- return;
-}
-
-
-void
-call_subr_marker_set( CALL_DEF_LISTMARKERS * almarkers )
-{
- CMN_KEY key;
-
- key.id = almarkers->NbMarkers;
- key.data.pdata = almarkers->Markers;
- TsmAddToStructure( TelMarkerSet, 1, &key );
-
- return;
-}
-
-
-void
-call_subr_polygon( CALL_DEF_FACET * afacet )
-{
- CMN_KEY k[3];
-
- k[0].id = NUM_VERTICES_ID;
- k[0].data.ldata = afacet->NbPoints;
-
- k[1].id = SHAPE_FLAG_ID;
- k[1].data.ldata = TEL_SHAPE_UNKNOWN;
-
- switch (afacet->TypeFacet) {
- case 0 : /* TOP_UNKNOWN */
- k[1].data.ldata = TEL_SHAPE_UNKNOWN;
- break;
- case 1 : /* TOP_COMPLEX */
- k[1].data.ldata = TEL_SHAPE_COMPLEX;
- break;
- case 2 : /* TOP_CONCAVE */
- k[1].data.ldata = TEL_SHAPE_CONCAVE;
- break;
- case 3 : /* TOP_CONVEX */
- k[1].data.ldata = TEL_SHAPE_CONVEX;
- break;
- }
-
-#if defined(__sgi) || defined(IRIX)
- /* Pb avec le tesselator sgi */
- k[1].data.ldata = TEL_SHAPE_CONVEX;
-#endif
-
- k[2].id = VERTICES_ID;
- k[2].data.pdata = afacet->UPoints.Points;
-
- TsmAddToStructure( TelPolygon, 3, &k[0], &k[1], &k[2] );
-
- return;
-}
-
-
-void
-call_subr_polygon_data( CALL_DEF_FACET * afacet )
-{
- CMN_KEY k[10];
- cmn_key kp[10];
- Tint nk = 0, i;
- TEL_COLOUR col;
- void *npt;
- TEL_POINT *pts=0, *ptn=0;
- TEL_TEXTURE_COORD *ptt=0;
-
- k[nk].id = NUM_VERTICES_ID;
- k[nk].data.ldata = afacet->NbPoints;
- nk++;
-
- if( afacet->ColorIsDefined )
- {
- col.rgb[0] = afacet->Color.r;
- col.rgb[1] = afacet->Color.g;
- col.rgb[2] = afacet->Color.b;
-
- k[nk].id = FACET_COLOUR_VALS_ID;
- k[nk].data.pdata = &col;
- nk++;
- }
-
- if( afacet->NormalIsDefined )
- {
- npt = &afacet->Normal;
- k[nk].id = FNORMALS_ID;
- k[nk].data.pdata = npt;
- nk++;
- }
-
- switch (afacet->TypePoints)
- {
- case 1:
- {
- k[nk].id = SHAPE_FLAG_ID;
- k[nk].data.ldata = TEL_SHAPE_UNKNOWN;
- switch (afacet->TypeFacet) {
- case 0 : /* TOP_UNKNOWN */
- k[nk].data.ldata = TEL_SHAPE_UNKNOWN;
- break;
- case 1 : /* TOP_COMPLEX */
- k[nk].data.ldata = TEL_SHAPE_COMPLEX;
- break;
- case 2 : /* TOP_CONCAVE */
- k[nk].data.ldata = TEL_SHAPE_CONCAVE;
- break;
- case 3 : /* TOP_CONVEX */
- k[nk].data.ldata = TEL_SHAPE_CONVEX;
- break;
- }
-#if defined(__sgi) || defined(IRIX)
- /* Pb avec le tesselator sgi */
- k[nk].data.ldata = TEL_SHAPE_CONVEX;
-#endif
- nk++;
- k[nk].id = VERTICES_ID;
- k[nk].data.pdata = afacet->UPoints.Points;
- nk++;
- break;
- }
- case 2:
- {
- Tint i;
-
- k[nk].id = SHAPE_FLAG_ID;
- k[nk].data.ldata = TEL_SHAPE_UNKNOWN;
- switch (afacet->TypeFacet) {
- case 0 : /* TOP_UNKNOWN */
- k[nk].data.ldata = TEL_SHAPE_UNKNOWN;
- break;
- case 1 : /* TOP_COMPLEX */
- k[nk].data.ldata = TEL_SHAPE_COMPLEX;
- break;
- case 2 : /* TOP_CONCAVE */
- k[nk].data.ldata = TEL_SHAPE_CONCAVE;
- break;
- case 3 : /* TOP_CONVEX */
- k[nk].data.ldata = TEL_SHAPE_CONVEX;
- break;
- }
-#if defined(__sgi) || defined(IRIX)
- /* Pb avec le tesselator sgi */
- k[nk].data.ldata = TEL_SHAPE_CONVEX;
-#endif
- nk++;
- //cmn_memreserve( pts, afacet->NbPoints, 0 );
- pts = new TEL_POINT[afacet->NbPoints];
- k[nk].id = VERTICES_ID;
- k[nk].data.pdata = pts;
- nk++;
- //cmn_memreserve( ptn, afacet->NbPoints, 0 );
- ptn = new TEL_POINT[afacet->NbPoints];
- k[nk].id = VNORMALS_ID;
- k[nk].data.pdata = ptn;
- nk++;
- for( i = 0; i < afacet->NbPoints; i++ )
- {
- pts[i].xyz[0] = afacet->UPoints.PointsN[i].Point.x;
- pts[i].xyz[1] = afacet->UPoints.PointsN[i].Point.y;
- pts[i].xyz[2] = afacet->UPoints.PointsN[i].Point.z;
-
- ptn[i].xyz[0] = afacet->UPoints.PointsN[i].Normal.dx;
- ptn[i].xyz[1] = afacet->UPoints.PointsN[i].Normal.dy;
- ptn[i].xyz[2] = afacet->UPoints.PointsN[i].Normal.dz;
- }
- break;
- }
- case 5:
- {
- Tint i;
-
- k[nk].id = SHAPE_FLAG_ID;
- k[nk].data.ldata = TEL_SHAPE_UNKNOWN;
- switch (afacet->TypeFacet) {
- case 0 : /* TOP_UNKNOWN */
- k[nk].data.ldata = TEL_SHAPE_UNKNOWN;
- break;
- case 1 : /* TOP_COMPLEX */
- k[nk].data.ldata = TEL_SHAPE_COMPLEX;
- break;
- case 2 : /* TOP_CONCAVE */
- k[nk].data.ldata = TEL_SHAPE_CONCAVE;
- break;
- case 3 : /* TOP_CONVEX */
- k[nk].data.ldata = TEL_SHAPE_CONVEX;
- break;
- }
-#if defined(__sgi) || defined(IRIX)
- /* Pb avec le tesselator sgi */
- k[nk].data.ldata = TEL_SHAPE_CONVEX;
-#endif
- nk++;
- //cmn_memreserve( pts, afacet->NbPoints, 0 );
- pts = new TEL_POINT[afacet->NbPoints];
- k[nk].id = VERTICES_ID;
- k[nk].data.pdata = pts;
- nk++;
- //cmn_memreserve( ptn, afacet->NbPoints, 0 );
- ptn = new TEL_POINT[afacet->NbPoints];
- k[nk].id = VNORMALS_ID;
- k[nk].data.pdata = ptn;
- nk++;
- //cmn_memreserve( ptt, afacet->NbPoints, 0 );
- ptt = new TEL_TEXTURE_COORD[afacet->NbPoints];
- k[nk].id = VTEXTURECOORD_ID;
- k[nk].data.pdata = ptt;
- nk++;
- for( i = 0; i < afacet->NbPoints; i++ )
- {
- pts[i].xyz[0] = afacet->UPoints.PointsNT[i].Point.x;
- pts[i].xyz[1] = afacet->UPoints.PointsNT[i].Point.y;
- pts[i].xyz[2] = afacet->UPoints.PointsNT[i].Point.z;
-
- ptn[i].xyz[0] = afacet->UPoints.PointsNT[i].Normal.dx;
- ptn[i].xyz[1] = afacet->UPoints.PointsNT[i].Normal.dy;
- ptn[i].xyz[2] = afacet->UPoints.PointsNT[i].Normal.dz;
-
- ptt[i].xy[0] = afacet->UPoints.PointsNT[i].TextureCoord.tx;
- ptt[i].xy[1] = afacet->UPoints.PointsNT[i].TextureCoord.ty;
- }
- break;
- }
- }
-
- for( i = 0; i < nk; i++ )
- kp[i] = &k[i];
-
- TsmAddToStructure( TelPolygon, -nk, kp );
-
- if( pts )
- {
- //cmn_freemem( pts );
- delete[] pts;
- //cmn_freemem( ptn );
- delete[] ptn;
- //cmn_freemem( ptt );
- delete[] ptt;
- }
-
- return;
-}
-
-
-void
-call_subr_polygon_indices( CALL_DEF_LISTPOINTS * alpoints,
- CALL_DEF_LISTEDGES * aledges,
- CALL_DEF_LISTINTEGERS * albounds )
-{
- CMN_KEY k[10];
- cmn_key kp[10];
- Tint nk = 0, i;
- tel_point varr=0;
- tel_point narr=0;
- tel_colour carr=0;
- tel_texture_coord tarr=0;
- Tint *edgvis=NULL, *bounds, *indices;
- Tint num_indices;
-
- k[nk].id = NUM_VERTICES_ID;
- k[nk].data.ldata = alpoints->NbPoints;
- nk++;
-
- k[nk].id = NUM_FACETS_ID;
- k[nk].data.ldata = albounds->NbIntegers;
- nk++;
-
- k[nk].id = SHAPE_FLAG_ID;
- k[nk].data.ldata = TEL_SHAPE_UNKNOWN;
- nk++;
-
- if( aledges->NbEdges )
- {
- //cmn_memreserve( edgvis, aledges->NbEdges, 0 );
- edgvis = new Tint[aledges->NbEdges];
- if( !edgvis )
- return;
- for( i = 0; i < aledges->NbEdges; i++ )
- edgvis[i] = aledges->Edges[i].Type ? CALL_PHIGS_EDGE_OFF :
- CALL_PHIGS_EDGE_ON;
- k[nk].id = EDGE_DATA_ID;
- k[nk].data.pdata = edgvis;
- nk++;
- }
-
- bounds = new Tint[albounds->NbIntegers];
- if( !bounds )
- {
- delete[] edgvis;
- return;
- }
- for( i = 0, num_indices = 0; i < albounds->NbIntegers; i++ )
- {
- bounds[i] = albounds->Integers[i];
- num_indices += bounds[i];
- }
- k[nk].id = BOUNDS_DATA_ID;
- k[nk].data.pdata = bounds;
- nk++;
-
- indices = new Tint[num_indices];
- if( !indices )
- {
- delete[] edgvis;
- delete[] bounds;
- return;
- }
- for( i = 0; i < num_indices; i++ )
- indices[i] = aledges->Edges[i].Index1;
- k[nk].id = CONNECTIVITY_ID;
- k[nk].data.pdata = indices;
- nk++;
-
- switch( alpoints->TypePoints )
- {
- case 1 : /* Vertex Coordinates Specified */
- varr = new TEL_POINT[alpoints->NbPoints];
- if( !varr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- return;
- }
- for( i = 0; i < alpoints->NbPoints; i++ )
- varr[i].xyz[0] = alpoints->UPoints.Points[i].x,
- varr[i].xyz[1] = alpoints->UPoints.Points[i].y,
- varr[i].xyz[2] = alpoints->UPoints.Points[i].z;
- k[nk].id = VERTICES_ID;
- k[nk].data.pdata = varr;
- nk++;
- break;
-
- case 2 : /* Coordinates and Vertex Normal Specified */
- varr = new TEL_POINT[alpoints->NbPoints];
- if( !varr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- return;
- }
- narr = new TEL_POINT[alpoints->NbPoints];
- if( !narr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- delete[] varr;
- return;
- }
- for( i = 0; i < alpoints->NbPoints; i++ )
- {
- varr[i].xyz[0] = alpoints->UPoints.PointsN[i].Point.x,
- varr[i].xyz[1] = alpoints->UPoints.PointsN[i].Point.y,
- varr[i].xyz[2] = alpoints->UPoints.PointsN[i].Point.z;
-
- narr[i].xyz[0] = alpoints->UPoints.PointsN[i].Normal.dx,
- narr[i].xyz[1] = alpoints->UPoints.PointsN[i].Normal.dy,
- narr[i].xyz[2] = alpoints->UPoints.PointsN[i].Normal.dz;
- }
- k[nk].id = VERTICES_ID;
- k[nk].data.pdata = varr;
- nk++;
- k[nk].id = VNORMALS_ID;
- k[nk].data.pdata = narr;
- nk++;
- break;
-
- case 3 : /* Coordinates and Vertex Colour Specified */
- varr = new TEL_POINT[alpoints->NbPoints];
- if( !varr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- return;
- }
- carr = new TEL_COLOUR[alpoints->NbPoints];
- if( !carr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- delete[] varr;
- return;
- }
- for( i = 0; i < alpoints->NbPoints; i++ )
- {
- varr[i].xyz[0] = alpoints->UPoints.PointsC[i].Point.x,
- varr[i].xyz[1] = alpoints->UPoints.PointsC[i].Point.y,
- varr[i].xyz[2] = alpoints->UPoints.PointsC[i].Point.z;
-
- carr[i].rgb[0] = alpoints->UPoints.PointsC[i].Color.r,
- carr[i].rgb[1] = alpoints->UPoints.PointsC[i].Color.g,
- carr[i].rgb[2] = alpoints->UPoints.PointsC[i].Color.b;
- }
- k[nk].id = VERTICES_ID;
- k[nk].data.pdata = varr;
- nk++;
- k[nk].id = VERTEX_COLOUR_VALS_ID;
- k[nk].data.pdata = carr;
- nk++;
- break;
-
- case 4 : /* Coordinates and Vertex Colour and Vertex Normal Specified */
- varr = new TEL_POINT[alpoints->NbPoints];
- if( !varr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- return;
- }
- carr = new TEL_COLOUR[alpoints->NbPoints];
- if( !carr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- delete[] varr;
- return;
- }
- narr = new TEL_POINT[alpoints->NbPoints];
- if( !narr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- delete[] varr;
- delete[] carr;
- return;
- }
- for( i = 0; i < alpoints->NbPoints; i++ )
- {
- varr[i].xyz[0] = alpoints->UPoints.PointsNC[i].Point.x,
- varr[i].xyz[1] = alpoints->UPoints.PointsNC[i].Point.y,
- varr[i].xyz[2] = alpoints->UPoints.PointsNC[i].Point.z;
-
- carr[i].rgb[0] = alpoints->UPoints.PointsNC[i].Color.r,
- carr[i].rgb[1] = alpoints->UPoints.PointsNC[i].Color.g,
- carr[i].rgb[2] = alpoints->UPoints.PointsNC[i].Color.b;
-
- narr[i].xyz[0] = alpoints->UPoints.PointsNC[i].Normal.dx,
- narr[i].xyz[1] = alpoints->UPoints.PointsNC[i].Normal.dy,
- narr[i].xyz[2] = alpoints->UPoints.PointsNC[i].Normal.dz;
- }
- k[nk].id = VERTICES_ID;
- k[nk].data.pdata = varr;
- nk++;
- k[nk].id = VERTEX_COLOUR_VALS_ID;
- k[nk].data.pdata = carr;
- nk++;
- k[nk].id = VNORMALS_ID;
- k[nk].data.pdata = narr;
- nk++;
- break;
-
- case 5 : /* Coordinates and Vertex Normal and Texture Coordinates specified */
- varr = new TEL_POINT[alpoints->NbPoints];
- if( !varr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- return;
- }
- narr = new TEL_POINT[alpoints->NbPoints];
- if( !narr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- delete[] varr;
- return;
- }
- tarr = new TEL_TEXTURE_COORD[alpoints->NbPoints];
-
- if( !tarr )
- {
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- delete[] varr;
- delete[] narr;
- return;
- }
- for( i = 0; i < alpoints->NbPoints; i++ )
- {
- varr[i].xyz[0] = alpoints->UPoints.PointsNT[i].Point.x,
- varr[i].xyz[1] = alpoints->UPoints.PointsNT[i].Point.y,
- varr[i].xyz[2] = alpoints->UPoints.PointsNT[i].Point.z;
-
- narr[i].xyz[0] = alpoints->UPoints.PointsNT[i].Normal.dx,
- narr[i].xyz[1] = alpoints->UPoints.PointsNT[i].Normal.dy,
- narr[i].xyz[2] = alpoints->UPoints.PointsNT[i].Normal.dz;
-
- tarr[i].xy[0] = alpoints->UPoints.PointsNT[i].TextureCoord.tx,
- tarr[i].xy[1] = alpoints->UPoints.PointsNT[i].TextureCoord.ty;
- }
- k[nk].id = VERTICES_ID;
- k[nk].data.pdata = varr;
- nk++;
- k[nk].id = VNORMALS_ID;
- k[nk].data.pdata = narr;
- nk++;
- k[nk].id = VTEXTURECOORD_ID;
- k[nk].data.pdata = tarr;
- nk++;
- break;
- }
-
- for( i = 0; i < nk; i++ )
- kp[i] = &k[i];
-
-
- TsmAddToStructure( TelPolygonIndices, -nk, kp );
-
- delete[] edgvis;
- delete[] bounds;
- delete[] indices;
- delete[] varr;
- if( tarr )
- delete[] tarr;
- if( narr )
- delete[] narr;
- if( carr )
- delete[] carr;
-
- return;
-}
-
-
-void
-call_subr_polygon_set( CALL_DEF_LISTFACETS * alfacets )
-{
- CMN_KEY key[3];
- register Tint i, j, k;
-
- Tint num_bounds, *bounds;
- tel_point points;
-
- num_bounds = alfacets->NbFacets;
- bounds = new Tint[num_bounds];
- if( !bounds )
- return;
-
- for( i = 0, j = 0; i < num_bounds; i++ )
- j += alfacets->LFacets[i].NbPoints;
-
- points = new TEL_POINT[j];
- if( !points )
- {
- delete[] bounds;
- return;
- }
-
- for( i = 0, k = 0; i < num_bounds; i++ )
- for( j = 0; j < alfacets->LFacets[i].NbPoints; j++ )
- {
- points[k].xyz[0] = alfacets->LFacets[i].UPoints.Points[j].x;
- points[k].xyz[1] = alfacets->LFacets[i].UPoints.Points[j].y;
- points[k].xyz[2] = alfacets->LFacets[i].UPoints.Points[j].z;
- k++;
- }
-
- key[0].id = NUM_FACETS_ID;
- key[0].data.ldata = num_bounds;
- key[1].id = BOUNDS_DATA_ID;
- key[1].data.pdata = bounds;
- key[2].id = VERTICES_ID;
- key[2].data.pdata = points;
- TsmAddToStructure( TelPolygonSet, 3, &key[0], &key[1], &key[2] );
-
- delete[] bounds;
- delete[] points;
-
- return;
-}
-
-
-void
-call_subr_quadrangle( CALL_DEF_QUAD * aquad )
-{
- CMN_KEY key[15];
- cmn_key kp[15];
- Tint nk = 0, i;
- tel_point vertices, vnormals=0;
- tel_texture_coord vtexturecoord=0;
-
- /* key[nk].id = NUM_ROWS_ID; */
- key[nk].id = NUM_COLUMNS_ID;
- key[nk].data.ldata = aquad->SizeRow - 1;
- nk++;
- /* key[nk].id = NUM_COLUMNS_ID; */
- key[nk].id = NUM_ROWS_ID;
- key[nk].data.ldata = aquad->SizeCol - 1;
- nk++;
-
- //cmn_memreserve( vertices, aquad->NbPoints, 0 );
- vertices = new TEL_POINT[aquad->NbPoints];
- if( !vertices )
- return;
-
- switch( aquad->TypePoints )
- {
- case 1: /* Vertex Coordinates Specified */
- for( i = 0; i < aquad->NbPoints; i++ )
- {
- vertices[i].xyz[0] = aquad->UPoints.Points[i].x;
- vertices[i].xyz[1] = aquad->UPoints.Points[i].y;
- vertices[i].xyz[2] = aquad->UPoints.Points[i].z;
- }
- break;
-
- case 2: /* Coordinates and Vertex Normal Specified */
- //cmn_memreserve( vnormals, aquad->NbPoints, 0 );
- vnormals = new TEL_POINT[aquad->NbPoints];
- if( !vnormals )
- {
- //cmn_freemem( vertices );
- delete[] vertices;
- return;
- }
- for( i = 0; i < aquad->NbPoints; i++ )
- {
- vertices[i].xyz[0] = aquad->UPoints.PointsN[i].Point.x;
- vertices[i].xyz[1] = aquad->UPoints.PointsN[i].Point.y;
- vertices[i].xyz[2] = aquad->UPoints.PointsN[i].Point.z;
- vnormals[i].xyz[0] = aquad->UPoints.PointsN[i].Normal.dx;
- vnormals[i].xyz[1] = aquad->UPoints.PointsN[i].Normal.dy;
- vnormals[i].xyz[2] = aquad->UPoints.PointsN[i].Normal.dz;
- }
- key[nk].id = VNORMALS_ID;
- key[nk].data.pdata = vnormals;
- nk++;
- break;
-
- case 5: /* Coordinates and Vertex Normal and Texture Coordinate Specified */
- vnormals = new TEL_POINT[aquad->NbPoints];
- if( !vnormals )
- {
- delete[] vertices;
- return;
- }
- vtexturecoord = new TEL_TEXTURE_COORD[aquad->NbPoints];
- if (!vtexturecoord)
- {
- delete[] vnormals;
- delete[] vertices;
- }
- for( i = 0; i < aquad->NbPoints; i++ )
- {
- vertices[i].xyz[0] = aquad->UPoints.PointsNT[i].Point.x;
- vertices[i].xyz[1] = aquad->UPoints.PointsNT[i].Point.y;
- vertices[i].xyz[2] = aquad->UPoints.PointsNT[i].Point.z;
- vnormals[i].xyz[0] = aquad->UPoints.PointsNT[i].Normal.dx;
- vnormals[i].xyz[1] = aquad->UPoints.PointsNT[i].Normal.dy;
- vnormals[i].xyz[2] = aquad->UPoints.PointsNT[i].Normal.dz;
- vtexturecoord[i].xy[0] = aquad->UPoints.PointsNT[i].TextureCoord.tx;
- vtexturecoord[i].xy[1] = aquad->UPoints.PointsNT[i].TextureCoord.ty;
- }
- key[nk].id = VNORMALS_ID;
- key[nk].data.pdata = vnormals;
- nk++;
- key[nk].id = VTEXTURECOORD_ID;
- key[nk].data.pdata = vtexturecoord;
- nk++;
- break;
- }
-
- key[nk].id = VERTICES_ID;
- key[nk].data.pdata = vertices;
- nk++;
-
- for( i = 0; i < nk; i++ )
- kp[i] = &key[i];
-
- TsmAddToStructure( TelQuadrangle, -nk, kp );
-
- delete[] vertices;
- if (vtexturecoord)
- delete[] vtexturecoord;
- if( vnormals )
- delete[] vnormals;
-
- return;
-}
-
-void
-call_subr_set_text_colr( Tfloat r, Tfloat g, Tfloat b )
-{
- CMN_KEY key;
- TEL_COLOUR col;
-
- col.rgb[0] = r,
- col.rgb[1] = g,
- col.rgb[2] = b;
- key.data.pdata = &col;
- TsmAddToStructure( TelTextColour, 1, &key );
-
- return;
-}
-
-void
-call_subr_set_text_colr_subtitle( Tfloat r, Tfloat g, Tfloat b )
-{
- CMN_KEY key;
- TEL_COLOUR col;
-
- col.rgb[0] = r,
- col.rgb[1] = g,
- col.rgb[2] = b;
- key.data.pdata = &col;
- TsmAddToStructure( TelTextColourSubTitle, 1, &key );
-
- return;
-}
-
-
-void
-call_subr_triangle( CALL_DEF_TRIKE * atrike )
-{
- Tint i;
- tel_point vertices, vnormals=0;
- tel_texture_coord vtexturecoord=0;
- CMN_KEY key[15];
- cmn_key kp[15];
- Tint nk = 0;
-
- vertices = new TEL_POINT[atrike->NbPoints];
- if( !vertices )
- return;
-
- switch( atrike->TypePoints )
- {
- case 1: /* Vertex Coordinates Specified */
- for( i = 0; i < atrike->NbPoints; i++ )
- {
- vertices[i].xyz[0] = atrike->UPoints.Points[i].x;
- vertices[i].xyz[1] = atrike->UPoints.Points[i].y;
- vertices[i].xyz[2] = atrike->UPoints.Points[i].z;
- }
- break;
-
- case 2: /* Coordinates and Vertex Normal Specified */
- vnormals = new TEL_POINT[atrike->NbPoints];
- if( !vnormals )
- {
- delete[] vertices;
- return;
- }
- for( i = 0; i < atrike->NbPoints; i++ )
- {
- vertices[i].xyz[0] = atrike->UPoints.PointsN[i].Point.x;
- vertices[i].xyz[1] = atrike->UPoints.PointsN[i].Point.y;
- vertices[i].xyz[2] = atrike->UPoints.PointsN[i].Point.z;
- vnormals[i].xyz[0] = atrike->UPoints.PointsN[i].Normal.dx;
- vnormals[i].xyz[1] = atrike->UPoints.PointsN[i].Normal.dy;
- vnormals[i].xyz[2] = atrike->UPoints.PointsN[i].Normal.dz;
- }
- key[nk].id = VNORMALS_ID;
- key[nk].data.pdata = vnormals;
- nk++;
- break;
- case 5: /* Coordinates and Vertex Normal and Texture Coordinates Specified */
- vnormals = new TEL_POINT[atrike->NbPoints];
- if( !vnormals )
- {
- delete[] vertices;
- return;
- }
- vtexturecoord = new TEL_TEXTURE_COORD[atrike->NbPoints];
- if (!vtexturecoord)
- {
- delete[] vnormals;
- delete[] vertices;
- }
- for( i = 0; i < atrike->NbPoints; i++ )
- {
- vertices[i].xyz[0] = atrike->UPoints.PointsNT[i].Point.x;
- vertices[i].xyz[1] = atrike->UPoints.PointsNT[i].Point.y;
- vertices[i].xyz[2] = atrike->UPoints.PointsNT[i].Point.z;
- vnormals[i].xyz[0] = atrike->UPoints.PointsNT[i].Normal.dx;
- vnormals[i].xyz[1] = atrike->UPoints.PointsNT[i].Normal.dy;
- vnormals[i].xyz[2] = atrike->UPoints.PointsNT[i].Normal.dz;
- vtexturecoord[i].xy[0] = atrike->UPoints.PointsNT[i].TextureCoord.tx;
- vtexturecoord[i].xy[1] = atrike->UPoints.PointsNT[i].TextureCoord.ty;
- }
- key[nk].id = VNORMALS_ID;
- key[nk].data.pdata = vnormals;
- nk++;
- key[nk].id = VTEXTURECOORD_ID;
- key[nk].data.pdata = vtexturecoord;
- nk++;
- break;
- }
-
- key[nk].id = NUM_FACETS_ID;
- key[nk].data.ldata = atrike->NbPoints-2;
- nk++;
-
- key[nk].id = VERTICES_ID;
- key[nk].data.pdata = vertices;
- nk++;
-
- for( i = 0; i < nk; i++ )
- kp[i] = &key[i];
-
- TsmAddToStructure( TelTriangleMesh, -nk, kp );
-
- delete[] vertices;
- if( vnormals )
- delete[] vnormals;
-
- return;
-}
-
-
-void
-call_subr_set_highl_rep( Tint ind )
-{
- CMN_KEY key;
-
- key.data.ldata = ind;
- TsmAddToStructure( TelHighlightIndex, 1, &key );
-
- return;
-}
-
-
-#define CALL_ 128
-
-void
-call_subr_structure_exploration( Tint Id,
- Tint LabelBegin,
- Tint LabelEnd,
- Tint elem_num,
- Tint *elem_type,
- CALL_DEF_POINT *pt,
- CALL_DEF_NORMAL *npt,
- CALL_DEF_COLOR *cpt,
- CALL_DEF_NORMAL *nfa )
-{
-#define CALL_MAX_ELEMS_PRINT 1000000
- Tfloat r=0, g=0, b=0;
- Tfloat x=0, y=0, z=0;
- Tfloat nx=0, ny=0, nz=0;
- Tfloat dx=0, dy=0, dz=0;
-
- static Tint Initialisation = 1;
-
- Tchar *buffer=NULL;
- Tint actual_size; /* OUT content size */
- Tint err=0; /* OUT error indicator */
- TelType type; /* OUT element type */
- Tint size; /* OUT element size */
- Tint ws; /* OUT workstation */
-
- Tint index; /* element pointer value */
- Tint cur_index; /* OUT element pointer value */
- Teldata data; /* OUT data record */
-
- register int i, j;
- Tint MAXPOINTS;
- Tint MAXAREAS;
-
- static Tint idata, jdata, kdata;
-
- Tint printall; /* print all structure elements or not */
- Tint dump; /* print or not */
-
- static Tint IdCur; /* current structure id
- (for exploration step by step) */
- static Tint ElCur; /* current structure element number
- (for exploration step by step) */
- static Tint IndCur; /* current index point in the structure element
- (for exploration step by step) */
- static Tint JndCur; /* current index element in the structure element
- (for exploration step by step) */
- static Tint EndExplo;/* flag when the exploration of the current
- element is done.
- (for exploration step by step) */
-
- if( Initialisation )
- {
- Initialisation = 0;
- IdCur = -1;
- ElCur = -1;
- IndCur = -1;
- JndCur = 0;
- }
-
- dump = 0;
- printall = 1;
- MAXPOINTS = CALL_MAX_ELEMS_PRINT;
- MAXAREAS = CALL_MAX_ELEMS_PRINT;
-
- if( (LabelBegin == 0) && (LabelEnd == 0) )
- {
- dump = 1;
- printall = 0;
- }
-
- if( elem_num )
- {
- index = elem_num;
- dump = 1;
- printall = 1;
-
- npt->dx = npt->dy = npt->dz = nx = ny = nz = ( float )0.0;
- nfa->dx = nfa->dy = nfa->dz = dx = dy = dz = ( float )0.0;
- pt->x = pt->y = pt->z = x = y = z = ( float )0.0;
- cpt->r = cpt->g = cpt->b = r = g = b = ( float )0.0;
-
- if ( (Id != IdCur) || (ElCur != elem_num) || EndExplo )
- {
- IdCur = Id;
- ElCur = elem_num;
- IndCur = -1;
- JndCur = 0;
- }
- else
- {
- IndCur ++;
- }
- }
- else
- {
- index = 1;
- IdCur = -1;
- ElCur = -1;
- IndCur = -1;
- JndCur = 0;
- }
-
- call_func_open_struct (Id);
-
- while( index )
- {
- call_func_set_elem_ptr( index );
- if( call_func_inq_elem_ptr( &cur_index ) == TFailure )
- err = 1;
- else
- err = 0;
-
- /* it's the end */
- if( ( index != cur_index ) || err )
- {
- index = 0;
- break;
- }
- if( TelInqCurElemTypeSize( &type, &size ) == TFailure )
- err = 1;
- else
- err = 0;
-
- if( err || (type == CALL_PHIGS_ELEM_NIL) )
- {
- index = 0;
- break;
- }
-
- if( elem_num )
- {
- EndExplo = 0;
- *elem_type = type;
- }
-
- if( type == CALL_PHIGS_ELEM_LABEL )
- {
- buffer = (Tchar *)malloc( CALL_ );
- TelInqCurElemContent( CALL_, buffer, &actual_size, &data );
-
- if( data.idata == LabelBegin )
- dump = 1;
- if( ( LabelBegin == 0 ) && ( LabelEnd == 0 ) )
- dump = 1;
- if( dump )
- {
- if( elem_num )
- {
- if( IndCur >= 1 )
- {
- EndExplo = 1;
- }
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf( "\tELEM_LABEL\n" );
- printf( "\t\tLABEL %d\n", data.idata );
- }
- }
-
- if( data.idata == LabelEnd )
- dump = 0;
-
- free( buffer );
- }
-
- if( dump )
- {
- switch (type)
- {
- case CALL_PHIGS_ELEM_NIL :
- {
- if( elem_num )
- {
- if (IndCur >= 0)
- {
- EndExplo = 1;
- }
- else
- {
- x = y = z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_NIL\n");
- printf("\t\tNo data involved\n");
- }
- break;
- }
- case CALL_PHIGS_ELEM_POLYMARKER3 :
- {
- i = size;
- buffer = new Tchar[i];
- TelInqCurElemContent( i, buffer, &actual_size, &data );
- idata = size/sizeof( TEL_POINT );
- if( elem_num )
- {
- if( (IndCur > -1) && (IndCur < idata) )
- {
- i = IndCur;
- x = data.pts3[i].xyz[0];
- y = data.pts3[i].xyz[1];
- z = data.pts3[i].xyz[2];
- }
- if (IndCur >= idata)
- EndExplo = 1;
- }
- else
- {
- printf("\tELEM_POLYMARKER3\n");
- printf("\t\tPOLYMARKER 3 nb pts %d\n", idata);
- if (printall)
- {
- for (i=0; i<idata && i<MAXPOINTS; i++)
- printf( "\t\tpoint %d : %f %f %f\n", i,
- data.pts3[i].xyz[0],
- data.pts3[i].xyz[1],
- data.pts3[i].xyz[2] );
- }
- else
- {
- i = 0;
- printf( "\t\tfirst point %d : %f %f %f\n", i,
- data.pts3[i].xyz[0],
- data.pts3[i].xyz[1],
- data.pts3[i].xyz[2] );
- i = idata - 1;
- printf("\t\tlast point %d : %f %f %f\n", i,
- data.pts3[i].xyz[0],
- data.pts3[i].xyz[1],
- data.pts3[i].xyz[2]);
- }
- }
- delete[] buffer;
- break;
- }
- case CALL_PHIGS_ELEM_FILL_AREA_SET3 :
- {
- i = size;
- buffer = new Tchar[i];
- TelInqCurElemContent( i, buffer, &actual_size, &data );
- jdata = data.fillareaset3data.num_bounds;
- if( elem_num )
- {
- if ((IndCur == 0) && (JndCur == 0))
- kdata = 0;
- if (JndCur >= jdata)
- EndExplo = 1;
- else
- {
- if (IndCur == 0)
- {
- idata = data.fillareaset3data.bounds[JndCur];
- }
- else
- {
- if ((IndCur > -1) && (IndCur < idata))
- {
- x =
- data.fillareaset3data.points[kdata+IndCur].xyz[0];
- y =
- data.fillareaset3data.points[kdata+IndCur].xyz[1];
- z =
- data.fillareaset3data.points[kdata+IndCur].xyz[2];
-
- if(data.fillareaset3data.vrtflag ==
- CALL_PHIGS_VERT_COORD_NORMAL)
- {
- nx = data.fillareaset3data.vnormals[IndCur].xyz[0];
- ny = data.fillareaset3data.vnormals[IndCur].xyz[1];
- nz = data.fillareaset3data.vnormals[IndCur].xyz[2];
- }
- if(data.fillareaset3data.vrtflag ==
- CALL_PHIGS_VERT_COORD_COLOUR)
- {
- r =
- data.fillareaset3data.colours[kdata+IndCur].rgb[0];
- g =
- data.fillareaset3data.colours[kdata+IndCur].rgb[1];
- b =
- data.fillareaset3data.colours[kdata+IndCur].rgb[2];
- }
- if (data.fillareaset3data.vrtflag ==
- CALL_PHIGS_VERT_COORD_COLOUR_NORMAL)
- {
- nx = data.fillareaset3data.vnormals[IndCur].xyz[0];
- ny = data.fillareaset3data.vnormals[IndCur].xyz[1];
- nz = data.fillareaset3data.vnormals[IndCur].xyz[2];
- r =
- data.fillareaset3data.colours[kdata+IndCur].rgb[0];
- g =
- data.fillareaset3data.colours[kdata+IndCur].rgb[1];
- b =
- data.fillareaset3data.colours[kdata+IndCur].rgb[2];
- }
- }
- }
- if (IndCur >= idata)
- {
- kdata += data.fillareaset3data.bounds[JndCur];
- JndCur ++;
- IndCur = 0;
- }
- }
- }
- else
- {
- printf("\tELEM_FILL_AREA_SET3_DATA\n");
- printf("\t\tSET OF FILL AREA SET 3 WITH DATA\n");
- kdata = 0;
- printf("\t\tnb of faces %d\n", jdata);
- printf("\t\tfflag %d eflag %d vflag %d colr model RGB\n",
- data.fillareaset3data.faflag,
- data.fillareaset3data.edgflag,
- data.fillareaset3data.vrtflag );
- kdata = 0;
- for (j=0; j<jdata && j<MAXAREAS; j++)
- {
- idata = data.fillareaset3data.bounds[j];
- printf("\t\tface %d : %d vertices\n", j, idata);
- if (data.fillareaset3data.faflag ==
- CALL_PHIGS_FACET_NORMAL)
- printf("\t\t\tface normal %f %f %f\n",
- data.fillareaset3data.gnormal[j].xyz[0],
- data.fillareaset3data.gnormal[j].xyz[1],
- data.fillareaset3data.gnormal[j].xyz[2]);
- if (data.fillareaset3data.faflag ==
- CALL_PHIGS_FACET_COLOUR_NORMAL)
- printf("\t\t\tnormal %f %f %f\n",
- data.fillareaset3data.gnormal[j].xyz[0],
- data.fillareaset3data.gnormal[j].xyz[1],
- data.fillareaset3data.gnormal[j].xyz[2]);
- if (printall)
- for (i=0; i<idata && i<MAXPOINTS; i++)
- printf("\t\t\tvertex %d : %f %f %f\n", i,
- data.fillareaset3data.points[kdata+i].xyz[0],
- data.fillareaset3data.points[kdata+i].xyz[1],
- data.fillareaset3data.points[kdata+i].xyz[2]);
- else
- {
- i = 0;
- printf("\t\tfirst vertex %d : %f %f %f\n", i,
- data.fillareaset3data.points[kdata+i].xyz[0],
- data.fillareaset3data.points[kdata+i].xyz[1],
- data.fillareaset3data.points[kdata+i].xyz[2]);
-
- i = idata - 1;
- printf("\t\tlast vertex %d : %f %f %f\n", i,
- data.fillareaset3data.points[kdata+i].xyz[0],
- data.fillareaset3data.points[kdata+i].xyz[1],
- data.fillareaset3data.points[kdata+i].xyz[2]);
- }
- kdata += data.fillareaset3data.bounds[j];
- }
- delete[] buffer;
- break;
- }
- }
- case CALL_PHIGS_ELEM_FILL_AREA3 :
- {
- i = size;
- buffer = new Tchar[i];
- TelInqCurElemContent( i, buffer, &actual_size, &data );
- idata = data.fillarea3data.num_points;
-
- if( elem_num )
- {
- if( (IndCur > -1) && (IndCur < idata) )
- {
- i = IndCur;
- x = data.fillarea3data.points[i].xyz[0];
- y = data.fillarea3data.points[i].xyz[1];
- z = data.fillarea3data.points[i].xyz[2];
- }
- if( IndCur >= idata )
- EndExplo = 1;
- }
- else
- {
- printf( "\tELEM_FILL_AREA3\n" );
- printf( "\t\tFILL AREA 3 nb pts %d\n", idata );
- if( printall )
- {
- for( i=0; i<idata && i<MAXPOINTS; i++ )
- printf( "\t\tpoint %d : %f %f %f\n", i,
- data.fillarea3data.points[i].xyz[0],
- data.fillarea3data.points[i].xyz[1],
- data.fillarea3data.points[i].xyz[2] );
- }
- else
- {
- i = 0;
- printf("\t\tfirst point %d : %f %f %f\n", i,
- data.fillarea3data.points[i].xyz[0],
- data.fillarea3data.points[i].xyz[1],
- data.fillarea3data.points[i].xyz[2] );
- i = idata - 1;
- printf("\t\tlast point %d : %f %f %f\n", i,
- data.fillarea3data.points[i].xyz[0],
- data.fillarea3data.points[i].xyz[1],
- data.fillarea3data.points[i].xyz[2] );
- }
- }
- delete[] buffer;
- break;
- }
- case CALL_PHIGS_ELEM_ANNO_TEXT_REL3 :
- {
- buffer = new Tchar[size];
- TelInqCurElemContent( size, buffer, &actual_size, &data );
-
- if( elem_num )
- {
- if (IndCur == 0)
- {
- x = data.atext3.ref_pt.xyz[0];
- y = data.atext3.ref_pt.xyz[1];
- z = data.atext3.ref_pt.xyz[2];
- }
- if (IndCur == 1)
- {
- x = data.atext3.anno.xyz[0];
- y = data.atext3.anno.xyz[1];
- z = data.atext3.anno.xyz[2];
- }
- if( IndCur >= 2 )
- EndExplo = 1;
- }
- else
- {
- printf( "\tELEM_ANNO_TEXT_REL3\n" );
- printf( "\t\tANNOTATION TEXT RELATIVE 3 %S\n",
- data.atext3.string );
- printf( "\t\treference point %f %f %f\n",
- data.atext3.ref_pt.xyz[0],
- data.atext3.ref_pt.xyz[1],
- data.atext3.ref_pt.xyz[2] );
- printf( "\t\toffset %f %f %f\n",
- data.atext3.anno.xyz[0],
- data.atext3.anno.xyz[1],
- data.atext3.anno.xyz[2] );
- }
- delete[] buffer;
- break;
- }
- case CALL_PHIGS_ELEM_LINETYPE :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else {
- printf("\tELEM_LINETYPE\n");
- printf("\t\tLINETYPE %d\n", data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_LINEWIDTH :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.fdata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf( "\tELEM_LINEWIDTH\n" );
- printf( "\t\tLINEWIDTH SCALE FACTOR %f\n", data.fdata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_MARKER_TYPE :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if( IndCur >= 1 )
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_MARKER_TYPE\n");
- printf("\t\tMARKER TYPE %d\n", data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_MARKER_SIZE :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.fdata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_MARKER_SIZE\n");
- printf("\t\tMARKER SIZE SCALE FACTOR %f\n", data.fdata);
- }
- break;
- }
-#if 0
- case CALL_PHIGS_ELEM_TEXT_FONT : /* DECPHIGS */
- buffer = new Tchar[CALL_];
- TelInqCurElemContent (CALL_, buffer, &actual_size, &data);
- if( elem_num )
- if (IndCur >= 1)
- EndExplo = 1;
- else {
- x = data.idata;
- y = 0.0;
- z = 0.0;
- }
- else {
- printf("\tELEM_TEXT_FONT\n");
- printf("\t\tTEXT FONT %d\n", data.idata);
- }
- delete[] buffer;
- break;
-#endif
- case CALL_PHIGS_ELEM_CHAR_EXPAN :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.fdata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_CHAR_EXPAN\n");
- printf("\t\tCHARACTER EXPANSION FACTOR %f\n",data.fdata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_CHAR_SPACE :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.fdata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_CHAR_SPACE\n");
- printf("\t\tCHARACTER SPACING %f\n", data.fdata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_ANNO_CHAR_HT :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.fdata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_ANNO_CHAR_HT\n");
- printf("\t\tANNOTATION TEXT CHARACTER HEIGHT %f\n",
- data.fdata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_INT_STYLE :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.interior_style;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_INT_STYLE\n");
- printf("\t\tINTERIOR STYLE %d\n", data.interior_style);
- }
- break;
- }
- case CALL_PHIGS_ELEM_INT_STYLE_IND :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_INT_STYLE_IND\n");
- printf("\t\tINTERIOR STYLE INDEX %d\n", data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_EDGE_FLAG :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.edge_flag;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_EDGE_FLAG\n");
- printf("\t\tEDGE FLAG %d\n", data.edge_flag);
- }
- break;
- }
- case CALL_PHIGS_ELEM_EDGETYPE :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_EDGETYPE\n");
- printf("\t\tEDGETYPE %d\n", data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_EDGEWIDTH :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.fdata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_EDGEWIDTH\n");
- printf("\t\tEDGEWIDTH SCALE FACTOR %f\n", data.fdata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_ADD_NAMES_SET :
- {
- buffer = new Tchar[size];
- TelInqCurElemContent( size, buffer, &actual_size, &data );
- idata = data.name_set.number;
- if( elem_num )
- {
- if( (IndCur > -1) && (IndCur < idata) )
- {
- i = IndCur;
- x = ( float )data.name_set.integers[i];
- y = ( float )0.0;
- z = ( float )0.0;
- }
- if( IndCur >= idata )
- EndExplo = 1;
- }
- else
- {
- printf("\tELEM_ADD_NAMES_SET\n");
- printf("\t\tADD NAMES TO SET\n");
- for( i=0; i<idata; i++ )
- printf("\t\tnames %d : %d\n",
- i, data.name_set.integers[i]);
- }
- delete[] buffer;
- break;
- }
- case CALL_PHIGS_ELEM_REMOVE_NAMES_SET :
- {
- buffer = new Tchar[size];
- TelInqCurElemContent( size, buffer, &actual_size, &data );
- idata = data.name_set.number;
- if( elem_num )
- {
- if( (IndCur > -1) && (IndCur < idata) )
- {
- i = IndCur;
- x = ( float )data.name_set.integers[i];
- y = ( float )0.0;
- z = ( float )0.0;
- }
- if (IndCur >= idata)
- EndExplo = 1;
- }
- else
- {
- printf("\tELEM_REMOVE_NAMES_SET\n");
- printf("\t\tREMOVE NAMES FROM SET\n");
- for( i=0; i<idata; i++ )
- printf("\t\tnames %d : %d\n",
- i, data.name_set.integers[i]);
- }
- delete[] buffer;
- break;
- }
- case CALL_PHIGS_ELEM_LOCAL_MODEL_TRAN3 :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 0)
- EndExplo = 1;
- else
- {
- x = y = z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_LOCAL_MODEL_TRAN3\n");
- printf("\t\tLOCAL MODELLING TRANSFORMATION 3 comp %d\n",
- data.local_xform_3.compose_type);
- for( i=0; i<4; i++ )
- {
- printf("\t\t\t");
- for( j=0; j<4; j++ )
- printf(" %f", data.local_xform_3.mat3[i][j]);
- printf("\n");
- }
- }
- break;
- }
- case CALL_PHIGS_ELEM_VIEW_IND :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_VIEW_IND\n");
- printf("\t\tVIEW INDEX %d\n", data.idata);
-
- if(! call_subr_inquirews (Id, &ws))
- printf("\t\tERROR : no view definition\n");
- else
- {
- printf("\t\tview structure in %d workstation\n", ws);
- printf("\t\t**********************\n");
- printf("\t\tdefinition in the ws %d\n", ws);
- printf("\t\t**********************\n");
- TelPrintViewRepresentation( ws, Id );
- }
- }
- break;
- }
- case CALL_PHIGS_ELEM_EXEC_STRUCT :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_EXEC_STRUCT\n");
- printf("\t\tEXECUTE STRUCTURE %d\n", data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_APPL_DATA :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 0)
- EndExplo = 1;
- else
- {
- x = y = z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_APPL_DATA\n");
- printf("\t\tcontent not exploited\n");
- }
- break;
- }
- case CALL_PHIGS_ELEM_PICK_ID :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_PICK_ID\n");
- printf("\t\tPICK ID %d\n", data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_POLYLINE_SET3_DATA : /* DECPHIGS */
- {
- buffer = new Tchar[size];
- TelInqCurElemContent( size, buffer, &actual_size, &data);
- jdata = data.lineset3data.num_bounds;
-
- if( elem_num )
- {
- if( ( IndCur == -1 ) && ( JndCur == 0 ) )
- kdata = 0;
-
- if( JndCur >= jdata )
- EndExplo = 1;
- else
- {
- if (IndCur == 0)
- {
- idata = data.lineset3data.bounds[JndCur];
- }
- else
- {
- if ( ( IndCur > -1 ) && ( IndCur < idata ) )
- {
- x = data.lineset3data.points[kdata+IndCur].xyz[0];
- y = data.lineset3data.points[kdata+IndCur].xyz[1];
- z = data.lineset3data.points[kdata+IndCur].xyz[2];
-
- if( data.lineset3data.colours )
- {
- r =
- data.lineset3data.colours[kdata+IndCur].rgb[0];
- g =
- data.lineset3data.colours[kdata+IndCur].rgb[1];
- b =
- data.lineset3data.colours[kdata+IndCur].rgb[2];
- }
- }
-
- if( IndCur >= idata )
- {
- kdata += data.lineset3data.bounds[JndCur];
- JndCur ++;
- IndCur = 0;
- }
- }
- }
- }
- else
- {
- printf( "\tELEM_POLYLINE_SET3_DATA\n" );
- kdata = 0;
- printf( "\t\tPOLYLINE SET 3 WITH DATA\n" );
- printf( "\t\tnb of lines %d\n", jdata );
- printf( "\t\tvflag %d colr model RGB\n",
- data.lineset3data.vrtflag );
- for( j = 0; j < jdata && j < MAXAREAS; j++ )
- {
- idata = data.lineset3data.bounds[j];
- printf( "\t\tface %d : %d vertices\n", j, idata );
- if( printall )
- {
- for( i = 0; i < idata && i < MAXPOINTS; i++ )
- printf( "\t\t\tvertex %d : %f %f %f\n", i,
- data.lineset3data.points[kdata+i].xyz[0],
- data.lineset3data.points[kdata+i].xyz[1],
- data.lineset3data.points[kdata+i].xyz[2] );
- }
- else
- {
- i = 0;
- printf( "\t\tfirst vertex %d : %f %f %f\n", i,
- data.lineset3data.points[kdata+i].xyz[0],
- data.lineset3data.points[kdata+i].xyz[1],
- data.lineset3data.points[kdata+i].xyz[2] );
-
- i = idata - 1;
- printf( "\t\tlast vertex %d : %f %f %f\n", i,
- data.lineset3data.points[kdata+i].xyz[0],
- data.lineset3data.points[kdata+i].xyz[1],
- data.lineset3data.points[kdata+i].xyz[2] );
- }
- kdata += data.lineset3data.bounds[j];
- }
- }
- delete[] buffer;
- break;
- }
- case CALL_PHIGS_ELEM_TRI_STRIP3_DATA :
- {
- buffer = new Tchar[size];
- TelInqCurElemContent( size, buffer, &actual_size, &data );
- idata = data.trianglestrip3data.num_facets + 2;
-
- if( elem_num )
- {
- if (IndCur >= idata)
- EndExplo = 1;
- else
- {
- x = data.trianglestrip3data.points[IndCur].xyz[0];
- y = data.trianglestrip3data.points[IndCur].xyz[1];
- z = data.trianglestrip3data.points[IndCur].xyz[2];
-
- if( data.trianglestrip3data.vrtflag ==
- CALL_PHIGS_VERT_COORD_COLOUR )
- {
- r = data.trianglestrip3data.colours[IndCur].rgb[0];
- g = data.trianglestrip3data.colours[IndCur].rgb[1];
- b = data.trianglestrip3data.colours[IndCur].rgb[2];
- }
- else if( data.trianglestrip3data.vrtflag ==
- CALL_PHIGS_VERT_COORD_NORMAL )
- {
- nx =
- data.trianglestrip3data.vnormals[IndCur].xyz[0];
- ny =
- data.trianglestrip3data.vnormals[IndCur].xyz[1];
- nz =
- data.trianglestrip3data.vnormals[IndCur].xyz[2];
- }
- else if( data.trianglestrip3data.vrtflag ==
- CALL_PHIGS_VERT_COORD_COLOUR_NORMAL )
- {
- nx =
- data.trianglestrip3data.vnormals[IndCur].xyz[0];
- ny =
- data.trianglestrip3data.vnormals[IndCur].xyz[1];
- nz =
- data.trianglestrip3data.vnormals[IndCur].xyz[2];
- r = data.trianglestrip3data.colours[IndCur].rgb[0];
- g = data.trianglestrip3data.colours[IndCur].rgb[1];
- b = data.trianglestrip3data.colours[IndCur].rgb[2];
- }
- }
- }
- else
- {
- printf("\tELEM_TRI_STRIP3_DATA\n");
- printf("\t\tTRIANGLE STRIP 3 WITH DATA\n");
- printf("\t\tnb of vertices %d\n", idata);
- printf("\t\tfflag %d vflag %d colr model RGB\n",
- data.trianglestrip3data.fctflag,
- data.trianglestrip3data.vrtflag);
- if( printall )
- for( i=0; i<idata && i<MAXPOINTS; i++ )
- printf("\t\t\tvertex %d : %f %f %f\n", i,
- data.trianglestrip3data.points[i].xyz[0],
- data.trianglestrip3data.points[i].xyz[1],
- data.trianglestrip3data.points[i].xyz[2] );
- else
- {
- i = 0;
- printf("\t\tfirst vertex %d : %f %f %f\n", i,
- data.trianglestrip3data.points[i].xyz[0],
- data.trianglestrip3data.points[i].xyz[1],
- data.trianglestrip3data.points[i].xyz[2]);
-
- i = idata - 1;
- printf("\t\tlast vertex %d : %f %f %f\n", i,
- data.trianglestrip3data.points[i].xyz[0],
- data.trianglestrip3data.points[i].xyz[1],
- data.trianglestrip3data.points[i].xyz[2]);
- }
- }
- delete buffer;
- break;
- }
- case CALL_PHIGS_ELEM_QUAD_MESH3_DATA :
- {
- buffer = new Tchar[size];
- TelInqCurElemContent( size, buffer, &actual_size, &data);
- idata = (data.quadmesh3data.dim.x_dim+1) *
- (data.quadmesh3data.dim.y_dim+1);
-
- if( elem_num )
- {
- if (IndCur >= idata)
- EndExplo = 1;
- else
- {
- x = data.quadmesh3data.points[IndCur].xyz[0];
- y = data.quadmesh3data.points[IndCur].xyz[1];
- z = data.quadmesh3data.points[IndCur].xyz[2];
-
- if( data.quadmesh3data.vrtflag ==
- CALL_PHIGS_VERT_COORD_COLOUR )
- {
- r = data.quadmesh3data.colours[IndCur].rgb[0];
- g = data.quadmesh3data.colours[IndCur].rgb[1];
- b = data.quadmesh3data.colours[IndCur].rgb[2];
- }
- else if( data.quadmesh3data.vrtflag ==
- CALL_PHIGS_VERT_COORD_NORMAL )
- {
- nx = data.quadmesh3data.vnormals[IndCur].xyz[0];
- ny = data.quadmesh3data.vnormals[IndCur].xyz[1];
- nz = data.quadmesh3data.vnormals[IndCur].xyz[2];
- }
- else if( data.quadmesh3data.vrtflag ==
- CALL_PHIGS_VERT_COORD_COLOUR_NORMAL )
- {
- nx = data.quadmesh3data.vnormals[IndCur].xyz[0];
- ny = data.quadmesh3data.vnormals[IndCur].xyz[1];
- nz = data.quadmesh3data.vnormals[IndCur].xyz[2];
- r = data.quadmesh3data.colours[IndCur].rgb[0];
- g = data.quadmesh3data.colours[IndCur].rgb[1];
- b = data.quadmesh3data.colours[IndCur].rgb[2];
- }
- }
- }
- else
- {
- printf("\tELEM_QUAD_MESH3_DATA\n");
- printf("\t\tQUADRILATERAL MESH 3 WITH DATA\n");
- printf("\t\tdimensions %d %d\n",
- data.quadmesh3data.dim.x_dim,
- data.quadmesh3data.dim.y_dim);
- printf("\t\tnb of vertices %d\n", idata);
- printf("\t\tfflag %d vflag %d colr model RGB\n",
- data.quadmesh3data.fctflag,
- data.quadmesh3data.vrtflag);
- if( printall )
- {
- for( i=0; i<idata && i<MAXPOINTS; i++ )
- printf("\t\t\tvertex %d : %f %f %f\n", i,
- data.quadmesh3data.points[i].xyz[0],
- data.quadmesh3data.points[i].xyz[1],
- data.quadmesh3data.points[i].xyz[2]);
- }
- else
- {
- i = 0;
- printf("\t\tfirst vertex %d : %f %f %f\n", i,
- data.quadmesh3data.points[i].xyz[0],
- data.quadmesh3data.points[i].xyz[1],
- data.quadmesh3data.points[i].xyz[2]);
-
- i = idata - 1;
- printf("\t\tlast vertex %d : %f %f %f\n", i,
- data.quadmesh3data.points[i].xyz[0],
- data.quadmesh3data.points[i].xyz[1],
- data.quadmesh3data.points[i].xyz[2]);
- }
- }
- delete[] buffer;
- break;
- }
- case CALL_PHIGS_ELEM_TEXT_COLR :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.gnl_colour.rgb[0];
- y = data.gnl_colour.rgb[1];
- z = data.gnl_colour.rgb[2];
- }
- }
- else
- {
- printf("\tELEM_TEXT_COLR\n");
- printf("\t\tTEXT COLOUR r %f g %f b %f\n",
- data.gnl_colour.rgb[0],
- data.gnl_colour.rgb[1],
- data.gnl_colour.rgb[2] );
- }
- break;
- }
- case CALL_PHIGS_ELEM_MARKER_COLR :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.gnl_colour.rgb[0];
- y = data.gnl_colour.rgb[1];
- z = data.gnl_colour.rgb[2];
- }
- }
- else
- {
- printf("\tELEM_MARKER_COLR\n");
- printf("\t\tPOLYMARKER COLOUR r %f g %f b %f\n",
- data.gnl_colour.rgb[0],
- data.gnl_colour.rgb[1],
- data.gnl_colour.rgb[2] );
- }
- break;
- }
- case CALL_PHIGS_ELEM_EDGE_COLR :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.gnl_colour.rgb[0];
- y = data.gnl_colour.rgb[1];
- z = data.gnl_colour.rgb[2];
- }
- }
- else
- {
- printf("\tELEM_EDGE_COLR\n");
- printf("\t\tEDGE COLOUR r %f g %f b %f\n",
- data.gnl_colour.rgb[0],
- data.gnl_colour.rgb[1],
- data.gnl_colour.rgb[2]);
- }
- break;
- }
- case CALL_PHIGS_ELEM_LINE_COLR :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.gnl_colour.rgb[0];
- y = data.gnl_colour.rgb[1];
- z = data.gnl_colour.rgb[2];
- }
- }
- else
- {
- printf("\tELEM_LINE_COLR\n");
- printf("\t\tPOLYLINE COLOUR r %f g %f b %f\n",
- data.gnl_colour.rgb[0],
- data.gnl_colour.rgb[1],
- data.gnl_colour.rgb[2]);
- }
- break;
- }
- case CALL_PHIGS_ELEM_INT_COLR :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.gnl_colour.rgb[0];
- y = data.gnl_colour.rgb[1];
- z = data.gnl_colour.rgb[2];
- }
- }
- else
- {
- printf("\tELEM_INT_COLR\n");
- printf("\t\tINTERIOR COLOUR r %f g %f b %f\n",
- data.gnl_colour.rgb[0],
- data.gnl_colour.rgb[1],
- data.gnl_colour.rgb[2]);
- }
- break;
- }
- case CALL_PHIGS_ELEM_BACK_INT_COLR :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = data.gnl_colour.rgb[0];
- y = data.gnl_colour.rgb[1];
- z = data.gnl_colour.rgb[2];
- }
- }
- else
- {
- printf("\tELEM_BACK_INT_COLR\n");
- printf("\t\tBACK INTERIOR COLOUR r %f g %f b %f\n",
- data.gnl_colour.rgb[0],
- data.gnl_colour.rgb[1],
- data.gnl_colour.rgb[2]);
- }
- break;
- }
- case CALL_PHIGS_ELEM_REFL_PROPS :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur == 0)
- {
- x = data.surf_prop.amb;
- y = data.surf_prop.diff;
- z = data.surf_prop.trans;
- }
- if (IndCur == 1)
- {
- x = data.surf_prop.speccol.rgb[0];
- y = data.surf_prop.speccol.rgb[1];
- z = data.surf_prop.speccol.rgb[2];
- }
- if (IndCur == 2)
- {
- x = data.surf_prop.spec;
- y = data.surf_prop.shine;
- z = ( float )0.0;
- }
- if (IndCur >= 3)
- EndExplo = 1;
- }
- else
- {
- printf("\tELEM_REFL_PROPS\n");
- printf("\t\tREFLECTANCE PROPERTIES\n");
- printf("\t\tamb coef %f diff coef %f trans coef %f\n",
- data.surf_prop.amb,
- data.surf_prop.diff,
- data.surf_prop.trans);
- printf("\t\tspecular color r %f g %f b %f\n",
- data.surf_prop.speccol.rgb[0],
- data.surf_prop.speccol.rgb[1],
- data.surf_prop.speccol.rgb[2]);
- printf("\t\tspecular coef %f exp %f\n",
- data.surf_prop.spec,
- data.surf_prop.shine);
- }
- break;
- }
- case CALL_PHIGS_ELEM_BACK_REFL_PROPS :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur == 0) {
- x = data.surf_prop.amb;
- y = data.surf_prop.diff;
- z = data.surf_prop.trans;
- }
- if (IndCur == 1) {
- x = data.surf_prop.speccol.rgb[0];
- y = data.surf_prop.speccol.rgb[1];
- z = data.surf_prop.speccol.rgb[2];
- }
- if (IndCur == 2) {
- x = data.surf_prop.spec;
- y = data.surf_prop.shine;
- z = ( float )0.0;
- }
- if (IndCur >= 3)
- EndExplo = 1;
- }
- else
- {
- printf("\tELEM_BACK_REFL_PROPS\n");
- printf("\t\tBACK REFLECTANCE PROPERTIES\n");
- printf("\t\tamb coef %f diff coef %f trans coef %f\n",
- data.surf_prop.amb,
- data.surf_prop.diff,
- data.surf_prop.trans);
- printf("\t\tspecular color r %f g %f b %f\n",
- data.surf_prop.speccol.rgb[0],
- data.surf_prop.speccol.rgb[1],
- data.surf_prop.speccol.rgb[2]);
- printf("\t\tspecular coef %f exp %f\n",
- data.surf_prop.spec,
- data.surf_prop.shine);
- }
- break;
- }
- case CALL_PHIGS_ELEM_INT_SHAD_METH :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_INT_SHAD_METH\n");
- printf("\t\tINTERIOR SHADING METHOD %d\n", data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_INT_REFL_EQN :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_INT_REFL_EQN\n");
- printf("\t\tREFLECTANCE EQUATION %d\n", data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_BACK_INT_REFL_EQN :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_BACK_INT_REFL_EQN\n");
- printf("\t\tBACK INTERIOR REFLECTANCE EQUATION %d\n",
- data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_FACE_DISTING_MODE :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_FACE_DISTING_MODE\n");
- printf("\t\tFACE DISTINGUISHING MODE %d\n", data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_FACE_CULL_MODE :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_FACE_CULL_MODE\n");
- printf("\t\tFACE CULLING MODE %d\n", data.idata);
- }
- break;
- }
- case CALL_PHIGS_ELEM_LIGHT_SRC_STATE :
- {
- buffer = new Tchar[size];
- TelInqCurElemContent( size, buffer, &actual_size, &data );
- idata = data.light_source_state.on.number;
- jdata = data.light_source_state.off.number;
- if( elem_num )
- {
- if ( (IndCur >= idata) && (IndCur >= jdata) )
- EndExplo = 1;
- else
- {
- if (IndCur < idata)
- x = ( float )data.light_source_state.on.integers[IndCur];
- if (IndCur < jdata)
- nx = ( float )data.light_source_state.off.integers[IndCur];
- }
- }
- else
- {
- printf("\tELEM_LIGHT_SRC_STATE\n");
- for (i=0; i<idata; i++)
- printf("\t\tactive light %d\n",
- data.light_source_state.on.integers[i]);
- for (j=0; j<jdata; j++)
- printf("\t\tinactive light %d\n",
- data.light_source_state.off.integers[j]);
- }
- delete[] buffer;
- break;
- }
- case CALL_PHIGS_ELEM_DCUE_IND :
- {
- TelInqCurElemContent( 0, buffer, &actual_size, &data );
- if( elem_num )
- {
- if (IndCur >= 1)
- EndExplo = 1;
- else
- {
- x = ( float )data.idata;
- y = ( float )0.0;
- z = ( float )0.0;
- }
- }
- else
- {
- printf("\tELEM_DCUE_IND\n");
- printf("\t\tDEPTH CUE INDEX %d\n", data.idata);
- }
- break;
- }
- default:
- break;
- }
- }
-
- if( elem_num )
- {
- index = 0;
- pt->x = x;
- pt->y = y;
- pt->z = z;
- npt->dx = nx;
- npt->dy = ny;
- npt->dz = nz;
- cpt->r = r;
- cpt->g = g;
- cpt->b = b;
- nfa->dx = dx;
- nfa->dy = dy;
- nfa->dz = dz;
-
- if( EndExplo )
- *elem_type = 0;
- }
- else
- index ++;
- } /* while (index) */
-
- call_func_close_struct ();
-}
-
-Tint
-call_subr_inquirews( Tint struct_id, Tint *ws_id )
-{
- Tint act_size;
-
- TsmGetWSPosted( struct_id, 1, ws_id, &act_size );
-
- if( act_size )
- return 1;
- else
- return 0;
-}
-
-
-void
-call_subr_polygon_holes( CALL_DEF_LISTFACETS * alfacets )
-{
- register int i, j, k;
- int go;
- CMN_KEY k1, k2, k3;
-
- Tint *bounds;
- TEL_POINT *points;
-
- bounds = new Tint[alfacets->NbFacets];
-
- j = 0;
- for( i=0; i<alfacets->NbFacets; i++ )
- j += alfacets->LFacets[i].NbPoints;
-
- points = new TEL_POINT[j];
-
- for( i = 0; i < alfacets->NbFacets; i++ )
- bounds[i] = alfacets->LFacets[i].NbPoints;
-
- k = 0;
- for (i=0; i<alfacets->NbFacets; i++)
- {
- for (j=0; j<alfacets->LFacets[i].NbPoints; j++)
- {
- points[k].xyz[0] = alfacets->LFacets[i].UPoints.Points[j].x;
- points[k].xyz[1] = alfacets->LFacets[i].UPoints.Points[j].y;
- points[k].xyz[2] = alfacets->LFacets[i].UPoints.Points[j].z;
- k++;
- }
- }
-
- go = 1;
- if( bounds == 0 )
- go = 0;
- if( points == 0 )
- go = 0;
-
- if( go )
- {
- k1.id = NUM_FACETS_ID;
- k1.data.ldata = alfacets->NbFacets;
- k2.id = BOUNDS_DATA_ID;
- k2.data.pdata = bounds;
- k3.id = VERTICES_ID;
- k3.data.pdata = points;
-
- TsmAddToStructure( TelPolygonHoles, 3, &k1, &k2, &k3 );
- }
-
- if( bounds != 0 )
- delete[] bounds;
- if( points != 0 )
- delete[] points;
-}
-
-void
-call_subr_polygon_holes_data( CALL_DEF_LISTFACETS * alfacets )
-{
- register Tint i, j, k, count=0;
- CMN_KEY key[10];
- cmn_key kk[10];
- int go;
- Tint num_vertices;
- Tint num_bounds, *bounds = 0;
- TEL_POINT *vertices = 0;
- TEL_POINT *vnormals = 0;
-
- for( i = 0; i < 10; i++ )
- kk[i] = &key[i];
-
- key[count].id = SHAPE_FLAG_ID;
- key[count].data.ldata = TEL_SHAPE_UNKNOWN;
- count++;
-
- key[count].id = NUM_FACETS_ID;
- key[count].data.ldata = alfacets->NbFacets;
- count++;
-
- num_bounds = alfacets->NbFacets;
- bounds = new Tint[num_bounds];
-
- key[count].id = BOUNDS_DATA_ID;
- key[count].data.pdata = bounds;
- count++;
-
- num_vertices = 0;
- for( i=0; i<num_bounds; i++ )
- num_vertices += alfacets->LFacets[i].NbPoints;
-
- k = 0;
- for( i=0; i<num_bounds; i++ )
- {
- bounds[i] = alfacets->LFacets[i].NbPoints;
-
- switch( alfacets->LFacets[i].TypePoints )
- {
- case 1 : /* Coordinates Specified */
- {
- if( vertices == 0 )
- {
- vertices = new TEL_POINT[num_vertices];
-
- key[count].id = VERTICES_ID;
- key[count].data.pdata = vertices;
- count++;
- }
-
- for( j=0; j<alfacets->LFacets[i].NbPoints; j++ )
- {
- vertices[k].xyz[0] = alfacets->LFacets[i].UPoints.Points[j].x;
- vertices[k].xyz[1] = alfacets->LFacets[i].UPoints.Points[j].y;
- vertices[k].xyz[2] = alfacets->LFacets[i].UPoints.Points[j].z;
- k++;
- }
-
- break;
- }
-
- case 2 : /* Coordinates and Vertex Normal Specified */
- {
- if( vertices == 0 )
- {
- vertices = new TEL_POINT[num_vertices];
-
- key[count].id = VERTICES_ID;
- key[count].data.pdata = vertices;
- count++;
-
- vnormals = new TEL_POINT[num_vertices];
- key[count].id = VNORMALS_ID;
- key[count].data.pdata = vnormals;
- count++;
- }
-
- for( j=0; j<alfacets->LFacets[i].NbPoints; j++ )
- {
- vertices[k].xyz[0] =
- alfacets->LFacets[i].UPoints.PointsN[j].Point.x;
- vertices[k].xyz[1] =
- alfacets->LFacets[i].UPoints.PointsN[j].Point.y;
- vertices[k].xyz[2] =
- alfacets->LFacets[i].UPoints.PointsN[j].Point.z;
- vnormals[k].xyz[0] =
- alfacets->LFacets[i].UPoints.PointsN[j].Normal.dx;
- vnormals[k].xyz[1] =
- alfacets->LFacets[i].UPoints.PointsN[j].Normal.dy;
- vnormals[k].xyz[2] =
- alfacets->LFacets[i].UPoints.PointsN[j].Normal.dz;
- k++;
- }
-
- break;
- }
- }
- }
-
- go = 1;
- if(bounds == 0)
- go = 0;
- if(vertices == 0)
- go = 0;
- if(vnormals == 0)
- go = 0;
-
- if(go)
- {
- TsmAddToStructure( TelPolygonHoles, -count, kk );
- }
-
- if(bounds)
- delete[] bounds;
- if(vertices)
- delete[] vertices;
- if(vnormals)
- delete[] vnormals;
-}
-
-
-void
-call_subr_curve( CALL_DEF_LISTPOINTS * alpoints )
-{
- CMN_KEY key[3];
- cmn_key kp[3];
-
- kp[0] = &key[0], kp[1] = &key[1], kp[2] = &key[2];
-
- key[0].id = CURVE_TYPE_ID;
- key[0].data.ldata = TelBezierCurve;
-
- key[1].id = CURVE_NUM_POINTS_ID;
- key[1].data.ldata = 20;
-
- key[2].id = CURVE_VERTICES_ID;
- key[2].data.pdata = alpoints->UPoints.Points;
-
- TsmAddToStructure( TelCurve, -3, kp );
-
- return;
-}
-
-/* *** PARRAY functions *** */
-
-void call_subr_parray( CALL_DEF_PARRAY *parray )
-{
- CMN_KEY key;
- key.id = PARRAY_ID;
- key.data.pdata = (void *) parray;
-
- TsmAddToStructure( TelParray, 1, &key );
-}
-
-void call_subr_userdraw( CALL_DEF_USERDRAW *anobject )
-{
- CMN_KEY key;
-
- key.id = 1;
- key.data.pdata = anobject;
-
- TsmAddToStructure( TelUserdraw, 1, &key );
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_subrvis :
-
-TEST :
-------
-
-Le main TestOfDesktop.c permet de tester cette classe.
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-07-02-96 : FMN ; Suppression code inutile:
-- TxglLink() et TxglUnlink()
-19-03-96 : CAL ; Ajout de la fonction subr_resize.
-appele par togl_ratio_window
-21-03-96 : CAL ; Dans subr_doublebuffer et subr_open_ws
-retrait des lignes qui donnaient un background
-noir a la fenetre.
-01-04-96 : CAL ; Integration MINSK portage WNT
-02-07-96 : FMN ; Suppression WSWSHeight, WSWSWidth et WSType
-17-07-96 : FMN ; Modification de call_subr_hlhsr().
-18-07-96 : FMN ; Ajout appel TxglWinset() pour le Resize.
-01-08-96 : FMN ; Ajout appel reaffichage dans le resize.
-25-11-96 : FMN ; PRO6577: Ajout WSUpdateState pour call_subr_set_background.
-29-01-97 : FMN ; Suppression de call_subr_doublebuffer().
-05-02-97 : FMN ; Suppression variables inutiles.
-12-02-97 : FMN ; Suppression de call_facilities_list.DepthCueing
-14-02-97 : FMN ; Ajout WSUpdateState pour call_subr_transparency.
-30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox.
-02-07-97 : FMN ; Ajout init generale par contexte.
-(GL_POLYGON_OFFSET_EXT, glLightModelf, glHint).
-03-07-97 : FMN ; Test Headlight.
-08-09-97 : CAL ; subr_open_ws retourne 0 si pb. (gere par togl_view)
-07-10-97 : FMN ; Simplification WNT
-03-10-97 : FMN ; Meilleure gestion des EXT, ajout QueryExtension
-17-11-97 : FMN ; Suppression redraw sur le resize.
-05-12-97 : FMN ; Double gestion du glPolygonOffsetEXT
-17-12-97 : FMN ; Probleme compilation SGI
-03-03-98 : FMN ; Simplification gestion du glPolygonOffsetEXT
-15-03-98 : FMN ; Suppression variable WSNeedsClear
-17-03-98 : FMN ; Ajout mode animation
-08-07-98 : FMN ; Changement du nom de la primitive call_togl_erase_immediat_mode()
--> call_togl_erase_animation_mode.
-22-10-98 : FMN ; Amelioration des perfs: glHint utilise GL_FASTEST.
-14-12-98 : BGN; Developpement (S3989, Phase "triedre")
-29-03-01 : GG; glPolygonOffsetEXT is no more available
-since OGL 1.2
-20-08-01 : GG ; Add functions call_subr_enable_polygon_offset ()
-and call_subr_disable_polygon_offset ()
-
-************************************************************************/
-
-#ifdef WNT
-#define BUC60579 /*GG_240999 Under WNT,resets the ws attributes for each
-// created view-manager and not only for the first
-*/
-#endif
-
-#define IMP190100 /*GG Reverse the front & back depth cueing planes
-// position.
-*/
-
-#define RIC120302 /*GG Use TxglSetWindow instead TxglCreateWindow
-// when a GLXContext is given
-// Add call_subr_displayCB function
-*/
-
-#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
-from higher API */
-#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
-from higher API */
-
-#define OCC1188 /*SAV added control of the background image*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <stdio.h>
-
-#include <OpenGl_tgl_all.hxx>
-
-
-#include <InterfaceGraphic.hxx>
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_inquire.hxx>
-
-#include <OpenGl_Extension.hxx>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_pick.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_telem_depthcue.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-#include <OpenGl_tgl_pick.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_telem_filters.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_animation.hxx>
-#include <OpenGl_triedron.hxx>
-#include <OpenGl_tgl_util.hxx>
-#include <OpenGl_Memory.hxx>
-#include <OpenGl_graduatedtrihedron.hxx>
-#include <OpenGl_ResourceCleaner.hxx>
-#include <OpenGl_ResourceTexture.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-static Tint attri_init = 0;
-
-/*----------------------------------------------------------------------*/
-
-#ifndef WNT
-static Bool WaitForNotify(Display *d, XEvent *e, char *arg) {
- return (e->type == MapNotify) && (e->xmap.window == (Window)arg);
-}
-#endif
-
-/*----------------------------------------------------------------------*/
-
-static int offsetStatus=0;
-#ifdef GL_EXT_polygon_offset
-static GLfloat offsetFactor=1.0,offsetUnits=0.0;
-#elif GL_POLYGON_OFFSET_EXT
-static GLfloat offsetFactor=0.5,offsetUnits=0.0005;
-#endif
-void call_subr_enable_polygon_offset( )
-{
- if( offsetStatus < 0 ) return;
-
-#ifdef GL_EXT_polygon_offset
- if( offsetStatus == 0 ) {
- if (QueryExtension("GL_EXT_polygon_offset")) {
- char svalue[64];
- if( call_util_osd_getenv ("CALL_OPENGL_POLYGON_OFFSET",
- svalue,sizeof(svalue)) ) {
- float v1,v2;
- int n = sscanf(svalue,"%f %f",&v1,&v2);
- if( n > 0 ) offsetFactor = v1;
- if( n > 1 ) offsetUnits = v2;
- printf(" $$$ CALL_OPENGL_POLYGON_OFFSET %f %f\n",
- offsetFactor,offsetUnits);
- }
- offsetStatus = 1;
- } else {
- offsetStatus = -1;
- }
- }
-
- if( offsetStatus > 0 ) {
-#ifdef GL_POLYGON_OFFSET_FILL
- glPolygonOffset(offsetFactor,offsetUnits);
- glEnable(GL_POLYGON_OFFSET_FILL);
-#elif GL_POLYGON_OFFSET_EXT
- glPolygonOffsetEXT(offsetFactor,offsetUnits);
- glEnable(GL_POLYGON_OFFSET_EXT);
-#endif
- }
-#else
- offsetStatus = -1;
-#endif /* GL_EXT_polygon_offset */
-}
-
-void
-call_subr_disable_polygon_offset( )
-{
- if( offsetStatus > 0 ) {
-#ifdef GL_POLYGON_OFFSET_FILL
- glDisable(GL_POLYGON_OFFSET_FILL);
-#elif GL_POLYGON_OFFSET_EXT
- glDisable(GL_POLYGON_OFFSET_EXT);
-#endif
- }
-}
-
-/*----------------------------------------------------------------------*/
-
-int
-call_subr_open_ws( CALL_DEF_VIEW * aview )
-{
- CMN_KEY_DATA data;
- WINDOW win;
- TEL_HIGHLIGHT hrep = { TelHLForcedColour, {{ ( float )1.0, ( float )1.0, ( float )1.0 }} };
- TEL_DEPTHCUE dcrep = { TelDCSuppressed, {( float )0.0, ( float )1.0}, {( float )1.0, ( float )0.0}, {{( float )0.0, ( float )0.0, ( float )0.0}} };
- Tint width, height;
- Tfloat bgcolr, bgcolg, bgcolb; /* background color */
-#ifdef OCC1188
- TSM_BG_TEXTURE bgTexture;
-#endif
-
-#ifndef WNT
- XEvent event;
- Window root;
- int newx, newy;
- unsigned int newwidth, newheight, newbw, newdepth;
-#else
- RECT cr;
-#endif /* WNT */
-
- width = ( Tint )aview->DefWindow.dx;
- height = ( Tint )aview->DefWindow.dy;
-
- /* background color */
- bgcolr = aview->DefWindow.Background.r,
- bgcolg = aview->DefWindow.Background.g,
- bgcolb = aview->DefWindow.Background.b;
-
-#ifdef RIC120302
- if( aview->GContext )
- win = TxglSetWindow( call_thedisplay, /*(HWND)*/(WINDOW)aview->DefWindow.XWindow,
- /*(HGLRC)*/(GLCONTEXT)aview->GContext );
- else
-#endif /*RIC120302*/
- win = TxglCreateWindow( call_thedisplay, /*(HWND)*/(WINDOW)aview->DefWindow.XWindow,
- 0, 0, width, height, 0, bgcolr, bgcolg, bgcolb );
-#ifndef WNT
- if( win != aview->DefWindow.XWindow ) {
- XMapWindow( call_thedisplay, win );
- XIfEvent(call_thedisplay, &event, WaitForNotify, (char *) win);
- }
-#endif /* WNT */
-
- if( TxglWinset( call_thedisplay, (WINDOW) win ) == TFailure )
- return 0;
- else {
- TsmRegisterWsid( aview->WsId );
- data.ldata = (Tint) win;
- TsmSetWSAttri( aview->WsId, WSWindow, &data );
-#ifndef WNT
- XGetGeometry (
- call_thedisplay, win, &root,
- &newx, &newy,&newwidth, &newheight, &newbw, &newdepth
- );
- width = newwidth;
- height = newheight;
-#else
- GetClientRect ( win, &cr );
- width = cr.right;
- height = cr.bottom;
-#endif /* WNT */
-#ifdef OCC1188
- bgTexture.texId = 0;
- data.pdata = &bgTexture;
- TsmSetWSAttri( aview->WsId, WSBgTexture, &data );
-#endif
- data.ldata = width;
- TsmSetWSAttri( aview->WsId, WSWidth, &data );
- data.ldata = height;
- TsmSetWSAttri( aview->WsId, WSHeight, &data );
- data.ldata = -1;
- TsmSetWSAttri( aview->WsId, WSViewStid, &data );
- data.ldata = TOn;
- TsmSetWSAttri( aview->WsId, WSDbuff, &data );
- data.ldata = TNotDone;
- TsmSetWSAttri( aview->WsId, WSUpdateState, &data );
- data.ldata = TOff;
- TsmSetWSAttri( aview->WsId, WSTransparency, &data );
- TelSetHighlightRep( aview->WsId, 0, &hrep );
- TelSetDepthCueRep( aview->WsId, 0, &dcrep );
- TelInitWS( aview->WsId, width, height, bgcolr, bgcolg, bgcolb );
-
-#ifdef BUC61044
- /* 24/10/01 : SAV ; setting OGL depth testing enabled by default */
- data.ldata = TOn;
- TsmSetWSAttri( aview->WsId, WSDepthTest, &data );
-#endif
-#ifdef BUC61045
- /* 24/10/01 : SAV ; setting flag to control GL_LIGHTING (used in triedron) */
- data.ldata = TOn;
- TsmSetWSAttri( aview->WsId, WSGLLight, &data );
-#endif
-
-#ifdef BUC60579
- TsmInitAttributes();
-#else
- if( !attri_init ) {
- TsmInitAttributes();
- attri_init = 1;
- }
-#endif
-
- /*
- * Init generale du contexte
- */
-
- /* Eviter d'avoir les faces mal orientees en noir. */
- /* Pourrait etre utiliser pour detecter les problemes d'orientation */
- glLightModeli((GLenum)GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
-
- /* Optimisation pour le Fog et l'antialiasing */
- glHint( GL_FOG_HINT, GL_FASTEST );
- glHint( GL_POINT_SMOOTH_HINT, GL_FASTEST );
- glHint( GL_LINE_SMOOTH_HINT, GL_FASTEST );
- glHint( GL_POLYGON_SMOOTH_HINT, GL_FASTEST );
-
- /* Polygon Offset */
- call_subr_enable_polygon_offset();
-
- return 1;
-
- } /* TxglWinset */
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_subr_resize (CALL_DEF_VIEW * aview)
-{
- CMN_KEY_DATA data;
- WINDOW win;
- Tint width, height;
- Tfloat bgcolr, bgcolg, bgcolb;
- Tint wswidth, wsheight;
- Tint wsviewstid;
- /* Tint swap = 1;*/ /* swap buffers ? yes */
-
-#ifndef WNT
- /* XEvent event;*/
- Window root;
- int newx, newy;
- unsigned int newwidth, newheight, newbw, newdepth;
-#else
- RECT cr;
-#endif /* WNT */
-
-#ifdef TRACE
- printf("call_subr_resize \n");
-#endif
- /* Recuperation de la definition precedente de la ws */
- TsmGetWSAttri (aview->WsId, WSWidth, &data);
- wswidth = data.ldata;
- TsmGetWSAttri (aview->WsId, WSHeight, &data);
- wsheight = data.ldata;
- TsmGetWSAttri (aview->WsId, WSViewStid, &data);
- wsviewstid = data.ldata;
-
- /* S'il s'agit du togl_ratio_window initial alors on ne fait rien */
- if (wsviewstid == -1) return;
-
- /*
- * Si l'on resize une fenetre qui a la meme taille que la taille
- * precedente alors on ne fait rien
- */
- if ((wswidth == (Tint) aview->DefWindow.dx) &&
- (wsheight == (Tint) aview->DefWindow.dy)) return;
-
-#ifndef WNT
- TsmGetWSAttri (aview->WsId, WSWindow, &data);
- win = data.ldata;
-
- XResizeWindow (call_thedisplay, win,
- (unsigned int) aview->DefWindow.dx,
- (unsigned int) aview->DefWindow.dy);
-
- XSync (call_thedisplay, False);
-
- /* Mettre a jour ses attributs */
- XGetGeometry (call_thedisplay, win, &root,
- &newx, &newy,&newwidth, &newheight, &newbw, &newdepth);
- width = newwidth;
- height = newheight;
-
- /* background color */
- bgcolr = aview->DefWindow.Background.r,
- bgcolg = aview->DefWindow.Background.g,
- bgcolb = aview->DefWindow.Background.b;
-
- /* Rendre courant le Drawable et le Context */
- if (TxglWinset (call_thedisplay, (Window) win) == TSuccess) {
-
- data.ldata = width;
- TsmSetWSAttri (aview->WsId, WSWidth, &data);
- data.ldata = height;
- TsmSetWSAttri (aview->WsId, WSHeight, &data);
- TelInitWS (aview->WsId, width, height, bgcolr, bgcolg, bgcolb);
- }
-
-#else
-
- /* On detruit l'ancienne sous-fenetre de la window graphique */
- TsmGetWSAttri (aview->WsId, WSWindow, &data);
- win = (WINDOW) data.ldata;
- /*
- * On recree une nouvelle sous-fenetre de la window graphique
- * avec la nouvelle dimension
- */
- /* background color */
- bgcolr = aview->DefWindow.Background.r,
- bgcolg = aview->DefWindow.Background.g,
- bgcolb = aview->DefWindow.Background.b;
- /* Rendre courant le Drawable et le Context */
- if (TxglWinset (call_thedisplay, win) == TSuccess) {
- //if (TxglWinset (call_thedisplay, GET_GL_CONTEXT()) == TSuccess) {
- /* Mettre a jour la sous-fenetre associee */
- /* Mettre a jour ses attributs */
- GetClientRect ( win, &cr );
- width = cr.right;
- height = cr.bottom;
- data.ldata = width;
- TsmSetWSAttri (aview->WsId, WSWidth, &data);
- data.ldata = height;
- TsmSetWSAttri (aview->WsId, WSHeight, &data);
- TelInitWS (aview->WsId, width, height, bgcolr, bgcolg, bgcolb);
- }
-#endif /* WNT */
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_subr_antialiasing( CALL_DEF_VIEW * aview, Tint tag )
-{
- CMN_KEY k;
- Tint fl = tag ? TOn : TOff;
-
- call_func_set_edit_mode( TEditReplace );
- call_func_open_struct( aview->ViewId );
- call_func_set_elem_ptr(0);
- call_func_set_elem_ptr_label(View_LABAliasing);
- call_func_offset_elem_ptr(1);
- k.data.ldata = fl;
- TsmAddToStructure( TelAntiAliasing, 1, &k );
- call_func_close_struct();
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_subr_hlhsr( CALL_DEF_VIEW * aview, int tag )
-{
- CMN_KEY_DATA data;
-
- data.ldata = (tag ? TOn : TOff);
- TsmSetWSAttri( aview->WsId, WSZbuffer, &data );
- return;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-void
-call_subr_depthcueing( CALL_DEF_VIEW * aview, Tint tag )
-{
- TEL_DEPTHCUE rep;
-# define CALL_DEF_DEPTH_CUEING_INDEX 1
-
- if( !tag )
- {
- call_func_set_edit_mode(CALL_PHIGS_EDIT_REPLACE);
- call_func_open_struct(aview->ViewId);
- call_func_set_elem_ptr(0);
- call_func_set_elem_ptr_label(View_LABDepthCueing);
- call_func_offset_elem_ptr(1);
- call_func_appl_data(0);
- call_func_close_struct();
- }
- else
- {
- rep.mode = CALL_PHIGS_ALLOWED;
- rep.planes[0] = aview->Context.DepthBackPlane;
- rep.planes[1] = aview->Context.DepthFrontPlane;
-#ifdef TRACE
- printf(" $$$ DepthFrontPlane %f DepthBackPlane %f FrontPlaneDistance %f BackPlaneDistance %f\n",aview->Context.DepthFrontPlane,aview->Context.DepthBackPlane,aview->Mapping.FrontPlaneDistance,aview->Mapping.BackPlaneDistance);
-#endif
- rep.planes[0] =
-#ifdef IMP190100
- (aview->Context.DepthFrontPlane -
- aview->Mapping.BackPlaneDistance) /
-#else
- (aview->Mapping.FrontPlaneDistance -
- aview->Context.DepthFrontPlane) /
-#endif
- (aview->Mapping.FrontPlaneDistance -
- aview->Mapping.BackPlaneDistance);
-
- rep.planes[1] =
-#ifdef IMP190100
- (aview->Context.DepthBackPlane -
- aview->Mapping.BackPlaneDistance) /
-#else
- (aview->Mapping.FrontPlaneDistance -
- aview->Context.DepthBackPlane) /
-#endif
- (aview->Mapping.FrontPlaneDistance -
- aview->Mapping.BackPlaneDistance);
-
- if(rep.planes[0] < 0.)
- rep.planes[0] = ( float )0.0;
- else if(rep.planes[0] > 1.)
- rep.planes[0] = ( float )1.0;
- if(rep.planes[1] < 0.)
- rep.planes[1] = ( float )0.0;
- else if(rep.planes[1] > 1.)
- rep.planes[1] = ( float )1.0;
-#ifdef IMP190100
- if(rep.planes[1] > rep.planes[0])
- {
- rep.planes[1] = ( float )0.0;
- rep.planes[0] = ( float )1.0;
- }
-#else
- if(rep.planes[0] > rep.planes[1])
- {
- rep.planes[0] = ( float )0.0;
- rep.planes[1] = ( float )1.0;
- }
-#endif
-
-#ifdef TRACE
- printf(" plane[0] %f plane[1] %f\n",rep.planes[0],rep.planes[1]);
-#endif
- rep.scales[0] = ( float )1.;
- rep.scales[1] = ( float )0.;
- rep.col.rgb[0] = aview->DefWindow.Background.r;
- rep.col.rgb[1] = aview->DefWindow.Background.g;
- rep.col.rgb[2] = aview->DefWindow.Background.b;
- TelSetDepthCueRep(aview->WsId, CALL_DEF_DEPTH_CUEING_INDEX, &rep);
-
- call_func_set_edit_mode(CALL_PHIGS_EDIT_REPLACE);
- call_func_open_struct(aview->ViewId);
- call_func_set_elem_ptr(0);
- call_func_set_elem_ptr_label(View_LABDepthCueing);
- call_func_offset_elem_ptr(1);
- call_func_dcue_ind(CALL_DEF_DEPTH_CUEING_INDEX);
- call_func_close_struct();
- }
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-call_subr_get_view_index( Tint stid, Tint *ind )
-{
- tsm_node node;
- Tint i, num;
-
- if( TsmGetStructure( stid, &num, &node ) == TSuccess )
- {
- for( i = 0; i < num; i++ )
- {
- if( node->elem.el == TelViewIndex )
- {
- *ind = node->elem.data.ldata;
- return TSuccess;
- }
- }
- }
- return TFailure;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_subr_pick( CALL_DEF_PICK *apick )
-{
- Tint depth;
- TPickOrder order;
- TStatus stat;
-
- static int *listid, *listelem, *listpickid;
-
- TEL_PICK_PATH path_list[CALL_MAX_DEPTH_LENGTH];
- TEL_PICK_REPORT rep;
-
- Tint i;
-
- if( listid )
- {
- //cmn_freemem( listid );
- delete[] listid;
- //cmn_freemem( listelem );
- delete[] listelem;
- //cmn_freemem( listpickid );
- delete[] listpickid;
- listid = listelem = listpickid = 0;
- }
-
- order = apick->Context.order == 0 ? PTOP_FIRST : PBOTTOM_FIRST;
-
- depth = apick->Context.depth < CALL_MAX_DEPTH_LENGTH ?
- apick->Context.depth : CALL_MAX_DEPTH_LENGTH ;
-
- rep.pick_path = path_list;
-
- stat = TPick( apick->WsId, apick->x, apick->y, apick->Context.aperture,
- apick->Context.aperture, order, depth, &rep );
-
- if( stat == TSuccess )
- {
- apick->Pick.depth = rep.depth;
-
-#ifdef TRACE
- printf( "\n\n\tPICK REPORT FOLLOWS" );
- printf( "\n\t*******************\n" );
- printf( "\ndepth = %d\torder = %s\n", rep.depth,
- order == PTOP_FIRST ? "TopFirst" : "BottomFirst" );
-#endif
-
- //cmn_memreserve( listid, rep.depth, 0 );
- listid = new int[rep.depth];
- //cmn_memreserve( listelem, rep.depth, 0 );
- listelem = new int[rep.depth];
- //cmn_memreserve( listpickid, rep.depth, 0 );
- listpickid = new int[rep.depth];
- if( !listid || !listelem || !listpickid )
- return;
- apick->Pick.listid = listid;
- apick->Pick.listelem = listelem;
- apick->Pick.listpickid = listpickid;
-
- for( i = 0; i < rep.depth; i++ )
- {
- listelem[i] = path_list[i].el_num;
- listpickid[i] = path_list[i].pick_id;
- listid[i] = path_list[i].struct_id;
-#ifdef TRACE
- printf( "\n\tSTRUCTURE ID [%d] = %ld", i, listid[i] );
- printf( "\n\tPICK ID [%d] = %ld", i, listpickid[i] );
- printf( "\n\tELEMENT ID [%d] = %ld", i, listelem[i] );
-#endif
- }
-#ifdef TRACE
- printf("\n");
-#endif
- }
-
- return;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-void
-call_subr_set_light_src_rep( CALL_DEF_LIGHT * alight )
-{
- TEL_LIGHT rep;
-
- switch( alight->LightType )
- {
- case 0 : /* TOLS_AMBIENT */
- rep.type = CALL_PHIGS_LIGHT_AMBIENT;
- rep.col.rgb[0] = alight->Color.r;
- rep.col.rgb[1] = alight->Color.g;
- rep.col.rgb[2] = alight->Color.b;
- break;
-
- case 1 : /* TOLS_DIRECTIONAL */
- rep.type = CALL_PHIGS_LIGHT_DIRECTIONAL;
- rep.col.rgb[0] = alight->Color.r;
- rep.col.rgb[1] = alight->Color.g;
- rep.col.rgb[2] = alight->Color.b;
- rep.dir[0] = alight->Direction.x;
- rep.dir[1] = alight->Direction.y;
- rep.dir[2] = alight->Direction.z;
- break;
-
- case 2 : /* TOLS_POSITIONAL */
- rep.type = CALL_PHIGS_LIGHT_POSITIONAL;
- rep.col.rgb[0] = alight->Color.r;
- rep.col.rgb[1] = alight->Color.g;
- rep.col.rgb[2] = alight->Color.b;
- rep.pos[0] = alight->Position.x;
- rep.pos[1] = alight->Position.y;
- rep.pos[2] = alight->Position.z;
- rep.atten[0] = alight->Attenuation[0];
- rep.atten[1] = alight->Attenuation[1];
- break;
-
- case 3 : /* TOLS_SPOT */
- rep.type = CALL_PHIGS_LIGHT_SPOT;
- rep.col.rgb[0] = alight->Color.r;
- rep.col.rgb[1] = alight->Color.g;
- rep.col.rgb[2] = alight->Color.b;
- rep.pos[0] = alight->Position.x;
- rep.pos[1] = alight->Position.y;
- rep.pos[2] = alight->Position.z;
- rep.dir[0] = alight->Direction.x;
- rep.dir[1] = alight->Direction.y;
- rep.dir[2] = alight->Direction.z;
- rep.shine = alight->Concentration;
- rep.atten[0] = alight->Attenuation[0];
- rep.atten[1] = alight->Attenuation[1];
- rep.angle = alight->Angle;
- break;
- }
-
- rep.HeadLight = alight->Headlight;
- AddLight( alight->WsId, alight->LightId, &rep );
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_subr_set_background( Tint ws, tel_colour rgb )
-{
- CMN_KEY_DATA data;
- CMN_KEY_DATA key;
-
- /* Mise a jour de l'update_mode */
- key.ldata = TNotDone;
- TsmSetWSAttri( ws, WSUpdateState, &key );
-
- data.pdata = rgb->rgb;
- TsmSetWSAttri( ws, WSBackground, &data );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_subr_set_gradient_background( Tint ws, Tint type, tel_colour color1, tel_colour color2 )
-{
- CMN_KEY_DATA data;
- CMN_KEY_DATA key;
- TSM_BG_GRADIENT bgGradient;
-
- /* Mise a jour de l'update_mode */
- key.ldata = TNotDone;
- TsmSetWSAttri( ws, WSUpdateState, &key );
-
- bgGradient.type = (TSM_GradientType)type;
- bgGradient.color1 = *color1;
- bgGradient.color2 = *color2;
- data.pdata = &bgGradient;
- TsmSetWSAttri( ws, WSBgGradient, &data );
- return;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-void
-call_subr_close_ws( CALL_DEF_VIEW * aview )
-{
- CMN_KEY_DATA key;
- CMN_KEY_DATA textureKey;
-
- TsmGetWSAttri( aview->WsId, WSWindow, &key );
-
-#ifdef OCC1188
- tsm_bg_texture texture;
- WINDOW aWnd = (WINDOW) key.ldata;
-
- TsmGetWSAttri( aview->WsId, WSBgTexture, &textureKey );
- texture = (tsm_bg_texture)textureKey.pdata;
-
- if ( texture != 0 && texture->texId != 0 )
- {
- OpenGl_ResourceCleaner* anCleaner = OpenGl_ResourceCleaner::GetInstance();
-
- // Delete the texture with ResourceCleaner; if it is not possible
- // do this directly with proper context selected
- if ( !anCleaner->AddResource( TxglGetContext(aWnd),
- new OpenGl_ResourceTexture(texture->texId) ) )
- {
- GLCONTEXT cur_context = GET_GL_CONTEXT();
- GLDRAWABLE cur_drawable = GET_GLDEV_CONTEXT();
-
- if ( TxglWinset( call_thedisplay, aWnd ) == TSuccess )
- glDeleteTextures( 1,(GLuint *)&(texture->texId) );
-
- // activate the previous context for this thread
- GL_MAKE_CURRENT( call_thedisplay, cur_drawable, cur_context );
- }
- }
-
-#endif
-
-#ifdef RIC120302
- if( !aview->GContext )
-#endif
- TxglDestroyWindow( call_thedisplay, (WINDOW) key.ldata );
-
- TglDeleteFiltersForWS( aview->WsId );
- RemoveWksLight( aview->WsId );
- call_triedron_erase (aview); /* BGN 09-12-98 */
- call_graduatedtrihedron_erase( aview->WsId );
- TelDeleteViewsForWS( aview->WsId );
- TelDeleteHighlightsForWS( aview->WsId );
- TelDeleteDepthCuesForWS( aview->WsId );
-
- TsmUnregisterWsid( aview->WsId );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-call_subr_transparency (int wsid, int viewid, int tag)
-{
- CMN_KEY_DATA data;
- CMN_KEY_DATA key;
-
- /* Est-il necessaire de faire de la transparence ? */
- TsmGetWSAttri( wsid, WSTransparency, &data );
- if (data.ldata != tag)
- {
- data.ldata = (tag ? TOn : TOff);
- TsmSetWSAttri( wsid, WSTransparency, &data );
-
- /* Mise a jour de l'update_mode */
- key.ldata = TNotDone;
- TsmSetWSAttri( wsid, WSUpdateState, &key );
- (void) call_togl_erase_animation_mode();
- }
-}
-
-#ifdef RIC120302
-/*----------------------------------------------------------------------*/
-int
-call_subr_displayCB( CALL_DEF_VIEW * aview, int reason )
-{
- int status = 0;
- if( aview->GDisplayCB ) {
- Aspect_GraphicCallbackStruct callData;
- CMN_KEY_DATA data;
- WINDOW win;
-
- TsmGetWSAttri (aview->WsId, WSWindow, &data);
- win = (WINDOW) data.ldata;
-
- callData.reason = reason;
- callData.display = call_thedisplay;
- callData.window = win;
- callData.wsID = aview->WsId;
- callData.viewID = aview->ViewId;
- callData.gcontext = TxglGetContext(win);
-
- status = (*aview->GDisplayCB)
- ( aview->DefWindow.XWindow, aview->GClientData, &callData );
- }
-
- return status;
-}
-#endif
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-static TStatus SurfaceAreaPropertiesDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus SurfaceAreaPropertiesAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus SurfaceAreaPropertiesDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus SurfaceAreaPropertiesPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus SurfaceAreaPropertiesInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- SurfaceAreaPropertiesDisplay,
- SurfaceAreaPropertiesAdd,
- SurfaceAreaPropertiesDelete,
- SurfaceAreaPropertiesPrint,
- SurfaceAreaPropertiesInquire
-};
-
-
-MtblPtr
-TelSurfaceAreaPropertiesInitClass( TelType *el )
-{
- *el = TelSurfaceAreaProperties;
- return MtdTbl;
-}
-
-static TStatus
-SurfaceAreaPropertiesAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_surf_prop data = new TEL_SURF_PROP();;
-
- //cmn_memreserve( data, 1, 0 );
- if( !data )
- return TFailure;
-
- *data = *(tel_surf_prop)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-SurfaceAreaPropertiesDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelSurfaceAreaProperties;
- key.data.pdata = data.pdata;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-SurfaceAreaPropertiesDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- //cmn_freemem( data.pdata );
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-
-
-static TStatus
-SurfaceAreaPropertiesPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_surf_prop p;
-
- p = (tel_surf_prop)data.pdata;
-
- fprintf( stdout, "TelSurfaceAreaProperties\n" );
- fprintf( stdout, "\tAmbient Coeff: %f\n", p->amb );
- fprintf( stdout, "\tDiffuse Coeff: %f\n", p->diff );
- fprintf( stdout, "\tSpecular Coeff: %f\n", p->spec );
- fprintf( stdout, "\tTransparency Coeff: %f\n", p->trans );
- fprintf( stdout, "\tShininess: %f\n", p->shine );
- fprintf( stdout, "\tSpecular colour: R = %f, G = %f, B = %f\n",
- p->speccol.rgb[0], p->speccol.rgb[1], p->speccol.rgb[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-static TStatus
-SurfaceAreaPropertiesInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_surf_prop p;
-
- p = (tel_surf_prop)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->surf_prop = *p;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-Include OpenGl_telem :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-07-02-96 : FMN ; Ajout prototype de TsmInitAttributes()
-11-03-96 : FMN ; Ajout prototype de TelResetMaterial()
-13-06-96 : CAL ; Ajout prototype de TelSetTransparency()
-05-08-97 : PCT ; support texture mapping
-21-08-97 : PCT ; ajout deuxieme passe pour les textures
-28-08-97 : PCT ; ajot coordonnee textures
-15-01-98 : FMN ; Ajout Hidden line
-08-04-98 : FGU ; Ajout champs pour emission
-24-06-98 : FMN ; Correction indice pour les type de trait.
-La reference se trouve dans Aspect.cdl
-16-06-2000 : ATS : G005 : Move type declarations to InterfaceGraphic_telem.h
-
-
-************************************************************************/
-
-#ifndef OPENGL_TELEM_H
-#define OPENGL_TELEM_H
-
-#include <InterfaceGraphic_telem.hxx>
-
-extern void TelHookOnAllClasses(void);
-extern Tchar*TelGetStringForPM( Tint, Tfloat ); /* marker type, marker size */
-extern void TelUpdateMaterial( Tint ); /* TEL_FRONT_MATERIAL or
- TEL_BACK_MATERIAL */
-/* FSXXX NEW */
-extern void TelForceMaterial( Tint );
-extern void TsmInitAttributes( void );
-extern void TelResetMaterial( void );
-
-extern void TelSetTransparency( Tint );
-
-#endif /* OPENGL_TELEM_H */
+++ /dev/null
-#ifndef OPENGL_TSM_ATTRI_H
-#define OPENGL_TSM_ATTRI_H
-
-extern TStatus TsmPushAttri( void );
-extern TStatus TsmPopAttri( void );
-extern TStatus TsmSetAttri( Tint, ... );
-extern TStatus TsmGetAttri( Tint, ... );
-extern TStatus TsmPushAttriLight( void );
-extern TStatus TsmPopAttriLight( void );
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_telem_depthcue.h :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-12-02-97 : FMN ; Suppression de TelGetDepthCueRep
-
-************************************************************************/
-
-#ifndef OPENGL_TELEM_DEPTHCUE_H
-#define OPENGL_TELEM_DEPTHCUE_H
-
-#include <OpenGl_telem.hxx>
-
-struct TEL_DEPTHCUE
-{
- TDepthCueType mode;
- Tfloat planes[2]; /* in the range 0.0 & 1.0 */
- Tfloat scales[2]; /* in the range 0.0 & 1.0. This is fraction
- of object colour to be visible */
- TEL_COLOUR col;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_DEPTHCUE* tel_depthcue;
-
-struct TEL_GL_DEPTHCUE
-{
- TEL_DEPTHCUE dcrep;
- Tfloat dist[2];
-};
-typedef TEL_GL_DEPTHCUE* tel_gl_depthcue;
-
-/* ws, dcid, dcrep */
-extern TStatus TelSetDepthCueRep( Tint, Tint, tel_depthcue );
-/* ws, dcid, dcrep */
-
-extern void TelPrintDepthCueRep( Tint, Tint ); /* ws, hid */
-/* ws, viewid, dcid, data */
-extern TStatus TelGetGLDepthCue( Tint, Tint, Tint, tel_gl_depthcue );
-extern TStatus TelDeleteDepthCuesForWS( Tint wsid );
-
-#endif
+++ /dev/null
-#ifndef OPENGL_TELEM_FILTERS_S
-#define OPENGL_TELEM_FILTERS_S
-
-typedef enum
-{
- InvisFilter, HighlFilter, PickFilter
-} TFilterSet;
-
-/* Filter functions */ /* Wsid, Inclusion num, list, Exclusion num, list */
-extern TStatus TglSetHighlFilter( Tint, Tint, Tint*, Tint, Tint* );
-extern TStatus TglSetPickFilter( Tint, Tint, Tint*, Tint, Tint* );
-extern TStatus TglSetInvisFilter( Tint, Tint, Tint*, Tint, Tint* );
-
-/* Nameset functions */
-extern TStatus TglNamesetPush( void );
-extern TStatus TglNamesetPop( void );
-extern TStatus TglNamesetAdd( Tint, Tint* );
-extern TStatus TglNamesetRemove( Tint, Tint* );
-extern TStatus TglDeleteFiltersForWS( Tint wsid );
-
-/* Compare Nameset with filters */ /* Failure if not found in inclusion set */
-extern TStatus TglFilterNameset( Tint, TFilterSet ); /* Wsid, enum */
-
-#endif
+++ /dev/null
-#ifndef OPENGL_TELEM_HIGHLIGHT_H
-#define OPENGL_TELEM_HIGHLIGHT_H
-
-#include <OpenGl_telem.hxx>
-
-typedef struct
-{
- THighlightType type;
- TEL_COLOUR col;
-} TEL_HIGHLIGHT, *tel_highlight;
-
-/* currently, the routines ignore wsid */
-
-/* ws, hid, highlighrep */
-extern TStatus TelSetHighlightRep( Tint, Tint, tel_highlight );
-/* ws, hid, highlighrep */
-extern TStatus TelGetHighlightRep( Tint, Tint, tel_highlight );
-
-extern void TelPrintHighlightRep( Tint, Tint ); /* ws, hid */
-extern TStatus TelDeleteHighlightsForWS( Tint wsid );
-
-#endif
+++ /dev/null
-#ifndef OPENGL_TELEM_INQUIRE_H
-#define OPENGL_TELEM_INQUIRE_H
-
-typedef struct {
- Tint number; /* number of Tints in list */
- Tint *integers; /* list of integers */
-} Tintlst;
-
-typedef struct {
- Tint x_dim; /* dimension (number of divisions) along X */
- Tint y_dim; /* dimension (number of divisions) along Y */
-} Tdim;
-
-typedef union
-{
- Tint idata; /* integer valued data */
- Tfloat fdata; /* float valued data */
- Tchar *data; /* %%TEMP - use for application data for now */
- TEL_POINT *pts3; /* list of 3d points */
-
- struct
- {
- TEL_POINT ref_pt; /* reference text point */
- TEL_POINT anno; /* annotation pt/offset */
- Techar *string; /* text string */
- } atext3;
-
- Tint size;
- Tint interior_style; /* interior style */
- Tint edge_flag; /* edge flag */
- Tintlst name_set; /* name sets */
- Tmatrix3 mat3; /* 3d transformation matrix */
-
- struct
- {
- Tmatrix3 mat3; /* 3d transformation matrix */
- TComposeType compose_type; /* composition type */
- } local_xform_3;
-
- struct
- {
- Tint vrtflag; /* per vertex data flag */
- Tint num_bounds; /* number of lines in the set */
- Tint *bounds; /* list of number of points in each bound */
- TEL_POINT *points; /* array of points */
- TEL_COLOUR *colours; /* array of vertex colour values */
- } lineset3data;
-
- struct
- {
- Tint shpflag; /* primitive shape flag */
- Tint faflag; /* per fill area data flag */
- Tint vrtflag; /* per vertex data flag */
- TEL_POINT *gnormal; /* geometric normal */
- Tint num_points; /* number of vertices in fill area */
- tel_colour facet_colour_val; /* facet colour value */
- TEL_POINT *points; /* array of points */
- TEL_COLOUR *colours; /* array of vertex colour values */
- TEL_POINT *vnormals; /* array of vertex normals */
- } fillarea3data;
-
- struct
- {
- Tint shpflag; /* primitive shape flag */
- Tint faflag; /* per fill area data flag */
- Tint vrtflag; /* per vertex data flag */
- Tint edgflag; /* edge flag */
- TEL_POINT *gnormal; /* geometric normal */
- Tint *edgvis; /* edge visibility per edge */
- Tint num_bounds; /* number of bounds in fill area set */
- tel_colour facet_colour_val; /* facet colour value */
- Tint *bounds; /* bounds */
- TEL_POINT *points; /* array of points */
- TEL_COLOUR *colours; /* array of vertex colour values */
- TEL_POINT *vnormals; /* array of vertex normals */
- } fillareaset3data;
-
- struct
- {
- Tint fctflag; /* per facet data flag */
- Tint vrtflag; /* per vertex data flag */
- Tint num_facets; /* number of facets, (num_points-2) */
- TEL_POINT *gnormals; /* geometric normals */
- TEL_COLOUR *facet_colour_vals; /* facet colour value */
- TEL_POINT *points; /* array of points for all bounds */
- TEL_COLOUR *colours; /* array of vertex colour values */
- TEL_POINT *vnormals; /* array of vertex normals for all bounds */
- } trianglestrip3data;
-
- struct
- {
- Tint shpflag; /* primitive shape flag */
- Tint fctflag; /* per facet data flag */
- Tint vrtflag; /* per vertex data flag */
- Tdim dim; /* number of cols by rows */
- TEL_POINT *gnormals; /* geometric normals */
- TEL_COLOUR *facet_colour_vals; /* facet colour value */
- TEL_POINT *points; /* array of points for all bounds */
- TEL_COLOUR *colours; /* array of vertex colour values */
- TEL_POINT *vnormals; /* array of vertex normals for all bounds */
- } quadmesh3data;
-
- struct
- {
- Tint shpflag; /* primitive shape flag */
- Tint fctflag; /* per facet data flag */
- Tint vrtflag; /* per vertex data flag */
- Tint edgflag; /* per edge data flag */
- TEL_POINT *gnormals; /* geometric normals */
- Tint *edgvis; /* array of edge visibility flags for all edges */
- Tint num_vertices;/*number of fill areas in the set */
- TEL_COLOUR *facet_colour_vals; /* facet colour values */
- TEL_POINT *points; /* array of vertices */
- TEL_COLOUR *colours; /* array of vertex colour values */
- TEL_POINT *vnormals; /* array of vertex normals for all vertices */
- Tint num_bounds; /* number of bounds */
- Tint *bounds; /* list of number of points in each bound */
- Tint *indices; /* list of vertex indices for all bounds */
- } indexedpolygons3data;
-
- /* depth cue index */ /* -- idata -- */
- /* surface properties */
- /* back surface properties */
- TEL_SURF_PROP surf_prop; /* Front or back surface properties */
- /* interior shading method */ /* -- idata -- */
- /* interior lighting method */ /* -- idata -- */
-
- struct
- {
- Tintlst on; /* list of activated lights */
- Tintlst off; /* list of deactivated lights */
- } light_source_state;
-
- struct {
- Tint distinguish; /* distinguish */
- TelCullMode cull; /* culling mode */
- } face_processing_mode;
-
- /* polyline, polymarker, text, interior, back interior, edge colour */
- TEL_COLOUR gnl_colour;
-} Teldata;
-
-typedef struct
-{
- Tint size;
- Tint act_size;
- Tchar *buf;
- Teldata *data;
-} TEL_INQ_CONTENT, *tel_inq_content;
-
-/* keys to be used for inquiry */
-#define INQ_GET_SIZE_ID 1 /* key.data.ldata will contain size */
-#define INQ_GET_CONTENT_ID 2 /* key.data.pdata is pointer to Teldata */
-
-/* element, size */
-extern TStatus TelInqCurElemTypeSize( TelType *, Tint * );
-
-/* size of buffer, buffer, actual_size, data */
-extern TStatus TelInqCurElemContent( Tint, Tchar *, Tint *, Teldata * );
-
-#endif
+++ /dev/null
-#ifndef OPENGL_TELEM_PICK_H
-#define OPENGL_TELEM_PICK_H
-
-typedef union
-{
- unsigned int s[2];
- Tint i;
-} TEL_PACKED_NAME, *tel_packed_name;
-
-typedef enum
-{
- TTopFirst, TBottomFirst
-} TPickOrder;
-
-typedef struct
-{
- Tint el_num;
- Tint pick_id;
- Tint struct_id;
-} TEL_PICK_PATH, *tel_pick_path;
-
-typedef struct
-{
- Tint depth;
- tel_pick_path pick_path;
-} TEL_PICK_REPORT, *tel_pick_report;
-
-extern Tint TglVpBeingPicked; /* defined in telem/pick */
-
-extern TStatus TPick( Tint, Tint, Tint, Tfloat, Tfloat, /*wsid, x, y, apw, aph*/
- TPickOrder, Tint, tel_pick_report );/*order, depth, rep*/
-
-#endif
#include <GL/glx.h>
#endif /* WNT */
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_attri.hxx>
#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define NO_TRACE
-#define CALL_DEF_DELTA 10
-#define NO_COPYBUFFER
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-static Tint call_back_buffer_restored = TOff;
-
-#ifndef WNT
-
-/*
-* Wrappers and utilities used to select between pixmap and gl double buffering
-*/
-
-/* Cache some pixmap info for pixmap double buffering */
-
-static Display *window_display; /* the display in use */
-static Window window_id; /* the window to copy the pixmap to */
-static Pixmap pixmap_id; /* the pixmap id */
-static GLXPixmap glx_pixmap; /* the glx pixmap */
-static int
-window_width, /* window width and height for XCopyArea */
-window_height,
-window_depth;
-
-static GC window_gc; /* GC for XCopyArea */
-
-static GLXContext glx_context; /* GL Context */
-
-static int usePixmapDB = 0; /* True if doing pixmap double buffering */
-
-/*----------------------------------------------------------------------*/
-
-void TelSetPixmapDBParams(Display *dpy,
- Window window,
- int width, int height, int depth, GC gc,
- Pixmap pixmap,
- GLXPixmap glxpixmap,
- GLXContext ctx)
-
-{
- window_display = dpy;
- window_id = window;
- window_width = width;
- window_height = height;
- window_depth = depth;
- window_gc = gc;
-
- pixmap_id = pixmap;
-
- glx_pixmap = glxpixmap;
-
- glx_context = ctx;
-}
-
-GLXPixmap TelGetGLXPixmap()
-{
- return glx_pixmap;
-}
-
-void TelSetPixmapDB(int flag)
-{
- usePixmapDB = flag;
-}
-
-int TelTestPixmapDB()
-{
- return usePixmapDB;
-}
-
-void TelDrawBuffer(GLenum buf)
-{
- if (usePixmapDB)
- glDrawBuffer(GL_FRONT);
- else
- glDrawBuffer(buf);
-}
-
-#endif /* WNT */
-
-/*----------------------------------------------------------------------*/
-
-void TelMakeFrontBufCurrent(Tint WsId)
-{
-#ifndef WNT
- if (usePixmapDB)
- {
- glXMakeCurrent(window_display,window_id, glx_context);
- glDrawBuffer(GL_FRONT);
- }
- else
-#endif /* WNT */
- {
- glDrawBuffer(GL_FRONT);
- }
-}
-
-void TelMakeBackBufCurrent(Tint WsId)
-{
-#ifndef WNT
- if (usePixmapDB)
- {
- glXMakeCurrent(window_display,glx_pixmap, glx_context);
- glDrawBuffer(GL_BACK);
- }
- else
-#endif /* WNT */
- {
- glDrawBuffer(GL_BACK);
- }
-}
-
-#ifdef IMP190100
-void TelMakeFrontAndBackBufCurrent(Tint WsId)
-{
-#ifndef WNT
- if (usePixmapDB)
- {
- glXMakeCurrent(window_display,window_id, glx_context);
- glDrawBuffer(GL_FRONT_AND_BACK);
- }
- else
-#endif /* WNT */
- {
- glDrawBuffer(GL_FRONT_AND_BACK);
- }
-}
-#endif
-
-/*----------------------------------------------------------------------*/
-Tint
-TelRemdupnames(Tint *ls, Tint num )
-{
- register Tint *ap, *bp, n;
-
- if( num < 2 )
- return num;
-
- ap = bp = ls+1;
- n = num-1;
- while( n-- )
- {
- if( ap[-1] != *bp )
- *ap++ = *bp++;
- else
- bp++;
- }
-
- return ap-ls;
-}
+#include <InterfaceGraphic_Graphic3d.hxx>
+#include <InterfaceGraphic_Visual3d.hxx>
-/*----------------------------------------------------------------------*/
-#ifdef BUC60823
#define GPRECIS 0.000001
Tint TelGetPolygonNormal(tel_point pnts, Tint* indexs, Tint npnt, Tfloat *norm ) {
Tint status=0;
return status;
}
-#else
-void
-TelGetNormal(Tfloat *data1, Tfloat *data2, Tfloat *data3, Tfloat *norm ) {
- Tfloat a[3], b[3];
- vecsub( a, data2, data1 );
- vecsub( b, data3, data2 );
- veccrs( norm, a, b );
-}
-#endif
-
-/*----------------------------------------------------------------------*/
-Tint
-TelIsBackFace(Tmatrix3 n, Tfloat *nrm )
-{
- Tfloat r[4], m[4];
-
- veccpy(m,nrm);
- m[3] = ( float )1.0;
-
- TelTranpt3( r, m, n );
-
- return r[2] < 0.0;
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelTransposemat3 (Tmatrix3 a)
-{
- Tint row, col;
- Tmatrix3 res;
- Tint dim = 4;
-
- /* transposition de la sous-matrice dim x dim */
- for (row = 0; row < dim; row++)
- for (col = 0; col < dim; col++)
- res[row][col] = a[col][row];
-
- /* copie du resultat */
- matcpy (a, res);
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelMultiplymat3 (Tmatrix3 c, Tmatrix3 a, Tmatrix3 b)
+void TelMultiplymat3 (Tmatrix3 c, Tmatrix3 a, Tmatrix3 b)
{
Tint row, col, i;
Tmatrix3 res;
return;
}
-
-/*----------------------------------------------------------------------*/
-void
-TelTranpt3(Tfloat tpt[4], Tfloat pt[4], Tmatrix3 mat )
-{
- register long i, j;
- Tfloat sum;
-
- for( i = 0; i < 4; i++ )
- {
- for( j = 0, sum = ( float )0.0; j < 4; j++ )
- {
- sum += pt[j] * mat[j][i];
- }
- tpt[i] = sum;
- }
- return;
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelInitWS(Tint ws, Tint w, Tint h, Tfloat bgcolr, Tfloat bgcolg, Tfloat bgcolb )
-{
- CMN_KEY_DATA data;
-
- TsmGetWSAttri( ws, WSDbuff, &data );
-
- glMatrixMode(GL_MODELVIEW);
- glViewport( 0, 0, w, h);
-
- /*
- * CAL mai 1998
- * Contournement bug SGI sur Octane (PRO12899)
- * Bavures de pixels lors de la copie de vue 3d
- */
- glDisable (GL_SCISSOR_TEST);
-
-#ifdef TRACE
- printf("OPENGL: TelInitWS: glClearColor %d \n", ws);
-#endif
- if( data.ldata == TOn )
- {
-#ifndef WNT
- if (TelTestPixmapDB())
- {
- glDrawBuffer(GL_FRONT);
- glClearColor(bgcolr, bgcolg, bgcolb, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- }
- else
- {
- /* QTOCC_PATCH by PCD: the frame buffer should not be cleared here
- to avoid flicker. It is cleared properly in TelClearViews()
- called by call_func_redraw_all_structs_begin() */
- glDrawBuffer(GL_BACK);
- }
-#else
- /* QTOCC_PATCH by PCD: the frame buffer should not be cleared here
- to avoid flicker. It is cleared properly in TelClearViews()
- called by call_func_redraw_all_structs_begin() */
- glDrawBuffer(GL_BACK);
-#endif /* WNT */
- }
- else
- {
- glClearColor(bgcolr, bgcolg, bgcolb, ( float )1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- }
- return;
-
-}
-
-
-/*----------------------------------------------------------------------*/
-void TelSwapBuffers ( Tint ws ) {
-
-#ifndef WNT
-
- CMN_KEY_DATA data;
-
- if (TelTestPixmapDB())
- {
- glFlush();
- XCopyArea(call_thedisplay, pixmap_id, window_id,
- window_gc, 0, 0,
- window_width, window_height, 0, 0);
- }
- else
- {
- TsmGetWSAttri( ws, WSWindow, &data );
- glXSwapBuffers ( call_thedisplay, data.ldata );
- }
-
-#else
-
- SwapBuffers ( wglGetCurrentDC () );
- TelFlush(0);
-
-#endif /* WNT */
-
- TelSetBackBufferRestored (TOff);
-
-#ifdef TRACE
- printf("OPENGL: TelSwapBuffers: glXSwapBuffers %d \n", ws);
-#endif
-
- return;
-
-} /* end TelSwapBuffers */
-
-/*----------------------------------------------------------------------*/
-Tint
-TelBackBufferRestored ()
-{
- return call_back_buffer_restored;
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelSetBackBufferRestored (Tint flag)
-{
-#ifdef TRACE
- printf("OPENGL: TelSetBackBufferRestored(%d): \n",flag);
-#endif
- call_back_buffer_restored = flag;
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelCopyBuffers(Tint ws, GLenum from, GLenum to,
- Tfloat xm, Tfloat ym, Tfloat zm, Tfloat XM, Tfloat YM, Tfloat ZM, Tint flag)
-{
- CMN_KEY_DATA key;
- Tint w, h;
-
-#ifdef TRACE
- printf("OPENGL: TelCopyBuffers: \n");
-#endif
-
- if (to == GL_BACK) TelSetBackBufferRestored (TOff);
-
-#ifndef WNT
- if (TelTestPixmapDB())
- {
-#ifdef TRACE
- printf("OPENGL: TelSwapBuffers: glFlush \n");
-#endif
- glFlush();
- XCopyArea(window_display, pixmap_id, window_id,
- window_gc, 0, 0,
- window_width, window_height, 0, 0);
- return;
- }
-#endif /* WNT */
-
- TsmGetWSAttri (ws, WSWidth, &key);
- w = key.ldata;
- TsmGetWSAttri (ws, WSHeight, &key);
- h = key.ldata;
-
- glMatrixMode (GL_PROJECTION);
- glPushMatrix ();
- glLoadIdentity ();
- gluOrtho2D ((GLdouble) 0., (GLdouble) w, 0., (GLdouble) h);
- glMatrixMode (GL_MODELVIEW);
- glPushMatrix ();
- glLoadIdentity ();
-
- TelDisable (ws);
- if (flag)
- {
- /*
- * calcul de la projection de la boite
- * et copie du rectangle projete
- */
- Tint i;
- GLsizei width, height;
- Tfloat xmr, ymr, XMR, YMR;
- Tfloat xr[8], yr[8];
- /*
- * Projection de la boite englobante
- */
- if ((TelProjectionRaster (ws, xm, ym, zm, &xr[0], &yr[0]) == TSuccess)
- && (TelProjectionRaster (ws, xm, YM, zm, &xr[1], &yr[1]) == TSuccess)
- && (TelProjectionRaster (ws, XM, YM, zm, &xr[2], &yr[2]) == TSuccess)
- && (TelProjectionRaster (ws, XM, ym, zm, &xr[3], &yr[3]) == TSuccess)
- && (TelProjectionRaster (ws, xm, ym, ZM, &xr[4], &yr[4]) == TSuccess)
- && (TelProjectionRaster (ws, xm, YM, ZM, &xr[5], &yr[5]) == TSuccess)
- && (TelProjectionRaster (ws, XM, YM, ZM, &xr[6], &yr[6]) == TSuccess)
- && (TelProjectionRaster (ws, XM, ym, ZM, &xr[7], &yr[7]) == TSuccess))
- {
- xmr = ymr = (float ) shortreallast ();
- XMR = YMR = (float ) shortrealfirst ();
- /*
- * Recherche du rectangle projete
- */
- for (i=0; i<8; i++) {
- if (xmr > xr[i]) xmr = xr[i];
- if (ymr > yr[i]) ymr = yr[i];
- if (XMR < xr[i]) XMR = xr[i];
- if (YMR < yr[i]) YMR = yr[i];
- }
- /* pour eviter les bavures de pixels ! */
- xmr--;ymr--;
- XMR++;YMR++;
-
- /*
- * Ajout CAL : 10/05/96
- * Si les MinMax viennent d'un ensemble de markers
- * on ne tient pas compte du scale factor de ceux-ci
- * dans les valeurs de MinMax. En effet, ce facteur
- * est dans l'espace pixel et les MinMax dans l'espace
- * du modele. Donc ajout d'un delta de pixels
- * en esperant que les applis n'utilisent pas des
- * markers tres gros !
- */
- xmr -= CALL_DEF_DELTA; ymr -= CALL_DEF_DELTA;
- XMR += CALL_DEF_DELTA; YMR += CALL_DEF_DELTA;
-
- /*
- * Le rectangle projete peut-etre clippe
- */
- width = (GLsizei) (XMR-xmr+1);
- height = (GLsizei) (YMR-ymr+1);
-#ifdef COPYBUFFER
- printf ("avant clipping\n");
- printf ("xm, ym, zm : %f, %f, %f\n", xm, ym, zm);
- printf ("XM, YM, ZM : %f, %f, %f\n", XM, YM, ZM);
- printf ("taille fenetre : %d, %d\n", w, h);
- printf ("xmr, ymr by GLU : %f, %f\n", xmr, ymr);
- printf ("YMR, YMR by GLU : %f, %f\n", XMR, YMR);
- printf ("copie x, y, dx, dy : %d, %d, %d, %d\n\n",
- (int) xmr, (int) ymr, (int) width, (int) height);
-#endif
- /*
- * (xmr,ymr) coin inferieur gauche
- * (XMR,YMR) coin superieur droit
- */
- /* cas ou 1 coin est en dehors de la fenetre */
- if (xmr < 0) { width = (GLsizei) (XMR+1); xmr = 0; }
- if (ymr < 0) { height = (GLsizei) (YMR+1); ymr = 0; }
- if (XMR > w) { width = (GLsizei) (w-xmr+1); }
- if (YMR > h) { height = (GLsizei) (h-ymr+1); }
-
- /* cas ou les 2 coins sont en dehors de la fenetre */
- if (XMR < 0) { xmr = 0; width = height = 1; }
- if (YMR < 0) { ymr = 0; width = height = 1; }
- if (xmr > w) { xmr = 0; width = height = 1; }
- if (ymr > h) { ymr = 0; width = height = 1; }
-#ifdef COPYBUFFER
- printf ("apres clipping\n");
- printf ("xmr, ymr by GLU : %f, %f\n", xmr, ymr);
- printf ("YMR, YMR by GLU : %f, %f\n", XMR, YMR);
- printf ("copie x, y, dx, dy : %d, %d, %d, %d\n\n",
- (int) xmr, (int) ymr, (int) width, (int) height);
-#endif
- glDrawBuffer (to);
- glReadBuffer (from);
- /* copie partielle */
- glRasterPos2i ((GLint) xmr, (GLint) ymr);
- glCopyPixels ((GLint) xmr, (GLint) ymr, width, height, GL_COLOR);
- /* TelFlush (1); */
- }
- else
- {
- glDrawBuffer (to);
- /* TelClearViews (ws); */
- glReadBuffer (from);
- /* copie complete */
- glRasterPos2i (0, 0);
- glCopyPixels (0, 0, w+1, h+1, GL_COLOR);
- /* TelFlush (1); */
- }
- }
- else
- {
- glDrawBuffer (to);
- /* TelClearViews (ws); */
- glReadBuffer (from);
- /* copie complete */
- glRasterPos2i (0, 0);
- glCopyPixels (0, 0, w+1, h+1, GL_COLOR);
- /* TelFlush (1); */
- }
- TelEnable (ws);
-
- glMatrixMode (GL_PROJECTION);
- glPopMatrix ();
- glMatrixMode (GL_MODELVIEW);
- glPopMatrix ();
-
- glDrawBuffer (GL_BACK);
- return;
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelReadImage(Tint ws, GLenum from, Tint posx, Tint posy, Tint width, Tint height, unsigned int *image)
-{
- CMN_KEY_DATA key;
- Tint w, h;
-
-#ifdef TRACE
- printf("OPENGL: TelReadImage: %d %d %d %d \n", posx, posy, width, height);
-#endif
-
- if (image !=NULL)
- {
- TsmGetWSAttri (ws, WSWidth, &key);
- w = key.ldata;
- TsmGetWSAttri (ws, WSHeight, &key);
- h = key.ldata;
-
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity ();
- gluOrtho2D ((GLdouble) 0., (GLdouble) w, 0., (GLdouble) h);
- glMatrixMode (GL_MODELVIEW);
- glLoadIdentity ();
-
- glReadBuffer(from);
-
- glRasterPos2i (posx, posy);
- TelDisable (ws);
- glReadPixels (posx, posy, width, height, GL_RGBA, GL_UNSIGNED_BYTE, image);
- TelEnable (ws);
-
- glReadBuffer(GL_BACK);
- }
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelDrawImage(Tint ws, GLenum to, Tint posx, Tint posy, Tint width, Tint height, unsigned int *image)
-{
- CMN_KEY_DATA key;
- Tint w, h;
-
-#ifdef TRACE
- printf("OPENGL: TelDrawImage: %d %d %d %d \n", posx, posy, width, height);
-#endif
-
- if (image !=NULL)
- {
- TsmGetWSAttri (ws, WSWidth, &key);
- w = key.ldata;
- TsmGetWSAttri (ws, WSHeight, &key);
- h = key.ldata;
-
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity ();
- gluOrtho2D ((GLdouble) 0., (GLdouble) w, 0., (GLdouble) h);
- glMatrixMode (GL_MODELVIEW);
- glLoadIdentity ();
-
- glDrawBuffer(to);
-
- glRasterPos2i (posx, posy);
- TelDisable (ws);
- glDrawPixels (width, height, GL_RGBA, GL_UNSIGNED_BYTE, image);
- TelEnable (ws);
-
- glDrawBuffer(GL_BACK);
- }
- return;
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelReadDepths(Tint ws, Tint posx, Tint posy, Tint width, Tint height, float *depths)
-{
- CMN_KEY_DATA key;
- Tint w, h;
-
-#ifdef TRACE
- printf("OPENGL: TelReadDepths: %d %d %d %d \n", posx, posy, width, height);
-#endif
-
- if ( TsmGetWSAttri (ws, WSWindow, &key) != TSuccess ) return;
-
- if (depths != NULL && TxglWinset (call_thedisplay, (WINDOW) key.ldata) == TSuccess)
- {
- TsmGetWSAttri (ws, WSWidth, &key);
- w = key.ldata;
- TsmGetWSAttri (ws, WSHeight, &key);
- h = key.ldata;
-
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity ();
- gluOrtho2D ((GLdouble) 0., (GLdouble) w, 0., (GLdouble) h);
- glMatrixMode (GL_MODELVIEW);
- glLoadIdentity ();
-
- glRasterPos2i (posx, posy);
- TelDisable (ws);
- glReadPixels (posx, posy, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depths);
- TelEnable (ws);
- }
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelEnable (Tint ws)
-{
- /*glPixelTransferi (GL_MAP_COLOR, GL_TRUE);*/
-
- /* GL_DITHER on/off pour le trace */
- if (TxglGetDither())
- glEnable (GL_DITHER);
- else
- glDisable (GL_DITHER);
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelDisable (Tint ws)
-{
- glDisable (GL_DITHER);
- glPixelTransferi (GL_MAP_COLOR, GL_FALSE);
-
- /*
- * Disable stuff that's likely to slow down glDrawPixels.
- * (Omit as much of this as possible, when you know in advance
- * that the OpenGL state will already be set correctly.)
- */
- glDisable(GL_ALPHA_TEST);
- glDisable(GL_BLEND);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_FOG);
- LightOff();
-
- glDisable(GL_LOGIC_OP);
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
- glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
- glPixelTransferi(GL_RED_SCALE, 1);
- glPixelTransferi(GL_RED_BIAS, 0);
- glPixelTransferi(GL_GREEN_SCALE, 1);
- glPixelTransferi(GL_GREEN_BIAS, 0);
- glPixelTransferi(GL_BLUE_SCALE, 1);
- glPixelTransferi(GL_BLUE_BIAS, 0);
- glPixelTransferi(GL_ALPHA_SCALE, 1);
- glPixelTransferi(GL_ALPHA_BIAS, 0);
-
- /*
- * Disable extensions that could slow down glDrawPixels.
- * (Actually, you should check for the presence of the proper
- * extension before making these calls. I've omitted that
- * code for simplicity.)
- */
-
-#ifdef GL_EXT_convolution
- glDisable(GL_CONVOLUTION_1D_EXT);
- glDisable(GL_CONVOLUTION_2D_EXT);
- glDisable(GL_SEPARABLE_2D_EXT);
-#endif
-
-#ifdef GL_EXT_histogram
- glDisable(GL_HISTOGRAM_EXT);
- glDisable(GL_MINMAX_EXT);
-#endif
-
-#ifdef GL_EXT_texture3D
- glDisable(GL_TEXTURE_3D_EXT);
-#endif
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-TStatus
-TelProjectionRaster(Tint ws, Tfloat x, Tfloat y, Tfloat z, Tfloat *xr, Tfloat *yr)
-{
- Tint w, h;
- CMN_KEY_DATA key;
- Tint vid; /* View index */
- TEL_VIEW_REP vrep; /* View definition */
-
- GLint status;
-
- int i, j, k;
- GLdouble objx, objy, objz;
- GLdouble modelMatrix[16], projMatrix[16];
- GLint viewport[4];
- GLdouble winx, winy, winz;
-
- vid = ws;
-
- if (TelGetViewRepresentation (ws, vid, &vrep) != TSuccess)
- return TFailure;
-
- TsmGetWSAttri (ws, WSWidth, &key);
- w = key.ldata;
- TsmGetWSAttri (ws, WSHeight, &key);
- h = key.ldata;
-
- objx = ( GLdouble )x; objy = ( GLdouble )y; objz = ( GLdouble )z;
-
- for (k = 0, i = 0; i < 4; i++)
- for (j = 0; j < 4; j++, k++)
- modelMatrix[k] = ( GLdouble )vrep.orientation_matrix[i][j];
-
- for (k = 0, i = 0; i < 4; i++)
- for (j = 0; j < 4; j++, k++)
- projMatrix[k] = ( GLdouble )vrep.mapping_matrix[i][j];
-
- viewport[0] = 0;
- viewport[1] = 0;
- viewport[2] = w;
- viewport[3] = h;
-
- /*
- * glGetIntegerv (GL_VIEWPORT, viewport);
- * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
- * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
- */
-
- status = gluProject (objx, objy, objz,
- modelMatrix, projMatrix, viewport,
- &winx, &winy, &winz);
-
- if (status == GL_TRUE) {
- *xr = ( Tfloat )winx;
- *yr = ( Tfloat )winy;
- return TSuccess;
- }
- else
- {
- *xr = 0.0F;
- *yr = 0.0F;
- return TFailure;
- }
-}
-
-/*----------------------------------------------------------------------*/
-TStatus
-TelUnProjectionRaster(Tint ws, Tint xr, Tint yr, Tfloat *x, Tfloat *y, Tfloat *z)
-{
- Tint w, h;
- CMN_KEY_DATA key;
- Tint vid; /* View index */
- TEL_VIEW_REP vrep; /* View definition */
-
- int i, j, k;
- GLdouble objx, objy, objz;
- GLdouble modelMatrix[16], projMatrix[16];
- GLint viewport[4];
- GLdouble winx, winy, winz;
- GLint status;
-
- vid = ws;
-
- if (TelGetViewRepresentation (ws, vid, &vrep) != TSuccess)
- return TFailure;
-
- TsmGetWSAttri (ws, WSWidth, &key);
- w = key.ldata;
- TsmGetWSAttri (ws, WSHeight, &key);
- h = key.ldata;
-
- winx = ( GLdouble )xr; winy = ( GLdouble )yr; winz = ( GLdouble )0.0;
-
- for (k = 0, i = 0; i < 4; i++)
- for (j = 0; j < 4; j++, k++)
- modelMatrix[k] = ( GLdouble )vrep.orientation_matrix[i][j];
-
- for (k = 0, i = 0; i < 4; i++)
- for (j = 0; j < 4; j++, k++)
- projMatrix[k] = ( GLdouble )vrep.mapping_matrix[i][j];
-
- viewport[0] = 0;
- viewport[1] = 0;
- viewport[2] = w;
- viewport[3] = h;
-
- /*
- * glGetIntegerv (GL_VIEWPORT, viewport);
- * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
- * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
- */
-
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &objx, &objy, &objz);
-
- if (status == GL_TRUE) {
- *x = ( Tfloat )objx;
- *y = ( Tfloat )objy;
- *z = ( Tfloat )objz;
-
- return TSuccess;
- }
- else {
- *x = 0.0F;
- *y = 0.0F;
- *z = 0.0F;
-
- return TFailure;
- }
-}
-
-/*----------------------------------------------------------------------*/
-TStatus
-TelUnProjectionRasterWithRay(Tint ws, Tint xr, Tint yr, Tfloat *x, Tfloat *y, Tfloat *z,
- Tfloat *dx, Tfloat *dy, Tfloat *dz)
-{
- Tint w, h;
- CMN_KEY_DATA key;
- Tint vid; /* View index */
- TEL_VIEW_REP vrep; /* View definition */
-
- int i, j, k;
- GLdouble objx, objy, objz;
- GLdouble objx1, objy1, objz1;
- GLdouble modelMatrix[16], projMatrix[16];
- GLint viewport[4];
- GLdouble winx, winy, winz;
- GLint status;
-
- vid = ws;
-
- if (TelGetViewRepresentation (ws, vid, &vrep) != TSuccess)
- return TFailure;
-
- TsmGetWSAttri (ws, WSWidth, &key);
- w = key.ldata;
- TsmGetWSAttri (ws, WSHeight, &key);
- h = key.ldata;
-
- winx = ( GLdouble )xr; winy = ( GLdouble )yr; winz = ( GLdouble )0.0;
-
- for (k = 0, i = 0; i < 4; i++)
- for (j = 0; j < 4; j++, k++)
- modelMatrix[k] = ( GLdouble )vrep.orientation_matrix[i][j];
-
- for (k = 0, i = 0; i < 4; i++)
- for (j = 0; j < 4; j++, k++)
- projMatrix[k] = ( GLdouble )vrep.mapping_matrix[i][j];
-
- viewport[0] = 0;
- viewport[1] = 0;
- viewport[2] = w;
- viewport[3] = h;
-
- /*
- * glGetIntegerv (GL_VIEWPORT, viewport);
- * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
- * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
- */
-
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &objx, &objy, &objz);
-
- if (status == GL_TRUE) {
- *x = ( Tfloat )objx;
- *y = ( Tfloat )objy;
- *z = ( Tfloat )objz;
-
- winz = ( GLdouble ) -10.0;
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &objx1, &objy1, &objz1);
-
- if (status == GL_TRUE) {
- *dx = ( Tfloat )(objx-objx1);
- *dy = ( Tfloat )(objy-objy1);
- *dz = ( Tfloat )(objz-objz1);
-
- return TSuccess;
- }
- else {
- *dx = 0.0F;
- *dy = 0.0F;
- *dz = 0.0F;
-
- return TFailure;
- }
- }
- else {
- *x = 0.0F;
- *y = 0.0F;
- *z = 0.0F;
- *dx = 0.0F;
- *dy = 0.0F;
- *dz = 0.0F;
-
- return TFailure;
- }
-}
-
-/*----------------------------------------------------------------------*/
-void
-TelFlush(Tint wait)
-{
- if (wait)
- {
-#ifdef TRACE
- printf("OPENGL: TelFlush: glFinish \n");
-#endif
- glFinish ();
- }
- else
- {
-#ifdef TRACE
- printf("OPENGL: TelFlush: glFlush \n");
-#endif
- glFlush();
- }
- return;
-}
-
-/*----------------------------------------------------------------------*/
-Tint
-TelIsBackFacePerspective(Tmatrix3 n, Tfloat *p1, Tfloat *p2, Tfloat *p3 )
-{
- Tfloat r1[4], r2[4], r3[4], m[4], norm[4];
-
- veccpy( m, p1 );
- m[3] = ( float )1.0;
- TelTranpt3( r1, m, n );
- r1[0] /= r1[3];
- r1[1] /= r1[3];
- r1[2] /= r1[3];
-
- veccpy( m, p2 );
- m[3] = ( float )1.0;
- TelTranpt3( r2, m, n );
- r2[0] /= r2[3];
- r2[1] /= r2[3];
- r2[2] /= r2[3];
-
- veccpy( m, p3 );
- m[3] = ( float )1.0;
- TelTranpt3( r3, m, n );
- r3[0] /= r3[3];
- r3[1] /= r3[3];
- r3[2] /= r3[3];
- TelGetNormal( r1, r2, r3, norm );
-
- return norm[2] < 0.0;
-}
-
-/*----------------------------------------------------------------------*/
#ifndef WNT
#include <GL/glx.h>
#endif
-#include <OpenGl_telem.hxx>
+#include <InterfaceGraphic_telem.hxx>
/*
* ShortRealLast () = 3.40282346638528860e+38
} \
}
-extern Tint TelRemdupnames( Tint*, Tint ); /* list, num */
-#ifdef BUC60823
extern int TelGetPolygonNormal( tel_point, Tint*, Tint, Tfloat* );
extern int TelGetNormal( Tfloat*, Tfloat*, Tfloat*, Tfloat* );
-#else
-extern void TelGetNormal( Tfloat*, Tfloat*, Tfloat*, Tfloat* );
-#endif
-/* point1, point2, point3, normal */
-extern Tint TelIsBackFace( Tmatrix3, Tfloat* ); /* normal */
-extern Tint TelIsBackFacePerspective( Tmatrix3, Tfloat*, Tfloat*, Tfloat* );
-/* matrix, point 1, point 2, point 3 */
extern void TelMultiplymat3( Tmatrix3, Tmatrix3, Tmatrix3 );
-/* mat out, mat in, mat in */
-extern void TelTransposemat3( Tmatrix3 ); /* mat in out */
-extern void TelTranpt3( Tfloat [4], Tfloat [4], Tmatrix3 ); /* out, in, mat */
-
-extern void TelInitWS( Tint, Tint, Tint, Tfloat, Tfloat, Tfloat );
-/* ws, width, height, bgcolr, bgcolg, bgcolb */
-extern void TelSwapBuffers( Tint );
-extern void TelCopyBuffers( Tint, GLenum, GLenum,
- Tfloat, Tfloat, Tfloat, Tfloat, Tfloat, Tfloat, Tint );
-extern TStatus TelProjectionRaster( Tint ws, Tfloat x, Tfloat y, Tfloat z,
- Tfloat *xr, Tfloat *yr);
-extern TStatus TelUnProjectionRaster( Tint ws, Tint xr, Tint yr,
- Tfloat *x, Tfloat *y, Tfloat *z);
-TStatus
-TelUnProjectionRasterWithRay(Tint ws, Tint xr, Tint yr, Tfloat *x, Tfloat *y, Tfloat *z,
- Tfloat *dx, Tfloat *dy, Tfloat *dz);
-extern Tint TelBackBufferRestored(void);
-extern void TelSetBackBufferRestored( Tint );
-extern void TelEnable( Tint );
-extern void TelDisable( Tint );
-extern void TelFlush( Tint );
-
-extern void TelSetFrontFaceAttri(
- Tint, /* interior_style */
- Tint, /* back_interior_style */
- Tint, /* interior_index */
- Tint, /* back_interior_index */
- Tint, /* front_shading_method */
- Tint, /* back_shading_method */
- Tint, /* front_lighting_model */
- Tint, /* back_lighting_model */
- tel_surf_prop, /* surf_prop */
- tel_surf_prop, /* back_surf_prop */
- tel_colour, /* interior_colour */
- tel_colour /* back_interior_colour */
- );
-extern void TelSetBackFaceAttri(
- Tint, /* interior_style */
- Tint, /* back_interior_style */
- Tint, /* interior_index */
- Tint, /* back_interior_index */
- Tint, /* front_shading_method */
- Tint, /* back_shading_method */
- Tint, /* front_lighting_model */
- Tint, /* back_lighting_model */
- tel_surf_prop, /* surf_prop */
- tel_surf_prop, /* back_surf_prop */
- tel_colour, /* interior_colour */
- tel_colour /* back_interior_colour */
- );
-
-extern void TelReadImage(Tint , GLenum , Tint , Tint , Tint , Tint , unsigned int *);
-extern void TelDrawImage(Tint , GLenum , Tint , Tint , Tint , Tint , unsigned int *);
-extern void TelReadDepths(Tint , Tint , Tint , Tint , Tint , float *);
-
-extern void TelMakeFrontBufCurrent(Tint );
-extern void TelMakeBackBufCurrent(Tint );
-#ifdef IMP190100
-extern void TelMakeFrontAndBackBufCurrent(Tint );
-#endif
-
-#ifndef WNT
-extern void TelSetPixmapDBParams(Display *dpy,
- Window window,
- int width, int height, int depth, GC gc,
- Pixmap pixmap,
- GLXPixmap glxpixmap,
- GLXContext ctx);
-extern GLXPixmap TelGetGLXPixmap(void);
-extern void TelSetPixmapDB(int flag);
-extern int TelTestPixmapDB(void);
-extern void TelDrawBuffer(GLenum buf);
-#endif /* WNT*/
#endif
--- /dev/null
+/***********************************************************************
+
+FONCTION :
+----------
+File OpenGl_telem_view :
+
+************************************************************************/
+
+#include <OpenGl_tgl_all.hxx>
+#include <OpenGl_telem_view.hxx>
+#include <OpenGl_telem_util.hxx>
+#include <OpenGl_Display.hxx>
+
+static void
+EvalViewMappingMatrix( tel_view_mapping mapping /* View Mapping */,
+ Tint *error_ind /* Out: Error Indicator */,
+ Tmatrix3 mat /* Out: Mapping Matrix * */,
+ Tint flag,
+ Tfloat cx,
+ Tfloat cy,
+ Tint clip_flag,
+ Tlimit3 *clip_limit
+ )
+{
+ Tfloat gx, gy, xsf, ysf, zsf;
+ Tfloat fpd, bpd;
+
+ /* OCC18942 */
+ Tfloat n, f, r, l, t, b, Zprp, dx, dy, VPD;
+
+ /* FSXXX */
+ /* GLint gdtmp; */
+ Tlimit3 vp = { ( float )-1.0, ( float )1.0, ( float )-1.0, ( float )1.0, ( float )1.0, ( float )-1.0 };
+ Tmatrix3 pmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
+ Tmatrix3 mmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
+ { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
+
+ fpd = mapping->fpd;
+ bpd = mapping->bpd;
+
+ /* invalid window */
+ if( mapping->window.xmin >= mapping->window.xmax ||
+ mapping->window.ymin >= mapping->window.ymax )
+ {
+ *error_ind = 1;
+ return;
+ }
+
+ /* invalid viewport */
+ if( mapping->viewport.xmin >= mapping->viewport.xmax ||
+ mapping->viewport.ymin >= mapping->viewport.ymax ||
+ mapping->viewport.zmin >= mapping->viewport.zmax )
+ {
+ *error_ind = 2;
+ return;
+ }
+
+ /* invalid back/front plane distances */
+ if( mapping->bpd >= mapping->fpd )
+ {
+ *error_ind = 3;
+ return;
+ }
+
+ /* prp between front and back planes */
+ if (!openglDisplay.IsNull() || !openglDisplay->Walkthrough())
+ {
+ if( mapping->prp[2] < mapping->fpd &&
+ mapping->prp[2] > mapping->bpd )
+ {
+ *error_ind = 4;
+ return;
+ }
+ }
+
+ if( mapping->prp[2] == mapping->vpd )
+ {
+ *error_ind = 5; /* prp on view plane */
+ return;
+ }
+
+ if( mapping->viewport.xmin < 0 ||
+ mapping->viewport.xmax > 1 ||
+ mapping->viewport.ymin < 0 ||
+ mapping->viewport.ymax > 1 ||
+ mapping->viewport.zmin < 0 ||
+ mapping->viewport.zmax > 1 )
+ {
+ *error_ind = 6; /* viewport limits outside NPC space */
+ return;
+ }
+
+ *error_ind = 0;
+
+ /* OCC18942: Moved here while debugging perspective projection matrix */
+ /* centers */
+ if( flag == 0 )
+ {
+ cx = mapping->window.xmin + mapping->window.xmax, cx /= ( float )2.0;
+ cy = mapping->window.ymin + mapping->window.ymax, cy /= ( float )2.0;
+ }
+
+ gx = (cx - mapping->prp[0]) / (mapping->vpd - mapping->prp[2]);
+ gy = (cy - mapping->prp[1]) / (mapping->vpd - mapping->prp[2]);
+
+#ifdef PRINT
+ printf("EvalViewMappingMatrix \n");
+ printf("prp %f %f %f \n", mapping->prp[0], mapping->prp[1], mapping->prp[2]);
+ printf("vpd fpd bpd %f %f %f \n", mapping->vpd, mapping->fpd, mapping->bpd);
+ printf("window limit %f %f %f %f\n", mapping->window.xmin, mapping->window.xmax,
+ mapping->window.ymin, mapping->window.ymax);
+ printf("viewport limit %f %f %f %f\n", mapping->viewport.xmin, mapping->viewport.xmax,
+ mapping->viewport.ymin, mapping->viewport.ymax);
+#endif
+
+ /* projection matrix */
+ if( mapping->proj == TelParallel )
+ {
+
+ pmat[2][0] = -gx; pmat[3][0] = mapping->vpd*gx;
+ pmat[2][1] = -gy; pmat[3][1] = mapping->vpd*gy;
+ }
+ else if (!openglDisplay.IsNull() && !openglDisplay->SymPerspective())/* TelPerspective */
+ {
+ pmat[0][0] = pmat[1][1] = mapping->prp[2] - mapping->vpd;
+ pmat[2][0] = -gx;
+ pmat[2][1] = -gy;
+ pmat[2][3] = ( float )-1.0;
+ pmat[3][0] = mapping->vpd * gx;
+ pmat[3][1] = mapping->vpd * gy;
+ pmat[3][3] = mapping->prp[2];
+
+ /* modify the next two cells to change clipping policy */
+ if (!openglDisplay.IsNull() && !openglDisplay->Walkthrough())
+ {
+ pmat[2][2] = mapping->prp[2] - ( fpd + bpd );
+ pmat[3][2] = fpd * bpd;
+ }
+ }
+ /* OCC18942: New approach to calculation of mapping (projection) matrix */
+ else
+ {
+ dx = mapping->window.xmax - mapping->window.xmin;
+ dy = mapping->window.ymax - mapping->window.ymin;
+ Zprp = mapping->prp[2];
+ VPD = Zprp - mapping->vpd;
+
+ /*
+ Calculate canonical perspective projection parameters as if we were about
+ to use glFrustum() to create symmetric perspective frustum.
+
+ After the view orientation matrix is applied, the coordinate system origin is located
+ at the VRP and oriented properly. However, the viewplane has width = dx and height = dy
+ and its center (cx, cy, VPD) is not always located at the view Z axis.
+ The canonical perspective projection matrix assumes the eye is located at (0, 0, 0).
+ Thus the old approach resulted in a non-symmetric perspective,
+ as X and Y coordinates of the projection reference point (PRP) were not updated
+ when cx and cy changed. Moreover, such "static" perspective had some other disadvantages,
+ such as non-realistic panning, i.e. instead of moving the eye (or camera) over the model
+ a sort of "frame" moved over the static perspective projection picture,
+ exposing a part of this static picture to the user.
+
+ In order to make the perspective symmetric, we need to translate
+ the coordinate system to PRP before projection.
+ Thus we translate X, Y and Z co-ordinates by -cx, -cy and -Zprp respectively.
+
+ NOTE: mat[i][j] means j-th element of i-th column, as OpenGL accepts the matrices
+ in column-major order, while in C two-dimensional arrays are stored in memory
+ in row-major order!
+
+ VPD is used below instead of near clipping plane dispance (n) in order to simplify
+ calculation of l and r values. If we did not use VPD in the matrix calculation, we would have to
+ project 0.5 * dx, -0.5 * dx, 0.5 * dy and - 0.5 * dy onto the near clipping plane
+ to calculate these values.
+
+ Pending issues:
+ 1. It is still necessary to find a way to calculate the perspective projection matrix
+ for TPM_WALKTHROUGH projection model. This projection model is not supported yet
+ by the new code.
+ */
+ r = .5f * dx;
+ l = -r;
+ t = .5f * dy;
+ b = -t;
+ n = Zprp - fpd; f = Zprp - bpd;
+
+ mat[0][0] = 2.f * VPD / (r - l);
+ mat[1][1] = 2.f * VPD / (t - b);
+ mat[2][0] = (r + l) / (r - l);
+ mat[2][1] = (t + b) / (t - b);
+ mat[2][2] = - (f + n) / (f - n);
+ mat[2][3] = -1.f;
+ /*
+ The last column takes into account translation along X, Y and Z axis
+ before projecting. This can be considered as a result of right-multiplying the canonical
+ perspective projection matrix P by a translation matrix T
+ (it differs form the canonical matrix by the last column only):
+ | 1 0 0 -cx |
+ | 0 1 0 -cy |
+ mat = P * T, where T = | 0 0 1 -Zprp |
+ | 0 0 0 1 |
+ */
+ mat[3][0] = -mat[2][0] * Zprp - mat[0][0] * cx;
+ mat[3][1] = -mat[2][1] * Zprp - mat[1][1] * cy;
+ mat[3][2] = -2.f * f * n / (f - n) - mat[2][2] * Zprp;
+ mat[3][3] = Zprp;
+
+#ifdef PRINT
+ printf("r l t b n f: %f %f %f %f %f %f \n", r,l,t,b,n,f);
+ printf( "mapping_matrix (new code):\n" );
+ pr_matrix(mat);
+#endif
+
+ /* return here, as further calculations are related to the old approach */
+ return;
+ }
+
+ /* scale factors */
+ xsf = (vp.xmax - vp.xmin) / (mapping->window.xmax - mapping->window.xmin);
+ ysf = (vp.ymax - vp.ymin) / (mapping->window.ymax - mapping->window.ymin);
+ zsf = (vp.zmax - vp.zmin) / (fpd - bpd);
+
+ /* map matrix */
+ mmat[0][0] = xsf, mmat[1][1] = ysf, mmat[2][2] = zsf;
+ mmat[3][0] = vp.xmin - xsf*mapping->window.xmin;
+ mmat[3][1] = vp.ymin - ysf*mapping->window.ymin;
+ mmat[3][2] = vp.zmin - zsf*bpd;
+
+ /* multiply to obtain mapping matrix */
+ TelMultiplymat3( mat, pmat, mmat );
+
+#ifdef PRINT
+ printf( "mapping_matrix :\n" );
+ pr_matrix(mat);
+#endif
+}
+
+void
+TelEvalViewOrientationMatrix( Tfloat *vrp /* View Reference Point */,
+ Tfloat *vpn /* View Plane Normal */,
+ Tfloat *vup /* View Up Vector */,
+ Tfloat *asf /* Axial Scale Factors */,
+ Tint *error_ind/* Out: Error indicator */,
+ Tmatrix3 rmat /* Out: Orientation Matrix */
+ )
+{
+ Tfloat u[3], v[3], n[3], f;
+
+ /* view plane normal of zero length */
+ if( vecmag(vpn) == 0.0 )
+ {
+ *error_ind = 1;
+ return;
+ }
+
+ /* view up vector of zero length */
+ if( vecmag(vup) == 0.0 )
+ {
+ *error_ind = 2;
+ return;
+ }
+
+ /* view up vector parallel to view plane normal */
+ vecang(vup, vpn, f);
+ if( f == 0.0 )
+ {
+ *error_ind = 3;
+ return;
+ }
+
+ *error_ind = 0;
+
+ veccpy(n, vpn);
+ veccpy(v, vup);
+ vecnrm(n);
+
+ veccrs(u,v,n); /* up vector cross plane normal gives U axis */
+ vecnrm(u);
+
+ veccrs(v,n,u); /* plane normal cross U axis gives modified up vector */
+ vecnrm(v); /* redundant ? */
+
+ /* rotate to align along u, v, n */
+ rmat[0][0] = ( float )u[0] * asf[0],
+ rmat[0][1] = ( float )v[0] * asf[0],
+ rmat[0][2] = ( float )n[0] * asf[0],
+ rmat[0][3] = ( float )0.0;
+
+ rmat[1][0] = ( float )u[1] * asf[1],
+ rmat[1][1] = ( float )v[1] * asf[1],
+ rmat[1][2] = ( float )n[1] * asf[1],
+ rmat[1][3] = ( float )0.0;
+
+ rmat[2][0] = ( float )u[2] * asf[2],
+ rmat[2][1] = ( float )v[2] * asf[2],
+ rmat[2][2] = ( float )n[2] * asf[2],
+ rmat[2][3] = ( float )0.0;
+
+ /* translate to centre at vrp */
+
+ rmat[3][0] = - ( float ) (u[0]*vrp[0] + u[1]*vrp[1] + u[2]*vrp[2]);
+ rmat[3][1] = - ( float ) (v[0]*vrp[0] + v[1]*vrp[1] + v[2]*vrp[2]);
+ rmat[3][2] = - ( float ) (n[0]*vrp[0] + n[1]*vrp[1] + n[2]*vrp[2]);
+ rmat[3][3] = ( float )1.0;
+
+#ifdef PRINT
+ printf("TelEvalViewOrientationMatrix \n");
+ printf("view_ref_pt %f %f %f \n", vrp[0], vrp[1], vrp[2]);
+ printf("view_up_vec %f %f %f \n", vup[0], vup[1], vup[2]);
+ printf("view_plane_normal %f %f %f \n", vpn[0], vpn[1], vpn[2]);
+ pr_matrix(rmat);
+#endif
+
+ return;
+}
+
+void
+TelEvalViewMappingMatrix( tel_view_mapping mapping /* View Mapping */,
+ Tint *error_ind /* Out: Error Indicator */,
+ Tmatrix3 mat /* Out: Mapping Matrix */
+ )
+{
+ EvalViewMappingMatrix( mapping, error_ind, mat, 0, ( float )0.0, ( float )0.0, 0, 0 );
+}
+
#ifndef OPENGL_TELEM_VIEW_H
#define OPENGL_TELEM_VIEW_H
-#include <OpenGl_telem.hxx>
-#include <OpenGl_tgl.hxx>
-#include <NCollection_List.hxx>
+#include <InterfaceGraphic_tgl_all.hxx>
typedef struct
{
Tfloat zmax;
} Tlimit3;
-
-
typedef enum
{
TelParallel, TelPerspective
Tfloat bpd;
} TEL_VIEW_MAPPING, *tel_view_mapping;
-
-typedef struct
-{
- Tmatrix3 orientation_matrix;
- Tmatrix3 mapping_matrix;
- Tlimit3 clip_limit;
- Tint clip_xy;
- Tint clip_back;
- Tint clip_front;
- Tint shield_indicator;
- TEL_COLOUR shield_colour;
- Tint border_indicator;
- TEL_COLOUR border_colour;
- Tint active_status;
- NCollection_List<CALL_DEF_PLANE> clipping_planes;
- struct
- {
- Tfloat vrp[3];
- Tfloat vpn[3];
- Tfloat vup[3];
- TEL_VIEW_MAPPING map;
- Tfloat scaleFactors[3];
- } extra;
-} TEL_VIEW_REP, *tel_view_rep;
-
-
-typedef enum
-{
- UVN2XYZ, XYZ2UVN
-} TelCoordType;
-
-extern Tint TglUpdateView0; /* defined in telem/view */
-
extern void /* vrp, vpn, vup, error_ind, mat */
TelEvalViewOrientationMatrix(Tfloat*, Tfloat*, Tfloat*, Tfloat*, Tint*, Tmatrix3);
extern void /* mapping, error_ind, mat */
TelEvalViewMappingMatrix( tel_view_mapping, Tint*, Tmatrix3 );
-extern void /* mapping, error_ind, mat, cx, cy */
-TelEvalViewMappingMatrixPick(tel_view_mapping, Tint*, Tmatrix3, Tfloat, Tfloat);
-
-extern TStatus /* ws, view_id, view_representation */
-TelSetViewRepresentation( Tint, Tint, tel_view_rep );
-
-extern TStatus /* ws, view_id, type, uvn, xyz */
-TelConvertCoord( Tint, Tint, TelCoordType, Tfloat*, Tfloat* );
-
-extern TStatus TelSetViewIndex( Tint, Tint ); /* ws, view_id */
-extern TStatus TelSetViewProjection( Tint, Tint ); /* ws, view_id */
-extern TStatus /* ws, view_id, view_representation */
-TelGetViewRepresentation( Tint, Tint, tel_view_rep );
-extern TStatus TelDeleteViewsForWS( Tint wsid );
-
-
-extern void TelClearViews( Tint ); /* ws */
-extern void TelClearBackground( Tint ); /* ws */
-
-extern TStatus TelPrintViewRepresentation( Tint, Tint ); /* ws, view */
-extern TStatus Tel2Dto3D( Tint ws, Tint vid, Tint x, Tint y,
- Tfloat *x1, Tfloat *y1, Tfloat *z1,
- Tfloat *x2, Tfloat *y2, Tfloat *z2 );
-/* x is from bottom */
-/* y is from top */
-
#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_text :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-05-03-96 : FMN ; Suppression code inutile:
-01-04-96 : CAL ; Integration MINSK portage WNT
-29-04-96 : FMN ; correction warning de compilation.
-21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
-30-11-98 : FMN ; S4069 : Textes toujours visibles
-02.14.100 : JR : Warnings on WNT truncations from double to float
-21.06.03 : SAN : Suppress text display while in animation mode (TEXT_DEGENER)
-22.01.04 : SAN : Implement texture mapped fonts on WNT only (OCC2934)
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#ifndef WNT
-#include <X11/Xlib.h>
-#endif
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <string.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_Extension.hxx>
-#include <OpenGl_Memory.hxx>
-
-#include <OpenGl_TextRender.hxx>
-
-struct TEL_TEXT_DATA
-{
- TEL_POINT attach_pt;
- Tint length;
- const wchar_t *sdata;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_TEXT_DATA* tel_text_data;
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions statiques
-*/
-
-static TStatus TextDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-#if defined(__sun) || defined (__osf__) || defined (__hp) || defined (__sgi)
-#else
-PFNGLBLENDEQUATIONEXTPROC glBlendEquationOp = (PFNGLBLENDEQUATIONEXTPROC) INVALID_EXT_FUNCTION_PTR;
-#endif
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#if defined(__osf__) || defined (__sun) || defined (__sgi) || defined(__hp9000s700) || defined(WNT)
-#undef GL_EXT_blend_logic_op
-#endif
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-/*static GLboolean lighting_mode;*/
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- TextDisplay,
- TextDisplay,
- TextAdd,
- TextDelete,
- TextPrint,
- TextInquire
-};
-
-extern GLuint fontBase;
-extern GLuint printerFontBase;
-
-#define TEXT_DEGENER
-
-#ifdef TEXT_DEGENER
-extern int g_nDegenerateModel;
-extern float g_fSkipRatio;
-#endif
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr
-TelTextInitClass( TelType* el )
-{
- *el = TelText;
- return MtdTbl;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tint i;
- TEL_POINT def_pt = {{ ( float )0.0, ( float )0.0, ( float )0.0 }};
- tel_point pt = &def_pt;
- tel_text_data data;
- Techar *str= 0;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case TEXT_ATTACH_PT_ID:
- pt = (tel_point)k[i]->data.pdata;
- break;
- case TEXT_STRING_ID:
- str = (Techar*)k[i]->data.pdata;
- break;
- }
- }
-
- data = new TEL_TEXT_DATA();
- if( !data )
- return TFailure;
-
- //szv: instead of strlen + 1
- i = 0; while (str[i++]);
-
- wchar_t *wstr = new wchar_t[i];
- if( !wstr )
- return TFailure;
-
- data->attach_pt = *pt;
- data->length = i;
- //szv: instead of memcpy
- i = 0; while (wstr[i++] = (wchar_t)(*str++));
- data->sdata = wstr;
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_text_data d;
- CMN_KEY key, key1;
- TEL_COLOUR colour, colours;
- int style, display_type;
- GLboolean flag_zbuffer = GL_FALSE;
- GLboolean blend_state = GL_FALSE;
- GLint sWidth, sAscent, sDescent;
- GLdouble modelMatrix[16], projMatrix[16];
- GLint viewport[4];
- GLdouble objrefX, objrefY, objrefZ;
- GLdouble objX, objY, objZ;
- GLdouble obj1X, obj1Y, obj1Z;
- GLdouble obj2X, obj2Y, obj2Z;
- GLdouble obj3X, obj3Y, obj3Z;
- GLdouble winx1, winy1, winz1;
- GLdouble winx, winy, winz;
- GLint status;
-
-#ifdef TEXT_DEGENER
- if ( g_nDegenerateModel > 0 && g_fSkipRatio == 1. )
- return TSuccess;
-#endif
-
- d = (tel_text_data)data.pdata;
-
- if( k[0]->id == TOn )
- { /* Use highlight colours */
- TEL_HIGHLIGHT hrep;
-
- key.id = TelHighlightIndex;
- TsmGetAttri( 1, &key );
- if( TelGetHighlightRep( TglActiveWs, key.data.ldata, &hrep )
- == TSuccess )
- colour = hrep.col;
- else
- {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- colour = hrep.col;
- }
- }
- else
- {
- key.id = TelTextColour;
- key.data.pdata = &colour;
- TsmGetAttri( 1, &key );
- }
-
- key.id = TelTextStyle;
- key1.id = TelTextDisplayType;
- TsmGetAttri( 2, &key, &key1 );
- style = key.data.ldata;
- display_type = key1.data.ldata;
-
- /* style annotation */
- if (style == ASPECT_TOST_ANNOTATION)
- {
- flag_zbuffer = glIsEnabled(GL_DEPTH_TEST);
- if (flag_zbuffer) glDisable(GL_DEPTH_TEST);
- }
-
- OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
-
- /* display type of text */
- if (display_type != ASPECT_TODT_NORMAL)
- {
- key.id = TelTextColourSubTitle;
- key.data.pdata = &colours;
- TsmGetAttri( 1, &key );
-
- /* Optimisation: il faudrait ne faire le Get qu'une fois par Redraw */
- glGetIntegerv (GL_VIEWPORT, viewport);
- glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
- glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
-
- switch (display_type)
- {
- case ASPECT_TODT_BLEND:
-
-#if defined(GL_EXT_blend_logic_op)
- if ( (PFNGLBLENDEQUATIONEXTPROC)glBlendEquationOp == (PFNGLBLENDEQUATIONEXTPROC)INVALID_EXT_FUNCTION_PTR )
- {
- if(QueryExtension("GL_EXT_blend_logic_op")) {
-#ifdef WNT
- glBlendEquationOp = (PFNGLBLENDEQUATIONEXTPROC)wglGetProcAddress("glBlendEquationOp");
-#else
- glBlendEquationOp = (PFNGLBLENDEQUATIONEXTPROC)glXGetProcAddress((GLubyte*)"glBlendEquationOp");
-#endif
- } else
- glBlendEquationOp = NULL;
- }
-
- if ( glBlendEquationOp )
- {
- blend_state = glIsEnabled(GL_BLEND);
- if (!blend_state) glEnable(GL_BLEND);
- glBlendEquationOp(GL_LOGIC_OP);
- glLogicOp(GL_XOR);
- }
-#else
-
- blend_state = glIsEnabled(GL_BLEND);
- if (!blend_state) glEnable(GL_BLEND);
- glEnable(GL_COLOR_LOGIC_OP);
- glLogicOp(GL_XOR);
-
-#endif
- break;
- case ASPECT_TODT_SUBTITLE:
- textRender->StringSize(d->sdata, &sWidth, &sAscent, &sDescent);
- objrefX = (float)d->attach_pt.xyz[0];
- objrefY = (float)d->attach_pt.xyz[1];
- objrefZ = (float)d->attach_pt.xyz[2];
- status = gluProject (objrefX, objrefY, objrefZ, modelMatrix, projMatrix, viewport,
- &winx1, &winy1, &winz1);
-
- winx = winx1;
- winy = winy1-sDescent;
- winz = winz1+0.00001;
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &objX, &objY, &objZ);
-
- winx = winx1 + sWidth;
- winy = winy1-sDescent;
- winz = winz1+0.00001; /* il vaut mieux F+B / 1000000 ? */
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &obj1X, &obj1Y, &obj1Z);
-
- winx = winx1 + sWidth;
- winy = winy1 + sAscent;
- winz = winz1+0.00001;
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &obj2X, &obj2Y, &obj2Z);
-
- winx = winx1;
- winy = winy1+ sAscent;
- winz = winz1+0.00001;
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &obj3X, &obj3Y, &obj3Z);
-
- glColor3fv( colours.rgb );
- glBegin(GL_POLYGON);
- glVertex3d(objX, objY, objZ);
- glVertex3d(obj1X, obj1Y, obj1Z);
- glVertex3d(obj2X, obj2Y, obj2Z);
- glVertex3d(obj3X, obj3Y, obj3Z);
- glEnd();
- break;
-
- case ASPECT_TODT_DEKALE:
- objrefX = (float)d->attach_pt.xyz[0];
- objrefY = (float)d->attach_pt.xyz[1];
- objrefZ = (float)d->attach_pt.xyz[2];
- status = gluProject (objrefX, objrefY, objrefZ, modelMatrix, projMatrix, viewport,
- &winx1, &winy1, &winz1);
-
- winx = winx1+1;
- winy = winy1+1;
- winz = winz1+0.00001;
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &objX, &objY, &objZ);
-
- glColor3fv( colours.rgb );
- textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
- winx = winx1-1;
- winy = winy1-1;
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &objX, &objY, &objZ);
-
- textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
- winx = winx1-1;
- winy = winy1+1;
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &objX, &objY, &objZ);
-
- textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
- winx = winx1+1;
- winy = winy1-1;
- status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport,
- &objX, &objY, &objZ);
- textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ );
- break;
- }
- }
-
- glColor3fv( colour.rgb );
- textRender->RenderText( d->sdata, fontBase, 0, (float)d->attach_pt.xyz[0], (float)d->attach_pt.xyz[1],(float)d->attach_pt.xyz[2] );
- /* maj attributs */
- if (flag_zbuffer) glEnable(GL_DEPTH_TEST);
- if (display_type == ASPECT_TODT_BLEND)
- {
-#if defined(GL_EXT_blend_logic_op)
- if ((!blend_state) && (QueryExtension("GL_EXT_blend_logic_op"))) glDisable(GL_BLEND);
-#else
- if (!blend_state) glDisable(GL_BLEND);
- glDisable(GL_COLOR_LOGIC_OP);
-#endif
- }
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_text_data d = (tel_text_data)data.pdata;
- if (d)
- {
- delete[] d->sdata;
- delete d;
- }
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_text_data p;
-
- p = (tel_text_data)data.pdata;
-
- fprintf( stdout, "TelText.\n" );
- fprintf( stdout, "\t\tString : %S\n", p->sdata );
- fprintf( stdout, "\t\tAttach Point : %f %f %f\n", p->attach_pt.xyz[0],
- p->attach_pt.xyz[1],
- p->attach_pt.xyz[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_text_data d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
-
- d = (tel_text_data)data.pdata;
-
- size_reqd = sizeof(Techar)*d->length;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- if( c->size >= size_reqd )
- {
- w->atext3.string = (Techar*)c->buf;
- w->atext3.ref_pt = d->attach_pt;
- w->atext3.anno.xyz[0] = ( float )0.0;
- w->atext3.anno.xyz[1] = ( float )0.0;
- w->atext3.anno.xyz[2] = ( float )0.0;
- //szv: instead of strcpy
- Techar *ptr1 = w->atext3.string;
- const wchar_t *ptr2 = d->sdata;
- while (*ptr1++ = (Techar)(*ptr2++));
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-/*OCC7456 abd 14.12.2004 Text alingnment attributes */
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-static TStatus TextAlignDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextAlignAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextAlignPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- TextAlignDisplay,
- TextAlignAdd,
- 0, /* Delete */
- TextAlignPrint,
- 0 /* Inquire */
-};
-
-MtblPtr
-TelTextAlignInitClass( TelType *el )
-{
- *el = TelTextAlign;
- return MtdTbl;
-}
-
-static TStatus
-TextAlignDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelTextAlign;
- key.data.pdata = data.pdata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-static TStatus
-TextAlignAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_align_data data = new TEL_ALIGN_DATA();
- if( !data )
- return TFailure;
-
- *data = *(tel_align_data)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-TextAlignPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelTextHAlign. Value = %d\n", data.ldata);
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
+++ /dev/null
-// File: OpenGl_textangle.cxx
-// Created: 30.09.09
-// Author: Paul Supryatkin
-// Copyright: Open CASCADE 2009
-
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-static TStatus TextAngleDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextAngleAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- TextAngleDisplay,
- TextAngleAdd,
- 0, /* Delete */
- 0,
- 0 /* Inquire */
-};
-
-MtblPtr
-TelTextAngleInitClass( TelType *el )
-{
- *el = TelTextAngle;
- return MtdTbl;
-}
-
-static TStatus
-TextAngleDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelTextAngle;
- key.data.ldata = data.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-static TStatus
-TextAngleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
- return TSuccess;
-}
-
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_textcol :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-01-04-96 : CAL ; Integration MINSK portage WNT
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions statiques
-*/
-
-static TStatus TextColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextColourAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextColourDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextColourPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextColourInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*----------------------------------------------------------------------*/
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- TextColourDisplay,
- TextColourAdd,
- TextColourDelete,
- TextColourPrint,
- TextColourInquire
-};
-
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr
-TelTextColourInitClass( TelType *el )
-{
- *el = TelTextColour;
- return MtdTbl;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_colour data = new TEL_COLOUR();
- //cmn_memreserve( data, 1, 0 );
-
- if( !data )
- return TFailure;
-
- *data = *(tel_colour)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour d;
- CMN_KEY key;
-
- d = (tel_colour)data.pdata;
-
- key.id = TelTextColour;
- key.data.pdata = d;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- //cmn_freemem( data.pdata );
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour p;
-
- p = (tel_colour)data.pdata;
-
- fprintf( stdout, "TelTextColour. R = %g, G = %g, B = %g\n",
- p->rgb[0], p->rgb[1], p->rgb[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_colour col;
-
- col = (tel_colour)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
-
- w->gnl_colour.rgb[0] = col->rgb[0];
- w->gnl_colour.rgb[1] = col->rgb[1];
- w->gnl_colour.rgb[2] = col->rgb[2];
- break;
- }
- }
- }
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_textcolsubtitle :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-30-11-98 : FMN ; Creation.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions statiques
-*/
-
-static TStatus TextColourSubTitleDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextColourSubTitleAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextColourSubTitleDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextColourSubTitlePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextColourSubTitleInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*----------------------------------------------------------------------*/
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- TextColourSubTitleDisplay,
- TextColourSubTitleAdd,
- TextColourSubTitleDelete,
- TextColourSubTitlePrint,
- TextColourSubTitleInquire
-};
-
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr
-TelTextColourSubTitleInitClass( TelType *el )
-{
- *el = TelTextColourSubTitle;
- return MtdTbl;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextColourSubTitleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_colour data = new TEL_COLOUR();
- //cmn_memreserve( data, 1, 0 );
- if( !data )
- return TFailure;
-
- *data = *(tel_colour)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextColourSubTitleDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour d;
- CMN_KEY key;
-
- d = (tel_colour)data.pdata;
-
- key.id = TelTextColourSubTitle;
- key.data.pdata = d;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextColourSubTitleDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- //cmn_freemem( data.pdata );
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextColourSubTitlePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_colour p;
-
- p = (tel_colour)data.pdata;
-
- fprintf( stdout, "TelTextColourSubTitle. R = %g, G = %g, B = %g\n",
- p->rgb[0], p->rgb[1], p->rgb[2] );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextColourSubTitleInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_colour col;
-
- col = (tel_colour)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (tel_inq_content)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
-
- w->gnl_colour.rgb[0] = col->rgb[0];
- w->gnl_colour.rgb[1] = col->rgb[1];
- w->gnl_colour.rgb[2] = col->rgb[2];
- break;
- }
- }
- }
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_textdisplaystyle :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-30-11-98 : FMN ; Creation.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions statiques
-*/
-
-static TStatus TextDisplayTypeDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextDisplayTypeAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextDisplayTypePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*----------------------------------------------------------------------*/
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- TextDisplayTypeDisplay,
- TextDisplayTypeAdd,
- 0, /* Delete */
- TextDisplayTypePrint,
- 0 /* Inquire */
-};
-
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr
-TelTextDisplayTypeInitClass( TelType *el )
-{
- *el = TelTextDisplayType;
- return MtdTbl;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextDisplayTypeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextDisplayTypeDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelTextDisplayType;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextDisplayTypePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_textfont :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-01-04-96 : CAL ; Integration MINSK portage WNT
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-static TStatus TextFontDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextFontAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextFontPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- TextFontDisplay, /* PickTraverse */
- TextFontDisplay,
- TextFontAdd,
- 0, /* Delete */
- TextFontPrint,
- 0 /* Inquire */
-};
-
-
-MtblPtr
-TelTextFontInitClass( TelType *el )
-{
- *el = TelTextFont;
- return MtdTbl;
-}
-
-static TStatus
-TextFontAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->pdata = k[0]->data.pdata;
-
- return TSuccess;
-}
-
-
-static TStatus
-TextFontDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelTextFont;
- key.data.pdata = data.pdata;
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-static TStatus
-TextFontPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelTextFont. %s\n", (char *) data.pdata );
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
+++ /dev/null
-// File: OpenGl_textzoomable.cxx
-// Created: 08.10.09
-// Author: Paul Supryatkin
-// Copyright: Open CASCADE 2009
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-static TStatus TextFontAspectDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextFontAspectAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- TextFontAspectDisplay,
- TextFontAspectAdd,
- 0, /* Delete */
- 0,
- 0 /* Inquire */
-};
-
-MtblPtr
-TelTextFontAspectInitClass( TelType *el )
-{
- *el = TelTextFontAspect;
- return MtdTbl;
-}
-
-static TStatus
-TextFontAspectDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelTextFontAspect;
- key.data.ldata = data.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-static TStatus
-TextFontAspectAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
- return TSuccess;
-}
-
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_textheight :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-01-04-96 : CAL ; Integration MINSK portage WNT
-26-04-96 : FMN ; Correction warning de compilation.
-20-11-97 : CAL ; RererereMerge avec le source de portage.
-17-12-96 : FMN ; Warning de compilation.
-
-************************************************************************/
-
-#define BUC60821 //GG 12/02/01 allow tu use the nearest font size.
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_Memory.hxx>
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions statiques
-*/
-
-static TStatus TextHeightDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextHeightAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextHeightDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextHeightPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextHeightInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*----------------------------------------------------------------------*/
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- TextHeightDisplay, /* PickTraverse */
- TextHeightDisplay,
- TextHeightAdd,
- TextHeightDelete,
- TextHeightPrint,
- TextHeightInquire
-};
-
-
-/*----------------------------------------------------------------------*/
-MtblPtr
-TelTextHeightInitClass( TelType *el )
-{
- *el = TelTextHeight;
- return MtdTbl;
-}
-
-/*----------------------------------------------------------------------*/
-static TStatus
-TextHeightAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- Tfloat *data = new Tfloat();
- if( !data )
- return TFailure;
-
-#ifdef BUC60821
- *data = k[0]->data.fdata;
-#else /*BUC60821*/
-#ifndef WNT
- {
- Tint d_wdth, d_hght;
- call_tox_getscreen( &d_wdth, &d_hght );
- *data = k[0]->data.fdata * d_hght;
- }
-#else
- *data = k[0]->data.fdata;
-#endif /* WNT */
-#endif /* BUC60821 */
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-static TStatus
-TextHeightDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelTextHeight;
- key.data.fdata = *(Tfloat*)(data.pdata);
- TsmSetAttri( 1, &key );
-
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-static TStatus
-TextHeightDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-static TStatus
-TextHeightPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelTextHeight. Value = %g\n", *(Tfloat *)(data.pdata));
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-static TStatus
-TextHeightInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- Tfloat *f = (Tfloat*)data.pdata;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (TEL_INQ_CONTENT *)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->fdata = *f;
- break;
- }
- }
- }
-
- return TSuccess;
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_textstyle :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-30-11-98 : FMN ; Creation.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions statiques
-*/
-
-static TStatus TextStyleDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextStyleAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextStylePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-
-/*----------------------------------------------------------------------*/
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- TextStyleDisplay,
- TextStyleAdd,
- 0, /* Delete */
- TextStylePrint,
- 0 /* Inquire */
-};
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr
-TelTextStyleInitClass( TelType *el )
-{
- *el = TelTextStyle;
- return MtdTbl;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextStyleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextStyleDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelTextStyle;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TextStylePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_texture.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-05-08-97 : PCT ; Support texture mapping
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-static TStatus TextureIdMethodAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextureIdMethodDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextureIdMethodPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextureIdMethodInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- TextureIdMethodDisplay,
- TextureIdMethodAdd,
- 0, /* Delete */
- TextureIdMethodPrint,
- TextureIdMethodInquire
-};
-
-
-MtblPtr
-TelTextureIdInitClass( TelType *el )
-{
- *el = TelTextureId;
- return MtdTbl;
-}
-
-static TStatus
-TextureIdMethodAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-
-static TStatus
-TextureIdMethodDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelTextureId;
- key.data.ldata = d.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-
-static TStatus
-TextureIdMethodPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
-
- return TSuccess;
-}
-
-
-static TStatus
-TextureIdMethodInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (TEL_INQ_CONTENT*)k[i]->data.pdata;
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
+++ /dev/null
-// File: OpenGl_textzoomable.cxx
-// Created: 09.09.09
-// Author: Paul Supryatkin
-// Copyright: Open CASCADE 2009
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_Memory.hxx>
-
-static TStatus TextZoomableDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TextZoomableAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* PickTraverse */
- TextZoomableDisplay,
- TextZoomableAdd,
- 0, /* Delete */
- 0,
- 0 /* Inquire */
-};
-
-MtblPtr
-TelTextZoomableInitClass( TelType *el )
-{
- *el = TelTextZoomable;
- return MtdTbl;
-}
-
-static TStatus
-TextZoomableDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelTextZoomable;
- key.data.ldata = data.ldata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-static TStatus
-TextZoomableAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
- return TSuccess;
-}
-
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-Include OpenGl_tgl :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Reference a InterfaceGraphic_Cextern.hxx
-03-03-97 : FMN ; Ajout displaylist pour le mode transient
-15-03-98 : FMN ; Ajout mode animation
-08-07-98 : FMN ; On utilise OpenGl_animation.h pour le mode animation.
-
-************************************************************************/
-
-#ifndef OPENGL_TGL_H
-#define OPENGL_TGL_H
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#ifndef EXPORT
-# if defined(WNT) && !defined(HAVE_NO_DLL)
-# ifdef __OpenGl_DLL
-# define EXPORT __declspec( dllexport )
-# else
-# define EXPORT
-# endif /* __OpenGl_DLL */
-# else
-# define EXPORT
-# endif /* WNT */
-#endif /* EXPORT */
-
-
-//#include <InterfaceGraphic_Cextern.hxx>
-#include <InterfaceGraphic.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_inquire.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes fonctions externes
-*/
-
-extern CALL_DEF_INQUIRE call_facilities_list;
-
-extern EXPORT void call_togl_set_environment(char*); /* adisplay */
-extern EXPORT void call_togl_inquirefacilities(void);
-extern EXPORT void call_togl_polygon_set(CALL_DEF_GROUP *, CALL_DEF_LISTFACETS *);
-extern EXPORT void call_togl_curve(CALL_DEF_GROUP *, CALL_DEF_LISTPOINTS *);
-extern EXPORT void call_togl_redraw_immediat_mode(CALL_DEF_VIEW *);
-extern EXPORT void call_togl_redraw_layer2d(CALL_DEF_VIEW * aview,
- CALL_DEF_LAYER * alayer);
-
-/*----------------------------------------------------------------------*/
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_tgl_elems :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-17-07-96 : FMN ; Suppression de TelHLHSRMode
-23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
-et TelBackInteriorShadingMethod
-
-************************************************************************/
-
-#ifndef OPENGL_TGL_ELEMS_H
-#define OPENGL_TGL_ELEMS_H
-
-#include <OpenGl_tsm.hxx>
-
-/* Element types */
-#define CALL_PHIGS_ELEM_NIL TelNil
-#define CALL_PHIGS_ELEM_POLYMARKER3 TelMarkerSet
-#define CALL_PHIGS_ELEM_ANNO_TEXT_REL3 TelText
-#define CALL_PHIGS_ELEM_LINETYPE TelPolylineType
-#define CALL_PHIGS_ELEM_LINEWIDTH TelPolylineWidth
-#define CALL_PHIGS_ELEM_MARKER_TYPE TelPolymarkerType
-#define CALL_PHIGS_ELEM_MARKER_SIZE TelPolymarkerSize
-#define CALL_PHIGS_ELEM_TEXT_FONT TelTextFont
-#define CALL_PHIGS_ELEM_CHAR_EXPAN TelCharacterExpansionFactor
-#define CALL_PHIGS_ELEM_CHAR_SPACE TelCharacterSpacing
-#define CALL_PHIGS_ELEM_ANNO_CHAR_HT TelTextHeight
-#define CALL_PHIGS_ELEM_INT_STYLE TelInteriorStyle
-#define CALL_PHIGS_ELEM_INT_STYLE_IND TelInteriorStyleIndex
-#define CALL_PHIGS_ELEM_EDGE_FLAG TelEdgeFlag
-#define CALL_PHIGS_ELEM_EDGETYPE TelEdgeType
-#define CALL_PHIGS_ELEM_EDGEWIDTH TelEdgeWidth
-#define CALL_PHIGS_ELEM_ADD_NAMES_SET TelAddNameset
-#define CALL_PHIGS_ELEM_REMOVE_NAMES_SET TelRemoveNameset
-#define CALL_PHIGS_ELEM_LOCAL_MODEL_TRAN3 TelLocalTran3
-#define CALL_PHIGS_ELEM_VIEW_IND TelViewIndex
-#define CALL_PHIGS_ELEM_EXEC_STRUCT TelExecuteStructure
-#define CALL_PHIGS_ELEM_LABEL TelLabel
-#define CALL_PHIGS_ELEM_APPL_DATA TelApplicationData
-#define CALL_PHIGS_ELEM_PICK_ID TelPickId
-#define CALL_PHIGS_ELEM_POLYLINE_SET3_DATA TelPolyline
-#define CALL_PHIGS_ELEM_TRI_STRIP3_DATA TelTriangleMesh
-#define CALL_PHIGS_ELEM_QUAD_MESH3_DATA TelQuadrangle
-#define CALL_PHIGS_ELEM_TEXT_COLR TelTextColour
-#define CALL_PHIGS_ELEM_MARKER_COLR TelPolymarkerColour
-#define CALL_PHIGS_ELEM_EDGE_COLR TelEdgeColour
-#define CALL_PHIGS_ELEM_LINE_COLR TelPolylineColour
-#define CALL_PHIGS_ELEM_INT_COLR TelInteriorColour
-#define CALL_PHIGS_ELEM_BACK_INT_COLR TelBackInteriorColour
-#define CALL_PHIGS_ELEM_REFL_PROPS TelSurfaceAreaProperties
-#define CALL_PHIGS_ELEM_BACK_REFL_PROPS TelBackSurfaceAreaProperties
-#define CALL_PHIGS_ELEM_INT_SHAD_METH TelInteriorShadingMethod
-#define CALL_PHIGS_ELEM_INT_REFL_EQN TelInteriorReflectanceEquation
-#define CALL_PHIGS_ELEM_BACK_INT_REFL_EQN TelBackInteriorReflectanceEquation
-#define CALL_PHIGS_ELEM_FACE_DISTING_MODE TelFaceDistinguishingMode
-#define CALL_PHIGS_ELEM_FACE_CULL_MODE TelFaceCullingMode
-#define CALL_PHIGS_ELEM_LIGHT_SRC_STATE TelLightSrcState
-#define CALL_PHIGS_ELEM_DCUE_IND TelDepthCueIndex
-#define CALL_PHIGS_ELEM_HIGHLIGHT_INDEX TelHighlightIndex
-#define CALL_PHIGS_ELEM_FILL_AREA3 TelPolygon
-#define CALL_PHIGS_ELEM_NDXPOLYGONS3_DATA TelPolygonIndices
-#define CALL_PHIGS_ELEM_FILL_AREA_SET3 TelPolygonHoles
-#endif
* Includes
*/
#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_pick.hxx>
-#include <OpenGl_tsm.hxx>
-#include <InterfaceGraphic_Aspect.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
* Prototypes
*/
-extern void call_func_label(Tint); /* lid */
-extern void call_func_set_view_ind(Tint); /* vid */
-extern void call_func_appl_data(void*); /* data */
-extern void call_func_set_local_tran3(Tmatrix3, TComposeType); /* mat, mode */
-extern void call_func_set_linewidth(Tfloat); /* lw */
-extern void call_func_set_linetype(Tint); /* lt */
-extern void call_func_set_int_style(Tint); /* is */
-extern void call_func_set_edge_flag(Tint); /* state */
-extern void call_func_set_edge_type(Tint); /* type */
-extern void call_func_set_edgewidth(Tfloat); /* width */
-extern void call_func_set_int_style_ind(Tint); /* ind */
-extern void call_func_set_face_disting_mode(Tint); /* mode */
-extern void call_func_set_face_cull_mode(Tint); /* mode */
-extern void call_func_set_marker_type(Tint); /* type */
-extern void call_func_set_marker_size(Tfloat); /* size */
-extern void call_func_exec_struct(Tint); /* stid */
-extern void call_func_init_tgl(void);
-extern void call_func_post_struct(Tint, Tint, Tfloat); /* ws, stid, prio */
-extern void call_func_set_int_shad_meth(Tint); /* method */
-extern void call_func_set_refl_eqn(Tint); /* eqn */
-extern void call_func_set_back_refl_eqn(Tint); /* eqn */
-extern void call_func_set_text_font(Tchar*); /* font */
-extern void call_func_set_char_space(Tfloat); /* sp */
-extern void call_func_set_char_expan(Tfloat); /* exp */
-extern void call_func_set_pick_id(Tint); /* pickid */
-extern void call_func_redraw_all_structs (Tint, Tint); /* wsid, swap */
-extern void call_func_redraw_all_structs_begin (Tint); /* wsid */
-extern void call_func_redraw_all_structs_proc (Tint); /* wsid */
-extern void call_func_redraw_all_structs_end (Tint, Tint); /* wsid, swap */
-extern void call_func_set_anno_char_ht(Tfloat); /* height */
-extern void call_func_set_anno_char_up_vec(Tfloat[2]); /* up_vector */
-extern void call_func_set_anno_path(Tint); /* path */
-extern void call_func_set_anno_align(Tint, Tint); /* hor, ver */
-extern void call_func_anno_text_rel3( tel_point, Techar* );
-extern void call_func_dcue_ind(Tint); /* dcid */
-extern void call_func_set_do_texturemap(Tint); /* bool */
-extern void call_func_set_texture_id(Tint); /* TextureID */
-extern void call_func_set_text_style(int); /* style */
-extern void call_func_set_text_display_type(int); /* display_type */
-#ifdef G003
-extern void call_func_set_degenerate_model ( Tint, Tfloat ); /* degenerate model */
-#endif /* G003 */
+extern void call_func_eval_ori_matrix3 (const point3* vrp,
+ const vec3* vpn,
+ const vec3* vup,
+ int* err_ind,
+ float mout[4][4]);
-extern void call_func_set_text_zoomable(Tint); /*Text Zoomable usage*/
-extern void call_func_set_text_angle(Tfloat); /*Text Angle usage*/
-extern void call_func_set_text_fontaspect(OSD_FontAspect); /*Text Zoomable usage*/
+extern void call_func_eval_map_matrix3(view_map3 *Map, int *err_ind, matrix3 mat);
+
+int EXPORT call_togl_create_texture (int Type, unsigned int Width, unsigned int Height, unsigned char *Data, char *FileName);
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-extern void call_func_set_polygon_offset_params( Tint, /* mode */
- Tfloat, /* factor */
- Tfloat ); /* units */
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
+void EXPORT call_togl_destroy_texture (int TexId);
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-extern void call_func_set_transform_persistence( Tint, Tfloat, Tfloat, Tfloat );
-/* extern void call_func_set_transform_persistence( tel_transform_persistence tp );*/
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
+void EXPORT call_togl_modify_texture (int TexId, CALL_DEF_INIT_TEXTURE *init_tex);
+
+int EXPORT call_togl_inquiretexture ();
-
-/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */
-extern void call_func_eval_ori_matrix3( point3 *vrp, vec3 *vpn, vec3 *vup,
- int *err_ind, float mout[4][4] );
-/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */
-extern void call_func_eval_map_matrix3( view_map3 *Map, int *err_ind,
- matrix3 mat );
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-/* Edge types */
-#define CALL_PHIGS_EDGE_OFF TOff
-#define CALL_PHIGS_EDGE_ON TOn
-
-/* Edge data flags */
-#define CALL_PHIGS_EDGE_NONE TOff
-#define CALL_PHIGS_EDGE_VISIBILITY TOn
-
-/* Line Types */
-#define CALL_PHIGS_LINE_SOLID TEL_LS_SOLID
-#define CALL_PHIGS_LINE_DASH TEL_LS_DASH
-#define CALL_PHIGS_LINE_DOT TEL_LS_DOT
-#define CALL_PHIGS_LINE_DASH_DOT TEL_LS_DASH_DOT
-
-/* Marker types */
-#define CALL_PHIGS_MARKER_DOT TEL_PM_DOT
-#define CALL_PHIGS_MARKER_PLUS TEL_PM_PLUS
-#define CALL_PHIGS_MARKER_ASTERISK TEL_PM_STAR
-#define CALL_PHIGS_MARKER_CIRCLE TEL_PM_CIRC
-#define CALL_PHIGS_MARKER_CROSS TEL_PM_CROSS
-#define CALL_PHIGS_MARKER_USER_DEFINED TEL_PM_USERDEFINED
-
-/* Text : Path */
-#define CALL_PHIGS_PATH_RIGHT 0
-#define CALL_PHIGS_PATH_LEFT 0
-#define CALL_PHIGS_PATH_UP 0
-#define CALL_PHIGS_PATH_DOWN 0
-
-/* Text : Horizontal alignment */
-#define CALL_PHIGS_HOR_LEFT 0
-#define CALL_PHIGS_HOR_CENTER 1
-#define CALL_PHIGS_HOR_RIGHT 2
-
-/* Text : Vertical alignment */
-#define CALL_PHIGS_VERT_BOTTOM 0
-#define CALL_PHIGS_VERT_CENTER 1
-#define CALL_PHIGS_VERT_TOP 2
-
-/* Interior styles */
-#define CALL_PHIGS_STYLE_HOLLOW TSM_HOLLOW
-#define CALL_PHIGS_STYLE_SOLID TSM_SOLID
-#define CALL_PHIGS_STYLE_HATCH TSM_HATCH
-#define CALL_PHIGS_STYLE_EMPTY TSM_EMPTY
-#define CALL_PHIGS_STYLE_HIDDENLINE TSM_HIDDENLINE
-
-/* Light Source Types */
-#define CALL_PHIGS_LIGHT_AMBIENT TLightAmbient
-#define CALL_PHIGS_LIGHT_DIRECTIONAL TLightDirectional
-#define CALL_PHIGS_LIGHT_POSITIONAL TLightPositional
-#define CALL_PHIGS_LIGHT_SPOT TLightSpot
-
-/* Hatch styles */
-#define CALL_PHIGS_HATCH_HORIZ TEL_HS_HORIZONTAL
-#define CALL_PHIGS_HATCH_HORIZ_DBL TEL_HS_HORIZONTAL_SPARSE
-#define CALL_PHIGS_HATCH_VERT TEL_HS_VERTICAL
-#define CALL_PHIGS_HATCH_VERT_DBL TEL_HS_VERTICAL_SPARSE
-#define CALL_PHIGS_HATCH_DIAG_45 TEL_HS_DIAG_45
-#define CALL_PHIGS_HATCH_DIAG_45_DBL TEL_HS_DIAG_45_SPARSE
-#define CALL_PHIGS_HATCH_DIAG_135 TEL_HS_DIAG_135
-#define CALL_PHIGS_HATCH_DIAG_135_DBL TEL_HS_DIAG_135_SPARSE
-#define CALL_PHIGS_HATCH_GRID_R TEL_HS_GRID
-#define CALL_PHIGS_HATCH_GRID_R_DBL TEL_HS_GRID_SPARSE
-#define CALL_PHIGS_HATCH_GRID_D TEL_HS_CROSS
-#define CALL_PHIGS_HATCH_GRID_D_DBL TEL_HS_CROSS_SPARSE
-
-/* Edit modes */
-#define CALL_PHIGS_EDIT_INSERT TEditInsert
-#define CALL_PHIGS_EDIT_REPLACE TEditReplace
-
-/* Transformation */
-#define CALL_PHIGS_TYPE_PRECONCAT TPreConcatenate
-#define CALL_PHIGS_TYPE_POSTCONCAT TPostConcatenate
-#define CALL_PHIGS_TYPE_REPLACE TReplace
-
-/* Clipping indicators */
-#define CALL_PHIGS_IND_NO_CLIP TOff
-#define CALL_PHIGS_IND_CLIP TOn
-
-/* Projection types */
-#define CALL_PHIGS_TYPE_PARAL TelParallel
-#define CALL_PHIGS_TYPE_PERSPECT TelPerspective
-
-/* shading methods */
-#define CALL_PHIGS_SD_NONE TEL_SM_FLAT
-#define CALL_PHIGS_SD_COLOUR TEL_SM_GOURAUD
-#define CALL_PHIGS_SD_DOT_PRODUCT TEL_SM_GOURAUD
-#ifndef BUC60570
-#define CALL_PHIGS_SD_NORMAL TEL_SM_GOURAUD
-#else
-#define CALL_PHIGS_SD_NORMAL TEL_SM_FLAT
-#endif
-
-/* lighting methods */
-#define CALL_PHIGS_REFL_NONE 0x0000
-#define AMBIENT_MASK 0x0001
-#define DIFFUSE_MASK 0x0002
-#define SPECULAR_MASK 0x0004
-#define EMISSIVE_MASK 0x0008
-
-/* cull mode */
-#define CALL_PHIGS_CULL_NONE TelCullNone
-#define CALL_PHIGS_CULL_BACKFACE TelCullBack
-#define CALL_PHIGS_CULL_FRONTFACE TelCullFront
-
-/* depth cue mode */
-#define CALL_PHIGS_SUPPRESSED TelDCSuppressed
-#define CALL_PHIGS_ALLOWED TelDCAllowed
-
-/* distinguish mode */
-#define CALL_PHIGS_DISTING_NO TOff
-#define CALL_PHIGS_DISTING_YES TOn
-
-#define CALL_DEF_ENABLE_ZBUFFER TOn
-#define CALL_DEF_DISABLE_ZBUFFER TOff
-
-/* style of text */
-#define ASPECT_TOST_NORMAL 0
-#define ASPECT_TOST_ANNOTATION 1
-
-/* display type of the text */
-#define ASPECT_TODT_NORMAL 0
-#define ASPECT_TODT_SUBTITLE 1
-#define ASPECT_TODT_DEKALE 2
-#define ASPECT_TODT_BLEND 3
-
-/* Pick Order */
-#define PTOP_FIRST TTopFirst
-#define PBOTTOM_FIRST TBottomFirst
-
-/* Facet types */
-#define CALL_PHIGS_SHAPE_COMPLEX TEL_SHAPE_COMPLEX
-#define CALL_PHIGS_SHAPE_NONCONVEX TEL_SHAPE_CONCAVE
-#define CALL_PHIGS_SHAPE_CONVEX TEL_SHAPE_CONVEX
-#define CALL_PHIGS_SHAPE_UNKNOWN TEL_SHAPE_UNKNOWN
-
-/* Vertex flags */
-#define CALL_PHIGS_VERT_COORD TEL_VTFLAG_NONE
-#define CALL_PHIGS_VERT_COORD_COLOUR TEL_VTFLAG_COLOUR
-#define CALL_PHIGS_VERT_COORD_NORMAL TEL_VTFLAG_NORMAL
-#define CALL_PHIGS_VERT_COORD_COLOUR_NORMAL TEL_VTFLAG_COLOURNORMAL
-
-/* Facet data flags */
-#define CALL_PHIGS_FACET_NONE TEL_FAFLAG_NONE
-#define CALL_PHIGS_FACET_COLOUR TEL_FAFLAG_COLOUR
-#define CALL_PHIGS_FACET_NORMAL TEL_FAFLAG_NORMAL
-#define CALL_PHIGS_FACET_COLOUR_NORMAL TEL_FAFLAG_COLOURNORMAL
-
-/* functions */
-#define call_func_open_struct TsmOpenStructure
-#define call_func_close_struct TsmCloseStructure
-#define call_func_set_edit_mode TsmSetEditMode
-#define call_func_set_elem_ptr TsmSetElementPointer
-#define call_func_offset_elem_ptr TsmOffsetElementPointer
-#define call_func_set_elem_ptr_label TsmSetElementPointerAtLabel
-#define call_func_del_elem TsmDeleteElement
-#define call_func_del_elem_range TsmDeleteElementRange
-#define call_func_del_elems_labels TsmDeleteElementsBetweenLabels
-#define call_func_del_struct TsmDeleteStructure
-
-#define call_func_inq_elem_ptr TsmGetCurElemPtr
-#define call_func_inq_elem TsmGetCurElem
-
-/* Declarations des subroutines triedron */
-
-void EXPORT call_togl_ztriedron_setup (
- float* xcolor,
- float* ycolor,
- float* zcolor,
- float sizeratio,
- float axisdiameter,
- int nbfacettes
- );
-
-void EXPORT call_togl_triedron_display (
- CALL_DEF_VIEW * aview,
- int APosition,
- float r,
- float g,
- float b,
- float AScale,
- int asWireframe
- );
-
-void EXPORT call_togl_triedron_erase (
- CALL_DEF_VIEW *aview
- );
-
-void EXPORT call_togl_triedron_echo (
- CALL_DEF_VIEW *aview,
- int AType
- );
-
-/* Graduated trihedron */
-
-void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view,
- const Graphic3d_CGraduatedTrihedron &cubic);
-
-void EXPORT call_togl_graduatedtrihedron_erase(CALL_DEF_VIEW* view);
-
-void EXPORT call_togl_graduatedtrihedron_minmaxvalues(float xmin, float ymin, float zmin,
- float xmax, float ymax, float zmax);
-
-/* Declarations des subroutines mode immediat */
-
-int EXPORT call_togl_begin_ajout_mode (
- CALL_DEF_VIEW *aview
- );
-
-void EXPORT call_togl_end_ajout_mode (
- );
-
-int EXPORT call_togl_begin_immediat_mode (
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer,
- int doublebuffer,
- int retainmode
- );
-
-void EXPORT call_togl_end_immediat_mode (
- int synchronize
- );
-
-void EXPORT call_togl_clear_immediat_mode (
- CALL_DEF_VIEW *aview,
- int aFlush
- );
-
-void EXPORT call_togl_transform (
- CALL_DEF_MATRIX4X4 amatrix,
- int mode
- );
-
-void EXPORT call_togl_begin_polyline (
- );
-
-void EXPORT call_togl_end_polyline (
- );
-
-void EXPORT call_togl_begin_polygon (
- );
-
-void EXPORT call_togl_end_polygon (
- );
-
-void EXPORT call_togl_begin_trianglemesh (
- );
-
-void EXPORT call_togl_end_trianglemesh (
- );
-
-void EXPORT call_togl_begin_marker (
- );
-
-void EXPORT call_togl_end_marker (
- );
-
-void EXPORT call_togl_begin_bezier (
- );
-
-void EXPORT call_togl_end_bezier (
- );
-
-void EXPORT call_togl_move (
- float x,
- float y,
- float z
- );
-
-void EXPORT call_togl_movenormal (
- float x,
- float y,
- float z,
- float nx,
- float ny,
- float nz
- );
-
-void EXPORT call_togl_moveweight (
- float x,
- float y,
- float z,
- float w
- );
-
-void EXPORT call_togl_draw (
- float x,
- float y,
- float z
- );
-
-void EXPORT call_togl_drawnormal (
- float x,
- float y,
- float z,
- float nx,
- float ny,
- float nz
- );
-
-void EXPORT call_togl_drawweight (
- float x,
- float y,
- float z,
- float w
- );
-
-void EXPORT call_togl_draw_text (
- CALL_DEF_TEXT *atext
- );
-
-void EXPORT call_togl_draw_structure (
- int StructId
- );
-
-void EXPORT call_togl_set_linecolor (
- float r,
- float g,
- float b
- );
-
-void EXPORT call_togl_set_interiorcolor (
- float r,
- float g,
- float b
- );
-
-void EXPORT call_togl_set_linetype (
-
- long type
-
- );
-
-void EXPORT call_togl_set_interiortype (
-
- long type
-
- );
-
-void EXPORT call_togl_set_linewidth (
-
- float width
-
- );
-
-void EXPORT call_togl_set_textcolor (
-
- float r,
- float g,
- float b
-
- );
-
-void EXPORT call_togl_set_textfont (
-
- char *police,
- float factor,
- float space
-
- );
-
-void EXPORT call_togl_set_markercolor (
-
- float r,
- float g,
- float b
-
- );
-
-void EXPORT call_togl_set_markertype (
-
- long type,
- float scale
-
- );
-
-void EXPORT call_togl_set_minmax (
-
- float x1,
- float y1,
- float z1,
- float x2,
- float y2,
- float z2
-
- );
-
-void EXPORT call_togl_set_rgb (
-
- float r,
- float g,
- float b
-
- );
-
-/* Declarations des subroutines appelees du C++ */
-/* dans les packages Graphic3d et Visual3d */
-
-void EXPORT call_togl_opengroup (
-
- CALL_DEF_GROUP *agroup
-
- );
-
-void EXPORT call_togl_closegroup (
-
- CALL_DEF_GROUP *agroup
-
- );
-
-void EXPORT call_togl_cleargroup (
-
- CALL_DEF_GROUP *agroup
-
- );
-
-void EXPORT call_togl_linecontextgroup (
-
- CALL_DEF_GROUP *agroup,
- int noinsert
-
- );
-
-void EXPORT call_togl_facecontextgroup (
-
- CALL_DEF_GROUP *agroup,
- int noinsert
-
- );
-
-void EXPORT call_togl_markercontextgroup (
-
- CALL_DEF_GROUP *agroup,
- int noinsert
-
- );
-
-void EXPORT call_togl_textcontextgroup (
-
- CALL_DEF_GROUP *agroup,
- int noinsert
-
- );
-
-void EXPORT call_togl_group (
-
- CALL_DEF_GROUP *agroup
-
- );
-
-void EXPORT call_togl_marker (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_MARKER *amarker
-
- );
-
-void EXPORT call_togl_marker_set (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTMARKERS *almarkers
-
- );
-
-void EXPORT call_togl_polyline (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTPOINTS *alpoints
-
- );
-
-void EXPORT call_togl_polygon (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_FACET *afacet
-
- );
-
-void EXPORT call_togl_polygon_holes (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTFACETS *alfacets
-
- );
-
-void EXPORT call_togl_polygon_indices (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTPOINTS *alpoints,
- CALL_DEF_LISTEDGES *aledges,
- CALL_DEF_LISTINTEGERS *albounds
-
- );
-
-void EXPORT call_togl_pickid (
-
- CALL_DEF_GROUP *agroup
-
- );
-
-void EXPORT call_togl_quadrangle (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_QUAD *aquad
-
- );
-
-void EXPORT call_togl_removegroup (
-
- CALL_DEF_GROUP *agroup
-
- );
-
-void EXPORT call_togl_text (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_TEXT *atext
-
- );
-
-void EXPORT call_togl_triangle (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_TRIKE *atrike
-
- );
-
-void EXPORT call_togl_bezier (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTPOINTS *alpoints
-
- );
-
-void EXPORT call_togl_bezier_weight (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTPOINTS *alpoints,
- CALL_DEF_LISTREALS *alweights
-
- );
-
-void EXPORT call_togl_blink (
-
- CALL_DEF_STRUCTURE *astructure,
- int create
-
- );
-
-void EXPORT call_togl_boundarybox (
-
- CALL_DEF_STRUCTURE *astructure,
- int create
-
- );
-
-void EXPORT call_togl_clearstructure (
-
- CALL_DEF_STRUCTURE *astructure
-
- );
-
-void EXPORT call_togl_contextstructure (
-
- CALL_DEF_STRUCTURE *astructure
-
- );
-
-void EXPORT call_togl_highlightcolor (
-
- CALL_DEF_STRUCTURE *astructure,
- CALL_DEF_COLOR *acolor,
- int create
-
- );
-
-void EXPORT call_togl_namesetstructure (
-
- CALL_DEF_STRUCTURE *astructure
-
- );
-
-void EXPORT call_togl_removestructure (
-
- CALL_DEF_STRUCTURE *astructure
-
- );
-
-void EXPORT call_togl_structure (
-
- CALL_DEF_STRUCTURE *astructure
-
- );
-
-void EXPORT call_togl_transformstructure (
-
- CALL_DEF_STRUCTURE *astructure
-
- );
-
-void EXPORT call_togl_degeneratestructure (
-
- CALL_DEF_STRUCTURE *astructure
-
- );
-
-void EXPORT call_togl_connect (
-
- CALL_DEF_STRUCTURE *afather,
- CALL_DEF_STRUCTURE *ason
-
- );
-
-void EXPORT call_togl_disconnect (
-
- CALL_DEF_STRUCTURE *afather,
- CALL_DEF_STRUCTURE *ason
-
- );
-
-int EXPORT call_togl_begin_animation (
-
- CALL_DEF_VIEW *aview
-
- );
-
-void EXPORT call_togl_end_animation (
-
- CALL_DEF_VIEW *aview
-
- );
-
-int EXPORT call_togl_begin (
-
- char *adisplay
-
- );
-
-/*RIC120302*/
-int EXPORT call_togl_begin_display (
-
- void *pdisplay
-
- );
-/*RIC120302*/
-
-void EXPORT call_togl_end (
-
-
- );
-
-void EXPORT call_togl_structure_exploration (
-
- long Id,
- long LabelBegin,
- long LabelEnd
-
- );
-
-void EXPORT call_togl_element_exploration (
-
- long Id,
- long elem_num,
- long *type,
- CALL_DEF_POINT *pt,
- CALL_DEF_NORMAL *npt,
- CALL_DEF_COLOR *cpt,
- CALL_DEF_NORMAL *nfa
-
- );
-
-void EXPORT call_togl_element_type (
-
- long Id,
- long elem_num,
- long *type
-
- );
-
-void EXPORT call_togl_activateview (
-
- CALL_DEF_VIEW *aview
-
- );
-
-void EXPORT call_togl_antialiasing (
-
- CALL_DEF_VIEW *aview,
- int tag
-
- );
-
-void EXPORT call_togl_background (
-
- CALL_DEF_VIEW *aview
-
- );
-
-void EXPORT call_togl_gradient_background (
-
- int ws, int type,
- tel_colour tcolor1, tel_colour tcolor2
-
- );
-
-void EXPORT call_togl_set_gradient_type (
-
- int ws, int type
-
- );
-
-int EXPORT call_togl_project_raster (
-
- int wsid,
- float x,
- float y,
- float z,
- int *ixr,
- int *iyr
-
- );
-
-int EXPORT call_togl_adopt_to_rect(
- int,
- int,
- int
- );
-
-int EXPORT call_togl_unproject_raster (
-
- int wsid,
- int xm,
- int ym,
- int xM,
- int yM,
- int ixr,
- int iyr,
- float *x,
- float *y,
- float *z
-
- );
-
-int EXPORT call_togl_unproject_raster_with_ray (
-
- int wsid,
- int xm,
- int ym,
- int xM,
- int yM,
- int ixr,
- int iyr,
- float *x,
- float *y,
- float *z,
- float *dx,
- float *dy,
- float *dz
-
- );
-
-void EXPORT call_togl_cliplimit (
-
- CALL_DEF_VIEW *aview,
- int wait
-
- );
-
-void EXPORT call_togl_deactivateview (
-
- CALL_DEF_VIEW *aview
-
- );
-
-void EXPORT call_togl_depthcueing (
-
- CALL_DEF_VIEW *aview,
- int tag
-
- );
-
-void EXPORT call_togl_displaystructure (
-
- CALL_DEF_VIEW *aview,
- int StructId,
- int Priority
-
- );
-
-void EXPORT call_togl_erasestructure (
-
- int ViewId,
- int StructId
-
- );
-
-void EXPORT call_togl_init_pick (
-
-
- );
-
-void EXPORT call_togl_pick (
-
- CALL_DEF_PICK *apick
-
- );
-
-void EXPORT call_togl_ratio_window (
-
- CALL_DEF_VIEW *aview
-
- );
-
-void EXPORT call_togl_redraw (
-
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer
-
- );
-
-void EXPORT call_togl_redraw_area (
-
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer,
- int x, int y, int width, int height
-
- );
-
-void EXPORT call_togl_removeview (
-
- CALL_DEF_VIEW *aview
-
- );
-
-void EXPORT call_togl_setlight (
-
- CALL_DEF_VIEW *aview
-
- );
-
-void EXPORT call_togl_setplane (
-
- CALL_DEF_VIEW *aview
-
- );
-
-void EXPORT call_togl_setvisualisation (
-
- CALL_DEF_VIEW *aview
-
- );
-
-void EXPORT call_togl_transparency (
-
- int WsId,
- int ViewId,
- int Activity
-
- );
-
-void EXPORT call_togl_update (
-
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer
-
- );
-
-int EXPORT call_togl_view (
-
- CALL_DEF_VIEW *aview
-
- );
-
-int EXPORT call_togl_viewmapping (
-
- CALL_DEF_VIEW *aview,
- int wait
-
- );
-
-int EXPORT call_togl_vieworientation (
-
- CALL_DEF_VIEW *aview,
- int wait
-
- );
-
-int EXPORT call_togl_inquiretexture (
-
-
- );
-
-int EXPORT call_togl_inquirelight (
-
-
- );
-
-int EXPORT call_togl_inquireplane (
-
-
- );
-
-int EXPORT call_togl_inquireview (
-
-
- );
-
-int EXPORT call_togl_inquiremat (
-
- CALL_DEF_VIEW *aview,
- CALL_DEF_MATRIX4X4 ori_matrix,
- CALL_DEF_MATRIX4X4 map_matrix
-
- );
-
-void EXPORT call_togl_view_exploration (
-
- long Id
-
- );
-
-#ifdef OCC1188
-int EXPORT call_togl_create_texture (
-
- int Type,
- unsigned int Width,
- unsigned int Height,
- unsigned char *Data,
- char *FileName
-
- );
-
-void EXPORT call_togl_create_bg_texture (
-
- CALL_DEF_VIEW *aview,
- int width,
- int height,
- unsigned char *data,
- int style
-
- );
-#endif /* OCC1188 */
-
-void EXPORT call_togl_set_bg_texture_style(
-
- CALL_DEF_VIEW* aview,
- int style
-
- );
-
-void EXPORT call_togl_destroy_texture (
-
- int TexId
-
- );
-
-void EXPORT call_togl_modify_texture (
-
- int TexId,
- CALL_DEF_INIT_TEXTURE *init_tex
-
- );
-
-void EXPORT call_togl_environment (
-
- CALL_DEF_VIEW *aview
-
- );
-
-/* Declarations des subroutines layer mode */
-
-void EXPORT call_togl_layer2d (
-
- CALL_DEF_LAYER *alayer
-
- );
-
-void EXPORT call_togl_removelayer2d (
-
- CALL_DEF_LAYER *alayer
-
- );
-
-void EXPORT call_togl_begin_layer2d (
-
- CALL_DEF_LAYER *alayer
-
- );
-
-void EXPORT call_togl_end_layer2d (
- );
-
-void EXPORT call_togl_clear_layer2d (
-
- CALL_DEF_LAYER *alayer
-
- );
-
-void EXPORT call_togl_begin_polyline2d (
- );
-
-void EXPORT call_togl_end_polyline2d (
- );
-
-void EXPORT call_togl_begin_polygon2d (
- );
-
-void EXPORT call_togl_end_polygon2d (
- );
-
-void EXPORT call_togl_move2d (
-
- float x,
- float y
-
- );
-
-void EXPORT call_togl_draw2d (
-
- float x,
- float y
-
- );
-
-void EXPORT call_togl_edge2d (
-
- float x,
- float y
-
- );
-
-void EXPORT call_togl_rectangle2d (
-
- float x,
- float y,
- float w,
- float h
-
- );
-
-void EXPORT call_togl_set_color (
-
- float r,
- float g,
- float b
-
- );
-
-void EXPORT call_togl_set_transparency (
-
- float a
-
- );
-
-void EXPORT call_togl_unset_transparency ( );
-
-void EXPORT call_togl_set_line_attributes (
-
- long type,
- float width
-
- );
-
-void EXPORT call_togl_set_text_attributes (
-
- Tchar* font,
- long type,
- float r,
- float g,
- float b
-
- );
-
-void EXPORT call_togl_set_text_attributes (
-
- Tchar* font,
- Tint height,
- OSD_FontAspect type,
- float r,
- float g,
- float b
-
- );
-
-void EXPORT call_togl_set_text_scale_factors (
-
- Tfloat x,
- Tfloat y
-
- );
-
-void EXPORT call_togl_text2d (
-
- Techar *s,
- float x,
- float y,
- float height
-
- );
-
-void EXPORT call_togl_textsize2d (
-
- Techar *s,
- float height,
- float *width,
- float *ascent,
- float *descent
-
- );
-
-void EXPORT call_togl_backfacing (
-
- CALL_DEF_VIEW*
-
- );
-
-/* *** group of parray functions *** */
-
-void EXPORT call_togl_parray (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_PARRAY* parray
-
- );
-
-void EXPORT call_togl_parray_remove (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_PARRAY* parray
-
- );
-
-void EXPORT call_togl_userdraw (
-
- CALL_DEF_GROUP *agroup,
- CALL_DEF_USERDRAW *anobject
-
- );
-
-/* ------------------------- */
-Standard_Boolean EXPORT call_togl_print (
-
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer,
- const Aspect_Drawable hPrintDC,
- const int background,
- const char* filename,
- const int printalgo = 0,
- const float theScaleFactor = 1.0
-
- );
-
-
-#ifdef BUC61044
-void EXPORT call_togl_depthtest (
-
- CALL_DEF_VIEW *aview,
- int dFlag
-
- );
-
-int EXPORT call_togl_isdepthtest (
-
- CALL_DEF_VIEW *aview
-
- );
-#endif
-
-#ifdef BUC61045
-void EXPORT call_togl_gllight (
-
- CALL_DEF_VIEW *aview,
- int dFlag
-
- );
-
-int EXPORT call_togl_isgllight (
-
- CALL_DEF_VIEW *aview
-
- );
-#endif
-
-/*----------------------------------------------------------------------*/
+int EXPORT call_togl_inquireplane ();
#endif
+++ /dev/null
-#ifndef OPENGL_TGL_PICK_H
-#define OPENGL_TGL_PICK_H
-
-typedef struct
-{
- Tint number;
- Tint *integers;
-} Tintlst;
-
-/* Primitive pick and name set ids. */ /* defined in tgl/util */
-extern Tintlst inc_pick_filter;
-extern Tintlst exc_pick_filter;
-
-/* Primitive highlight and name set ids. */ /* defined in tgl/util */
-extern Tintlst inc_highl_filter;
-extern Tintlst exc_highl_filter;
-
-#define CALL_MAX_DEPTH_LENGTH 128
-
-#endif
+++ /dev/null
-/*
-File OpenGl_tgl_subrs.h
-
-Modified 16/06/2000 : ATS,SPK : G005 : Group of functions
-call_subr_parray_xxx
-call_subr_darray_xxx
-*/
-
-#ifndef OPENGL_TGL_SUBRS_H
-#define OPENGL_TGL_SUBRS_H
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_telem.hxx>
-
-extern void call_subr_set_line_colr(Tfloat, Tfloat, Tfloat); /* r, g, b */
-extern void call_subr_polyline(CALL_DEF_LISTPOINTS *); /* alpoints */
-extern void call_subr_polyline_data(CALL_DEF_LISTPOINTS *); /* alpoints */
-extern void call_subr_addnameset(Tint, Tint *); /* num, names */
-extern void call_subr_remnameset(Tint, Tint *); /* num, names */
-
-extern void call_subr_set_int_colr(Tfloat, Tfloat, Tfloat, Tfloat);/* r, g, b, a */
-extern void call_subr_set_back_int_colr(Tfloat, Tfloat, Tfloat, Tfloat);
-extern void call_subr_set_text_colr(Tfloat, Tfloat, Tfloat); /* r, g, b */
-extern void call_subr_set_text_colr_subtitle(Tfloat, Tfloat, Tfloat); /* r, g, b */
-extern void call_subr_set_edge_colr(Tfloat, Tfloat, Tfloat); /* r, g, b */
-extern void call_subr_set_marker_colr(Tfloat, Tfloat, Tfloat); /* r, g, b */
-extern void call_subr_set_refl_props(CALL_DEF_MATERIAL *, Tint); /* mat, tag */
-extern void call_subr_marker(CALL_DEF_MARKER *); /* amarker */
-extern void call_subr_marker_set(CALL_DEF_LISTMARKERS *); /* almarkers */
-
-extern TStatus call_subr_get_exec_struct(Tint, Tint, Tint *); /* F, S, &ind */
-extern void call_subr_polygon_data(CALL_DEF_FACET *); /* afacet */
-extern void call_subr_polygon(CALL_DEF_FACET *); /* afacet */
-extern void call_subr_polygon_holes(CALL_DEF_LISTFACETS *); /* alfacets */
-extern void call_subr_polygon_holes_data(CALL_DEF_LISTFACETS *); /* alfacets */
-extern void call_subr_polygon_indices(CALL_DEF_LISTPOINTS *, /* alpoints */
- CALL_DEF_LISTEDGES *, /* aledges */
- CALL_DEF_LISTINTEGERS *); /* albounds */
-extern void call_subr_polygon_set(CALL_DEF_LISTFACETS *); /* alfacets */
-extern void call_subr_quadrangle(CALL_DEF_QUAD *); /* aquad */
-extern void call_subr_polygon_holes(CALL_DEF_LISTFACETS *); /* alfacets */
-
-extern void call_subr_polygon_holes_data(CALL_DEF_LISTFACETS *); /*alfacets*/
-
-extern void call_subr_triangle(CALL_DEF_TRIKE *); /* atrike */
-extern void call_subr_set_highl_rep(Tint); /* index */
-extern void call_subr_structure_exploration(Tint, /*Id*/
- Tint, /*LabelBegin*/
- Tint, /*LabelEnd*/
- Tint, /*elem_num*/
- Tint*, /*elem_type*/
- CALL_DEF_POINT *, /*pt*/
- CALL_DEF_NORMAL *, /*npt*/
- CALL_DEF_COLOR *, /*cpt*/
- CALL_DEF_NORMAL * /*nfa*/);
-/* struct_id, ws_ids */
-extern Tint call_subr_inquirews(Tint, Tint *);
-extern void call_subr_curve(CALL_DEF_LISTPOINTS *);
-
-/* PARRAY functions */
-
-extern void call_subr_parray( CALL_DEF_PARRAY *parray );
-extern void call_subr_userdraw( CALL_DEF_USERDRAW *anobject );
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_tgl_subrvis :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-17-07-96 : FMN ; Modification de call_subr_hlhsr et call_util_setvisualization
-29-01-97 : FMN ; Suppression de call_subr_doublebuffer().
-
-************************************************************************/
-
-#ifndef OPENGL_TGL_SUBRVIS_H
-#define OPENGL_TGL_SUBRVIS_H
-
-#ifndef RIC120302
-#define RIC120302 /* GG Add call_subr_displayCB function
-*/
-#endif
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_telem.hxx>
-
-#ifdef RIC120302
-extern int call_subr_displayCB(CALL_DEF_VIEW* /*aview*/, int /*reason*/ );
-#endif
-extern int call_subr_open_ws(CALL_DEF_VIEW *); /* aview */
-extern void call_subr_enable_polygon_offset();
-extern void call_subr_disable_polygon_offset();
-extern void call_subr_resize(CALL_DEF_VIEW *); /* aview */
-extern void call_subr_antialiasing(CALL_DEF_VIEW *, Tint); /* aview, tag */
-extern void call_subr_hlhsr(CALL_DEF_VIEW *, Tint); /* aview, flag */
-extern void call_subr_depthcueing(CALL_DEF_VIEW *, Tint); /* aview, tag */
-extern TStatus call_subr_get_view_index(Tint, Tint *); /* stid, &vid */
-extern void call_subr_pick(CALL_DEF_PICK *); /* apick */
-extern void call_subr_set_light_src_rep(CALL_DEF_LIGHT *); /* alight */
-extern void call_subr_set_background(Tint, tel_colour); /* ws, rgb */
-extern void call_subr_set_gradient_background(Tint, Tint, tel_colour, tel_colour); /* ws, type, rgb ,rgb */
-extern void call_subr_close_ws(CALL_DEF_VIEW *);
-extern void call_util_setvisualization(CALL_DEF_VIEW *, int, int);
-extern void call_subr_transparency (int , int , int );
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-Include OpenGl_tgl_tox :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-on ne garde que call_tox_open_display(). Les autres
-point d'entree sont inutiles [cf OpenGl_txgl.c]
-11-03-98 : CAL ; Suppression code inutile
-12-03-02 ; GG ; RIC120302 Add call_tox_set_display
-
-************************************************************************/
-
-#ifndef OPENGL_TGL_TOX_H
-#define OPENGL_TGL_TOX_H
-
-#include <InterfaceGraphic.hxx>
-
-extern DISPLAY *call_thedisplay; /* display pointer; defined in tgl/tox */
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes fonctions externes
-*/
-
-extern Tint call_tox_open_display(void);
-extern Tint call_tox_set_display(void*);
-extern void call_tox_getscreen(Tint *, Tint *); /* w, h */
-extern void call_tox_rect(int,WINDOW,int,int) ;
-extern Tfloat call_tox_getpitchsize();
-
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_tgl_util :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-06-03-96 : FMN ; Suppression code inutile:
-01-04-96 : CAL ; Integration MINSK portage WNT
-29-04-96 : FMN ; Correction Warning.
-30-01-97 : FMN ; Suppression call_util_init_indexes()
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tgl_util.hxx>
-#include <OpenGl_tgl_pick.hxx>
-#include <OpenGl_telem_filters.hxx>
-
-#include <OpenGl_context.hxx>
-
-#ifdef WNT
-#include <OpenGl_Extension.hxx>
-#include <InterfaceGraphic_wntio.hxx>
-#endif /* WNT */
-
-/*----------------------------------------------------------------------*/
-
-Tintlst inc_pick_filter;
-Tintlst exc_pick_filter;
-Tintlst inc_highl_filter;
-Tintlst exc_highl_filter;
-Tintlst inc_invis_filter;
-Tintlst exc_invis_filter;
-
-/*----------------------------------------------------------------------*/
-
-void
-call_util_init_filters( Tint wsid )
-{
- Tint pick_inc_names[1] = { CALL_DEF_STRUCTPICKABLE };
- Tint highl_inc_names[1] = { CALL_DEF_STRUCTHIGHLIGHTED };
- Tint invis_inc_names[1] = { CALL_DEF_STRUCTNOVISIBLE };
-
- Tint pick_excl_names[1] = { CALL_DEF_STRUCTNOPICKABLE };
-
- inc_highl_filter.number = 1;
- inc_highl_filter.integers = highl_inc_names;
- exc_highl_filter.number = 0;
- exc_highl_filter.integers = 0;
- TglSetHighlFilter( wsid, 1, highl_inc_names, 0, 0 );
-
- inc_pick_filter.number = 1;
- inc_pick_filter.integers = pick_inc_names;
- exc_pick_filter.number = 1;
- exc_pick_filter.integers = pick_excl_names;
- TglSetPickFilter( wsid, 1, pick_inc_names, 1, pick_excl_names );
-
- inc_invis_filter.number = 1;
- inc_invis_filter.integers = invis_inc_names;
- exc_invis_filter.number = 0;
- exc_invis_filter.integers = 0;
- TglSetInvisFilter( wsid, 1, invis_inc_names, 0, 0 );
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-Tint
-call_util_test_structure( Tint stid )
-{
- TStatus stat;
- Tint num;
- tsm_node ptr;
-
- stat = TsmGetStructure( stid, &num, &ptr );
- if( stat == TSuccess )
- {
- if( num )
- return 2;
- return 1;
- }
- return 0;
-}
-
-/*----------------------------------------------------------------------*/
-
-/*
-call_util_osd_getenv (symbol, value)
-char *symbol, *value
-
-Gets an environment variable.
-*/
-
-EXPORT extern int call_util_osd_getenv ( char *symbol,
- char *value,
- int lval )
-{
- char *s;
-
- if ((s = getenv (symbol)) == NULL) return (0);
- if ((int)strlen (s) > lval) return (0);
- strcpy (value, s);
- return (1);
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-#ifndef OPENGL_TGL_UTIL_H
-#define OPENGL_TGL_UTIL_H
-#include <OpenGl_Extension.hxx>
-
-
-extern void call_util_init_filters(Tint); /* ws */
-extern Tint call_util_test_structure(Tint); /* stid */
-EXPORT extern int call_util_osd_getenv (char *, char *, int);
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_tgl_utilgr :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-29-04-96 : FMN ; Correction Warning.
-30-01-97 : FMN ; Suppression call_util_init_indexes()
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_context.hxx>
-
-#include <OpenGl_tgl_utilgr.hxx>
-#include <OpenGl_Memory.hxx>
-
-Tint
-call_util_context_group_place( CALL_DEF_GROUP * agroup )
-{
- Tint n;
-
- n = 0;
- if( agroup->ContextLine.IsSet )
- n = n + CALL_DEF_CONTEXTLINE_SIZE;
- if( agroup->ContextFillArea.IsSet )
- n = n + CALL_DEF_CONTEXTFILLAREA_SIZE;
- if( agroup->ContextMarker.IsSet )
- n = n + CALL_DEF_CONTEXTMARKER_SIZE;
- if( agroup->ContextText.IsSet )
- n = n + CALL_DEF_CONTEXTTEXT_SIZE;
-
- return n;
-}
-
-
-Tint
-call_util_osd_putenv( Tchar *symbol, Tchar *value )
-{
-#ifndef WNT
- Tchar *s;
- Tint l;
-
- l = strlen((char*)symbol) + strlen((char*)value) + 2;
- s = new Tchar[l];;
- if( s )
- {
- sprintf( (char*)s,"%s=%s", symbol, value );
- if( !putenv((char*)s) )
- return 1;
- }
- return 0;
-#else
- return SetEnvironmentVariable ( (LPCSTR)symbol, (LPCSTR)value );
-#endif /* WNT */
-}
-
-Tint
-call_util_rgbindex( Tfloat r, Tfloat g, Tfloat b )
-{
- union
- {
- Tint colpack;
- unsigned char rgb[3];
- } rgb2ind;
-
- rgb2ind.colpack = 0;
- rgb2ind.rgb[0] = ( unsigned char )(r*100);
- rgb2ind.rgb[1] = ( unsigned char )(g*100);
- rgb2ind.rgb[2] = ( unsigned char )(b*100);
-
- return rgb2ind.colpack;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_tgl_utilgr.h :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-30-01-97 : FMN ; Suppression call_util_init_indexes()
-
-************************************************************************/
-
-#ifndef OPENGL_TGL_UTILGR_H
-#define OPENGL_TGL_UTILGR_H
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-extern Tint call_util_context_group_place(CALL_DEF_GROUP *); /* agroup */
-extern Tint call_util_osd_putenv(Tchar *, Tchar *); /* symbol, value */
-extern Tint call_util_rgbindex(Tfloat, Tfloat, Tfloat); /* r, g, b */
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-Include OpenGl_tgl_vis.h :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Reference a InterfaceGraphic_Cextern.hxx
-29-01-97 : FMN ; Suppression de call_togl_doublebuffer().
-05-02-97 : FMN ; Suppression de call_togl_minmaxvalues().
-et de call_togl_projection().
-
-************************************************************************/
-
-#ifndef OPENGL_TGL_VIS_H
-#define OPENGL_TGL_VIS_H
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_telem_view.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-extern TEL_VIEW_REP call_viewrep; /* defined in call_togl_cliplimit.c */
-
-/*----------------------------------------------------------------------*/
-
-#endif
+++ /dev/null
-#define G003
-#define G004
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_tmesh :
-
-
-REMARQUES:
-----------
-
-Le culling et le backfacing ne marchent pas.
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-22-04-96 : FMN ; Suppression prototype inutile.
-09-08-96 : FMN ; Suppression appel glMatrixMode() avant glGetFloatv()
-21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
-30-06-97 : FMN ; Suppression OpenGl_telem_light.h
-18-07-97 : FMN ; Ajout desactivation des lights suivant front_lighting_model
-21-07-97 : FMN ; Amelioration des performances OPTIMISATION_FMN
-- suppression calcul inutile sur les front faces
-- utilisation de GL_LINE_LOOP
-27-08-97 : FMN ; Correction affichage des edges
-On n'affiche que les edges dans le mode IS_EMPTY
-10-09-97 : FMN ; Amelioration des perfs liees aux lights.
-15-09-97 : PCT ; Ajout coordonnees textures
-24-09-97 : FMN ; Suppression OPTIMISATION_FMN.
-08-12-97 : FMN ; Suppression appel TsmGetAttri inutile.
-23-12-97 : FMN ; Suppression IsBackFace()
-31-12-97 : FMN ; Simplification pour le highlight
-15-01-98 : FMN ; Ajout Hidden line
-16-02-00 : EUG ; Degeneration support
-16-02-00 : EUG ; Bitmap drawing support
-08-03-01 : GG ; BUC60823 Avoid crash in the normal computation method
-on confuse point.
-
-************************************************************************/
-
-#define BUC60876 /* GG 5/4/2001 Disable local display list
-// when animation is not required
-*/
-
-/*----------------------------------------------------------------------*/
-
-#define OCC4298 // SAN : 12/11/2003 : Memory beyond array bound read in TriangleMeshAdd()
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_TextureBox.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */
-
-#ifdef G003
-# include <float.h>
-# define DEF_DS_INTERNAL
-# include <OpenGl_degeneration.hxx>
-
-# ifdef G004
-extern GLboolean g_fBitmap;
-# endif /* G004 */
-
-extern int g_nDegenerateModel;
-extern float g_fSkipRatio;
-extern GLboolean g_fAnimation;
-
-#endif /* G003 */
-
-/*----------------------------------------------------------------------*/
-
-typedef struct
-{
- Tint num_facets; /* Number of facets */
- Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */
- Tint vertex_flag;/* TEL_VT_NONE or TEL_VT_NORMAL */
- tel_point fnormals; /* length = num_facets */
- tel_colour fcolours; /* length = num_facets */
- tel_point vertices; /* length = num_facets + 2 */
- tel_colour vcolours; /* length = num_facets + 2 */
- tel_point vnormals; /* length = num_facets + 2 */
- tel_texture_coord vtexturecoord; /* Texture coordinates */
-#ifdef G003
- DS_INTERNAL d;
-#endif /* G003 */
-} TEL_TMESH_DATA, *tel_tmesh_data;
-
-static TStatus TriangleMeshDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TriangleMeshAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TriangleMeshDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TriangleMeshPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TriangleMeshInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static void draw_tmesh( tel_tmesh_data,
- Tint, /* highlight flag */
- Tint, /* front_lighting_model, */
- Tint, /* interior_style, */
- tel_colour /* edge_colour, */
- );
-#ifndef G003
-static void draw_edges( tel_tmesh_data, tel_colour, Tint);
-#else
-static void draw_edges ( tel_tmesh_data, tel_colour, Tint, Tint );
-void draw_degenerates_as_points ( PDS_INTERNAL, tel_point, Tint );
-void draw_degenerates_as_bboxs ( PDS_INTERNAL, tel_point, Tint );
-extern void set_drawable_items ( GLboolean*, int );
-#endif /* G003 */
-
-static void draw_line_loop ( tel_tmesh_data );
-
-static TStatus ( *MtdTbl[] )( TSM_ELEM_DATA, Tint, cmn_key* ) = {
-
- TriangleMeshDisplay, /* PickTraverse */
- TriangleMeshDisplay,
- TriangleMeshAdd,
- TriangleMeshDelete,
- TriangleMeshPrint,
- TriangleMeshInquire
-
-};
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr TelTriangleMeshInitClass ( TelType* el ) {
-
- *el = TelTriangleMesh;
-
- return MtdTbl;
-
-} /* end TelTriangleMeshInitClass */
-
-/*----------------------------------------------------------------------*/
-static TStatus
-TriangleMeshAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-/* expects keys
-NUM_FACETS_ID
-FNORMALS_ID
-FACET_COLOUR_VALS_ID
-VERTICES_ID
-VERTEX_COLOUR_VALS_ID
-VNORMALS_ID
-VTEXTURECOORD_ID */
-{
- Tint i, j;
- tel_tmesh_data data;
-
- for( i = 0; i < n; i++ )
- {
- if( k[i]->id == NUM_FACETS_ID )
- break;
- }
- if( i == n )
- return TFailure;
-
- if( !(k[i]->data.ldata) )
- return TFailure;
-
- data = new TEL_TMESH_DATA();
- if( !data )
- return TFailure;
-
- data->num_facets = k[i]->data.ldata;
- data->vtexturecoord = 0;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case FNORMALS_ID:
- {
- data->facet_flag = TEL_FA_NORMAL;
- data->fnormals = new TEL_POINT[data->num_facets];
- memcpy( data->fnormals, k[i]->data.pdata, data->num_facets*sizeof(TEL_POINT) );
- for( j = 0; j < data->num_facets; j++ )
- vecnrm( data->fnormals[j].xyz );
- break;
- }
- case FACET_COLOUR_VALS_ID:
- {
- data->fcolours = new TEL_COLOUR[data->num_facets];
- memcpy( data->fcolours,
- k[i]->data.pdata,
- data->num_facets*sizeof(TEL_COLOUR) );
- break;
- }
- case VERTICES_ID:
- {
- data->vertices = new TEL_POINT[data->num_facets + 2];
- memcpy( data->vertices, k[i]->data.pdata,
- (data->num_facets+2)*sizeof(TEL_POINT) );
- break;
- }
- case VERTEX_COLOUR_VALS_ID:
- {
- data->vcolours = new TEL_COLOUR[data->num_facets];
- memcpy( data->vcolours, k[i]->data.pdata,
- (data->num_facets+2)*sizeof(TEL_COLOUR) );
-
- break;
- }
- case VNORMALS_ID:
- {
- data->vertex_flag = TEL_VT_NORMAL;
- data->vnormals = new TEL_POINT[data->num_facets + 2];
- memcpy( data->vnormals, k[i]->data.pdata,
- (data->num_facets + 2)*sizeof(TEL_POINT) );
- for( j = 0; j < (data->num_facets+2); j++ )
- vecnrm( data->vnormals[j].xyz );
- break;
- }
- case VTEXTURECOORD_ID:
- {
- data->vtexturecoord = new TEL_TEXTURE_COORD[data->num_facets + 2];
- memcpy( data->vtexturecoord,
- k[i]->data.pdata,
- (data->num_facets + 2)*sizeof(TEL_TEXTURE_COORD) );
- break;
- }
-
- default:
- {
- break;
- }
- }
- }
-
- if( data->facet_flag != TEL_FA_NORMAL )
- {
- /* calculate the normals and store */
-
- data->fnormals = new TEL_POINT[data->num_facets];
- for( i = 0; i < data->num_facets; i++ ) {
- if( i & 1 ) {
- TelGetNormal( data->vertices[i].xyz, data->vertices[i+2].xyz,
- data->vertices[i+1].xyz, data->fnormals[i].xyz );
- } else {
- TelGetNormal( data->vertices[i].xyz, data->vertices[i+1].xyz,
- data->vertices[i+2].xyz, data->fnormals[i].xyz );
- }
- }
-#ifndef BUC60823
- for( j = 0; j < data->num_facets; j++ )
- vecnrm( data->fnormals[j].xyz );
-#endif
- }
- if( data->vertex_flag != TEL_VT_NORMAL )
- {
- /* calculate the vertex normals */
- data->vnormals = new TEL_POINT[data->num_facets + 2];
- for( i = 2; i < data->num_facets; i++ )
- {
- data->vnormals[i].xyz[0] = ( data->fnormals[i-2].xyz[0] +
- data->fnormals[i-1].xyz[0] +
- data->fnormals[ i ].xyz[0] ) / ( float )3.0;
- data->vnormals[i].xyz[1] = ( data->fnormals[i-2].xyz[1] +
- data->fnormals[i-1].xyz[1] +
- data->fnormals[ i ].xyz[1] ) / ( float )3.0;
- data->vnormals[i].xyz[2] = ( data->fnormals[i-2].xyz[2] +
- data->fnormals[i-1].xyz[2] +
- data->fnormals[ i ].xyz[2] ) / ( float )3.0;
- }
- data->vnormals[0] = data->fnormals[0];
-#ifdef OCC4298
- if( data->num_facets > 1 )
- {
-#endif
- data->vnormals[1].xyz[0] = ( data->fnormals[0].xyz[0] +
- data->fnormals[1].xyz[0] )/( float )2.0;
- data->vnormals[1].xyz[1] = ( data->fnormals[0].xyz[1] +
- data->fnormals[1].xyz[1] )/( float )2.0;
- data->vnormals[1].xyz[2] = ( data->fnormals[0].xyz[2] +
- data->fnormals[1].xyz[2] )/( float )2.0;
-#ifdef OCC4298
- }
- else
- data->vnormals[1] = data->fnormals[0];
-#endif
- /* last vertex */
- data->vnormals[data->num_facets+1] = data->fnormals[data->num_facets-1];
-
- /* second last vertex */
-#ifdef OCC4298
- if( data->num_facets > 1 )
- {
-#endif
- data->vnormals[data->num_facets].xyz[0] =
- ( data->fnormals[data->num_facets-1].xyz[0] +
- data->fnormals[data->num_facets-2].xyz[0] ) / ( float )2.0;
- data->vnormals[data->num_facets].xyz[1] =
- ( data->fnormals[data->num_facets-1].xyz[1] +
- data->fnormals[data->num_facets-2].xyz[1] ) / ( float )2.0;
- data->vnormals[data->num_facets].xyz[2] =
- ( data->fnormals[data->num_facets-1].xyz[2] +
- data->fnormals[data->num_facets-2].xyz[2] ) / ( float )2.0;
-#ifdef OCC4298
- }
-#endif
- }
-#ifdef G003
- data -> d.list = 0;
- data -> d.dlist = 0;
- data -> d.degMode = 0;
- data -> d.model = -1;
- data -> d.skipRatio = 0.0F;
- data->d.bDraw = new unsigned char[data->num_facets + 2];
-#endif /* G003 */
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-/*----------------------------------------------------------------------*/
-
-static TStatus
-TriangleMeshDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY k11, k12, k17, k111, k114;
-
- Tint front_lighting_model;
- Tint interior_style;
- TEL_COLOUR interior_colour;
- TEL_COLOUR edge_colour;
-
- tel_tmesh_data d;
-
- k12.id = TelInteriorReflectanceEquation;
- k17.id = TelInteriorStyle;
- k111.id = TelInteriorColour;
- k111.data.pdata = &interior_colour;
- k114.id = TelEdgeColour;
- k114.data.pdata = &edge_colour;
-
- TsmGetAttri( 4, &k12, &k17, &k111, &k114);
-
- front_lighting_model = k12.data.ldata;
- interior_style = k17.data.ldata;
-
-#ifdef PRINT
- printf("TriangleMeshDisplay \n");
-#endif
-
- /*
- * Use highlight colours
- */
- if( k[0]->id == TOn )
- {
- TEL_HIGHLIGHT hrep;
-
- k11.id = TelHighlightIndex;
- TsmGetAttri( 1, &k11 );
- if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep ) == TSuccess )
- {
- if( hrep.type == TelHLForcedColour )
- {
- edge_colour = interior_colour = hrep.col;
- front_lighting_model = CALL_PHIGS_REFL_NONE;
- }
- else if( hrep.type == TelHLColour )
- {
- edge_colour = hrep.col;
- k[0]->id = TOff;
- }
- }
- else
- {
- TelGetHighlightRep( TglActiveWs, 0, &hrep );
- if( hrep.type == TelHLForcedColour )
- {
- edge_colour = interior_colour = hrep.col;
- front_lighting_model = CALL_PHIGS_REFL_NONE;
- }
- else if( hrep.type == TelHLColour )
- {
- edge_colour = hrep.col;
- k[0]->id = TOff;
- }
- }
- }
-
- d = (tel_tmesh_data)data.pdata;
-
- glColor3fv( interior_colour.rgb );
-
- draw_tmesh( d, k[0]->id,
- front_lighting_model,
- interior_style,
- &edge_colour);
-
- return TSuccess;
-
-}
-
-/*----------------------------------------------------------------------*/
-
-static void draw_tmesh (
- tel_tmesh_data p,
- Tint hflag,
- Tint front_lighting_model,
- Tint interior_style,
- tel_colour edge_colour
- )
-{
-
- Tint i, newList = 0;
- tel_point pv, pfn, pvn;
- tel_colour pfc, pvc;
- tel_texture_coord pvt;
-
- pfn = p -> fnormals;
- pfc = p -> fcolours;
- pv = p -> vertices;
- pvc = p -> vcolours;
- pvn = p -> vnormals;
- pvt = p -> vtexturecoord;
-
- if ( hflag ) pvc = pfc = 0;
-#ifdef G003
- if ( g_nDegenerateModel < 2 && interior_style != TSM_EMPTY ) {
-#else
- if( interior_style != TSM_EMPTY ) {
-#endif /* G003 */
- if ( front_lighting_model == CALL_PHIGS_REFL_NONE )
-
- LightOff ();
-
- else LightOn ();
-#ifdef G003
-#ifdef BUC60876
- if ( !g_fAnimation )
- goto doDraw; /* Disable object display list out of animation */
-#endif
-# ifdef G004
- if ( g_fBitmap ) goto doDraw; /* display lists are NOT shared between */
- /* window's context and bitmap's one */
-# endif /* G004 */
- if ( p -> d.model != front_lighting_model || !p -> d.list ||
- p -> d.model == -1 ||
- ( g_nDegenerateModel && p -> d.skipRatio != g_fSkipRatio )
- ) {
-
- p -> d.skipRatio = g_fSkipRatio;
- p -> d.model = front_lighting_model;
- p -> d.degMode = g_nDegenerateModel;
-
- if ( g_fSkipRatio == 0.0 ) {
-
- if ( !p -> d.list ) p -> d.list = glGenLists ( 1 );
-
- glNewList ( p -> d.list, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-#endif /* G003 */
-#ifdef G004
-doDraw:
-#endif /* G004 */
- glBegin ( GL_TRIANGLE_STRIP );
-
- if ( front_lighting_model == CALL_PHIGS_REFL_NONE ) {
-
- if ( pvc )
-
- for ( i = 0; i < p -> num_facets + 2; ++i ) {
-
- glColor3fv ( pvc[ i ].rgb );
- glVertex3fv ( pv [ i ].xyz );
-
- } /* end for */
-
- else if ( pfc ) {
-
- glColor3fv ( pfc[ 0 ].rgb );
- glVertex3fv ( pv [ 0 ].xyz );
- glVertex3fv ( pv [ 1 ].xyz );
-
- for ( i = 2; i < p -> num_facets + 2; ++i ) {
-
- glColor3fv ( pfc[ i - 2 ].rgb );
- glVertex3fv( pv [ i ].xyz );
-
- } /* end for */
-
- } else for ( i = 0; i < p -> num_facets + 2; ++i ) glVertex3fv ( pv[ i ].xyz );
-
- } else { /* front_lighting_model != TelLModelNone */
-
- if ( pvt && !ForbidSetTextureMapping )
-
- for ( i = 0; i < p -> num_facets + 2; ++i ) {
-
- glNormal3fv ( pvn[ i ].xyz );
- glTexCoord2fv ( pvt[ i ].xy );
- glVertex3fv ( pv [ i ].xyz );
-
- } /* end for */
-
- else for ( i = 0; i < p -> num_facets + 2; ++i ) {
-
- glNormal3fv( pvn[ i ].xyz );
- glVertex3fv( pv[ i ].xyz );
-
- } /* end for */
-
- } /* end else */
-
- glEnd ();
-#ifdef G003
- } else if ( g_fSkipRatio != 1.0 ) {
-
- set_drawable_items ( p -> d.bDraw, p -> num_facets + 2 );
-
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
-
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-
- glBegin ( GL_TRIANGLES );
-
- if ( front_lighting_model == CALL_PHIGS_REFL_NONE ) {
-
- if ( pvc ) {
-
- for ( i = 0; i < p -> num_facets; ++i ) {
-
- if ( p -> d.bDraw[ i ] ) {
-
- if ( i % 2 ) {
-
- glColor3fv ( pvc[ i ].rgb );
- glVertex3fv ( pv [ i ].xyz );
- glColor3fv ( pvc[ i + 2 ].rgb );
- glVertex3fv ( pv [ i + 2 ].xyz );
- glColor3fv ( pvc[ i + 1 ].rgb );
- glVertex3fv ( pv [ i + 1 ].xyz );
-
- } else {
-
- glColor3fv ( pvc[ i + 2 ].rgb );
- glVertex3fv ( pv [ i + 2 ].xyz );
- glColor3fv ( pvc[ i ].rgb );
- glVertex3fv ( pv [ i ].xyz );
- glColor3fv ( pvc[ i + 1 ].rgb );
- glVertex3fv ( pv [ i + 1 ].xyz );
-
- } /* end else */
- } /* if */
- } /* for */
-
- } else if ( pfc ) {
-
- for ( i = 0; i < p -> num_facets; ++i ) {
-
- if ( p -> d.bDraw[ i ] ) {
-
- if ( i % 2 ) {
-
- glColor3fv ( pfc[ i ].rgb );
- glVertex3fv( pv [ i ].xyz );
- glColor3fv ( pfc[ i + 2 ].rgb );
- glVertex3fv( pv [ i + 2 ].xyz );
- glColor3fv ( pfc[ i + 1 ].rgb );
- glVertex3fv( pv [ i + 1 ].xyz );
-
- } else {
-
- glColor3fv ( pfc[ i + 2 ].rgb );
- glVertex3fv( pv [ i + 2 ].xyz );
- glColor3fv ( pfc[ i ].rgb );
- glVertex3fv( pv [ i ].xyz );
- glColor3fv ( pfc[ i + 1 ].rgb );
- glVertex3fv( pv [ i + 1 ].xyz );
-
- } /* end else */
- } /* if */
- } /* for */
-
- } else {
- for ( i = 0; i < p -> num_facets; ++i ) {
-
- if ( p -> d.bDraw[ i ] ) {
-
- if ( i % 2 ) {
-
- glVertex3fv ( pv[ i ].xyz );
- glVertex3fv ( pv[ i + 2 ].xyz );
- glVertex3fv ( pv[ i + 1 ].xyz );
-
- } else {
-
- glVertex3fv ( pv[ i + 2 ].xyz );
- glVertex3fv ( pv[ i ].xyz );
- glVertex3fv ( pv[ i + 1 ].xyz );
-
- } /* end else */
- } /* if */
- } /* for */
- }
-
- } else { /* front_lighting_model != TelLModelNone */
-
- if ( pvt && !ForbidSetTextureMapping ) {
-
- for ( i = 0; i < p -> num_facets; ++i ) {
-
- if ( p -> d.bDraw[ i ] ) {
-
- if ( i % 2 ) {
-
- glNormal3fv ( pvn[ i ].xyz );
- glTexCoord2fv ( pvt[ i ].xy );
- glVertex3fv ( pv [ i ].xyz );
- glNormal3fv ( pvn[ i + 2 ].xyz );
- glTexCoord2fv ( pvt[ i + 2 ].xy );
- glVertex3fv ( pv [ i + 2 ].xyz );
- glNormal3fv ( pvn[ i + 1 ].xyz );
- glTexCoord2fv ( pvt[ i + 1 ].xy );
- glVertex3fv ( pv [ i + 1 ].xyz );
-
- } else {
-
- glNormal3fv ( pvn[ i + 2 ].xyz );
- glTexCoord2fv ( pvt[ i + 2 ].xy );
- glVertex3fv ( pv [ i + 2 ].xyz );
- glNormal3fv ( pvn[ i ].xyz );
- glTexCoord2fv ( pvt[ i ].xy );
- glVertex3fv ( pv [ i ].xyz );
- glNormal3fv ( pvn[ i + 1 ].xyz );
- glTexCoord2fv ( pvt[ i + 1 ].xy );
- glVertex3fv ( pv [ i + 1 ].xyz );
-
- } /* end else */
- } /* if */
- } /* end for */
-
- } else {
- for ( i = 0; i < p -> num_facets; ++i ) {
-
- if ( p -> d.bDraw[ i ] ) {
-
- if ( i % 2 ) {
-
- glNormal3fv( pvn[ i ].xyz );
- glVertex3fv( pv[ i ].xyz );
- glNormal3fv( pvn[ i + 2 ].xyz );
- glVertex3fv( pv[ i + 2 ].xyz );
- glNormal3fv( pvn[ i + 1 ].xyz );
- glVertex3fv( pv[ i + 1 ].xyz );
-
- } else {
-
- glNormal3fv( pvn[ i + 2 ].xyz );
- glVertex3fv( pv[ i + 2 ].xyz );
- glNormal3fv( pvn[ i ].xyz );
- glVertex3fv( pv[ i ].xyz );
- glNormal3fv( pvn[ i + 1 ].xyz );
- glVertex3fv( pv[ i + 1 ].xyz );
-
- } /* end else */
-
- } /* if */
- } /* for */
- } /* end else */
- } /* end else front_lighting_model != TelLModelNone */
-
- glEnd ();
-
- } else {
-
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
-
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-
- } /* end else */
- if ( newList ) glEndList ();
-
- if ( g_nDegenerateModel ) return;
-
- } else {
-
- glCallList ( g_fSkipRatio == 0.0 ? p -> d.list : p -> d.dlist );
-
- if ( g_nDegenerateModel ) return;
-
- } /* end else */
-#endif /* G003 */
- } /* end if ( interior_style != TSM_EMPTY ) */
-#ifdef G003
- i = 0;
-
- /* OCC11904 -- Temporarily disable environment mapping */
- glPushAttrib(GL_ENABLE_BIT);
- glDisable(GL_TEXTURE_1D);
- glDisable(GL_TEXTURE_2D);
-
- switch ( g_nDegenerateModel ) {
-
- default:
- break;
-
- case 2: /* XXX_TDM_WIREFRAME */
- i = 1;
- break;
-
- case 3: /* XXX_TDM_MARKER */
- draw_degenerates_as_points ( &p -> d, p -> vertices, p -> num_facets + 2 );
- glPopAttrib();
- return;
-
- case 4: /* XXX_TDM_BBOX */
- draw_degenerates_as_bboxs ( &p -> d, p -> vertices, p -> num_facets + 2 );
- glPopAttrib();
- return;
-
- } /* end switch */
-
- draw_edges ( p, edge_colour, interior_style, i );
-#else
- draw_edges ( p, edge_colour, interior_style );
-#endif /* G003 */
-
- glPopAttrib();
-} /* end draw_tmesh */
-
-/*----------------------------------------------------------------------*/
-static TStatus
-TriangleMeshDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- tel_tmesh_data p;
-
- p = (tel_tmesh_data)data.pdata;
- if( p->fnormals )
- delete[] p->fnormals;
- if( p->fcolours )
- delete[] p->fcolours;
- if( p->vertices )
- delete[] p->vertices;
- if( p->vcolours )
- delete[] p->vcolours;
- if( p->vnormals )
- delete[] p->vnormals;
- if (p->vtexturecoord)
- delete[] p->vtexturecoord;
-#ifdef G003
- if ( GET_GL_CONTEXT() != NULL ) {
-
- if ( p -> d.list ) glDeleteLists ( p -> d.list, 1 );
- if ( p -> d.dlist ) glDeleteLists ( p -> d.dlist, 1 );
-
- } /* end if */
-
- if ( p -> d.bDraw )
- delete[] p->d.bDraw;
-#endif /* G003 */
- if (data.pdata)
- delete data.pdata;
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-static TStatus
-TriangleMeshPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
- tel_tmesh_data p;
-
- p = (tel_tmesh_data)data.pdata;
-
- fprintf(stdout, "TelTriangleMesh. Number of Facets : %d\n", p->num_facets);
- switch( p->facet_flag )
- {
- case TEL_FA_NONE:
- if( p->fcolours )
- fprintf( stdout, "\t\tFacet Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tFacet Flag : NONE\n" );
- break;
-
- case TEL_FA_NORMAL:
- if( p->fcolours )
- fprintf( stdout, "\t\tFacet Flag : COLOURNORMAL\n" );
- else
- fprintf( stdout, "\t\tFacet Flag : NORMAL\n" );
- break;
- }
-
- switch( p->vertex_flag )
- {
- case TEL_VT_NONE:
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOUR\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NONE\n" );
- break;
-
- case TEL_VT_NORMAL:
- if( p->vcolours )
- fprintf( stdout, "\t\tVertex Flag : COLOURNORMAL\n" );
- else
- fprintf( stdout, "\t\tVertex Flag : NORMAL\n" );
- break;
- }
- if( p->fnormals )
- {
- fprintf( stdout, "\n\t\tFacet Normals : " );
- for( i = 0; i < p->num_facets; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->fnormals[i].xyz[0],
- p->fnormals[i].xyz[1],
- p->fnormals[i].xyz[2] );
- }
- else
- fprintf( stdout, "\n\t\tFacet Normals not specified\n" );
-
- if( p->fcolours )
- {
- fprintf( stdout, "\n\t\tFacet Colours : " );
- for( i = 0; i < p->num_facets; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->fcolours[i].rgb[0],
- p->fcolours[i].rgb[1],
- p->fcolours[i].rgb[2] ); }
- else
- fprintf( stdout, "\n\t\tFacet Colours not specified\n" );
- if( p->vertices )
- {
- fprintf( stdout, "\n\t\tVertices : " );
- for( i = 0; i < p->num_facets+2; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vertices[i].xyz[0],
- p->vertices[i].xyz[1],
- p->vertices[i].xyz[2] ); }
-
- fprintf( stdout, "\n" );
- if( p->vcolours )
- {
- fprintf( stdout, "\n\t\tVertex Colours : " );
- for( i = 0; i < p->num_facets+2; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vcolours[i].rgb[0],
- p->vcolours[i].rgb[1],
- p->vcolours[i].rgb[2] ); }
- else
- fprintf( stdout, "\n\t\tVertex Colours not specified\n" );
-
- if( p->vnormals )
- {
- fprintf( stdout, "\n\t\tVertex Normals : " );
- for( i = 0; i < p->num_facets+2; i++ )
- fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i,
- p->vnormals[i].xyz[0],
- p->vnormals[i].xyz[1],
- p->vnormals[i].xyz[2] ); }
- else
- fprintf( stdout, "\n\t\tVertex Normals not specified\n" );
-
- if (p->vtexturecoord)
- {
- fprintf(stdout, "\n\t\tTexture Coordinates : ");
- for (i=0; i<p->num_facets+2; i++)
- fprintf(stdout, "\n\t\t v[%d] = %g %g", i,
- p->vtexturecoord[i].xy[0],
- p->vtexturecoord[i].xy[1]);
- }
- else
- fprintf( stdout, "\n\t\tTexture Coordinates not specified\n");
-
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-#ifndef G003
-static void draw_edges ( tel_tmesh_data p, tel_colour edge_colour, Tint interior_style )
-{
-#else
-static void draw_edges (
- tel_tmesh_data p,
- tel_colour edge_colour,
- Tint interior_style,
- Tint forceDraw
- )
-{
-#endif /* G003 */
- CMN_KEY k, k1, k2, k3, k4;
- Tint i, edge_type, line_type_preserve, newList = 0;
- Tfloat edge_width, line_width_preserve;
- GLboolean texture_on;
- tel_point pv;
-#ifdef G003
- if ( interior_style != TSM_HIDDENLINE && !forceDraw ) {
-#else
- if ( interior_style != TSM_HIDDENLINE ) {
-#endif /* G003 */
-
- k.id = TelEdgeFlag;
- TsmGetAttri ( 1, &k );
-
- if ( k.data.ldata == TOff ) return;
-
- } /* end if */
-
- pv = p -> vertices;
-
- LightOff ();
- texture_on = IsTextureEnabled ();
- if ( texture_on ) DisableTexture ();
-
- k1.id = TelPolylineWidth;
- k2.id = TelPolylineType;
- k3.id = TelEdgeType;
- k4.id = TelEdgeWidth;
- TsmGetAttri ( 4, &k1, &k2, &k3, &k4 );
-
- line_width_preserve = k1.data.fdata;
- line_type_preserve = k2.data.ldata;
- edge_type = k3.data.ldata;
- edge_width = k4.data.fdata;
-
- if ( line_width_preserve != edge_width ) {
-
- k.id = TelPolylineWidth;
- k.data.fdata = edge_width;
- TsmSetAttri ( 1, &k );
-
- } /* end if */
-
- if ( line_type_preserve != edge_type ) {
-
- k.id = TelPolylineType;
- k.data.ldata = edge_type;
- TsmSetAttri ( 1, &k );
-
- } /* end if */
-
- glColor3fv ( edge_colour -> rgb );
-#ifdef G003
- if ( !forceDraw )
-#endif /* G003 */
- draw_line_loop ( p );
-#ifdef G003
- else {
-#ifdef BUC60876
- if ( !g_fAnimation )
- goto doDraw; /* Disable object display list out of animation */
-#endif
-# ifdef G004
- if ( g_fBitmap )
- goto doDraw;
-# endif /* G004 */
- if ( p -> d.degMode != 2 || p -> d.skipRatio != g_fSkipRatio || !p -> d.dlist ) {
-
- if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 );
-
- p -> d.degMode = 2;
- p -> d.skipRatio = g_fSkipRatio;
- glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-doDraw:
- glPushAttrib ( GL_DEPTH_BUFFER_BIT );
- glDisable ( GL_DEPTH_TEST );
-
- if ( g_fSkipRatio == 0.0 )
-
- draw_line_loop ( p );
-
- else if ( g_fSkipRatio != 1.0 ) {
-
- set_drawable_items ( p -> d.bDraw, p -> num_facets + 2 );
-
- for ( i = 0; i < p -> num_facets; ++i )
-
- if ( p -> d.bDraw[ i ] ) {
-
- glBegin ( GL_LINE_LOOP );
- glVertex3fv ( pv[ i ].xyz );
- glVertex3fv ( pv[ i + 1 ].xyz );
- glVertex3fv ( pv[ i + 2 ].xyz );
- glEnd();
-
- } /* end if */
-
- } /* end if */
-
- glPopAttrib ();
- if ( newList ) glEndList ();
-
- } else glCallList ( p -> d.dlist );
-
- } /* end else */
-#endif /* G003 */
- if ( line_width_preserve != edge_width ) {
-
- k.id = TelPolylineWidth;
- k.data.fdata = line_width_preserve;
- TsmSetAttri ( 1, &k );
-
- } /* end if */
-
- if ( line_type_preserve != edge_type ) {
-
- k.id = TelPolylineType;
- k.data.ldata = line_type_preserve;
- TsmSetAttri ( 1, &k );
-
- } /* end if */
-
- if ( texture_on ) EnableTexture ();
-
-} /* end draw_edges */
-#ifdef G003
-void draw_degenerates_as_points ( PDS_INTERNAL pd, tel_point p, Tint n ) {
-
- int i, newList = 0;
-
- LightOff ();
-#ifdef BUC60876
- if ( !g_fAnimation )
- goto doDraw; /* Disable object display list out of animation */
-#endif
-#ifdef G004
- if ( g_fBitmap )
- goto doDraw;
-#endif /* G004 */
- if ( pd -> degMode != 3 || pd -> skipRatio != g_fSkipRatio || !pd -> dlist ) {
-
- if ( !pd -> dlist ) pd -> dlist = glGenLists ( 1 );
-
- pd -> degMode = 3;
- pd -> skipRatio = g_fSkipRatio;
- glNewList ( pd -> dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-
- if ( g_fSkipRatio == 0.0 ) {
-#ifdef G004
-doDraw:
-#endif /* G004 */
- glBegin ( GL_POINTS );
-
- for ( i = 0; i < n; ++i ) glVertex3fv ( p[ i ].xyz );
-
- glEnd ();
-
- } else if ( g_fSkipRatio != 1.0 ) {
-
- set_drawable_items ( pd -> bDraw, n );
-
- glBegin ( GL_POINTS );
-
- for ( i = 0; i < n; ++i )
-
- if ( pd -> bDraw[ i ] ) glVertex3fv ( p[ i ].xyz );
-
- glEnd ();
-
- } /* end if */
- if ( newList ) glEndList ();
-
- } else glCallList ( pd -> dlist );
-
-} /* end draw_degenerates_as_points */
-
-void draw_degenerates_as_bboxs ( PDS_INTERNAL pd, tel_point p, Tint n ) {
-
- int i, newList = 0;
- GLfloat minp[ 3 ] = { FLT_MAX, FLT_MAX, FLT_MAX };
- GLfloat maxp[ 3 ] = { FLT_MIN, FLT_MIN, FLT_MIN };
-
- LightOff ();
-#ifdef BUC60876
- if ( !g_fAnimation )
- goto doDraw; /* Disable object display list out of animation */
-#endif
-#ifdef G004
- if ( g_fBitmap )
- goto doDraw;
-#endif /* G004 */
- if ( pd -> degMode != 4 || !pd -> dlist ) {
-
- if ( !pd -> dlist ) pd -> dlist = glGenLists ( 1 );
-
- pd -> degMode = 4;
-
- glNewList ( pd -> dlist, GL_COMPILE_AND_EXECUTE );
- newList = 1;
-#ifdef G004
-doDraw:
-#endif /* G004 */
- for ( i = 0; i < n; ++i ) {
-
- TEL_POINT pt = p[ i ];
-
- if ( pt.xyz[ 0 ] < minp[ 0 ] )
- minp[ 0 ] = pt.xyz[ 0 ] ;
- if ( pt.xyz[ 1 ] < minp[ 1 ] )
- minp[ 1 ] = pt.xyz[ 1 ] ;
- if ( pt.xyz[ 2 ] < minp[ 2 ] )
- minp[ 2 ] = pt.xyz[ 2 ] ;
-
- if ( pt.xyz[ 0 ] > maxp[ 0 ] )
- maxp[ 0 ] = pt.xyz[ 0 ] ;
- if ( pt.xyz[ 1 ] > maxp[ 1 ] )
- maxp[ 1 ] = pt.xyz[ 1 ] ;
- if ( pt.xyz[ 2 ] > maxp[ 2 ] )
- maxp[ 2 ] = pt.xyz[ 2 ] ;
-
- } /* end for */
-
- glBegin ( GL_LINE_STRIP );
-
- glVertex3fv ( minp );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], minp[ 1 ], minp[ 2 ] );
-
- glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] );
- glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] );
- glVertex3f ( maxp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
- glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] );
-
- glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] );
- glVertex3fv ( maxp );
- glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] );
- glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] );
-
- glEnd();
- if ( newList ) glEndList ();
-
- } else glCallList ( pd -> dlist );
-
-} /* end draw_degenerates_as_bboxs */
-#endif /* G003 */
-
-static void draw_line_loop ( tel_tmesh_data p ) {
-
- int i;
-
- for ( i = 0; i < p -> num_facets; ++i ) {
-
- glBegin ( GL_LINE_LOOP );
- glVertex3fv ( p -> vertices[ i ].xyz );
- glVertex3fv ( p -> vertices[ i + 1 ].xyz );
- glVertex3fv ( p -> vertices[ i + 2 ].xyz );
- glEnd();
-
- } /* end for */
-
-} /* end draw_line_loop */
-
-/*----------------------------------------------------------------------*/
-static TStatus
-TriangleMeshInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i, j;
- tel_tmesh_data d;
- Tint size_reqd=0;
- TStatus status = TSuccess;
- Tchar *cur_ptr = 0;
-
- d = (tel_tmesh_data)data.pdata;
-
- if( d->fcolours )
- size_reqd += ( d->num_facets * sizeof( TEL_COLOUR ) );
-
- if( d->facet_flag == TEL_FA_NORMAL )
- size_reqd += ( d->num_facets * sizeof( TEL_POINT ) );
-
- size_reqd += ( (d->num_facets+2) * sizeof( TEL_POINT ) );
-
- if( d->vcolours )
- size_reqd += ( (d->num_facets+2) * sizeof( TEL_COLOUR ) );
-
- if( d->vertex_flag == TEL_VT_NORMAL )
- size_reqd += ( (d->num_facets+2) * sizeof( TEL_POINT ) );
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = size_reqd;
- break;
- }
-
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (TEL_INQ_CONTENT*)k[i]->data.pdata;
- c->act_size = size_reqd;
- w = c->data;
-
- cur_ptr = c->buf;
- w->trianglestrip3data.num_facets = d->num_facets;
-
- if( c->size >= size_reqd )
- {
- if( d->facet_flag == TEL_FA_NORMAL )
- {
- if( d->fcolours )
- {
- w->trianglestrip3data.fctflag = TEL_FAFLAG_COLOURNORMAL;
- w->trianglestrip3data.gnormals = (tel_point)(c->buf);
- for( j = 0; j < d->num_facets; j++ )
- {
- w->trianglestrip3data.gnormals[j] = d->fnormals[j];
- }
- cur_ptr += ( d->num_facets * sizeof( TEL_POINT ) );
-
- w->trianglestrip3data.facet_colour_vals =
- (tel_colour)(cur_ptr);
- for( j = 0; j < d->num_facets; j++ )
- {
- w->trianglestrip3data.facet_colour_vals[j] =
- d->fcolours[j];
- }
- cur_ptr += ( d->num_facets * sizeof( TEL_COLOUR ) );
- }
- else
- {
- w->trianglestrip3data.fctflag = TEL_FAFLAG_NORMAL;
- w->trianglestrip3data.facet_colour_vals = 0;
- w->trianglestrip3data.gnormals = (tel_point)(c->buf);
- for( j = 0; j < d->num_facets; j++ )
- {
- w->trianglestrip3data.gnormals[j] = d->fnormals[j];
- }
- cur_ptr += ( d->num_facets * sizeof( TEL_POINT ) );
- }
- }
- else
- {
- w->trianglestrip3data.gnormals = 0;
- if( d->fcolours )
- {
- w->trianglestrip3data.fctflag = TEL_FAFLAG_COLOUR;
- w->trianglestrip3data.facet_colour_vals =
- (tel_colour)(c->buf );
- for( j = 0; j < d->num_facets; j++ )
- {
- w->trianglestrip3data.facet_colour_vals[j] =
- d->fcolours[j];
- }
- cur_ptr += ( d->num_facets * sizeof( TEL_COLOUR ) );
- }
- else
- {
- w->trianglestrip3data.fctflag = TEL_FAFLAG_NONE;
- w->trianglestrip3data.facet_colour_vals = 0;
- }
- }
-
- w->trianglestrip3data.points = (tel_point)cur_ptr;
- for( j = 0; j < (d->num_facets+2); j++ )
- {
- w->trianglestrip3data.points[j] = d->vertices[j];
- }
- cur_ptr += ( (d->num_facets+2) * sizeof( TEL_POINT ) );
-
- if( d->vertex_flag == TEL_VT_NORMAL )
- {
- if( d->vcolours )
- {
- w->trianglestrip3data.vrtflag = TEL_VTFLAG_COLOURNORMAL;
- w->trianglestrip3data.vnormals = (tel_point)(cur_ptr);
- for( j = 0; j < (d->num_facets+2); j++ )
- {
- w->trianglestrip3data.vnormals[j] = d->vnormals[i];
- }
- cur_ptr += ( (d->num_facets+2) * sizeof( TEL_POINT ) );
-
- w->trianglestrip3data.colours = (tel_colour)(cur_ptr);
-
- for( j = 0; j < (d->num_facets+2); j++ )
- {
- w->trianglestrip3data.colours[j] = d->vcolours[i];
- }
- }
- else
- {
- w->trianglestrip3data.vrtflag = TEL_VTFLAG_NORMAL;
- w->trianglestrip3data.colours = 0;
- w->trianglestrip3data.vnormals = (tel_point)(cur_ptr);
-
- for( j = 0; j < (d->num_facets+2); j++ )
- {
- w->trianglestrip3data.vnormals[j] = d->vnormals[i];
- }
- }
- }
- else
- {
- w->trianglestrip3data.vnormals = 0;
- if( d->vcolours )
- {
- w->trianglestrip3data.vrtflag = TEL_VTFLAG_COLOUR;
- w->trianglestrip3data.colours = (tel_colour)(cur_ptr);
- for( j = 0; j < (d->num_facets+2); j++ )
- {
- w->trianglestrip3data.colours[j] = d->vcolours[i];
- }
- }
- else
- {
- w->trianglestrip3data.vrtflag = TEL_VTFLAG_NONE;
- w->trianglestrip3data.colours = 0;
- }
- }
-
- status = TSuccess;
- }
- else
- status = TFailure;
- break;
- }
- }
- }
- return status;
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-void EXPORT
-call_togl_activateview
-(
- CALL_DEF_VIEW * aview
- )
-{
- if (aview->WsId != -1)
- call_func_post_struct (aview->WsId, aview->ViewId, ( float )1.0);
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-
-void EXPORT
-call_togl_antialiasing
-(
- CALL_DEF_VIEW * aview,
- int tag
- )
-{
- call_subr_antialiasing (aview, tag);
- return;
-}
+++ /dev/null
-#include <OpenGl_tgl_all.hxx>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_tsm_ws.hxx>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <GL/gl.h>
-
-extern GLboolean g_fList;
-
-void EXPORT call_togl_backfacing ( CALL_DEF_VIEW* aView ) {
-
- CMN_KEY_DATA key;
-
- key.ldata = aView -> Backfacing;
-
- TsmSetWSAttri ( aView -> WsId, WSBackfacing, &key );
-
- g_fList = GL_FALSE;
-
-} /* end call_togl_backfacing */
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-
-void EXPORT
-call_togl_background
-(
- CALL_DEF_VIEW * aview
- )
-{
- TEL_COLOUR col;
-
- col.rgb[0] = aview->DefWindow.Background.r,
- col.rgb[1] = aview->DefWindow.Background.g,
- col.rgb[2] = aview->DefWindow.Background.b;
- call_subr_set_background (aview->WsId, &col);
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_begin.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : CAL ; Creation.
-21-01-97 : CAL : Ajout temporaire d'un XSynchronize pour
-eviter un SEG V lors de la destruction d'une vue.
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-25-03-97 : CAL : getenv de CSF_GraphicSync
-04-11-97 : FMN : ajout InitExtensionGLX();
-17-03-98 : FMN ; Ajout mode animation
-24-11-98 : FMN ; Correction sur la gestion de la perspective (cf Programming Guide)
-22-12-98 : FMN ; Rename CSF_WALKTHROW en CSF_WALKTHROUGH
-08/04/02 : GG ; RIC120302 Add call_togl_begin_display() function
-
-************************************************************************/
-
-#define G003 /* GG 25-01-00 Enable animation always ...
-// See V3d_View::SetAnimationMode()
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <stdlib.h>
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_Extension.hxx>
-#include <OpenGl_animation.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Variable globales
-*/
-
-EXPORT GLboolean env_walkthrow = GL_FALSE;
-/* OCC18942: The new symmetric perspective projection matrix is off by default */
-EXPORT GLboolean env_sym_perspective = GL_FALSE;
-
-/*----------------------------------------------------------------------*/
-/*
-
-Opens and initialises Graphic Library environment.
-Returns true if the Graphic Library environment is open.
-Returns false if the Graphic Library environment is closed (error).
-
-*/
-
-int EXPORT
-call_togl_begin
-(
- char *adisplay
- )
-{
- char *pvalue;
-
- call_togl_set_environment (adisplay);
-#ifndef WNT
- if ((pvalue = getenv ("CSF_GraphicSync")) != NULL)
- XSynchronize (call_thedisplay, 1);
- InitExtensionGLX(call_thedisplay);
-#endif
-
- /* Test si mode workthrough oui/non */
- if ((pvalue = getenv ("CSF_WALKTHROUGH")) != NULL)
- env_walkthrow = GL_TRUE;
-
- /* Activation/Desactivation du mode Animation */
-#ifndef G003
- if ((pvalue = getenv ("CALL_ANIMATION")) != NULL)
- animationUseFlag = GL_TRUE;
- else
- animationUseFlag = GL_FALSE;
-#endif
-
- /* OCC18942: Test if symmetric perspective projection should be turned on */
- if ((pvalue = getenv ("CSF_SYM_PERSPECTIVE")) != NULL)
- env_sym_perspective = GL_TRUE;
-
- call_togl_inquirefacilities ();
- call_func_init_tgl ();
- return (1);
-}
-
-/*RIC120302*/
-/*
-
-Sets the Graphic Library environment.
-Returns true if the Graphic Library environment is open.
-Returns false if the Graphic Library environment is closed (error).
-
-
-*/
-
-int EXPORT
-call_togl_begin_display
-(
- void *pdisplay
- )
-{
- char *pvalue = NULL;
- int status;
-
- status = call_tox_set_display (pdisplay);
- if( status ) {
-#ifndef WNT
- if ((pvalue = getenv ("CSF_GraphicSync")) != NULL)
- XSynchronize (call_thedisplay, 1);
- InitExtensionGLX(call_thedisplay);
-#endif
- call_togl_inquirefacilities ();
- call_func_init_tgl ();
- }
- return (status);
-}
-/*RIC120302*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_begin_animation :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-05-01-98 : CAL ; Creation.
-21-01-98 : FMN ; Ajout call_togl_end_animation().
-17-03-98 : FMN ; Ajout mode animation
-08-07-98 : FMN ; Changement du nom de la primitive call_togl_erase_immediat_mode()
--> call_togl_erase_animation_mode.
-24-08-98 : BGN ; Correction de diag de compilation sur NT :
-Suppression de l'include OpenGl_animation.h qui
-provoque des doubles declarations.
-
-************************************************************************/
-
-#define G003 /* EUG 07-10-99 Animation management
-*/
-
-#define BUC60876 /* GG 5/4/2001 Disable local display list
-// when animation is not required
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-/* 24-08-98 : BGN ; include <OpenGl_animation.h> */
-
-#include <GL/gl.h>
-#ifdef G003
-# include <OpenGl_tsm_ws.hxx>
-void EXPORT call_togl_erase_animation_mode ( void );
-#endif /* G003 */
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define NO_DEBUG
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-/* Indique si la display-list a ete cree */
-static GLboolean listIndexCreate = GL_FALSE;
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-/* La display-list utilisee pour le mode animation */
-GLuint listIndex = 0;
-
-/* La vue de reference pour le mode animation */
-int listIndexView = -1;
-
-/* Flag si la display-list a ete initialise*/
-GLboolean listIndexFlag = GL_FALSE;
-
-/* Flag mode animation en cours */
-GLboolean animationFlag = GL_FALSE;
-
-/* Flag si le mode animation est disponible
-* (cf. var environnement CALL_ANIMATION) */
-#ifdef G003
-GLboolean animationUseFlag = GL_TRUE;
-GLboolean g_fAnimation;
-GLboolean g_fUpdateAM;
-GLboolean g_fDegeneration;
-GLboolean g_fList;
-#else
-GLboolean animationUseFlag = GL_FALSE;
-#endif /* G003 */
-
-/*----------------------------------------------------------------------*/
-
-int EXPORT
-call_togl_begin_animation
-(
- CALL_DEF_VIEW * aview
- )
-{
-#ifdef G003
- g_fAnimation = GL_TRUE;
- g_fList = GL_FALSE;
- g_fDegeneration = aview -> IsDegenerates;
- g_fUpdateAM = ( aview -> IsDegenerates ==
- aview -> IsDegeneratesPrev
- ) ? GL_FALSE : GL_TRUE;
- aview -> IsDegeneratesPrev = aview -> IsDegenerates;
-#endif /* G003 */
-
- if (animationUseFlag)
- {
- if (!listIndexCreate)
- {
- listIndex = glGenLists(1);
- listIndexCreate = GL_TRUE;
- }
-
- if (listIndex == 0)
- animationFlag = GL_FALSE;
- else
- animationFlag = GL_TRUE;
- }
-#ifdef DEBUG
- printf("call_togl_begin_animation(%d) animationFlag: %d\n", aview->WsId, animationFlag);
-#endif
- return (animationFlag);
-}
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_end_animation
-(
- CALL_DEF_VIEW * aview
- )
-{
-#ifdef G003
- CMN_KEY_DATA data;
-
-#ifdef BUC60876
- if( !g_fAnimation ) return;
-#else
- if( !animationFlag ) return;
-#endif
-
- data.ldata = TNotDone;
- TsmSetWSAttri ( aview -> WsId, WSUpdateState, &data );
- g_fAnimation = GL_FALSE;
-#ifndef BUC60876
- g_fUpdateAM = GL_TRUE;
-#endif
- g_fDegeneration = GL_FALSE;
-#endif /* G003 */
-
-#ifdef DEBUG
- printf("call_togl_end_animation(%d) \n", aview->WsId);
-#endif
- animationFlag = GL_FALSE;
-
-}
-
-/*----------------------------------------------------------------------*/
-/*
-* Permet de terminer effectivement le mode Animation.
-* Ceci est realise des qu'une structure a ete modifiee.
-*/
-
-void EXPORT call_togl_erase_animation_mode(void)
-{
-#ifdef DEBUG
- printf("call_togl_erase_animation_mode \n");
-#endif
- listIndexView = -1;
- listIndexFlag = GL_FALSE;
- animationFlag = GL_FALSE;
-#ifdef G003
- g_fAnimation = GL_FALSE;
- g_fUpdateAM = GL_FALSE;
- g_fDegeneration = GL_FALSE;
- g_fList = GL_FALSE;
-#endif /* G003 */
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_begin_immediat_mode.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : CAL ; Creation.
-08-03-96 : FMN ; - Ajout include manquant
-01-04-96 : CAL ; Integration MINSK portage WNT
-15-04-96 : CAL ; Integration travail PIXMAP de Jim ROTH
-07-05-96 : CAL ; Gestion du minmax calcule en C++
-voir call_togl_set_minmax
-Debug temporaire pour ROB, TelRobSetRGB ()
-12-06-96 : CAL ; Recuperation des attributs lors d'un draw_structure
-22-07-96 : GG ; Faire fonctionner correctement le highlight
-des polygones en mode immediat
-11-09-96 : FMN ; Ajout appel a TxglWinset dans call_togl_begin_immediat_mode
-04-11-96 : CAL : Retrait du mode simule, ajout du higlight
-dans togl_draw_structure
-06-11-96 : CAL : Retrait du test sur doublebuffer PRO5949
-16-12-96 : CAL : Ajout d'un glFinish () dans end_immediat_mode
-21-01-97 : CAL : Gestion du flag <partial> differente pour
-eviter les comparaisons avec shortrealfirst ou last
-22-04-97 : FMN ; Correction faute i a la place de j dans util_transform_pt
-22-04-97 : FMN ; Correction appel util_transform_pt dans togl_set_minmax
-24-04-97 : FMN ; (PRO4063) Ajout displaylist pour le mode transient
-25-07-97 : CAL ; Portage WNT (Bool, False, True)
-30-07-97 : FMN ; Meilleure gestion de la desactivation des lights
-10-09-97 : FMN ; Meilleure gestion de la desactivation des lights
-07-10-97 : FMN ; Simplification WNT
-Ajout glFlush dans call_togl_clear_immediat_mode()
-26-11-97 : FMN ; Ajout mode Ajout et xor
-Meilleure gestion display list pour le RetainMode
-19-12-97 : FMN ; Oublie return dans le call_togl_begin_ajout_mode()
-22-12-97 : FMN ; Suppression DEBUG_TEMPO_FOR_ROB
-Correction PRO10217
-Ajout affichage cadre TelCopyBuffer
-Ajout LightOff sur le redraw.
-02-02-98 : CAL ; Correction du bug sur les transformations de structure
-tracees en mode transient. (PRO10217) (PRO12283)
-05-02-98 : CAL ; Perfs : mise en place d'un flag identity pour savoir
-si la matrice de transformation est l'identite.
-08-04-98 : FMN ; Mailleur traitement du reaffichage d'une vue. Remplacement
-de TsmDisplayStructure() par call_func_redraw_all_structs().
-08-07-98 : FMN ; PRO14399: Desactivation animationFlag quand on debute
-le mode immediat (Transient et Ajout).
-30-09-98 : CAL ; Optimisation pour eviter de charger inutilement
-les matrices de la vue.
-27-11-98 : CAL ; S4062. Ajout des layers.
-02.14.100 : JR : Warnings on WNT truncations from double to float
-
-IMP190100 : GG
-// -> Preserve current attributes because
-// attributes can be changed between
-// begin_immediate_mode() end end_immediate_mode()
-// -> Optimize transformations computation.
-// -> Optimize REDRAW in immediat mode.
-// 19/09/00 -> Avoid to raise in set_linetype() & set_linewith()
-// due to a bad call to TsmPutAttri() function.
-
-BUC60726 GG_040900 Clear the last temporary detected in any case
-
-BUC60900 GG_180501 Unhilight entity more earlier
-when clear() is call instead at the next begin().
-
-************************************************************************/
-
-
-#define BUC60863 /*GG_100401 After any view update, made identical
-// the front and back buffer to avoid ghost drawing.
-// Minimize flicking.
-*/
-
-#define IMP150501 /*GG_150501 CADPAK_V2 Enable/Disable Zbuffer
-NOTE that the previous and unused "double-buffer"
-arg is changed to "zbuffer" and enable/disable
-to use the OpenGl zbuffer capabilities during immediat
-drawing
-*/
-
-#define IMP260601 /*GG Enable correct backing store between 2 different views.
-*/
-
-#define IMP051001 /*GG Activates the polygon offset for polygon
-// selection fill mode.
-*/
-
-/*----------------------------------------------------------------------*/
-
-#define RIC120302 /* GG Enable to use the application display
-// callback at end of traversal
-*/
-
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#ifdef IMP051001
-#include <OpenGl_Extension.hxx>
-#endif
-#include <math.h>
-#include <GL/gl.h>
-#include <stdio.h>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_telem_filters.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_animation.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-
-int call_util_osd_getenv( char * , char * , int ) ;
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define xCOPY
-#define xTRACE 0
-
-#if TRACE > 0
-#include <OpenGl_traces.h>
-#endif
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes fonctions
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes Private functions
-*/
-
-static void call_util_transform_pt (float *x, float *y, float *z);
-static int call_util_is_identity ();
-static void call_util_transpose_mat (float tmat[16], float mat[4][4]);
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-static int openglNumberOfPoints = 0;
-static GLint openglViewId = 0;
-static GLint openglWsId = 0;
-
-static int identity = 1;
-
-static int partial = -1; /* -1 init, 0 complete, 1 partielle */
-
-static float xm, ym, zm, XM, YM, ZM;
-
-static float openglMat[4][4] = {
- {1., 0., 0., 0.},
- {0., 1., 0., 0.},
- {0., 0., 1., 0.},
- {0., 0., 0., 1.},
-};
-
-static GLboolean transientOpen = GL_FALSE;
-
-/*----------------------------------------------------------------------*/
-/* Mode Ajout */
-/*----------------------------------------------------------------------*/
-
-int EXPORT call_togl_begin_ajout_mode (
- CALL_DEF_VIEW *aview
- )
-{
- CMN_KEY_DATA data;
-
- TsmGetWSAttri (aview->WsId, WSWindow, &data);
-#ifdef IMP260601
- if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) != TSuccess) return (0);
-#else
- if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) == TSuccess)
-#endif
-
- if (aview->ViewId == -1) return (0);
-
- openglWsId = aview->WsId;
- openglViewId = aview->ViewId;
-
- /* mise en place des matrices de projection et de mapping */
- /* TelSetViewIndex (aview->WsId, aview->ViewId); */
-
-#ifdef TRACE
- printf ("call_togl_begin_ajout_mode %d %d\n", openglViewId, openglWsId);
-#endif
-
- TelMakeFrontAndBackBufCurrent (aview->WsId);
-
- TsmPushAttri();
-
- return (1);
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT call_togl_end_ajout_mode ()
-{
-
-#ifdef TRACE
- printf ("call_togl_end_ajout_mode %d %d\n", openglViewId, openglWsId);
-#endif
-
- if (openglViewId != 0) {
- TelMakeBackBufCurrent (openglWsId);
- }
-
- openglViewId = 0;
- openglWsId = 0;
-
- identity = 1;
-
- /* FMN necessaire pour l'affichage sur WNT */
- glFlush();
-
- TsmPopAttri();
-
-}
-
-
-/*----------------------------------------------------------------------*/
-/* Mode Transient */
-/*----------------------------------------------------------------------*/
-
-void EXPORT call_togl_clear_immediat_mode (
- CALL_DEF_VIEW *aview, Tint aFlush
- )
-{
- CMN_KEY_DATA data;
- GLuint listIndex = 0;
- GLuint retainmode = 0;
-
- if( transientOpen ) {
- call_togl_end_immediat_mode(0);
- }
-
-#ifdef IMP260601
- TsmGetWSAttri (aview->WsId, WSWindow, &data);
- if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) != TSuccess) return;
-#endif
- TsmGetWSAttri( aview->WsId, WSRetainMode, &data );
- retainmode = data.ldata;
-
-#ifdef TRACE
- printf("call_togl_clear_immediat_mode. xm %f, ym %f, zm %f, XM %f, YM %f, ZM %f, partial %d retainmode %d\n",xm, ym, zm, XM, YM, ZM, partial, retainmode);
-#endif
-
- if ( TelBackBufferRestored () == TOff ) {
- call_togl_erase_animation_mode();
- call_func_redraw_all_structs_begin (aview->WsId);
- if( aview->ptrUnderLayer)
- call_togl_redraw_layer2d (aview, (CALL_DEF_LAYER *)aview->ptrUnderLayer);
- call_func_redraw_all_structs_proc (aview->WsId);
- if( aview->ptrOverLayer)
- call_togl_redraw_layer2d (aview, (CALL_DEF_LAYER *)aview->ptrOverLayer);
-#ifdef RIC120302
- call_subr_displayCB(aview,OCC_REDRAW_WINDOW);
-#endif
- call_func_redraw_all_structs_end (aview->WsId, aFlush);
- // After a redraw,
- // Made the back identical to the front buffer.
- // Always perform full copy (partial update optimization is useless on mordern hardware)!
- if (retainmode)
- TelCopyBuffers (aview->WsId, GL_FRONT, GL_BACK, xm, ym, zm, XM, YM, ZM, 0);
-#ifdef TRACE
- printf(" $$$ REDRAW\n");
-#endif
- TelSetBackBufferRestored (TOn);
- } else if( partial >= 0 ) {
- // Restore pixels from the back buffer.
- // Always perform full copy (partial update optimization is useless on mordern hardware)!
- TelCopyBuffers (aview->WsId, GL_BACK, GL_FRONT, xm, ym, zm, XM, YM, ZM, 0);
- }
-
- TsmGetWSAttri (aview->WsId, WSTransient, &data);
- listIndex = (GLuint) data.ldata;
- if( listIndex != 0 ) { /* Clear current list contents */
- glNewList( listIndex, GL_COMPILE_AND_EXECUTE);
- glEndList();
- }
- partial = -1;
- XM = YM = ZM = (float ) shortrealfirst ();
- xm = ym = zm = (float ) shortreallast ();
-}
-
-/*----------------------------------------------------------------------*/
-
-void call_togl_redraw_immediat_mode(
- CALL_DEF_VIEW * aview
- )
-{
- CMN_KEY_DATA data;
- GLuint listIndex = 0;
- int retainmode = 0;
-#ifndef IMP150501
- GLboolean flag_zbuffer = GL_FALSE;
-#endif
-
- TsmGetWSAttri( aview->WsId, WSRetainMode, &data );
- retainmode = data.ldata;
-
- TsmGetWSAttri (aview->WsId, WSTransient, &data);
- listIndex = (GLuint) data.ldata;
-
- if (retainmode != 0) {
- if (listIndex != 0) {
- TelMakeFrontBufCurrent (aview->WsId);
-
- LightOff();
- /* mise en place des matrices de projection et de mapping */
- /* TelSetViewIndex (aview->WsId, aview->ViewId); */
-
-#ifdef TRACE
- printf("call_togl_redraw_immediat_mode::call displaylist(%d) \n",
- listIndex);
-#endif
-#ifdef IMP150501
- glCallList(listIndex);
-#else
- flag_zbuffer = glIsEnabled(GL_DEPTH_TEST);
- if (flag_zbuffer) glDisable(GL_DEPTH_TEST);
- glCallList(listIndex);
- if (flag_zbuffer) glEnable(GL_DEPTH_TEST);
-#endif
- /* FMN necessaire pour l'affichage sur WNT */
- glFlush();
-
- TelMakeBackBufCurrent (aview->WsId);
- }
- }
-}
-
-
-/*----------------------------------------------------------------------*/
-
-int EXPORT
-call_togl_begin_immediat_mode
-(
- CALL_DEF_VIEW * aview,
- CALL_DEF_LAYER * anunderlayer,
- CALL_DEF_LAYER * anoverlayer,
-#ifdef IMP150501
- int zbuffer,
-#else
- int doublebuffer,
-#endif
- int retainmode
- )
-{
- CMN_KEY_DATA data;
- GLuint listIndex = 0;
-
- if (aview->ViewId == -1) return (0);
-
- TsmGetWSAttri (aview->WsId, WSWindow, &data);
-#ifdef IMP260601
- if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) != TSuccess) return (0);
-#else
- if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) == TSuccess)
-#endif
-
- openglWsId = aview->WsId;
- openglViewId = aview->ViewId;
-
- data.ldata = retainmode;
- TsmSetWSAttri( aview->WsId, WSRetainMode, &data );
-
-#ifdef TRACE
- printf ("call_togl_begin_immediat_mode %d %d RetainMode %d zbuffer %d partial %d\n", openglViewId, openglWsId, retainmode, zbuffer, partial);
-#endif
-
- call_togl_clear_immediat_mode(aview,1);
-
- TelMakeFrontBufCurrent (aview->WsId);
-
- TsmPushAttri();
-
-#ifdef COPY
- if (partial == 1) {
- glColor3f (1., 0., 0.);
- glBegin(GL_LINE_LOOP);
- glVertex3f (xm, ym, zm);
- glVertex3f (XM, ym, zm);
- glVertex3f (XM, YM, zm);
- glVertex3f (xm, YM, zm);
- glEnd();
- }
-#endif
-
- /*
- * RetainMode
- */
- if( retainmode ) {
- TsmGetWSAttri (aview->WsId, WSTransient, &data);
- listIndex = (GLuint) data.ldata;
-
- if (listIndex == 0) {
- listIndex = glGenLists(1);
-#ifdef TRACE
- printf("call_togl_begin_immediat_mode::init displaylist() %d \n", listIndex);
-#endif
- data.ldata = listIndex;
- TsmSetWSAttri( aview->WsId, WSTransient, &data );
- }
- if (listIndex == 0) return(0);
-#ifdef TRACE
- printf("call_togl_begin_immediat_mode::glNewList() %d \n", listIndex);
-#endif
- glNewList(listIndex, GL_COMPILE_AND_EXECUTE);
- transientOpen = GL_TRUE;
- }
-
-#ifdef IMP150501
- if( zbuffer ) {
- glEnable(GL_DEPTH_TEST);
- } else glDisable(GL_DEPTH_TEST);
-#endif
-
- return (1);
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-call_togl_end_immediat_mode (synchronize)
-GLboolean synchronize
-
-End of immediate graphic primitives in the view.
-*/
-
-void EXPORT
-call_togl_end_immediat_mode
-(
- int synchronize
- )
-{
-
-#ifdef TRACE
- printf ("call_togl_end_immediat_mode %d %d %d\n",
- synchronize, openglViewId, openglWsId);
-#endif
-
-#ifndef BUC60863 /* Don't modify the current minmax !!*/
- /* Mise ajout MinMax */
- if ((xm > shortreallast ()) ||
- (ym > shortreallast ()) ||
- (zm > shortreallast ()) ||
- (XM > shortreallast ()) ||
- (YM > shortreallast ()) ||
- (ZM > shortreallast ()) ||
- (xm < shortrealfirst ()) ||
- (ym < shortrealfirst ()) ||
- (zm < shortrealfirst ()) ||
- (XM < shortrealfirst ()) ||
- (YM < shortrealfirst ()) ||
- (ZM < shortrealfirst ())) {
- XM = YM = ZM = (float ) shortreallast ();
- xm = ym = zm = (float ) shortrealfirst ();
- partial = 0;
- }
- else {
- if (partial != 0) partial = 1;
- }
-#endif /*BUC60863*/
-
- if (openglViewId != 0) {
-#ifdef COPY
- if (partial == 1) {
- glColor3f (0., 1., 0.);
- glBegin(GL_LINE_LOOP);
- glVertex3f (xm, ym, zm);
- glVertex3f (XM, ym, zm);
- glVertex3f (XM, YM, zm);
- glVertex3f (xm, YM, zm);
- glEnd();
- }
-#endif
-
- if (transientOpen) {
- glEndList();
-#ifdef TRACE
- printf("--->glEndList() \n");
-#endif
- transientOpen = GL_FALSE;
- }
-
- TelMakeBackBufCurrent (openglWsId);
- }
-
- /*
- * Ajout CAL : pour voir quelque chose
- * avant le prochain begin_immediat_mode
- */
- glFinish ();
-
- openglViewId = 0;
- openglWsId = 0;
-
- identity = 1;
-
- TsmPopAttri();
-
-}
-
-/*----------------------------------------------------------------------*/
-/*
-call_togl_transform (amatrix, mode)
-float amatrix[4][4]
-GLboolean mode
-
-Set the local transformation for All primitives
-REPLACE the existante if mode is True or POSTCONCATENATE if GL_FALSE
-*/
-void EXPORT
-call_togl_transform ( float amatrix[4][4], int mode )
-{
- int i, j;
- if (mode || identity) {
- for (i=0; i<4; i++)
- for (j=0; j<4; j++)
- openglMat[i][j] = amatrix[i][j];
- } else
- TelMultiplymat3 (openglMat, openglMat, amatrix);
-
- identity = call_util_is_identity ();
-}
-
-
-/*
-call_togl_begin_polyline ()
-
-Sets the graphic library ready to receive a polyline.
-*/
-
-void EXPORT
-call_togl_begin_polyline ()
-{
- openglNumberOfPoints = 0;
- LightOff();
- glBegin (GL_LINE_STRIP);
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-call_togl_end_polyline ()
-
-End of the polyline.
-*/
-
-void EXPORT
-call_togl_end_polyline ()
-{
-
-#ifdef TRACE
- printf ("call_togl_end_polyline %d %d\n", openglViewId, openglWsId);
-#endif
-
- if (openglViewId != 0) glEnd ();
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-call_togl_draw (x, y, z)
-float x;
-float y;
-float z;
-
-Defines a new point in the current primitive.
-*/
-
-void EXPORT
-call_togl_draw
-(
- float x,
- float y,
- float z
- )
-{
-
-#ifdef TRACE
- printf ("call_togl_draw %d %d\n", openglViewId, openglWsId);
-#endif
-
- if (openglViewId != 0) {
- openglNumberOfPoints ++;
- call_util_transform_pt (&x, &y, &z);
- if (x > XM) XM = x;
- if (y > YM) YM = y;
- if (z > ZM) ZM = z;
- if (x < xm) xm = x;
- if (y < ym) ym = y;
- if (z < zm) zm = z;
- glVertex3f (x, y, z);
- partial = 1;
- }
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-call_togl_move (x, y, z)
-float x;
-float y;
-float z;
-
-Defines a new point in the current primitive.
-*/
-
-void EXPORT
-call_togl_move
-(
- float x,
- float y,
- float z
- )
-{
-
-#ifdef TRACE
- printf ("call_togl_move %d %d\n", openglViewId, openglWsId);
-#endif
-
- if (openglViewId != 0) {
- if (openglNumberOfPoints != 0) {
- call_togl_end_polyline ();
- call_togl_begin_polyline ();
- }
-
- openglNumberOfPoints ++;
- call_util_transform_pt (&x, &y, &z);
- if (x > XM) XM = x;
- if (y > YM) YM = y;
- if (z > ZM) ZM = z;
- if (x < xm) xm = x;
- if (y < ym) ym = y;
- if (z < zm) zm = z;
- glVertex3f (x, y, z);
- partial = 1;
- }
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-call_togl_set_linecolor (r, g, b)
-float r;
-float g;
-float b;
-
-Sets a new color in the current primitive.
-*/
-
-void EXPORT
-call_togl_set_linecolor
-(
- float r,
- float g,
- float b
- )
-{
-
-#ifdef TRACE
- printf ("call_togl_set_linecolor %d %d\n", openglViewId, openglWsId);
-#endif
-
- if (openglViewId != 0) {
- TEL_COLOUR color;
- CMN_KEY key;
- key.id = TelPolylineColour;
- color.rgb[0] = r; color.rgb[1] = g; color.rgb[2] = b;
- key.data.pdata = &color;
- TsmSetAttri( 1, &key );
- }
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-call_togl_set_linetype (type)
-long type;
-
-Sets a new line type in the current primitive.
-*/
-
-void EXPORT
-call_togl_set_linetype
-(
- long type
- )
-{
-#ifdef TRACE
- printf ("call_togl_set_linetype %d %d\n", openglViewId, openglWsId);
-#endif
-
- if (openglViewId != 0) {
- CMN_KEY key;
- key.id = TelPolylineType;
- key.data.ldata = type;
- TsmSetAttri( 1, &key);
- }
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-call_togl_set_linewidth (width)
-float width;
-
-Sets a new line width in the current primitive.
-*/
-
-void EXPORT
-call_togl_set_linewidth
-(
- float width
- )
-{
-
-#ifdef TRACE
- printf ("call_togl_set_linewidth %d %d\n", openglViewId, openglWsId);
-#endif
-
- if (openglViewId != 0) {
- CMN_KEY key;
- key.id = TelPolylineWidth;
- key.data.fdata = width;
- TsmSetAttri( 1, &key);
- }
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-call_togl_draw_structure (aStructureId)
-int aStructureId
-
-Draw a structure in the transient view space
-*/
-
-void EXPORT
-call_togl_draw_structure
-(
- int aStructureId
- )
-{
- Tint i, num;
- tsm_node node;
- register Tint istrsfed = 0;
- register Tint display = 1;
- register Tint highl = TOff;
- register TelType telem;
- CMN_KEY key;
-
- float mat16[16];
- GLint mode1;
- GLint mode2;
-
-#ifdef TRACE
- printf ("call_togl_draw_structure %d %d %d\n", openglViewId, openglWsId);
-#endif
-
- if (openglViewId == 0) return;
-
- if (TsmGetStructure (aStructureId, &num, &node) == TFailure || !num) return;
-
- /*transform_persistence_end();*/
-
- TsmPushAttriLight ();
- TsmPushAttri();
- TglNamesetPush();
-
- /* mise en place de la matrice de transformation du trace transient */
- if (! identity) {
- call_util_transpose_mat (mat16, openglMat);
- glGetIntegerv (GL_MATRIX_MODE, &mode1);
- glMatrixMode (GL_MODELVIEW);
- glPushMatrix ();
- glScalef (1., 1., 1.);
- glMultMatrixf (mat16);
- }
-
- for (i = 0; i < num; i++, node = node->next) {
- telem = node->elem.el;
-#if TRACE > 0
- TelTrace(telem,node->elem.data.ldata);
-#endif
- switch (telem) {
- case TelAddNameset:
- case TelRemoveNameset: {
- TsmSendMessage (telem, DisplayTraverse, node->elem.data, 0);
-
- if( TglFilterNameset( openglWsId, InvisFilter ) == TSuccess )
- display = 0;
-
- if( TglFilterNameset( openglWsId, HighlFilter ) == TSuccess )
- highl = TOn;
-
- break;
- }
-
- case TelCurve:
- case TelMarker:
- case TelMarkerSet:
- case TelPolyline:
- case TelText: {
- /* do not send Display message to */
- /* primitives if they are invisible */
- if (display)
- {
- LightOff();
-#ifdef IMP150501
- glDepthMask(GL_FALSE);
-#endif
- key.id = highl;
- TsmSendMessage (telem, DisplayTraverse, node->elem.data, 1, &key);
- }
- }
- break;
-
- case TelPolygon:
- case TelPolygonSet:
- case TelPolygonHoles:
- case TelPolygonIndices:
- case TelQuadrangle:
- case TelParray:
- case TelTriangleMesh: {
- /* do not send Display message to */
- /* primitives if they are invisible */
- if (display)
- {
- /* LightOn(); */
-#ifdef IMP150501
- glDepthMask(GL_FALSE);
-#endif
-#ifdef IMP051001
- if( highl ) {
- call_subr_disable_polygon_offset();
- }
-#endif
- key.id = highl;
- TsmSendMessage (telem, DisplayTraverse, node->elem.data, 1, &key);
-#ifdef IMP051001
- if( highl ) {
- call_subr_enable_polygon_offset();
- }
-#endif
- }
- }
- break;
-
- case TelLocalTran3: {
- tel_matrix3_data d = ((tel_matrix3_data)(node->elem.data.pdata));
- istrsfed = 1;
- call_util_transpose_mat (mat16, d->mat);
- glGetIntegerv (GL_MATRIX_MODE, &mode2);
- glMatrixMode (GL_MODELVIEW);
- glPushMatrix ();
- glScalef (1., 1., 1.);
- glMultMatrixf (mat16);
- }
- break;
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- case TelTransformPersistence:
- {
- key.id = openglWsId;
- TsmSendMessage (telem, DisplayTraverse, node->elem.data, 1, &key);
- break;
- }
- /*ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- default: {
- key.id = openglWsId;
- TsmSendMessage (telem, DisplayTraverse, node->elem.data, 1, &key);
- }
- }
- }
-
- TglNamesetPop();
- TsmPopAttri();
- TsmPopAttriLight ();
-
- if (istrsfed) {
- glPopMatrix ();
- glMatrixMode (mode2);
- }
- if (! identity) {
- glPopMatrix ();
- glMatrixMode (mode1);
- }
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-/*
-call_togl_set_minmax (x1, y1, z1, x2, y2, z2)
-float x1;
-float y1;
-float z1;
-float x2;
-float y2;
-float z2;
-
-Give the boundary box of the transient graphic
-*/
-
-void EXPORT
-call_togl_set_minmax (
- float x1,
- float y1,
- float z1,
- float x2,
- float y2,
- float z2
- )
-{
-#ifdef TRACE
- printf("call_togl_set_minmax. x1 %f, y1 %f, z1 %f, x2 %f, y2 %f, z2 %f\n",x1, y1, z1, x2, y2, z2);
-#endif
- if ((x1 > shortreallast ()) ||
- (y1 > shortreallast ()) ||
- (z1 > shortreallast ()) ||
- (x2 > shortreallast ()) ||
- (y2 > shortreallast ()) ||
- (z2 > shortreallast ()) ||
- (x1 < shortrealfirst ()) ||
- (y1 < shortrealfirst ()) ||
- (z1 < shortrealfirst ()) ||
- (x2 < shortrealfirst ()) ||
- (y2 < shortrealfirst ()) ||
- (z2 < shortrealfirst ())) {
- XM = YM = ZM = (float ) shortreallast ();
- xm = ym = zm = (float ) shortrealfirst ();
- partial = 0;
- }
- else {
- call_util_transform_pt (&x1, &y1, &z1);
- call_util_transform_pt (&x2, &y2, &z2);
- if (x1 > XM) XM = x1;
- if (x1 < xm) xm = x1;
- if (y1 > YM) YM = y1;
- if (y1 < ym) ym = y1;
- if (z1 > ZM) ZM = z1;
- if (z1 < zm) zm = z1;
-
- if (x2 > XM) XM = x2;
- if (x2 < xm) xm = x2;
- if (y2 > YM) YM = y2;
- if (y2 < ym) ym = y2;
- if (z2 > ZM) ZM = z2;
- if (z2 < zm) zm = z2;
- if (partial != 0) partial = 1;
- }
-}
-
-/*----------------------------------------------------------------------*/
-/*
-* Private functions
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-call_util_transform_pt (x, y, z)
-float *x;
-float *y;
-float *z;
-
-Transform the point pt
-*/
-
-static void call_util_transform_pt
-(
- float *x,
- float *y,
- float *z
- )
-{
- int i, j;
- float sum = 0.;
- float tpt[4], pt[4];
-
- if (! identity) {
- pt[0] = *x, pt[1] = *y, pt[2] = *z, pt[3] = 1.0;
-
- for (i = 0; i < 4; i++) {
- for (j = 0, sum = 0.0; j < 4; j++)
- sum += openglMat[i][j] * pt[j];
- tpt[i] = sum;
- }
-
- *x = tpt[0], *y = tpt[1], *z = tpt[2];
- }
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-int call_util_is_identity ()
-
-Returns 1 if openglMat is the identity
-*/
-
-static int call_util_is_identity
-(
- )
-{
- int i, j;
- int res = 1;
-
- for (i = 0; res && i < 4; i++)
- for (j = 0; res && j < 4; j++)
- if (i == j) res = (openglMat[i][j] == 1.);
- else res = (openglMat[i][j] == 0.);
-
-#ifdef TRACE
- printf ("La matrice suivante :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", openglMat[i][j]);
- printf ("\n");
- }
- if (res)
- printf ("est la matrice identite\n");
- else
- printf ("n'est pas la matrice identite\n");
-#endif
-
- return (res);
-}
-
-
-/*----------------------------------------------------------------------*/
-/*
-void call_util_transpose_mat (tmat, mat)
-float tmat[16];
-float mat[4][4];
-
-Transpose mat and returns tmat.
-*/
-
-static void call_util_transpose_mat (float tmat[16], float mat[4][4]) {
- int i, j;
-
- for (i=0; i<4; i++)
- for (j=0; j<4; j++)
- tmat[j*4+i] = mat[i][j];
-
-#ifdef TRACE
- printf ("Transposee :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", tmat[i*4+j]);
- printf ("\n");
- }
-#endif
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_begin_layer_mode.c :
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-01-12-98 : CAL ; Creation. S4062. Ajout des layers.
-02.14.100 : JR : Warnings on WNT truncations from double to float
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if defined(HAVE_MALLOC_H) || defined(WNT)
-#include <malloc.h>
-#endif
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <math.h>
-#include <GL/gl.h>
-#include <stdio.h>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_telem_filters.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_view.hxx>
-
-#include <OpenGl_TextRender.hxx>
-
-/*OCC6247*/
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_LightBox.hxx>
-
-#include <Visual3d_Layer.hxx>
-
-#include <OpenGl_Extension.hxx>
-#include <OpenGl_PrinterContext.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define NO_PRINT
-#define NOTRACE
-#define NO_DEBUG
-#define NO_TRACE_MAT
-#define NO_TRACE_TEXT
-
-#define IsNotModified 0
-#define IsModified 1
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables externes
-*/
-
-extern GLuint linestyleBase;
-extern GLuint fontBase;
-
-#if defined(__sun) || defined (__osf__) || defined (__hp) || defined (__sgi)
-#else
-extern PFNGLBLENDEQUATIONEXTPROC glBlendEquationOp;
-#endif
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes fonctions
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes Private functions
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-static CALL_DEF_LAYER ACLayer;
-
-static GLboolean layerOpen = GL_FALSE;
-static float layerHeight = -1.;
-static float layerWidth = -1.;
-static int layerPoints = 0;
-static Tchar *layerFont = NULL;
-static int layerType = -1;
-static int layerFontFlag = IsModified;
-static int layerFontType = 0;
-static float layerRed = -1.;
-static float layerGreen = -1.;
-static float layerBlue = -1.;
-static float layerFontRed = -1.;
-static float layerFontGreen = -1.;
-static float layerFontBlue = -1.;
-
-static OSD_FontAspect FTGLLayerFontAspect = OSD_FA_Regular;
-static Tint FTGLLayerFontHeight = 16;
-static Tint FTGLLayerFontAscent = 0;
-static Tint FTGLLayerFontDescent = 0;
-static Tint FTGLLayerFontWidth = 0;
-static Tfloat FTGLLayerFontXScale = 1.f;
-static Tfloat FTGLLayerFontYScale = 1.f;
-static Tchar FTGLLayerFontName[100];
-static Tint FTGLLayerFontCurrent = 0;
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_layer2d
-(
- CALL_DEF_LAYER * alayer
- )
-{
- //call_def_ptrLayer ptrLayer;
-
-#ifdef PRINT
- printf ("call_togl_layer2d\n");
-#endif
- alayer->ptrLayer = (call_def_ptrLayer) malloc (sizeof (CALL_DEF_PTRLAYER));
- alayer->ptrLayer->listIndex = glGenLists (1);
- ACLayer = *alayer;
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_removelayer2d
-(
- CALL_DEF_LAYER * alayer
- )
-{
- if (alayer->ptrLayer == NULL) return;
- if (alayer->ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_removelayer2d %d\n", ptrLayer->listIndex);
-#endif
-
- /*
- * On detruit la display-list associee au layer.
- */
- glDeleteLists (alayer->ptrLayer->listIndex, 1);
- alayer->ptrLayer->listIndex = 0;
- ACLayer = *alayer;
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_clear_layer2d (
- CALL_DEF_LAYER * aLayer
- )
-{
- if (aLayer->ptrLayer == NULL) return;
- if (aLayer->ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_clear_layer2d %d\n", ptrLayer->listIndex);
-#endif
-
- /*
- * On clear la display-list associee au layer.
- */
- /*
- * On detruit la display-list associee au layer.
- */
- glDeleteLists (aLayer->ptrLayer->listIndex, 1);
- aLayer->ptrLayer->listIndex = 0;
- /*
- * On cree la display-list associee au layer.
- */
- aLayer->ptrLayer->listIndex = glGenLists (1);
- //alayer->ptrLayer = /*(void *) */ptrLayer;
- ACLayer = *aLayer;
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_redraw_layer2d (
- CALL_DEF_VIEW * aview,
- CALL_DEF_LAYER * alayer
- )
-{
- float left, right, bottom, top;
- float delta, ratio;
- int attach;
-#ifdef TRACE_MAT
- GLdouble modelMatrix[16], projMatrix[16];
- GLint viewport[4];
- int i, j;
-#endif
- GLsizei dispWidth, dispHeight;
- GLboolean isl = IsLightOn(); /*OCC6247*/
-
- if ( aview->DefBitmap.bitmap ) {
- dispWidth = aview->DefBitmap.width;
- dispHeight = aview->DefBitmap.height;
- }
- else {
- dispWidth = (GLsizei) alayer->viewport[0];
- dispHeight = (GLsizei) alayer->viewport[1];
- }
-
- if (alayer->ptrLayer == NULL) return;
- if (alayer->ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_redraw_layer2d %d\n", ptrLayer->listIndex);
- printf ("\twindow size %f %f\n",
- aview->DefWindow.dx, aview->DefWindow.dy);
- printf ("\tviewport %f %f\n", (float) dispWidth, (float) dispHeight);
-#endif
-
- if(isl) {
- LightOff(); /*OCC6247*/
- }
-
- /*
- * On positionne la projection
- */
- glMatrixMode( GL_MODELVIEW );
- glPushMatrix ();
- glLoadIdentity ();
-
- glMatrixMode (GL_PROJECTION);
- glPushMatrix ();
- glLoadIdentity ();
-
- if (alayer->sizeDependent == 0)
- glViewport (0, 0, dispWidth, dispHeight);
-
- left = alayer->ortho[0],
- right = alayer->ortho[1],
- bottom = alayer->ortho[2],
- top = alayer->ortho[3];
- attach = alayer->attach;
-#ifdef TRACE
- printf ("\tattach %d ortho %f %f %f %f %d\n",
- attach, left, right, bottom, top);
-#endif
- if (alayer->sizeDependent == 0)
- ratio = (float) dispWidth/dispHeight;
- else
- ratio = aview->DefWindow.dx/aview->DefWindow.dy;
- if (ratio >= 1.0) { /* fenetre horizontale */
- delta = (float )((top - bottom)/2.0);
- switch (attach) {
- case 0: /* Aspect_TOC_BOTTOM_LEFT */
- top = bottom + 2*delta/ratio;
- break;
- case 1: /* Aspect_TOC_BOTTOM_RIGHT */
- top = bottom + 2*delta/ratio;
- break;
- case 2: /* Aspect_TOC_TOP_LEFT */
- bottom = top - 2*delta/ratio;
- break;
- case 3: /* Aspect_TOC_TOP_RIGHT */
- bottom = top - 2*delta/ratio;
- break;
- }
- }
- else { /* fenetre verticale */
- delta = (float )((right - left)/2.0);
- switch (attach) {
- case 0: /* Aspect_TOC_BOTTOM_LEFT */
- right = left + 2*delta*ratio;
- break;
- case 1: /* Aspect_TOC_BOTTOM_RIGHT */
- left = right - 2*delta*ratio;
- break;
- case 2: /* Aspect_TOC_TOP_LEFT */
- right = left + 2*delta*ratio;
- break;
- case 3: /* Aspect_TOC_TOP_RIGHT */
- left = right - 2*delta*ratio;
- break;
- }
- }
-#ifdef TRACE
- printf ("\tratio %f new ortho %f %f %f %f\n",
- ratio, left, right, bottom, top);
-#endif
-
-#ifdef WNT
- // Check printer context that exists only for print operation
- OpenGl_PrinterContext* aPrinterContext =
- OpenGl_PrinterContext::GetPrinterContext (GET_GL_CONTEXT());
-
- if (aPrinterContext)
- {
- // additional transformation matrix could be applied to
- // render only those parts of viewport that will be
- // passed to a printer as a current "frame" to provide
- // tiling; scaling of graphics by matrix helps render a
- // part of a view (frame) in same viewport, but with higher
- // resolution
- GLfloat aProjMatrix[16];
- aPrinterContext->GetProjTransformation (aProjMatrix);
- glLoadMatrixf ((GLfloat*) aProjMatrix);
-
- // printing operation also assumes other viewport dimension
- // to comply with transformation matrix or graphics scaling
- // factors for tiling for layer redraw
- GLsizei anViewportX = 0;
- GLsizei anViewportY = 0;
- aPrinterContext->GetLayerViewport (anViewportX, anViewportY);
- if (anViewportX != 0 && anViewportY != 0)
- glViewport (0, 0, anViewportX, anViewportY);
- }
-#endif
-
- glOrtho (left, right, bottom, top, -1.0, 1.0);
-
-#ifdef TRACE_MAT
- glGetIntegerv (GL_VIEWPORT, viewport);
- glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
- glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
- printf ("viewport :\n");
- printf ("\t");
- for (i = 0; i < 4; i++)
- printf ("%d ", viewport[i]);
- printf ("\n");
- printf ("modelMatrix :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", modelMatrix[i*4+j]);
- printf ("\n");
- }
- printf ("projMatrix :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", projMatrix[i*4+j]);
- printf ("\n");
- }
-#endif
-
- /*
- * On trace la display-list associee au layer.
- */
-#ifdef TRACE
- if (glIsList (alayer->ptrLayer->listIndex))
- printf ("\t%d is a list\n", alayer->ptrLayer->listIndex);
- else
- printf ("\t%d is not a list\n", alayer->ptrLayer->listIndex);
-#endif
- glPushAttrib (
- GL_LIGHTING_BIT | GL_LINE_BIT | GL_POLYGON_BIT |
- GL_DEPTH_BUFFER_BIT | GL_CURRENT_BIT | GL_TEXTURE_BIT );
- glDisable (GL_DEPTH_TEST);
- glCallList (alayer->ptrLayer->listIndex);
-
-
- //calling dynamic render of LayerItems
- if ( alayer->ptrLayer->layerData ) {
- ACLayer = *alayer;
- Visual3d_Layer* layer = (Visual3d_Layer*)alayer->ptrLayer->layerData;
- layer->RenderLayerItems();
- ACLayer.ptrLayer = NULL;
- }
-
-
- glPopAttrib ();
-
- /*
- * On retire la projection
- */
- glMatrixMode (GL_PROJECTION);
- glPopMatrix ();
-
- glMatrixMode( GL_MODELVIEW );
- glPopMatrix ();
-
- /*
- * Restauration du Viewport en cas de modification
- */
- if (alayer->sizeDependent == 0)
- glViewport (0, 0,
- (GLsizei) aview->DefWindow.dx,
- (GLsizei) aview->DefWindow.dy);
-
- glFlush ();
-
- if(isl) {
- LightOn(); /*OCC6247*/
- }
-
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_begin_layer2d
-(
- CALL_DEF_LAYER * alayer
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ACLayer = *alayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_begin_layer2d %d\n", ptrLayer->listIndex);
-#endif
-
- //abd
- glEnable(GL_TEXTURE_2D);
- GLboolean stat = glIsEnabled( GL_TEXTURE_2D );
-
- glNewList (ptrLayer->listIndex, GL_COMPILE);
- layerOpen = GL_TRUE;
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_end_layer2d
-(
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_end_layer2d %d\n", ptrLayer->listIndex);
-#endif
-
- /*
- * On ferme la display-list associee au layer.
- */
- if (layerOpen)
- glEndList ();
- layerOpen = GL_FALSE;
-
- ACLayer.ptrLayer = NULL;
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_begin_polyline2d (
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_begin_polyline2d %d\n", ptrLayer->listIndex);
-#endif
-
- layerPoints = 0;
- glBegin (GL_LINE_STRIP);
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_end_polyline2d (
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_end_polyline2d %d\n", ptrLayer->listIndex);
-#endif
-
- glEnd ();
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_begin_polygon2d (
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_begin_polygon2d %d\n", ptrLayer->listIndex);
-#endif
-
- layerPoints = 0;
- glBegin (GL_POLYGON);
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_end_polygon2d (
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_end_polygon2d %d\n", ptrLayer->listIndex);
-#endif
-
- glEnd ();
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_edge2d (
- float x,
- float y
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_edge2d %d\n", ptrLayer->listIndex);
- printf ("\tcoord %f %f\n", x, y);
-#endif
-
- layerPoints ++;
- glVertex3f (x, y, 0.);
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_draw2d
-(
- float x,
- float y
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_draw2d %d\n", ptrLayer->listIndex);
- printf ("\tcoord %f %f\n", x, y);
-#endif
-
- layerPoints ++;
- glVertex3f (x, y, 0.);
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_move2d
-(
- float x,
- float y
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_move2d %d\n", ptrLayer->listIndex);
- printf ("\tcoord %f %f\n", x, y);
-#endif
-
- if (layerPoints != 0) {
- call_togl_end_polyline2d ();
- call_togl_begin_polyline2d ();
- }
-
- layerPoints ++;
- glVertex3f (x, y, 0.);
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_rectangle2d
-(
- float x,
- float y,
- float w,
- float h
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_rectangle2d %d\n", ptrLayer->listIndex);
- printf ("\trectangle %f %f %f %f\n", x, y, w, h);
-#endif
-
- glRectf (x, y, x + w, y + h);
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_text2d ( Techar *s,
- float x,
- float y,
- float height )
-{
-#ifndef WNT
- Tint dispWidth, dispHeight;
-#endif
- GLdouble objx1, objy1, objz1;
-
- call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (!ptrLayer) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef TRACE_TEXT
- printf ("call_togl_text2d %d\n", ptrLayer->listIndex);
- printf ("\ttext %s %f %f %f\n", s, x, y, height);
-#endif
-
- OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
-
- FTGLLayerFontCurrent = textRender->FindFont( FTGLLayerFontName,
- FTGLLayerFontAspect,
- FTGLLayerFontHeight,
- FTGLLayerFontXScale,
- FTGLLayerFontYScale );
-
- objx1 = x,
- objy1 = y,
- objz1 = 0.0;
-
- //szv: conversion of Techar to wchar_t
- wchar_t *s1 = (wchar_t*)s;
- if (sizeof(Techar) != sizeof(wchar_t))
- {
- Tint i = 0; while (s[i++]);
- s1 = new wchar_t[i];
- i = 0; while (s1[i++] = (wchar_t)(*s++));
- }
-
- /*
- * On traite les differents types d'affichage de texte
- */
- switch (layerFontType) {
- case 0 : /* Aspect_TODT_Normal */
-#ifdef DEBUG
- printf ("---------------------\n");
- printf ("texte normal %f %f\n", objx1, objy1);
-#endif
-
- textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f );
-
- break;
- case 1 : /* Aspect_TODT_SubTitle */
-#ifdef OK
-#ifdef DEBUG
- printf ("---------------------\n");
- printf ("texte subtitle %f %f\n", objx1, objy1);
-#endif
- glGetIntegerv (GL_VIEWPORT, viewport);
- glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
- glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
-#ifdef TRACE_MAT
- printf ("viewport :\n");
- printf ("\t");
- for (i = 0; i < 4; i++)
- printf ("%d ", viewport[i]);
- printf ("\n");
- printf ("modelMatrix :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", modelMatrix[i*4+j]);
- printf ("\n");
- }
- printf ("projMatrix :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", projMatrix[i*4+j]);
- printf ("\n");
- }
-#endif
- /*
- * dimensionString("Methode cadre", &sWidth, &sAscent, &sDescent);
- */
- sWidth = 2.;
- sAscent = .2;
- sDescent = .2;
-
- objx2 = objx1; objy2 = objy1; objz2 = objz1;
- objx3 = objx1; objy3 = objy1; objz3 = objz1;
- objx4 = objx1; objy4 = objy1; objz4 = objz1;
- objx5 = objx1; objy5 = objy1; objz5 = objz1;
-
- status = gluProject (objx1, objy1, objz1,
- modelMatrix, projMatrix, viewport,
- &winx1, &winy1, &winz1);
-
- winx2 = winx1;
- winy2 = winy1-sDescent;
- winz2 = winz1+0.00001;
- status = gluUnProject (winx2, winy2, winz2,
- modelMatrix, projMatrix, viewport,
- &objx2, &objy2, &objz2);
-
- winx2 = winx1 + sWidth;
- winy2 = winy1-sDescent;
- winz2 = winz1+0.00001; /* il vaut mieux F+B / 1000000 ? */
- status = gluUnProject (winx2, winy2, winz2,
- modelMatrix, projMatrix, viewport,
- &objx3, &objy3, &objz3);
-
- winx2 = winx1 + sWidth;
- winy2 = winy1 + sAscent;
- winz2 = winz1+0.00001;
- status = gluUnProject (winx2, winy2, winz2,
- modelMatrix, projMatrix, viewport,
- &objx4, &objy4, &objz4);
-
- winx2 = winx1;
- winy2 = winy1+ sAscent;
- winz2 = winz1+0.00001;
- status = gluUnProject (winx2, winy2, winz2,
- modelMatrix, projMatrix, viewport,
- &objx5, &objy5, &objz5);
-
- glColor3f (layerFontRed, layerFontGreen, layerFontBlue);
- glBegin(GL_POLYGON);
- glVertex3d(objx2, objy2, objz2);
- glVertex3d(objx3, objy3, objz3);
- glVertex3d(objx4, objy4, objz4);
- glVertex3d(objx5, objy5, objz5);
- glEnd();
- glColor3f (layerRed, layerGreen, layerBlue);
-#endif /* OK */
-
- textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f);
-
- break;
- case 2 : /* Aspect_TODT_Dekale */
-#ifdef OK
-#ifdef DEBUG
- printf ("---------------------\n");
- printf ("texte dekale %f %f\n", objx1, objy1);
-#endif
- glGetIntegerv (GL_VIEWPORT, viewport);
- glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
- glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
-#ifdef DEBUG
- printf ("viewport :\n");
- printf ("\t");
- for (i = 0; i < 4; i++)
- printf ("%d ", viewport[i]);
- printf ("\n");
- printf ("modelMatrix :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", modelMatrix[i*4+j]);
- printf ("\n");
- }
- printf ("projMatrix :\n");
- for (i = 0; i < 4; i++) {
- printf ("\t");
- for (j = 0; j < 4; j++)
- printf ("%f ", projMatrix[i*4+j]);
- printf ("\n");
- }
-#endif
- status = gluProject (objx1, objy1, objz1,
- modelMatrix, projMatrix, viewport,
- &winx1, &winy1, &winz1);
-#ifdef DEBUG
- printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok"));
-#endif
- winx2 = winx1+1;
- winy2 = winy1+1;
- winz2 = winz1+0.00001;
- status = gluUnProject (winx2, winy2, winz2,
- modelMatrix, projMatrix, viewport,
- &objx2, &objy2, &objz2);
-#ifdef DEBUG
- printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok"));
-#endif
- glColor3f (layerFontRed, layerFontGreen, layerFontBlue);
-
-
- OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
- textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
-
-
- winx2 = winx1-1;
- winy2 = winy1-1;
- winz2 = winz1+0.00001;
- status = gluUnProject (winx2, winy2, winz2,
- modelMatrix, projMatrix, viewport,
- &objx2, &objy2, &objz2);
-#ifdef DEBUG
- printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok"));
-#endif
-
- textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
-
-
- winx2 = winx1-1;
- winy2 = winy1+1;
- winz2 = winz1+0.00001;
- status = gluUnProject (winx2, winy2, winz2,
- modelMatrix, projMatrix, viewport,
- &objx2, &objy2, &objz2);
-#ifdef DEBUG
- printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok"));
-#endif
-
-
- textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
-
- winx2 = winx1+1;
- winy2 = winy1-1;
- winz2 = winz1+0.00001;
- status = gluUnProject (winx2, winy2, winz2,
- modelMatrix, projMatrix, viewport,
- &objx2, &objy2, &objz2);
-#ifdef DEBUG
- printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok"));
-#endif
-
- textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f);
-
- glColor3f (layerRed, layerGreen, layerBlue);
-#endif /* OK */
-
- textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f);
-
-#ifdef DEBUG
- printf ("---------------------\n");
-#endif
- break;
- case 3 : /* Aspect_TODT_Blend */
-#ifdef OK
-#ifndef WNT
-#ifndef __sun
- if ( (PFNGLBLENDEQUATIONEXTPROC)glBlendEquationOp == (PFNGLBLENDEQUATIONEXTPROC)INVALID_EXT_FUNCTION_PTR )
- {
- if(QueryExtension("GL_EXT_blend_logic_op"))
- glBlendEquationOp = (PFNGLBLENDEQUATIONEXTPROC)glXGetProcAddress((GLubyte*)"glBlendEquationOp");
- else
- glBlendEquationOp = NULL;
- }
-
- if ( glBlendEquationOp )
-#endif //__sun
- {
- glEnable(GL_BLEND);
-#ifndef __sun
- glBlendEquationOp(GL_LOGIC_OP);
-#else
- glBlendEquation(GL_LOGIC_OP);
-#endif //__sun
- glLogicOp(GL_XOR);
- glColor3f (layerRed, layerGreen, layerBlue);
- glRasterPos2f (objx1, objy1);
- glDisable (GL_BLEND);
- }
-#else
- glColor3f (layerRed, layerGreen, layerBlue);
-
- textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f);
-
-
-#endif //WNT
-
-#else /* OK */
-#ifdef DEBUG
- printf ("---------------------\n");
- printf ("texte blend %f %f\n", objx1, objy1);
-#endif
-
- textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f);
-
-#ifdef DEBUG
- printf ("---------------------\n");
-#endif
-#endif /* OK */
- break;
- }
- //szv: delete temporary wide string
- if (sizeof(Techar) != sizeof(wchar_t))
- delete[] s1;
-}
-
-void EXPORT
-call_togl_textsize2d
-(
- Techar *s,
- float height,
- float *width,
- float *ascent,
- float *descent
- )
-{
-#ifndef WNT
- Tint dispWidth, dispHeight;
-#endif
-
- call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (!ptrLayer) return;
- if (ptrLayer->listIndex == 0) return;
-
- OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
-
- if ( FTGLLayerFontHeight != height || layerFontFlag == IsModified || FTGLLayerFontCurrent == 0 )
- {
- layerFontFlag = IsNotModified;
- FTGLLayerFontHeight = height;
- FTGLLayerFontCurrent = textRender -> FindFont(FTGLLayerFontName, FTGLLayerFontAspect, FTGLLayerFontHeight);
- }
-
- //szv: conversion of Techar to wchar_t
- wchar_t *s1 = (wchar_t*)s, *s2 = 0;
- if (sizeof(Techar) != sizeof(wchar_t))
- {
- Tint i = 0; while (s[i++]);
- s1 = s2 = new wchar_t[i];
- i = 0; while (s1[i++] = (wchar_t)(*s++));
- }
- textRender->StringSize(s1, &FTGLLayerFontWidth, &FTGLLayerFontAscent, &FTGLLayerFontDescent);
- //szv: delete temporary wide string
- if (s2) delete[] s2;
-
- *width = (float) FTGLLayerFontWidth;
- *ascent = (float) FTGLLayerFontAscent;
- *descent = (float) FTGLLayerFontDescent;
-
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_set_color
-(
- float r,
- float g,
- float b
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_set_color %d\n", ptrLayer->listIndex);
- printf ("\tcolor %f %f %f\n", r, g, b);
-#endif
-
- layerRed = r,
- layerGreen = g,
- layerBlue = b;
- glColor3f (r, g, b);
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_set_transparency
-(
- float a
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_set_transparency %d\n", ptrLayer->listIndex);
- printf ("\ttransparency %f\n", a);
-#endif
-
- glEnable (GL_BLEND);
- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glColor4f (layerRed, layerGreen, layerBlue, a);
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_unset_transparency
-(
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_set_untransparency %d\n", ptrLayer->listIndex);
-#endif
-
- glDisable (GL_BLEND);
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_set_line_attributes
-(
- long type,
- float width
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_set_line_attributes %d\n", ptrLayer->listIndex);
- printf ("\ttype, width %d %f\n", type, width);
-#endif
- if (layerType != type) {
- layerType = type;
- if (layerType == 0) { /* TOL_SOLID */
- glDisable (GL_LINE_STIPPLE);
- }
- else {
- if (layerType) {
- glCallList (linestyleBase+layerType);
- glEnable (GL_LINE_STIPPLE);
- }
- }
- }
- if (layerWidth != width) {
- layerWidth = width;
- glLineWidth ((GLfloat) layerWidth);
- }
-}
-
-/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_set_text_attributes
-(
- Tchar* font,
- long type,
- float r,
- float g,
- float b
- )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-#ifdef PRINT
- printf ("call_togl_set_text_attributes %d\n", ptrLayer->listIndex);
- printf ("\tfont %s type %ld\n", font, type);
- printf ("\tcolor %f %f %f\n", r, g, b);
-#endif
-
- if ( strcmp( (char*)FTGLLayerFontName, (char*)font ) != 0 ) {
- FTGLLayerFontName[0] = '\0';
- strcat( (char*)FTGLLayerFontName, (char*)font );
- FTGLLayerFontAspect = OSD_FA_Regular;
-
- OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
- FTGLLayerFontCurrent = textRender -> FindFont(FTGLLayerFontName, FTGLLayerFontAspect, FTGLLayerFontHeight);
-
- layerFontType = type;
- layerFontRed = r;
- layerFontGreen = g;
- layerFontBlue = b;
- layerFontFlag = IsModified;
- }
- else
- return;
-}
-
-void call_togl_set_text_attributes( Tchar* font,
- Tint height,
- OSD_FontAspect aspect,
- float r,
- float g,
- float b )
-{
- call_def_ptrLayer ptrLayer;
-
- ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
- if (ptrLayer == NULL) return;
- if (ptrLayer->listIndex == 0) return;
-
-#ifdef PRINT
- printf ("call_togl_set_text_attributes %d\n", ptrLayer->listIndex);
- printf ("\tfont %s type \n", font);
- printf ("\tcolor %f %f %f\n", r, g, b);
-#endif
- /*
- * On gere le type de font (ASCII !)
- */
- if ( strcmp( (char*)FTGLLayerFontName, (char*)font ) != 0 &&
- FTGLLayerFontAspect == aspect &&
- FTGLLayerFontHeight == height
- )
- {
- FTGLLayerFontName[0] = '\0';
- strcat( (char*)FTGLLayerFontName, (char*)font );
- FTGLLayerFontHeight = height;
- FTGLLayerFontAspect = aspect;
- layerFontFlag = IsModified;
- FTGLLayerFontXScale = FTGLLayerFontYScale = 1.f;
- OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
- FTGLLayerFontCurrent = textRender -> FindFont(FTGLLayerFontName, FTGLLayerFontAspect, FTGLLayerFontHeight);
-
- layerFontRed = r;
- layerFontGreen = g;
- layerFontBlue = b;
- }
-
-}
-
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-void EXPORT
-call_togl_bezier
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_LISTPOINTS * alpoints
- )
-{
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-void EXPORT
-call_togl_bezier_weight
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_LISTPOINTS * alpoints,
- CALL_DEF_LISTREALS * alweights
- )
-{
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-void EXPORT
-/* unimplemented. not possible in RGBmode */
-call_togl_blink
-(
- CALL_DEF_STRUCTURE * astructure,
- int create
- )
-{
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-
-void EXPORT
-call_togl_boundarybox
-(
- CALL_DEF_STRUCTURE * astructure,
- int create
- )
-{
-#define CALL_MAX_BOUNDBOXSIZE 16
-
- /* for the group */
- Tfloat liner, lineg, lineb;
- Tint linetype;
- Tfloat linewidth;
-
- /* for the structure */
- Tfloat Liner, Lineg, Lineb;
- Tint Linetype=0;
- Tfloat Linewidth;
-
- Tfloat Xm, Ym, Zm, XM, YM, ZM;
-
- CALL_DEF_LISTPOINTS alpoints;
- CALL_DEF_POINT points[CALL_MAX_BOUNDBOXSIZE];
-
- if( create )
- {
- Xm = astructure->BoundBox.Pmin.x;
- Ym = astructure->BoundBox.Pmin.y;
- Zm = astructure->BoundBox.Pmin.z;
- XM = astructure->BoundBox.Pmax.x;
- YM = astructure->BoundBox.Pmax.y;
- ZM = astructure->BoundBox.Pmax.z;
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( astructure->Id );
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( Structure_LABHighlight );
-
- liner = astructure->BoundBox.Color.r;
- lineg = astructure->BoundBox.Color.g;
- lineb = astructure->BoundBox.Color.b;
- linetype = CALL_PHIGS_LINE_SOLID;
- linewidth = ( float )1.0;
- call_subr_set_line_colr( liner, lineg, lineb );
- call_func_set_linetype( linetype );
- call_func_set_linewidth( linewidth );
-
- alpoints.NbPoints = CALL_MAX_BOUNDBOXSIZE;
- alpoints.TypePoints = 1;
- alpoints.UPoints.Points = points;
-
- points[ 0].x = Xm; points[ 0].y = Ym; points[ 0].z = Zm;
- points[ 1].x = Xm; points[ 1].y = Ym; points[ 1].z = ZM;
- points[ 2].x = Xm; points[ 2].y = YM; points[ 2].z = ZM;
- points[ 3].x = Xm; points[ 3].y = YM; points[ 3].z = Zm;
- points[ 4].x = Xm; points[ 4].y = Ym; points[ 4].z = Zm;
- points[ 5].x = XM; points[ 5].y = Ym; points[ 5].z = Zm;
- points[ 6].x = XM; points[ 6].y = Ym; points[ 6].z = ZM;
- points[ 7].x = XM; points[ 7].y = YM; points[ 7].z = ZM;
- points[ 8].x = XM; points[ 8].y = YM; points[ 8].z = Zm;
- points[ 9].x = XM; points[ 9].y = Ym; points[ 9].z = Zm;
- points[10].x = XM; points[10].y = YM; points[10].z = Zm;
- points[11].x = Xm; points[11].y = YM; points[11].z = Zm;
- points[12].x = Xm; points[12].y = YM; points[12].z = ZM;
- points[13].x = XM; points[13].y = YM; points[13].z = ZM;
- points[14].x = XM; points[14].y = Ym; points[14].z = ZM;
- points[15].x = Xm; points[15].y = Ym; points[15].z = ZM;
-
- call_subr_polyline( &alpoints );
-
- Liner = astructure->ContextLine.Color.r;
- Lineg = astructure->ContextLine.Color.g;
- Lineb = astructure->ContextLine.Color.b;
-
- switch( astructure->ContextLine.LineType )
- {
- case 0 : /* Aspect_TOL_SOLID */
- Linetype = CALL_PHIGS_LINE_SOLID;
- break;
- case 1 : /* Aspect_TOL_DASH */
- Linetype = CALL_PHIGS_LINE_DASH;
- break;
- case 2 : /* Aspect_TOL_DOT */
- Linetype = CALL_PHIGS_LINE_DOT;
- break;
- case 3 : /* Aspect_TOL_DOTDASH */
- Linetype = CALL_PHIGS_LINE_DASH_DOT;
- break;
- default :
- break;
- }
-
- Linewidth = (Tfloat)astructure->ContextLine.Width;
- call_subr_set_line_colr( Liner, Lineg, Lineb );
- call_func_set_linetype( Linetype );
- call_func_set_linewidth( Linewidth );
- call_func_close_struct();
- }
- else
- {
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- call_func_open_struct( astructure->Id );
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( Structure_LABHighlight );
- call_func_offset_elem_ptr( 1 );
- call_func_del_elem(); /* boundary box linecolor */
- call_func_offset_elem_ptr( 1 );
- call_func_del_elem(); /* boundary box linetype */
- call_func_offset_elem_ptr( 1 );
- call_func_del_elem(); /* boundary box linewidth */
- call_func_offset_elem_ptr( 1 );
- call_func_del_elem(); /* boundary box definition */
- call_func_offset_elem_ptr( 1 );
- call_func_del_elem(); /* structure linecolor */
- call_func_offset_elem_ptr( 1 );
- call_func_del_elem(); /* structure linetype */
- call_func_offset_elem_ptr( 1 );
- call_func_del_elem(); /* structure linewidth */
- call_func_close_struct();
- }
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_cleargroup.c :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_cleargroup
-(
- CALL_DEF_GROUP * agroup
- )
-{
- call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE);
- call_func_open_struct (agroup->Struct->Id);
- call_func_set_elem_ptr (0);
- call_func_del_elems_labels (agroup->LabelBegin, agroup->LabelEnd);
- call_func_close_struct ();
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-void EXPORT
-call_togl_clearstructure
-(
- CALL_DEF_STRUCTURE * astructure
- )
-{
- call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE);
- call_func_open_struct (astructure->Id);
- call_func_set_elem_ptr (0);
- call_func_del_elems_labels
- (astructure->GroupBegin, astructure->GroupEnd);
- call_func_close_struct ();
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_cliplimit.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : CAL ; Creation.
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-10-07-96 : FMN ; Suppression #define sur calcul matrice
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_telem_view.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables globales
-*/
-
-TEL_VIEW_REP call_viewrep;
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_cliplimit
-(
- CALL_DEF_VIEW * aview,
- int wait
- )
-{
- Tint waitwait;
-
- call_viewrep.clip_limit.xmin = ( float )0.0;
- call_viewrep.clip_limit.xmax = ( float )1.0;
- call_viewrep.clip_limit.ymin = ( float )0.0;
- call_viewrep.clip_limit.ymax = ( float )1.0;
-
- call_viewrep.clip_limit.zmax =
- ( aview->Context.ZClipFrontPlane - aview->Mapping.BackPlaneDistance ) /
- ( aview->Mapping.FrontPlaneDistance - aview->Mapping.BackPlaneDistance );
- call_viewrep.clip_limit.zmin =
- ( aview->Context.ZClipBackPlane - aview->Mapping.BackPlaneDistance ) /
- ( aview->Mapping.FrontPlaneDistance - aview->Mapping.BackPlaneDistance );
- if( call_viewrep.clip_limit.zmin < 0.0 )
- call_viewrep.clip_limit.zmin = ( float )0.0;
- if( call_viewrep.clip_limit.zmax > 1.0 )
- call_viewrep.clip_limit.zmax = ( float )1.0;
- if( call_viewrep.clip_limit.zmin > call_viewrep.clip_limit.zmax )
- {
- call_viewrep.clip_limit.zmin = ( float )0.0;
- call_viewrep.clip_limit.zmax = ( float )1.0;
- }
-
- call_viewrep.clip_xy = CALL_PHIGS_IND_NO_CLIP;
- call_viewrep.clip_back = CALL_PHIGS_IND_NO_CLIP;
- call_viewrep.clip_front = CALL_PHIGS_IND_NO_CLIP;
- if( aview->Context.BackZClipping )
- call_viewrep.clip_back = CALL_PHIGS_IND_CLIP;
- if( aview->Context.FrontZClipping )
- call_viewrep.clip_front = CALL_PHIGS_IND_CLIP;
-
- if( (!wait) && (aview->WsId != -1) )
- {
- waitwait = 1;
- call_togl_viewmapping( aview, waitwait );
- call_togl_vieworientation( aview, waitwait );
- TelSetViewRepresentation( aview->WsId, aview->ViewId, &call_viewrep );
- }
- return;
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-/*
-call_togl_closegroup (agroup)
-CALL_DEF_GROUP * agroup
-
-Opens the associated structure and sets the pointer
-at the end of the primitives.
-
-Method :
-
-- go to the end of the group in the specified structure.
-- skip the structure element which set all attributes of the structure.
-
-*/
-
-void EXPORT
-call_togl_closegroup
-(
- CALL_DEF_GROUP * agroup
- )
-{
- call_func_close_struct ();
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-void EXPORT
-call_togl_connect
-(
- CALL_DEF_STRUCTURE * afather,
- CALL_DEF_STRUCTURE * ason
- )
-{
- call_func_set_edit_mode (CALL_PHIGS_EDIT_INSERT);
- call_func_open_struct (afather->Id);
- call_func_set_elem_ptr (0);
- call_func_set_elem_ptr_label (Structure_LABConnect);
- call_func_exec_struct (ason->Id);
- call_func_close_struct ();
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_contextstructure.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-05-08-97 : PCT ; Support texture mapping
-23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
-30-12-97 : FMN ; CTS18312: Correction back material
-15-01-98 : FMN ; Ajout Hidden line
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-08-04-98 : FGU ; Ajout Emission
-30-11-98 : FMN ; S4069 : Textes toujours visibles
-02.14.100 : JR : Warnings on WNT #include ,stdio.h>
-22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets
-
-************************************************************************/
-
-#define OCC1174 /* SAV 08/01/03 : Added back face interior color management*/
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <stdio.h>
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-
-#include <OSD_FontAspect.hxx>
-
-
-void EXPORT
-call_togl_contextstructure
-(
- CALL_DEF_STRUCTURE * astructure
- )
-{
- Tfloat liner, lineg, lineb;
- Tfloat fillr, fillg, fillb;
-#ifdef OCC1174
- Tfloat fillBackr, fillBackg, fillBackb;
-#endif
- Tint linetype=0;
- Tint intstyle=0;
- Tfloat linewidth;
- Tint hatch=0;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- Tint polyOffsetMode;
- Tfloat polyOffsetFactor, polyOffsetUnits;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- Tfloat markr, markg, markb;
- Tint markertype=0;
- Tfloat markerscale;
-
- Tchar *fontid=NULL;
- Tfloat textr, textg, textb;
- Tfloat textrs, textgs, textbs;
- Tfloat textspace;
- Tfloat textexpan;
- int textstyle, textdisplaytype;
- Tint textzoomable;
- Tfloat textangle;
- OSD_FontAspect textfontaspect;
- /* Flag de mise a jour des composants materiel */
- Tint lightbool = 0x0;
- CALL_DEF_TRANSFORM_PERSISTENCE transPers = astructure->TransformPersistence;
-
- /* Destruction */
- if( astructure->ContextLine.IsDef == -1 )
- {
- }
- if( astructure->ContextFillArea.IsDef == -1 )
- {
- }
- if( astructure->ContextMarker.IsDef == -1 )
- {
- }
- if( astructure->ContextText.IsDef == -1 )
- {
- }
- call_func_open_struct( astructure->Id );
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( Structure_LABTransPersistence );
- if( astructure->TransformPersistence.IsSet == 1 )
- {
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- call_func_offset_elem_ptr( 1 );
- }
- else
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- /*call_func_set_transform_persistence( transPersFlag );*/
- call_func_set_transform_persistence( transPers.Flag, transPers.Point.x, transPers.Point.y, transPers.Point.z );
- call_func_close_struct();
- /* }*/
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- if( astructure->ContextLine.IsDef == 1 )
- {
- liner = astructure->ContextLine.Color.r;
- lineg = astructure->ContextLine.Color.g;
- lineb = astructure->ContextLine.Color.b;
-
- switch( astructure->ContextLine.LineType )
- {
- case 0 : /* Aspect_TOL_SOLID */
- linetype = CALL_PHIGS_LINE_SOLID;
- break;
- case 1 : /* Aspect_TOL_DASH */
- linetype = CALL_PHIGS_LINE_DASH;
- break;
- case 2 : /* Aspect_TOL_DOT */
- linetype = CALL_PHIGS_LINE_DOT;
- break;
- case 3 : /* Aspect_TOL_DOTDASH */
- linetype = CALL_PHIGS_LINE_DASH_DOT;
- break;
- default :
- break;
- }
-
- linewidth = (Tfloat)astructure->ContextLine.Width;
-
- if( astructure->ContextLine.IsSet )
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- else
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( astructure->Id );
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( Structure_LABContextLine );
-
- if( astructure->ContextLine.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_line_colr( liner, lineg, lineb );
- if( astructure->ContextLine.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_linetype( linetype );
- if( astructure->ContextLine.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_linewidth( linewidth );
- call_func_close_struct();
- }
-
- if( astructure->ContextFillArea.IsDef == 1 )
- {
- switch( astructure->ContextFillArea.Style )
- {
- case 0 : /* Aspect_IS_EMPTY */
- intstyle = CALL_PHIGS_STYLE_EMPTY;
- break;
- case 1 : /* Aspect_IS_HOLLOW */
- intstyle = CALL_PHIGS_STYLE_HOLLOW;
- break;
- case 2 : /* Aspect_IS_HATCH */
- intstyle = CALL_PHIGS_STYLE_HATCH;
- break;
- case 3 : /* Aspect_IS_SOLID */
- intstyle = CALL_PHIGS_STYLE_SOLID;
- break;
- case 4 : /* Aspect_IS_HIDDENLINE */
- intstyle = CALL_PHIGS_STYLE_HIDDENLINE;
- break;
- default :
- break;
- }
-
- switch( astructure->ContextFillArea.Hatch )
- {
- case 0 : /* Aspect_HS_HORIZONTAL */
- hatch = CALL_PHIGS_HATCH_HORIZ;
- break;
- case 1 : /* Aspect_HS_HORIZONTAL_WIDE */
- hatch = CALL_PHIGS_HATCH_HORIZ_DBL;
- break;
- case 2 : /* Aspect_HS_VERTICAL */
- hatch = CALL_PHIGS_HATCH_VERT;
- break;
- case 3 : /* Aspect_HS_VERTICAL_WIDE */
- hatch = CALL_PHIGS_HATCH_VERT_DBL;
- break;
- case 4 : /* Aspect_HS_DIAGONAL_45 */
- hatch = CALL_PHIGS_HATCH_DIAG_45;
- break;
- case 5 : /* Aspect_HS_DIAGONAL_45_WIDE */
- hatch = CALL_PHIGS_HATCH_DIAG_45_DBL;
- break;
- case 6 : /* Aspect_HS_DIAGONAL_135 */
- hatch = CALL_PHIGS_HATCH_DIAG_135;
- break;
- case 7 : /* Aspect_HS_DIAGONAL_135_WIDE */
- hatch = CALL_PHIGS_HATCH_DIAG_135_DBL;
- break;
- case 8 : /* Aspect_HS_GRID */
- hatch = CALL_PHIGS_HATCH_GRID_R;
- break;
- case 9 : /* Aspect_HS_GRID_WIDE */
- hatch = CALL_PHIGS_HATCH_GRID_R_DBL;
- break;
- case 10 : /* Aspect_HS_GRID_DIAGONAL */
- hatch = CALL_PHIGS_HATCH_GRID_D;
- break;
- case 11 : /* Aspect_HS_GRID_DIAGONAL_WIDE */
- hatch = CALL_PHIGS_HATCH_GRID_D_DBL;
- break;
- default :
- break;
- }
-
- fillr = astructure->ContextFillArea.IntColor.r;
- fillg = astructure->ContextFillArea.IntColor.g;
- fillb = astructure->ContextFillArea.IntColor.b;
-
-#ifdef OCC1174
- fillBackr = astructure->ContextFillArea.BackIntColor.r;
- fillBackg = astructure->ContextFillArea.BackIntColor.g;
- fillBackb = astructure->ContextFillArea.BackIntColor.b;
-#endif
-
- liner = astructure->ContextFillArea.EdgeColor.r;
- lineg = astructure->ContextFillArea.EdgeColor.g;
- lineb = astructure->ContextFillArea.EdgeColor.b;
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- polyOffsetMode = astructure->ContextFillArea.PolygonOffsetMode;
- polyOffsetFactor = astructure->ContextFillArea.PolygonOffsetFactor;
- polyOffsetUnits = astructure->ContextFillArea.PolygonOffsetUnits;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- switch( astructure->ContextFillArea.LineType )
- {
- case 0 : /* Aspect_TOL_SOLID */
- linetype = CALL_PHIGS_LINE_SOLID;
- break;
- case 1 : /* Aspect_TOL_DASH */
- linetype = CALL_PHIGS_LINE_DASH;
- break;
- case 2 : /* Aspect_TOL_DOT */
- linetype = CALL_PHIGS_LINE_DOT;
- break;
- case 3 : /* Aspect_TOL_DOTDASH */
- linetype = CALL_PHIGS_LINE_DASH_DOT;
- break;
- default :
- break;
- }
-
- linewidth = (Tfloat)astructure->ContextFillArea.Width;
-
- if( astructure->ContextFillArea.IsSet )
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- else
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( astructure->Id );
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( Structure_LABContextFillArea );
-
- /* interior */
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_int_style( intstyle );
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_int_colr( fillr, fillg, fillb, ( float )1.0 );
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
-#ifdef OCC1174
- call_subr_set_back_int_colr( fillBackr, fillBackg, fillBackb, ( float )1.0 );
-#else
- call_subr_set_back_int_colr( fillr, fillg, fillb, ( float )1.0 );
-#endif
- /* edge */
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( astructure->ContextFillArea.Edge )
- call_func_set_edge_flag( CALL_PHIGS_EDGE_ON );
- else
- call_func_set_edge_flag( CALL_PHIGS_EDGE_OFF );
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_edge_colr( liner, lineg, lineb );
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_edge_type( linetype );
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_edgewidth( linewidth );
- /* hatch */
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( intstyle == CALL_PHIGS_STYLE_HATCH )
- call_func_set_int_style_ind( hatch );
- else
- call_func_appl_data( 0 );
- /* front and back face */
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( astructure->ContextFillArea.Distinguish )
- call_func_set_face_disting_mode(CALL_PHIGS_DISTING_YES);
- else
- call_func_set_face_disting_mode(CALL_PHIGS_DISTING_NO);
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( astructure->ContextFillArea.BackFace )
- call_func_set_face_cull_mode(CALL_PHIGS_CULL_BACKFACE);
- else
- call_func_set_face_cull_mode( CALL_PHIGS_CULL_NONE );
- /* front face */
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
-
- /* Front face */
- /* Gestion Lumiere */
- if( astructure->ContextFillArea.Front.IsAmbient )
- lightbool = lightbool | AMBIENT_MASK;
-
- if( astructure->ContextFillArea.Front.IsDiffuse )
- lightbool = lightbool | DIFFUSE_MASK;
-
- if( astructure->ContextFillArea.Front.IsSpecular )
- lightbool = lightbool | SPECULAR_MASK;
-
- if( astructure->ContextFillArea.Front.IsEmission )
- lightbool = lightbool | EMISSIVE_MASK;
-
- if( !lightbool )
- call_func_set_refl_eqn( CALL_PHIGS_REFL_NONE );
- else
- call_func_set_refl_eqn( lightbool );
-
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_refl_props( &astructure->ContextFillArea.Front, 0 );
-
- /* back face */
- /* Gestion lumiere */
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
-
- if( astructure->ContextFillArea.Back.IsAmbient )
- lightbool = lightbool | AMBIENT_MASK;
-
- if( astructure->ContextFillArea.Back.IsDiffuse )
- lightbool = lightbool | DIFFUSE_MASK;
-
- if( astructure->ContextFillArea.Back.IsSpecular )
- lightbool = lightbool | SPECULAR_MASK;
-
- if( astructure->ContextFillArea.Back.IsEmission )
- lightbool = lightbool | EMISSIVE_MASK;
-
- if( !lightbool )
- call_func_set_back_refl_eqn( CALL_PHIGS_REFL_NONE );
- else
- call_func_set_back_refl_eqn( lightbool );
-
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_refl_props( &astructure->ContextFillArea.Back, 1 );
-
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_do_texturemap(astructure->ContextFillArea.Texture.doTextureMap);
-
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_texture_id(astructure->ContextFillArea.Texture.TexId);
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- if( astructure->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_polygon_offset_params( polyOffsetMode, polyOffsetFactor, polyOffsetUnits );
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- call_func_close_struct();
- }
-
- if( astructure->ContextMarker.IsDef == 1 )
- {
- markr = astructure->ContextMarker.Color.r;
- markg = astructure->ContextMarker.Color.g;
- markb = astructure->ContextMarker.Color.b;
-
- switch( astructure->ContextMarker.MarkerType )
- {
- case 0 : /* Aspect_TOM_POINT */
- markertype = CALL_PHIGS_MARKER_DOT;
- break;
- case 1 : /* Aspect_TOM_PLUS */
- markertype = CALL_PHIGS_MARKER_PLUS;
- break;
- case 2 : /* Aspect_TOM_STAR */
- markertype = CALL_PHIGS_MARKER_ASTERISK;
- break;
- case 3 : /* Aspect_TOM_O */
- markertype = CALL_PHIGS_MARKER_CIRCLE;
- break;
- case 4 : /* Aspect_TOM_X */
- markertype = CALL_PHIGS_MARKER_CROSS;
- break;
- case 5 : /* Aspect_TOM_USERDEFINED*/
- markertype = CALL_PHIGS_MARKER_USER_DEFINED;
- break;
- default :
- printf( "\n\tINVALID MARKER TYPE %d",
- astructure->ContextMarker.MarkerType );
- break;
- }
-
- markerscale = (Tfloat)astructure->ContextMarker.Scale;
-
- if( astructure->ContextMarker.IsSet )
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- else
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( astructure->Id );
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( Structure_LABContextMarker );
- if( astructure->ContextMarker.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_marker_colr( markr, markg, markb );
- if( astructure->ContextMarker.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_marker_type( markertype );
- if( astructure->ContextMarker.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_marker_size( markerscale );
- call_func_close_struct();
- }
-
-#ifdef TRACE
- cout << "TKOpenGl::OpenGl_togl_contextstructure"
- << "\t is defined : " << astructure->ContextText.IsDef << endl;
-#endif
- if( astructure->ContextText.IsDef == 1 )
- {
- textr = astructure->ContextText.Color.r;
- textg = astructure->ContextText.Color.g;
- textb = astructure->ContextText.Color.b;
-
- textrs = astructure->ContextText.ColorSubTitle.r;
- textgs = astructure->ContextText.ColorSubTitle.g;
- textbs = astructure->ContextText.ColorSubTitle.b;
-
- fontid = new Tchar[strlen((char*)astructure->ContextText.Font)+1];
- strcpy((char*)fontid,(char*)astructure->ContextText.Font);
-
- textspace = (Tfloat)astructure->ContextText.Space;
- textexpan = (Tfloat)astructure->ContextText.Expan;
- textstyle = (int) astructure->ContextText.Style;
- textdisplaytype = (int) astructure->ContextText.DisplayType;
- textzoomable = (int) astructure->ContextText.TextZoomable;
- textangle = (float) astructure->ContextText.TextAngle;
- textfontaspect = (OSD_FontAspect)astructure->ContextText.TextFontAspect;
-
- if( astructure->ContextText.IsSet )
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- else
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( astructure->Id );
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( Structure_LABContextText );
- if( astructure->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_zoomable( textzoomable );
- call_func_set_text_angle( textangle );
- call_func_set_text_fontaspect( textfontaspect );
-
- if( astructure->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_font( fontid );
- if( astructure->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_char_space( textspace );
- if( astructure->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_char_expan( textexpan );
- if( astructure->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_text_colr( textr, textg, textb );
- if( astructure->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_style( textstyle );
- if( astructure->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_display_type( textdisplaytype );
- if( astructure->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_text_colr_subtitle( textrs, textgs, textbs );
-
- call_func_close_struct();
- }
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_curve
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_LISTPOINTS * alpoints
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- call_subr_curve (alpoints);
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_deactivateview.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : CAL ; Creation.
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-void EXPORT
-call_togl_deactivateview
-(
- CALL_DEF_VIEW * aview
- )
-{
- if (aview->WsId != -1)
- call_func_post_struct (aview->WsId, -1, ( float )1.0);
- return;
-}
+++ /dev/null
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl.hxx>
-
-void EXPORT call_togl_degeneratestructure ( CALL_DEF_STRUCTURE* astructure ) {
-
- call_func_set_edit_mode ( CALL_PHIGS_EDIT_REPLACE );
- call_func_open_struct ( astructure -> Id );
- call_func_set_elem_ptr ( 0 );
- call_func_set_elem_ptr_label ( Structure_LABDegenerateModel );
- call_func_offset_elem_ptr ( 1 );
- call_func_set_degenerate_model (
- astructure -> ContextFillArea.DegenerationMode,
- astructure -> ContextFillArea.SkipRatio
- );
- call_func_close_struct ();
-
-} /* end call_togl_degeneratestructure */
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_depthcueing.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : CAL ; Creation.
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-
-void EXPORT
-call_togl_depthcueing
-(
- CALL_DEF_VIEW * aview,
- int tag
- )
-{
- call_subr_depthcueing (aview, tag);
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_depthtest :
-GL_DEPTH_TEST
-+
-GL_LIGHTING
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-22-10-01 : SAV ; Creation.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-
-#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
-from higher API */
-#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
-from higher API */
-
-#ifdef BUC61044
-void EXPORT call_togl_depthtest( CALL_DEF_VIEW *aview, Tint dFlag )
-{
- CMN_KEY_DATA key;
-
- key.ldata = dFlag;
-
- TsmSetWSAttri( aview->WsId, WSDepthTest, &key );
-}
-
-Tint EXPORT call_togl_isdepthtest( CALL_DEF_VIEW *aview )
-{
- CMN_KEY_DATA key;
-
- TsmGetWSAttri( aview->WsId, WSDepthTest, &key );
-
- return key.ldata;
-}
-#endif
-
-#ifdef BUC61045
-void EXPORT call_togl_gllight( CALL_DEF_VIEW *aview, Tint dFlag )
-{
- CMN_KEY_DATA key;
-
- key.ldata = dFlag;
-
- TsmSetWSAttri( aview->WsId, WSGLLight, &key );
-}
-
-Tint EXPORT call_togl_isgllight( CALL_DEF_VIEW *aview )
-{
- CMN_KEY_DATA key;
-
- TsmGetWSAttri( aview->WsId, WSGLLight, &key );
-
- return key.ldata;
-}
-#endif
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-
-void EXPORT
-call_togl_disconnect
-(
- CALL_DEF_STRUCTURE * afather,
- CALL_DEF_STRUCTURE * ason
- )
-{
- Tint i;
-
- if (call_subr_get_exec_struct (afather->Id, ason->Id, &i) == TSuccess) {
- call_func_open_struct (afather->Id);
- call_func_set_elem_ptr (i);
- call_func_del_elem ();
- call_func_close_struct ();
- }
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_displaystructure.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : CAL ; Creation.
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-10-04-97 : CAL ; Modification pour que last draw => last execute.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_telem_view.hxx>
-
-void EXPORT
-call_togl_displaystructure
-(
- CALL_DEF_VIEW *aview,
- int StructId,
- int Priority
- )
-{
- int labelPriority;
-
- switch (Priority) {
- case 0 : labelPriority = View_LABPriority01; break;
- case 1 : labelPriority = View_LABPriority02; break;
- case 2 : labelPriority = View_LABPriority03; break;
- case 3 : labelPriority = View_LABPriority04; break;
- case 4 : labelPriority = View_LABPriority05; break;
- case 5 : labelPriority = View_LABPriority06; break;
- case 6 : labelPriority = View_LABPriority07; break;
- case 7 : labelPriority = View_LABPriority08; break;
- case 8 : labelPriority = View_LABPriority09; break;
- case 9 : labelPriority = View_LABPriority10; break;
- case 10: labelPriority = View_LABEnd; break;
-
- default: labelPriority = Priority; break;
- }
-
- call_func_set_edit_mode (CALL_PHIGS_EDIT_INSERT);
- call_func_open_struct (aview->ViewId);
- call_func_set_elem_ptr (0);
- call_func_set_elem_ptr_label (labelPriority);
- call_func_offset_elem_ptr (-1);
- call_func_exec_struct (StructId);
- call_func_close_struct ();
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_element_exploration :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_elems.hxx>
-
-void EXPORT
-call_togl_element_exploration
-(
- long Id,
- long elem_num,
- long *type,
- CALL_DEF_POINT *pt,
- CALL_DEF_NORMAL *npt,
- CALL_DEF_COLOR *cpt,
- CALL_DEF_NORMAL *nfa
- )
-{
- call_subr_structure_exploration (Id, 0, 0, elem_num, (Tint *)type,
- pt, npt, cpt, nfa);
-
- switch( *type )
- {
- case CALL_PHIGS_ELEM_POLYLINE_SET3_DATA :
- *type = 1;
- break;
-
- case CALL_PHIGS_ELEM_FILL_AREA3 :
- *type = 2;
- break;
-
- case CALL_PHIGS_ELEM_TRI_STRIP3_DATA :
- *type = 3;
- break;
-
- case CALL_PHIGS_ELEM_QUAD_MESH3_DATA :
- *type = 4;
- break;
-
- case CALL_PHIGS_ELEM_ANNO_TEXT_REL3 :
- *type = 5;
- break;
-
- case CALL_PHIGS_ELEM_POLYMARKER3 :
- *type = 6;
- break;
-
- default :
- *type = 0;
- break;
- }
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_displaystructure.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : CAL ; Creation.
-05-02-97 : FMN ; Suppression includes
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-void EXPORT
-call_togl_end ()
-{
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-
-void EXPORT
-call_togl_erasestructure
-(
- int ViewId,
- int StructId
- )
-{
- Tint i;
-
- if (call_subr_get_exec_struct (ViewId, StructId, &i) == TSuccess) {
- call_func_open_struct (ViewId);
- call_func_set_elem_ptr (i);
- call_func_del_elem ();
- call_func_close_struct ();
- }
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_facecontextgroup :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-03-09-97 : FMN ; Ajout traitement Begin/EndPrimitives()
-05-08-97 : PCT ; ajout texture mapping
-23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
-30-12-97 : FMN ; CTS18312: Correction back material
-15-01-98 : FMN ; Ajout Hidden line
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-08-04-98 : FGU ; Ajout emission
-22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets
-
-************************************************************************/
-
-#define OCC1174 /* SAV 08/01/03 : Added back face interior color management */
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_context.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_facecontextgroup
-(
- CALL_DEF_GROUP * agroup,
- int noinsert
- )
-{
- /* for the group */
- Tfloat liner, lineg, lineb;
- Tint linetype=0;
- Tfloat linewidth;
- Tfloat fillr, fillg, fillb;
-#ifdef OCC1174
- Tfloat fillBackr, fillBackg, fillBackb;
-#endif
- Tint intstyle=0;
- Tint hatch=0;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- Tint polyOffsetMode;
- Tfloat polyOffsetFactor, polyOffsetUnits;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- /* for the structure */
- Tfloat Liner, Lineg, Lineb;
- Tint Linetype=0;
- Tfloat Linewidth;
- Tfloat Fillr, Fillg, Fillb;
-#ifdef OCC1174
- Tfloat FillBackr, FillBackg, FillBackb;
-#endif
- Tint Intstyle=0;
- Tint Hatch=0;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- Tint PolyOffsetMode;
- Tfloat PolyOffsetFactor, PolyOffsetUnits;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- /* Flag sur les composants lumineux du materiel */
- Tint lightbool = 0x0;
-
- /*
- * Si le groupe est ouvert cela signifie que BeginPrimitives
- * a ete utilise.
- * Dans le cas des markers composes, il faut refermer temporairement
- * le groupe pour eviter des insertions d'attributs aleatoires.
- */
- if (agroup->IsOpen) call_togl_closegroup (agroup);
-
- if( agroup->ContextFillArea.IsDef )
- {
- /* recuperation du contexte du group */
- /* pour les primitives fill area */
-
- switch( agroup->ContextFillArea.Style )
- {
- case 0 : /* Aspect_IS_EMPTY */
- intstyle = CALL_PHIGS_STYLE_EMPTY;
- break;
- case 1 : /* Aspect_IS_HOLLOW */
- intstyle = CALL_PHIGS_STYLE_HOLLOW;
- break;
- case 2 : /* Aspect_IS_HATCH */
- intstyle = CALL_PHIGS_STYLE_HATCH;
- break;
- case 3 : /* Aspect_IS_SOLID */
- intstyle = CALL_PHIGS_STYLE_SOLID;
- break;
- case 4 : /* Aspect_IS_HIDDENLINE */
- intstyle = CALL_PHIGS_STYLE_HIDDENLINE;
- break;
- default :
- break;
- }
-
- switch( agroup->ContextFillArea.Hatch )
- {
- case 0 : /* Aspect_HS_HORIZONTAL */
- hatch = CALL_PHIGS_HATCH_HORIZ;
- break;
- case 1 : /* Aspect_HS_HORIZONTAL_WIDE */
- hatch = CALL_PHIGS_HATCH_HORIZ_DBL;
- break;
- case 2 : /* Aspect_HS_VERTICAL */
- hatch = CALL_PHIGS_HATCH_VERT;
- break;
- case 3 : /* Aspect_HS_VERTICAL_WIDE */
- hatch = CALL_PHIGS_HATCH_VERT_DBL;
- break;
- case 4 : /* Aspect_HS_DIAGONAL_45 */
- hatch = CALL_PHIGS_HATCH_DIAG_45;
- break;
- case 5 : /* Aspect_HS_DIAGONAL_45_WIDE */
- hatch = CALL_PHIGS_HATCH_DIAG_45_DBL;
- break;
- case 6 : /* Aspect_HS_DIAGONAL_135 */
- hatch = CALL_PHIGS_HATCH_DIAG_135;
- break;
- case 7 : /* Aspect_HS_DIAGONAL_135_WIDE */
- hatch = CALL_PHIGS_HATCH_DIAG_135_DBL;
- break;
- case 8 : /* Aspect_HS_GRID */
- hatch = CALL_PHIGS_HATCH_GRID_R;
- break;
- case 9 : /* Aspect_HS_GRID_WIDE */
- hatch = CALL_PHIGS_HATCH_GRID_R_DBL;
- break;
- case 10 : /* Aspect_HS_GRID_DIAGONAL */
- hatch = CALL_PHIGS_HATCH_GRID_D;
- break;
- case 11 : /* Aspect_HS_GRID_DIAGONAL_WIDE */
- hatch = CALL_PHIGS_HATCH_GRID_D_DBL;
- break;
- default :
- break;
- }
-
- fillr = agroup->ContextFillArea.IntColor.r;
- fillg = agroup->ContextFillArea.IntColor.g;
- fillb = agroup->ContextFillArea.IntColor.b;
-
-#ifdef OCC1174
- fillBackr = agroup->ContextFillArea.BackIntColor.r;
- fillBackg = agroup->ContextFillArea.BackIntColor.g;
- fillBackb = agroup->ContextFillArea.BackIntColor.b;
-#endif
-
- liner = agroup->ContextFillArea.EdgeColor.r;
- lineg = agroup->ContextFillArea.EdgeColor.g;
- lineb = agroup->ContextFillArea.EdgeColor.b;
-
- switch( agroup->ContextFillArea.LineType )
- {
- case 0 : /* Aspect_TOL_SOLID */
- linetype = CALL_PHIGS_LINE_SOLID;
- break;
- case 1 : /* Aspect_DASH */
- linetype = CALL_PHIGS_LINE_DASH;
- break;
- case 2 : /* Aspect_TOL_DOT */
- linetype = CALL_PHIGS_LINE_DOT;
- break;
- case 3 : /* Aspect_TOL_DOTDASH */
- linetype = CALL_PHIGS_LINE_DASH_DOT;
- break;
- default :
- break;
- }
-
- linewidth =( Tfloat ) agroup->ContextFillArea.Width;
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- polyOffsetMode = agroup->ContextFillArea.PolygonOffsetMode;
- polyOffsetFactor = agroup->ContextFillArea.PolygonOffsetFactor;
- polyOffsetUnits = agroup->ContextFillArea.PolygonOffsetUnits;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- switch( agroup->Struct->ContextFillArea.Style )
- {
- case 0 : /* Aspect_IS_EMPTY */
- Intstyle = CALL_PHIGS_STYLE_EMPTY;
- break;
- case 1 : /* Aspect_IS_HOLLOW */
- Intstyle = CALL_PHIGS_STYLE_HOLLOW;
- break;
- case 2 : /* Aspect_IS_HATCH */
- Intstyle = CALL_PHIGS_STYLE_HATCH;
- break;
- case 3 : /* Aspect_IS_SOLID */
- Intstyle = CALL_PHIGS_STYLE_SOLID;
- break;
- case 4 : /* Aspect_IS_HIDDENLINE */
- intstyle = CALL_PHIGS_STYLE_HIDDENLINE;
- break;
- default :
- break;
- }
-
- switch( agroup->Struct->ContextFillArea.Hatch )
- {
- case 0 : /* Aspect_HS_HORIZONTAL */
- Hatch = CALL_PHIGS_HATCH_HORIZ;
- break;
- case 1 : /* Aspect_HS_HORIZONTAL_WIDE */
- Hatch = CALL_PHIGS_HATCH_HORIZ_DBL;
- break;
- case 2 : /* Aspect_HS_VERTICAL */
- Hatch = CALL_PHIGS_HATCH_VERT;
- break;
- case 3 : /* Aspect_HS_VERTICAL_WIDE */
- Hatch = CALL_PHIGS_HATCH_VERT_DBL;
- break;
- case 4 : /* Aspect_HS_DIAGONAL_45 */
- Hatch = CALL_PHIGS_HATCH_DIAG_45;
- break;
- case 5 : /* Aspect_HS_DIAGONAL_45_WIDE */
- Hatch = CALL_PHIGS_HATCH_DIAG_45_DBL;
- break;
- case 6 : /* Aspect_HS_DIAGONAL_135 */
- Hatch = CALL_PHIGS_HATCH_DIAG_135;
- break;
- case 7 : /* Aspect_HS_DIAGONAL_135_WIDE */
- Hatch = CALL_PHIGS_HATCH_DIAG_135_DBL;
- break;
- case 8 : /* Aspect_HS_GRID */
- Hatch = CALL_PHIGS_HATCH_GRID_R;
- break;
- case 9 : /* Aspect_HS_GRID_WIDE */
- Hatch = CALL_PHIGS_HATCH_GRID_R_DBL;
- break;
- case 10 : /* Aspect_HS_GRID_DIAGONAL */
- Hatch = CALL_PHIGS_HATCH_GRID_D;
- break;
- case 11 : /* Aspect_HS_GRID_DIAGONAL_WIDE */
- Hatch = CALL_PHIGS_HATCH_GRID_D_DBL;
- break;
- default :
- break;
- }
-
- Fillr = agroup->Struct->ContextFillArea.IntColor.r;
- Fillg = agroup->Struct->ContextFillArea.IntColor.g;
- Fillb = agroup->Struct->ContextFillArea.IntColor.b;
-
-#ifdef OCC1174
- FillBackr = agroup->Struct->ContextFillArea.BackIntColor.r;
- FillBackg = agroup->Struct->ContextFillArea.BackIntColor.g;
- FillBackb = agroup->Struct->ContextFillArea.BackIntColor.b;
-#endif
-
- Liner = agroup->Struct->ContextFillArea.EdgeColor.r;
- Lineg = agroup->Struct->ContextFillArea.EdgeColor.g;
- Lineb = agroup->Struct->ContextFillArea.EdgeColor.b;
-
- switch( agroup->Struct->ContextFillArea.LineType )
- {
- case 0 : /* Aspect_TOL_SOLID */
- Linetype = CALL_PHIGS_LINE_SOLID;
- break;
- case 1 : /* Aspect_DASH */
- Linetype = CALL_PHIGS_LINE_DASH;
- break;
- case 2 : /* Aspect_TOL_DOT */
- Linetype = CALL_PHIGS_LINE_DOT;
- break;
- case 3 : /* Aspect_TOL_DOTDASH */
- Linetype = CALL_PHIGS_LINE_DASH_DOT;
- break;
- default :
- break;
- }
-
- Linewidth =( Tfloat ) agroup->Struct->ContextFillArea.Width;
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- PolyOffsetMode = agroup->Struct->ContextFillArea.PolygonOffsetMode;
- PolyOffsetFactor = agroup->Struct->ContextFillArea.PolygonOffsetFactor;
- PolyOffsetUnits = agroup->Struct->ContextFillArea.PolygonOffsetUnits;
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- if( noinsert == 1 )
- {
- if( agroup->ContextFillArea.IsSet )
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- else
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( agroup->Struct->Id );
-
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( agroup->LabelBegin );
- if( agroup->PickId.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE );
- /* interior */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_int_style( intstyle );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_int_colr( fillr, fillg, fillb, ( float )1.0 );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
-#ifdef OCC1174
- call_subr_set_back_int_colr( fillBackr, fillBackg, fillBackb, ( float )1.0 );
-#else
- call_subr_set_back_int_colr( fillr, fillg, fillb, ( float )1.0 );
-#endif
- /* edge */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( agroup->ContextFillArea.Edge )
- call_func_set_edge_flag( CALL_PHIGS_EDGE_ON );
- else
- call_func_set_edge_flag( CALL_PHIGS_EDGE_OFF );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_edge_colr( liner, lineg, lineb );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_edge_type( linetype );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_edgewidth( linewidth );
- /* hatch */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( intstyle == CALL_PHIGS_STYLE_HATCH )
- call_func_set_int_style_ind( hatch );
- else
- call_func_appl_data( 0 );
-
- /* front and back face */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( agroup->ContextFillArea.Distinguish )
- call_func_set_face_disting_mode( CALL_PHIGS_DISTING_YES );
- else
- call_func_set_face_disting_mode( CALL_PHIGS_DISTING_NO );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( agroup->ContextFillArea.BackFace )
- call_func_set_face_cull_mode( CALL_PHIGS_CULL_BACKFACE );
- else
- call_func_set_face_cull_mode( CALL_PHIGS_CULL_NONE );
-
- /* front face */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
-
- if( agroup->ContextFillArea.Front.IsAmbient )
- lightbool = lightbool | AMBIENT_MASK;
-
- if( agroup->ContextFillArea.Front.IsDiffuse )
- lightbool = lightbool | DIFFUSE_MASK;
-
- if( agroup->ContextFillArea.Front.IsSpecular )
- lightbool = lightbool | SPECULAR_MASK;
-
- if( agroup->ContextFillArea.Front.IsEmission )
- lightbool = lightbool | EMISSIVE_MASK;
-
- if( !lightbool )
- call_func_set_refl_eqn( CALL_PHIGS_REFL_NONE );
- else
- call_func_set_refl_eqn( lightbool );
-
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
-
- call_subr_set_refl_props( &agroup->ContextFillArea.Front, 0 );
-
- /* back face */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
-
- if( agroup->ContextFillArea.Back.IsAmbient )
- lightbool = lightbool | AMBIENT_MASK;
-
- if( agroup->ContextFillArea.Back.IsDiffuse )
- lightbool = lightbool | DIFFUSE_MASK;
-
- if( agroup->ContextFillArea.Back.IsSpecular )
- lightbool = lightbool | SPECULAR_MASK;
-
- if( agroup->ContextFillArea.Back.IsEmission )
- lightbool = lightbool | EMISSIVE_MASK;
-
- if( !lightbool )
- call_func_set_back_refl_eqn( CALL_PHIGS_REFL_NONE );
- else
- call_func_set_back_refl_eqn( lightbool );
-
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_refl_props( &agroup->ContextFillArea.Back, 1 );
-
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_do_texturemap(agroup->ContextFillArea.Texture.doTextureMap);
-
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_texture_id(agroup->ContextFillArea.Texture.TexId);
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_polygon_offset_params( polyOffsetMode, polyOffsetFactor, polyOffsetUnits );
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- call_func_set_elem_ptr_label( agroup->LabelEnd );
- call_func_offset_elem_ptr( -call_util_context_group_place( agroup )
- - 1 );
- /* interior */
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_int_style( Intstyle );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_int_colr( Fillr, Fillg, Fillb, ( float )1.0 );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
-#ifdef OCC1174
- call_subr_set_back_int_colr( FillBackr, FillBackg, FillBackb, ( float )1.0 );
-#else
- call_subr_set_back_int_colr( Fillr, Fillg, Fillb, ( float )1.0 );
-#endif
- /* edge */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( agroup->ContextFillArea.Edge )
- call_func_set_edge_flag( CALL_PHIGS_EDGE_ON );
- else
- call_func_set_edge_flag( CALL_PHIGS_EDGE_OFF );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_edge_colr( Liner, Lineg, Lineb );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_edge_type( Linetype );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_edgewidth( Linewidth );
- /* hatch */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( Intstyle == CALL_PHIGS_STYLE_HATCH )
- call_func_set_int_style_ind( Hatch );
- else
- call_func_appl_data( 0 );
- /* front and back face */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( agroup->Struct->ContextFillArea.Distinguish )
- call_func_set_face_disting_mode( CALL_PHIGS_DISTING_YES );
- else
- call_func_set_face_disting_mode( CALL_PHIGS_DISTING_NO );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( agroup->Struct->ContextFillArea.BackFace )
- call_func_set_face_cull_mode( CALL_PHIGS_CULL_BACKFACE );
- else
- call_func_set_face_cull_mode( CALL_PHIGS_CULL_NONE );
-
- /* front face */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
-
- if( agroup->Struct->ContextFillArea.Front.IsAmbient )
- lightbool = lightbool | AMBIENT_MASK;
-
- if( agroup->Struct->ContextFillArea.Front.IsDiffuse )
- lightbool = lightbool | DIFFUSE_MASK;
-
- if( agroup->Struct->ContextFillArea.Front.IsSpecular )
- lightbool = lightbool | SPECULAR_MASK;
-
- if( agroup->Struct->ContextFillArea.Front.IsEmission )
- lightbool = lightbool | EMISSIVE_MASK;
-
- if( !lightbool )
- call_func_set_refl_eqn( CALL_PHIGS_REFL_NONE );
- else
- call_func_set_refl_eqn( lightbool );
-
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_refl_props( &agroup->Struct->ContextFillArea.Front, 0 );
-
- /* back face */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
-
- if( agroup->Struct->ContextFillArea.Back.IsAmbient )
- lightbool = lightbool | AMBIENT_MASK;
-
- if( agroup->Struct->ContextFillArea.Back.IsDiffuse )
- lightbool = lightbool | DIFFUSE_MASK;
-
- if( agroup->Struct->ContextFillArea.Back.IsSpecular )
- lightbool = lightbool | SPECULAR_MASK;
-
- if( agroup->Struct->ContextFillArea.Back.IsEmission )
- lightbool = lightbool | EMISSIVE_MASK;
-
- if( !lightbool )
- call_func_set_back_refl_eqn( CALL_PHIGS_REFL_NONE );
- else
- call_func_set_back_refl_eqn( lightbool );
-
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_refl_props( &agroup->Struct->ContextFillArea.Back, 1 );
-
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_do_texturemap(agroup->Struct->ContextFillArea.Texture.doTextureMap);
-
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_texture_id(agroup->Struct->ContextFillArea.Texture.TexId);
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_polygon_offset_params( PolyOffsetMode, PolyOffsetFactor, PolyOffsetUnits );
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- /*call_func_offset_elem_ptr( 1 );*/
- /*call_func_set_transform_persistence( TransPers );*/
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
- call_func_close_struct();
- } /* no insert */
-
- if( noinsert == 0 )
- {
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( agroup->Struct->Id );
-
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( agroup->LabelEnd );
- call_func_offset_elem_ptr( -call_util_context_group_place( agroup )
- - 1 );
- call_func_set_int_style( intstyle );
- call_subr_set_int_colr( fillr, fillg, fillb, ( float )1.0 );
-#ifdef OCC1174
- call_subr_set_back_int_colr( fillBackr, fillBackg, fillBackb, ( float )1.0 );
-#else
- call_subr_set_back_int_colr( fillr, fillg, fillb, ( float )1.0 );
-#endif
- if( agroup->ContextFillArea.Edge )
- call_func_set_edge_flag( CALL_PHIGS_EDGE_ON );
- else
- call_func_set_edge_flag( CALL_PHIGS_EDGE_OFF );
- call_subr_set_edge_colr( liner, lineg, lineb );
- call_func_set_edge_type( linetype );
- call_func_set_edgewidth( linewidth );
- if( intstyle == CALL_PHIGS_STYLE_HATCH )
- call_func_set_int_style_ind( hatch );
- else
- call_func_appl_data( 0 );
- if( agroup->ContextFillArea.Distinguish )
- call_func_set_face_disting_mode( CALL_PHIGS_DISTING_YES );
- else
- call_func_set_face_disting_mode( CALL_PHIGS_DISTING_NO );
- if( agroup->ContextFillArea.BackFace )
- call_func_set_face_cull_mode( CALL_PHIGS_CULL_BACKFACE );
- else
- call_func_set_face_cull_mode( CALL_PHIGS_CULL_NONE );
-
- /* front face */
- if( agroup->ContextFillArea.Front.IsAmbient )
- lightbool = lightbool | AMBIENT_MASK;
-
- if( agroup->ContextFillArea.Front.IsDiffuse )
- lightbool = lightbool | DIFFUSE_MASK;
-
- if( agroup->ContextFillArea.Front.IsSpecular )
- lightbool = lightbool | SPECULAR_MASK;
-
- if( agroup->ContextFillArea.Front.IsEmission )
- lightbool = lightbool | EMISSIVE_MASK;
-
- if( !lightbool )
- call_func_set_refl_eqn( CALL_PHIGS_REFL_NONE );
- else
- call_func_set_refl_eqn( lightbool );
-
- call_subr_set_refl_props( &agroup->ContextFillArea.Front, 0 );
-
- /* back face */
- if( agroup->ContextFillArea.Back.IsAmbient )
- lightbool = lightbool | AMBIENT_MASK;
-
- if( agroup->ContextFillArea.Back.IsDiffuse )
- lightbool = lightbool | DIFFUSE_MASK;
-
- if( agroup->ContextFillArea.Back.IsSpecular )
- lightbool = lightbool | SPECULAR_MASK;
-
- if( agroup->ContextFillArea.Back.IsEmission )
- lightbool = lightbool | EMISSIVE_MASK;
-
- if( !lightbool )
- call_func_set_back_refl_eqn( CALL_PHIGS_REFL_NONE );
- else
- call_func_set_back_refl_eqn( lightbool );
-
- call_subr_set_refl_props( &agroup->ContextFillArea.Back, 1 );
-
- call_func_set_do_texturemap(agroup->ContextFillArea.Texture.doTextureMap);
-
- call_func_set_texture_id(agroup->ContextFillArea.Texture.TexId);
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- call_func_set_polygon_offset_params( polyOffsetMode, polyOffsetFactor, polyOffsetUnits );
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-
-
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE );
- if( !agroup->ContextFillArea.IsSet )
- {
- call_func_set_int_style( Intstyle );
- call_subr_set_int_colr( Fillr, Fillg, Fillb, ( float )1.0 );
-#ifdef OCC1174
- call_subr_set_back_int_colr( FillBackr, FillBackg, FillBackb, ( float )1.0 );
-#else
- call_subr_set_back_int_colr( Fillr, Fillg, Fillb, ( float )1.0 );
-#endif
- if( agroup->Struct->ContextFillArea.Edge )
- call_func_set_edge_flag( CALL_PHIGS_EDGE_ON );
- else
- call_func_set_edge_flag( CALL_PHIGS_EDGE_OFF );
- call_subr_set_edge_colr( Liner, Lineg, Lineb );
- call_func_set_edge_type( Linetype );
- call_func_set_edgewidth( Linewidth );
- if( Intstyle == CALL_PHIGS_STYLE_HATCH )
- call_func_set_int_style_ind( Hatch );
- else
- call_func_appl_data( 0 );
- if( agroup->Struct->ContextFillArea.Distinguish )
- call_func_set_face_disting_mode( CALL_PHIGS_DISTING_YES );
- else
- call_func_set_face_disting_mode( CALL_PHIGS_DISTING_NO );
- if( agroup->Struct->ContextFillArea.BackFace )
- call_func_set_face_cull_mode( CALL_PHIGS_CULL_BACKFACE );
- else
- call_func_set_face_cull_mode( CALL_PHIGS_CULL_NONE );
-
- /* front face */
- if( agroup->Struct->ContextFillArea.Front.IsAmbient )
- lightbool = lightbool | AMBIENT_MASK;
-
- if( agroup->Struct->ContextFillArea.Front.IsDiffuse )
- lightbool = lightbool | DIFFUSE_MASK;
-
- if( agroup->Struct->ContextFillArea.Front.IsSpecular )
- lightbool = lightbool | SPECULAR_MASK;
-
- if( agroup->Struct->ContextFillArea.Front.IsEmission )
- lightbool = lightbool | EMISSIVE_MASK;
-
- if( !lightbool )
- call_func_set_refl_eqn( CALL_PHIGS_REFL_NONE );
- else
- call_func_set_refl_eqn( lightbool );
-
- call_subr_set_refl_props( &agroup->Struct->ContextFillArea.Front, 0 );
-
- /* back face */
- if( agroup->Struct->ContextFillArea.Back.IsAmbient )
- lightbool = lightbool | AMBIENT_MASK;
-
- if( agroup->Struct->ContextFillArea.Back.IsDiffuse )
- lightbool = lightbool | DIFFUSE_MASK;
-
- if( agroup->Struct->ContextFillArea.Back.IsSpecular )
- lightbool = lightbool | SPECULAR_MASK;
-
- if( agroup->Struct->ContextFillArea.Back.IsEmission )
- lightbool = lightbool | EMISSIVE_MASK;
-
- if( !lightbool )
- call_func_set_back_refl_eqn( CALL_PHIGS_REFL_NONE );
- else
- call_func_set_back_refl_eqn( lightbool );
-
- call_subr_set_refl_props(&agroup->Struct->ContextFillArea.Back, 1);
-
- call_func_set_do_texturemap(agroup->Struct->ContextFillArea.Texture.doTextureMap);
-
- call_func_set_texture_id(agroup->Struct->ContextFillArea.Texture.TexId);
-
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- call_func_set_polygon_offset_params( PolyOffsetMode, PolyOffsetFactor, PolyOffsetUnits );
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- }
-
- call_func_close_struct();
- } /* insert */
-
- }
- /* Voir commentaire en debut de fonction */
- if (agroup->IsOpen) call_togl_opengroup (agroup);
- return;
-}
+++ /dev/null
-#include <OpenGl_tgl_subrvis.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <InterfaceGraphic_telem.hxx>
-
-void EXPORT
-call_togl_gradient_background
-(
- int ws, int type,
- tel_colour tcolor1, tel_colour tcolor2
-)
-{
- call_subr_set_gradient_background ( ws, type, tcolor1, tcolor2 );
- return;
-}
-
-
-void EXPORT call_togl_set_gradient_type
-(
- int ws, int type
-)
-{
- tsm_bg_gradient gradient;
- CMN_KEY_DATA cmnData;
- CMN_KEY_DATA cmnKey;
-
- /* check if gradient background is already created */
- TsmGetWSAttri( ws, WSBgGradient, &cmnData );
- gradient = (tsm_bg_gradient)cmnData.pdata;
- if ( gradient->type != 0 ) {
- switch ( type ) {
- case 0 :
- gradient->type = TSM_GT_NONE;
- case 1 :
- gradient->type = TSM_GT_HOR;
- break;
- case 2 :
- gradient->type = TSM_GT_VER;
- break;
- case 3 :
- gradient->type = TSM_GT_DIAG1;
- break;
- case 4 :
- gradient->type = TSM_GT_DIAG1;
- break;
- case 5 :
- gradient->type = TSM_GT_CORNER1;
- break;
- case 6 :
- gradient->type = TSM_GT_CORNER2;
- break;
- case 7 :
- gradient->type = TSM_GT_CORNER3;
- break;
- case 8 :
- gradient->type = TSM_GT_CORNER4;
- break;
- default :
- gradient->type = TSM_GT_NONE;
- break;
- }
-
- /* setting flag to update changes */
- cmnKey.ldata = TNotDone;
- TsmSetWSAttri( ws, WSUpdateState, &cmnKey );
-
- /* storing background texture */
- cmnData.pdata = gradient;
- TsmSetWSAttri( ws, WSBgGradient, &cmnData );
- }
-}
+++ /dev/null
-// File: OpenGl_togl_graduatedtrihedron.cxx
-// Created: 6 March 2011
-// Author: Sergey ZERCHANINOV
-// Copyright: OPEN CASCADE SA 2011
-
-#include <OpenGl_graduatedtrihedron.hxx>
-
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_telem_view.hxx>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Aspect.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view,
- const Graphic3d_CGraduatedTrihedron &cubic)
-{
- call_graduatedtrihedron_display(view->WsId, cubic);
-}
-
-void EXPORT call_togl_graduatedtrihedron_erase(CALL_DEF_VIEW* view)
-{
- call_graduatedtrihedron_erase(view->WsId);
-}
-
-void EXPORT call_togl_graduatedtrihedron_minmaxvalues(float xmin, float ymin, float zmin,
- float xmax, float ymax, float zmax)
-{
- call_graduatedtrihedron_minmaxvalues(xmin, ymin, zmin, xmax, ymax, zmax);
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_group.c :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-/*----------------------------------------------------------------------*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-void EXPORT
-call_togl_group
-(
- CALL_DEF_GROUP * agroup
- )
-{
- call_func_set_edit_mode (CALL_PHIGS_EDIT_INSERT);
- call_func_open_struct (agroup->Struct->Id);
- call_func_set_elem_ptr (0);
- call_func_set_elem_ptr_label (agroup->StructureEnd);
- call_func_offset_elem_ptr (-1);
- call_func_label (agroup->LabelBegin);
- call_func_label (agroup->LabelEnd);
- call_func_close_struct ();
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_telem_highlight.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_highlightcolor
-(
- CALL_DEF_STRUCTURE * astructure,
- CALL_DEF_COLOR * acolor,
- int create
- )
-{
- Tint index;
- TEL_HIGHLIGHT hrep = { TelHLForcedColour };
-
- call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE);
- call_func_open_struct (astructure->Id);
- call_func_set_elem_ptr (0);
- call_func_del_elems_labels (Structure_LABHighlight, Structure_LABVisibility);
- call_func_close_struct ();
-
- if (create) {
- call_func_set_edit_mode (CALL_PHIGS_EDIT_INSERT);
- call_func_open_struct (astructure->Id);
- call_func_set_elem_ptr (0);
- call_func_set_elem_ptr_label(Structure_LABHighlight);
- index = call_util_rgbindex(acolor->r, acolor->g, acolor->b);
- hrep.col.rgb[0] = acolor->r,
- hrep.col.rgb[1] = acolor->g,
- hrep.col.rgb[2] = acolor->b;
- TelSetHighlightRep (0, index, &hrep);
- call_subr_set_highl_rep (index);
- call_func_close_struct ();
- }
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl.hxx>
-
-EXPORT void /* redundant */
-call_togl_init_pick ()
-{
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_inquirefacilities :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-12-02-97 : FMN ; Suppression TelEnquireFacilities()
-En fait la plupart de ces valeurs ne servent a rien.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_telem_util.hxx>
-
-int call_togl_inquirelight (void);
-
-CALL_DEF_INQUIRE call_facilities_list;
-
-void EXPORT
-call_togl_inquirefacilities ()
-{
- call_facilities_list.AntiAliasing = 1;
- call_facilities_list.DepthCueing = 1;
- call_facilities_list.DoubleBuffer = 1;
- call_facilities_list.ZBuffer = 1;
-
- call_togl_inquirelight();
- call_togl_inquireplane();
- call_togl_inquireview();
-
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_inquirelight.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_LightBox.hxx>
-
-int EXPORT
-call_togl_inquirelight ()
-{
- return call_facilities_list.MaxLights = OpenGLMaxLights;
-}
#endif
#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tgl.hxx>
int EXPORT
call_togl_inquireplane ()
maxplanes -= 2; /* NOTE the 2 first planes are reserved for ZClipping */
if( maxplanes < 0 )
maxplanes = 0;
- call_facilities_list.MaxPlanes = maxplanes;
#endif
}
#ifdef DEBUG
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tgl.hxx>
-
-int EXPORT
-call_togl_inquireview ()
-{
- return call_facilities_list.MaxViews = 10000;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-long EXPORT
-call_togl_light
-(
- CALL_DEF_LIGHT * alight,
- long update
- )
-{
- static long NbLights = 1;
-
- /* rest of the code is redundant */
- return update ? alight->LightId : NbLights++;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_light_exploration.c :
-
-
-REMARQUES:
----------
-Not implemented
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-30-06-97 : FMN ; Suppression OpenGl_telem_light.h
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-void EXPORT
-call_togl_light_exploration
-(
- CALL_DEF_LIGHT * alight
- )
-{
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_linecontextgroup :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-03-09-97 : FMN ; Ajout traitement Begin/EndPrimitives()
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_linecontextgroup
-(
- CALL_DEF_GROUP * agroup,
- int noinsert
- )
-{
- /* for the group */
- Tfloat liner, lineg, lineb;
- Tint linetype=0;
- Tfloat linewidth;
-
- /* for the structure */
- Tfloat Liner, Lineg, Lineb;
- Tint Linetype=0;
- Tfloat Linewidth;
-
- /*
- * Si le groupe est ouvert cela signifie que BeginPrimitives
- * a ete utilise.
- * Dans le cas des markers composes, il faut refermer temporairement
- * le groupe pour eviter des insertions d'attributs aleatoires.
- */
- if (agroup->IsOpen) call_togl_closegroup (agroup);
-
- if( agroup->ContextLine.IsDef )
- {
- liner = agroup->ContextLine.Color.r;
- lineg = agroup->ContextLine.Color.g;
- lineb = agroup->ContextLine.Color.b;
-
- switch( agroup->ContextLine.LineType )
- {
- case 0 : /* Aspect_TOL_SOLID */
- linetype = CALL_PHIGS_LINE_SOLID;
- break;
- case 1 : /* Aspect_DASH */
- linetype = CALL_PHIGS_LINE_DASH;
- break;
- case 2 : /* Aspect_TOL_DOT */
- linetype = CALL_PHIGS_LINE_DOT;
- break;
- case 3 : /* Aspect_TOL_DOTDASH */
- linetype = CALL_PHIGS_LINE_DASH_DOT;
- break;
- default :
- break;
- }
- linewidth = (Tfloat)agroup->ContextLine.Width;
-
- Liner = agroup->Struct->ContextLine.Color.r;
- Lineg = agroup->Struct->ContextLine.Color.g;
- Lineb = agroup->Struct->ContextLine.Color.b;
-
- switch( agroup->Struct->ContextLine.LineType )
- {
- case 0 : /* Aspect_TOL_SOLID */
- Linetype = CALL_PHIGS_LINE_SOLID;
- break;
- case 1 : /* Aspect_DASH */
- Linetype = CALL_PHIGS_LINE_DASH;
- break;
- case 2 : /* Aspect_TOL_DOT */
- Linetype = CALL_PHIGS_LINE_DOT;
- break;
- case 3 : /* Aspect_TOL_DOTDASH */
- Linetype = CALL_PHIGS_LINE_DASH_DOT;
- break;
- default :
- break;
- }
- Linewidth = (Tfloat)agroup->Struct->ContextLine.Width;
-
- /*TransPers = agroup->TransformPersistenceFlag;*/
-
- if( noinsert )
- {
- if( agroup->ContextLine.IsSet )
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- else
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( agroup->Struct->Id );
-
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( agroup->LabelBegin );
- if( agroup->PickId.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_line_colr( liner, lineg, lineb );
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_linetype( linetype );
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_linewidth( linewidth );
-
- call_func_set_elem_ptr_label( agroup->LabelEnd );
- call_func_offset_elem_ptr( -call_util_context_group_place( agroup )
- - 1 );
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_line_colr( Liner, Lineg, Lineb );
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_linetype( Linetype );
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_linewidth( Linewidth );
- call_func_close_struct( );
- } /* no insert */
-
- if( noinsert == 0 )
- {
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( agroup->Struct->Id );
-
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( agroup->LabelEnd );
- call_func_offset_elem_ptr( -call_util_context_group_place( agroup )
- - 1 );
- call_subr_set_line_colr( liner, lineg, lineb );
- call_func_set_linetype( linetype );
- call_func_set_linewidth( linewidth );
-
- if( !agroup->ContextLine.IsSet )
- {
- call_subr_set_line_colr( Liner, Lineg, Lineb );
- call_func_set_linetype( Linetype );
- call_func_set_linewidth( Linewidth );
- }
- call_func_close_struct();
- } /* insert */
- }
- /* Voir commentaire en debut de fonction */
- if (agroup->IsOpen) call_togl_opengroup (agroup);
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_marker
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_MARKER * amarker
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- call_subr_marker (amarker);
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_marker_set
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_LISTMARKERS * almarkers
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- call_subr_marker_set (almarkers);
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_markercontextgroup.c :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-
-************************************************************************/
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_context.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-/*----------------------------------------------------------------------*/
-
-/*--------------------------------generate USERDEFINED marker--------begin-------*/
-#ifdef WNT
-#include <windows.h>
-#endif
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#if defined(HAVE_MALLOC_H) || defined(WNT)
-#include <malloc.h>
-#endif
-
-typedef struct
-{
- int* IdList;
- GLuint* DisplayIdList;
- int Quantity;
-} UserDefineMarkerStruct;
-
-static UserDefineMarkerStruct UDMS_Marker = { NULL, NULL, 0 };
-
-int EXPORT GenerateMarkerBitmap( int theId, unsigned int theWidth, unsigned int theHeight, unsigned char* theArray )
-{
- int i = 0;
- int anIndex = -1;
- GLint w, h, size, k, l;
-
- for( ; i < UDMS_Marker.Quantity; i++ )
- {
- if( UDMS_Marker.IdList[i] == theId )
- {
- anIndex = i;
- glDeleteLists( UDMS_Marker.DisplayIdList[i], 1 );
- if ( glGetError() != GL_NO_ERROR )
- return -1;
- break;
- }
- }
- if( anIndex == -1 )
- {
- anIndex = UDMS_Marker.Quantity;
- if( anIndex == 0 )
- {
- UDMS_Marker.IdList = (int*)malloc( sizeof( int ) );
- UDMS_Marker.DisplayIdList = (GLuint*)malloc( sizeof( GLuint ) );
- }
- else
- {
- UDMS_Marker.IdList = (int*) realloc( UDMS_Marker.IdList, (UDMS_Marker.Quantity + 1)*sizeof( int ) );
- UDMS_Marker.DisplayIdList = (GLuint*) realloc( UDMS_Marker.DisplayIdList, (UDMS_Marker.Quantity + 1)*sizeof( GLuint ) );
- }
- UDMS_Marker.Quantity++;
- }
-
- UDMS_Marker.IdList[anIndex] = theId;
- UDMS_Marker.DisplayIdList[anIndex] = glGenLists( 1 );
- glNewList( UDMS_Marker.DisplayIdList[anIndex], GL_COMPILE );
-
- w = ( GLsizei ) theWidth;
- h = ( GLsizei ) theHeight;
- glBitmap( w, h,
- ( float )theWidth / ( float )2.0,
- ( float )theHeight / ( float )2.0,
- ( float )30.0, ( float )30.0,
- ( GLubyte* )theArray );
-
- glEndList();
-
- return 0;
-}
-
-GLuint EXPORT GetListIndex( int theId )
-{
- int i = 0;
- for( ; i < UDMS_Marker.Quantity; i++ )
- {
- if( UDMS_Marker.IdList[i] == theId )
- return UDMS_Marker.DisplayIdList[i];
- }
- return -1;
-}
-
-/*--------------------------------generate USERDEFINED marker---------end--------*/
-
-
-void EXPORT
-call_togl_markercontextgroup
-(
- CALL_DEF_GROUP * agroup,
- int noinsert
- )
-{
- /* for the group */
- Tfloat markr, markg, markb;
- Tint markertype;
- Tfloat markerscale;
-
- /* for the structure */
- Tfloat Markr, Markg, Markb;
- Tint Markertype;
- Tfloat Markerscale;
-
- /*
- * Si le groupe est ouvert cela signifie que BeginPrimitives
- * a ete utilise.
- * Dans le cas des markers composes, il faut refermer temporairement
- * le groupe pour eviter des insertions d'attributs aleatoires.
- */
- if (agroup->IsOpen) call_togl_closegroup (agroup);
-
- if( agroup->ContextMarker.IsDef )
- {
- markr = agroup->ContextMarker.Color.r;
- markg = agroup->ContextMarker.Color.g;
- markb = agroup->ContextMarker.Color.b;
- markertype = CALL_PHIGS_MARKER_CROSS;
- switch( agroup->ContextMarker.MarkerType )
- {
- case 0 : /* Aspect_TOM_POINT */
- markertype = CALL_PHIGS_MARKER_DOT;
- break;
- case 1 : /* Aspect_TOM_PLUS */
- markertype = CALL_PHIGS_MARKER_PLUS;
- break;
- case 2 : /* Aspect_TOM_STAR */
- markertype = CALL_PHIGS_MARKER_ASTERISK;
- break;
- case 3 : /* Aspect_TOM_O */
- markertype = CALL_PHIGS_MARKER_CIRCLE;
- break;
- case 4 : /* Aspect_TOM_X */
- markertype = CALL_PHIGS_MARKER_CROSS;
- break;
- case 13 : /* Aspect_TOM_USERDEFINED */
- markertype = CALL_PHIGS_MARKER_USER_DEFINED;
- break;
- default :
- break;
- }
- markerscale = (Tfloat)agroup->ContextMarker.Scale;
-
- Markr = agroup->Struct->ContextMarker.Color.r;
- Markg = agroup->Struct->ContextMarker.Color.g;
- Markb = agroup->Struct->ContextMarker.Color.b;
- Markertype = CALL_PHIGS_MARKER_CROSS;
- switch( agroup->Struct->ContextMarker.MarkerType )
- {
- case 0 : /* Aspect_TOM_POINT */
- Markertype = CALL_PHIGS_MARKER_DOT;
- break;
- case 1 : /* Aspect_TOM_PLUS */
- Markertype = CALL_PHIGS_MARKER_PLUS;
- break;
- case 2 : /* Aspect_TOM_STAR */
- Markertype = CALL_PHIGS_MARKER_ASTERISK;
- break;
- case 3 : /* Aspect_TOM_O */
- Markertype = CALL_PHIGS_MARKER_CIRCLE;
- break;
- case 4 : /* Aspect_TOM_X */
- Markertype = CALL_PHIGS_MARKER_CROSS;
- break;
- case 13 : /* Aspect_TOM_USERDEFINED*/
- markertype = CALL_PHIGS_MARKER_USER_DEFINED;
- break;
- default :
- break;
- }
- Markerscale = (Tfloat)agroup->Struct->ContextMarker.Scale;
-
- if( noinsert )
- {
- if( agroup->ContextMarker.IsSet )
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- else
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( agroup->Struct->Id );
-
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( agroup->LabelBegin );
- if( agroup->PickId.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE );
- if( agroup->ContextMarker.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_marker_colr( markr, markg, markb );
- if( agroup->ContextMarker.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_marker_type( markertype );
- if( agroup->ContextMarker.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_marker_size( markerscale );
-
- call_func_set_elem_ptr_label( agroup->LabelEnd );
- call_func_offset_elem_ptr(-call_util_context_group_place(agroup)-1);
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE );
- if( agroup->ContextMarker.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_marker_colr( Markr, Markg, Markb );
- if( agroup->ContextMarker.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_marker_type( Markertype );
- if( agroup->ContextMarker.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_marker_size( Markerscale );
-
- call_func_close_struct();
- } /* no insert */
-
- if( noinsert == 0 )
- {
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( agroup->Struct->Id );
-
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( agroup->LabelEnd );
- call_func_offset_elem_ptr(-call_util_context_group_place(agroup)-1);
- call_subr_set_marker_colr( markr, markg, markb );
- call_func_set_marker_type( markertype );
- call_func_set_marker_size( markerscale );
-
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE );
- if( !agroup->ContextMarker.IsSet )
- {
- call_subr_set_marker_colr( Markr, Markg, Markb );
- call_func_set_marker_type( Markertype );
- call_func_set_marker_size( Markerscale );
- }
- call_func_close_struct();
- } /* insert */
- }
- /* Voir commentaire en debut de fonction */
- if (agroup->IsOpen) call_togl_opengroup (agroup);
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-
-void EXPORT
-call_togl_namesetstructure
-(
- CALL_DEF_STRUCTURE * astructure
- )
-{
- Tint nameset[3];
-
- nameset[0] = astructure->highlight ? CALL_DEF_STRUCTHIGHLIGHTED : CALL_DEF_STRUCTNOHIGHLIGHTED;
- nameset[1] = astructure->visible ? CALL_DEF_STRUCTVISIBLE : CALL_DEF_STRUCTNOVISIBLE;
- nameset[2] = astructure->pick ? CALL_DEF_STRUCTPICKABLE : CALL_DEF_STRUCTNOPICKABLE;
-
- call_func_set_edit_mode(CALL_PHIGS_EDIT_REPLACE);
- call_func_open_struct(astructure->Id);
- call_func_set_elem_ptr(0);
- call_func_set_elem_ptr_label(Structure_LABNameSet);
- call_func_offset_elem_ptr(1);
- call_subr_addnameset(3, nameset);
- call_func_close_struct();
-
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_opengroup.c :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-/*----------------------------------------------------------------------*/
-
-/*
-call_togl_opengroup (agroup)
-CALL_DEF_GROUP * agroup
-
-Opens the associated structure and sets the pointer
-at the end of the primitives.
-
-Method :
-
-- go to the end of the group in the specified structure.
-- skip the structure element which set all attributes of the structure.
-
-*/
-
-void EXPORT
-call_togl_opengroup
-(
- CALL_DEF_GROUP * agroup
- )
-{
- call_func_set_edit_mode (CALL_PHIGS_EDIT_INSERT);
- call_func_open_struct (agroup->Struct->Id);
- call_func_set_elem_ptr (0);
- call_func_set_elem_ptr_label (agroup->LabelEnd);
- call_func_offset_elem_ptr (- call_util_context_group_place (agroup) - 1);
-}
+++ /dev/null
-/*
-File OpenGl_togl_parray.c
-Created 16/06/2000 : ATS : G005
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT call_togl_parray
-(
- CALL_DEF_GROUP *agroup,
- CALL_DEF_PARRAY *parray
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- call_subr_parray (parray);
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
-}
-
-//=======================================================================
-//function : call_togl_parray_remove
-//purpose : Remove the driver's element corresponding to the primitives
-// array <thePArray> and clean its visualization data. The driver
-// clears all its references to array and stops displaying it.
-// <theGroup> is the group that has added <thePArray> to driver.
-//=======================================================================
-
-void EXPORT call_togl_parray_remove (CALL_DEF_GROUP* theGroup,
- CALL_DEF_PARRAY* thePArray)
-{
- CALL_DEF_PARRAY* anElData;
- Tint aBegId, aEndId, aCurId;
- TSM_ELEM anElem;
-
- // set edit mode and open struct
- call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE);
- call_func_open_struct (theGroup->Struct->Id);
-
- // get begin label
- call_func_set_elem_ptr (0);
- if (call_func_set_elem_ptr_label (theGroup->LabelBegin) == TFailure)
- return;
- call_func_inq_elem_ptr (&aBegId);
-
- // get end label
- if (call_func_set_elem_ptr_label (theGroup->LabelEnd) == TFailure)
- return;
- call_func_inq_elem_ptr (&aEndId);
-
- // iterate between labels and search for the array
- if (aBegId != aEndId)
- {
- // move one element back
- if (call_func_offset_elem_ptr (-1) == TFailure ||
- call_func_inq_elem_ptr (&aCurId) == TFailure)
- return;
-
- // iterate from end label to begin label
- while (aCurId > aBegId)
- {
- call_func_inq_elem (&anElem);
-
- // compare element with the array
- if (anElem.el == TelParray && anElem.data.pdata == (void* )thePArray)
- {
- anElData = (CALL_DEF_PARRAY* )anElem.data.pdata;
-
- // validate for correct pointer
- if (anElData->num_bounds == thePArray->num_bounds &&
- anElData->num_edges == thePArray->num_edges &&
- anElData->num_vertexs == thePArray->num_vertexs &&
- anElData->type == thePArray->type)
- {
- call_func_del_elem();
- break;
- }
- }
- else
- {
- call_func_offset_elem_ptr (-1);
- call_func_inq_elem_ptr (&aCurId);
- }
- }
- }
-
- call_func_close_struct();
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_pick :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-06-03-96 : FMN ; Ajout OpenGl_tgl_tox.h pour call_thedisplay
-01-04-96 : CAL ; Integration MINSK portage WNT
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_tgl_tox.hxx>
-
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_pick
-(
- CALL_DEF_PICK *apick
- )
-{
- call_tox_rect( apick->WsId,
- TxglGetSubWindow( call_thedisplay, (WINDOW)apick->DefWindow.XWindow)
- , apick->x, apick->y );
- apick->Pick.depth = 0;
- if( apick->x <= apick->DefWindow.dx &&
- apick->y <= apick->DefWindow.dy )
- call_subr_pick( apick );
- return;
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_pickid.c :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_pickid
-(
- CALL_DEF_GROUP * agroup
- )
-{
- call_func_open_struct( agroup->Struct->Id );
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( agroup->LabelBegin );
- if( agroup->PickId.IsDef )
- {
- if( agroup->PickId.IsSet )
- {
- call_func_offset_elem_ptr( 1 );
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- }
- else
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
-
- call_func_set_pick_id( agroup->PickId.Value );
- }
- else
- {
- if( agroup->PickId.IsSet )
- {
- call_func_offset_elem_ptr( 1 );
- call_func_del_elem();
- }
- }
- call_func_close_struct();
-
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_plane :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-long EXPORT
-call_togl_plane
-(
- CALL_DEF_PLANE * aplane,
- long update
- )
-{
- static long NbPlanes = 1;
-
- /* rest of the code is redundant */
-
- return update ? aplane->PlaneId : NbPlanes++;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_polygon.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-05-08-97 : PCT ; Support texture mapping
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_polygon
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_FACET * afacet
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- switch (afacet->TypePoints) {
- case 1 : /* Vertex Coordinates Specified */
- if (afacet->NormalIsDefined)
- call_subr_polygon_data (afacet);
- else
- call_subr_polygon (afacet);
- break;
- case 2 : /* Coordinates and Vertex Normal Specified */
- case 5 : /* Coordinates and Vertex Normal and Texture Coordinate Specified */
- call_subr_polygon_data (afacet);
- break;
- }
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_polygon_holes
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_LISTFACETS * alfacets
- )
-{
-#ifdef OK
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- switch (alfacets->LFacets[0].TypePoints) {
- case 1 : /* Vertex Coordinates Specified */
- if (alfacets->LFacets[0].NormalIsDefined)
- call_subr_polygon_holes_data (alfacets);
- else
- call_subr_polygon_holes (alfacets);
- break;
- case 2 : /* Coordinates and Vertex Normal Specified */
- call_subr_polygon_holes_data (alfacets);
- break;
- }
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
-#endif
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_polygon_indices
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_LISTPOINTS * alpoints,
- CALL_DEF_LISTEDGES * aledges,
- CALL_DEF_LISTINTEGERS * albounds
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- call_subr_polygon_indices (alpoints, aledges, albounds);
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_polygon_set
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_LISTFACETS * alfacets
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- call_subr_polygon_set (alfacets);
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_polyline
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_LISTPOINTS * alpoints
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- switch (alpoints->TypePoints) {
- case 1 : /* Vertex Coordinates Specified */
- call_subr_polyline (alpoints);
- break;
- case 3 : /* Coordinates and Vertex Colour Specified */
- call_subr_polyline_data (alpoints);
- break;
- }
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
-}
+++ /dev/null
-/* File OpenGL_togl_print.c
-Created March 2000
-Author THA
-e-mail t-hartl@muenchen.matra-dtv.fr */
-
-#define RIC120302 /* GG Enable to use the application display
-// callback at end of traversal
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-#include <OpenGl_animation.hxx>
-#include <OpenGl_FrameBuffer.hxx>
-#include <OpenGl_PrinterContext.hxx>
-#include <Visual3d_Layer.hxx>
-#include <TColStd_Array2OfReal.hxx>
-#include <string.h>
-
-#ifdef HAVE_FREEIMAGE
- #include <NCollection_Handle.hxx>
- #include <FreeImagePlus.h>
- #ifdef _MSC_VER
- #pragma comment( lib, "FreeImage.lib" )
- #pragma comment( lib, "FreeImagePlus.lib" )
- #endif
- typedef NCollection_Handle<fipImage> FipHandle;
-#endif
-
-// ---------------------------------------------------------------
-// Function: getNearestPowOfTwo
-// Purpose: get the nearest power of two for theNumber
-// ---------------------------------------------------------------
-static GLsizei getNearestPowOfTwo (const GLsizei theNumber)
-{
- GLsizei aLast = 1;
- for (GLsizei p2 = 1; p2 <= theNumber; aLast = p2, p2 <<= 1);
- return aLast;
-}
-
-// ---------------------------------------------------------------
-// Function: getMaxFrameSize
-// Purpose: get the maximum possible frame size
-// ---------------------------------------------------------------
-static void getMaxFrameSize(Standard_Integer& theWidth,
- Standard_Integer& theHeight)
-{
- GLsizei aMaxX, aMaxY;
- GLint aVpDim[2];
- GLint aTexDim = 2048;
- glGetIntegerv (GL_MAX_VIEWPORT_DIMS, (GLint*) &aVpDim);
- glGetIntegerv (GL_MAX_TEXTURE_SIZE, &aTexDim);
- (aVpDim[0] >= aTexDim) ? aMaxX = (GLsizei) aTexDim :
- aMaxX = getNearestPowOfTwo((GLsizei)aVpDim[0]);
- (aVpDim[1] >= aTexDim) ? aMaxY = (GLsizei) aTexDim :
- aMaxY = getNearestPowOfTwo((GLsizei)aVpDim[1]);
-
- theWidth = (Standard_Integer)aMaxX;
- theHeight = (Standard_Integer)aMaxY;
-}
-
-// ---------------------------------------------------------------
-// Function: fitDimensionsRatio
-// Purpose: calculate correct width/height ratio for theWidth and
-// theHeight parameters
-// ---------------------------------------------------------------
-static void fitDimensionsRatio (Standard_Integer& theWidth,
- Standard_Integer& theHeight,
- const Standard_Real theViewRatio)
-{
- // set dimensions in accordance with the viewratio
- if (theHeight < theWidth/theViewRatio)
- theWidth = (Standard_Integer)(theHeight*theViewRatio);
-
- if (theWidth < theHeight*theViewRatio)
- theHeight = (Standard_Integer)(theWidth/theViewRatio);
-}
-
-// ---------------------------------------------------------------
-// Function: getDimensionsTiling
-// Purpose: calculate maximum possible dimensions for framebuffer
-// in tiling mode according to the view size
-// ---------------------------------------------------------------
-static void getDimensionsTiling (Standard_Integer& theFrameWidth,
- Standard_Integer& theFrameHeight,
- const int theViewWidth,
- const int theViewHeight)
-{
- // fit the maximum dimensions into the printing area
- if (theFrameWidth > theViewWidth)
- theFrameWidth = theViewWidth;
-
- if (theFrameHeight > theViewHeight)
- theFrameHeight = theViewHeight;
-}
-
-// ---------------------------------------------------------------
-// Function: initBufferStretch
-// Purpose: calculate initialization sizes for frame buffer
-// when the stretch algorithm is selected
-// ---------------------------------------------------------------
-static void initBufferStretch (Standard_Integer& theFrameWidth,
- Standard_Integer& theFrameHeight,
- const int theViewWidth,
- const int theViewHeight)
-{
-
- // Calculate correct width/height for framebuffer
- Standard_Real aViewRatio = (Standard_Real)theViewWidth/theViewHeight;
- fitDimensionsRatio (theFrameWidth, theFrameHeight, aViewRatio);
-
- // downscale the framebuffer if it is too large
- Standard_Real aWidthRate = (Standard_Real)theFrameWidth /theViewWidth;
- Standard_Real aHeightRate = (Standard_Real)theFrameHeight/theViewHeight;
-
- if ((aWidthRate > 1 && aHeightRate > 1 && aWidthRate >= aHeightRate) ||
- (aWidthRate > 1 && aHeightRate <= 1))
- {
- theFrameWidth = (Standard_Integer)(theFrameWidth /aWidthRate);
- theFrameHeight = (Standard_Integer)(theFrameHeight/aWidthRate);
- }
- else if ((aWidthRate > 1 && aHeightRate > 1 && aWidthRate < aHeightRate) ||
- (aWidthRate <= 1 && aHeightRate > 1))
- {
- theFrameWidth = (Standard_Integer)(theFrameWidth /aHeightRate);
- theFrameHeight = (Standard_Integer)(theFrameHeight/aHeightRate);
- }
-
-}
-
-// ---------------------------------------------------------------
-// Function: initBufferTiling
-// Purpose: calculate initialization sizes for frame buffer
-// when the tile algorithm is selected
-// ---------------------------------------------------------------
-static void initBufferTiling (Standard_Integer& theFrameWidth,
- Standard_Integer &theFrameHeight,
- const int theViewWidth,
- const int theViewHeight)
-{
- // fit framebuffer into the printing area
- if (theFrameWidth > theViewWidth)
- theFrameWidth = theViewWidth;
-
- if (theFrameHeight > theViewHeight)
- theFrameHeight = theViewHeight;
-}
-
-// ---------------------------------------------------------------
-// Function: redrawView
-// Purpose: redraw view in printing mode
-// ---------------------------------------------------------------
-static void redrawView (CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer,
- const int isBackground)
-{
- // prepare for redraw
- call_func_redraw_all_structs_begin (aview->WsId);
- call_subr_displayCB (aview, OCC_REDRAW_BITMAP | OCC_PRE_REDRAW);
- call_togl_setplane (aview);
-
- // clear background
- if (isBackground == 0)
- {
- glClearColor (1.0, 1.0, 1.0, 1.0);
- glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- }
-
- // draw underlayer
- if (anunderlayer->ptrLayer)
- {
- call_togl_redraw_layer2d (aview, anunderlayer);
- }
-
- // redraw main plane
- call_func_redraw_all_structs_proc (aview->WsId);
- call_subr_displayCB (aview,OCC_REDRAW_BITMAP | OCC_PRE_OVERLAY);
- // draw overlayer
- if (anoverlayer->ptrLayer)
- {
- call_togl_redraw_layer2d (aview, anoverlayer);
- }
- call_subr_displayCB (aview,OCC_REDRAW_BITMAP);
-
-
- // tell to end redrawing
- call_func_redraw_all_structs_end (aview->WsId, 0);
- call_togl_redraw_immediat_mode (aview);
-}
-
-// ---------------------------------------------------------------
-// Function: initBitmapBuffer
-// Purpose: init device independent bitmap to hold printing data
-// ---------------------------------------------------------------
-#ifdef WNT
-#ifndef HAVE_FREEIMAGE
-static void initBitmapBuffer (const HDC theMemoryDC,
- HBITMAP &theMemoryBmp,
- const Standard_Integer theBmpWidth,
- const Standard_Integer theBmpHeight,
- VOID* &theBufferPtr)
-{
- // define compatible bitmap
- BITMAPINFO aBitmapData;
- memset (&aBitmapData, 0, sizeof (BITMAPINFOHEADER));
- aBitmapData.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
- aBitmapData.bmiHeader.biWidth = theBmpWidth;
- aBitmapData.bmiHeader.biHeight = theBmpHeight;
- aBitmapData.bmiHeader.biPlanes = 1;
- aBitmapData.bmiHeader.biBitCount = 24;
- aBitmapData.bmiHeader.biXPelsPerMeter = 0;
- aBitmapData.bmiHeader.biYPelsPerMeter = 0;
- aBitmapData.bmiHeader.biClrUsed = 0;
- aBitmapData.bmiHeader.biClrImportant = 0;
- aBitmapData.bmiHeader.biCompression = BI_RGB;
- aBitmapData.bmiHeader.biSizeImage = 0;
-
- // Create Device Independent Bitmap
- theMemoryBmp = CreateDIBSection (theMemoryDC, &aBitmapData, DIB_RGB_COLORS,
- &theBufferPtr, NULL, 0);
-}
-#else
-// ---------------------------------------------------------------
-// Function: imagePasteDC
-// Purpose: copy the data from image buffer to the device context
-// ---------------------------------------------------------------
-static bool imagePasteDC(HDC theDstDC, FipHandle theImage, int theOffsetX,
- int theOffsetY, int theWidth, int theHeight,
- int theLeft = 0, int theTop = 0)
-{
- // get image parameters
- BITMAPINFO* aBitmapData = theImage->getInfo ();
- SetStretchBltMode (theDstDC, STRETCH_HALFTONE);
-
- // organize blocks data passing if memory isn't enough to pass all the data
- // at once
- int aLinesComplete = 0, aMaxBlockWidth = theHeight, aBlockWidth = 0,
- aPassed = 0, aInverseLine = 0, aScan = 0;
- BYTE *aDataPtr = 0;
- while (aMaxBlockWidth >= 1 && aLinesComplete < theHeight)
- {
- // how much lines still to pass
- aBlockWidth = theHeight - aLinesComplete;
-
- // normalize count of lines to pass to maximum lines count at one pass.
- if (aBlockWidth > aMaxBlockWidth)
- aBlockWidth = aMaxBlockWidth;
-
- // access image data at the start scan line, we need to calculate scan from
- // the bottom of image (image is bottom-left, the src coord is top-left)
- aInverseLine = theTop + aBlockWidth + aLinesComplete;
- aScan = theImage->getHeight() - aInverseLine;
- aDataPtr = theImage->getScanLine (aScan);
- if (!aDataPtr)
- return false;
-
- // try to pass block to the device
- if (aBlockWidth > 0)
- {
- // instead of banded output we provide blocked as it isn't always passed
- // to printer as it is expected
- aPassed = SetDIBitsToDevice (theDstDC, theOffsetX,
- theOffsetY + aLinesComplete,
- theWidth, aBlockWidth, theLeft, 0,
- 0, aBlockWidth,
- aDataPtr, aBitmapData, DIB_RGB_COLORS);
-
- // if result is bad, try to decrease band width
- if (aPassed != aBlockWidth)
- {
- aMaxBlockWidth = aMaxBlockWidth >> 1;
- aLinesComplete = 0;
- }
- else
- aLinesComplete += aBlockWidth;
- }
- }
-
- // check for total failure
- if (aMaxBlockWidth < 1)
- return false;
-
- return true;
-}
-
-// ---------------------------------------------------------------
-// Function: imageStretchDC
-// Purpose: copy pixels from image to dc by stretching them
-// ---------------------------------------------------------------
-static bool imageStretchDC(HDC theDstDC, FipHandle theImage, int theOffsetX,
- int theOffsetY, int theWidth, int theHeight)
-{
- // access to raw image data
- BYTE *aDataPtr = theImage->accessPixels ();
- if (!aDataPtr)
- return false;
-
- // get image parameters
- unsigned int widthPx = theImage->getWidth ();
- unsigned int heightPx = theImage->getHeight ();
- BITMAPINFO* aBitmapData = theImage->getInfo ();
- SetStretchBltMode (theDstDC, STRETCH_HALFTONE);
-
- // pass lines and check if operation is succesfull
- int aPassed = 0;
- aPassed = StretchDIBits (theDstDC, theOffsetX, theOffsetY, theWidth,
- theHeight, 0, 0, widthPx, heightPx, aDataPtr,
- aBitmapData, DIB_RGB_COLORS, SRCCOPY);
-
- if (aPassed != heightPx)
- return false;
-
- return true;
-}
-#endif
-#endif
-
-// ---------------------------------------------------------------
-// Function: call_togl_print
-// Purpose:
-// ---------------------------------------------------------------
-Standard_Boolean EXPORT
-call_togl_print
-(
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer,
- const Aspect_Drawable hPrintDC,
- const int background,
- const char* filename,
- const int printalgo,
- const float theScaleFactor
- )
-{
-
-#ifdef WNT
-
- CMN_KEY_DATA data;
- DOCINFO di;
- bool IsTiling = (printalgo == 1);
- HDC hPrnDC = (HDC) hPrintDC;
-
- TsmGetWSAttri (aview->WsId, WSWindow, &data);
- if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) != TSuccess)
- {
- MessageBox (NULL, "Print failed: can't setup the view for printing.",
- "The operation couldn't be completed.", MB_OK);
- return Standard_False;
- }
-
- // printer page dimensions
- int devWidth = GetDeviceCaps (hPrnDC, HORZRES);
- int devHeight = GetDeviceCaps (hPrnDC, VERTRES);
-
- // if context is actually a memory dc, try to retrieve bitmap dimensions
- // (memory dc could be used for testing purposes)
- if (GetObjectType (hPrnDC) == OBJ_MEMDC)
- {
- // memory dc dimensions
- BITMAP aBitmapInfo;
- HBITMAP aMemoryBitmap = (HBITMAP) GetCurrentObject (hPrnDC, OBJ_BITMAP);
- if (aMemoryBitmap)
- if (GetObject (aMemoryBitmap, sizeof (BITMAP), &aBitmapInfo))
- {
- devWidth = aBitmapInfo.bmWidth;
- devHeight = aBitmapInfo.bmHeight;
- }
- }
-
- Standard_Integer tempWidth = (Standard_Integer) devWidth;
- Standard_Integer tempHeight = (Standard_Integer) devHeight;
-
- // view dimensions
- RECT rect;
- GetClientRect((WINDOW) data.ldata, &rect);
- int viewWidth = rect.right-rect.left;
- int viewHeight = rect.bottom-rect.top;
- if (viewWidth == 0 || viewHeight == 0)
- {
- MessageBox (NULL, "Print failed: can't setup the view for printing.",
- "The operation couldn't be completed.", MB_OK);
- return Standard_False;
- }
-
- // calculate correct width/height ratio
- Standard_Real viewRatio = (Standard_Real)viewWidth/viewHeight;
- fitDimensionsRatio(tempWidth, tempHeight, viewRatio);
-
- // width and height for printing area
- int width = (int) (tempWidth * theScaleFactor);
- int height = (int) (tempHeight * theScaleFactor);
-
- // device independent bitmap for the whole view
-#ifdef HAVE_FREEIMAGE
- FipHandle aViewImage = NULL;
- BYTE* aViewBuffer = NULL;
-#else
- HDC hMemDC = CreateCompatibleDC (hPrnDC);
- HBITMAP hViewBitmap = NULL;
- HGDIOBJ hViewBitmapOld = NULL;
- VOID* aViewBuffer = NULL;
-#endif
-
- // Frame buffer initialization
- OpenGl_FrameBuffer* aFrameBuffer = NULL;
- OpenGl_FrameBuffer* aPrevBuffer = (OpenGl_FrameBuffer*) aview->ptrFBO;
- Standard_Integer aFrameWidth (0), aFrameHeight (0),
- aPrevBufferX (0), aPrevBufferY (0);
-
- // try to use existing frame buffer
- if (aPrevBuffer)
- {
- GLsizei aPrevWidth = aPrevBuffer->GetSizeX();
- GLsizei aPrevHeight = aPrevBuffer->GetSizeY();
- bool isUsable = false;
-
- // check if its possible to use previous frame buffer
- if (!IsTiling && aPrevWidth >= width && aPrevHeight >= height)
- {
- aFrameWidth = (Standard_Integer) width;
- aFrameHeight = (Standard_Integer) height;
- isUsable = true;
- }
- else if (IsTiling)
- {
- getDimensionsTiling (aFrameWidth, aFrameHeight, width, height);
- if (aPrevWidth >= aFrameWidth && aPrevHeight >= aFrameHeight)
- isUsable = true;
- }
-
- // if it is enough memory for image paste dc operation
- if (isUsable)
- {
-#ifdef HAVE_FREEIMAGE
- // try to allocate fipImage and necessary resources
- fipImage* anImagePtr = new fipImage (FIT_BITMAP, aFrameWidth,
- aFrameHeight, 24);
-
- // if allocated succesfully
- if (anImagePtr->isValid())
- {
- aViewImage = anImagePtr;
- aViewBuffer = aViewImage->accessPixels ();
- }
- else
- delete anImagePtr;
-
- if (!aViewBuffer)
- {
- isUsable = false;
- aViewBuffer = NULL;
- aViewImage = NULL;
- }
-#else
- // try to allocate compatible bitmap and necessary resources
- initBitmapBuffer (hMemDC, hViewBitmap,
- aFrameWidth, aFrameHeight, aViewBuffer);
- if (!aViewBuffer)
- {
- isUsable = false;
- if (hViewBitmap)
- DeleteObject (hViewBitmap);
- hViewBitmap = NULL;
- }
- else
- hViewBitmapOld = SelectObject (hMemDC, hViewBitmap);
-#endif
- }
-
- // use previous frame buffer
- if (isUsable)
- {
- aPrevBufferX = aPrevWidth;
- aPrevBufferY = aPrevHeight;
- aFrameBuffer = aPrevBuffer;
- aFrameBuffer->ChangeViewport (aFrameWidth, aFrameHeight);
- }
- }
-
- // if previous buffer cannot be used, try to init a new one
- if (!aFrameBuffer)
- {
- aFrameBuffer = new OpenGl_FrameBuffer();
-
- // try to create the framebuffer with the best possible size
- Standard_Integer aMaxWidth(0), aMaxHeight(0);
- getMaxFrameSize (aMaxWidth, aMaxHeight);
- while (aMaxWidth > 1 && aMaxHeight > 1)
- {
- aFrameWidth = aMaxWidth;
- aFrameHeight = aMaxHeight;
-
- // calculate dimensions for different printing algorithms
- if (!IsTiling)
- initBufferStretch (aFrameWidth, aFrameHeight, width, height);
- else
- initBufferTiling (aFrameWidth, aFrameHeight, width, height);
-
- // try to initialize framebuffer
- if (aFrameBuffer->Init (aFrameWidth, aFrameHeight))
- {
-#ifdef HAVE_FREEIMAGE
- // try to allocate fipImage and necessary resources
- fipImage* anImagePtr = new fipImage (FIT_BITMAP, aFrameWidth,
- aFrameHeight, 24);
-
- // if allocated succesfully
- if (anImagePtr->isValid())
- {
- aViewImage = anImagePtr;
- aViewBuffer = aViewImage->accessPixels ();
- }
- else
- delete anImagePtr;
-
- if (!aViewBuffer)
- {
- aFrameBuffer->Release ();
- aViewBuffer = NULL;
- aViewImage = NULL;
- }
- else
- break;
-#else
- // try to allocate compatible bitmap and necessary resources
- initBitmapBuffer (hMemDC, hViewBitmap,
- aFrameWidth, aFrameHeight, aViewBuffer);
- if (!aViewBuffer)
- {
- if (hViewBitmap)
- DeleteObject (hViewBitmap);
- aFrameBuffer->Release ();
- hViewBitmap = NULL;
- }
- else
- {
- hViewBitmapOld = SelectObject (hMemDC, hViewBitmap);
- break;
- }
-#endif
- }
-
- // not initialized, decrease dimensions
- aMaxWidth = aMaxWidth >> 1;
- aMaxHeight = aMaxHeight >> 1;
- }
-
- // check if there are proper dimensions
- if (aMaxWidth <= 1 || aMaxHeight <= 1)
- {
- MessageBox (NULL, "Print failed: can't allocate buffer for printing.",
- "The operation couldn't be completed.", MB_OK);
-
- if (aFrameBuffer)
- delete aFrameBuffer;
-#ifndef HAVE_FREEIMAGE
- if (hMemDC)
- DeleteDC (hMemDC);
-#endif
-
- return Standard_False;
- }
- }
-
- // setup printing context and viewport
- GLint aViewPortBack[4];
- GLint aReadBufferPrev = GL_BACK;
- GLint anAlignBack = 1;
- OpenGl_PrinterContext aPrinterContext (GET_GL_CONTEXT());
- aPrinterContext.SetLayerViewport ((GLsizei)aFrameWidth,
- (GLsizei)aFrameHeight);
- glGetIntegerv (GL_VIEWPORT, aViewPortBack);
- glGetIntegerv (GL_PACK_ALIGNMENT, &anAlignBack);
- glPixelStorei (GL_PACK_ALIGNMENT, 4);
-
- // start document if the printer context is not actually a memory dc
- // (memory dc could be used for testing purposes)
- if (GetObjectType (hPrnDC) == OBJ_DC)
- {
- // Initalize printing procedure
- di.cbSize = sizeof(DOCINFO);
- di.lpszDocName = "Open Cascade Document - print v3d view";
- di.lpszOutput = filename;
-
- // if can't print the document
- if (StartDoc (hPrnDC, &di) <= 0 || StartPage (hPrnDC) <= 0)
- {
- MessageBox (NULL, "Print failed: printer can't start operation.",
- "The operation couldn't be completed.", MB_OK);
-#ifndef HAVE_FREEIMAGE
- if (hViewBitmap)
- {
- SelectObject (hMemDC, hViewBitmapOld);
- DeleteObject (hViewBitmap);
- }
- DeleteDC (hMemDC);
-#endif
-
- return Standard_False;
- }
- }
-
- // activate the offscreen buffer
- aFrameBuffer->BindBuffer ();
-
- // calculate offset for centered printing
- int aDevOffx = (int)(devWidth - width) /2;
- int aDevOffy = (int)(devHeight - height)/2;
-
- // operation complete flag
- bool isDone = true;
-
- if (!IsTiling)
- {
- aPrinterContext.SetScale ((GLfloat)aFrameWidth /viewWidth,
- (GLfloat)aFrameHeight/viewHeight);
- aFrameBuffer->SetupViewport ();
- redrawView (aview, anunderlayer, anoverlayer, background);
- glReadPixels (0, 0, aFrameWidth, aFrameHeight,
- GL_BGR_EXT, GL_UNSIGNED_BYTE, (GLvoid* )aViewBuffer);
-
- // copy result to the printer device and check for errors
-#ifdef HAVE_FREEIMAGE
- if (!aViewImage->rescale(width, height, FILTER_BICUBIC) ||
- !imagePasteDC (hPrnDC, aViewImage, aDevOffx, aDevOffy, width, height))
- isDone = imageStretchDC (hPrnDC, aViewImage, aDevOffx, aDevOffy,
- width, height);
-#else
- if (width > aFrameWidth && height > aFrameHeight)
- {
- SetStretchBltMode (hPrnDC, STRETCH_HALFTONE);
- isDone = StretchBlt (hPrnDC, aDevOffx, aDevOffy, width, height,
- hMemDC, 0, 0, aFrameWidth, aFrameHeight, SRCCOPY);
- }
- else
- {
- isDone = BitBlt (hPrnDC, aDevOffx, aDevOffy, width, height,
- hMemDC, 0, 0, SRCCOPY);
- }
-#endif
- }
- else
- {
- // calculate total count of frames and cropping size
- Standard_Integer aPxCropx = 0;
- Standard_Integer aPxCropy = 0;
- Standard_Integer aTotalx =
- (Standard_Integer)floor ((float)width /aFrameWidth);
- Standard_Integer aTotaly =
- (Standard_Integer)floor ((float)height/aFrameHeight);
- if (width %aFrameWidth != 0)
- {
- aPxCropx = (aFrameWidth - width%aFrameWidth)/2;
- aTotalx++;
- }
- if (height%aFrameHeight != 0)
- {
- aPxCropy = (aFrameHeight - height%aFrameHeight)/2;
- aTotaly++;
- }
-
- int anOddPixelx = (width %aFrameWidth) %2;
- int anOddPixely = (height%aFrameHeight)%2;
-
- // calculate scale factor for full frames
- Standard_Real aScalex = (Standard_Real)width /aFrameWidth;
- Standard_Real aScaley = (Standard_Real)height/aFrameHeight;
-
- // calculate and set the text scaling factor for printing context
- GLfloat aScaleRatex = (GLfloat)aFrameWidth /viewWidth;
- GLfloat aScaleRatey = (GLfloat)aFrameHeight/viewHeight;
- aPrinterContext.SetScale (aScaleRatex*(GLfloat)aScalex,
- aScaleRatey*(GLfloat)aScaley);
-
- // initialize projection matrix for printer context
- TColStd_Array2OfReal aProj (0, 3, 0, 3);
- Standard_Real aDef = 0;
- aProj.Init (aDef);
- aProj(2,2) = 1.0;
- aProj(3,3) = 1.0;
-
- // projection matrix offsets for printer context
- // offsets are even numbers
- Standard_Real aOffsetx(0), aOffsety(0);
- aOffsetx = -(aTotalx-1);
- aOffsety = -(aTotaly-1);
-
- // rect of frame image that will be copied
- // and coordinates in view image where to put it
- Standard_Integer aLeft = 0, aRight = 0, aBottom = 0, aTop = 0;
- Standard_Integer aSubLeft = (Standard_Integer)aDevOffx;
- Standard_Integer aSubTop = (Standard_Integer)aDevOffy;
-
- // draw sequence of full frames
- for (int i = 0; i < aTotalx; i++)
- {
- // offsets are even numbers
- aOffsety = -(aTotaly-1);
- aSubTop = (Standard_Integer)aDevOffy;
-
- // calculate cropped frame rect
- aLeft = (i == 0) ? aPxCropx : 0;
- aRight = (i == aTotalx-1) ? aFrameWidth-(aPxCropx+anOddPixelx) :
- aFrameWidth;
-
- for (int j = 0; j < aTotaly; j++)
- {
- // no offset for single frames
- aProj(3,0) = (aTotalx == 1) ? 0 : -aOffsetx;
- aProj(3,1) = (aTotaly == 1) ? 0 : aOffsety;
-
- // set projection matrix
- aProj(0,0) = aScalex;
- aProj(1,1) = aScaley;
- aPrinterContext.SetProjTransformation (aProj);
-
- // calculate cropped frame rect
- aTop = (j == 0) ? aPxCropy : 0;
- aBottom = (j == aTotaly-1) ? aFrameHeight-(aPxCropy+anOddPixely) :
- aFrameHeight;
-
- // draw to the offscreen buffer and capture the result
- aFrameBuffer->SetupViewport ();
- redrawView (aview, anunderlayer, anoverlayer, background);
- glReadPixels (0, 0, aFrameWidth, aFrameHeight,
- GL_BGR_EXT, GL_UNSIGNED_BYTE, (GLvoid* )aViewBuffer);
-#ifdef HAVE_FREEIMAGE
- // cut out pixels that are out of printing area
- isDone = imagePasteDC (hPrnDC, aViewImage, aSubLeft, aSubTop,
- aRight-aLeft, aBottom-aTop, aLeft, aTop);
-#else
- isDone = BitBlt (hPrnDC, aSubLeft, aSubTop, aRight-aLeft, aBottom-aTop,
- hMemDC, aLeft, aTop, SRCCOPY);
-#endif
-
- // stop operation if errors
- if (!isDone)
- break;
-
- // calculate new view offset for y-coordinate
- aOffsety += 2.0;
- aSubTop += aBottom-aTop;
- }
-
- // stop operation if errors
- if (!isDone)
- break;
-
- // calculate new view offset for x-coordinate
- aOffsetx += 2.0;
- aSubLeft += aRight-aLeft;
- }
- }
-
- // complete printing or indicate an error
- if (GetObjectType (hPrnDC) == OBJ_DC && isDone == true)
- {
- EndPage (hPrnDC);
- EndDoc (hPrnDC);
- }
- else if (isDone == false)
- {
- MessageBox (NULL, "Print failed: insufficient memory or spool error.\nPlease use smaller printer resolution.",
- "The opeartion couldn't be completed.", MB_OK);
- if (GetObjectType (hPrnDC) == OBJ_DC)
- AbortDoc (hPrnDC);
- }
-
- // return OpenGl to the previous state
- aPrinterContext.Deactivate ();
- glPixelStorei (GL_PACK_ALIGNMENT, anAlignBack);
- aFrameBuffer->UnbindBuffer();
- glViewport (aViewPortBack[0], aViewPortBack[1],
- aViewPortBack[2], aViewPortBack[3]);
- if (aPrevBuffer)
- aPrevBuffer->ChangeViewport (aPrevBufferX, aPrevBufferY);
- else
- delete aFrameBuffer;
-
- // delete resources
-#ifndef HAVE_FREEIMAGE
- if (hViewBitmap)
- {
- SelectObject (hMemDC, hViewBitmapOld);
- DeleteObject (hViewBitmap);
- }
- DeleteDC (hMemDC);
-#endif
-
- return (Standard_Boolean) isDone;
-
-#else // not WNT
- return Standard_False;
-#endif
-}
-
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_project_raster :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-24-05-96 : CAL ; Creation
-12-06-98 : CAL ; Modification respecter l'origine top-left.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_tsm_ws.hxx>
-
-//For right copution of projection befor dumping to pixmap
-int call_togl_adopt_to_rect( int wsid, int width, int height ) {
- CMN_KEY_DATA key;
- TStatus result;
-
- key.ldata = width;
- result = TsmSetWSAttri (wsid, WSWidth, &key);
- if (result != TSuccess)
- return 1;
-
- key.ldata = height;
- result = TsmSetWSAttri (wsid, WSHeight, &key);
- if (result != TSuccess)
- return 1;
-
- return 0;
-}
-
-int call_togl_project_raster
-(
- int wsid,
- float x,
- float y,
- float z,
- int *ixr,
- int *iyr
- )
-{
- TStatus result;
- float xr, yr;
-
- Tint h;
- CMN_KEY_DATA key;
-
- TsmGetWSAttri (wsid, WSHeight, &key);
- h = key.ldata;
-
- result = TelProjectionRaster (wsid, x, y, z, &xr, &yr);
-
- if (result == TSuccess) {
- *ixr = (int) xr;
- *iyr = h - (int) yr;
- return (0);
- }
- else
- return (1);
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_quadrangle
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_QUAD * aquad
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- call_subr_quadrangle (aquad);
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_ration_window :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-02-07-96 : FMN ; Suppression WSWSHeight et WSWSWidth
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-
-************************************************************************/
-#define IMP100701 /* GG Prevent window resizing on when redraw
-in a pixmap
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-
-void EXPORT
-call_togl_ratio_window
-(
- CALL_DEF_VIEW * aview
- )
-{
- CMN_KEY_DATA k;
-
-#ifdef IMP100701
- if( aview->DefBitmap.bitmap ) return;
-#endif
-
- call_subr_resize( aview );
-
- k.ldata = ( Tint )aview->DefWindow.dx;
- TsmSetWSAttri( aview->WsId, WSWidth, &k );
- k.ldata = ( Tint )aview->DefWindow.dy;
- TsmSetWSAttri( aview->WsId, WSHeight, &k );
-
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_redraw.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : CAL ; Creation.
-23-01-97 : CAL : Ajout pour mettre des traces facilement
-apres lancement de Designer
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-03-03-97 : FMN ; (PRO4063) Ajout displaylist pour le mode transient
-07-10-97 : FMN ; Simplification WNT
-08-08-98 : FMN ; ajout PRINT debug
-18-11-98 : CAL ; S4062. Ajout des layers.
-15-11-99 : GG ; Add call_togl_redraw_area()
-15-11-99 : VKH ; G004 redrawing view to a large pixmap
-02.01.100 : JR : = 0 for Integer and = NULL for pointers
-02.02.100 " #include <GL/glu.h> for declaration of gluErrorString
-07-03-00 : GG : G004 use the already created pixmap.
-Enable two side lighting before redrawing in pixmap.
-
-************************************************************************/
-
-#define G004 /* VKH 15-11-99 redrawing view to a large pixmap
-*/
-
-#define RIC120302 /* GG Enable to use the application display
-callback at end of traversal
-Modified P. Dolbey 09/06/07 to call back
-before redrawing the overlayer
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#ifdef G004
-#ifndef WNT
-#define CALL_DEF_STRING_LENGTH 132
-#else
-#include <OpenGl_AVIWriter.hxx>
-#endif
-# include <OpenGl_tgl_all.hxx>
-GLboolean g_fBitmap;
-#endif /*G004*/
-
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-#include <OpenGl_FrameBuffer.hxx>
-#include <OpenGl_ResourceCleaner.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-void EXPORT
-call_togl_redraw
-(
- CALL_DEF_VIEW * aview,
- CALL_DEF_LAYER * anunderlayer,
- CALL_DEF_LAYER * anoverlayer
- )
-{
- CMN_KEY_DATA data;
- Tint swap = 1; /* swap buffers ? yes */
-
- if ( TsmGetWSAttri (aview->WsId, WSWindow, &data) != TSuccess ) return;
-
- WINDOW aWin = (WINDOW )data.ldata;
- if (TxglWinset (call_thedisplay, aWin) == TSuccess)
- {
- OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )aview->ptrFBO;
- GLint aViewPortBack[4]; glGetIntegerv (GL_VIEWPORT, aViewPortBack);
- if (aFrameBuffer != NULL)
- {
- aFrameBuffer->SetupViewport();
- aFrameBuffer->BindBuffer();
- swap = 0; // no need to swap buffers
- }
- OpenGl_ResourceCleaner::GetInstance()->Cleanup();
- call_func_redraw_all_structs_begin (aview->WsId);
- call_subr_displayCB (aview, OCC_REDRAW_WINDOW | OCC_PRE_REDRAW);
- call_togl_setplane( aview );
- if (anunderlayer->ptrLayer)
- {
- call_togl_redraw_layer2d (aview, anunderlayer);
- }
- call_func_redraw_all_structs_proc (aview->WsId);
- call_subr_displayCB (aview, OCC_REDRAW_WINDOW | OCC_PRE_OVERLAY);
- if (anoverlayer->ptrLayer)
- {
- call_togl_redraw_layer2d (aview, anoverlayer);
- }
- call_subr_displayCB (aview, OCC_REDRAW_WINDOW);
- call_func_redraw_all_structs_end (aview->WsId, swap);
- call_togl_redraw_immediat_mode (aview);
-
- if (aFrameBuffer != NULL)
- {
- aFrameBuffer->UnbindBuffer();
- // move back original viewport
- glViewport (aViewPortBack[0], aViewPortBack[1], aViewPortBack[2], aViewPortBack[3]);
- }
- }
-
-#ifdef WNT
- if (OpenGl_AVIWriter_AllowWriting (aview->DefWindow.XWindow))
- {
- GLint params[4];
- glGetIntegerv (GL_VIEWPORT, params);
- int nWidth = params[2] & ~0x7;
- int nHeight = params[3] & ~0x7;
-
- const int nBitsPerPixel = 24;
- GLubyte* aDumpData = new GLubyte[nWidth * nHeight * nBitsPerPixel / 8];
-
- glPixelStorei (GL_PACK_ALIGNMENT, 1);
- glReadPixels (0, 0, nWidth, nHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, aDumpData);
- OpenGl_AVIWriter_AVIWriter (aDumpData, nWidth, nHeight, nBitsPerPixel);
- delete[] aDumpData;
- }
-#endif
-
- return;
-}
-
-void EXPORT
-call_togl_redraw_area
-(
- CALL_DEF_VIEW * aview,
- CALL_DEF_LAYER * anunderlayer,
- CALL_DEF_LAYER * anoverlayer,
- int x, int y, int width, int height
- )
-{
- CMN_KEY_DATA data;
-
- /*
- When the exposure area size is > window size / 2 do a full redraw.
- */
- if( width*height >
- (int)(aview->DefWindow.dx*aview->DefWindow.dy)/2 ) {
- call_togl_redraw(aview,anunderlayer,anoverlayer);
- return;
- }
- /*
- Or redraw only the area in the front buffer
- */
- TsmGetWSAttri (aview->WsId, WSWindow, &data);
- if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) == TSuccess)
- {
- GLint buffer;
- glGetIntegerv (GL_DRAW_BUFFER, &buffer);
- if (buffer != GL_FRONT) glDrawBuffer (GL_FRONT);
- glEnable (GL_SCISSOR_TEST);
- glScissor ((GLint )x,
- (GLint )((int )aview->DefWindow.dy - (y + height)),
- (GLsizei )width, (GLsizei )height);
- OpenGl_ResourceCleaner::GetInstance()->Cleanup();
- call_func_redraw_all_structs_begin (aview->WsId);
- call_subr_displayCB (aview, OCC_REDRAW_WINDOWAREA | OCC_PRE_REDRAW);
- call_togl_setplane( aview );
- if (anunderlayer->ptrLayer)
- {
- call_togl_redraw_layer2d (aview, anunderlayer);
- }
- call_func_redraw_all_structs_proc (aview->WsId);
- call_subr_displayCB (aview, OCC_REDRAW_WINDOWAREA | OCC_PRE_OVERLAY);
- if (anoverlayer->ptrLayer)
- {
- call_togl_redraw_layer2d (aview, anoverlayer);
- }
- call_subr_displayCB(aview,OCC_REDRAW_WINDOWAREA);
- call_func_redraw_all_structs_end (aview->WsId, 0);
- call_togl_redraw_immediat_mode (aview);
- glFlush();
- glDisable (GL_SCISSOR_TEST);
- if (buffer != GL_FRONT) glDrawBuffer (buffer);
- }
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_removegroup.c :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_removegroup
-(
- CALL_DEF_GROUP * agroup
- )
-{
- call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE);
- call_func_open_struct (agroup->Struct->Id);
- call_func_set_elem_ptr (0);
- call_func_del_elems_labels (agroup->LabelBegin, agroup->LabelEnd);
- call_func_set_elem_ptr (0);
- call_func_set_elem_ptr_label (agroup->LabelBegin);
- call_func_del_elem ();
- call_func_set_elem_ptr_label (agroup->LabelEnd);
- call_func_del_elem ();
- call_func_close_struct ();
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-void EXPORT
-call_togl_removestructure
-(
- CALL_DEF_STRUCTURE * astructure
- )
-{
- call_func_del_struct (astructure->Id);
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-
-void EXPORT
-call_togl_removeview
-(
- CALL_DEF_VIEW * aview
- )
-{
- call_func_del_struct (aview->ViewId);
- call_subr_close_ws (aview);
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_set_environment :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-29-04-96 : FMN ; Correction Warning.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <string.h>
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-
-void EXPORT
-call_togl_set_environment
-(
- char * adisplay
- )
-{
- int status;
-
- if (call_thedisplay == NULL) {
- if (strlen (adisplay) != 0)
- call_util_osd_putenv ((Tchar*)"DISPLAY", (Tchar*)adisplay);
- status = call_tox_open_display ();
- }
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-Gestion des light sous OpenGL
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-25-06-97 : PCT ; Appel de la toolkit OpenGl_LightBox
-et correction de bug passage
-plusieurs lights -> aucune lights
-
-************************************************************************/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-#include <OpenGl_inquire.hxx>
-
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_Memory.hxx>
-
-void EXPORT
-call_togl_setlight
-(
- CALL_DEF_VIEW * aview
- )
-{
- Tint *actl=0;
- Tint i;
- CALL_DEF_LIGHT alight;
- CMN_KEY k;
-
- actl = new Tint[call_facilities_list.MaxLights];
- if( !actl )
- return;
-
- /* PCT ; 25-06-97 */
- ResetWksLight(aview->WsId);
-
- for( i =0; i < aview->Context.NbActiveLight &&
- i < call_facilities_list.MaxLights; i++ )
- {
- alight = aview->Context.ActiveLight[i];
- actl[i] = alight.LightId;
- call_subr_set_light_src_rep( &alight );
- }
-
- call_func_set_edit_mode(CALL_PHIGS_EDIT_REPLACE);
- call_func_open_struct(aview->ViewId);
- call_func_set_elem_ptr(0);
- call_func_set_elem_ptr_label(View_LABLight);
- call_func_offset_elem_ptr(1);
- k.id = aview->Context.NbActiveLight;
- k.data.pdata = actl;
- TsmAddToStructure( TelLightSrcState, 1, &k );
- call_func_close_struct();
-
- delete[] actl;
-
- return;
-}
+++ /dev/null
-#define GER61454 //GG 14-09-99 Activates the model clipping planes
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <GL/gl.h>
-
-
-struct TEL_VIEW_DATA
-{
- TEL_VIEW_REP vrep;
-#ifdef CAL_100498
- Tmatrix3 inverse_matrix;/* accelerates UVN2XYZ conversion */
-#endif
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_VIEW_DATA *tel_view_data; /* Internal data stored for every view rep */
-
-
-void EXPORT
-/* unimplemented */
-call_togl_setplane
-(
- CALL_DEF_VIEW * aview
- )
-{
-#ifdef GER61454
-
- CMN_KEY_DATA key;
- tel_view_data vptr;
- TEL_VIEW_REP *call_viewrep;
- CALL_DEF_PLANE *plane;
- int j;
-
- // return view representation
-
- if( aview->ViewId == 0 )
- return; // no modifications on default view
-
- if( TsmGetWSAttri( aview->WsId, WSViews, &key ) != TSuccess )
- return;
-
- vptr = (tel_view_data)key.pdata;
- if( !vptr )
- return;
-
- call_viewrep = &vptr->vrep;
-
- // clear clipping planes information
- call_viewrep->clipping_planes.Clear();
- // update information
- if( aview->Context.NbActivePlane > 0 )
- for( j=0 ; j<aview->Context.NbActivePlane ; j++ )
- call_viewrep->clipping_planes.Append( aview->Context.ActivePlane[j] );
-
-#endif
-return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_setvisualisation :
-
-TEST :
-------
-
-Le main TestOfDesktop.c permet de tester cette classe.
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-17-07-96 : FMN ; Simplification du code
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-24-12-97 : FMN ; Suppression de call_func_set_back_int_shad_meth()
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_setvisualisation
-(
- CALL_DEF_VIEW * aview
- )
-{
- /* activation */
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- call_func_open_struct( aview->ViewId );
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( View_LABViewContext );
- call_func_offset_elem_ptr( 1 );
-
- switch( aview->Context.Visualization )
- {
- case 0 : /* VISUAL3D_TOV_WIREFRAME */
- call_func_appl_data( 0 );
-
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( View_LABHlhsr );
- call_func_offset_elem_ptr( 1 );
- call_util_setvisualization (
- aview,
- aview->Context.ZBufferActivity,
- CALL_DEF_DISABLE_ZBUFFER);
- break;
-
- case 1 : /* VISUAL3D_TOV_SHADING */
- switch( aview->Context.Model )
- {
- case 0 : /* VISUAL3D_TOM_NONE */
- call_func_set_int_shad_meth( CALL_PHIGS_SD_NONE );
-
- break;
-
- case 1 : /* VISUAL3D_TOM_INTERP_COLOR */
- call_func_set_int_shad_meth( CALL_PHIGS_SD_COLOUR );
- break;
-
- case 2 : /* VISUAL3D_TOM_FACET */
- call_func_set_int_shad_meth( CALL_PHIGS_SD_NORMAL );
- break;
-
- case 3 : /* VISUAL3D_TOM_VERTEX */
- call_func_set_int_shad_meth( CALL_PHIGS_SD_COLOUR );
- break;
-
- case 4 : /* VISUAL3D_TOM_HIDDENLINE */
- call_func_set_int_shad_meth( CALL_PHIGS_SD_NONE );
- break;
- }
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( View_LABHlhsr );
- call_func_offset_elem_ptr( 1 );
- call_util_setvisualization (
- aview,
- aview->Context.ZBufferActivity,
- CALL_DEF_ENABLE_ZBUFFER);
- break;
- }
-
- call_func_close_struct();
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-void call_util_setvisualization
-(
- CALL_DEF_VIEW * aView,
- int ZBuffer,
- int Mode
- )
-{
- switch (ZBuffer) {
- case -1 : /* non force */
- call_subr_hlhsr (aView, Mode);
- break;
- case 0 : /* force a "disable" */
- call_subr_hlhsr (aView, CALL_DEF_DISABLE_ZBUFFER);
- break;
- case 1 : /* force a "enable" */
- call_subr_hlhsr (aView, CALL_DEF_ENABLE_ZBUFFER);
- break;
- }
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-#define G003 /* EUG degeneration support
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_util.hxx>
-
-void EXPORT
-call_togl_structure
-(
- CALL_DEF_STRUCTURE * astructure
- )
-{
- Tint struct_defined;
- Tint nameset[3];
-
- nameset[0] = astructure->highlight ? CALL_DEF_STRUCTHIGHLIGHTED
- : CALL_DEF_STRUCTNOHIGHLIGHTED;
- nameset[1] = astructure->visible ? CALL_DEF_STRUCTVISIBLE :
- CALL_DEF_STRUCTNOVISIBLE;
- nameset[2] = astructure->pick ? CALL_DEF_STRUCTPICKABLE :
- CALL_DEF_STRUCTNOPICKABLE;
-
- struct_defined = call_util_test_structure( astructure->Id );
-
- if( struct_defined )
- call_func_del_struct( astructure->Id );
-
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( astructure->Id );
- call_func_label( Structure_LABBegin );
- call_func_label( Structure_LABTransformation );
-
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- call_func_label( Structure_LABTransPersistence );
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
- call_func_appl_data (0);
-#ifdef G003
- call_func_label ( Structure_LABDegenerateModel );
- call_func_offset_elem_ptr ( 1 );
- call_func_set_degenerate_model (
- astructure -> ContextFillArea.DegenerationMode,
- astructure -> ContextFillArea.SkipRatio);
-#endif /* G003 */
- call_func_label( Structure_LABContextLine );
- call_func_label( Structure_LABContextFillArea );
- call_func_label( Structure_LABContextMarker );
- call_func_label( Structure_LABContextText );
- call_func_label( Structure_LABHighlight );
- call_func_label( Structure_LABVisibility );
- call_func_label( Structure_LABPick );
- call_func_label( Structure_LABNameSet );
- call_subr_addnameset( 3, nameset );
- call_func_label( Structure_LABConnect );
- call_func_label( astructure->GroupBegin );
- call_func_label( astructure->GroupEnd );
- call_func_close_struct();
-
- /* call_togl_contextstructure( astructure ); */
-
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_structure_exploration :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-01-04-96 : CAL ; Integration MINSK portage WNT
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-
-void EXPORT
-call_togl_structure_exploration
-(
- long Id,
- long LabelBegin,
- long LabelEnd
- )
-{
- Tint type;
- CALL_DEF_POINT pt;
- CALL_DEF_NORMAL npt, nfa;
- CALL_DEF_COLOR cpt;
-
- call_subr_structure_exploration (Id, LabelBegin, LabelEnd, 0, &type, &pt, &npt, &cpt, &nfa);
-
- return;
-}
+++ /dev/null
-
-#include <math.h>
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_text
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_TEXT * atext
- )
-{
- Tint path;
- Tfloat up_vect[2];
- TEL_POINT text_pt;
- Tint hor_align, ver_align;
-
- up_vect[0] = ( float )cos (atext->Angle);
- up_vect[1] = ( float )sin (atext->Angle);
-
- switch (atext->Path) {
- case 0: /* Graphic3d_TP_UP */
- path = CALL_PHIGS_PATH_UP;
- break;
- case 1: /* Graphic3d_TP_DOWN */
- path = CALL_PHIGS_PATH_DOWN;
- break;
- case 2: /* Graphic3d_TP_LEFT */
- path = CALL_PHIGS_PATH_LEFT;
- break;
- case 3: /* Graphic3d_TP_RIGHT */
- path = CALL_PHIGS_PATH_RIGHT;
- break;
- default:
- path = CALL_PHIGS_PATH_RIGHT;
- break;
- }
-
- switch (atext->HAlign) {
- case 0: /* Graphic3d_HTA_LEFT */
- hor_align = CALL_PHIGS_HOR_LEFT;
- break;
- case 1: /* Graphic3d_HTA_CENTER */
- hor_align = CALL_PHIGS_HOR_CENTER;
- break;
- case 2: /* Graphic3d_HTA_RIGHT */
- hor_align = CALL_PHIGS_HOR_RIGHT;
- break;
- default:
- hor_align = CALL_PHIGS_HOR_LEFT;
- break;
- }
-
- switch (atext->VAlign) {
- case 0: /* Graphic3d_VTA_BOTTOM */
- ver_align = CALL_PHIGS_VERT_BOTTOM;
- break;
- case 1: /* Graphic3d_VTA_CENTER */
- ver_align = CALL_PHIGS_VERT_CENTER;
- break;
- case 2: /* Graphic3d_VTA_TOP */
- ver_align = CALL_PHIGS_VERT_TOP;
- break;
- default:
- ver_align = CALL_PHIGS_VERT_BOTTOM;
- break;
- }
-
- text_pt.xyz[0] = atext->Position.x;
- text_pt.xyz[1] = atext->Position.y;
- text_pt.xyz[2] = atext->Position.z;
-
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- call_func_set_anno_char_ht (atext->Height);
- call_func_set_anno_char_up_vec (up_vect);
- call_func_set_anno_path (path);
- call_func_set_anno_align (hor_align, ver_align);
- call_func_anno_text_rel3 (&text_pt, (Techar*)atext->string);
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_textcontextgroup :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-03-09-97 : FMN ; Ajout traitement Begin/EndPrimitives()
-03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE
-30-11-98 : FMN ; S4069 : Textes toujours visibles
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_context.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-#include <OSD_FontAspect.hxx>
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_textcontextgroup
-(
- CALL_DEF_GROUP * agroup,
- int noinsert
- )
-{
- /* for the group */
- Tchar *fontid=NULL;
- Tfloat textr, textg, textb;
- Tfloat textrs, textgs, textbs;
- Tfloat textspace;
- Tfloat textexpan;
- int textstyle, textdisplaytype;
- int textzoomable;
- float textangle;
- OSD_FontAspect textfontaspect;
-
- /* for the structure */
- Tchar *Fontid=NULL;
- Tfloat Textr, Textg, Textb;
- Tfloat Textrs, Textgs, Textbs;
- Tfloat Textspace;
- Tfloat Textexpan;
- int Textstyle, Textdisplaytype;
- int Textzoomable;
- float Textangle;
- OSD_FontAspect Textfontaspect;
-
- /*
- * Si le groupe est ouvert cela signifie que BeginPrimitives
- * a ete utilise.
- * Dans le cas des markers composes, il faut refermer temporairement
- * le groupe pour eviter des insertions d'attributs aleatoires.
- */
- if (agroup->IsOpen) call_togl_closegroup (agroup);
-
-#ifdef TRACE
-
- cout << "TKOpenGl::OpenGl_togl_textcontextgroup"
- << "\t is defined : " << agroup->ContextText.IsDef << endl;
-#endif
- if( agroup->ContextText.IsDef )
- {
- textr = agroup->ContextText.Color.r;
- textg = agroup->ContextText.Color.g;
- textb = agroup->ContextText.Color.b;
- textrs = agroup->ContextText.ColorSubTitle.r;
- textgs = agroup->ContextText.ColorSubTitle.g;
- textbs = agroup->ContextText.ColorSubTitle.b;
-
- fontid = new Tchar[strlen((char*)agroup->ContextText.Font)+1];
- strcpy((char*)fontid,(char*)agroup->ContextText.Font);
-
- textspace = (Tfloat) agroup->ContextText.Space;
- textexpan = (Tfloat) agroup->ContextText.Expan;
- textstyle = (int) agroup->ContextText.Style;
- textdisplaytype = (int) agroup->ContextText.DisplayType;
- textzoomable = (int) agroup->ContextText.TextZoomable;
- textangle = (float) agroup->ContextText.TextAngle;
- textfontaspect = (OSD_FontAspect) agroup->ContextText.TextFontAspect;
-
- Textr = agroup->Struct->ContextText.Color.r;
- Textg = agroup->Struct->ContextText.Color.g;
- Textb = agroup->Struct->ContextText.Color.b;
-
- Textrs = agroup->Struct->ContextText.ColorSubTitle.r;
- Textgs = agroup->Struct->ContextText.ColorSubTitle.g;
- Textbs = agroup->Struct->ContextText.ColorSubTitle.b;
-
- Fontid = new Tchar[strlen((char*)agroup->Struct->ContextText.Font)+1];
- strcpy((char*)Fontid,(char*)agroup->Struct->ContextText.Font);
-
- Textspace = (Tfloat) agroup->Struct->ContextText.Space;
- Textexpan = (Tfloat) agroup->Struct->ContextText.Expan;
- Textstyle = (int) agroup->Struct->ContextText.Style;
- Textdisplaytype = (int) agroup->Struct->ContextText.DisplayType;
- Textzoomable = (int) agroup->Struct->ContextText.TextZoomable;
- Textangle = (float) agroup->Struct->ContextText.TextAngle;
- Textfontaspect = (OSD_FontAspect) agroup->Struct->ContextText.TextFontAspect;
-
- if( noinsert )
- {
- if( agroup->ContextText.IsSet )
- call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE );
- else
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( agroup->Struct->Id );
-
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( agroup->LabelBegin );
- if( agroup->PickId.IsSet )
- call_func_offset_elem_ptr( 1 );
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE );
- if( agroup->ContextMarker.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTMARKER_SIZE );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_zoomable( textzoomable );
- call_func_set_text_angle( textangle );
- call_func_set_text_fontaspect( textfontaspect );
-
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_font( fontid );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_char_space( textspace );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_char_expan( textexpan );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_text_colr( textr, textg, textb );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_style( textstyle );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_display_type( textdisplaytype );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_text_colr_subtitle( textrs, textgs, textbs );
-
- call_func_set_elem_ptr_label( agroup->LabelEnd );
- call_func_offset_elem_ptr(-call_util_context_group_place(agroup)-1);
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE );
- if( agroup->ContextMarker.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTMARKER_SIZE );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_zoomable( Textzoomable);
- call_func_set_text_angle( Textangle);
- call_func_set_text_fontaspect( Textfontaspect);
-
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_font( Fontid );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_char_space( Textspace );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_char_expan( Textexpan );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_text_colr( Textr, Textg, Textb );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_style( Textstyle );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_func_set_text_display_type( Textdisplaytype );
- if( agroup->ContextText.IsSet )
- call_func_offset_elem_ptr( 1 );
- call_subr_set_text_colr_subtitle( Textrs, Textgs, Textbs );
- call_func_close_struct();
- } /* no insert */
-
- if( noinsert == 0 )
- {
- call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT );
- call_func_open_struct( agroup->Struct->Id );
-
- call_func_set_elem_ptr( 0 );
- call_func_set_elem_ptr_label( agroup->LabelEnd );
- call_func_offset_elem_ptr(-call_util_context_group_place(agroup)-1);
- call_func_set_text_zoomable( textzoomable );
- call_func_set_text_angle( textangle );
- call_func_set_text_fontaspect( textfontaspect );
-
- call_func_set_text_font( fontid );
- call_func_set_char_space( textspace );
- call_func_set_char_expan( textexpan );
- call_subr_set_text_colr( textr, textg, textb );
- call_func_set_text_style( textstyle );
- call_func_set_text_display_type( textdisplaytype );
- call_subr_set_text_colr_subtitle( textrs, textgs, textbs );
-
- if( agroup->ContextLine.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE );
- if( agroup->ContextFillArea.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE );
- if( agroup->ContextMarker.IsSet )
- call_func_offset_elem_ptr( CALL_DEF_CONTEXTMARKER_SIZE );
- if( !agroup->ContextText.IsSet )
- {
- call_func_set_text_zoomable( Textzoomable );
- call_func_set_text_angle( Textangle );
- call_func_set_text_fontaspect( Textfontaspect );
- call_func_set_text_font( Fontid );
- call_func_set_char_space( Textspace );
- call_func_set_char_expan( Textexpan );
- call_subr_set_text_colr( Textr, Textg, Textb );
- call_func_set_text_style( Textstyle );
- call_func_set_text_display_type( Textdisplaytype );
- call_subr_set_text_colr_subtitle( Textrs, Textgs, Textbs );
- }
- call_func_close_struct();
- } /* insert */
- }
- /* Voir commentaire en debut de fonction */
- if (agroup->IsOpen) call_togl_opengroup (agroup);
- return;
-}
#include <stdlib.h>
#include <string.h>
#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
#include <OpenGl_tgl_funcs.hxx>
#include <OpenGl_TextureBox.hxx>
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-
#ifdef OCC1188
#include <GL/glu.h>
#endif
/*----------------------------------------------------------------------*/
-void EXPORT
-call_togl_environment(CALL_DEF_VIEW *aview)
-{
- CMN_KEY_DATA data;
-
- if (call_togl_inquiretexture ())
- {
- data.ldata = aview->Context.TexEnvId;
- TsmSetWSAttri(aview->WsId, WSTextureEnv, &data);
-
- data.ldata = aview->Context.SurfaceDetail;
- TsmSetWSAttri(aview->WsId, WSSurfaceDetail, &data);
- }
-}
-
-/*----------------------------------------------------------------------*/
-
int EXPORT
call_togl_inquiretexture ()
{
return 1;
#endif /* SUN */
}
-
-/*----------------------------------------------------------------------*/
-
-#ifdef OCC1188
-void EXPORT call_togl_create_bg_texture( CALL_DEF_VIEW* view, int width, int height,
- unsigned char* data, int style )
-{
- TSM_BG_TEXTURE tex;
- tsm_bg_texture createdTex;
- CMN_KEY_DATA cmnData;
- CMN_KEY_DATA cmnKey;
- GLuint texture = 0;
- GLubyte *image = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte));
- memcpy( image, data, ( width * height * 3 ) );
-
- /* check if some bg texture is already created */
- TsmGetWSAttri( view->WsId, WSBgTexture, &cmnData );
- createdTex = (tsm_bg_texture)cmnData.pdata;
- if ( createdTex->texId != 0 )
- glDeleteTextures( 1, (GLuint*)&(createdTex->texId) );
- glGenTextures( 1, &texture );
- glBindTexture( GL_TEXTURE_2D, texture );
- /* Create MipMapped Texture */
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
- gluBuild2DMipmaps( GL_TEXTURE_2D, 3/*4*/, width, height, GL_RGB, GL_UNSIGNED_BYTE, image );
-
- tex.texId = texture;
- tex.width = width;
- tex.height = height;
- switch ( style ) {
- case 0 :
- case 1 :
- tex.style = TSM_FS_CENTER;
- break;
- case 2 :
- tex.style = TSM_FS_TILE;
- break;
- case 3 :
- tex.style = TSM_FS_STRETCH;
- break;
- default :
- tex.style = TSM_FS_CENTER;
- break;
- }
-
- /* setting flag to update changes */
- cmnKey.ldata = TNotDone;
- TsmSetWSAttri( view->WsId, WSUpdateState, &cmnKey );
-
- /* storing background texture */
- cmnData.pdata = &tex;
- TsmSetWSAttri( view->WsId, WSBgTexture, &cmnData );
- free( image );
-}
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT call_togl_set_bg_texture_style( CALL_DEF_VIEW* view, int style )
-{
- tsm_bg_texture texture;
- CMN_KEY_DATA cmnData;
- CMN_KEY_DATA cmnKey;
-
- /* check if background texture is already created */
- TsmGetWSAttri( view->WsId, WSBgTexture, &cmnData );
- texture = (tsm_bg_texture)cmnData.pdata;
- if ( texture->texId != 0 ) {
- switch ( style ) {
- case 0 :
- case 1 :
- texture->style = TSM_FS_CENTER;
- break;
- case 2 :
- texture->style = TSM_FS_TILE;
- break;
- case 3 :
- texture->style = TSM_FS_STRETCH;
- break;
- default :
- texture->style = TSM_FS_CENTER;
- break;
- }
-
- /* setting flag to update changes */
- cmnKey.ldata = TNotDone;
- TsmSetWSAttri( view->WsId, WSUpdateState, &cmnKey );
-
- /* storing background texture */
- cmnData.pdata = texture;
- TsmSetWSAttri( view->WsId, WSBgTexture, &cmnData );
- }
-}
-#endif /* OCC1188 */
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl.hxx>
-
-void EXPORT
-call_togl_transformstructure
-(
- CALL_DEF_STRUCTURE * astructure
- )
-{
- call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE);
- call_func_open_struct (astructure->Id);
- call_func_set_elem_ptr (0);
- call_func_set_elem_ptr_label (Structure_LABTransformation);
- call_func_offset_elem_ptr (1);
- call_func_set_local_tran3 (astructure->Transformation, CALL_PHIGS_TYPE_REPLACE);
- call_func_close_struct ();
-
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-
-void EXPORT
-call_togl_transparency
-(
- int wsid,
- int viewid,
- int tag
- )
-{
- call_subr_transparency (wsid, viewid, tag);
- return;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_triangle
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_TRIKE * atrike
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- call_subr_triangle (atrike);
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_triedron :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-17-09-98 : FMN/BGN ; Creation des points d'entree.
-14-12-98 : BGN; Developpement (S3989, Phase "triedre")
-15-12-98 : BGN; Ajout des WSUpdateState .
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-/* pour utiliser WSUpdateState et TsmSetWSAttri */
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tsm_ws.hxx>
-
-#include <OpenGl_triedron.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define NO_PRINT
-
-/*----------------------------------------------------------------------*/
-
-void EXPORT
-call_togl_ztriedron_setup
-(
- float* xcolor,
- float* ycolor,
- float* zcolor,
- float sizeratio,
- float axisdiameter,
- int nbfacettes
- )
-{
- call_ztriedron_setup(xcolor, ycolor, zcolor,
- sizeratio, axisdiameter, nbfacettes);
-}
-
-void EXPORT
-call_togl_triedron_display
-(
- CALL_DEF_VIEW * aview,
- int aPosition,
- float r,
- float g,
- float b,
- float aScale,
- int asWireframe
- )
-{
-
- CMN_KEY_DATA data;
- TStatus status;
-
-#ifdef PRINT
- printf("call_togl_triedron_display r = %f, g = %f, b = %f", r, g, b);
- printf(", aScale = %f, aPosition = %d \n", aScale, aPosition );
-#endif
- status = call_triedron_init (aview, aPosition, r, g, b, aScale, asWireframe);
-
- /* Mise a jour de l'update_mode */
- data.ldata = TNotDone;
- TsmSetWSAttri(aview->WsId, WSUpdateState, &data );
-
-
- return;
-}
-
-
-void EXPORT
-call_togl_triedron_erase
-(
- CALL_DEF_VIEW * aview
- )
-{
-
- CMN_KEY_DATA data;
-
-#ifdef PRINT
- printf("call_togl_triedron_erase \n");
-#endif
- call_triedron_erase (aview);
-
- /* Mise a jour de l'update_mode */
- data.ldata = TNotDone;
- TsmSetWSAttri(aview->WsId, WSUpdateState, &data );
-
- return;
-}
-
-
-void EXPORT
-call_togl_triedron_echo
-(
- CALL_DEF_VIEW * aview,
- int AType
- )
-{
-#ifdef PRINT
- printf("call_togl_triedron_echo \n");
-#endif
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_unproject_raster :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-24-05-96 : CAL ; Creation
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_telem_util.hxx>
-
-int EXPORT
-call_togl_unproject_raster
-(
- int wsid,
- int xm,
- int ym,
- int xM,
- int yM,
- int ixr,
- int iyr,
- float *x,
- float *y,
- float *z
- )
-{
- TStatus result;
- Tint xr, yr;
-
- xr = ixr;
- /*
- Patched by P.Dolbey: the window pixel height decreased by one
- in order for yr to remain within valid coordinate range [0; Ym -1]
- where Ym means window pixel height.
- */
- yr = (yM-1)-ym-iyr;
- result = TelUnProjectionRaster (wsid, xr, yr, x, y, z);
-
- if (result == TSuccess)
- return (0);
- else
- return (1);
-}
-
-int EXPORT
-call_togl_unproject_raster_with_ray
-(
- int wsid,
- int xm,
- int ym,
- int xM,
- int yM,
- int ixr,
- int iyr,
- float *x,
- float *y,
- float *z,
- float *dx,
- float *dy,
- float *dz
- )
-{
- TStatus result;
- Tint xr, yr;
-
- xr = ixr;
- yr = yM-ym-iyr;
- result = TelUnProjectionRasterWithRay (wsid, xr, yr, x, y, z, dx, dy, dz);
-
- if (result == TSuccess)
- return (0);
- else
- return (1);
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_update :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-01-04-96 : CAL ; Integration MINSK portage WNT
-05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
-07-10-97 : FMN ; Simplification WNT
-08-08-98 : FMN ; ajout PRINT debug
-18-11-98 : CAL ; S4062. Ajout des layers.
-
-************************************************************************/
-
-#define RIC120302 /* GG Avoid duplicate code with
-// call_togl_redraw
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#ifndef RIC120302
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#endif
-
-void EXPORT call_togl_update
-(
- CALL_DEF_VIEW * aview,
- CALL_DEF_LAYER * anunderlayer,
- CALL_DEF_LAYER * anoverlayer
- )
-{
- CMN_KEY_DATA data;
- Tint update_state;
-#ifndef RIC120302
- Tint swap = 1; /* swap buffers ? yes */
-#endif
-
- TsmGetWSAttri (aview->WsId, WSUpdateState, &data);
- update_state = data.ldata;
- /*
- * Si l'update_state est NotDone, alors on retrace
- */
- if (update_state == TNotDone) {
-#ifdef RIC120302
- call_togl_redraw( aview, anunderlayer, anoverlayer );
-#else
- TsmGetWSAttri (aview->WsId, WSWindow, &data);
- if (TxglWinset (call_thedisplay, (Window) data.ldata) == TSuccess) {
- call_func_redraw_all_structs_begin (aview->WsId);
-
- call_togl_setplane( aview ); /* update clipping planes */
-
- if (anunderlayer->ptrLayer)
- call_togl_redraw_layer2d (aview, anunderlayer);
- call_func_redraw_all_structs_proc (aview->WsId);
- if (anoverlayer->ptrLayer)
- call_togl_redraw_layer2d (aview, anoverlayer);
- call_func_redraw_all_structs_end (aview->WsId, swap);
- call_togl_redraw_immediat_mode (aview);
- }
-#endif
- }
-
- return;
-}
+++ /dev/null
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrs.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-void EXPORT
-call_togl_userdraw
-(
- CALL_DEF_GROUP * agroup,
- CALL_DEF_USERDRAW * anobject
- )
-{
- if (! agroup->IsOpen) call_togl_opengroup (agroup);
- call_subr_userdraw ( anobject );
- if (! agroup->IsOpen) call_togl_closegroup (agroup);
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_view :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-08-07-96 : FMN ; Suppression appel call_togl_ car deja fait dans
-call_togl_cliplimit.
-17-07-96 : FMN ; Suppression appel call_subr_hlhsr
-30-01-97 : FMN ; Suppression call_util_init_indexes()
-30-06-97 : FMN ; Suppression code inutile
-08-09-97 : CAL ; subr_open_ws retourne 0 si pb.
-24-12-97 : FMN ; Suppression de call_func_set_back_int_shad_meth()
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <InterfaceGraphic_Labels.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_tgl_vis.hxx>
-#include <OpenGl_tgl_util.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-#include <OpenGl_tgl_subrvis.hxx>
-#include <OpenGl_tgl_utilgr.hxx>
-
-/*----------------------------------------------------------------------*/
-
-int EXPORT
-call_togl_view
-(
- CALL_DEF_VIEW * aview
- )
-{
-
- if (! call_subr_open_ws(aview))
- return 0;
-
- call_util_init_filters(aview->WsId);
-
- if( call_util_test_structure(aview->ViewId) )
- call_func_del_struct(aview->ViewId);
-
- call_func_set_edit_mode(CALL_PHIGS_EDIT_INSERT);
-
- call_func_open_struct(aview->ViewId);
- call_func_label (View_LABViewIndex);
- call_func_set_view_ind (aview->ViewId);
-
- call_func_label (View_LABViewContext);
- switch (aview->Context.Visualization)
- {
- case 0 : /* VISUAL3D_TOV_WIREFRAME */
- call_func_appl_data (0);
- break;
- case 1 : /* VISUAL3D_TOV_SHADING */
- switch (aview->Context.Model)
- {
- case 0 : /* VISUAL3D_TOM_NONE */
- call_func_set_int_shad_meth (CALL_PHIGS_SD_NONE);
- break;
- case 1 : /* VISUAL3D_TOM_INTERP_COLOR */
- call_func_set_int_shad_meth (CALL_PHIGS_SD_COLOUR);
- break;
- case 2 : /* VISUAL3D_TOM_FACET */
- call_func_set_int_shad_meth
- (CALL_PHIGS_SD_DOT_PRODUCT);
- break;
- case 3 : /* VISUAL3D_TOM_VERTEX */
- call_func_set_int_shad_meth (CALL_PHIGS_SD_NORMAL);
- break;
- case 4 : /* VISUAL3D_TOM_HIDDENLINE */
- call_func_set_int_shad_meth (CALL_PHIGS_SD_NONE);
- break;
- }
- break;
- }
-
- call_func_label (View_LABHlhsr);
- call_func_appl_data (0);
-
- call_func_label (View_LABLight);
- call_func_appl_data (0);
-
- call_func_label (View_LABPlane);
- call_func_appl_data (0);
-
- call_func_label (View_LABAliasing);
- call_func_appl_data (0);
-
- call_func_label (View_LABDepthCueing);
- call_func_appl_data (0);
-
- call_func_label (View_LABPriority00);
- call_func_label (View_LABPriority01);
- call_func_label (View_LABPriority02);
- call_func_label (View_LABPriority03);
- call_func_label (View_LABPriority04);
- call_func_label (View_LABPriority05);
- call_func_label (View_LABPriority06);
- call_func_label (View_LABPriority07);
- call_func_label (View_LABPriority08);
- call_func_label (View_LABPriority09);
- call_func_label (View_LABPriority10);
- call_func_label (View_LABEnd);
- call_func_label (View_LABImmediat1);
- call_func_label (View_LABImmediat2);
- call_func_close_struct ();
-
- if( call_viewrep.active_status == TOff )
- {/* First time. Set defaults */
- call_viewrep.active_status = TOn;
- call_viewrep.shield_indicator = TOn;
- call_viewrep.border_indicator = TOff; /* non utilise */
- call_viewrep.shield_colour.rgb[0] = ( float )0.0,
- call_viewrep.shield_colour.rgb[1] = ( float )0.0,
- call_viewrep.shield_colour.rgb[2] = ( float )0.0;
- call_viewrep.border_colour.rgb[0] = ( float )0.0,
- call_viewrep.border_colour.rgb[1] = ( float )0.0,
- call_viewrep.border_colour.rgb[2] = ( float )0.0;
- }
-
- return 1;
-}
+++ /dev/null
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tgl.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-void EXPORT
-call_togl_view_exploration
-(
- long id
- )
-{
- call_togl_structure_exploration (id, 0, 0);
- return;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_viewmapping.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : CAL ; Creation.
-10-07-96 : FMN ; Suppression #define sur calcul matrice
-25-07-96 : FMN ; Suppression code inutile
-18-11-98 : FMN ; Correction sur la gestion de la perspective (cf Programming Guide)
-09-12-98 : FMN ; Correction erreur de compilation sur WNT
-17-12-98 : FMN ; Correction erreur de compilation sur WNT
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_vis.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-#include <GL/gl.h>
-
-/*----------------------------------------------------------------------*/
-/*
-* Variable globales
-*/
-
-EXPORT extern GLboolean env_walkthrow; /* definit dans OpenGl_togl_begin.c */
-
-/*----------------------------------------------------------------------*/
-
-int EXPORT
-call_togl_viewmapping
-(
- CALL_DEF_VIEW * aview,
- int wait
- )
-{
- int i, j;
- float ratio;
- Tint waitwait;
- Tint err_ind;
-
- TEL_VIEW_MAPPING Map;
-
- err_ind = 0;
- ratio = aview->DefWindow.dy / aview->DefWindow.dx;
-
- Map.window.xmin = aview->Mapping.WindowLimit.um;
- Map.window.ymin = aview->Mapping.WindowLimit.vm;
- Map.window.xmax = aview->Mapping.WindowLimit.uM;
- Map.window.ymax = aview->Mapping.WindowLimit.vM;
-
- Map.viewport.xmin = ( float )0.0;
- Map.viewport.xmax = ( ( float )1. < ( float )1./ratio ? ( float )1. : ( float )1./ratio );
- Map.viewport.ymin = ( float )0.0;
- Map.viewport.ymax = ( ( float )1. < ratio ? ( float )1. : ratio );
- Map.viewport.zmin = ( float )0.0;
- Map.viewport.zmax = ( float )1.0;
-
- /* projection type */
- switch( aview->Mapping.Projection )
- {
- case 0 :
- Map.proj = CALL_PHIGS_TYPE_PERSPECT;
- break;
- case 1 :
- Map.proj = CALL_PHIGS_TYPE_PARAL;
- break;
- }
-
- /* projection reference point */
- Map.prp[0] = aview->Mapping.ProjectionReferencePoint.x;
- Map.prp[1] = aview->Mapping.ProjectionReferencePoint.y;
- if (env_walkthrow)
- Map.prp[2] = aview->Mapping.ProjectionReferencePoint.z;
- else
- Map.prp[2] = aview->Mapping.FrontPlaneDistance +
- aview->Mapping.ProjectionReferencePoint.z;
-
- /* view plane distance */
- Map.vpd = aview->Mapping.ViewPlaneDistance;
-
- /* back plane distance */
- Map.bpd = aview->Mapping.BackPlaneDistance;
-
- /* front plane distance */
- Map.fpd = aview->Mapping.FrontPlaneDistance;
-
- /* use user-defined matrix */
- if ( aview->Mapping.IsCustomMatrix ) {
- for( i = 0; i < 4; i++ )
- for( j = 0; j < 4; j++ )
- call_viewrep.mapping_matrix[i][j] = aview->Mapping.ProjectionMatrix[i][j];
- }
- else
- TelEvalViewMappingMatrix( &Map, &err_ind, call_viewrep.mapping_matrix );
-
- if( !err_ind && aview->WsId != -1 )
- {
- call_viewrep.extra.map = Map;
- if( !wait )
- {
- waitwait = 1;
- call_togl_vieworientation( aview, waitwait );
- call_togl_cliplimit( aview, waitwait );
- TelSetViewRepresentation( aview->WsId, aview->ViewId, &call_viewrep );
- call_togl_ratio_window( aview );
- }
- }
- return err_ind;
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_togl_vieworientation.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : CAL ; Creation.
-10-07-96 : FMN ; Suppression #define sur calcul matrice
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-#include <OpenGl_tgl_vis.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-/*----------------------------------------------------------------------*/
-
-int EXPORT
-call_togl_vieworientation
-(
- CALL_DEF_VIEW * aview,
- int wait
- )
-{
- int i, j;
- Tint waitwait;
- Tint err_ind; /* OUT error indicator */
-
- Tfloat Vrp[3];
- Tfloat Vpn[3];
- Tfloat Vup[3];
- Tfloat ScaleFactors[3];
-
- err_ind = 0;
-
- Vrp[0] = aview->Orientation.ViewReferencePoint.x;
- Vrp[1] = aview->Orientation.ViewReferencePoint.y;
- Vrp[2] = aview->Orientation.ViewReferencePoint.z;
-
- Vpn[0] = aview->Orientation.ViewReferencePlane.x;
- Vpn[1] = aview->Orientation.ViewReferencePlane.y;
- Vpn[2] = aview->Orientation.ViewReferencePlane.z;
-
- Vup[0] = aview->Orientation.ViewReferenceUp.x;
- Vup[1] = aview->Orientation.ViewReferenceUp.y;
- Vup[2] = aview->Orientation.ViewReferenceUp.z;
-
- ScaleFactors[0] = aview->Orientation.ViewScaleX;
- ScaleFactors[1] = aview->Orientation.ViewScaleY;
- ScaleFactors[2] = aview->Orientation.ViewScaleZ;
-
- /* use user-defined matrix */
- if ( aview->Orientation.IsCustomMatrix ) {
- for( i = 0; i < 4; i++ )
- for( j = 0; j < 4; j++ )
- call_viewrep.orientation_matrix[i][j] = aview->Orientation.ModelViewMatrix[i][j];
- }
- else
- TelEvalViewOrientationMatrix( Vrp, Vpn, Vup, ScaleFactors, &err_ind, call_viewrep.orientation_matrix);
-
- if( !err_ind && aview->WsId != -1 )
- {
- call_viewrep.extra.vrp[0] = Vrp[0],
- call_viewrep.extra.vrp[1] = Vrp[1],
- call_viewrep.extra.vrp[2] = Vrp[2];
-
- call_viewrep.extra.vpn[0] = Vpn[0],
- call_viewrep.extra.vpn[1] = Vpn[1],
- call_viewrep.extra.vpn[2] = Vpn[2];
-
- call_viewrep.extra.vup[0] = Vup[0],
- call_viewrep.extra.vup[1] = Vup[1],
- call_viewrep.extra.vup[2] = Vup[2];
-
- call_viewrep.extra.scaleFactors[0] = ScaleFactors[0],
- call_viewrep.extra.scaleFactors[1] = ScaleFactors[1],
- call_viewrep.extra.scaleFactors[2] = ScaleFactors[2];
-
- if( !wait )
- {
- waitwait = 1;
- call_togl_viewmapping( aview, waitwait );
- call_togl_cliplimit( aview, waitwait );
- TelSetViewRepresentation( aview->WsId, aview->ViewId, &call_viewrep );
- }
- }
- return err_ind;
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-
-#ifndef WNT
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_tox :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-on ne garde que :
-- call_tox_open_display()
-- call_tox_getscreen(Tint *d_wdth, Tint *d_hght)
-01-04-96 : CAL ; Integration MINSK portage WNT
-20-11-97 : CAL ; RererereMerge avec le source de portage.
-12-02-01 : GG ; BUC60821 Add getpitchsize() function
-27-03-02 : GG ; RIC120202 Add new function call_tox_set_display
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <stdio.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#include <InterfaceGraphic_Aspect.hxx>
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_tgl_util.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables globales
-*/
-
-Display * call_thedisplay; /* display pointer; defined in tgl/tox */
-
-/*----------------------------------------------------------------------*/
-/*
-*Fonctions externes
-*/
-
-/*----------------------------------------------------------------------*/
-
-Tint
-call_tox_open_display (void)
-{
- char synchro[132];
-
- if (call_thedisplay == NULL)
- /*
- * display_name
- * Specifies the hardware display name, which determines the
- * display and communications domain to be used.
- * On a POSIX system, if the display_name is NULL, it defaults
- * to the value of the DISPLAY environment variable.
- */
- call_thedisplay = XOpenDisplay ((char*) NULL);
-
- if (call_thedisplay != NULL)
- if (call_util_osd_getenv ("CALL_SYNCHRO_X", synchro, 132))
- XSynchronize (call_thedisplay, 1);
- else
- XSynchronize (call_thedisplay, 0);
- else
- fprintf (stderr, "Cannot connect to X server %s\n",
- XDisplayName ((char*) NULL));
-
- return (call_thedisplay == NULL);
-}
-
-/*RIC120302*/
-Tint
-call_tox_set_display (void *vdisplay)
-{
- Display *pdisplay = (Display*) vdisplay;
- char synchro[132];
-
- if ( pdisplay ) {
- call_thedisplay = pdisplay;
-
- if (call_util_osd_getenv ("CALL_SYNCHRO_X", synchro, 132))
- XSynchronize (call_thedisplay, 1);
- else
- XSynchronize (call_thedisplay, 0);
- } else {
- fprintf (stderr, "Cannot connect to X server %s\n",
- XDisplayName ((char*) NULL));
- }
- return (call_thedisplay != NULL);
-}
-/*RIC120302*/
-
-/*----------------------------------------------------------------------*/
-
-void
-call_tox_getscreen( Tint *d_wdth, Tint *d_hght )
-{
- *d_wdth = DisplayWidth( call_thedisplay, DefaultScreen(call_thedisplay) );
- *d_hght = DisplayHeight( call_thedisplay, DefaultScreen(call_thedisplay) );
- return;
-}
-
-/*----------------------------------------------------------------------*/
-
-Tfloat
-call_tox_getpitchsize( )
-{
- static float pitch_size = 0.;
-
- if( pitch_size == 0. ) {
- int width = DisplayWidth( call_thedisplay, DefaultScreen(call_thedisplay) );
- int height = DisplayHeight( call_thedisplay, DefaultScreen(call_thedisplay) );
- int mmwidth = DisplayWidthMM( call_thedisplay, DefaultScreen(call_thedisplay) );
- int mmheight = DisplayHeightMM( call_thedisplay, DefaultScreen(call_thedisplay) );
- pitch_size = ((float)mmwidth/width + (float)mmheight/height)/2.;
- }
-
- return pitch_size;
-}
-
-/*----------------------------------------------------------------------*/
-#else
-# include <windows.h>
-# include <OpenGl_tgl_all.hxx>
-# include <OpenGl_txgl.hxx>
-
-DISPLAY* call_thedisplay = "DISPLAY"; /* Dummy for Windows NT */
-
-Tint
-call_tox_open_display ( void )
-{
- return 1;
-}
-
-/*RIC120302*/
-Tint
-call_tox_set_display ( void* vdisplay)
-{
- return 1;
-}
-/*RIC120302*/
-
-void
-call_tox_getscreen ( Tint *d_wdth, Tint *d_hght )
-{
- *d_wdth = GetSystemMetrics(SM_CXSCREEN);
- *d_hght = GetSystemMetrics(SM_CYSCREEN);
- return;
-}
-
-#endif /* WNT */
+++ /dev/null
-switch (elem) {
- case TelNil:
- printf ("TelNil\n");
- break;
- case TelLabel:
- printf ("TelLabel %d\n", e[i].data);
- break;
- case TelAntiAliasing:
- printf ("TelAntiAliasing\n");
- break;
- case TelBlink:
- printf ("TelBlink\n");
- break;
- case TelExecuteStructure:
- printf ("TelExecuteStructure %d\n", e[i].data);
- break;
- case TelPolylineColour:
- printf ("TelPolylineColour\n");
- break;
- case TelPolylineType:
- printf ("TelPolylineType\n");
- break;
- case TelPolylineWidth:
- printf ("TelPolylineWidth\n");
- break;
- case TelInteriorStyle:
- printf ("TelInteriorStyle\n");
- break;
- case TelInteriorColour:
- printf ("TelInteriorColour\n");
- break;
- case TelBackInteriorColour:
- printf ("TelBackInteriorColour\n");
- break;
- case TelEdgeColour:
- printf ("TelEdgeColour\n");
- break;
- case TelEdgeType:
- printf ("TelEdgeType\n");
- break;
- case TelEdgeWidth:
- printf ("TelEdgeWidth\n");
- break;
- case TelEdgeFlag:
- printf ("TelEdgeFlag\n");
- break;
- case TelInteriorStyleIndex:
- printf ("TelInteriorStyleIndex\n");
- break;
- case TelFaceDistinguishingMode:
- printf ("TelFaceDistinguishingMode\n");
- break;
- case TelFaceCullingMode:
- printf ("TelFaceCullingMode\n");
- break;
- case TelInteriorReflectanceEquation:
- printf ("TelInteriorReflectanceEquation\n");
- break;
- case TelSurfaceAreaProperties:
- printf ("TelSurfaceAreaProperties\n");
- break;
- case TelBackInteriorReflectanceEquation:
- printf ("TelBackInteriorReflectanceEquation\n");
- break;
- case TelBackSurfaceAreaProperties:
- printf ("TelBackSurfaceAreaProperties\n");
- break;
- case TelPolymarkerColour:
- printf ("TelPolymarkerColour\n");
- break;
- case TelPolymarkerType:
- printf ("TelPolymarkerType\n");
- break;
- case TelPolymarkerSize:
- printf ("TelPolymarkerSize\n");
- break;
- case TelTextFont:
- printf ("TelTextFont\n");
- break;
- case TelTextHeight:
- printf ("TelTextHeight\n");
- break;
- case TelCharacterSpacing:
- printf ("TelCharacterSpacing\n");
- break;
- case TelCharacterExpansionFactor:
- printf ("TelCharacterExpansionFactor\n");
- break;
- case TelTextColour:
- printf ("TelTextColour\n");
- break;
- case TelDepthCueIndex:
- printf ("TelDepthCueIndex\n");
- break;
- case TelPickId:
- printf ("TelPickId\n");
- break;
- case TelPolygon:
- printf ("TelPolygon\n");
- break;
- case TelPolygonSet:
- printf ("TelPolygonSet\n");
- break;
- case TelPolygonHoles:
- printf ("TelPolygonHoles\n");
- break;
- case TelPolygonIndices:
- printf ("TelPolygonIndices\n");
- break;
- case TelQuadrangle:
- printf ("TelQuadrangle\n");
- break;
- case TelPolyline:
- printf ("TelPolyline\n");
- break;
- case TelMarker:
- printf ("TelMarker\n");
- break;
- case TelMarkerSet:
- printf ("TelMarkerSet\n");
- break;
- case TelText:
- printf ("TelText\n");
- break;
- case TelTriangleMesh:
- printf ("TelTriangleMesh\n");
- break;
- case TelAddNameset:
- printf ("TelAddNameset\n");
- break;
- case TelRemoveNameset:
- printf ("TelRemoveNameset\n");
- break;
- case TelInteriorShadingMethod:
- printf ("TelInteriorShadingMethod\n");
- break;
- case TelLocalTran3:
- printf ("TelLocalTran3\n");
- break;
- case TelHighlightIndex:
- printf ("TelHighlightIndex\n");
- break;
- case TelLightSrcState:
- printf ("TelLightSrcState\n");
- break;
- case TelClippingPlane:
- printf ("TelClippingPlane\n");
- break;
- case TelViewIndex:
- printf ("TelViewIndex\n");
- break;
- case TelApplicationData:
- printf ("TelApplicationData\n");
- break;
- case TelCurve:
- printf ("TelCurve\n");
- break;
- case TelTextureId:
- printf ("TelTextureId\n");
- break;
- case TelDoTextureMap:
- printf ("TelDoTextureMap\n");
- break;
- case TelLast:
- printf ("TelLast\n");
- break;
- default:
- printf ("default\n");
- break;
-}
+++ /dev/null
-
-#include <OpenGl_transform_persistence.hxx>
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h> /* pour M_PI */
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_tsm_ws.hxx> /* pour TsmGetWSAttri */
-#include <OpenGl_telem_view.hxx> /* pour tel_view_data */
-
-
-#include <OpenGl_tgl_funcs.hxx>
-
-#include <OpenGl_Memory.hxx>
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Type definitions
-*/
-
-typedef struct
-{
- TEL_VIEW_REP vrep;
-#ifdef CAL_100498
- Tmatrix3 inverse_matrix;/* accelerates UVN2XYZ conversion */
-#endif
-} TEL_VIEW_DATA, *tel_view_data; /* Internal data stored for every view rep */
-
-
-
-static TStatus TransformPersistenceDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TransformPersistenceAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TransformPersistenceDelete( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus TransformPersistencePrint( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- TransformPersistenceDisplay, /* PickTraverse */
- TransformPersistenceDisplay,
- TransformPersistenceAdd,
- 0, /*TransformPersistenceDelete,*/
- TransformPersistencePrint,
- 0 /* Inquire */
-};
-
-
-MtblPtr
-TelTransformPersistentInitClass( TelType *el )
-{
- *el = TelTransformPersistence;
- return MtdTbl;
-}
-
-static TStatus
-TransformPersistenceAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- tel_transform_persistence data = new TEL_TRANSFORM_PERSISTENCE();
-
- if( !data )
- return TFailure;
-
- *data = *(tel_transform_persistence)(k[0]->data.pdata);
-
- ((tsm_elem_data)(d.pdata))->pdata = data;
-
- return TSuccess;
-}
-
-
-static TStatus
-TransformPersistenceDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY key;
-
- key.id = TelTransformPersistence;
- key.data.pdata = data.pdata;
- TsmSetAttri( 1, &key );
- return TSuccess;
-}
-
-static TStatus
-TransformPersistenceDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- /* transform_persistence_end();*/
- return TSuccess;
-}
-
-
-static TStatus
-TransformPersistencePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
-
- return TSuccess;
-}
-
-/***********************************/
-static int isGenerated = 0;
-
-void transform_persistence_end(void)
-{
- if( isGenerated == 1 )
- /* restore matrix */
- {
- glMatrixMode (GL_PROJECTION);
- glPopMatrix ();
- glMatrixMode (GL_MODELVIEW);
- glPopMatrix ();
- isGenerated = 0;
- }
-
- /*printf( "Transform Persistence End: %i \n", isGenerated );*/
-}
-
-
-void transform_persistence_begin( int theFlag,
- float theX,
- float theY,
- float theZ )
-{
- CMN_KEY_DATA key;
- tel_view_data vptr;
- int i, j;
- GLdouble modelMatrix[4][4];
- GLdouble projMatrix[4][4];
- GLdouble idenMatrix[4][4] = { {1.,0.,0.,0.}, {0.,1.,0.,0.}, {0.,0.,1.,0.},{0.,0.,0.,1.} };
- GLint viewport[4];
- double det2;
-
- double W, H, W1, W2, H1, H2;
- double winx, winy, winz;
- double scaleX, scaleY, scaleZ;
-
-#ifdef PRINT1
- printf( "Transform Persistence Mode: %i\n", theFlag );
- printf( "Transform Persistence PointX: %f\n", theX );
- printf( "Transform Persistence PointY: %f\n", theY );
- printf( "Transform Persistence PointZ: %f\n", theZ );
-#endif /*PRINT1*/
-
- if( theFlag == 0 )
- {
- transform_persistence_end();
- return;
- }
-
- glGetIntegerv (GL_VIEWPORT, viewport);
- glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix );
- glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix );
-
- W = viewport[2];
- H = viewport[3];
-
- if( isGenerated == 0 )
- isGenerated = 1;
- else
- {
- /* restore matrix */
- glMatrixMode (GL_PROJECTION);
- glPopMatrix ();
- glMatrixMode (GL_MODELVIEW);
- glPopMatrix ();
- }
-
- glMatrixMode( GL_MODELVIEW );
- glPushMatrix();
- glLoadIdentity();
-
- glMatrixMode( GL_PROJECTION );
- glPushMatrix();
- glLoadIdentity();
-
- /*pre loading matrix*/
- if( theFlag & TPF_PAN )
- /* Annulate translate matrix */
- {
- modelMatrix[3][0] = 0.;
- modelMatrix[3][1] = 0.;
- modelMatrix[3][2] = 0.;
- projMatrix[3][0] = 0.;
- projMatrix[3][1] = 0.;
- projMatrix[3][2] = 0.;
- }
-
- if( theFlag & TPF_ZOOM )
- /* Annulate zoom matrix */
- {
- if( W > H )
- det2 = 0.002 / projMatrix[1][1];
- else
- det2 = 0.002 / projMatrix[0][0];
-
- TsmGetWSAttri( TglActiveWs, WSViews, &key );
- vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/
- scaleX = vptr->vrep.extra.scaleFactors[0];
- scaleY = vptr->vrep.extra.scaleFactors[1];
- scaleZ = vptr->vrep.extra.scaleFactors[2];
-
- for( i = 0; i < 3; i++ )
- {
- for( j = 0; j < 3; j++ )
- {
- if(i == 0)
- modelMatrix[i][j] /= scaleX;
- if(i == 1)
- modelMatrix[i][j] /= scaleY;
- if(i == 2)
- modelMatrix[i][j] /= scaleZ;
- }
- }
- for( i = 0 ; i < 2; i++ )
- projMatrix[i][i] *= det2;
- }
-
- if( theFlag & TPF_ROTATE )
- /* Annulate rotate matrix */
- {
- modelMatrix[0][0] = 1.;
- modelMatrix[1][1] = 1.;
- modelMatrix[2][2] = 1.;
-
- modelMatrix[1][0] = 0.;
- modelMatrix[2][0] = 0.;
- modelMatrix[0][1] = 0.;
- modelMatrix[2][1] = 0.;
- modelMatrix[0][2] = 0.;
- modelMatrix[1][2] = 0.;
- }
- else if( theFlag & TPF_RELATIVE_ROTATE )
- /* Initialize relative rotate matrix*/
- {
- modelMatrix[3][0] = 0.;
- modelMatrix[3][1] = 0.;
- modelMatrix[3][2] = 0.;
-
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslated( theX, theY, theZ );
- }
-
- if( theFlag == TPF_TRIEDRON )
- {
- /* Annulate translation matrix */
- modelMatrix[3][0] = 0.;
- modelMatrix[3][1] = 0.;
- modelMatrix[3][2] = 0.;
-
- projMatrix[3][0] = 0.;
- projMatrix[3][1] = 0.;
- projMatrix[3][2] = 0.;
-
- if( W > H )
- det2 = 0.002 / projMatrix[1][1];
- else
- det2 = 0.002 / projMatrix[0][0];
-
- for( i = 0 ; i < 2; i++ )
- projMatrix[i][i] *= det2;
- }
-
- /* load matrix */
- glMatrixMode (GL_MODELVIEW);
- glMultMatrixd( (GLdouble *) modelMatrix);
-
- glMatrixMode ( GL_PROJECTION );
- glMultMatrixd( (GLdouble *) projMatrix);
-
-
- /*post loading matrix*/
- if( theFlag == TPF_TRIEDRON )
- {
- glMatrixMode( GL_PROJECTION );
-
- gluUnProject( W/2, H/2., 0, (GLdouble*)idenMatrix, (GLdouble*)projMatrix, (GLint*)viewport, &winx, &winy, &winz);
- W1 = winx;
- H1 = winy;
- gluUnProject( -W/2, -H/2., 0, (GLdouble*)idenMatrix, (GLdouble*)projMatrix, (GLint*)viewport, &winx, &winy, &winz);
- W2 = winx;
- H2 = winy;
-
- if( theX == 0. && theY == 0. )
- {
- /*center*/
- }
- else if( theX > 0. && theY > 0. )
- {
- /*right upper*/
- glTranslated( (W1 - W2)/2. - theZ/2., (H1-H2)/2. - theZ/2., 0. );
- }
- else if( theX > 0. && theY < 0. )
- {
- /*right lower*/
- glTranslated( (W1 - W2)/2. - theZ/2., -(H1-H2)/2. + theZ/2., 0. );
- }
- else if( theX < 0. && theY > 0. )
- {
- /*left upper*/
- glTranslated( -(W1 - W2)/2. + theZ/2., (H1-H2)/2. - theZ/2., 0. );
- }
- else if( theX < 0 && theY < 0 )
- {
- /*left lower*/
- glTranslated( -(W1 - W2)/2. + theZ/2., -(H1-H2)/2. + theZ/2., 0. );
- }
- }
-}
TPF_TRIEDRON = 0x020
};
-
-extern void transform_persistence_begin( int, float, float, float );
-
-extern void transform_persistence_end(void);
-
-
#endif /*OPENGL_TRANSFORM_PERSISTENCE_H*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_triedron : gestion du triedre non zoomable.
-
-REMARQUES:
-----------
-
-Algorithme :
-o dimensions et origine du triedre sont recalcules a chaque fois, en
-fonction de la taille (u,v = largeur-hauteur) de la fenetre =>
-il est inutile ici de jouer sur le facteur d'echelle.
-o on n'inhibe que les translations, car on veut conserver les
-transformations d'orientations.
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-08-12-98 : BGN ; Creation.
-
-
-************************************************************************/
-
-#define BUC60851 /* GG 15/03/01 Avoid to raise after the second creation
-of the trihedron
-*/
-
-#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
-from higher API */
-
-
-#define QTOCC_PATCH /* Active QtOPENCASCADE patches */
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tgl_tox.hxx>
-
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h> /* pour M_PI */
-
-#include <OpenGl_LightBox.hxx>
-#include <OpenGl_TextureBox.hxx>
-#include <OpenGl_tgl_tox.hxx>
-
-#include <OpenGl_tsm_ws.hxx> /* pour TsmGetWSAttri */
-#include <OpenGl_telem_view.hxx> /* pour tel_view_data */
-#include <InterfaceGraphic_Graphic3d.hxx> /* pour CALL_DEF_STRUCTURE */
-#include <InterfaceGraphic_Aspect.hxx> /* pour CALL_DEF_VIEW */
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_transform_persistence.hxx>
-
-#ifdef HAVE_GL2PS
-#include <gl2ps.h>
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <OpenGl_TextRender.hxx>
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define NO_DEBUG
-#define NO_PRINT
-#define NO_PRINT_MATRIX
-
-/* on trouve que 10 vues sera suffisant */
-#define GROW_SIZE_NZ_WKS 10
-
-/* pour l'instant on ne travaille que sur le triedre */
-/* on augmentera le define quand on developpera les struc. non zoomables*/
-#define GROW_SIZE_NZ_STRUC 1
-
-/* Identificateur du Triedre Non Zommable dans la liste des structures */
-# define TRIEDRON_ID -100
-
-/*----------------------------------------------------------------------*/
-/*
-* Definition de types
-*/
-typedef struct
-{
- float aXColor[3];
- float aYColor[3];
- float aZColor[3];
- float aRatio;
- float aDiametr;
- int aNbFacettes;
-} ZBUF_STRUCT;
-
-
-/* donnees des structures non zoomables liees a une wks (=une vue) */
-typedef struct
-{
- int NZStrucID; /* = TRIEDRON_ID ou astructure->Id de Graphic3d sinon.*/
- int aPos;
- float aColor[3];
- float aScale;
- int isWireframe;
- CALL_DEF_STRUCTURE * astructure;
- ZBUF_STRUCT* aZBufParam;
-} NZ_STRUC_DATA;
-
-
-
-/* liste des wks (=vues) concernees par les structures non zoomables */
-typedef struct
-{
- int nz_wks; /* = id de la wks */
- int triedron_on; /* =0 si le triedre non zoomable n'est pas defini */
- int nz_struc_count; /* nb de structures non zoomables de la vue */
- int nz_struc_size;
- NZ_STRUC_DATA *nz_struc;
-} NZ_WKS;
-
-
-typedef struct
-{
- TEL_VIEW_REP vrep;
-} TEL_VIEW_DATA, *tel_view_data; /* Internal data stored for every view rep */
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-static NZ_WKS *nz_wks = NULL;
-static int nz_wks_count = 0;
-static int nz_wks_size = 0;
-
-/* Default parameters for ZBUFFER triheron */
-static float theXColor[] = { 1.0, 0.0, 0.0 };
-static float theYColor[] = { 0.0, 1.0, 0.0 };
-static float theZColor[] = { 0.0, 0.0, 1.0 };
-static float theRatio = 0.8f;
-static float theDiametr = 0.05f;
-static int theNBFacettes = 12;
-
-/*----------------------------------------------------------------------*/
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions privees
-*/
-
-
-
-/*----------------------------------------------------------------------*/
-/*
-* recherche de la wks NZWksID concernee par les structures non zoomables;
-* creation de l'element wks s'il n'existe pas.
-*/
-static int find_nz_wks(int NZWksID, int alloc)
-{
- int i;
-
- /* recherche la wks dans la liste si elle existe */
- for (i=0; i<nz_wks_count; i++)
- if (nz_wks[i].nz_wks == NZWksID)
- return i;
-
- if (!alloc) return -1;
-
- /* la wks n'existe pas => on fait de la place si il n'y en a plus */
- if (nz_wks_count == nz_wks_size) {
-#ifdef BUC60851
- if( nz_wks_size > 0 ) {
- nz_wks_size += GROW_SIZE_NZ_WKS;
- nz_wks = (NZ_WKS *) realloc(nz_wks, nz_wks_size * sizeof(NZ_WKS));
- } else {
- nz_wks_size = GROW_SIZE_NZ_WKS;
- nz_wks = (NZ_WKS *) malloc(nz_wks_size * sizeof(NZ_WKS));
- }
-#else
- nz_wks_size += GROW_SIZE_NZ_WKS;
- nz_wks = (NZ_WKS *) realloc(nz_wks, nz_wks_size * sizeof(NZ_WKS));
-#endif
- if (nz_wks == NULL) return -1;
- }
-
- nz_wks[nz_wks_count].nz_wks = NZWksID;
- nz_wks[nz_wks_count].triedron_on = 0;
- nz_wks[nz_wks_count].nz_struc = NULL;
- nz_wks[nz_wks_count].nz_struc_size = 0;
- nz_wks[nz_wks_count].nz_struc_count = 0;
-
- return nz_wks_count++;
-}
-
-/*-----------------------------------------------------------------*/
-/*
-* recherche de la structure non zoomable NZStrucID dans la liste
-* de la wks NZWksIdx ;
-* creation de l'element structure non zoomable s'il n'existe pas.
-*/
-static int find_nz_struc(int NZWksIdx, int NZStrucID, int alloc)
-{
- int i;
- NZ_STRUC_DATA *nz_struc;
-
-
- /* recherche la structure non zoomable dans la liste de la wks */
- nz_struc = nz_wks[NZWksIdx].nz_struc;
- for (i=0; i<nz_wks[NZWksIdx].nz_struc_count; i++)
- if (nz_struc[i].NZStrucID == NZStrucID)
- return i;
-
- if (!alloc) return -1;
-
- /* la structure non zoomable n'existe pas => on la cree */
- if (nz_wks[NZWksIdx].nz_struc_count == nz_wks[NZWksIdx].nz_struc_size) {
-#ifdef BUC60851
- if( nz_wks[NZWksIdx].nz_struc_size > 0 ) {
- nz_wks[NZWksIdx].nz_struc_size += GROW_SIZE_NZ_STRUC;
- nz_wks[NZWksIdx].nz_struc =
- (NZ_STRUC_DATA *) realloc(nz_wks[NZWksIdx].nz_struc,
- nz_wks[NZWksIdx].nz_struc_size * sizeof(NZ_STRUC_DATA));
- } else {
- nz_wks[NZWksIdx].nz_struc_size = GROW_SIZE_NZ_STRUC;
- nz_wks[NZWksIdx].nz_struc =
- (NZ_STRUC_DATA *) malloc( nz_wks[NZWksIdx].nz_struc_size * sizeof(NZ_STRUC_DATA));
- }
-#else
- nz_wks[NZWksIdx].nz_struc_size += GROW_SIZE_NZ_STRUC;
- nz_wks[NZWksIdx].nz_struc = (NZ_STRUC_DATA *) realloc(nz_wks[NZWksIdx].nz_struc, nz_wks[NZWksIdx].nz_struc_size * sizeof(NZ_STRUC_DATA));
-#endif
- if (nz_wks[NZWksIdx].nz_struc == NULL) return -1;
-
- nz_wks[NZWksIdx].nz_struc[nz_wks[NZWksIdx].nz_struc_count].aZBufParam = NULL;
- }
-
- return nz_wks[NZWksIdx].nz_struc_count++;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-/*
-* affichage d'un triedre non zoomable a partir des index dans les tables
-* des structures non zoomables.
-*
-* Triedre = Objet non Zoomable :
-* on recalcule ses dimensions et son origine en fonction de la taille
-* de la fenetre; on positionne selon le choix de l'init;
-* et on inhibe seulement les translations.
-*
-*/
-
-
-
-
-TStatus call_triedron_redraw (
- int nz_wks_entry,
- int nz_struc_entry,
- GLdouble U,
- GLdouble V
- )
-{
- GLdouble modelMatrix[4][4];
- GLdouble projMatrix[4][4];
-
- GLdouble TriedronAxeX[3] = { 1.0, 0.0, 0.0 };
- GLdouble TriedronAxeY[3] = { 0.0, 1.0, 0.0 };
- GLdouble TriedronAxeZ[3] = { 0.0, 0.0, 1.0 };
- GLdouble TriedronOrigin[3] = { 0.0, 0.0, 0.0 };
- GLfloat TriedronColor[3] = { 1.0, 1.0, 1.0 }; /* def = blanc */
-
- GLfloat TriedronWidth = 1.0;
- GLfloat TriedronScale = (float)0.1 ;
- GLint TriedronPosition = 0; /* def = Aspect_TOTP_CENTER */
-
- GLdouble L, l, rayon ;
- GLdouble minUV;
- int ii;
-#ifdef PRINT_MATRIX
- int jj;
-#endif
- int NbFacettes;
- double Angle;
- GLdouble TriedronCoord[3] = { 1.0, 0.0, 0.0 };
-
- GLuint fontBase = 0;
- GLint mode;
-
-#ifdef QTOCC_PATCH /* PCD 10/02/08 */
- /* Fix to problem with clipping planes chopping off pieces of the triedron */
- GLint max_plane=0;
- GLboolean* isPlaneActive;
- glGetIntegerv( GL_MAX_CLIP_PLANES, &max_plane);
- isPlaneActive= new GLboolean[max_plane];
- /* Backup the clip planes. */
- for (ii = 0; ii < max_plane ; ii++) {
- isPlaneActive[ii] = glIsEnabled(GL_CLIP_PLANE0 + ii);
- glDisable(GL_CLIP_PLANE0 + ii);
- }
-#endif
-
- /*
- * Lecture des Init. du Triedre
- */
-
- TriedronColor[0] = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[0];
- TriedronColor[1] = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[1];
- TriedronColor[2] = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[2];
- TriedronScale = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aScale;
- TriedronPosition = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aPos;
-
-
- /*
- * Calcul des axes => on inhibe le zoom.
- */
-
- /* la taille des axes est 1 proportion (fixee a l'init du triedre) */
- /* de la dimension la plus petite de la window. */
- if ( U < V ) minUV = U;
- else minUV = V;
- L = minUV * (double) TriedronScale ;
-
- /* Position de l'origine */
- TriedronOrigin[0]= 0.0;
- TriedronOrigin[1]= 0.0;
- TriedronOrigin[2]= 0.0;
-
- /* Position des Axes */
- TriedronAxeX[0] = TriedronOrigin[0] + L ;
- TriedronAxeX[1] = TriedronOrigin[1] + 0.0;
- TriedronAxeX[2] = TriedronOrigin[2] + 0.0;
-
- TriedronAxeY[0] = TriedronOrigin[0] + 0.0;
- TriedronAxeY[1] = TriedronOrigin[1] + L ;
- TriedronAxeY[2] = TriedronOrigin[2] + 0.0;
-
- TriedronAxeZ[0] = TriedronOrigin[0] + 0.0;
- TriedronAxeZ[1] = TriedronOrigin[1] + 0.0;
- TriedronAxeZ[2] = TriedronOrigin[2] + L ;
-
- /*
- * On inhibe les translations; on conserve les autres transformations.
- */
-
- /* on lit les matrices de transformation et de projection de la vue */
- /* pour annuler les translations (dernieres colonnes des matrices). */
- glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix );
- glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix );
-
-#ifdef PRINT_MATRIX
- printf ("\n--- call_triedron_redraw : avant transfo projMatrix= ");
- for (ii = 0; ii<4 ; ii++) {
- printf ("\n ");
- for (jj = 0; jj<4 ; jj++) {
- printf (" %f ", projMatrix[ii][jj] );
- }
- }
- printf ("\n--- call_triedron_redraw : avant transfo modelMatrix= ");
- for (ii = 0; ii<4 ; ii++) {
- printf ("\n ");
- for (jj = 0; jj<4 ; jj++) {
- printf (" %f ", modelMatrix[ii][jj] );
- }
- }
-#endif
-
-
- /* on annule la translation qui peut etre affectee a la vue */
- modelMatrix[3][0] = 0. ;
- modelMatrix[3][1] = 0. ;
- modelMatrix[3][2] = 0. ;
- projMatrix[3][0] = 0. ;
- projMatrix[3][1] = 0. ;
- projMatrix[3][2] = 0. ;
-
-
- /* sauvegarde du contexte des matrices avant chargement */
- glMatrixMode (GL_MODELVIEW);
- glPushMatrix ();
- glLoadIdentity ();
- glLoadMatrixd( (GLdouble *) modelMatrix);
- glMatrixMode ( GL_PROJECTION );
- glPushMatrix ();
- glLoadIdentity();
- glLoadMatrixd( (GLdouble *) projMatrix);
-
-
-#ifdef PRINT_MATRIX
- printf ("\n\n\n--- call_triedron_redraw : APRES transfo projMatrix= ");
- for (ii = 0; ii<4 ; ii++) {
- printf ("\n ");
- for (jj = 0; jj<4 ; jj++) {
- printf (" %f ", projMatrix[ii][jj] );
- }
- }
- printf ("\n--- call_triedron_redraw : APRES transfo modelMatrix= ");
- for (ii = 0; ii<4 ; ii++) {
- printf ("\n ");
- for (jj = 0; jj<4 ; jj++) {
- printf (" %f ", modelMatrix[ii][jj] );
- }
- }
-#endif
-
-
- /*
- * Positionnement de l'origine du triedre selon le choix de l'init
- */
-
- /* on fait uniquement une translation de l'origine du Triedre */
-
- switch (TriedronPosition) {
-
- case 0 : /* Aspect_TOTP_CENTER */
- break;
-
- case 1 : /* Aspect_TOTP_LEFT_LOWER */
- glTranslated( -U/2. + L , -V/2. + L , 0. );
- break;
-
- case 2 : /*Aspect_TOTP_LEFT_UPPER */
- glTranslated( -U/2. + L , +V/2. - L -L/3. , 0. );
- break;
-
- case 3 : /* Aspect_TOTP_RIGHT_LOWER */
- glTranslated( U/2. - L -L/3. , -V/2. + L , 0. );
- break;
-
- case 4 : /* Aspect_TOTP_RIGHT_UPPER */
- glTranslated( U/2. - L -L/3. , +V/2. - L -L/3. , 0. );
- break;
-
- default :
- break;
-
- }
-
-#ifdef PRINT
- printf ("\n--- call_triedron_redraw : TriedronOrigin= %f %f %f\n",
- TriedronOrigin[0], TriedronOrigin[1], TriedronOrigin[2]);
- printf ("\n--- : TriedronAxeX= %f %f %f \n",
- TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]);
- printf ("\n--- : TriedronAxeY= %f %f %f \n",
- TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2] );
- printf ("\n--- : TriedronAxeZ= %f %f %f \n",
- TriedronAxeZ[0], TriedronAxeZ[1], TriedronAxeZ[2]);
- printf ("\n--- : TriedronScale= %f \n",TriedronScale);
- printf ("\n--- : 1/echelle = ( %f %f %f %f ) \n",
- modelMatrix[0][0],modelMatrix[1][1],modelMatrix[2][2],modelMatrix[3][3]);
-#endif
-
-
- /*
- * Creation du triedre
- */
- glColor3fv (TriedronColor);
-
- glGetIntegerv( GL_RENDER_MODE, &mode );
-
-#ifdef HAVE_GL2PS
- if( mode==GL_RENDER )
- glLineWidth( TriedronWidth );
- else if( mode==GL_FEEDBACK )
- gl2psLineWidth( TriedronWidth );
-#else
- glLineWidth( TriedronWidth );
-#endif
-
-#ifdef QTOCC_PATCH /* Fotis Sioutis 2007-11-14 15:06
- I have also seen in previous posts that the view trihedron in V3d_WIREFRAME mode
- changes colors depending on the state of the view. This behaviour can be easily
- corrected by altering call_triedron_redraw function in OpenGl_triedron.c of TKOpengl.
- The only change needed is to erase the LightOff() function that is called before the
- Axis name drawing and move this function call just before the initial axis drawing.
- Below is the code portion with the modification.I don't know if this is considered to
- be a bug but anyway i believe it might help some of you out there.*/
- LightOff();
-#endif
-
- /* dessin des axes */
- glBegin(GL_LINES);
- glVertex3dv( TriedronOrigin );
- glVertex3dv( TriedronAxeX );
-
- glVertex3dv( TriedronOrigin );
- glVertex3dv( TriedronAxeY );
-
- glVertex3dv( TriedronOrigin );
- glVertex3dv( TriedronAxeZ );
- glEnd();
-
-
- /* fleches au bout des axes (= cones de la couleur demandee) */
- l = L - L/4. ; /* distance a l'origine */
- rayon = L/30. ; /* rayon de la base du cone */
- NbFacettes = 12; /* le cone sera compose de 12 facettes triangulaires */
- Angle = 2. * M_PI/ NbFacettes;
-
- /* solution FILAIRE des cones au bout des axes : une seule ligne */
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- /* (la couleur est deja initialisee dans TriedronColor) */
- /* FIN de la solution FILAIRE CHOISIE pour les cones des axes */
-
- /* fleche en X */
- glBegin(GL_TRIANGLE_FAN);
- glVertex3dv( TriedronAxeX );
- TriedronCoord[0] = TriedronOrigin[0] + l ;
- ii = NbFacettes;
- while (ii >= 0 ) {
- TriedronCoord[1] = TriedronOrigin[1] + ( rayon * sin(ii * Angle) );
- TriedronCoord[2] = TriedronOrigin[2] + ( rayon * cos(ii * Angle) );
- glVertex3dv( TriedronCoord );
- ii--;
- }
- glEnd();
-
- /* fleche en Y */
- glBegin(GL_TRIANGLE_FAN);
- glVertex3dv( TriedronAxeY );
- TriedronCoord[1] = TriedronOrigin[1] + l ;
- ii = NbFacettes;
- while (ii >= 0 ) {
- TriedronCoord[0] = TriedronOrigin[0] + (rayon * cos(ii * Angle) );
- TriedronCoord[2] = TriedronOrigin[2] + (rayon * sin(ii * Angle) );
- glVertex3dv( TriedronCoord );
- ii--;
- }
- glEnd();
-
- /* fleche en Z */
- glBegin(GL_TRIANGLE_FAN);
- glVertex3dv( TriedronAxeZ );
- TriedronCoord[2] = TriedronOrigin[2] + l ;
- ii = NbFacettes;
- while (ii >= 0 ) {
- TriedronCoord[0] = TriedronOrigin[0] + ( rayon * sin(ii * Angle) );
- TriedronCoord[1] = TriedronOrigin[1] + ( rayon * cos(ii * Angle) );
- glVertex3dv( TriedronCoord );
- ii--;
- }
- glEnd();
-
- /* dessin de l'origine */
- TriedronCoord[0] = TriedronOrigin[0] + rayon ;
- TriedronCoord[1] = TriedronOrigin[1] + 0.0 ;
- TriedronCoord[2] = TriedronOrigin[2] + 0.0 ;
- ii = 24 ;
- Angle = 2. * M_PI/ii ;
- glBegin(GL_LINE_LOOP);
- while (ii >= 0 ) {
- TriedronCoord[0] = TriedronOrigin[0] + ( rayon * sin(ii * Angle) );
- TriedronCoord[1] = TriedronOrigin[1] + ( rayon * cos(ii * Angle) );
- glVertex3dv( TriedronCoord );
- ii--;
- }
- glEnd();
-
- LightOff();
-
- /*
- * Noms des axes et de l'origine
- */
-
- /* init de la fonte */
-
- OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
-
- /* Axe X */
- TriedronCoord[0] = TriedronOrigin[0] + ( L + rayon ) ;
- TriedronCoord[1] = TriedronOrigin[1] + 0.0;
- TriedronCoord[2] = TriedronOrigin[2] - rayon ;
- textRender->RenderText(L"X", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2] );
-
- /* Axe Y */
- TriedronCoord[0] = TriedronOrigin[0] + rayon ;
- TriedronCoord[1] = TriedronOrigin[1] + ( L + 3.0 * rayon ) ;
- TriedronCoord[2] = TriedronOrigin[2] + ( 2.0 * rayon );
- textRender->RenderText(L"Y", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
-
- /* Axe Z */
- TriedronCoord[0] = TriedronOrigin[0] + ( - 2.0 * rayon ) ;
- TriedronCoord[1] = TriedronOrigin[1] + rayon/2. ;
- TriedronCoord[2] = TriedronOrigin[2] + ( L + 3.0 * rayon ) ;
- textRender->RenderText(L"Z", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
-
-#ifdef QTOCC_PATCH /* PCD 10/02/08 */
- /* Recover the clip planes */
- glGetIntegerv( GL_MAX_CLIP_PLANES, &max_plane);
- for (ii = 0; ii <max_plane ; ii++) {
- if (isPlaneActive[ii]) {
- glEnable(GL_CLIP_PLANE0 + ii);
- }
- }
- free(isPlaneActive);
-
-#endif
-
- /*
- * restauration du contexte des matrices
- */
- glMatrixMode (GL_PROJECTION);
- glPopMatrix ();
- glMatrixMode (GL_MODELVIEW);
- glPopMatrix ();
-
-
- return (TSuccess);
-
-}
-
-
-
-
-/*******************************************************
-* Draws ZBUFFER trihedron mode
-*******************************************************/
-TStatus call_zbuffer_triedron_redraw (
- int nz_wks_entry,
- int nz_struc_entry,
- GLdouble U,
- GLdouble V
- )
-{
- GLdouble modelMatrix[4][4];
- GLdouble projMatrix[4][4];
-
- GLdouble TriedronAxeX[3] = { 1.0, 0.0, 0.0 };
- GLdouble TriedronAxeY[3] = { 0.0, 1.0, 0.0 };
- GLdouble TriedronAxeZ[3] = { 0.0, 0.0, 1.0 };
- GLdouble TriedronOrigin[3] = { 0.0, 0.0, 0.0 };
- GLfloat TriedronColor[3] = { 1.0, 1.0, 1.0 }; /* def = blanc */
-
- GLfloat TriedronScale = (float)0.1 ;
- GLint TriedronPosition = 0; /* def = Aspect_TOTP_CENTER */
-
- GLdouble L, l, rayon ;
- GLdouble minUV;
- int NbFacettes = 12;
- double Angle;
- GLdouble TriedronCoord[3] = { 1.0, 0.0, 0.0 };
-
- GLuint fontBase = 0;
-
- GLuint startList;
- GLUquadricObj* aQuadric;
- GLfloat aXColor[] = { 1.0, 0.0, 0.0, 0.6f };
- GLfloat aYColor[] = { 0.0, 1.0, 0.0, 0.6f };
- GLfloat aZColor[] = { 0.0, 0.0, 1.0, 0.6f };
- GLdouble aConeDiametr;
- GLdouble aConeLength;
- GLdouble aCylinderDiametr;
- GLdouble aCylinderLength;
- GLboolean aIsDepthEnabled;
-#ifndef BUG
- GLboolean aIsDepthMaskEnabled;
-#endif
- GLint aViewPort[4]; /* to store view port coordinates */
- GLdouble aWinCoord[3];
- GLboolean isWithinView;
- GLdouble aLengthReduce = 0.8;
- GLdouble aAxisDiametr = 0.05;
- ZBUF_STRUCT* aParam;
-
-#ifdef QTOCC_PATCH
- GLint df; /* PCD 17/06/07 */
- GLfloat aNULLColor[] = { 0.0, 0.0, 0.0, 0.0f }; /* FS 21/01/08 */
- /* Fix to problem with clipping planes chopping off pieces of the triedron */
- int i;
- GLint max_plane=0;
- GLboolean* isPlaneActive;
- glGetIntegerv( GL_MAX_CLIP_PLANES, &max_plane);
- isPlaneActive = new GLboolean[max_plane];
- /* Backup the clip planes. */
- for (i = 0; i < max_plane ; i++) {
- isPlaneActive[i] = glIsEnabled(GL_CLIP_PLANE0 + i);
- glDisable(GL_CLIP_PLANE0 + i);
- }
-#endif
-
- /*
- * Lecture des Init. du Triedre
- */
-
- TriedronColor[0] = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[0];
- TriedronColor[1] = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[1];
- TriedronColor[2] = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[2];
- TriedronScale = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aScale;
- TriedronPosition = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aPos;
-
- if (nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aZBufParam != NULL) {
- aParam = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aZBufParam;
- aXColor[0] = aParam->aXColor[0];
- aXColor[1] = aParam->aXColor[1];
- aXColor[2] = aParam->aXColor[2];
-
- aYColor[0] = aParam->aYColor[0];
- aYColor[1] = aParam->aYColor[1];
- aYColor[2] = aParam->aYColor[2];
-
- aZColor[0] = aParam->aZColor[0];
- aZColor[1] = aParam->aZColor[1];
- aZColor[2] = aParam->aZColor[2];
-
- aLengthReduce = aParam->aRatio;
- aAxisDiametr = aParam->aDiametr;
- NbFacettes = aParam->aNbFacettes;
- }
-
- /*
- * Calcul des axes => on inhibe le zoom.
- */
-
- /* la taille des axes est 1 proportion (fixee a l'init du triedre) */
- /* de la dimension la plus petite de la window. */
- if ( U < V ) minUV = U;
- else minUV = V;
- L = minUV * (double) TriedronScale ;
-
- /* Position de l'origine */
- TriedronOrigin[0]= 0.0;
- TriedronOrigin[1]= 0.0;
- TriedronOrigin[2]= 0.0;
-
- /* Position des Axes */
- TriedronAxeX[0] = TriedronOrigin[0] + L ;
- TriedronAxeX[1] = TriedronOrigin[1] + 0.0;
- TriedronAxeX[2] = TriedronOrigin[2] + 0.0;
-
- TriedronAxeY[0] = TriedronOrigin[0] + 0.0;
- TriedronAxeY[1] = TriedronOrigin[1] + L ;
- TriedronAxeY[2] = TriedronOrigin[2] + 0.0;
-
- TriedronAxeZ[0] = TriedronOrigin[0] + 0.0;
- TriedronAxeZ[1] = TriedronOrigin[1] + 0.0;
- TriedronAxeZ[2] = TriedronOrigin[2] + L ;
-
- /* Check position in the ViewPort */
- glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix );
- glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix );
-
- glGetIntegerv(GL_VIEWPORT, aViewPort);
- gluProject(TriedronOrigin[0], TriedronOrigin[1], TriedronOrigin[2],
- (GLdouble *)modelMatrix, (GLdouble *)projMatrix, aViewPort,
- &aWinCoord[0], &aWinCoord[1], &aWinCoord[2]);
-
-#ifdef QTOCC_PATCH /* PCD 29/09/2008 */
- /* Simple code modification recommended by Fotis Sioutis and Peter Dolbey */
- /* to remove the irritating default behaviour of triedrons using V3d_ZBUFFER */
- /* which causes the glyph to jump around the screen when the origin moves offscreen. */
- isWithinView = GL_FALSE;
-#else
- /* Original code */
- isWithinView = !((aWinCoord[0]<aViewPort[0]) || (aWinCoord[0]>aViewPort[2]) ||
- (aWinCoord[1]<aViewPort[1]) || (aWinCoord[1]>aViewPort[3]));
-#endif
-
- if (!isWithinView) {
- /* Annulate translation matrix */
- modelMatrix[3][0] = 0. ;
- modelMatrix[3][1] = 0. ;
- modelMatrix[3][2] = 0. ;
- projMatrix[3][0] = 0. ;
- projMatrix[3][1] = 0. ;
- projMatrix[3][2] = 0. ;
-
- /* save matrix */
- glMatrixMode (GL_MODELVIEW);
- glPushMatrix ();
- glLoadIdentity ();
- glLoadMatrixd( (GLdouble *) modelMatrix);
- glMatrixMode ( GL_PROJECTION );
- glPushMatrix ();
- glLoadIdentity();
- glLoadMatrixd( (GLdouble *) projMatrix);
-
-
- /*
- * Define position in the view
- */
- switch (TriedronPosition) {
- case 0 : /* Aspect_TOTP_CENTER */
- break;
-
- case 1 : /* Aspect_TOTP_LEFT_LOWER */
- glTranslated( -U/2. + L , -V/2. + L , 0. );
- break;
-
- case 2 : /* Aspect_TOTP_LEFT_UPPER */
- glTranslated( -U/2. + L , +V/2. - L -L/3. , 0. );
- break;
-
- case 3 : /* Aspect_TOTP_RIGHT_LOWER */
- glTranslated( U/2. - L -L/3. , -V/2. + L , 0. );
- break;
-
- case 4 : /* Aspect_TOTP_RIGHT_UPPER */
- glTranslated( U/2. - L -L/3. , +V/2. - L -L/3. , 0. );
- break;
-
- default :
- break;
-
- }
- L *= aLengthReduce;
- }
-
-
- /*
- * Creation the trihedron
- */
-
-#define COLOR_REDUCE 0.3f
-#define CYLINDER_LENGTH 0.75f
-#ifdef BUG
-#define ALPHA_REDUCE 0.4f
-#else
-#define ALPHA_REDUCE 1.0f
-#endif
-
- startList = glGenLists(4);
- aQuadric = gluNewQuadric();
-
- aCylinderLength = L * CYLINDER_LENGTH;
- aCylinderDiametr = L * aAxisDiametr;
- aConeDiametr = aCylinderDiametr * 2;
- aConeLength = L * (1 - CYLINDER_LENGTH);
- /* Correct for owerlapping */
- /* aCylinderLength += aConeLength - 1.2*aCylinderDiametr*aConeLength/aConeDiametr;*/
-
- aIsDepthEnabled = glIsEnabled(GL_DEPTH_TEST);
-#ifndef BUG
-
-#ifdef QTOCC_PATCH /*PCD 02/07/07 */
- /* GL_DEPTH_WRITEMASK is not a valid argument to glIsEnabled, the */
- /* original code is shown to be broken when run under an OpenGL debugger */
- /* like GLIntercept. This is the correct way to retrieve the mask value. */
- glGetBooleanv(GL_DEPTH_WRITEMASK, &aIsDepthMaskEnabled);
-#else
- aIsDepthMaskEnabled = glIsEnabled(GL_DEPTH_WRITEMASK);
-#endif
-
-#endif
-
- /* Create cylinder for axis */
- gluQuadricDrawStyle(aQuadric, GLU_FILL); /* smooth shaded */
- gluQuadricNormals(aQuadric, GLU_FLAT);
- /* Axis */
- glNewList(startList, GL_COMPILE);
- gluCylinder(aQuadric, aCylinderDiametr, aCylinderDiametr, aCylinderLength, NbFacettes, 1);
- glEndList();
- /* Cone */
- glNewList(startList + 1, GL_COMPILE);
- gluCylinder(aQuadric, aConeDiametr, 0, aConeLength, NbFacettes, 1);
- glEndList();
- /* Central sphere */
- glNewList(startList + 2, GL_COMPILE);
-#ifdef QTOCC_PATCH
- gluSphere(aQuadric, aCylinderDiametr * 2, NbFacettes, NbFacettes);
-#else
- gluSphere(aQuadric, aCylinderDiametr, NbFacettes, NbFacettes);
-#endif
- glEndList();
- /* End disk */
- gluQuadricOrientation(aQuadric,GLU_INSIDE); /*szv*/
- glNewList(startList + 3, GL_COMPILE);
- gluDisk(aQuadric, aCylinderDiametr, aConeDiametr, NbFacettes, 1/*szv:2*/);
- glEndList();
-
-#ifdef QTOCC_PATCH
- /* Store previous attributes */
- glPushAttrib(GL_LIGHTING_BIT | GL_POLYGON_BIT);
- LightOn();
-#else
- LightOn();
-
- /* Store previous attributes */
- glPushAttrib(GL_LIGHTING_BIT | GL_POLYGON_BIT);
-#endif
-
- glCullFace(GL_BACK);
- glEnable(GL_CULL_FACE);
-
-#ifdef QTOCC_PATCH /*Fotis Sioutis | 2008-01-21 10:55
- In the function call_zbuffer_triedron_redraw of TKOpengl,
- the z buffered trihedron changes colors in case there
- is an object in the scene that has an explicit material
- attached to it.In the trihedron display loop,
- GL_COLOR_MATERIAL is enabled, but only the GL_DIFFUSE
- parameter is utilized in glColorMaterial(...).
- This causes the last ambient,specular and emission values
- used, to stay at the stack and applied to the trihedron
- (which causes the color change).
- A fix is proposed , to change GL_DIFFUSE to
- GL_AMBIENT_AND_DIFFUSE in glColorMaterial call in
- line 946.The above of course will leave unchanged
- the SPECULAR and EMISSION values.
- Another proposal which would fix 100% the problem
- is to use glMaterial instead of glColor on the trihedron
- drawing loop. */
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, aNULLColor);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, aNULLColor);
- glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, aNULLColor);
-
- glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.);
-#endif
-
- glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
- glEnable(GL_COLOR_MATERIAL);
-
- if (!aIsDepthEnabled) {
- glEnable(GL_DEPTH_TEST);
-#ifndef BUG
- glClear(GL_DEPTH_BUFFER_BIT);
-#endif
- }
-#ifdef BUG
- if (!(aIsDepthEnabled && isWithinView))
- glClear(GL_DEPTH_BUFFER_BIT);
-#endif
-#ifndef BUG
- if (!aIsDepthMaskEnabled) {
- /* This is how the depthmask needs to be re-enabled...*/
- glDepthMask(GL_TRUE);
- /* ...and not this stuff below */
- }
-#endif
-
- glMatrixMode(GL_MODELVIEW);
-#ifdef QTOCC_PATCH /* PCD 17/06/07 */
- glGetIntegerv (GL_DEPTH_FUNC, &df);
-#else
- /*szv:if (isWithinView) {*/
- glDepthFunc(GL_GREATER);
- glPushMatrix();
- glPushMatrix();
- glPushMatrix();
-
- glColor4f(TriedronColor[0]*COLOR_REDUCE,
- TriedronColor[1]*COLOR_REDUCE,
- TriedronColor[2]*COLOR_REDUCE,
- ALPHA_REDUCE);
- glCallList(startList+2);
-
- /* Z axis */
- glColor4f(aZColor[0]*COLOR_REDUCE,
- aZColor[1]*COLOR_REDUCE,
- aZColor[2]*COLOR_REDUCE,
- ALPHA_REDUCE);
- glCallList(startList);
- glTranslated(0, 0, L * CYLINDER_LENGTH);
- glCallList(startList + 3);
- glCallList(startList + 1);
- glPopMatrix();
-
- /* X axis */
- glRotated(90.0, TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2]);
- glColor4f(aXColor[0]*COLOR_REDUCE,
- aXColor[1]*COLOR_REDUCE,
- aXColor[2]*COLOR_REDUCE,
- ALPHA_REDUCE);
- glCallList(startList);
- glTranslated(0, 0, L * CYLINDER_LENGTH);
- glCallList(startList + 3);
- glCallList(startList + 1);
- glPopMatrix();
-
- /* Y axis */
- glRotated(-90.0, TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]);
- glColor4f(aYColor[0]*COLOR_REDUCE,
- aYColor[1]*COLOR_REDUCE,
- aYColor[2]*COLOR_REDUCE,
- ALPHA_REDUCE);
- glCallList(startList);
- glTranslated(0, 0, L * CYLINDER_LENGTH);
- glCallList(startList + 3);
- glCallList(startList + 1);
- glPopMatrix();
-
- glDepthFunc(GL_LESS);
- /*szv:}*/
-#endif
-
-#ifdef QTOCC_PATCH
- for (i = 0; i < 2; i++) /* PCD 11/02/08 Two pass method */
- {
- if (i == 0) /* First pass */
- {
- glDepthFunc(GL_ALWAYS);
- }
- else
- {
- glDepthFunc(GL_LEQUAL);
- }
-#endif
-
- glPushMatrix();
- glPushMatrix();
- glPushMatrix();
-
- glColor3fv(TriedronColor);
- glCallList(startList+2);
-
- /* Z axis */
- glColor4fv(aZColor);
- glCallList(startList);
- glTranslated(0, 0, L * CYLINDER_LENGTH);
- glCallList(startList + 3);
- glCallList(startList + 1);
- glPopMatrix();
-
- /* X axis */
- glRotated(90.0, TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2]);
- glColor4fv(aXColor);
- glCallList(startList);
- glTranslated(0, 0, L * CYLINDER_LENGTH);
- glCallList(startList + 3);
- glCallList(startList + 1);
- glPopMatrix();
-
- /* Y axis */
- glRotated(-90.0, TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]);
- glColor4fv(aYColor);
- glCallList(startList);
- glTranslated(0, 0, L * CYLINDER_LENGTH);
- glCallList(startList + 3);
- glCallList(startList + 1);
- glPopMatrix();
-
-#ifdef QTOCC_PATCH
- }
-#endif
-
- if (!aIsDepthEnabled)
- glDisable(GL_DEPTH_TEST);
-#ifndef BUG
- if (!aIsDepthMaskEnabled)
-
-#ifdef QTOCC_PATCH /*PCD 02/07/07 */
- glDepthMask(GL_FALSE);
-#else
- glDisable(GL_DEPTH_WRITEMASK);
-#endif
-
-#endif
- glDisable(GL_CULL_FACE);
- glDisable(GL_COLOR_MATERIAL);
-
- gluDeleteQuadric(aQuadric);
- glColor3fv (TriedronColor);
-
-#ifdef QTOCC_PATCH /* PCD 11/02/08 */
- /* Always write the text */
- glDepthFunc(GL_ALWAYS);
-#endif
-
- glPopAttrib();
-
- /* fleches au bout des axes (= cones de la couleur demandee) */
- l = L - L/4. ; /* distance a l'origine */
- rayon = L/30. ; /* rayon de la base du cone */
- Angle = 2. * M_PI/ NbFacettes;
-
- glDeleteLists(startList, 4);
-
- LightOff();
-
- /*
- * origine names
- */
-
- /* init font */
-
- OpenGl_TextRender* textRender=OpenGl_TextRender::instance();
-
- /* Axe X */
- TriedronCoord[0] = TriedronOrigin[0] + ( L + rayon ) ;
- TriedronCoord[1] = TriedronOrigin[1] + 0.0;
- TriedronCoord[2] = TriedronOrigin[2] - rayon ;
- textRender->RenderText(L"X", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
-
- /* Axe Y */
- TriedronCoord[0] = TriedronOrigin[0] + rayon ;
- TriedronCoord[1] = TriedronOrigin[1] + ( L + 3.0 * rayon ) ;
- TriedronCoord[2] = TriedronOrigin[2] + ( 2.0 * rayon );
- textRender->RenderText(L"Y", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
-
- /* Axe Z */
- TriedronCoord[0] = TriedronOrigin[0] + ( - 2.0 * rayon ) ;
- TriedronCoord[1] = TriedronOrigin[1] + rayon/2. ;
- TriedronCoord[2] = TriedronOrigin[2] + ( L + 3.0 * rayon ) ;
- textRender->RenderText(L"Z", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]);
-
-#ifdef QTOCC_PATCH
- /*PCD 17/06/07 */
- glDepthFunc(df);
-
- /* PCD 10/02/08 */
- /* Recover the clip planes */
- glGetIntegerv( GL_MAX_CLIP_PLANES, &max_plane);
- for (i = 0; i < max_plane ; i++) {
- if (isPlaneActive[i]) {
- glEnable(GL_CLIP_PLANE0 + i);
- }
- }
- free(isPlaneActive);
-#endif
-
- if (!isWithinView) { /* restore matrix */
- glMatrixMode (GL_PROJECTION);
- glPopMatrix ();
- glMatrixMode (GL_MODELVIEW);
- glPopMatrix ();
- }
-
- return (TSuccess);
-
-}
-
-
-/*----------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions publiques
-*/
-
-
-/*
-* initialisation d'un triedre non zoomable dans une vue.
-* ou modification des valeurs deja initialisees.
-*/
-
-TStatus call_triedron_init (
- CALL_DEF_VIEW * aview,
- int aPosition,
- float r,
- float g,
- float b,
- float aScale,
- int asWireframe
- )
-
-{
-
- int nz_wks_entry;
- int nz_struc_entry;
- ZBUF_STRUCT* aParam;
-
-
-#ifdef PRINT
- printf("\n----------- call_triedron_init r = %f, g = %f, b = %f",
- r, g, b);
- printf(", aScale = %f, aPosition = %d \n", aScale, aPosition );
-#endif
-
- if (aview->WsId == -1) return(TFailure);
- if (aview->ViewId == -1) return(TFailure);
-#ifdef PRINT
- printf(", aview->WsId=%d aview->ViewId=%d \n",aview->WsId,aview->ViewId);
-#endif
-
-
-
- /* recherche du num de la liste de structures non zoomables de la wks */
- /* creation sinon */
- nz_wks_entry = find_nz_wks(aview->WsId, 1);
- if (nz_wks_entry == -1) return TFailure;
-
- /* recherche du Triedre s'il existe; creation sinon */
- nz_struc_entry = find_nz_struc(nz_wks_entry, TRIEDRON_ID, 1);
- if (nz_struc_entry == -1) return TFailure;
-
- /* mise a jour du Triedre */
- nz_wks[nz_wks_entry].triedron_on = 1;
- nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].NZStrucID = TRIEDRON_ID;
- nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].astructure = NULL;
- nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aPos = aPosition;
- nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[0] = r;
- nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[1] = g;
- nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[2] = b;
- nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aScale = aScale;
- nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].isWireframe = asWireframe;
-
- nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aZBufParam = new ZBUF_STRUCT();
- if (nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aZBufParam == NULL) return TFailure;
-
- aParam = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aZBufParam;
- aParam->aXColor[0] = theXColor[0];
- aParam->aXColor[1] = theXColor[1];
- aParam->aXColor[2] = theXColor[2];
-
- aParam->aYColor[0] = theYColor[0];
- aParam->aYColor[1] = theYColor[1];
- aParam->aYColor[2] = theYColor[2];
-
- aParam->aZColor[0] = theZColor[0];
- aParam->aZColor[1] = theZColor[1];
- aParam->aZColor[2] = theZColor[2];
-
- aParam->aRatio = theRatio;
- aParam->aDiametr = theDiametr;
- aParam->aNbFacettes = theNBFacettes;
-
-
-#ifdef DEBUG
- printf("nz_wks_entry=%d nz_struc_entry=%d \n",nz_wks_entry,nz_struc_entry);
- printf("ajout ok\n");
-#endif
- return (TSuccess);
-
-}
-
-/*----------------------------------------------------------------------*/
-
-/*
-* affichage d'un triedre non zoomable dans la wks awsid
-*
-* Triedre = Objet non Zoomable;
-* on cree cette fonction pour pouvoir travailler par les structures
-* utilisees par les fonctions Tsm* et TEL_VIEW_REP
-*
-*/
-
-TStatus call_triedron_redraw_from_wsid (
- Tint awsid
- )
-
-{
-
- TStatus status = TSuccess;
- int nz_wks_entry;
- int nz_struc_entry;
- int save_texture_state;
- GLdouble U, V ; /* largeur,hauteur de la fenetre */
-
- CMN_KEY_DATA key;
- tel_view_data vptr;
-
- if ( awsid == -1) return (TFailure );
-
-#ifdef BUC61045
- /* check if GL_LIGHTING should be disabled
- no enabling 'cause it will be done (if necessary: kinda Polygon types )
- during redrawing structures
- */
- TsmGetWSAttri (awsid, WSGLLight, &key );
- if ( key.ldata == TOff )
- glDisable( GL_LIGHTING );
-#endif
-
- /* recherche du numero de la liste de structures non zoomables de la wks */
-#ifdef PRINT
- printf("\n----------- call_triedron_redraw_from_WSID : appel find_nz_wks \n");
-#endif
- nz_wks_entry = find_nz_wks(awsid, 0);
- /* si on ne l'a pas trouve, il n'y a rien a faire */
- if (nz_wks_entry == -1) return (TSuccess);
-
- /* recherche du Triedre */
-#ifdef PRINT
- printf("\n----------- call_triedron_redraw_from_WSID : appel find_nz_struc \n");
-#endif
- nz_struc_entry = find_nz_struc(nz_wks_entry, TRIEDRON_ID, 0);
- /* si on ne l'a pas trouve, il n'y a rien a faire */
- if (nz_struc_entry == -1) return (TSuccess);
- /* si il est "off" il n'y a rien a faire */
- if (nz_wks[nz_wks_entry].triedron_on == 0) return (TSuccess);
-
-
- /* recherche de la dimension de la fenetre */
- /* (car la taille des axes du treiedre en sera 1 proportion) */
- TsmGetWSAttri (awsid, WSViews, &key );
- vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/
- if ( !vptr ) return TFailure; /* no view defined yet */
- U = vptr->vrep.extra.map.window.xmax - vptr->vrep.extra.map.window.xmin;
- V = vptr->vrep.extra.map.window.ymax - vptr->vrep.extra.map.window.ymin;
-
- /* sauvegarde du contexte (on reste dans le buffer courant) */
- save_texture_state = IsTextureEnabled();
- DisableTexture();
-
- /* affichage du Triedre Non Zoomable */
- transform_persistence_end();
- if (nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].isWireframe)
- status = call_triedron_redraw (nz_wks_entry, nz_struc_entry, U, V);
- else
- status = call_zbuffer_triedron_redraw (nz_wks_entry, nz_struc_entry, U, V);
-
- /* restauration du contexte */
- if (save_texture_state) EnableTexture();
-
- return status;
-
-}
-
-/*----------------------------------------------------------------------*/
-
-/*
-* affichage d'un triedre non zoomable dans la vue aview
-*
-* Triedre = Objet non Zoomable;
-* on cree cette fonction pour pouvoir utiliser CALL_DEF_VIEW
-*
-*/
-
-TStatus call_triedron_redraw_from_view (
- CALL_DEF_VIEW * aview
- )
-{
-
- TStatus status = TSuccess;
- int nz_wks_entry;
- int nz_struc_entry;
- int save_texture_state;
- GLdouble U, V ; /* largeur,hauteur de la fenetre */
-
-
-
- if (aview->WsId == -1) return (TFailure );
- if (aview->ViewId == -1) return (TFailure);
-#ifdef PRINT
- printf("\n call_triedron_redraw_from_VIEW aview->WsId=%d aview->ViewId=%d \n",aview->WsId,aview->ViewId);
-#endif
-
-
- /* recherche du numero de la liste de structures non zoomables de la wks */
-#ifdef PRINT
- printf("\n----------- call_triedron_redraw_from_VIEW : appel find_nz_wks \n");
-#endif
- nz_wks_entry = find_nz_wks(aview->WsId, 0);
- /* si on ne l'a pas trouve, il n'y a rien a faire */
- if (nz_wks_entry == -1) return (TSuccess);
-
- /* recherche du Triedre */
-#ifdef PRINT
- printf("\n----------- call_triedron_redraw_from_VIEW : appel find_nz_struc \n");
-#endif
- nz_struc_entry = find_nz_struc(nz_wks_entry, TRIEDRON_ID, 0);
- /* si on ne l'a pas trouve, il n'y a rien a faire */
- if (nz_struc_entry == -1) return (TSuccess);
- /* si il est "off" il n'y a rien a faire */
- if (nz_wks[nz_wks_entry].triedron_on == 0) return (TSuccess);
-
-
- /* recherche de la dimension de la fenetre */
- /* (car la taille des axes du treiedre en sera 1 proportion) */
- U = aview->Mapping.WindowLimit.uM - aview->Mapping.WindowLimit.um ;
- V = aview->Mapping.WindowLimit.vM - aview->Mapping.WindowLimit.vm ;
-
- /* sauvegarde du contexte et ecriture en front buffer */
- save_texture_state = IsTextureEnabled();
- DisableTexture();
- glDrawBuffer (GL_FRONT);
-
- /* affichage du Triedre Non Zoomable */
- transform_persistence_end();
- status = call_triedron_redraw (nz_wks_entry, nz_struc_entry, U, V);
-
- /* necessaire pour WNT */
- glFlush();
-
- /* restauration du contexte */
- if (save_texture_state) EnableTexture();
- glDrawBuffer (GL_BACK);
-
- return status;
-
-}
-
-/*----------------------------------------------------------------------*/
-
-/*
-* destruction du triedre non zoomable d'une vue.
-*/
-
-TStatus call_triedron_erase (
- CALL_DEF_VIEW * aview
- )
-
-{
- int nz_wks_entry;
- int i;
-
-
-#ifdef PRINT
- printf("\n----------- call_triedron_erase " );
-#endif
-
- if (aview->WsId == -1) return(TFailure);
- if (aview->ViewId == -1) return(TFailure);
-#ifdef PRINT
- printf(", aview->WsId=%d aview->ViewId=%d \n",aview->WsId,aview->ViewId);
-#endif
-
-
- /* recherche du num de la liste de structures non zoomables de la wks */
- /* si on ne l'a pas trouve, il n'y a rien a faire */
- nz_wks_entry = find_nz_wks(aview->WsId, 0);
- if (nz_wks_entry == -1) return TSuccess;
-
-
- /*
- * destruction du Triedre puis de toute la wks
- */
- /* (aujourd'hui il n'y a pas d'autre structure graphique dans la table */
- /* de la wks => on detruit tout ; */
- /* si on ajoutait d'autres structures non zoomables, il faudrait */
- /* selectionner et detruire uniquement l'element Triedre en cherchant */
- /* s'il existe via une variable nz_struc_entry ). */
- for (i = 0; i < nz_wks[nz_wks_entry].nz_struc_count; i++) {
- if (nz_wks[nz_wks_entry].nz_struc[i].aZBufParam != NULL)
- free(nz_wks[nz_wks_entry].nz_struc[i].aZBufParam);
- }
-
- if (nz_wks[nz_wks_entry].nz_struc != NULL) {
- free(nz_wks[nz_wks_entry].nz_struc);
- }
-
- if (nz_wks_count == 1) {
- free(nz_wks);
- nz_wks_count = 0;
- nz_wks_size = 0;
- }
- else { /* il y a au moins 2 wks definies */
- memcpy(&nz_wks[nz_wks_entry],
- &nz_wks[nz_wks_entry+1],
- (nz_wks_count - nz_wks_entry - 1)*sizeof(NZ_WKS));
- nz_wks_count--;
- }
-
-
-#ifdef DEBUG
- printf("nz_wks_entry=%d nz_wks_count=%d nz_wks_size=%d\n",
- nz_wks_entry, nz_wks_count, nz_wks_size );
- printf("erase ok\n");
-#endif
-
- return (TSuccess);
-}
-
-/*----------------------------------------------------------------------*/
-
-
-/*
-* gestion d'un echo de designation du triedre non zoomable d' une vue.
-*/
-TStatus call_triedron_echo (
- CALL_DEF_VIEW * aview,
- int aType
- )
-
-{
- return (TSuccess);
-}
-
-
-/*----------------------------------------------------------------------*/
-
-/*
-* initialisation of zbuffer trihedron
-*/
-extern TStatus call_ztriedron_setup (
- float* xcolor,
- float* ycolor,
- float* zcolor,
- float sizeratio,
- float axisdiameter,
- int nbfacettes)
-{
- theXColor[0] = xcolor[0];
- theXColor[1] = xcolor[1];
- theXColor[2] = xcolor[2];
-
- theYColor[0] = ycolor[0];
- theYColor[1] = ycolor[1];
- theYColor[2] = ycolor[2];
-
- theZColor[0] = zcolor[0];
- theZColor[1] = zcolor[1];
- theZColor[2] = zcolor[2];
-
- theRatio = sizeratio;
- theDiametr = axisdiameter;
- theNBFacettes = nbfacettes;
-
- return (TSuccess);
-}
-
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_triedron.h : gestion du triedre non zoomable.
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-24-10-98 : BGN ; Creation.
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-
-#ifndef __OPENGL_TRIEDRON_H_
-#define __OPENGL_TRIEDRON_H_
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <GL/gl.h>
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_tsm.hxx>
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Types definis
-*/
-
-
-/*----------------------------------------------------------------------*/
-/*
-* variables statiques
-*/
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes
-*/
-/*
-* initialisation of zbuffer trihedron
-*/
-extern TStatus call_ztriedron_setup (
- float* xcolor,
- float* ycolor,
- float* zcolor,
- float sizeratio,
- float axisdiameter,
- int nbfacettes
- );
-
-/*
-* initialisation d'un triedre non zoomable dans la Wks
-*/
-extern TStatus call_triedron_init (
- CALL_DEF_VIEW * aview,
- int aPosition,
- float r,
- float g,
- float b,
- float aScale,
- int asWireframe);
-
-
-/*
-* affichage d'un triedre non zoomable dans la vue aview.
-*/
-
-extern TStatus call_triedron_redraw_from_view (CALL_DEF_VIEW * aview);
-
-
-/*
-* affichage d'un triedre non zoomable dans la workstation awsid
-*/
-
-extern TStatus call_triedron_redraw_from_wsid (Tint awsid);
-
-
-/*
-* destruction du triedre non zoomable d' une vue.
-*/
-
-extern TStatus call_triedron_erase (CALL_DEF_VIEW * aview);
-
-/*
-* gestion d'un echo de designation du triedre non zoomable d' une vue.
-*/
-extern TStatus call_triedron_echo (
- CALL_DEF_VIEW * aview,
- int aType);
-
-
-/*----------------------------------------------------------------------*/
-
-#endif /* __OPENGL_TRIEDRON_H_ */
-
-/*----------------------------------------------------------------------*/
-
+++ /dev/null
-#ifndef OPENGL_TRSF_STACK_H
-#define OPENGL_TRSF_STACK_H
-
-typedef struct TSM_TRSF_STACK_STRUCT {
- struct TSM_TRSF_STACK_STRUCT *next;
- struct TSM_TRSF_STACK_STRUCT *prev;
- Tmatrix3 LocalTran3;
-} TSM_TRSF_STACK, *tsm_trsf_stack;
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_togl_texture.c :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-05-08-97 : PCT ; Support texture mapping
-ajout pour deuxieme passe du texture mapping
-
-************************************************************************/
-
-#define G003 /* EUG 16-09-99 ZBufferAuto treatment
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_Memory.hxx>
-
-static MtblPtr TsmMtblArray[TelLast];
-
-/* Fixed Header info for a structure */
-struct TSM_HEAD_STRUCT
-{
- Tint num; /* number of elements present */
-};
-typedef TSM_HEAD_STRUCT TSM_HEAD;
-typedef TSM_HEAD_STRUCT* tsm_head;
-
-/* The head of the list when the structure is in the form of a list */
-struct TSM_LHEAD_STRUCT
-{
- tsm_node next; // first list node
- tsm_node prev; // last list node for reverse iteration
- TSM_HEAD header;
-};
-typedef TSM_LHEAD_STRUCT TSM_LHEAD;
-typedef TSM_LHEAD_STRUCT *tsm_lhead;
-
-/* A Structure having fixed header and variable list of elements */
-struct TSM_STRUCT_STRUCT
-{
- TSM_LHEAD elemListHead;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TSM_STRUCT_STRUCT TSM_STRUCT;
-typedef TSM_STRUCT_STRUCT *tsm_struct;
-
-#define TsmStructureNotOpen -1
-#define TsmInvalidStructure -1
-
-/* Context maintained for the currently open structure */
-struct TSM_CONTEXT_STRUCT
-{
- Tint stid; /* Current Open Structure */
- Tint ind; /* Current Element Index */
- /* = TsmStructureNotOpen if no structure currently open */
- tsm_struct s; /* Current Structure Pointer */
- tsm_node n; /* Current Element list node */
-};
-typedef TSM_CONTEXT_STRUCT TSM_CONTEXT;
-typedef TSM_CONTEXT_STRUCT* tsm_context;
-
-static TSM_CONTEXT context = { TsmInvalidStructure, TsmStructureNotOpen, 0, 0 };
-
-static TEditMode edit_mode;
-
-#define TSM_HTBL_SIZE 251
-typedef NCollection_List<TSM_NODE*> NodeList;
-typedef NCollection_DataMap<Tint, TSM_STRUCT*> StructMap;
-Handle(NCollection_BaseAllocator) _Allocator = NCollection_BaseAllocator::CommonBaseAllocator();
-static StructMap _StructMap( 1, _Allocator );
-
-
-
-/* Global workstation variable */
-Tint TglActiveWs; /* valid only during traversals */
-
-void
-TsmInitAllClasses( MtblPtr (**tbl)(TelType*), Tint size )
-{
- register Tint i;
- TelType el;
- register MtblPtr fp;
-
- for( i=0; i<size; i++ )
- {
- fp = tbl[i](&el);
- TsmMtblArray[el] = fp;
- }
- return;
-}
-
-/* This function invokes the required method of the element type by looking
-up an array of Method Tables of each element.
-The arguments passed to the method are the data of the element and any
-other data that needs to be sent.
-In the case of ADD_TO_STRUCTURE methods, data should be the address of the
-element data. Other wise, it is the element data itself
-*/
-
-TStatus
-TsmSendMessage( TelType el, TMsgType msg, TSM_ELEM_DATA data, Tint n, ... )
-{
-#if defined (SOLARIS) || defined (IRIXO32)
- cmn_key *k;
-#else
- cmn_key k[TMaxArgs];
-
- // Nullifies 0-th element of the "k" array
- // because it might be used in a UserDraw function
- // to get information on view ID, for example.
- k[0] = NULL;
- // Uncomment the code below if you caught
- // exception because of k[1] is NULL.
- // Nullifies the whole array of "k"
- //int i = TMaxArgs;
- //while (--i)
- // k[i] = NULL;
-
-#endif
- TStatus TheStatus = TSuccess;
-
- CMN_GET_STACK( n, k );
-
- if( TsmMtblArray[el] && TsmMtblArray[el][msg] )
- TheStatus = TsmMtblArray[el][msg]( data, n, k );
- return TheStatus;
-}
-
-static void
-TsmFreeList( tsm_struct s )
-{
- if ( !s )
- return;
-
- if( _Allocator.IsNull() )
- return ;
-
- tsm_node node, prev;
- Tint num, i;
-
- num = s->elemListHead.header.num;
- node = s->elemListHead.next;
-
- for( i=0; i<num; i++ )
- {
- TsmSendMessage( node->elem.el, Delete, node->elem.data, 0 );
- prev = node;
- node = node->next;
- delete prev;
- }
-
- s->elemListHead.next = s->elemListHead.prev = (tsm_node)&(s->elemListHead);
- s->elemListHead.header.num = 0;
- return;
-}
-
-TStatus
-TsmOpenStructure( Tint stid )
-{
- tsm_struct s = 0;
-
- if( _Allocator.IsNull() )
- return TFailure;
-
- if( context.ind != TsmStructureNotOpen )
- return TFailure; /* Some structure already open */
-
- if ( !_StructMap.IsBound(stid) ){
- s = new TSM_STRUCT();
- if ( !s )
- return TFailure; // Memory allocation failed
-
- _StructMap.Bind( stid, s );
- s->elemListHead.next = s->elemListHead.prev = (tsm_node)&(s->elemListHead);
- s->elemListHead.header.num = 0;
- }
-
- s = _StructMap.Find(stid);
-
- context.s = s;
- context.stid = stid;
- // Make the context point at the last node of the structure,
- // this is the list head in case of an empty structure
- context.ind = s->elemListHead.header.num;
- context.n = s->elemListHead.prev;
-
- /* Ajout CAL, 14/09/95 */
- /* on force l'update_state de toutes les wks a TNotDone */
- TsmInitUpdateState ();
-
- return TSuccess;
-}
-
-TStatus
-TsmCloseStructure()
-{
- if( context.ind == TsmStructureNotOpen )
- return TFailure; /* No structure currently open */
-
- context.ind = TsmStructureNotOpen;
-
- return TSuccess;
-}
-
-
-TStatus
-TsmDisplayStructure( Tint stid, Tint wsid )
-{
- TSM_ELEM_DATA data;
- CMN_KEY key;
-
- TglActiveWs = wsid;
-
- if( context.ind != TsmStructureNotOpen )
- return TFailure; /* Some structure currently open */
-
- key.id = wsid;
- data.ldata = stid;
- TsmSendMessage( TelExecuteStructure, DisplayTraverse, data, 1, &key );
-
- return TSuccess;
-}
-
-TStatus
-TsmPrintStructure( Tint stid )
-{
- tsm_node node;
- Tint i, num;
- tsm_struct s;
-
- if( context.ind != TsmStructureNotOpen )
- return TFailure; /* Some structure currently open */
-
- if ( _StructMap.IsEmpty() )
- return TFailure; /* No structure created yet */
-
- /* Obtain structure pointer from hash table */
- if ( !_StructMap.IsBound(stid) )
- return TFailure; /* Non-existent structure */
-
- s = _StructMap.Find(stid);
-
- printf( "\nPRINT:" );
- printf( "\n\tSTRUCTURE ID = %d", stid );
- if( !s ){
- num = 0;
- node = 0;
- }
- else{
- num = s->elemListHead.header.num;
- node = s->elemListHead.next;
- }
-
- printf( "\n\tNUMBER OF ELEMENTS = %d", num);
- printf( "\n" );
-
- /* For each element Send Message Print */
- for( i = 0; i < num; i++ ){
- printf("\n\tElement[%d] : ", i+1);
- TsmSendMessage( node->elem.el, Print, node->elem.data, 0 );
- node = node->next;
- }
-
- return TSuccess;
-}
-
-TStatus
-TsmAddToStructure( TelType el, Tint n, ... )
-{
- TSM_ELEM_DATA data;
-#if defined (SOLARIS) || defined (IRIXO32)
- cmn_key *k;
-#else
- cmn_key k[TMaxArgs];
-#endif
-
- if( context.ind == TsmStructureNotOpen )
- return TFailure; /* No structure currently open */
-
- CMN_GET_STACK( n, k );
- data.pdata = &data;
- if( TsmSendMessage( el, Add, data, -n, k ) == TFailure )
- return TFailure;
-
- if( edit_mode == TEditReplace ){
- TsmSendMessage( context.n->elem.el, Delete, context.n->elem.data, 0 );
- }
- else{
- tsm_node node = new TSM_NODE();
-
- if( !node )
- return TFailure;
-
- /* insert the node in the linked list after the current node */
- node->prev = context.n;
- node->next = context.n->next;
- context.n->next = node;
- node->next->prev = node;
-
- /* Make this node as current node */
- context.n = node;
- context.ind++;
-
- /* Increment the no of elements */
- context.s->elemListHead.header.num++;
- }
-
- context.n->elem.el = el;
- context.n->elem.data = data;
-
- return TSuccess;
-}
-
-TStatus
-TsmDeleteStructure( Tint stid )
-{
- if( context.ind != TsmStructureNotOpen && context.stid == stid )
- return TFailure; /* Same structure currently open */
-
- if ( _StructMap.IsEmpty() )
- return TFailure; /* No structure created yet */
-
- if ( !_StructMap.IsBound(stid) )
- return TFailure; /* Non-existent structure */
-
- tsm_struct s = _StructMap.ChangeFind(stid);
-
- if( stid == context.stid ){
- context.stid = TsmInvalidStructure;
- // Ensure the context doesn't point to freed memory
- context.s = 0;
- context.n = 0;
- }
-
- if( s ){
- TsmFreeList( s );
-
- /* Free structure memory */
- delete s;
- }
-
- /* Remove hash table entry */
- _StructMap.UnBind( stid );
-
- /* Ajout BGN, 27/05/97 */
- /* on force l'update_state de toutes les wks a TNotDone */
- TsmInitUpdateState ();
-
- return TSuccess;
-}
-
-TEditMode
-TsmSetEditMode( TEditMode mode )
-{
- TEditMode m;
-
- m = edit_mode;
-
- /* Set static variable for mode */
- edit_mode = mode;
-
- /* return previous mode */
- return m;
-}
-
-TStatus
-TsmDeleteElement()
-{
- tsm_node node;
-
- if( context.ind == TsmStructureNotOpen )
- return TFailure; /* No structure currently open */
-
- // Zero ind means the currently open structure is empty
- // or the current node is the list head -> nothing to delete
- // See also TsmSetElementPointer()
- if( !context.ind )
- return TFailure;
-
- /* Send message DELETE element */
- TsmSendMessage( context.n->elem.el, Delete, context.n->elem.data, 0 );
-
- node = context.n;
- node->prev->next = node->next;
- node->next->prev = node->prev;
-
- /* make previous node as current node */
- context.n = node->prev;
- context.ind--;
-
- /* Decrement the no of elements */
- context.s->elemListHead.header.num--;
-
- /* free the linked list node */
- delete node;
-
- return TSuccess;
-}
-
-TStatus
-TsmDeleteElementsBetweenLabels( Tint label_id1, Tint label_id2 )
-/* label_id1 & label_id2 exclusive */
-{
- Tint elem1, elem2;
-
- if( context.ind == TsmStructureNotOpen )
- return TFailure; /* No structure currently open */
-
- TsmSetElementPointer( 0 );
-
- if( TsmSetElementPointerAtLabel( label_id1 ) == TFailure)
- return TFailure;
- elem1 = context.ind;
-
- if( TsmSetElementPointerAtLabel( label_id2 ) == TFailure)
- return TFailure;
- elem2 = context.ind;
-
- TsmDeleteElementRange( elem1, elem2 );
-
- return TSuccess;
-}
-
-TStatus
-TsmDeleteElementRange( Tint elem1, Tint elem2 ) /* elem1 & elem2 exclusive */
-{
- if( context.ind == TsmStructureNotOpen )
- return TFailure; /* No structure currently open */
-
- TsmSetElementPointer( elem2 - 1 );
- while( context.ind != elem1 && context.ind )
- TsmDeleteElement();
-
- return TSuccess;
-}
-
-TStatus
-TsmSetElementPointer( Tint index )
-{
- if( context.ind == TsmStructureNotOpen )
- return TFailure; /* No structure currently open */
-
- /* Set static variable accordingly */
- if( context.ind == index ){
- return TSuccess;
- }
- if( index >= context.s->elemListHead.header.num ){
- index = context.s->elemListHead.header.num;
- context.n = context.s->elemListHead.prev;
- }
- else if( index <= 0 ){
- index = 0;
- context.n = (tsm_node)&(context.s->elemListHead);
- }
- else{
- Tint a, b, c, d;
- tsm_node node;
-
- a = index - 0;
- b = context.ind - index; if( b < 0 ) b = -b; /* b = labs(b) */
- c = context.s->elemListHead.header.num - index;
- d = ( a < b ) ? ( a < c ? a : c ) : ( b < c ? b : c ) ;
-
- if( a == d ){
- /* Traverse from head in forward direction */
- d = index-1;
- node = context.s->elemListHead.next;
- while( d-- ){
- node = node->next;
- }
- }
- else if( b == d ){
- /* Traverse from current node in appropriate direction */
- node = context.n;
- d = context.ind;
- if( context.ind < index ){
- while( d != index ){
- node = node->next;
- d++;
- }
- }
- else{
- while( d != index ){
- node = node->prev;
- d--;
- }
- }
- }
- else{ /* ( c == d ) */
- /* Traverse from head in backward direction */
- d = context.s->elemListHead.header.num;
- node = context.s->elemListHead.prev;
- while( d != index ){
- node = node->prev;
- d--;
- }
- }
-
- context.n = node;
- }
-
- context.ind = index;
-
- return TSuccess;
-}
-
-
-TStatus
-TsmSetElementPointerAtLabel( Tint label_id )
-{
- Tint i, num;
- tsm_node node;
-
- if( context.ind == TsmStructureNotOpen )
- return TFailure; /* No structure currently open */
-
- num = context.s->elemListHead.header.num;
- for( i=context.ind+1, node=context.n->next; i<=num; i++, node=node->next ){
- if( node->elem.el == TelLabel && node->elem.data.ldata == label_id ){
- context.ind = i;
- context.n = node;
- return TSuccess;
- }
- }
-
- return TFailure;
-}
-
-TStatus
-TsmOffsetElementPointer( Tint offset )
-{
- return TsmSetElementPointer( context.ind + offset );
-}
-
-TStatus
-TsmGetStructure( Tint stid, Tint *num, tsm_node *n )
-{
- if ( _StructMap.IsEmpty() )
- return TFailure; /* No structure created yet */
-
- if ( !_StructMap.IsBound(stid) )
- return TFailure; /* Non-existent structure */
-
- tsm_struct s = _StructMap.Find(stid);
-
- *num = s ? s->elemListHead.header.num : 0;
- // Here we cannot return a pointer to the structure's list head,
- // as it will wrongly interpreted as a regular pointer to TSM_NODE,
- // thus returning null pointer - this should be checked by callers!
- *n = s ? s->elemListHead.next : 0;
-
- return TSuccess;
-}
-
-static TStatus
-GetDepth( Tint stid, Tint *depth )
-{
- tsm_struct s;
- Tint i, d, b, num;
-
- if ( _StructMap.IsEmpty() )
- return TFailure; /* No structure created yet */
-
- if ( !_StructMap.IsBound(stid) )
- return TFailure; /* Non-existent structure */
-
- s = _StructMap.Find(stid);
-
- (*depth)++;
- d = b = *depth;
-
- if( s ){
- num = s->elemListHead.header.num;
- tsm_node node = s->elemListHead.next;
- for( i = 0; i < num; i++ ){
- if( node->elem.el == TelExecuteStructure ){
- GetDepth( node->elem.data.ldata, &d );
- if( *depth < d )
- *depth = d;
- }
- d = b;
- node = node->next;
- }
- }
-
- return TSuccess;
-}
-
-
-TStatus
-TsmGetStructureDepth( Tint stid, Tint *depth )
-{
- *depth = 0;
-
- GetDepth( stid, depth );
- return TSuccess;
-}
-
-TStatus
-TsmGetCurElem( TSM_ELEM *elem )
-{
- // Zero ind means no current element
- if( context.ind == TsmStructureNotOpen ||
- !context.ind )
- return TFailure;
-
- *elem = context.n->elem;
- return TSuccess;
-}
-
-TStatus
-TsmGetCurElemPtr( Tint *ptr )
-{
- // Zero ind means no current element
- if( context.ind == TsmStructureNotOpen ||
- !context.ind )
- return TFailure;
-
- *ptr = context.ind;
- return TSuccess;
-}
+ enum to control texture fill method
*/
-
-#include <OpenGl_cmn_varargs.hxx>
-
typedef enum
{
TelNil = 0,
TelLast
} TelType;
-typedef union TSM_ELEM_DATA_UNION
-{
- void *pdata;
- Tint ldata;
-} TSM_ELEM_DATA, *tsm_elem_data;
-
-typedef struct TSM_ELEM_STRUCT
-{
- TelType el;
- TSM_ELEM_DATA data;
- IMPLEMENT_MEMORY_OPERATORS
-} TSM_ELEM, *tsm_elem;
-
-/* A node containing an elem when structure is in the form of a list */
-struct TSM_NODE_STRUCT
-{
- struct TSM_NODE_STRUCT *next;
- struct TSM_NODE_STRUCT *prev;
- TSM_ELEM elem;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TSM_NODE_STRUCT TSM_NODE;
-typedef TSM_NODE_STRUCT* tsm_node;
-
-#ifdef OCC1188
-/* background texture properties */
-typedef enum
-{
- TSM_FS_CENTER,
- TSM_FS_TILE,
- TSM_FS_STRETCH
-} TSM_FillStyle;
-
-typedef struct
-{
- Tuint texId;
- Tint width;
- Tint height;
- TSM_FillStyle style;
- IMPLEMENT_MEMORY_OPERATORS
-} TSM_BG_TEXTURE, *tsm_bg_texture;
-#endif /* OCC1188 */
-
-typedef enum
-{
- TSM_GT_NONE,
- TSM_GT_HOR,
- TSM_GT_VER,
- TSM_GT_DIAG1,
- TSM_GT_DIAG2,
- TSM_GT_CORNER1,
- TSM_GT_CORNER2,
- TSM_GT_CORNER3,
- TSM_GT_CORNER4
-} TSM_GradientType;
-
-typedef struct
-{
- TEL_COLOUR color1;
- TEL_COLOUR color2;
- TSM_GradientType type;
- IMPLEMENT_MEMORY_OPERATORS
-} TSM_BG_GRADIENT, *tsm_bg_gradient;
-
-
-typedef enum
-{
- PickTraverse=0,
- DisplayTraverse,
- Add,
- Delete,
- Print,
- Inquire
-} TMsgType;
-
-typedef enum
-{
- TEditInsert = 1,
- TEditReplace
-} TEditMode;
-
-extern Tint TglActiveWs; /* currently defined in tsm/tsm.c */
-
-typedef TStatus (**MtblPtr)( TSM_ELEM_DATA, Tint, cmn_key* );
-
-extern void TsmInitAllClasses( MtblPtr (**tbl)(TelType*), Tint size );
-
-extern TEditMode TsmSetEditMode( TEditMode );
-extern TStatus TsmSendMessage( TelType, TMsgType, TSM_ELEM_DATA, Tint, ... );
-extern TStatus TsmOpenStructure( Tint );
-extern TStatus TsmCloseStructure();
-extern TStatus TsmDisplayStructure( Tint, Tint );
-extern TStatus TsmPrintStructure( Tint );
-extern TStatus TsmAddToStructure( TelType, Tint, ... );
-extern TStatus TsmDeleteStructure( Tint );
-extern TStatus TsmDeleteElement();
-extern TStatus TsmDeleteElementsBetweenLabels( Tint, Tint );
-extern TStatus TsmDeleteElementRange( Tint, Tint );
-extern TStatus TsmSetElementPointer( Tint );
-extern TStatus TsmSetElementPointerAtLabel( Tint );
-extern TStatus TsmOffsetElementPointer( Tint );
-extern TStatus TsmGetStructure( Tint, Tint*, tsm_node * );
-extern TStatus TsmGetStructureDepth( Tint, Tint* );
-extern TStatus TsmGetCurElem( TSM_ELEM * );
-extern TStatus TsmGetCurElemPtr( Tint * );
-
#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_tsm_ws :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-02-07-96 : FMN ; Suppression WSWSHeight, WSWSWidth et WSType
-17-07-96 : FMN ; Ajout WSZbuffer
-24-04-97 : FMN ; Ajout displaylist pour le mode transient
-07-08-97 : PCT ; ajout texture environnante
-22-10-01 : SAV ; added flag WSDepthTest to control depth testing
-24-10-01 : SAV ; added flag WSGLLight to control GL_LIGHTING
-particularly, this thechnique is used in triedron displaying.
-
-************************************************************************/
-
-#ifndef OPENGL_TSM_WS_H
-#define OPENGL_TSM_WS_H
-
-#define G003 /* EUG 11-01-00 backfacing management
-*/
-
-#define BUC61044 /* SAV ; added functionality to control gl depth testing
-from higher API */
-#define BUC61045 /* SAV ; added functionality to control gl lighting
-from higher API */
-#define OCC1188 /* SAV Added 23-12-02 background texture attribute */
-
-#include <OpenGl_cmn_varargs.hxx>
-
-typedef enum
-{
- WSTextureEnv, WSSurfaceDetail,
- WSFilters, WSWindow, WSWidth, WSHeight, WSDbuff,
- WSViewStid, WSLights, WSViews, WSBackground, WSNeedsClear, WSHighlights,
- WSDepthCues, WSTransparency, WSZbuffer, WSTransient, WSRetainMode, WSUpdateState, WSPixmap, WSGLXPixmap, WSDepth
-#ifdef G003
- , WSBackfacing
-#endif /* G003 */
-#ifdef BUC61044
- , WSDepthTest
-#endif
-#ifdef BUC61045
- , WSGLLight
-#endif
-#ifdef OCC1188
- , WSBgTexture
-#endif
- , WSBgGradient
-} TWSAttri;
-
-extern TStatus TsmRegisterWsid( Tint );
-extern TStatus TsmSetWSAttri( Tint, TWSAttri, cmn_key_data );
-extern TStatus TsmGetWSAttri( Tint, TWSAttri, cmn_key_data );
-/* struct_id, size, ws, actual_size */
-extern TStatus TsmGetWSPosted( Tint, Tint, Tint*, Tint* );
-extern TStatus TsmUnregisterWsid( Tint wsid );
-extern TStatus TsmInitUpdateState();
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_txgl :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-07-02-96 : FMN ; Suppression code inutile:
-- TxglLink() et TxglUnlink()
-08-03-96 : FMN ; Suppression variables globales
-Ajout cmn_delete_from_htbl() dans TxglDestroyWindow()
-21-03-96 : CAL ; test sur previous_ctx dans TxglDestroyWindow()
-et dans TxglSetDbuff()
-01-04-96 : CAL ; Integration MINSK portage WNT
-15-04-96 : CAL ; Integration travail PIXMAP de Jim ROTH
-26-04-96 : FMN ; Correction warning de compilation
-20-06-96 : CAL ; Retrait du XDestroyWindow dans TxglDestroyWindow
-18-07-96 : FMN ; Suppression code inutile: TxglSetWindow().
-27-09-96 : CAL ; Portage WNT
-16-10-96 : GG ; Coder le parametre de GLX_DEPTH_SIZE a 1 plutot
-que 0 si l'on souhaite accroitre les performances
-de 50% en utilisant le ZBuffer hardware !!!
-Si la fenetre fournie a deja le bon visual pas
-la peine de creer une sous-fenetre.
-16-10-96 : GG ; Le dithering doit etre active aussi avec 12 plans
-de maniere a ameliorer la qualite
-17-10-96 : FMN ; Ajout fonction printVisualInfo()
-06-11-96 : CAL ; Remise a True du BackDitherProp pour < 12 plans
-12-11-96 : CAL ; BackDitherProp = True pour <= 8 plans
-BackDitherProp = False pour > 8 plans
-29-01-97 : FMN ; Amelioration du tests pour le dithering
-DitherProp = True pour <= 8 plans red
-DitherProp = False pour > 8 plans red
-Suppression de TxglSetDbuff()
-06-06-97 : FMN ; Meilleure gestion glXMakeCurrent (pb avec LightWoks)
-Suppression de previous_win
-02-07-97 : FMN ; Suppression variable ESSAI
-07-10-97 : FMN ; Simplification WNT
-13-10-97 : FMN ; Ajout wglShareLists
-06-02-98 : FMN ; PRO11674: Suppression XSetErrorHandler(0) inutile
-23-11-98 : CAL ; PRO16603: previous_ctx jamais remis a 0 pour eviter
-la perte des lists.
-07-12-98 : CAL ; PRO 16311 et PRO 11821
-02.14.100 : JR : Warnings on WNT
-14.07.06 : SAN : OCC12977: update previous_ctx properly in TxglDestroyWindow.
-Old code resulted in crashes on some ATI Radeon cards under Linux.
-
-************************************************************************/
-
-#define BUC60691 /*GG 06/06/00 Due to a severe bug in secondary
-// table hash-code computation not yet solve,
-// It's necessary to compute the primary hash-key key
-// correctly under WNT/W98. The actual method is wrong
-// because a size 4 is used for this table instead
-// a conventional prime number as under UNIX system (23).
-// Under W98 sometimes the function wglMakeContext() does
-// not work for an UNKNOWN reason, the number of DC
-// seems limited to 5 but nothing tell that the limit is
-// reached !
-// We try right now to recover this error by creating a new DC.
-*/
-
-#define RIC120303 /*GG Add new function TxglSetWindow using
-// the GLXContext defined by the user
-// Add new function TxglGetContext.
-*/
-
-#define OCC954 /*SAV: 13/11/02 - check GLRC before deleting it*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <stdio.h>
-
-#include <OpenGl_Memory.hxx>
-#include <OpenGl_ResourceCleaner.hxx>
-
-
-#ifdef WNT
-struct HTBL_ENTRY {
- HDC hDC;
- HGLRC hGLRC;
- int nUsed;
- IMPLEMENT_MEMORY_OPERATORS
-};
-
-
-int call_util_osd_getenv ( char*, char*, int );
-#endif /* WNT */
-
-#include <OpenGl_txgl.hxx>
-int call_util_osd_getenv( char * , char * , int ) ;
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-#ifndef WNT
-typedef NCollection_DataMap<Tint, GLCONTEXT> GLContextMap;
-#else
-typedef NCollection_DataMap<Tint, HTBL_ENTRY*> GLContextMap;
-#endif
-
-static GLContextMap _Txgl_Map;
-
-
-#ifndef WNT
-static int BackDitherProp = False; /* Dithering pour le background */
-static int DitherProp = True; /* Dithering pour le trace */
-static GLXContext previous_ctx = 0; /* Use for share display list */
-static GLXContext dead_ctx; /* Context to be destroyed */
-static Display *dead_dpy; /* Display associated with dead_ctx */
-#else
-static int BackDitherProp = FALSE; /* Dithering pour le background */
-static int DitherProp = TRUE; /* Dithering pour le trace */
-static BOOL s_sysPalInUse; /* Flag to check system colors usage */
-static HGLRC previous_ctx = 0; /* Use for share display list */
-#endif /* WNT */
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define NO_TRACE
-
-#define CALL_DEF_STRING_LENGTH 132
-
-#define WIN_HTBL_SIZE 23
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions statiques
-*/
-
-#ifndef WNT
-#ifdef TRACE
-static GLvoid printVisualInfo( Display *, XVisualInfo *glxVisual );
-#endif
-#else
-#ifdef BUC60691
-static BOOL win95 = FALSE;
-#endif
-
-static int find_pixel_format(HTBL_ENTRY * hte, PIXELFORMATDESCRIPTOR * pfd);
-
-__declspec( dllexport ) int __fastcall __OpenGl_INIT__ (
- unsigned hInstance, unsigned long reason_for_call
- ) {
- if ( reason_for_call == DLL_PROCESS_ATTACH ) {
-
- }
- return 1;
-
- } /* end __OpenGl_INIT__ */
-#endif /* WNT */
-
- /*----------------------------------------------------------------------*/
-
- WINDOW
- TxglCreateWindow( DISPLAY *disp, WINDOW par,
- Tint x, Tint y, Tint w, Tint h, Tint bw,
- Tfloat bgcolr, Tfloat bgcolg, Tfloat bgcolb )
- {
-
-#ifndef WNT
-
- GLCONTEXT ctx;
- Colormap cmap;
- XVisualInfo* vis=NULL;
- /* XVisualInfo tmplt;*/
- XSetWindowAttributes cwa;
- XColor color;
- int value;
- char string[CALL_DEF_STRING_LENGTH];
- WINDOW win;
-
- int DBuffer = (call_util_osd_getenv ("CALL_OPENGL_NO_DBF", string, CALL_DEF_STRING_LENGTH)) ? False : True;
-
- if (call_util_osd_getenv("JWR_PIXMAP_DB", string, CALL_DEF_STRING_LENGTH))
- TelSetPixmapDB(1);
-
- XWindowAttributes wattr;
- XGetWindowAttributes (disp, par, &wattr);
- Tint scr = DefaultScreen (disp);
-
-#if defined(__linux) || defined(Linux)
- {
- XVisualInfo aVisInfo;
- int aNbItems;
- int isGl, isDoubleBuffer, isRGBA, aDepthSize, aStencilSize;
- unsigned long aVisInfoMask = VisualIDMask | VisualScreenMask;
- aVisInfo.visualid = wattr.visual->visualid;
- aVisInfo.screen = DefaultScreen (disp);
- vis = XGetVisualInfo (disp, aVisInfoMask, &aVisInfo, &aNbItems);
- if (vis != NULL)
- {
- // check Visual for OpenGl context's parameters compability
- if (glXGetConfig (disp, vis, GLX_USE_GL, &isGl) != 0)
- isGl = 0;
-
- if (glXGetConfig (disp, vis, GLX_RGBA, &isRGBA) != 0)
- isRGBA = 0;
-
- if (glXGetConfig (disp, vis, GLX_DOUBLEBUFFER, &isDoubleBuffer) != 0)
- isDoubleBuffer = 0;
-
- if (glXGetConfig (disp, vis, GLX_DEPTH_SIZE, &aDepthSize) != 0)
- aDepthSize = 0;
-
- if (glXGetConfig (disp, vis, GLX_STENCIL_SIZE, &aStencilSize) != 0)
- aStencilSize = 0;
-
- if (!isGl || !aDepthSize || !aStencilSize ||
- !isRGBA || isDoubleBuffer != DBuffer)
- {
- XFree (vis);
- vis = NULL;
- }
- }
- }
-#endif
-
- if (vis == NULL)
- {
- int anIter = 0;
- int anAttribs[13];
- anAttribs[anIter++] = GLX_RGBA;
-
- anAttribs[anIter++] = GLX_DEPTH_SIZE;
- anAttribs[anIter++] = 1;
-
- anAttribs[anIter++] = GLX_STENCIL_SIZE;
- anAttribs[anIter++] = 1;
-
- anAttribs[anIter++] = GLX_RED_SIZE;
- anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1;
-
- anAttribs[anIter++] = GLX_GREEN_SIZE;
- anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1;
-
- anAttribs[anIter++] = GLX_BLUE_SIZE;
- anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1;
-
- if (DBuffer)
- anAttribs[anIter++] = GLX_DOUBLEBUFFER;
-
- anAttribs[anIter++] = None;
-
- vis = glXChooseVisual (disp, scr, anAttribs);
- if (vis == NULL) return TFailure;
- }
-
-#ifdef TRACE
- printf ("TxglCreateWindow \n");
- printf ("Informations sur le visual\n");
- printf ("par visualid %x%x %d\n", wattr.visual->visualid, wattr.visual->visualid);
- printf ("vis visualid 0x%x %d\n", vis->visualid, vis->visualid);
- printf ("vis depth %d\n", vis->depth);
- printf ("vis class %d\n", vis->class);
- printf ("vis red_mask %ld\n", vis->red_mask);
- printf ("vis green_mask %ld\n", vis->green_mask);
- printf ("vis blue_mask %ld\n", vis->blue_mask);
- printf ("vis colormap_size %d\n", vis->colormap_size);
- printf ("vis bits_per_rgb %d\n", vis->bits_per_rgb);
- printVisualInfo( disp, vis );
-#endif
-
- /*
- * Le BackDitherProp est utilise pour le clear du background
- * Pour eviter une difference de couleurs avec la couleur choisie
- * par l'application (XWindow) il faut desactiver le dithering
- * au dessus de 8 plans.
- *
- * Pour le DitherProp:
- * On cherchera a activer le Dithering que si le Visual a au moins
- * 8 plans pour le GLX_RED_SIZE. Le test est plus sur car on peut
- * avoir une profondeur superieure a 12 mais avoir besoin du dithering.
- * (Carte Impact avec GLX_RED_SIZE a 5 par exemple)
- */
-
- glXGetConfig( disp, vis, GLX_RED_SIZE, &value );
- DitherProp = (value < 8) ? True : False;
- BackDitherProp = (vis->depth <= 8) ? True : False;
-
-#ifdef TRACE
- printf("Dithering %d BackDithering %d \n",DitherProp,BackDitherProp);
-#endif
-
- if (call_util_osd_getenv ("CALL_OPENGL_NO_DITHER", string, CALL_DEF_STRING_LENGTH))
- DitherProp = False;
-
- if (call_util_osd_getenv ("CALL_OPENGL_NO_BACKDITHER", string, CALL_DEF_STRING_LENGTH))
- BackDitherProp = False;
-
- if (dead_ctx) {
- /* recover display lists from dead_ctx, then destroy it */
- ctx = glXCreateContext( disp, vis, dead_ctx, GL_TRUE );
- glXDestroyContext(dead_dpy, dead_ctx);
- } else if (previous_ctx == 0) {
- ctx = glXCreateContext( disp, vis, NULL, GL_TRUE );
- } else {
- /* ctx est une copie du previous */
- ctx = glXCreateContext( disp, vis, previous_ctx, GL_TRUE );
- }
- previous_ctx = ctx;
-
- if( ctx )
- OpenGl_ResourceCleaner::GetInstance()->AppendContext( ctx, true );
-
- // remove the dead_ctx for ResourceCleaner after appending shared ctx
- if (dead_ctx) {
- OpenGl_ResourceCleaner::GetInstance()->RemoveContext(dead_ctx);
- dead_ctx = 0;
- }
-
- if( !ctx) return TFailure;
-
- cmap = XCreateColormap( disp, par, vis->visual, AllocNone );
-
- color.red = (unsigned short) (bgcolr * 0xFFFF);
- color.green = (unsigned short) (bgcolg * 0xFFFF);
- color.blue = (unsigned short) (bgcolb * 0xFFFF);
- color.flags = DoRed | DoGreen | DoBlue;
- XAllocColor( disp, cmap, &color );
-
- cwa.colormap = cmap;
- cwa.event_mask = StructureNotifyMask;
- cwa.border_pixel = color.pixel;
- cwa.background_pixel = color.pixel;
-
- unsigned long mask = CWBackPixel | CWColormap | CWBorderPixel | CWEventMask;
-
- if( vis->visualid == wattr.visual->visualid ) {
- win = par;
- }
- else
- {
- win = XCreateWindow( disp, par, x, y, w, h, bw,
- vis->depth, InputOutput, vis->visual,
- mask, &cwa );
- }
-
-#ifdef TRACE
- printf ("TxglCreateWindow win %x par %x \n", win, par);
-#endif
-
- XSetWindowBackground( disp, win, cwa.background_pixel );
- XClearWindow( disp, win );
-
- /* if in Pixmap double buffering mode, set up pixmap */
-
- if (TelTestPixmapDB())
- {
- GC gc;
- Pixmap pixmap;
- GLXPixmap glxpixmap;
-
- printf("setting up pixmap double buffering\n");
-
- gc = XCreateGC(disp, win, 0, NULL);
-
- pixmap = XCreatePixmap(disp, win, w, h, vis->depth);
-
- glxpixmap = glXCreateGLXPixmap(disp, vis, pixmap);
-
- glXMakeCurrent(disp, glxpixmap, ctx);
-
- glDrawBuffer(GL_FRONT);
-
- TelSetPixmapDBParams(disp, win, w, h, vis->depth, gc, pixmap, glxpixmap, ctx);
- }
-
- XFree((char*)vis);
-
- _Txgl_Map.Bind( (Tint)win, ctx );
-
- return win;
-
-#else /* WNT */
-
- HTBL_ENTRY* hte;
- PIXELFORMATDESCRIPTOR pfd;
- BOOL DBuffer = TRUE;
- int iPixelFormat;
- char string[ CALL_DEF_STRING_LENGTH ];
-
-#ifdef BUC60691
- OSVERSIONINFO os;
- os.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
- GetVersionEx(&os);
- if( os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) win95 = TRUE;
-#endif
-
- if ( _Txgl_Map.IsBound( (Tint)par ) ) {
- hte = _Txgl_Map.ChangeFind( (Tint)par );
- if ( hte )
- {
- ++hte -> nUsed;
- printf("*TxglCreateWindow.window %d is alreday created\n",par);
- return par;
- }
- }
-
- hte = new HTBL_ENTRY();
-
- if ( !hte ) return 0;
- hte -> hDC = GetDC ( par );
-
- iPixelFormat = find_pixel_format(hte, &pfd);
-
- if ( !iPixelFormat )
- {
- printf ("*OpenGL interface: ChoosePixelFormat failed. Error code: %d\n",GetLastError ());
-
- ReleaseDC ( par, hte -> hDC );
- delete hte;
-
- return 0;
- }
-
- if ( pfd.dwFlags & PFD_NEED_PALETTE )
- {
- WINDOW_DATA* wd = ( WINDOW_DATA* )GetWindowLongPtr ( par, GWLP_USERDATA );
-
- InterfaceGraphic_RealizePalette (hte -> hDC, wd -> hPal, FALSE,
- s_sysPalInUse = pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ? TRUE : FALSE);
- }
-
- if ( pfd.cColorBits <= 8 )
- {
- DitherProp = TRUE;
- BackDitherProp = TRUE;
- }
-
- if (call_util_osd_getenv ("CALL_OPENGL_NO_DITHER", string, CALL_DEF_STRING_LENGTH))
- DitherProp = FALSE;
-
- if (call_util_osd_getenv ("CALL_OPENGL_NO_BACKDITHER", string, CALL_DEF_STRING_LENGTH))
- BackDitherProp = FALSE;
-
- if ( !SetPixelFormat ( hte -> hDC, iPixelFormat, &pfd ) )
- {
- printf ("*OpenGL interface: SetPixelFormat failed. Error code %d\n",GetLastError ());
- ReleaseDC ( par, hte -> hDC );
- delete hte;
- return 0;
- }
-
- hte -> hGLRC = wglCreateContext ( hte -> hDC );
-
- if ( !hte -> hGLRC )
- {
- printf ("*OpenGL interface: wglCreateContext failed. Error code: %d\n",GetLastError ());
- return 0;
- }
-
- Standard_Boolean isShared = Standard_True;
-
- if (previous_ctx == 0 )
- previous_ctx = hte -> hGLRC;
- // if we already have some shared context
- else
- {
- // try to share context with one from resource cleaner list
- GLCONTEXT shareCtx = OpenGl_ResourceCleaner::GetInstance()->GetSharedContext();
-
- if (shareCtx != 0)
- isShared = (Standard_Boolean)wglShareLists(shareCtx, hte -> hGLRC);
- else
- {
- isShared = (Standard_Boolean)wglShareLists(previous_ctx, hte -> hGLRC);
- // add shared previous_ctx to a control list if it's not there
- if (isShared)
- OpenGl_ResourceCleaner::GetInstance()->AppendContext(previous_ctx, isShared);
- }
- }
-
- // add the context to OpenGl_ResourceCleaner control list
- OpenGl_ResourceCleaner::GetInstance()->AppendContext( hte -> hGLRC, isShared);
- _Txgl_Map.Bind( (Tint)par, hte );
-
- return par;
-
-#endif /* WNT */
-
- }
-
-#ifdef RIC120302
- WINDOW
- TxglSetWindow( DISPLAY *disp, WINDOW par, GLCONTEXT ctx)
- {
-#ifndef WNT
- XVisualInfo* vis;
- char string[CALL_DEF_STRING_LENGTH];
- XWindowAttributes wattr;
-
- XGetWindowAttributes( disp , par , &wattr );
- {
- unsigned long vmask = VisualIDMask | VisualScreenMask;
- XVisualInfo vinfo;
- int ninfo;
- vinfo.visualid = wattr.visual->visualid;
- vinfo.screen = DefaultScreen( disp );
- vis = XGetVisualInfo( disp, vmask, &vinfo, &ninfo);
- }
-
- if( !vis) return TFailure;
-
-#ifdef TRACE
- printf ("TxglSetWindow \n");
- printf ("Informations sur le visual\n");
- printf ("par visualid %x%x %d\n", wattr.visual->visualid, wattr.visual->visualid);
- printf ("vis visualid 0x%x %d\n", vis->visualid, vis->visualid);
- printf ("vis depth %d\n", vis->depth);
- printf ("vis class %d\n", vis->class);
- printf ("vis red_mask %ld\n", vis->red_mask);
- printf ("vis green_mask %ld\n", vis->green_mask);
- printf ("vis blue_mask %ld\n", vis->blue_mask);
- printf ("vis colormap_size %d\n", vis->colormap_size);
- printf ("vis bits_per_rgb %d\n", vis->bits_per_rgb);
- printVisualInfo( disp, vis );
-#endif
-
- /*
- * Le BackDitherProp est utilise pour le clear du background
- * Pour eviter une difference de couleurs avec la couleur choisie
- * par l'application (XWindow) il faut desactiver le dithering
- * au dessus de 8 plans.
- *
- * Pour le DitherProp:
- * On cherchera a activer le Dithering que si le Visual a au moins
- * 8 plans pour le GLX_RED_SIZE. Le test est plus sur car on peut
- * avoir une profondeur superieure a 12 mais avoir besoin du dithering.
- * (Carte Impact avec GLX_RED_SIZE a 5 par exemple)
- */
-
- {
- int value;
- glXGetConfig( disp, vis, GLX_RED_SIZE, &value );
-
- if ( value < 8 ) {
- DitherProp = True;
- } else {
- DitherProp = False;
- }
-
- if ( vis->depth <= 8 ) {
- BackDitherProp = True;
- } else {
- BackDitherProp = False;
- }
- }
-
-#ifdef TRACE
- printf("Dithering %d BackDithering %d \n",DitherProp,BackDitherProp);
-#endif
-
- if (call_util_osd_getenv ("CALL_OPENGL_NO_DITHER", string, CALL_DEF_STRING_LENGTH))
- DitherProp = False;
-
- if (call_util_osd_getenv ("CALL_OPENGL_NO_BACKDITHER", string, CALL_DEF_STRING_LENGTH))
- BackDitherProp = False;
-
- previous_ctx = ctx;
-
- XFree((char*)vis);
-
- _Txgl_Map.Bind( ( Tint )par, ctx );
-#else /* WNT */
-
- /* abd
- cmn_htbl_elem rec;*/
- HTBL_ENTRY* hte;
- PIXELFORMATDESCRIPTOR pfd;
- BOOL DBuffer = TRUE;
- int iPixelFormat;
- char string[ CALL_DEF_STRING_LENGTH ];
-
-#ifdef BUC60691
- OSVERSIONINFO os;
- os.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
- GetVersionEx(&os);
- if( os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) win95 = TRUE;
-#endif
-
- if ( _Txgl_Map.IsBound( ( Tint )par ) )
- {
- hte = _Txgl_Map.ChangeFind( ( Tint )par );
- ++hte -> nUsed;
- printf("*TxglSetWindow.window %d is alreday created\n",par);
- return par;
- }
-
- hte = new HTBL_ENTRY();
-
- if ( !hte ) return 0;
-
- hte -> hDC = GetDC ( par );
- iPixelFormat = find_pixel_format(hte, &pfd);
-
- if ( !iPixelFormat )
- {
- printf ("*OpenGL interface: ChoosePixelFormat failed. Error code: %d\n",GetLastError ());
-
- ReleaseDC ( par, hte -> hDC );
- delete hte;
-
- return 0;
- }
-
- if ( pfd.dwFlags & PFD_NEED_PALETTE )
- {
- WINDOW_DATA* wd = ( WINDOW_DATA* )GetWindowLongPtr ( par, GWLP_USERDATA );
-
- InterfaceGraphic_RealizePalette (hte -> hDC, wd -> hPal, FALSE,
- s_sysPalInUse = pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ? TRUE : FALSE);
- }
-
- if ( pfd.cColorBits <= 8 )
- {
- DitherProp = TRUE;
- BackDitherProp = TRUE;
- }
-
- if (call_util_osd_getenv ("CALL_OPENGL_NO_DITHER", string, CALL_DEF_STRING_LENGTH))
- DitherProp = FALSE;
-
- if (call_util_osd_getenv ("CALL_OPENGL_NO_BACKDITHER", string, CALL_DEF_STRING_LENGTH))
- BackDitherProp = FALSE;
-
- if ( !SetPixelFormat ( hte -> hDC, iPixelFormat, &pfd ) )
- {
- printf ("*OpenGL interface: SetPixelFormat failed. Error code %d\n",GetLastError ());
- ReleaseDC ( par, hte -> hDC );
- delete hte;
- return 0;
- }
-
- hte -> hGLRC = previous_ctx = ctx;
-
- _Txgl_Map.Bind( ( Tint )par, hte );
-#endif /* WNT */
-
- return par;
-
- }
-#endif /*RIC120302*/
-
- /*----------------------------------------------------------------------*/
-
- TStatus
- TxglWinset( DISPLAY *disp, WINDOW win )
- {
-
-#ifndef WNT
-
- Bool i;
- GLXContext ctx;
- GLenum errorcode;
- const GLubyte *errorstring;
-
- if ( !_Txgl_Map.IsBound( win ) )
- return TFailure;
-
- ctx = _Txgl_Map.ChangeFind( win );
-
-
-#ifdef TRACE
- printf ("TxglWinset::glXMakeCurrent %x \n", win);
-#endif
- if (TelTestPixmapDB())
- {
- i = glXMakeCurrent(disp, TelGetGLXPixmap(), ctx);
- }
- else
- {
- i = glXMakeCurrent(disp, win, ctx); /* TRUE/FALSE */
- }
- if (!i)
- {
- // if there is no current context it might be impossible to use
- // glGetError correctly
- printf("glXMakeCurrent failed!\n");
- }
-
- return i == True ? TSuccess : TFailure;
-
-#else /* WNT */
-
- HTBL_ENTRY* hte;
- HDC hdc = NULL;
- HGLRC hglrc = NULL;
- TStatus retVal = TFailure;
-
- __try {
-
- if ( !_Txgl_Map.IsBound( ( Tint )win ) ) {
- printf("OpenGL interface: TxglWinset failed.UNKNOWN win %x\n",win);
- __leave;
- }
- hte = _Txgl_Map.ChangeFind( ( Tint )win );
-
-#ifdef BUC60691
- if( win95 ) {
- retVal = (TStatus)ReleaseDC ( win, hte -> hDC );
- hte -> hDC = GetDC ( win );
- }
-#endif
- if ( !wglMakeCurrent ( hte -> hDC, hte -> hGLRC ) )
- {
-#ifdef BUC60691
- GLenum errorcode;
- const GLubyte *errorstring;
-
- errorcode = glGetError();
- errorstring = gluErrorString(errorcode);
- printf("wglMakeCurrent failed: %d %s\n", errorcode, errorstring);
-#else
- printf ("OpenGL interface: wglMakeCurrent failed. Error code: %d\n",GetLastError ());
-#endif
- retVal = TFailure;
- } else retVal = TSuccess;
-
- } /* end __try */
-
-
- __finally
- {
- }
-
- return retVal;
-
-#endif /* WNT */
-
- }
-
- /*----------------------------------------------------------------------*/
-
- WINDOW
- TxglGetSubWindow( DISPLAY *disp, WINDOW win )
- /* This function assumes that there is only
- one child for the parent */
- {
-
-#ifndef WNT
-
- Window root, parent, *child, w;
- unsigned int num;
-
- if( XQueryTree( disp, win, &root, &parent, &child, &num ) )
- {
- if (! num) return win;
- w = child[0];
- XFree( (char *)child );
- return w;
- }
- else
- return 0;
-
-#else /* WNT */
-
- return win;
-
-#endif /* WNT */
-
- }
-
- /*----------------------------------------------------------------------*/
-
- void
- TxglDestroyWindow( DISPLAY *disp, WINDOW win )
- {
-
-#ifndef WNT
-
- GLXContext ctx;
- Tint dummy;
-
- if ( !_Txgl_Map.IsBound(win) )
- return;
- ctx = _Txgl_Map.ChangeFind(win);
-
- /* FSXXX sync necessary if non-direct rendering */
- glXWaitGL();
-
- _Txgl_Map.UnBind( win );
-
- if (previous_ctx == ctx) {
- /* san -- OCC12977: it's important to put some valid GLXContext or null into
- previous_ctx here, otherwise next glxCreateContext() will crash on some ATI Radeon cards
- */
- previous_ctx = NULL;
- if ( _Txgl_Map.Size() > 0 ) {
- GLContextMap::Iterator it(_Txgl_Map);
- previous_ctx = it.Value();
- }
- /*
- * if this is the last remaining context, do not destroy it yet, to avoid
- * losing any shared display lists (fonts...)
- */
- if (previous_ctx) {
- OpenGl_ResourceCleaner::GetInstance()->RemoveContext(ctx);
- glXDestroyContext(disp, ctx);
- } else {
- dead_ctx = ctx;
- dead_dpy = disp;
- }
- } else {
- OpenGl_ResourceCleaner::GetInstance()->RemoveContext(ctx);
- glXDestroyContext(disp, ctx);
- }
-
-#else /* WNT */
-
- HTBL_ENTRY* hte;
-#ifdef _DEBUG
- WINDOW_DATA* wd;
-#endif /* _DEBUG */
- if ( !_Txgl_Map.IsBound(( Tint )win) )
- return;
- hte = _Txgl_Map.ChangeFind(( Tint )win);
-
-#ifdef _DEBUG
- /* In release version of application we need to process */
- /* palette messages in the main application message loop. */
- /* In debug version we don't have message loop for most */
- /* cases. So, let's restore system colors here now. */
- wd = ( WINDOW_DATA* )GetWindowLongPtr ( win, GWLP_USERDATA );
-
- if ( wd != NULL ) InterfaceGraphic_RealizePalette (
- hte -> hDC, wd -> hPal, TRUE, s_sysPalInUse);
-#endif /* _DEBUG */
-
- if ( --hte -> nUsed == 0 )
- {
- OpenGl_ResourceCleaner::GetInstance()->RemoveContext( hte -> hGLRC );
-#ifdef OCC954
- if ( wglGetCurrentContext() != NULL )
-#endif
- wglDeleteContext ( hte -> hGLRC );
- ReleaseDC ( win, hte -> hDC );
- _Txgl_Map.UnBind( (Tint ) win );
- if( _Txgl_Map.Size() == 0 ) {
- previous_ctx = 0;
- }
- delete hte;
- }
-
-#endif /* WNT */
-
- }
-
- /*----------------------------------------------------------------------*/
-
- int
- TxglGetDither(void)
- {
- return DitherProp;
- }
-
- /*----------------------------------------------------------------------*/
-
- int
- TxglGetBackDither(void)
- {
- return BackDitherProp;
- }
-
-
- /*----------------------------------------------------------------------*/
- /*RIC120302*/
- GLCONTEXT
- TxglGetContext( WINDOW win )
- {
- GLCONTEXT ctx = NULL;
- if ( _Txgl_Map.IsBound( (Tint) win ) )
- ctx =
-#ifdef WNT
- _Txgl_Map.Find( (Tint) win )->hGLRC;
-#else
- _Txgl_Map.Find( win );
-#endif
-
- return ctx;
- }
- /*RIC120302*/
-
- /*----------------------------------------------------------------------*/
- enum { ZERO = 0, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN };
-
- /* Unused :*/
-#ifdef TRACE
- static const char*
- className( int class )
- {
- static char *classes[] = {
- "StaticGray",
- "GrayScale",
- "StaticColor",
- "PseudoColor",
- "TrueColor",
- "DirectColor",
- };
-
- if ( class < ZERO || class > FIVE )
- return "unknown";
- else
- return classes[class];
- }
-#endif
- /*----------------------------------------------------------------------*/
-#ifndef WNT
-
-#ifdef TRACE
- static GLvoid printVisualInfo( DISPLAY *display, XVisualInfo *glxVisual )
- {
-
-#define TrueFalse(x) ( x ? "True" : "False" )
-
- int tmp;
-
- printf("\n" );
- printf(" X Visual Information ...\n\n" );
- printf("\tvisualid : 0x%x\n", glxVisual->visualid );
- printf("\tclass : %s\n\n", className( glxVisual->class ) );
-
- glXGetConfig(display, glxVisual, GLX_USE_GL, &tmp);
- printf( "\tSupport GL ( GLX_USE_GL ) : %s\n", TrueFalse(tmp) );
-
- glXGetConfig(display, glxVisual, GLX_LEVEL, &tmp);
- printf( "\tFramebuffer ( GLX_LEVEL ) : %s\n\n",
- (tmp < ZERO) ? "Underlay" : (tmp == ZERO ? "Normal" : tmp > ONE ? "Overlay" : "Popup") );
-
- glXGetConfig(display, glxVisual, GLX_BUFFER_SIZE, &tmp);
- printf( "\tFramebuffer depth ( GLX_BUFFER_SIZE ) : %d\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_DOUBLEBUFFER, &tmp);
- printf( "\tDoublebuffer ( GLX_DOUBLEBUFFER ) : %s\n",
- TrueFalse(tmp) );
-
- glXGetConfig(display, glxVisual, GLX_DEPTH_SIZE, &tmp);
- printf( "\tDepth buffer depth ( GLX_DEPTH_SIZE ) : %d\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_STENCIL_SIZE, &tmp);
- printf( "\tStencil buffer depth ( GLX_STENCIL_SIZE ) : %d\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_STEREO, &tmp);
- printf( "\tStereo Buffer ( GLX_STEREO ) : %s\n",
- TrueFalse(tmp) );
-
- glXGetConfig(display, glxVisual, GLX_AUX_BUFFERS, &tmp);
- printf( "\tAuxillary Buffers ( GLX_AUX_BUFFERS) : %d\n\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_RGBA, &tmp);
- printf( "\tColor mode ( GLX_RGBA ) : %s\n", tmp ? "RGBA" :
- "Color Index" );
-
- glXGetConfig(display, glxVisual, GLX_RED_SIZE, &tmp);
- printf( "\tRed Bits ( GLX_RED_SIZE ) : %d\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_GREEN_SIZE, &tmp);
- printf( "\tGreen Bits ( GLX_GREEN_SIZE ) : %d\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_BLUE_SIZE, &tmp);
- printf( "\tBlue Bits ( GLX_BLUE_SIZE ) : %d\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_ALPHA_SIZE, &tmp);
- printf( "\tAlpha Bits ( GLX_ALPHA_SIZE ) : %d\n\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_ACCUM_RED_SIZE, &tmp);
- printf( "\tRed Accumulation Bits ( GLX_ACCUM_RED_SIZE ) : %d\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_ACCUM_GREEN_SIZE, &tmp);
- printf( "\tGreen Accumulation Bits ( GLX_ACCUM_GREEN_SIZE ) : %d\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_ACCUM_BLUE_SIZE, &tmp);
- printf( "\tBlue Accumulation Bits ( GLX_ACCUM_BLUE_SIZE ) : %d\n", tmp );
-
- glXGetConfig(display, glxVisual, GLX_ACCUM_ALPHA_SIZE, &tmp);
- printf( "\tAlpha Accumulation Bits ( GLX_ACCUM_ALPHA_SIZE ) : %d\n\n", tmp );
- }
-#endif //TRACE
-#else //WNT
- int find_pixel_format(HTBL_ENTRY * hte, PIXELFORMATDESCRIPTOR * pfd)
- {
- int iPixelFormat = 0;
- int iGood = 0;
- int i, j, k;
- PIXELFORMATDESCRIPTOR pfd0;
- char string[ CALL_DEF_STRING_LENGTH ];
- BOOL DBuffer = TRUE;
- const int sBits[] = { 8, 1 };
- const int cBits[] = { 32, 24 };
- const int dBits[] = { 32, 24, 16 };
- int goodBits[3] = { 0, 0, 0 };
-
- if (call_util_osd_getenv ("CALL_OPENGL_NO_DBF",
- string, CALL_DEF_STRING_LENGTH))
- DBuffer = FALSE;
-
- pfd0.nSize = sizeof ( PIXELFORMATDESCRIPTOR );
- pfd0.nVersion = 1;
- pfd0.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
- pfd0.dwFlags |= ( DBuffer ) ? PFD_DOUBLEBUFFER : PFD_SUPPORT_GDI;
- pfd0.iPixelType = PFD_TYPE_RGBA;
- pfd0.cRedBits = 0;
- pfd0.cRedShift = 0;
- pfd0.cGreenBits = 0;
- pfd0.cGreenShift = 0;
- pfd0.cBlueBits = 0;
- pfd0.cBlueShift = 0;
- pfd0.cAlphaBits = 0;
- pfd0.cAlphaShift = 0;
- pfd0.cAccumBits = 0;
- pfd0.cAccumRedBits = 0;
- pfd0.cAccumGreenBits = 0;
- pfd0.cAccumBlueBits = 0;
- pfd0.cAccumAlphaBits = 0;
- pfd0.cStencilBits = 0;
- pfd0.cAuxBuffers = 0;
- pfd0.iLayerType = PFD_MAIN_PLANE;
- pfd0.bReserved = 0;
- pfd0.dwLayerMask = 0;
- pfd0.dwVisibleMask = 0;
- pfd0.dwDamageMask = 0;
-
- hte -> nUsed = 1;
- /*
- This loop tries to find the pixel format with parameters not worse
- than given in sBits, cBits, dBits, giving the priority to color bits
- then depth bits, with stencil bits having the lowest priority.
- If the needed combination is not found then the iGood value is used, it
- is rememebered during the loop as the best ever found combination.
- */
-
- for (k = 0; k < sizeof(sBits) / sizeof(int); k++) {
-
- pfd0.cStencilBits = sBits[k];
- for (i = 0; i < sizeof(dBits) / sizeof(int); i++) {
-
- pfd0.cDepthBits = dBits[i];
- iGood = 0;
- for (j = 0; j < sizeof(cBits) / sizeof(int); j++) {
-
- pfd0.cColorBits = cBits[j];
- iPixelFormat = ChoosePixelFormat ( hte -> hDC, &pfd0 );
-
- if (iPixelFormat) {
- pfd->cDepthBits = 0;
- pfd->cColorBits = 0;
- pfd->cStencilBits = 0;
- DescribePixelFormat (hte -> hDC, iPixelFormat,
- sizeof ( PIXELFORMATDESCRIPTOR ), pfd);
- if (pfd->cColorBits >= cBits[j] &&
- pfd->cDepthBits >= dBits[i] &&
- pfd->cStencilBits >= sBits[k])
- break; /* found - stop the lookup immediately */
- if (pfd->cColorBits > goodBits[0]) {
- goodBits[0] = pfd->cColorBits;
- goodBits[1] = pfd->cDepthBits;
- goodBits[2] = pfd->cStencilBits;
- iGood = iPixelFormat;
- } else if (pfd->cColorBits == goodBits[0]) {
- if (pfd->cDepthBits > goodBits[1]) {
- goodBits[1] = pfd->cDepthBits;
- goodBits[2] = pfd->cStencilBits;
- iGood = iPixelFormat;
- } else if (pfd->cDepthBits == goodBits[1]) {
- if (pfd->cStencilBits > goodBits[2]) {
- goodBits[2] = pfd->cStencilBits;
- iGood = iPixelFormat;
- }
- }
- }
- }
- }
- if (j < sizeof(cBits) / sizeof(int))
- break;
- }
- if (i < sizeof(dBits) / sizeof(int))
- break;
- }
-
- if ( !iPixelFormat )
- iPixelFormat = iGood;
-
- return iPixelFormat;
- }
-
-#endif /* WNT */
- /*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-Include OpenGl_txgl :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-07-02-96 : FMN ; Suppression code inutile:
-- TxglLink() et TxglUnlink()
-Ajout prototype de TxglGetBackDither()
-18-07-96 : FMN ; Suppression code inutile: TxglSetWindow().
-29-01-97 : FMN ; Suppression de TxglSetDbuff().
-
-************************************************************************/
-
-#ifndef OPENGL_TXGL_H
-#define OPENGL_TXGL_H
-
-#define RIC120302 /* GG ; Add NEW TxglSetWindow function
-// Add NEW TxglGetContext function
-*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-# include <InterfaceGraphic.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes fonctions externes
-*/
-
-extern WINDOW TxglCreateWindow( DISPLAY*, WINDOW, /* x, y, w, h, bw, bgcol */
- Tint, Tint, Tint, Tint, Tint, Tfloat, Tfloat, Tfloat );
-extern TStatus TxglWinset( DISPLAY*, WINDOW );
-#ifdef RIC120302
-extern WINDOW TxglSetWindow( DISPLAY*, WINDOW, GLCONTEXT );
-extern GLCONTEXT TxglGetContext( WINDOW );
-#endif
-extern WINDOW TxglGetSubWindow( DISPLAY*, WINDOW );
-extern void TxglDestroyWindow( DISPLAY *, WINDOW );
-extern int TxglGetDither(void);
-extern int TxglGetBackDither(void);
-
-/*----------------------------------------------------------------------*/
-
-#endif
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-file OpenGl_undefined :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-01-04-96 : CAL ; Integration MINSK portage WNT
-22-04-96 : FMN ; Suppression prototype inutile.
-25-06-96 : FMN ; Suppression utilisation de glScissor.
-02-07-96 : FMN ; Modification parametre glViewport.
-21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
-04-02-97 : FMN ; Suppression call_togl_ps, call_togl_xwd ...
-02-04-97 : FMN ; Correction call_tox_rect, on repasse en GL_BACK a la fin.call_tox_rect
-05-01-98 : FMN ; Suppression WNT inutile
-Suppression call_tox_set_colormap_mapping()
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <string.h>
-#include <stdio.h>
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <GL/gl.h>
-#ifndef WNT
-# include <GL/glx.h>
-#else
-# include <InterfaceGraphic_WNT.hxx>
-#endif /* WNT */
-
-#include <InterfaceGraphic_Aspect.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_tgl_tox.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_tgl_elems.hxx>
-#include <OpenGl_tgl_funcs.hxx>
-
-/*static GLboolean lighting_mode;*/
-extern DISPLAY *call_thedisplay;
-#ifndef WNT
-/*static GC gcx;*/
-#endif /* WNT */
-/*static int ft=1;*/
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define XTRACE
-
-#define CALL_DEF_BUFFER_SIZE 1024
-#define CALL_DEF_STRING_LENGTH 132
-
-/*----------------------------------------------------------------------*/
-EXPORT void call_togl_build_matrix (
- CALL_DEF_VIEW * aview,
- CALL_DEF_MATRIX4X4 gl_ori_matrix, CALL_DEF_MATRIX4X4 gl_map_matrix,
- CALL_DEF_MATRIX4X4 eval_ori_matrix, CALL_DEF_MATRIX4X4 eval_map_matrix )
-{
- int i, j;
- for (i=0; i<3; i++)
- for (j=0; j<3; j++)
- if (i == j) {
- gl_ori_matrix[i][j] = ( float )1.0;
- gl_map_matrix[i][j] = ( float )1.0;
- eval_ori_matrix[i][j] = ( float )1.0;
- eval_map_matrix[i][j] = ( float )1.0;
- }
- else {
- gl_ori_matrix[i][j] = ( float )0.0;
- gl_map_matrix[i][j] = ( float )0.0;
- eval_ori_matrix[i][j] = ( float )0.0;
- eval_map_matrix[i][j] = ( float )0.0;
- }
-}
-
-/*----------------------------------------------------------------------*/
-EXPORT void call_togl_element_type (
- long Id,
- long elem_num,
- long *elem_type )
-{
-#ifdef PHIGS_VERSION
- Pint err_ind; /* OUT error indicator */
- Pint size; /* OUT element size */
- Pint type; /* OUT element type */
- Pint cur_index; /* OUT element pointer value */
-
- type = 0;
- call_func_open_struct (Id);
- call_func_set_elem_ptr (elem_num);
- call_func_inq_elem_ptr (&err_ind, &cur_index);
- /* it is not the end */
- if ((elem_num==cur_index) && (! err_ind)) {
- call_func_inq_cur_elem_type_size
- (&err_ind, &type, &size);
- if (err_ind) type = 0;
- }
- call_func_close_struct ();
-
- switch (type)
- {
- case CALL_PHIGS_ELEM_POLYLINE3 :
- case CALL_PHIGS_ELEM_POLYLINE :
- case CALL_PHIGS_ELEM_POLYLINE_SET3_DATA :
- *elem_type = 1;
- break;
-
- case CALL_PHIGS_ELEM_FILL_AREA3 :
- case CALL_PHIGS_ELEM_FILL_AREA :
- case CALL_PHIGS_ELEM_FILL_AREA_SET3 :
- case CALL_PHIGS_ELEM_FILL_AREA_SET :
- case CALL_PHIGS_ELEM_FILL_AREA_SET3_DATA :
- case CALL_PHIGS_ELEM_SET_OF_FILL_AREA_SET3_DATA :
- *elem_type = 2;
- break;
-
- case CALL_PHIGS_ELEM_TRI_STRIP3_DATA :
- *elem_type = 3;
- break;
-
- case CALL_PHIGS_ELEM_QUAD_MESH3_DATA :
- *elem_type = 4;
- break;
-
- case CALL_PHIGS_ELEM_TEXT3 :
- case CALL_PHIGS_ELEM_TEXT :
- case CALL_PHIGS_ELEM_ANNO_TEXT_REL3 :
- case CALL_PHIGS_ELEM_ANNO_TEXT_REL :
- *elem_type = 5;
- break;
-
- case CALL_PHIGS_ELEM_POLYMARKER3 :
- case CALL_PHIGS_ELEM_POLYMARKER :
- *elem_type = 6;
- break;
-
- default :
- *elem_type = 0;
- break;
- }
-#endif
- TelType type;
- Tint cur_index;
- Tint err_ind=0;
- Tint size;
-
- type = TelNil;
-
- call_func_open_struct (Id);
- call_func_set_elem_ptr (elem_num);
- if( TsmGetCurElemPtr( &cur_index ) == TFailure )
- err_ind = 1;
- /* it is not the end */
- if ((elem_num==cur_index) && (! err_ind))
- TelInqCurElemTypeSize( &type, &size );
- call_func_close_struct ();
-
- switch (type)
- {
- case CALL_PHIGS_ELEM_POLYLINE_SET3_DATA :
- *elem_type = 1;
- break;
-
- case CALL_PHIGS_ELEM_FILL_AREA3 :
- case CALL_PHIGS_ELEM_FILL_AREA_SET3 :
- *elem_type = 2;
- break;
-
- case CALL_PHIGS_ELEM_TRI_STRIP3_DATA :
- *elem_type = 3;
- break;
-
- case CALL_PHIGS_ELEM_QUAD_MESH3_DATA :
- *elem_type = 4;
- break;
-
- case CALL_PHIGS_ELEM_ANNO_TEXT_REL3 :
-
- *elem_type = 5;
- break;
-
- case CALL_PHIGS_ELEM_POLYMARKER3 :
- *elem_type = 6;
- break;
-
- default :
- *elem_type = 0;
- break;
- }
- *elem_type = 0;
-}
-
-/*----------------------------------------------------------------------*/
-EXPORT int call_togl_inquiremat (
- CALL_DEF_VIEW * aview,
- CALL_DEF_MATRIX4X4 ori_matrix,
- CALL_DEF_MATRIX4X4 map_matrix )
-{
- TEL_VIEW_REP rep;
- int i, j, error;
- view_map3 map;
-
- TelGetViewRepresentation( aview->WsId, aview->ViewId, &rep );
- if(aview->Orientation.IsCustomMatrix) {
- /* OCC18942: Trying to return the current matrices instead of calculating them anew.
- This in particular allows using application-defined matrices. */
- } else {
- memcpy( &map.win, &rep.extra.map.window, sizeof( Tlimit ) );
- memcpy( &map.proj_vp, &rep.extra.map.viewport, sizeof( Tlimit3 ) );
- switch(rep.extra.map.proj){
- default:
- case TelParallel : map.proj_type = TYPE_PARAL; break;
- case TelPerspective : map.proj_type = TYPE_PERSPECT; break;
- }
- map.proj_ref_point.x = rep.extra.map.prp[0];
- map.proj_ref_point.y = rep.extra.map.prp[1];
- map.proj_ref_point.z = rep.extra.map.prp[2];
- map.view_plane = rep.extra.map.vpd;
- map.back_plane = rep.extra.map.bpd;
- map.front_plane = rep.extra.map.fpd;
-
- call_func_eval_ori_matrix3( (point3 *)rep.extra.vrp,
- (vec3 *)rep.extra.vpn,
- (vec3 *)rep.extra.vup,
- &error, rep.orientation_matrix );
- if( error )
- return 1;
-
- call_func_eval_map_matrix3( &map, &error, rep.mapping_matrix );
-
- if( error )
- return 1;
- }
- for( i = 0; i < 4; i++ )
- for( j = 0; j < 4; j++ )
- {
- ori_matrix[i][j] = rep.orientation_matrix[j][i];
- map_matrix[i][j] = rep.mapping_matrix[j][i];
- }
-
- return 0;
-}
-
-/*----------------------------------------------------------------------*/
-int call_tox_window_exists ( WINDOW w )
-{
- return (1);
-}
-
-/*----------------------------------------------------------------------*/
-extern void
-call_tox_rect( int wsid, WINDOW win, int u, int v )
-{
-#define STEP 2.0
- Tint w, h;
- CMN_KEY_DATA k;
- float p[3];
- float r[3] = { ( float )0.0, ( float )1.0, ( float )1.0 };
-
- TsmGetWSAttri( wsid, WSWidth, &k );
- w = k.ldata;
- TsmGetWSAttri( wsid, WSHeight, &k );
- h = k.ldata;
-
- TxglWinset( call_thedisplay, win );
- glViewport( 0, 0, w, h);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho( 0.0, ( GLdouble ) w, 0.0, ( GLdouble ) h, -100000.0, 100000.0 );
-
- p[0] = ( float )(u-STEP);
- p[1] = ( float )(v-STEP);
- p[2] = ( float )(-9999.0);
- glDrawBuffer(GL_FRONT) ;
- glColor3fv( r );
- glBegin(GL_QUADS);
- glVertex3fv( p );
- p[0] = ( float )(u+STEP);
- glVertex3fv( p );
- p[1] = ( float )(v+STEP);
- glVertex3fv( p );
- p[0] = ( float )(u-STEP);
- glVertex3fv( p );
- glEnd();
-
- TelFlush(0);
-
- glDrawBuffer(GL_BACK) ;
-}
-
-/*----------------------------------------------------------------------*/
-
-#if !defined(GLU_VERSION_1_2)
-void gluTessBeginContour() {
- printf(" UNIMPLEMENTED function gluTessBeginContour()\n");
-}
-void gluTessBeginPolygon() {
- printf(" UNIMPLEMENTED function gluTessBeginPolygon()\n");
-}
-void gluTessEndPolygon() {
- printf(" UNIMPLEMENTED function gluTessEndPolygon()\n");
-}
-void gluTessEndContour() {
- printf(" UNIMPLEMENTED function gluTessEndContour()\n");
-}
-#endif
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/*
-// File: OpenGl_userdraw.c
-// Created: Thu Mar 3 12:34:02 2005
-// Author: Sergey ZERTCHANINOV
-// <sergey.zertchaninov@opencascade.com>
-// Copyright: Open CASCADE 2005
-*/
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_callback.hxx>
-
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- 0, /* UserdrawPick, */
- 0, /* UserdrawDisplay, */
- 0, /* UserdrawAdd, */
- 0, /* UserdrawDelete, */
- 0, /* UserdrawPrint, */
- 0, /* UserdrawInquire */
-};
-
-MtblPtr TelUserdrawInitClass( TelType* el )
-{
- *el = TelUserdraw;
- return MtdTbl;
-}
-
-MtblPtr GetCallbackTable ()
-{
- return MtdTbl;
-}
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_view :
-
-
-REMARQUES:
-----------
-
-An implementation of the PHIGS viewing pipeline
-
-This module provides services for setting view representations and view
-indices, viewport management, coordinate conversion routines and help
-functions.
-
-The corresponding header file is telem_view.h
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-11-03-96 : FMN ; Correction warning compilation
-20-03-96 : CAL ; Modif de TelClearViews
-appel a call_tox_getscreen pour effacer tout
-meme apres un resize
-01-04-96 : CAL ; Integration MINSK portage WNT
-22-04-96 : FMN ; Suppression prototype inutile.
-25-06-96 : FMN ; Suppression utilisation de glScissor.
-28-06-96 : CAL ; Simplification de TelClearViews
-02-07-96 : FMN ; Suppression WSWSHeight et WSWSWidth
-Suppression de TelSetWSWindow
-Suppression glViewport inutile
-03-07-96 : FMN ; A une workstation correspond une vue.
-12-07-96 : FMN ; Correction calcul matrice orientatione.
-17-07-96 : FMN ; Ajout clear pour le zbuffer.
-21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
-24-01-97 : CAL ; Suppression code inutile (DEBUG_ONLY)
-30-06-97 : FMN ; Suppression OpenGl_telem_light.h
-27-08-97 : FMN ; Ajout glDepthMask avant le clear (PRO8939)
-09-12-97 : FMN ; Prise en compte environnement mapping.
-03-03-98 : FMN ; Suppression variable externe TglWhetherPerspective
-13-03-98 : FMN ; Suppression variable WSNeedsClear
-10-04-98 : CAL ; Suppression du calcul de inverse_matrix
-30-04-98 : FMN ; Suppression variable externe TglUpdateView0
-24-11-98 : FMN ; PRO16215: Suppression test sur le GL_MAX_CLIP_PLANES
-Si OpenGL n'a pas de plans de clipping on ne le simule pas.
-24-11-98 : FMN ; Correction sur la gestion de la perspective (cf Programming Guide)
-- Suppression du test (prp between front and back planes)
-- Suppression matrice perspective (modify the next two cells to change clipping policy)
-Ces modifs sont necessaires pour pouvoir mettre le prp entre le Front et Back plane
-
-************************************************************************/
-
-#define BUC60920 /* GG 010601
-Change the z buffer comparaison for minimizing
-unavailable or unviewable drawing of pixels in the same plane
-*/
-
-#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
-from higher API */
-
-#define OCC1188 /* SAV 23/12/02 TelClearBackground() draws background texture
-if any was defined
-*/
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_util.hxx>
-#include <OpenGl_telem_attri.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_txgl.hxx>
-#include <OpenGl_Memory.hxx>
-#include <Standard_TypeDef.hxx>
-#include <OpenGl_PrinterContext.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Variable globales
-*/
-
-EXPORT extern GLboolean env_walkthrow; /* definit dans OpenGl_togl_begin.c */
-/* OCC18942: The new perspective projection matrix is off by default */
-EXPORT extern GLboolean env_sym_perspective; /* defined in OpenGl_togl_begin.c */
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define NO_TRACE_MAT
-#define NO_TRACE_MATRIX
-#define NO_PRINT
-
-#define ENVTEX
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Prototypes
-*/
-
-#ifdef DEB
-static void pr_matrix( Tmatrix3 );
-#endif
-
-
-/*----------------------------------------------------------------------*/
-/*
-* Type definitions
-*/
-
-struct TEL_VIEW_DATA
-{
- TEL_VIEW_REP vrep;
-#ifdef CAL_100498
- Tmatrix3 inverse_matrix;/* accelerates UVN2XYZ conversion */
-#endif
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef TEL_VIEW_DATA *tel_view_data; /* Internal data stored for every view rep */
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-static void set_clipplanes( tel_view_rep ); /* front & back clip planes */
-static void set_userclipplanes( tel_view_rep ); /* user-defined clipping planes */
-
-#ifdef CAL_100498
-static void TelEvalInverseMatrix( Tfloat*, Tfloat*, Tfloat*, /*vrp,vpn,vup*/
- Tfloat, Tmatrix3 ); /*vpd,inverse*/
-#endif
-static Tmatrix3 ident = {
- { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 }
-};
-
-/*----------------------------------------------------------------------*/
-/*+
-Qsearch number comparison routine
-
-Compares view ids during sorting of the list of defined views
-for a workstation
-+*/
-
-/*----------------------------------------------------------------------*/
-/*+
-Evaluate View Mapping Matrix
-
-This routine computes the mapping matrix based on the Window and Viewport
-limits, Projection type and View plane, Front plane and Back plane
-distances.
-+*/
-
-static void
-EvalViewMappingMatrix( tel_view_mapping mapping /* View Mapping */,
- Tint *error_ind /* Out: Error Indicator */,
- Tmatrix3 mat /* Out: Mapping Matrix * */,
- Tint flag,
- Tfloat cx,
- Tfloat cy,
- Tint clip_flag,
- Tlimit3 *clip_limit
- )
-{
- Tfloat gx, gy, xsf, ysf, zsf;
- Tfloat fpd, bpd;
-
- /* OCC18942 */
- Tfloat n, f, r, l, t, b, Zprp, dx, dy, VPD;
-
- /* FSXXX */
- /* GLint gdtmp; */
- Tlimit3 vp = { ( float )-1.0, ( float )1.0, ( float )-1.0, ( float )1.0, ( float )1.0, ( float )-1.0 };
- Tmatrix3 pmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
- Tmatrix3 mmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 },
- { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } };
-
- fpd = mapping->fpd;
- bpd = mapping->bpd;
-
- /* invalid window */
- if( mapping->window.xmin >= mapping->window.xmax ||
- mapping->window.ymin >= mapping->window.ymax )
- {
- *error_ind = 1;
- return;
- }
-
- /* invalid viewport */
- if( mapping->viewport.xmin >= mapping->viewport.xmax ||
- mapping->viewport.ymin >= mapping->viewport.ymax ||
- mapping->viewport.zmin >= mapping->viewport.zmax )
- {
- *error_ind = 2;
- return;
- }
-
- /* invalid back/front plane distances */
- if( mapping->bpd >= mapping->fpd )
- {
- *error_ind = 3;
- return;
- }
-
- /* prp between front and back planes */
- if (!env_walkthrow)
- {
- if( mapping->prp[2] < mapping->fpd &&
- mapping->prp[2] > mapping->bpd )
- {
- *error_ind = 4;
- return;
- }
- }
-
- if( mapping->prp[2] == mapping->vpd )
- {
- *error_ind = 5; /* prp on view plane */
- return;
- }
-
- if( mapping->viewport.xmin < 0 ||
- mapping->viewport.xmax > 1 ||
- mapping->viewport.ymin < 0 ||
- mapping->viewport.ymax > 1 ||
- mapping->viewport.zmin < 0 ||
- mapping->viewport.zmax > 1 )
- {
- *error_ind = 6; /* viewport limits outside NPC space */
- return;
- }
-
- *error_ind = 0;
-
- /* OCC18942: Moved here while debugging perspective projection matrix */
- /* centers */
- if( flag == 0 )
- {
- cx = mapping->window.xmin + mapping->window.xmax, cx /= ( float )2.0;
- cy = mapping->window.ymin + mapping->window.ymax, cy /= ( float )2.0;
- }
-
- gx = (cx - mapping->prp[0]) / (mapping->vpd - mapping->prp[2]);
- gy = (cy - mapping->prp[1]) / (mapping->vpd - mapping->prp[2]);
-
-#ifdef PRINT
- printf("EvalViewMappingMatrix \n");
- printf("prp %f %f %f \n", mapping->prp[0], mapping->prp[1], mapping->prp[2]);
- printf("vpd fpd bpd %f %f %f \n", mapping->vpd, mapping->fpd, mapping->bpd);
- printf("window limit %f %f %f %f\n", mapping->window.xmin, mapping->window.xmax,
- mapping->window.ymin, mapping->window.ymax);
- printf("viewport limit %f %f %f %f\n", mapping->viewport.xmin, mapping->viewport.xmax,
- mapping->viewport.ymin, mapping->viewport.ymax);
-#endif
-
- /* projection matrix */
- if( mapping->proj == TelParallel )
- {
-
- pmat[2][0] = -gx; pmat[3][0] = mapping->vpd*gx;
- pmat[2][1] = -gy; pmat[3][1] = mapping->vpd*gy;
- }
- else if ( !env_sym_perspective )/* TelPerspective */
- {
- pmat[0][0] = pmat[1][1] = mapping->prp[2] - mapping->vpd;
- pmat[2][0] = -gx;
- pmat[2][1] = -gy;
- pmat[2][3] = ( float )-1.0;
- pmat[3][0] = mapping->vpd * gx;
- pmat[3][1] = mapping->vpd * gy;
- pmat[3][3] = mapping->prp[2];
-
- /* modify the next two cells to change clipping policy */
- if (!env_walkthrow)
- {
- pmat[2][2] = mapping->prp[2] - ( fpd + bpd );
- pmat[3][2] = fpd * bpd;
- }
- }
- /* OCC18942: New approach to calculation of mapping (projection) matrix */
- else
- {
- dx = mapping->window.xmax - mapping->window.xmin;
- dy = mapping->window.ymax - mapping->window.ymin;
- Zprp = mapping->prp[2];
- VPD = Zprp - mapping->vpd;
-
- /*
- Calculate canonical perspective projection parameters as if we were about
- to use glFrustum() to create symmetric perspective frustum.
-
- After the view orientation matrix is applied, the coordinate system origin is located
- at the VRP and oriented properly. However, the viewplane has width = dx and height = dy
- and its center (cx, cy, VPD) is not always located at the view Z axis.
- The canonical perspective projection matrix assumes the eye is located at (0, 0, 0).
- Thus the old approach resulted in a non-symmetric perspective,
- as X and Y coordinates of the projection reference point (PRP) were not updated
- when cx and cy changed. Moreover, such "static" perspective had some other disadvantages,
- such as non-realistic panning, i.e. instead of moving the eye (or camera) over the model
- a sort of "frame" moved over the static perspective projection picture,
- exposing a part of this static picture to the user.
-
- In order to make the perspective symmetric, we need to translate
- the coordinate system to PRP before projection.
- Thus we translate X, Y and Z co-ordinates by -cx, -cy and -Zprp respectively.
-
- NOTE: mat[i][j] means j-th element of i-th column, as OpenGL accepts the matrices
- in column-major order, while in C two-dimensional arrays are stored in memory
- in row-major order!
-
- VPD is used below instead of near clipping plane dispance (n) in order to simplify
- calculation of l and r values. If we did not use VPD in the matrix calculation, we would have to
- project 0.5 * dx, -0.5 * dx, 0.5 * dy and - 0.5 * dy onto the near clipping plane
- to calculate these values.
-
- Pending issues:
- 1. It is still necessary to find a way to calculate the perspective projection matrix
- for TPM_WALKTHROUGH projection model. This projection model is not supported yet
- by the new code.
- */
- r = .5f * dx;
- l = -r;
- t = .5f * dy;
- b = -t;
- n = Zprp - fpd; f = Zprp - bpd;
-
- mat[0][0] = 2.f * VPD / (r - l);
- mat[1][1] = 2.f * VPD / (t - b);
- mat[2][0] = (r + l) / (r - l);
- mat[2][1] = (t + b) / (t - b);
- mat[2][2] = - (f + n) / (f - n);
- mat[2][3] = -1.f;
- /*
- The last column takes into account translation along X, Y and Z axis
- before projecting. This can be considered as a result of right-multiplying the canonical
- perspective projection matrix P by a translation matrix T
- (it differs form the canonical matrix by the last column only):
- | 1 0 0 -cx |
- | 0 1 0 -cy |
- mat = P * T, where T = | 0 0 1 -Zprp |
- | 0 0 0 1 |
- */
- mat[3][0] = -mat[2][0] * Zprp - mat[0][0] * cx;
- mat[3][1] = -mat[2][1] * Zprp - mat[1][1] * cy;
- mat[3][2] = -2.f * f * n / (f - n) - mat[2][2] * Zprp;
- mat[3][3] = Zprp;
-
-#ifdef PRINT
- printf("r l t b n f: %f %f %f %f %f %f \n", r,l,t,b,n,f);
- printf( "mapping_matrix (new code):\n" );
- pr_matrix(mat);
-#endif
-
- /* return here, as further calculations are related to the old approach */
- return;
- }
-
- /* scale factors */
- xsf = (vp.xmax - vp.xmin) / (mapping->window.xmax - mapping->window.xmin);
- ysf = (vp.ymax - vp.ymin) / (mapping->window.ymax - mapping->window.ymin);
- zsf = (vp.zmax - vp.zmin) / (fpd - bpd);
-
- /* map matrix */
- mmat[0][0] = xsf, mmat[1][1] = ysf, mmat[2][2] = zsf;
- mmat[3][0] = vp.xmin - xsf*mapping->window.xmin;
- mmat[3][1] = vp.ymin - ysf*mapping->window.ymin;
- mmat[3][2] = vp.zmin - zsf*bpd;
-
- /* multiply to obtain mapping matrix */
- TelMultiplymat3( mat, pmat, mmat );
-
-#ifdef PRINT
- printf( "mapping_matrix :\n" );
- pr_matrix(mat);
-#endif
-}
-
-/*----------------------------------------------------------------------*/
-/*+
-Set View Representation
-
-This routine defines a view representation for a workstation.
-
-The representation of the view is stored in a storage table.
-An entry is made into the list of defined views for the workstation.
-If the view id being defined already exists, its representation gets
-modified, else a new representation is created.
-An inverse transformation matrix is computed and stored in the internal
-data for the view to accelerate UVN2XYZ conversions. To be able to compute
-this matrix, it requires some extra information about the view orientation,
-view plane distance and viewport limits.
-+*/
-
-TStatus
-TelSetViewRepresentation( Tint Wsid /* Workstation id*/,
- Tint Vid /* View id */,
- tel_view_rep vrep /* view repesentation */
- )
-{
- CMN_KEY_DATA key;
- tel_view_data vptr;
-
- if( Vid == 0 )
- return TFailure; /* attempt to modify default view */
-
- /* Mise a jour de l'update_mode */
- key.ldata = TNotDone;
- TsmSetWSAttri( Wsid, WSUpdateState, &key );
-
- TsmGetWSAttri( Wsid, WSViews, &key );
- vptr = (tel_view_data)(key.pdata) ; /* Obtain defined view data*/
-
- if( !vptr ) /* no view defined yet */
- { /* allocate */
- //cmn_memreserve(vptr, 1, 0 );
- vptr = new TEL_VIEW_DATA();
- if( !vptr ) return TFailure;
-
- key.pdata = vptr;
- TsmSetWSAttri( Wsid, WSViews, &key ); /* Set defined view data*/
- }
-
- /* copy view definition to storage table record */
- /* NOTE: Use the matrices already calculated and stored in vrep */
- vptr->vrep = *vrep;
-
-#ifdef CAL_100498
- /* compute inverse transformation matrix */
- TelEvalInverseMatrix( vrep->extra.vrp, vrep->extra.vpn, vrep->extra.vup,
- vrep->extra.map.vpd, vptr->inverse_matrix );
-#endif
-#ifdef TRACE_MAT
- printf( "\nTelSetViewRepresentation WS : %d, view : %d\n", Wsid, Vid );
- printf( "orientation_matrix :\n" );
- pr_matrix( vptr->vrep.orientation_matrix );
- printf( "mapping_matrix :\n" );
- pr_matrix( vptr->vrep.mapping_matrix );
-#endif
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-TStatus
-TelGetViewRepresentation( Tint Wsid /* Workstation id*/,
- Tint Vid /* View id */,
- tel_view_rep vrep /* view representation */
- )
-{
- CMN_KEY_DATA key;
- tel_view_data vptr;
-
- if( Vid == 0 )
- {
- matcpy( vrep->orientation_matrix, ident );
- matcpy( vrep->mapping_matrix, ident );
- vrep->clip_limit.xmin = vrep->clip_limit.ymin =
- vrep->clip_limit.zmin = ( float )0.0;
- vrep->clip_limit.xmax = vrep->clip_limit.ymax =
- vrep->clip_limit.zmax = ( float )1.0;
- vrep->clip_xy = TOff;
- vrep->clip_back = vrep->clip_front = TOn;
- vrep->shield_indicator = TOn;
- vrep->shield_colour.rgb[0] = vrep->shield_colour.rgb[1] =
- vrep->shield_colour.rgb[2] = ( float )0.0;
- vrep->border_indicator = TOff; /* non utilise */
- vrep->border_colour.rgb[0] = vrep->border_colour.rgb[1] =
- vrep->border_colour.rgb[2] = ( float )0.0;
- vrep->active_status = TOn;
- vrep->extra.vrp[0] = vrep->extra.vrp[1] = vrep->extra.vrp[2] = ( float )0.0;
- vrep->extra.vpn[0] = ( float )0.0,
- vrep->extra.vpn[1] = ( float )0.0,
- vrep->extra.vpn[2] = ( float )1.0;
- vrep->extra.vup[0] = ( float )0.0,
- vrep->extra.vup[1] = ( float )1.0,
- vrep->extra.vup[2] = ( float )0.0;
- vrep->extra.map.vpd = ( float )0.0,
- vrep->extra.map.fpd = ( float )0.0,
- vrep->extra.map.bpd = ( float )-1.0;
- vrep->extra.map.window.xmin = vrep->extra.map.window.ymin = ( float )0.0;
- vrep->extra.map.window.xmax = vrep->extra.map.window.ymax = ( float )1.0;
- vrep->extra.map.viewport.xmin = vrep->extra.map.viewport.ymin =
- vrep->extra.map.viewport.zmin = ( float )0.0;
- vrep->extra.map.viewport.xmax = vrep->extra.map.viewport.ymax =
- vrep->extra.map.viewport.zmax = ( float )1.0;
- vrep->clipping_planes.Clear();
- return TSuccess;
- }
-
- if(TsmGetWSAttri( Wsid, WSViews, &key ) != TSuccess) {
- return TFailure;
- }
- vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/
- if( !vptr ) return TFailure; /* no view defined yet */
- *vrep = vptr->vrep; /* copy view definition */
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-/*+
-Evaluate View Orientation Matrix
-
-This routine computes the orientation matrix based on the View Reference
-Point, View Plane Normal and the View Up Vector.
-+*/
-
-void
-TelEvalViewOrientationMatrix( Tfloat *vrp /* View Reference Point */,
- Tfloat *vpn /* View Plane Normal */,
- Tfloat *vup /* View Up Vector */,
- Tfloat *asf /* Axial Scale Factors */,
- Tint *error_ind/* Out: Error indicator */,
- Tmatrix3 rmat /* Out: Orientation Matrix */
- )
-{
- Tfloat u[3], v[3], n[3], f;
-
- /* view plane normal of zero length */
- if( vecmag(vpn) == 0.0 )
- {
- *error_ind = 1;
- return;
- }
-
- /* view up vector of zero length */
- if( vecmag(vup) == 0.0 )
- {
- *error_ind = 2;
- return;
- }
-
- /* view up vector parallel to view plane normal */
- vecang(vup, vpn, f);
- if( f == 0.0 )
- {
- *error_ind = 3;
- return;
- }
-
- *error_ind = 0;
-
- veccpy(n, vpn);
- veccpy(v, vup);
- vecnrm(n);
-
- veccrs(u,v,n); /* up vector cross plane normal gives U axis */
- vecnrm(u);
-
- veccrs(v,n,u); /* plane normal cross U axis gives modified up vector */
- vecnrm(v); /* redundant ? */
-
- /* rotate to align along u, v, n */
- rmat[0][0] = ( float )u[0] * asf[0],
- rmat[0][1] = ( float )v[0] * asf[0],
- rmat[0][2] = ( float )n[0] * asf[0],
- rmat[0][3] = ( float )0.0;
-
- rmat[1][0] = ( float )u[1] * asf[1],
- rmat[1][1] = ( float )v[1] * asf[1],
- rmat[1][2] = ( float )n[1] * asf[1],
- rmat[1][3] = ( float )0.0;
-
- rmat[2][0] = ( float )u[2] * asf[2],
- rmat[2][1] = ( float )v[2] * asf[2],
- rmat[2][2] = ( float )n[2] * asf[2],
- rmat[2][3] = ( float )0.0;
-
- /* translate to centre at vrp */
-
- rmat[3][0] = - ( float ) (u[0]*vrp[0] + u[1]*vrp[1] + u[2]*vrp[2]);
- rmat[3][1] = - ( float ) (v[0]*vrp[0] + v[1]*vrp[1] + v[2]*vrp[2]);
- rmat[3][2] = - ( float ) (n[0]*vrp[0] + n[1]*vrp[1] + n[2]*vrp[2]);
- rmat[3][3] = ( float )1.0;
-
-#ifdef PRINT
- printf("TelEvalViewOrientationMatrix \n");
- printf("view_ref_pt %f %f %f \n", vrp[0], vrp[1], vrp[2]);
- printf("view_up_vec %f %f %f \n", vup[0], vup[1], vup[2]);
- printf("view_plane_normal %f %f %f \n", vpn[0], vpn[1], vpn[2]);
- pr_matrix(rmat);
-#endif
-
- return;
-}
-/*----------------------------------------------------------------------*/
-
-void
-TelEvalViewMappingMatrix( tel_view_mapping mapping /* View Mapping */,
- Tint *error_ind /* Out: Error Indicator */,
- Tmatrix3 mat /* Out: Mapping Matrix */
- )
-{
- EvalViewMappingMatrix( mapping, error_ind, mat, 0, ( float )0.0, ( float )0.0, 0, 0 );
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-TelEvalViewMappingMatrixPick( tel_view_mapping mapping /* View Mapping */,
- Tint *error_ind /* Out: Error Indicator */,
- Tmatrix3 mat /* Out: Mapping Matrix */,
- Tfloat cx,
- Tfloat cy
- )
-{
- EvalViewMappingMatrix( mapping, error_ind, mat, 1, cx, cy, 0, 0 );
-}
-
-/*----------------------------------------------------------------------*/
-/*+
-Evalute inverse transformation matrix.
-
-This routine computes a matrix required to convert UVN coordinates to XYZ
-coordinates. It is called every time a View Representation is created or
-modified, and the inverse matrix is stored along with the internal data
-for the view representation.
-+*/
-
-#ifdef CAL_100498
-static void
-TelEvalInverseMatrix( Tfloat *vrp /* View Reference Point */,
- Tfloat *vpn /* View Plane Normal */,
- Tfloat *vup /* View Up Vector */,
- Tfloat vpd /* View Plane Distance */,
- Tmatrix3 mat /* Out: Inverse Transformation Matrix */
- )
-{
- Tfloat u[3], v[3], n[3], p[3], t[3];
- Tfloat dist = ( float )0.0;
-
- veccpy(n, vpn); /* compute UVN orientation */
- veccpy(v, vup);
- veccpy(p, vrp);
-
- veccrs(u,v,n);
- vecnrm(u);
-
- veccrs(v,n,u);
- vecnrm(v);
-
- dist = vpd;
- veccpy(t,n);
- vecscl(dist,t);
- vecadd(t,t,p); /* translation vector */
-
- veccpy(mat[0],u);
- veccpy(mat[1],v);
- veccpy(mat[2],n);
- veccpy(mat[3],t);
-
- mat[0][3] = mat[1][3] = mat[2][3] = ( float )0.0, mat[3][3] = ( float )1.0;
-
- return;
-}
-#endif
-
-#ifdef CAL_100498
-/*----------------------------------------------------------------------*/
-/*+
-Convert Coordinates utility routine
-
-This routine converts coordinates from UVN space to XYZ space and
-vice versa. For UVN2XYZ, the inverse transformation matrix is used and for
-XYZ2UVN, the orientation matrix is used.
-+*/
-
-TStatus
-TelConvertCoord( Tint Wsid /* Workstation id */,
- Tint Vid /* View id */,
- TelCoordType type /* Conversion type (UVN2XYZ or XYZ2UVN) */,
- Tfloat *uvn /* UVN coords if type is UVN2XYZ else Out */,
- Tfloat *xyz /* XYZ coords if type is XYZ2UVN else Out */
- )
-{
- CMN_KEY_DATA key;
- tel_view_data vptr;
- register Tint i;
-
- Tfloat pt[4], tpt[4];
-
- if( Vid == 0 )
- { /* default view */
- switch( type )
- {
- case UVN2XYZ:
- veccpy(xyz,uvn);
- break;
- case XYZ2UVN:
- veccpy(uvn,xyz);
- break;
- }
- return TSuccess;
- }
-
- TsmGetWSAttri( Wsid, WSViews, &key );
- vptr = key.pdata ; /* Obtain defined view data*/
- if( !vptr ) return TFailure; /* no view defined yet */
-
- switch( type )
- {
- case UVN2XYZ:
- veccpy(pt,uvn);
- pt[3] = ( float )1.0;
- TelTranpt3( tpt, pt, vptr->inverse_matrix );
- veccpy(xyz,tpt);
- break;
-
- case XYZ2UVN:
- veccpy(pt,xyz);
- pt[3] = ( float )1.0;
- TelTranpt3( tpt, pt, vptr->vrep.orientation_matrix );
- veccpy(uvn,tpt);
- break;
- }
-
- return TSuccess;
-}
-#endif
-
-/*----------------------------------------------------------------------*/
-/*+
-Print Matrix
-
-Debug tool
-+*/
-
-#ifdef DEB
-void
-pr_matrix( Tmatrix3 mat )
-{
- printf( "%f %f %f %f\n", mat[0][0], mat[0][1], mat[0][2], mat[0][3] );
- printf( "%f %f %f %f\n", mat[1][0], mat[1][1], mat[1][2], mat[1][3] );
- printf( "%f %f %f %f\n", mat[2][0], mat[2][1], mat[2][2], mat[2][3] );
- printf( "%f %f %f %f\n", mat[3][0], mat[3][1], mat[3][2], mat[3][3] );
- printf( "\n" );
- return;
-}
-#endif
-
-/*----------------------------------------------------------------------*/
-/*+
-Set View Index
-
-This routine activates the view representation which has been defined
-previously.
-+*/
-
-TStatus
-TelSetViewIndex( Tint Wsid /* Workstation id */,
- Tint Vid /* View id */ )
-{
- CMN_KEY_DATA key;
- tel_view_data vptr;
-
- if( Vid == 0 )
- { /* default view */
- GLint mm;
- glGetIntegerv(GL_MATRIX_MODE, &mm);
-#ifdef TRACE_MATRIX
- printf("OpenGl_view.c::TelSetViewIndex::glMatrixMode(GL_PROJECTION) \n");
-#endif
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho( -0.5, 0.5, -0.5, 0.5, -0.5, 0.5 );
- glMatrixMode(mm);
- return TSuccess;
- }
-
- TsmGetWSAttri( Wsid, WSViews, &key );
- vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/
- if( !vptr ) return TFailure; /* no view defined yet */
-
-
-#ifdef TRACE_MATRIX
- printf("OpenGl_view.c::TelSetViewIndex::glMatrixMode(GL_MODELVIEW) \n");
-#endif
- if(vptr->vrep.extra.scaleFactors[0] != 1. ||
- vptr->vrep.extra.scaleFactors[1] != 1. ||
- vptr->vrep.extra.scaleFactors[2] != 1.)
- glEnable(GL_NORMALIZE); /* if the view is scaled normal vectors are scaled to unit length for correct displaying of shaded objects*/
- else if(glIsEnabled(GL_NORMALIZE))
- glDisable(GL_NORMALIZE);
- glMatrixMode(GL_MODELVIEW);
- set_clipplanes( &(vptr->vrep) );
-
-
- glLoadMatrixf((GLfloat *) vptr->vrep.orientation_matrix );
- set_userclipplanes( &(vptr->vrep) ); /* set clipping planes defined by user */
-
-#ifdef ENVTEX
- /*
- * Ajout translation necessaire pour l'environnement mapping
- */
- {
- GLfloat dep;
-
- TsmGetWSAttri(Wsid, WSSurfaceDetail, &key);
- /* TOD_ENVIRONMENT ou TOD_ALL */
- if (key.ldata == 1 || key.ldata == 2)
- {
- /* dep = vptr->vrep.extra.map.fpd * 0.5F; */
- dep = (vptr->vrep.extra.map.fpd + vptr->vrep.extra.map.bpd) * 0.5F; /* OCC280: FitAll work incorrect for perspective view if the SurfaceDetail mode is V3d_TEX_ENVIRONMENT or V3d_TEX_ALL */
- glTranslatef(-dep*vptr->vrep.extra.vpn[0],
- -dep*vptr->vrep.extra.vpn[1],
- -dep*vptr->vrep.extra.vpn[2]);
-#ifdef PRINT
- printf("glTranslatef: %f %f %f \n",
- -dep*vptr->vrep.extra.vpn[0],
- -dep*vptr->vrep.extra.vpn[1],
- -dep*vptr->vrep.extra.vpn[2]);
-#endif
- }
- }
-#endif
-
-#ifdef TRACE_MATRIX
- printf("OpenGl_view.c::TelSetViewIndex::glMatrixMode(GL_PROJECTION) \n");
-#endif
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
-#ifdef WNT
- // add printing scale/tiling transformation
- OpenGl_PrinterContext* aPrinterContext =
- OpenGl_PrinterContext::GetPrinterContext(GET_GL_CONTEXT());
-
- if (aPrinterContext)
- {
- GLfloat aProjMatrix[16];
- aPrinterContext->GetProjTransformation(aProjMatrix);
- glLoadMatrixf((GLfloat*) aProjMatrix);
- }
-#endif
-
- glMultMatrixf((GLfloat *) vptr->vrep.mapping_matrix );
-
-#ifdef TRACE_MAT
- printf( "\nTelSetViewIndex WS : %d, view : %d", Wsid, Vid );
- printf( "orientation_matrix :\n" );
- pr_matrix( vptr->vrep.orientation_matrix );
- printf( "mapping_matrix :\n" );
- pr_matrix( vptr->vrep.mapping_matrix );
-#endif
-
- return vptr->vrep.active_status == TOn ? TSuccess : TFailure;
-}
-
-
-/*----------------------------------------------------------------------*/
-/*+
-Set View Projection
-
-This routine activates the Projection matrix for a previously defined
-view representation. It is meant to be used exclusively to restore the
-Projection transformation at the end of an ExecuteStructure element
-traversal. The restoration of the Viewing matrix is done by a GL popmatrix
-call.
-+*/
-
-TStatus
-TelSetViewProjection( Tint Wsid /* Workstation id */,
- Tint Vid /* View id */ )
-{
- CMN_KEY_DATA key;
- tel_view_data vptr;
-
- if( Vid == 0 )
- { /* default view */
- GLint mm;
- glGetIntegerv(GL_MATRIX_MODE, &mm);
-#ifdef TRACE_MATRIX
- printf("OpenGl_view.c::TelSetViewProjection::glMatrixMode(GL_PROJECTION) \n");
-#endif
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho( 0, 1, 0, 1, 0, 1 );
- glMatrixMode(mm);
-
-
- return TSuccess;
- }
-
- TsmGetWSAttri( Wsid, WSViews, &key );
- vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/
- if( !vptr ) return TFailure; /* no view defined yet */
-
- set_clipplanes( &(vptr->vrep) );
- set_userclipplanes( &(vptr->vrep) );
-
-#ifdef TRACE_MATRIX
- printf("OpenGl_view.c::TelSetViewProjection::glMatrixMode(GL_PROJECTION) \n");
-#endif
- glMatrixMode(GL_PROJECTION);
- glLoadMatrixf((GLfloat *) vptr->vrep.mapping_matrix );
-
- return vptr->vrep.active_status == TOn ? TSuccess : TFailure;
-}
-
-/*----------------------------------------------------------------------*/
-/*+
-Clear all active views in a workstation
-
-This routine clears all the viewports, draws the viewport borders and
-sets the viewport background if the corresponding indicators are on.
-It also clears view 0 (default view), if the workstation state demands it.
-+*/
-
-void
-TelClearViews( Tint Wsid /* Workstation id */ )
-{
- CMN_KEY_DATA key;
- tel_view_data vptr;
-
- TelResetMaterial();
-
- TsmGetWSAttri( Wsid, WSViews, &key );
- vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/
- if( !vptr ) return; /* no view defined yet */
-
- if( vptr->vrep.active_status == TOn ) /* for each active view only */
- {
- if( vptr->vrep.shield_indicator == TOn ) TelClearBackground( Wsid );
- }
-
- return;
-}
-
-/*----------------------------------------------------------------------*/
-/* Function for printing view information */
-
-TStatus
-TelPrintViewRepresentation( Tint Wsid /* Workstation id*/,
- Tint Vid /* View id */
- )
-{
- CMN_KEY_DATA key;
- tel_view_data vptr;
-
- printf( "\n\tPrint : Workstation %d View %d", Wsid, Vid );
-
- if( Vid == 0 )
- return TSuccess;
-
- TsmGetWSAttri( Wsid, WSViews, &key );
- vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/
- if( !vptr ) return TFailure; /* no view defined yet */
-
- /* Print the information */
- printf( "\n\tshield indicator : %s",
- vptr->vrep.shield_indicator == TOn ? "ON" : "OFF" );
- printf( "\n\tshield_colour r = %f, g = %f, b = %f",
- vptr->vrep.shield_colour.rgb[0],
- vptr->vrep.shield_colour.rgb[1],
- vptr->vrep.shield_colour.rgb[2] );
- printf( "\n\tactive_status : %s",
- vptr->vrep.active_status == TOn ? "ON":"OFF");
- printf( "\n\tVRP : %f %f %f", vptr->vrep.extra.vrp[0],
- vptr->vrep.extra.vrp[1],
- vptr->vrep.extra.vrp[2] );
- printf( "\n\tVPN : %f %f %f", vptr->vrep.extra.vpn[0],
- vptr->vrep.extra.vpn[1],
- vptr->vrep.extra.vpn[2] );
- printf( "\n\tVUP : %f %f %f", vptr->vrep.extra.vup[0],
- vptr->vrep.extra.vup[1],
- vptr->vrep.extra.vup[2] );
- printf( "\n\tPRP : %f %f %f", vptr->vrep.extra.map.prp[0],
- vptr->vrep.extra.map.prp[1],
- vptr->vrep.extra.map.prp[2] );
- printf( "\n\tWindow Limits xmin xmax ymin ymax :\n\t\t%f %f %f %f",
- vptr->vrep.extra.map.window.xmin,
- vptr->vrep.extra.map.window.xmax,
- vptr->vrep.extra.map.window.ymin,
- vptr->vrep.extra.map.window.ymax );
- printf( "\n\tViewport Limits xmin xmax ymin ymax zmin zmax :\n\t\t%f %f %f %f %f %f", vptr->vrep.extra.map.viewport.xmin,
- vptr->vrep.extra.map.viewport.xmax,
- vptr->vrep.extra.map.viewport.ymin,
- vptr->vrep.extra.map.viewport.ymax,
- vptr->vrep.extra.map.viewport.zmin,
- vptr->vrep.extra.map.viewport.zmax );
- printf( "\n\tProjection type : %s",
- vptr->vrep.extra.map.proj == TelParallel
- ? "PARALLEL" : "PERSPECTIVE" );
- printf( "\n\tVPD FPD BPD : %f %f %f\n", vptr->vrep.extra.map.vpd,
- vptr->vrep.extra.map.fpd,
- vptr->vrep.extra.map.bpd );
- return TSuccess;
-}
-
-
-/*----------------------------------------------------------------------*/
-
-#define FRONT_CLIPPING_PLANE (GL_CLIP_PLANE0 + 0)
-#define BACK_CLIPPING_PLANE (GL_CLIP_PLANE0 + 1)
-/*
-
-While drawing after a clipplane has been defined and enabled, each vertex
-is transformed to eye-coordinates, where it is dotted with the transformed
-clipping plane equation. Eye-coordinate vertexes whose dot product with
-the transformed clipping plane equation is positive or zero are in, and
-require no clipping. Those eye-coordinate vertexes whose dot product is
-negative are clipped. Because clipplane clipping is done in eye-
-coordinates, changes to the projection matrix have no effect on its
-operation.
-
-A point and a normal are converted to a plane equation in the following
-manner:
-
-point = [Px,Py,Pz]
-
-normal = |Nx|
-|Ny|
-|Nz|
-
-plane equation = |A|
-|B|
-|C|
-|D|
-A = Nx
-B = Ny
-C = Nz
-D = -[Px,Py,Pz] dot |Nx|
-|Ny|
-|Nz|
-
-*/
-
-/*----------------------------------------------------------------------*/
-
-static void
-set_clipplanes( tel_view_rep vrep )
-{
- GLdouble arr[4];
- Tfloat front, back;
- GLfloat mat[4][4];
-#ifdef TRACE_MATRIX
- printf("OpenGl_view.c::set_clipplanes::glMatrixMode(GL_MODELVIEW) \n");
-#endif
- glMatrixMode( GL_MODELVIEW );
- glGetFloatv( GL_MODELVIEW_MATRIX,(GLfloat *) mat );
- glLoadIdentity();
-
- if( vrep->clip_limit.zmin < 0.0 ||
- vrep->clip_limit.zmin > 1.0 ||
- vrep->clip_back == TOff )
- glDisable( BACK_CLIPPING_PLANE );
- else
- {
- /* cf Opengl_togl_cliplimit */
- back = (vrep->extra.map.fpd - vrep->extra.map.bpd) *
- vrep->clip_limit.zmin + vrep->extra.map.bpd;
- arr[0] = 0.0; /* Nx */
- arr[1] = 0.0; /* Ny */
- arr[2] = 1.0; /* Nz */
- arr[3] = -( (GLdouble) (back) * arr[2] ); /* P dot N */
- glClipPlane( BACK_CLIPPING_PLANE, arr );
- glEnable( BACK_CLIPPING_PLANE );
- }
-
- if( vrep->clip_limit.zmax < 0.0 ||
- vrep->clip_limit.zmax > 1.0 ||
- vrep->clip_front == TOff )
- glDisable( FRONT_CLIPPING_PLANE );
- else
- {
- /* cf Opengl_togl_cliplimit */
- front = (vrep->extra.map.fpd - vrep->extra.map.bpd) *
- vrep->clip_limit.zmax + vrep->extra.map.bpd;
- arr[0] = 0.0; /* Nx */
- arr[1] = 0.0; /* Ny */
- arr[2] = -1.0; /* Nz */
- arr[3] = -( (GLdouble) (front) * arr[2] ); /* P dot N */
- glClipPlane( FRONT_CLIPPING_PLANE, arr );
- glEnable( FRONT_CLIPPING_PLANE );
- }
-
- glLoadMatrixf( (GLfloat *) mat );
-}
-
-static void
-set_userclipplanes( tel_view_rep vrep )
-{
- int j,planeid;
- CALL_DEF_PLANE* plane;
-
-#ifdef TRACE_MATRIX
- printf("OpenGl_view.c::set_userclipplanes::glMatrixMode(GL_MODELVIEW) \n");
-#endif
-
-
- NCollection_List<CALL_DEF_PLANE>::Iterator planeIter(vrep->clipping_planes);
-
- // go through all of planes in the list & preview them
- for( j=0 ; planeIter.More(); planeIter.Next(), j++ )
- {
- plane = const_cast<CALL_DEF_PLANE*>(&planeIter.Value());
-
- if( plane->PlaneId > 0 )
- {
- planeid = GL_CLIP_PLANE2 + j;
-
- if( plane->Active )
- {
- // Activates new clip planes
- GLdouble equation[4];
- equation[0] = plane->CoefA;
- equation[1] = plane->CoefB;
- equation[2] = plane->CoefC;
- equation[3] = plane->CoefD;
-
- glClipPlane( planeid , equation );
- if( !glIsEnabled( planeid ) ) glEnable( planeid );
- }
- else
- {
- if( glIsEnabled( planeid ) ) glDisable( planeid );
- }
- }
- } //for( ; planeIter.More(); planeIter.Next() )
-
- // Disable the remainder Clip planes
-
- for( j=vrep->clipping_planes.Size(); j < call_facilities_list.MaxPlanes; j++ )
- {
- planeid = GL_CLIP_PLANE2 + j;
-
- if( glIsEnabled( planeid ) )
- glDisable( planeid );
- }
-
-
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-Tel2Dto3D( Tint ws, Tint vid, Tint x, Tint y,
- Tfloat *x1, Tfloat *y1, Tfloat *z1,
- Tfloat *x2, Tfloat *y2, Tfloat *z2 )
- /* x is from bottom */
- /* y is from top */
-{
- CMN_KEY_DATA key;
- TEL_VIEW_REP vrep;
- Tint w, h;
- GLint viewp[4];
- GLdouble xx1, yy1, zz1, xx2, yy2, zz2;
-
- TsmGetWSAttri( ws, WSWidth, &key );
- w = key.ldata;
- TsmGetWSAttri( ws, WSHeight, &key );
- h = key.ldata;
- y = key.ldata - y;
-
- /* FSXXX */
- printf("WARNING: Tel2Dto3D non verifie\n");
-
- TelGetViewRepresentation( ws, vid, &vrep );
-
- viewp[0] = 0; viewp[2] = w;
- viewp[1] = 0; viewp[3] = h;
-
-
- /* OGLXXX XXX I think this is backwards */
- gluProject((GLdouble) x, (GLdouble) y, 0.0,
- (GLdouble *) vrep.orientation_matrix,
- (GLdouble *) vrep.mapping_matrix,
- viewp, &xx1, &yy1, &zz1);
- gluProject((GLdouble) x, (GLdouble) y, 1.0,
- (GLdouble *) vrep.orientation_matrix,
- (GLdouble *) vrep.mapping_matrix,
- viewp, &xx2, &yy2, &zz2);
-
- *x1 = (float) xx1; *y1 = (float) yy1; *z1 = (float) zz1;
- *x2 = (float) xx2; *y2 = (float) yy2; *z2 = (float) zz2;
-
- return TSuccess;
-
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TelDeleteViewsForWS( Tint wsid )
-{
- CMN_KEY_DATA key;
- tel_view_data vptr;
-
- TsmGetWSAttri( wsid, WSViews, &key );
- vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/
-
- if( !vptr ) return TSuccess;
- delete vptr;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-void
-TelClearBackground( Tint Wsid /* Workstation id */ )
-{
- CMN_KEY_DATA key;
- Tfloat *rgb;
- Tint zbuffer;
-#ifdef BUC61044
- Tint dTest;
-#endif
-#ifdef OCC1188
- tsm_bg_texture texture;
-#endif
- tsm_bg_gradient gradient;
-
- // Disable clipping planes
- GLint ii = 0, max_plane = 0;
- glGetIntegerv( GL_MAX_CLIP_PLANES, &max_plane );
- while (ii < max_plane) {
- const GLint planeid = GL_CLIP_PLANE0 + ii++;
- if (glIsEnabled(planeid));
- glDisable(planeid);
- }
-
- TsmGetWSAttri (Wsid, WSBackground, &key);
- rgb = (Tfloat *)key.pdata;
-
-#ifdef OCC1188
- TsmGetWSAttri (Wsid, WSBgTexture, &key);
- texture = (tsm_bg_texture)key.pdata;
-#endif
- TsmGetWSAttri (Wsid, WSZbuffer, &key);
- zbuffer = key.ldata;
-
- TsmGetWSAttri (Wsid, WSBgGradient, &key);
- gradient = (tsm_bg_gradient)key.pdata;
-
- /* GL_DITHER on/off pour le background */
- if (TxglGetBackDither ())
- glEnable (GL_DITHER);
- else
- glDisable (GL_DITHER);
-
- if (zbuffer)
- {
-#ifdef BUC60920
- glDepthFunc(GL_LEQUAL);
-#else
- glDepthFunc(GL_LESS);
-#endif
- glDepthMask(GL_TRUE);
-
-#ifdef BUC61044
- /* getting depth testing flag */
- TsmGetWSAttri( Wsid, WSDepthTest, &key );
- dTest = key.ldata;
- /* SAV checking if depth test was depricated somewhere outside */
- if ( dTest == TOn )
- glEnable(GL_DEPTH_TEST);
- else
- glDisable(GL_DEPTH_TEST);
-#else
- glEnable(GL_DEPTH_TEST);
-#endif
-
- glClearDepth(1.0);
- glClearColor (rgb[0], rgb[1], rgb[2], ( float )0.0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- }
- else
- {
- glDisable(GL_DEPTH_TEST);
- glClearColor (rgb[0], rgb[1], rgb[2], ( float )0.0);
- glClear (GL_COLOR_BUFFER_BIT);
- }
-#ifdef OCC1188
- glPushAttrib( GL_ENABLE_BIT | GL_TEXTURE_BIT );
- /* drawing bg image if any */
- if ( texture->texId != 0 ) {
- GLint width, height; /* window dimensions*/
- GLfloat x_center, y_center; /* window center */
- GLfloat x_offset, y_offset; /* half of the texture size */
- GLfloat texX_range = 1.0;
- /* texture <s> coordinate */
- GLfloat texY_range = 1.0; /* texture <t> coordinate */
-
- TsmGetWSAttri( Wsid, WSWidth, &key );
- width = key.ldata;
- x_center = (GLfloat)( width / 2. );
- TsmGetWSAttri( Wsid, WSHeight, &key );
- height = key.ldata;
- y_center = (GLfloat)( height / 2. );
-
- x_offset = (GLfloat)( texture->width / 2. ); /* style = center */
- y_offset = (GLfloat)( texture->height / 2. ); /* style = center */
- if ( texture->style != 0 ) { /* stretch or tile */
- x_offset = x_center;
- y_offset = y_center;
- if ( texture->style == 1 ) { /* tile */
- texX_range = (float)( width / texture->width );
- if ( texX_range < 1.0 )
- texX_range = 1.0;
- texY_range = (float)( height / texture->height );
- if ( texY_range < 1.0 )
- texY_range = 1.0;
- }
- }
- /* drawing background texture */
- glMatrixMode( GL_PROJECTION );
- glPushMatrix();
- glLoadIdentity();
- gluOrtho2D( 0.0, (GLdouble)width, 0.0, (GLdouble)height );
- glMatrixMode( GL_MODELVIEW );
- glPushMatrix();
- glLoadIdentity();
- glEnable( GL_TEXTURE_2D );
- glBindTexture( GL_TEXTURE_2D, texture->texId );
- glDisable( GL_DEPTH_TEST );
-
- glDisable( GL_BLEND );
- glColor3f( rgb[0], rgb[1], rgb[2] );
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
- glBegin( GL_QUADS );
- glTexCoord2f(0.0f, 0.0f);glVertex2f( x_center - x_offset, y_center - y_offset );
- glTexCoord2f(texX_range, 0.0f);glVertex2f( x_center + x_offset, y_center - y_offset );
- glTexCoord2f(texX_range, texY_range);glVertex2f( x_center + x_offset, y_center + y_offset );
- glTexCoord2f(0.0f, texY_range);glVertex2f( x_center - x_offset, y_center + y_offset );
- glEnd();
- if ( zbuffer )
- glEnable( GL_DEPTH_TEST );
- glDisable( GL_TEXTURE_2D );
- glPopMatrix(); /*modelview*/
- glMatrixMode( GL_PROJECTION );
- glPopMatrix(); /*projection*/
- glMatrixMode( GL_MODELVIEW );
- }
- else if( gradient->type > 0 )
- {
-
- Tfloat* corner1 = 0;/* -1,-1*/
- Tfloat* corner2 = 0;/* 1,-1*/
- Tfloat* corner3 = 0;/* 1, 1*/
- Tfloat* corner4 = 0;/* -1, 1*/
- Tfloat* dcorner1 = (Tfloat*)malloc(3*sizeof(Tfloat));
- Tfloat* dcorner2 = (Tfloat*)malloc(3*sizeof(Tfloat));
-
- int upset[3] = {0} ;
-
- switch( gradient->type )
- {
- case 1:
- corner1 = gradient->color2.rgb;
- corner2 = gradient->color2.rgb;
- corner3 = gradient->color1.rgb;
- corner4 = gradient->color1.rgb;
- break;
- case 2:
- corner1 = gradient->color2.rgb;
- corner2 = gradient->color1.rgb;
- corner3 = gradient->color1.rgb;
- corner4 = gradient->color2.rgb;
- break;
- case 3:
- corner2 = gradient->color2.rgb;
- corner4 = gradient->color1.rgb;
- dcorner1 [0] = dcorner2[0] = (corner2[0] + corner4[0]) / 2.0;
- dcorner1 [1] = dcorner2[1] = (corner2[1] + corner4[1]) / 2.0;
- dcorner1 [2] = dcorner2[2] = (corner2[2] + corner4[2]) / 2.0;
- corner1 = dcorner1;
- corner3 = dcorner2;
- break;
- case 4:
- corner1 = gradient->color2.rgb;
- corner3 = gradient->color1.rgb;
- dcorner1 [0] = dcorner2[0] = (corner1[0] + corner3[0]) / 2.0;
- dcorner1 [1] = dcorner2[1] = (corner1[1] + corner3[1]) / 2.0;
- dcorner1 [2] = dcorner2[2] = (corner1[2] + corner3[2]) / 2.0;
- corner2 = dcorner1;
- corner4 = dcorner2;
- break;
- case 5:
- corner1 = gradient->color1.rgb;
- corner2 = gradient->color2.rgb;
- corner3 = gradient->color2.rgb;
- corner4 = gradient->color2.rgb;
- break;
- case 6:
- corner1 = gradient->color2.rgb;
- corner2 = gradient->color1.rgb;
- corner3 = gradient->color2.rgb;
- corner4 = gradient->color2.rgb;
- break;
- case 7:
- corner1 = gradient->color2.rgb;
- corner2 = gradient->color2.rgb;
- corner3 = gradient->color1.rgb;
- corner4 = gradient->color2.rgb;
- break;
- case 8:
- corner1 = gradient->color2.rgb;
- corner2 = gradient->color2.rgb;
- corner3 = gradient->color2.rgb;
- corner4 = gradient->color1.rgb;
- break;
- default:
- printf("gradient background type not right\n");
-
- }
- glMatrixMode( GL_PROJECTION );
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode( GL_MODELVIEW );
- glPushMatrix();
- glLoadIdentity();
-
- if ( glIsEnabled( GL_DEPTH_TEST) )
- {
- upset[0] = 1;
- glDisable( GL_DEPTH_TEST );
- }
- if ( glIsEnabled( GL_LIGHTING ) )
- {
- upset[1] = 1;
- glDisable( GL_LIGHTING );
- }
- if ( !glIsEnabled( GL_SMOOTH ) )
- {
- upset[2] = 1;
- glShadeModel( GL_SMOOTH ) ;
- }
-
- if( gradient->type <= 5 || gradient->type == 7 )
- {
- glBegin(GL_TRIANGLES);
- glColor3f(corner1[0],corner1[1],corner1[2]);
- glVertex2f(-1.,-1.);
- glColor3f(corner2[0],corner2[1],corner2[2]);
- glVertex2f( 1.,-1.);
- glColor3f(corner3[0],corner3[1],corner3[2]);
- glVertex2f( 1., 1.);
- glEnd();
- glBegin(GL_TRIANGLES);
- glColor3f(corner1[0],corner1[1],corner1[2]);
- glVertex2f(-1.,-1.);
- glColor3f(corner3[0],corner3[1],corner3[2]);
- glVertex2f( 1., 1.);
- glColor3f(corner4[0],corner4[1],corner4[2]);
- glVertex2f(-1., 1.);
- glEnd();
- }
- else if( gradient->type == 6 || gradient->type == 8 )
- {
- glBegin(GL_TRIANGLES);
- glColor3f(corner1[0],corner1[1],corner1[2]);
- glVertex2f(-1.,-1.);
- glColor3f(corner2[0],corner2[1],corner2[2]);
- glVertex2f( 1.,-1.);
- glColor3f(corner4[0],corner4[1],corner4[2]);
- glVertex2f(-1., 1.);
- glEnd();
- glBegin(GL_TRIANGLES);
- glColor3f(corner2[0],corner2[1],corner2[2]);
- glVertex2f( 1.,-1.);
- glColor3f(corner3[0],corner3[1],corner3[2]);
- glVertex2f( 1., 1.);
- glColor3f(corner4[0],corner4[1],corner4[2]);
- glVertex2f(-1., 1.);
- glEnd();
-
- }
-
- if ( upset[0] )
- glEnable( GL_DEPTH_TEST );
-
- if ( upset[1] )
- glEnable( GL_LIGHTING );
-
- if ( upset[2] )
- glShadeModel( GL_FLAT );
-
- if ( zbuffer )
- glEnable( GL_DEPTH_TEST );
- glPopMatrix();
- glMatrixMode( GL_PROJECTION );
- glPopMatrix();
- glMatrixMode( GL_MODELVIEW );
-
- free(dcorner1);
- free(dcorner2);
- dcorner1 = 0;
- dcorner2 = 0;
-
- }
-
-#endif /* OCC1188*/
-
- glPopAttrib();
-
- /* GL_DITHER on/off pour le trace */
- if (TxglGetDither ())
- glEnable (GL_DITHER);
- else
- glDisable (GL_DITHER);
-
-
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_vind :
-
-
-REMARQUES:
-----------
-
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-20-02-96 : FMN ; Suppression code inutile:
-01-04-96 : CAL ; Integration MINSK portage WNT
-05-01-98 : FMN ; Suppression WNT inutile
-
-************************************************************************/
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include <OpenGl_cmn_varargs.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_telem_view.hxx>
-#include <OpenGl_telem_inquire.hxx>
-#include <OpenGl_telem_attri.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Fonctions statiques
-*/
-
-static TStatus ViewIndexDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ViewIndexAdd( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ViewIndexPrint( TSM_ELEM_DATA, Tint, cmn_key* );
-static TStatus ViewIndexInquire( TSM_ELEM_DATA, Tint, cmn_key* );
-
-static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
-{
- ViewIndexDisplay, /* PickTraverse */
- ViewIndexDisplay,
- ViewIndexAdd,
- 0, /* Delete */
- ViewIndexPrint,
- ViewIndexInquire
-};
-
-/*----------------------------------------------------------------------*/
-
-MtblPtr
-TelViewIndexInitClass( TelType *el )
-{
- *el = TelViewIndex;
- return MtdTbl;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ViewIndexAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
-{
- ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ViewIndexDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- CMN_KEY kk;
-
- kk.id = TelViewIndex;
- kk.data.ldata = data.ldata;
- TsmSetAttri( 1, &kk );
- if( k[0]->id == TOn )
- TelSetViewIndex( TglActiveWs, data.ldata );
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ViewIndexPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- fprintf( stdout, "TelViewIndex. Value = %d\n", data.ldata);
- fprintf( stdout, "\n" );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-static TStatus
-ViewIndexInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
-{
- Tint i;
-
- for( i = 0; i < n; i++ )
- {
- switch( k[i]->id )
- {
- case INQ_GET_SIZE_ID:
- {
- k[i]->data.ldata = sizeof( Tint );
- break;
- }
- case INQ_GET_CONTENT_ID:
- {
- TEL_INQ_CONTENT *c;
- Teldata *w;
-
- c = (TEL_INQ_CONTENT*)(k[i]->data.pdata);
- w = c->data;
- c->act_size = 0;
- w->idata = data.ldata;
- break;
- }
- }
- }
-
- return TSuccess;
-}
-/*----------------------------------------------------------------------*/
+++ /dev/null
-/***********************************************************************
-
-FONCTION :
-----------
-File OpenGl_ws :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-02-07-96 : FMN ; Suppression WSWSHeight, WSWSWidth et WSType
-17-07-96 : FMN ; Ajout WSZbuffer
-24-04-97 : FMN ; (PRO4063) Ajout displaylist pour le mode transient
-27-07-97 : CAL ; Portage NT (GLuint)
-28-08-97 : PCT ; ajout texture mapping
-13-03-98 : FMN ; Suppression variable WSNeedsClear
-08-07-98 : FMN ; Changement du nom de la primitive call_togl_erase_immediat_mode()
--> call_togl_erase_animation_mode.
-
-************************************************************************/
-
-#define G003 /* EUG 11-01-00 backfacing management
-*/
-
-#define OCC1188 /* SAV 23/12/02 background texture management */
-
-/*----------------------------------------------------------------------*/
-/*
-* Includes
-*/
-
-#include <OpenGl_tgl_all.hxx>
-
-#include <OpenGl_tsm.hxx>
-
-#include <OpenGl_tsm_ws.hxx>
-#include <OpenGl_animation.hxx>
-#include <OpenGl_Memory.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
-* Constantes
-*/
-
-#define WS_HTBL_SIZE 23
-#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
-from higher API */
-#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
-from higher API */
-
-/*----------------------------------------------------------------------*/
-/*
-* Types definitions
-*/
-
-#ifdef OCC1188
-/* background texture properties */
-struct WS_BG_TEXTURE
-{
- Tuint texId;
- Tint width;
- Tint height;
- Tint style; /* 0 - centered, 1 - tiled, 2 - stretch */
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef WS_BG_TEXTURE *ws_bg_texture;
-#endif
-
-typedef TSM_BG_GRADIENT WS_BG_GRADIENT;
-typedef WS_BG_GRADIENT *ws_bg_gradient;
-
-struct WS_REC
-{
- Tint texture_env;
- Tint surface_detail;
- void *filters;
- Tint window;
- Tint width;
- Tint height;
- Tint d_buff;
- Tint view_stid;
- void *lights;
- void *views;
- Tfloat backg[3];
- void *highlights;
- void *depthcues;
- Tint update_state;
- Tint transparency;
- Tint zbuffer;
- Tint transient;
- Tint retainMode;
-#ifndef WNT
- Pixmap pixmap_id;
- GLXPixmap
- glx_pixmap;
- Tint wsdepth;
-#else
-
-#endif
-#ifdef G003
- Tint backfacing;
-#endif /* G003 */
-
-#ifdef BUC61044
- Tint depth_test;
-#endif
-#ifdef BUC61045
- Tint ws_gllight;
-#endif
-#ifdef OCC1188
- WS_BG_TEXTURE bgTexture;
-#endif /* OCC1188 */
- WS_BG_GRADIENT bgGradient;
- IMPLEMENT_MEMORY_OPERATORS
-};
-typedef WS_REC *ws_rec;
-
-/*----------------------------------------------------------------------*/
-/*
-* Variables statiques
-*/
-
-typedef NCollection_DataMap< Standard_Integer, ws_rec> WS_Map;
-typedef WS_Map::Iterator WS_Map_Iterator;
-Handle(NCollection_BaseAllocator) ws_Allocator = NCollection_BaseAllocator::CommonBaseAllocator();
-WS_Map ws_map ( 1 , ws_Allocator );
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmRegisterWsid( Tint wsid )
-{
- if( ws_Allocator.IsNull() )
- return TFailure;
-
- ws_rec rec = new WS_REC();
- ws_map.Bind( wsid, rec );
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmSetWSAttri( Tint wsid, TWSAttri attri, cmn_key_data data )
-{
-
- if( ws_Allocator.IsNull() )
- return TFailure;
-
- if ( !ws_map.IsBound( wsid ) ) {
- ws_rec rec = new WS_REC();
- ws_map.Bind( wsid, new WS_REC() );
- }
- ws_rec wsr = ws_map.ChangeFind( wsid );
-
- switch( attri )
- {
- case WSTextureEnv:
- wsr->texture_env = data->ldata;
- break;
-
- case WSSurfaceDetail:
- wsr->surface_detail = data->ldata;
- break;
-
- case WSFilters:
- wsr->filters = data->pdata;
- break;
-
- case WSWindow:
- wsr->window = data->ldata;
- break;
-
- case WSWidth:
- wsr->width = data->ldata;
- break;
-
- case WSHeight:
- wsr->height = data->ldata;
- break;
-
- case WSDbuff:
- wsr->d_buff = data->ldata;
- break;
-
- case WSViewStid:
- wsr->view_stid = data->ldata;
- break;
-
- case WSLights:
- wsr->lights = data->pdata;
- break;
-
- case WSViews:
- wsr->views = data->pdata;
- break;
-
- case WSBackground:
- wsr->backg[0] = ((Tfloat*)data->pdata)[0],
- wsr->backg[1] = ((Tfloat*)data->pdata)[1],
- wsr->backg[2] = ((Tfloat*)data->pdata)[2];
- break;
-
- case WSHighlights:
- wsr->highlights = data->pdata;
- break;
-
- case WSDepthCues:
- wsr->depthcues = data->pdata;
- break;
-
- case WSTransparency:
- wsr->transparency = data->ldata;
- break;
-
- case WSZbuffer:
- wsr->zbuffer = data->ldata;
- break;
-
- case WSTransient:
- wsr->transient = data->ldata;
- break;
-
- case WSRetainMode:
- wsr->retainMode = data->ldata;
- break;
-
- case WSUpdateState:
- wsr->update_state = data->ldata;
- break;
-
-#ifndef WNT
- case WSPixmap:
- wsr->pixmap_id = data->pixmap;
- break;
-
- case WSGLXPixmap:
- wsr->glx_pixmap = data->glxpixmap;
- break;
-
- case WSDepth:
- wsr->wsdepth = data->ldata;
- break;
-#endif
-#ifdef G003
- case WSBackfacing:
- wsr -> backfacing = data -> ldata;
- break;
-#endif /* G003 */
-
-#ifdef BUC61044
- case WSDepthTest:
- wsr->depth_test = data->ldata;
- break;
-#endif
-#ifdef BUC61045
- case WSGLLight:
- wsr->ws_gllight = data->ldata;
- break;
-#endif
-#ifdef OCC1188
- case WSBgTexture :
- wsr->bgTexture.texId = ((Tuint*)data->pdata)[0],
- wsr->bgTexture.width = ((Tint*)data->pdata)[1],
- wsr->bgTexture.height = ((Tint*)data->pdata)[2];
- wsr->bgTexture.style = ((Tint*)data->pdata)[3];
- break;
-#endif
- case WSBgGradient :
- wsr->bgGradient = *((WS_BG_GRADIENT*)(data->pdata));
-
- default:
- break;
- }
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmGetWSAttri( Tint wsid, TWSAttri attri, cmn_key_data data )
-{
- if( ws_Allocator.IsNull() )
- return TFailure;
-
- if ( !ws_map.IsBound( wsid ) ) {
- ws_rec rec = new WS_REC();
- ws_map.Bind( wsid, rec );
- }
- ws_rec wsr = ws_map.Find( wsid );
-
- switch( attri )
- {
- case WSTextureEnv:
- data->ldata = wsr->texture_env;
- break;
-
- case WSSurfaceDetail:
- data->ldata = wsr->surface_detail;
- break;
-
- case WSFilters:
- data->pdata = wsr->filters;
- break;
-
- case WSWindow:
- data->ldata = wsr->window;
- break;
-
- case WSWidth:
- data->ldata = wsr->width;
- break;
-
- case WSHeight:
- data->ldata = wsr->height;
- break;
-
- case WSDbuff:
- data->ldata = wsr->d_buff;
- break;
-
- case WSViewStid:
- data->ldata = wsr->view_stid;
- break;
-
- case WSLights:
- data->pdata = wsr->lights;
- break;
-
- case WSViews:
- data->pdata = wsr->views;
- break;
-
- case WSBackground:
- data->pdata = wsr->backg;
- break;
-
- case WSHighlights:
- data->pdata = wsr->highlights;
- break;
-
- case WSDepthCues:
- data->pdata = wsr->depthcues;
- break;
-
- case WSTransparency:
- data->ldata = wsr->transparency;
- break;
-
- case WSZbuffer:
- data->ldata = wsr->zbuffer;
- break;
-
- case WSTransient:
- data->ldata = wsr->transient;
- break;
-
- case WSRetainMode:
- data->ldata = wsr->retainMode;
- break;
-
- case WSUpdateState:
- data->ldata = wsr->update_state;
- break;
-
-#ifndef WNT
- case WSPixmap:
- data->pixmap = wsr->pixmap_id;
- break;
-
- case WSGLXPixmap:
- data->glxpixmap = wsr->glx_pixmap;
- break;
-
- case WSDepth:
- data->ldata = wsr->wsdepth;
- break;
-#endif
-#ifdef G003
- case WSBackfacing:
- data -> ldata = wsr -> backfacing;
- break;
-#endif /* G003 */
-
-#ifdef BUC61044
- case WSDepthTest:
- data->ldata = wsr->depth_test;
- break;
-#endif
-#ifdef BUC61045
- case WSGLLight:
- data->ldata = wsr->ws_gllight;
- break;
-#endif
-#ifdef OCC1188
- case WSBgTexture :
- data->pdata = &wsr->bgTexture;
- break;
-#endif
- case WSBgGradient :
- data->pdata = &wsr->bgGradient;
- break;
-
- default:
- break;
- }
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmGetWSPosted( Tint struct_id, Tint size, Tint *ws, Tint *actual_size )
-{
- if( ws_Allocator.IsNull() )
- return TFailure;
- Tint i=0;
- WS_Map_Iterator it(ws_map);
- for ( ; it.More(); it.Next()) {
- if( it.Value()->view_stid == struct_id ) {
- (*actual_size)++;
- if( size > i )
- ws[i++] = it.Key();
- }
- }
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmUnregisterWsid( Tint wsid )
-{
- if( ws_Allocator.IsNull() )
- return TFailure;
- if ( !ws_map.IsBound( wsid ) ) {
- return TFailure;
- }
- ws_rec wsr = ws_map.ChangeFind( wsid );
- ws_map.UnBind( wsid );
- delete wsr;
-
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
-
-TStatus
-TsmInitUpdateState()
-{
- if( ws_Allocator.IsNull() )
- return TFailure;
- WS_Map_Iterator it(ws_map);
- for ( ; it.More(); it.Next()) {
- it.ChangeValue()->update_state = TNotDone;
- (void) call_togl_erase_animation_mode();
- }
- return TSuccess;
-}
-
-/*----------------------------------------------------------------------*/
+++ /dev/null
--- File: QADBMReflex.cdl
--- Created: Mon Oct 7 14:55:32 2002
--- Author: QA Admin
--- <qa@russox>
----Copyright: Matra Datavision 2002
-
-package QADBMReflex
- uses Draw,
- TopoDS,
- AIS,
- PrsMgr,
- Prs3d,
- SelectMgr,
- Quantity,
- Graphic3d
-is
-
- class OCC749Prs;
- class OCC749PrsUseVertexC;
- class OCC749PrsUseVertex;
- class OCC749PrsUseVertexCABV;
- class OCC749PrsUseVertexABV;
- Commands(DI : in out Interpretor from Draw);
-end;
+++ /dev/null
-// File: QADBMReflex.cxx
-// Created: Mon Oct 7 14:56:07 2002
-// Author: QA Admin
-// <qa@russox>
-
-
-#include <QADBMReflex.ixx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-
-//=======================================================================
-//function : GetMaterialFromName
-//purpose : get the Graphic3d_NameOfMaterial from a string
-//=======================================================================
-
-#define DEFAULT_MATERIAL Graphic3d_NOM_BRASS
-static Graphic3d_NameOfMaterial GetMaterialFromName( const char *name, Draw_Interpretor& di )
-{
- Graphic3d_NameOfMaterial mat = DEFAULT_MATERIAL;
-
- if ( !strcasecmp(name,"BRASS" ) ) mat = Graphic3d_NOM_BRASS;
- else if ( !strcasecmp(name,"BRONZE" ) ) mat = Graphic3d_NOM_BRONZE;
- else if ( !strcasecmp(name,"COPPER" ) ) mat = Graphic3d_NOM_COPPER;
- else if ( !strcasecmp(name,"GOLD" ) ) mat = Graphic3d_NOM_GOLD;
- else if ( !strcasecmp(name,"PEWTER" ) ) mat = Graphic3d_NOM_PEWTER;
- else if ( !strcasecmp(name,"SILVER" ) ) mat = Graphic3d_NOM_SILVER;
- else if ( !strcasecmp(name,"STEEL" ) ) mat = Graphic3d_NOM_STEEL;
- else if ( !strcasecmp(name,"METALIZED" ) ) mat = Graphic3d_NOM_METALIZED;
- else if ( !strcasecmp(name,"STONE" ) ) mat = Graphic3d_NOM_STONE;
- else if ( !strcasecmp(name,"CHROME" ) ) mat = Graphic3d_NOM_CHROME;
- else if ( !strcasecmp(name,"ALUMINIUM" ) ) mat = Graphic3d_NOM_ALUMINIUM;
- else if ( !strcasecmp(name,"NEON_PHC" ) ) mat = Graphic3d_NOM_NEON_PHC;
- else if ( !strcasecmp(name,"NEON_GNC" ) ) mat = Graphic3d_NOM_NEON_GNC;
- else if ( !strcasecmp(name,"PLASTER" ) ) mat = Graphic3d_NOM_PLASTER;
- else if ( !strcasecmp(name,"SHINY_PLASTIC" ) ) mat = Graphic3d_NOM_SHINY_PLASTIC;
- else if ( !strcasecmp(name,"SATIN" ) ) mat = Graphic3d_NOM_SATIN;
- else if ( !strcasecmp(name,"PLASTIC" ) ) mat = Graphic3d_NOM_PLASTIC;
- else if ( !strcasecmp(name,"OBSIDIAN" ) ) mat = Graphic3d_NOM_OBSIDIAN;
- else if ( !strcasecmp(name,"JADE" ) ) mat = Graphic3d_NOM_JADE;
-
-#ifdef DEB
- di << " materiau" << name <<" "<<Standard_Integer(mat) << "\n";
-#endif
- return mat;
-}
-
-#include <QADBMReflex_OCC749PrsUseVertex.hxx>
-#include <QADBMReflex_OCC749PrsUseVertexC.hxx>
-static Standard_Integer OCC749 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-
- Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
- if(myAISContext.IsNull()) {
- di << "use 'vinit' command before " << argv[0];
- return 1;
- }
-
- //if(!(argc == 14 || argc == 17)) {
- // cerr << "Usage : " << argv[0] << " Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount BoxSize R1 G1 B1 R2 G2 B2 NameOfMaterial [R3 G3 B3]" << endl;
- if(!(argc == 14)) {
- di << "Usage : " << argv[0] << " Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount BoxSize R1 G1 B1 R2 G2 B2 NameOfMaterial" << "\n";
- return -1;
- }
-
- Standard_Integer IntegerReflection = atoi(argv[1]);
- Standard_Boolean Reflection;
- if (IntegerReflection == 0) {
- Reflection = Standard_False;
- } else {
- Reflection = Standard_True;
- }
-
- Standard_Integer IntegerUseVertexC = atoi(argv[2]);
- Standard_Boolean UseVertexC;
- if (IntegerUseVertexC == 0) {
- UseVertexC = Standard_False;
- } else {
- UseVertexC = Standard_True;
- }
-
- Standard_Integer IntegerTimer = atoi(argv[3]);
- Standard_Boolean Timer;
- if (IntegerTimer == 0) {
- Timer = Standard_False;
- } else {
- Timer = Standard_True;
- }
-
- Standard_Integer XCount = atoi(argv[4]);
- Standard_Integer YCount = atoi(argv[5]);
- Standard_Integer BoxSize = atoi(argv[6]);
-
- Quantity_Parameter R1,G1,B1,R2,G2,B2;
- Quantity_Parameter R3,G3,B3;
- Graphic3d_MaterialAspect MaterialAspect;
- Standard_Boolean Material;
-
- Standard_Integer R1_Integer = atoi(argv[7]);
- Standard_Integer G1_Integer = atoi(argv[8]);
- Standard_Integer B1_Integer = atoi(argv[9]);
- Standard_Integer R2_Integer = atoi(argv[10]);
- Standard_Integer G2_Integer = atoi(argv[11]);
- Standard_Integer B2_Integer = atoi(argv[12]);
- R1 = R1_Integer / 255.;
- G1 = G1_Integer / 255.;
- B1 = B1_Integer / 255.;
- R2 = R2_Integer / 255.;
- G2 = G2_Integer / 255.;
- B2 = B2_Integer / 255.;
- di << "RED1 : " << R1 << " GREEN1 : " << G1 << " BLUE1 : " << B1 <<"\n";
- di << "RED2 : " << R2 << " GREEN2 : " << G2 << " BLUE2 : " << B2 <<"\n";
-
- MaterialAspect = GetMaterialFromName(argv[13],di);
- Material = Standard_True;
-
- Quantity_Parameter MaterialR,MaterialG,MaterialB;
- MaterialR = MaterialAspect.Color().Red();
- MaterialG = MaterialAspect.Color().Green();
- MaterialB = MaterialAspect.Color().Blue();
- di << "MaterialRED : " << MaterialR << " MaterialGREEN : " << MaterialG << " MaterialBLUE : " << MaterialB <<"\n";
-
- Standard_Integer R3_Integer,G3_Integer,B3_Integer;
- if(argc == 17) {
- R3_Integer = atoi(argv[14]);
- G3_Integer = atoi(argv[15]);
- B3_Integer = atoi(argv[16]);
- } else {
- R3_Integer = R2_Integer;
- G3_Integer = G2_Integer;
- B3_Integer = B2_Integer;
- }
- R3 = R3_Integer / 255.;
- G3 = G3_Integer / 255.;
- B3 = B3_Integer / 255.;
- if(argc == 17) {
- di << "RED3 : " << R3 << " GREEN3 : " << G3 << " BLUE3 : " << B3 <<"\n";
- }
-
- myAISContext->EraseAll(Standard_False);
- if (UseVertexC) {
- Handle(QADBMReflex_OCC749PrsUseVertexC) anIntearactiveObject;
- anIntearactiveObject = new QADBMReflex_OCC749PrsUseVertexC(Reflection,
- Quantity_Color(R1, G1, B1, Quantity_TOC_RGB),
- Quantity_Color(R2, G2, B2, Quantity_TOC_RGB),
- Quantity_Color(R3, G3, B3, Quantity_TOC_RGB),
- XCount,
- YCount,
- BoxSize,
- MaterialAspect,
- Material,
- Timer);
- myAISContext->Display(anIntearactiveObject);
- } else {
- Handle(QADBMReflex_OCC749PrsUseVertex) anIntearactiveObject;
- anIntearactiveObject = new QADBMReflex_OCC749PrsUseVertex(Reflection,
- Quantity_Color(R1, G1, B1, Quantity_TOC_RGB),
- Quantity_Color(R2, G2, B2, Quantity_TOC_RGB),
- Quantity_Color(R3, G3, B3, Quantity_TOC_RGB),
- XCount,
- YCount,
- BoxSize,
- MaterialAspect,
- Material,
- Timer);
- myAISContext->Display(anIntearactiveObject);
- }
- return 0;
-}
-
-#include <QADBMReflex_OCC749PrsUseVertexABV.hxx>
-#include <QADBMReflex_OCC749PrsUseVertexCABV.hxx>
-static Standard_Integer OCC749_abv (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-
- Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
- if(myAISContext.IsNull()) {
- di << "use 'vinit' command before " << argv[0];
- return 1;
- }
-
- if(!(argc == 13)) {
- di << "Usage : " << argv[0] << " Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount R1 G1 B1 R2 G2 B2 NameOfMaterial" << "\n";
- return -1;
- }
-
- Standard_Integer IntegerReflection = atoi(argv[1]);
- Standard_Boolean Reflection;
- if (IntegerReflection == 0) {
- Reflection = Standard_False;
- } else {
- Reflection = Standard_True;
- }
-
- Standard_Integer IntegerUseVertexC = atoi(argv[2]);
- Standard_Boolean UseVertexC;
- if (IntegerUseVertexC == 0) {
- UseVertexC = Standard_False;
- } else {
- UseVertexC = Standard_True;
- }
-
- Standard_Integer IntegerTimer = atoi(argv[3]);
- Standard_Boolean Timer;
- if (IntegerTimer == 0) {
- Timer = Standard_False;
- } else {
- Timer = Standard_True;
- }
-
- Standard_Integer XCount = atoi(argv[4]);
- Standard_Integer YCount = atoi(argv[5]);
- //Standard_Integer BoxSize = atoi(argv[6]);
- Standard_Integer BoxSize = 1;
-
- Quantity_Parameter R1,G1,B1,R2,G2,B2;
- Quantity_Parameter R3,G3,B3;
- Graphic3d_MaterialAspect MaterialAspect;
- Standard_Boolean Material;
-
- //Standard_Integer R1_Integer = atoi(argv[7]);
- //Standard_Integer G1_Integer = atoi(argv[8]);
- //Standard_Integer B1_Integer = atoi(argv[9]);
- //Standard_Integer R2_Integer = atoi(argv[10]);
- //Standard_Integer G2_Integer = atoi(argv[11]);
- //Standard_Integer B2_Integer = atoi(argv[12]);
- Standard_Integer R1_Integer = atoi(argv[6]);
- Standard_Integer G1_Integer = atoi(argv[7]);
- Standard_Integer B1_Integer = atoi(argv[8]);
- Standard_Integer R2_Integer = atoi(argv[9]);
- Standard_Integer G2_Integer = atoi(argv[10]);
- Standard_Integer B2_Integer = atoi(argv[11]);
- R1 = R1_Integer / 255.;
- G1 = G1_Integer / 255.;
- B1 = B1_Integer / 255.;
- R2 = R2_Integer / 255.;
- G2 = G2_Integer / 255.;
- B2 = B2_Integer / 255.;
- di << "RED1 : " << R1 << " GREEN1 : " << G1 << " BLUE1 : " << B1 <<"\n";
- di << "RED2 : " << R2 << " GREEN2 : " << G2 << " BLUE2 : " << B2 <<"\n";
-
- //MaterialAspect = GetMaterialFromName(argv[13]);
- MaterialAspect = GetMaterialFromName(argv[12],di);
- Material = Standard_True;
-
- Quantity_Parameter MaterialR,MaterialG,MaterialB;
- MaterialR = MaterialAspect.Color().Red();
- MaterialG = MaterialAspect.Color().Green();
- MaterialB = MaterialAspect.Color().Blue();
- di << "MaterialRED : " << MaterialR << " MaterialGREEN : " << MaterialG << " MaterialBLUE : " << MaterialB <<"\n";
-
- Standard_Integer R3_Integer,G3_Integer,B3_Integer;
- if(argc == 17) {
- R3_Integer = atoi(argv[14]);
- G3_Integer = atoi(argv[15]);
- B3_Integer = atoi(argv[16]);
- } else {
- R3_Integer = R2_Integer;
- G3_Integer = G2_Integer;
- B3_Integer = B2_Integer;
- }
- R3 = R3_Integer / 255.;
- G3 = G3_Integer / 255.;
- B3 = B3_Integer / 255.;
- if(argc == 17) {
- di << "RED3 : " << R3 << " GREEN3 : " << G3 << " BLUE3 : " << B3 <<"\n";
- }
-
- myAISContext->EraseAll(Standard_False);
- if (UseVertexC) {
- Handle(QADBMReflex_OCC749PrsUseVertexCABV) anIntearactiveObject;
- anIntearactiveObject = new QADBMReflex_OCC749PrsUseVertexCABV(Reflection,
- Quantity_Color(R1, G1, B1, Quantity_TOC_RGB),
- Quantity_Color(R2, G2, B2, Quantity_TOC_RGB),
- Quantity_Color(R3, G3, B3, Quantity_TOC_RGB),
- XCount,
- YCount,
- BoxSize,
- MaterialAspect,
- Material,
- Timer);
- myAISContext->Display(anIntearactiveObject);
- } else {
- Handle(QADBMReflex_OCC749PrsUseVertexABV) anIntearactiveObject;
- anIntearactiveObject = new QADBMReflex_OCC749PrsUseVertexABV(Reflection,
- Quantity_Color(R1, G1, B1, Quantity_TOC_RGB),
- Quantity_Color(R2, G2, B2, Quantity_TOC_RGB),
- Quantity_Color(R3, G3, B3, Quantity_TOC_RGB),
- XCount,
- YCount,
- BoxSize,
- MaterialAspect,
- Material,
- Timer);
- myAISContext->Display(anIntearactiveObject);
- }
- return 0;
-}
-
-void QADBMReflex::Commands(Draw_Interpretor& theCommands) {
- char *group = "QADBMReflex";
-
- //theCommands.Add("OCC749", "OCC749 Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount BoxSize R1 G1 B1 R2 G2 B2 NameOfMaterial [R3 G3 B3]", __FILE__, OCC749, group);
- theCommands.Add("OCC749", "OCC749 Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount BoxSize R1 G1 B1 R2 G2 B2 NameOfMaterial", __FILE__, OCC749, group);
- theCommands.Add("OCC749_abv", "OCC749_abv Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount R1 G1 B1 R2 G2 B2 NameOfMaterial", __FILE__, OCC749_abv, group);
- return;
-}
+++ /dev/null
--- File: QADBMReflex_OCC749Prs.cdl
--- Created: Mon Oct 7 15:01:08 2002
--- Author: QA Admin
--- <qa@russox>
----Copyright: Matra Datavision 2002
-
-class OCC749Prs from QADBMReflex inherits InteractiveObject from AIS
-
-uses
- PresentationManager3d from PrsMgr,
- Presentation from Prs3d,
- Selection from SelectMgr,
- Color from Quantity,
- MaterialAspect from Graphic3d
-
-is
- Create( Reflection : Boolean from Standard;
- InteriorColor : Color from Quantity;
- EdgeColor : Color from Quantity;
- EdgeColor2 : Color from Quantity;
- XCount : Integer from Standard;
- YCount : Integer from Standard;
- BoxSize : Integer from Standard;
- MaterialAspect : MaterialAspect from Graphic3d;
- Material : Boolean from Standard;
- Timer : Boolean from Standard )
- returns mutable OCC749Prs from QADBMReflex;
-
- ComputeSelection(me : mutable;
- aSelection : mutable Selection from SelectMgr;
- aMode : Integer from Standard)
- is redefined virtual protected;
-
- SetReflection( me : mutable; Reflection : Boolean from Standard );
-
- GetReflection( me )
- returns Boolean from Standard;
-
- SetColor( me : mutable; InteriorColor : Color from Quantity;
- EdgeColor : Color from Quantity );
-
- GetInteriorColor( me )
- returns Color from Quantity;
-
- GetEdgeColor( me )
- returns Color from Quantity;
-
- SetEdgeColor2( me : mutable; EdgeColor2 : Color from Quantity );
-
- GetEdgeColor2( me )
- returns Color from Quantity;
-
- SetXYCount( me : mutable; XCount : Integer from Standard;
- YCount : Integer from Standard );
-
- GetXCount( me )
- returns Integer from Standard;
-
- GetYCount( me )
- returns Integer from Standard;
-
- SetBoxSize( me : mutable; BoxSize : Integer from Standard );
-
- GetBoxSize( me )
- returns Integer from Standard;
-
- SetMaterialAspect( me : mutable; MaterialAspect : MaterialAspect from Graphic3d );
-
- GetMaterialAspect( me )
- returns MaterialAspect from Graphic3d;
-
- SetMaterial( me : mutable; Material : Boolean from Standard );
-
- GetMaterial( me )
- returns Boolean from Standard;
-
- SetTimer( me : mutable; Timer : Boolean from Standard );
-
- GetTimer( me )
- returns Boolean from Standard;
-
-fields
- myReflection : Boolean from Standard;
- myInteriorColor : Color from Quantity;
- myEdgeColor : Color from Quantity;
- myEdgeColor2 : Color from Quantity;
- myXCount : Integer from Standard;
- myYCount : Integer from Standard;
- myBoxSize : Integer from Standard;
- myMaterialAspect : MaterialAspect from Graphic3d;
- myMaterial : Boolean from Standard;
- myTimer : Boolean from Standard;
-end OCC749Prs;
+++ /dev/null
-// File: QADBMReflex_OCC749Prs.cxx
-// Created: Mon Oct 7 15:01:41 2002
-// Author: QA Admin
-// <qa@russox>
-
-
-#include <QADBMReflex_OCC749Prs.ixx>
-
-//=======================================================================
-//function : QADBMReflex_OCC749Prs
-//purpose :
-//=======================================================================
-
-QADBMReflex_OCC749Prs::QADBMReflex_OCC749Prs( const Standard_Boolean Reflection,
- const Quantity_Color& InteriorColor,
- const Quantity_Color& EdgeColor,
- const Quantity_Color& EdgeColor2,
- const Standard_Integer XCount,
- const Standard_Integer YCount,
- const Standard_Integer BoxSize,
- const Graphic3d_MaterialAspect& MaterialAspect,
- const Standard_Boolean Material,
- const Standard_Boolean Timer ) :
- myReflection( Reflection ),
- myInteriorColor( InteriorColor ),
- myEdgeColor( EdgeColor ),
- myEdgeColor2( EdgeColor2 ),
- myXCount( XCount ),
- myYCount( YCount ),
- myBoxSize( BoxSize ),
- myMaterialAspect( MaterialAspect ),
- myMaterial( Material ),
- myTimer( Timer )
-{
- SetHilightMode(0);
- SetSelectionMode(0);
-}
-
-//=======================================================================
-//function : ComputeSelection
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749Prs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
- const Standard_Integer aMode)
-{
-}
-
-//=======================================================================
-//function : SetReflection
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749Prs::SetReflection( const Standard_Boolean Reflection )
-{
- myReflection = Reflection;
-}
-
-//=======================================================================
-//function : SetColor
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749Prs::SetColor(const Quantity_Color& InteriorColor,
- const Quantity_Color& EdgeColor )
-{
- myInteriorColor = InteriorColor;
- myEdgeColor = EdgeColor;
-}
-
-//=======================================================================
-//function : SetEdgeColor2
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749Prs::SetEdgeColor2(const Quantity_Color& EdgeColor2 )
-{
- myEdgeColor2 = EdgeColor2;
-}
-
-//=======================================================================
-//function : SetXYCount
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749Prs::SetXYCount(const Standard_Integer XCount,
- const Standard_Integer YCount)
-{
- myXCount = XCount;
- myYCount = YCount;
-}
-
-//=======================================================================
-//function : SetBoxSize
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749Prs::SetBoxSize(const Standard_Integer BoxSize)
-{
- myBoxSize = BoxSize;
-}
-
-
-//=======================================================================
-//function : SetMaterialAspect
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749Prs::SetMaterialAspect(const Graphic3d_MaterialAspect& MaterialAspect)
-{
- myMaterialAspect = MaterialAspect;
-}
-
-//=======================================================================
-//function : SetMaterial
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749Prs::SetMaterial( const Standard_Boolean Material)
-{
- myMaterial = Material;
-}
-
-//=======================================================================
-//function : SetTimer
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749Prs::SetTimer( const Standard_Boolean Timer)
-{
- myTimer = Timer;
-}
-
-//=======================================================================
-//function : GetReflection
-//purpose :
-//=======================================================================
-
-Standard_Boolean QADBMReflex_OCC749Prs::GetReflection() const
-{
- return myReflection;
-}
-
-//=======================================================================
-//function : GetInteriorColor
-//purpose :
-//=======================================================================
-
-Quantity_Color QADBMReflex_OCC749Prs::GetInteriorColor() const
-{
- return myInteriorColor;
-}
-
-//=======================================================================
-//function : GetEdgeColor
-//purpose :
-//=======================================================================
-
-Quantity_Color QADBMReflex_OCC749Prs::GetEdgeColor() const
-{
- return myEdgeColor;
-}
-
-//=======================================================================
-//function : GetEdgeColor2
-//purpose :
-//=======================================================================
-
-Quantity_Color QADBMReflex_OCC749Prs::GetEdgeColor2() const
-{
- return myEdgeColor2;
-}
-
-//=======================================================================
-//function : GetXCount
-//purpose :
-//=======================================================================
-
-Standard_Integer QADBMReflex_OCC749Prs::GetXCount() const
-{
- return myXCount;
-}
-
-//=======================================================================
-//function : GetYCount
-//purpose :
-//=======================================================================
-
-Standard_Integer QADBMReflex_OCC749Prs::GetYCount() const
-{
- return myYCount;
-}
-
-//=======================================================================
-//function : GetBoxSize
-//purpose :
-//=======================================================================
-
-Standard_Integer QADBMReflex_OCC749Prs::GetBoxSize() const
-{
- return myBoxSize;
-}
-
-//=======================================================================
-//function : GetMaterialAspect
-//purpose :
-//=======================================================================
-
-Graphic3d_MaterialAspect QADBMReflex_OCC749Prs::GetMaterialAspect() const
-{
- return myMaterialAspect;
-}
-
-//=======================================================================
-//function : GetMaterial
-//purpose :
-//=======================================================================
-
-Standard_Boolean QADBMReflex_OCC749Prs::GetMaterial() const
-{
- return myMaterial;
-}
-
-//=======================================================================
-//function : GetTimer
-//purpose :
-//=======================================================================
-
-Standard_Boolean QADBMReflex_OCC749Prs::GetTimer() const
-{
- return myTimer;
-}
+++ /dev/null
--- File: QADBMReflex_OCC749PrsUseVertex.cdl
--- Created: Mon Oct 7 15:01:08 2002
--- Author: QA Admin
--- <qa@russox>
----Copyright: Matra Datavision 2002
-
-class OCC749PrsUseVertex from QADBMReflex inherits OCC749Prs from QADBMReflex
-
-uses
- PresentationManager3d from PrsMgr,
- Presentation from Prs3d,
- Selection from SelectMgr,
- Color from Quantity,
- MaterialAspect from Graphic3d
-
-is
- Create( Reflection : Boolean from Standard;
- InteriorColor : Color from Quantity;
- EdgeColor : Color from Quantity;
- EdgeColor2 : Color from Quantity;
- XCount : Integer from Standard;
- YCount : Integer from Standard;
- BoxSize : Integer from Standard;
- MaterialAspect : MaterialAspect from Graphic3d;
- Material : Boolean from Standard;
- Timer : Boolean from Standard )
- returns mutable OCC749PrsUseVertex from QADBMReflex;
-
- Compute(me : mutable;
- aPresentationManager : PresentationManager3d from PrsMgr;
- aPresentation : mutable Presentation from Prs3d;
- aMode : Integer from Standard = 0)
- is redefined virtual protected;
-
-end OCC749PrsUseVertex;
+++ /dev/null
-// File: QADBMReflex_OCC749PrsUseVertex.cxx
-// Created: Mon Oct 7 15:01:41 2002
-// Author: QA Admin
-// <qa@russox>
-
-
-#include <QADBMReflex_OCC749PrsUseVertex.ixx>
-
-#include <Prs3d_Root.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Vertex.hxx>
-#include <Aspect_Array1OfEdge.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_MaterialAspect.hxx>
-#include <Quantity_Color.hxx>
-#include <Graphic3d_Array1OfVertexC.hxx>
-#include <Aspect_Edge.hxx>
-
-
-#include <Graphic3d_Array1OfVertex.hxx>
-#include <OSD_Timer.hxx>
-
-//=======================================================================
-//function : QADBMReflex_OCC749PrsUseVertex
-//purpose :
-//=======================================================================
-
- QADBMReflex_OCC749PrsUseVertex::QADBMReflex_OCC749PrsUseVertex( const Standard_Boolean Reflection,const Quantity_Color& InteriorColor,const Quantity_Color& EdgeColor,const Quantity_Color& EdgeColor2,const Standard_Integer XCount,const Standard_Integer YCount,const Standard_Integer BoxSize,const Graphic3d_MaterialAspect& MaterialAspect,const Standard_Boolean Material,const Standard_Boolean Timer ):QADBMReflex_OCC749Prs(Reflection,InteriorColor,EdgeColor,EdgeColor2,XCount,YCount,BoxSize,MaterialAspect,Material,Timer) {
-}
-
-static OSD_Timer Timer;
-
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749PrsUseVertex::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr,
- const Handle(Prs3d_Presentation)& aPresentation,
- const Standard_Integer aMode )
-{
- Standard_Boolean BooleanTimer = GetTimer();
- if (BooleanTimer) {
- Timer.Reset ();
- Timer.Start ();
- }
-
- aPresentation->Clear();
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(aPresentation);
-
- Graphic3d_MaterialAspect aFlatMat;
- Standard_Boolean BooleanMaterial = GetMaterial();
- if (BooleanMaterial) {
- aFlatMat = GetMaterialAspect();
- cout << "aFlatMat is set" << endl;
- } else
- cout << "aFlatMat is not set" << endl;
-
-
- Standard_Boolean BooleanReflection = GetReflection();
- if (BooleanReflection) {
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_AMBIENT);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_DIFFUSE);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_SPECULAR);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_EMISSION);
- } else {
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
- }
-
- Quantity_Color InteriorColor = GetInteriorColor();
- Quantity_Color EdgeColor = GetEdgeColor();
-
- Standard_Integer XCOUNT = GetXCount();
- Standard_Integer YCOUNT = GetYCount();
- Standard_Integer BOXSIZE = GetBoxSize();
-
- aGroup->BeginPrimitives();
- Handle(Graphic3d_AspectFillArea3d) Fill3d;
- Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID,
- InteriorColor,
- EdgeColor,
- Aspect_TOL_SOLID,
- 1.5,
- aFlatMat,
- aFlatMat);
-
- aGroup->BeginPrimitives();
- aGroup->SetGroupPrimitivesAspect(Fill3d);
- aGroup->SetPrimitivesAspect(Fill3d);
- //aGroup->BeginPrimitives();
-
- Standard_Integer i,j,z1=0,z2,zmax=XCOUNT;
- if (YCOUNT > XCOUNT) zmax = YCOUNT;
- for (i=0; i < XCOUNT; i++){
- for (j=0; j < YCOUNT; j++){
- if ((i!=0) || (j!=0))
- Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID,
- Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB),
- EdgeColor,
- Aspect_TOL_SOLID,
- 1.5,
- aFlatMat,
- aFlatMat);
-
- if (i == 0 && j ==0) {
- Fill3d->SetInteriorColor(InteriorColor);
- }
-
- aGroup->SetPrimitivesAspect(Fill3d);
-
- Graphic3d_Array1OfVertex aVertexes(1, 8);
-
- z2 = BOXSIZE +(i*zmax - j*((Standard_Integer) zmax/2));
- aVertexes(1).SetCoord(i*BOXSIZE, j*BOXSIZE, z1);
- aVertexes(2).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z1);
- aVertexes(3).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z1);
- aVertexes(4).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z1);
- aVertexes(5).SetCoord(i*BOXSIZE, j*BOXSIZE, z2);
- aVertexes(6).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z2);
- aVertexes(7).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z2);
- aVertexes(8).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z2);
-
- Aspect_Array1OfEdge aEdges(1, 24);
- aEdges(1) = Aspect_Edge(1, 2, Aspect_TOE_VISIBLE);
- aEdges(2) = Aspect_Edge(2, 3, Aspect_TOE_VISIBLE);
- aEdges(3) = Aspect_Edge(3, 4, Aspect_TOE_VISIBLE);
- aEdges(4) = Aspect_Edge(4, 1, Aspect_TOE_VISIBLE);
-
- aEdges(5) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE);
- aEdges(6) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE);
- aEdges(7) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE);
- aEdges(8) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE);
-
- aEdges(9) = Aspect_Edge(1, 5, Aspect_TOE_VISIBLE);
- aEdges(10) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE);
- aEdges(11) = Aspect_Edge(6, 2, Aspect_TOE_VISIBLE);
- aEdges(12) = Aspect_Edge(2, 1, Aspect_TOE_VISIBLE);
-
- aEdges(13) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE);
- aEdges(14) = Aspect_Edge(7, 3, Aspect_TOE_VISIBLE);
- aEdges(15) = Aspect_Edge(3, 2, Aspect_TOE_VISIBLE);
- aEdges(16) = Aspect_Edge(2, 6, Aspect_TOE_VISIBLE);
-
- aEdges(17) = Aspect_Edge(3, 7, Aspect_TOE_VISIBLE);
- aEdges(18) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE);
- aEdges(19) = Aspect_Edge(8, 4, Aspect_TOE_VISIBLE);
- aEdges(20) = Aspect_Edge(4, 3, Aspect_TOE_VISIBLE);
-
- aEdges(21) = Aspect_Edge(4, 8, Aspect_TOE_VISIBLE);
- aEdges(22) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE);
- aEdges(23) = Aspect_Edge(5, 1, Aspect_TOE_VISIBLE);
- aEdges(24) = Aspect_Edge(1, 4, Aspect_TOE_VISIBLE);
-
- aGroup->QuadrangleSet(aVertexes, aEdges);
- }
- }
- aGroup->EndPrimitives();
-
- if (BooleanTimer) {
- Timer.Stop ();
- Timer.Show (cout);
- }
-}
+++ /dev/null
--- File: QADBMReflex_OCC749PrsUseVertexABV.cdl
--- Created: Mon Oct 7 15:01:08 2002
--- Author: QA Admin
--- <qa@russox>
----Copyright: Matra Datavision 2002
-
-class OCC749PrsUseVertexABV from QADBMReflex inherits OCC749Prs from QADBMReflex
-
-uses
- PresentationManager3d from PrsMgr,
- Presentation from Prs3d,
- Selection from SelectMgr,
- Color from Quantity,
- MaterialAspect from Graphic3d
-
-is
- Create( Reflection : Boolean from Standard;
- InteriorColor : Color from Quantity;
- EdgeColor : Color from Quantity;
- EdgeColor2 : Color from Quantity;
- XCount : Integer from Standard;
- YCount : Integer from Standard;
- BoxSize : Integer from Standard;
- MaterialAspect : MaterialAspect from Graphic3d;
- Material : Boolean from Standard;
- Timer : Boolean from Standard )
- returns mutable OCC749PrsUseVertexABV from QADBMReflex;
-
- Compute(me : mutable;
- aPresentationManager : PresentationManager3d from PrsMgr;
- aPresentation : mutable Presentation from Prs3d;
- aMode : Integer from Standard = 0)
- is redefined virtual protected;
-
-end OCC749PrsUseVertexABV;
+++ /dev/null
-// File: QADBMReflex_OCC749PrsUseVertexABV.cxx
-// Created: Mon Oct 7 15:01:41 2002
-// Author: QA Admin
-// <qa@russox>
-
-
-#include <QADBMReflex_OCC749PrsUseVertexABV.ixx>
-
-#include <Prs3d_Root.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Vertex.hxx>
-#include <Aspect_Array1OfEdge.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_MaterialAspect.hxx>
-#include <Quantity_Color.hxx>
-#include <Graphic3d_Array1OfVertexC.hxx>
-#include <Aspect_Edge.hxx>
-
-
-#include <Graphic3d_Array1OfVertex.hxx>
-#include <OSD_Timer.hxx>
-
-//=======================================================================
-//function : QADBMReflex_OCC749PrsUseVertexABV
-//purpose :
-//=======================================================================
-
- QADBMReflex_OCC749PrsUseVertexABV::QADBMReflex_OCC749PrsUseVertexABV( const Standard_Boolean Reflection,const Quantity_Color& InteriorColor,const Quantity_Color& EdgeColor,const Quantity_Color& EdgeColor2,const Standard_Integer XCount,const Standard_Integer YCount,const Standard_Integer BoxSize,const Graphic3d_MaterialAspect& MaterialAspect,const Standard_Boolean Material,const Standard_Boolean Timer ):QADBMReflex_OCC749Prs(Reflection,InteriorColor,EdgeColor,EdgeColor2,XCount,YCount,BoxSize,MaterialAspect,Material,Timer) {
-}
-
-static OSD_Timer Timer;
-
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749PrsUseVertexABV::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr,
- const Handle(Prs3d_Presentation)& aPresentation,
- const Standard_Integer aMode )
-{
- Standard_Boolean BooleanTimer = GetTimer();
- if (BooleanTimer) {
- Timer.Reset ();
- Timer.Start ();
- }
-
- aPresentation->Clear();
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(aPresentation);
-
- Graphic3d_MaterialAspect aFlatMat;
- Standard_Boolean BooleanMaterial = GetMaterial();
- if (BooleanMaterial) {
- aFlatMat = GetMaterialAspect();
- }
-
- Standard_Boolean BooleanReflection = GetReflection();
- if (BooleanReflection) {
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_AMBIENT);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_DIFFUSE);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_SPECULAR);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_EMISSION);
- } else {
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
- }
-
- Quantity_Color InteriorColor = GetInteriorColor();
- Quantity_Color EdgeColor = GetEdgeColor();
- Standard_Integer XCOUNT = GetXCount();
- Standard_Integer YCOUNT = GetYCount();
- Standard_Integer BOXSIZE = GetBoxSize();
-
- //Handle(Graphic3d_AspectFillArea3d) Fill3d;
- //Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID,
- // InteriorColor,
- // EdgeColor,
- // Aspect_TOL_SOLID,
- // 1.5,
- // aFlatMat,
- // aFlatMat);
-
- //aGroup->SetPrimitivesAspect(Fill3d);
- aGroup->BeginPrimitives();
-
- Standard_Integer i,j,z1=0,z2,zmax=XCOUNT;
- if (YCOUNT > XCOUNT) zmax = YCOUNT;
-
- Standard_Integer HMAX = 100;
- BOXSIZE = HMAX / zmax;
- if (BOXSIZE ==0)
- BOXSIZE = 1;
-
- for (i=0; i < XCOUNT; i++){
- for (j=0; j < YCOUNT; j++){
-
- //Quantity_NameOfColor aColor = Quantity_Color::Name(1.,
- // (double)j/YCOUNT,
- // (double)i/XCOUNT);
- Handle(Graphic3d_AspectFillArea3d) Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID,
- Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB),
- EdgeColor,
- Aspect_TOL_SOLID,
- 1.5,
- aFlatMat,
- aFlatMat);
- //////////////////if (i == 0 && j ==0) {
- //////////////////Fill3d->SetInteriorColor(InteriorColor);
- //////////////////}
- aGroup->SetPrimitivesAspect(Fill3d);
-
- Graphic3d_Array1OfVertex aVertexes(1, 8);
-
- //////////////////z2 = BOXSIZE +(i*zmax - j*((Standard_Integer) zmax/2));
- z2 = BOXSIZE +(i*BOXSIZE - j*BOXSIZE/2);
- aVertexes(1).SetCoord(i*BOXSIZE, j*BOXSIZE, z1);
- aVertexes(2).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z1);
- aVertexes(3).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z1);
- aVertexes(4).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z1);
- aVertexes(5).SetCoord(i*BOXSIZE, j*BOXSIZE, z2);
- aVertexes(6).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z2);
- aVertexes(7).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z2);
- aVertexes(8).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z2);
-
- Aspect_Array1OfEdge aEdges(1, 24);
- aEdges(1) = Aspect_Edge(1, 2, Aspect_TOE_VISIBLE);
- aEdges(2) = Aspect_Edge(2, 3, Aspect_TOE_VISIBLE);
- aEdges(3) = Aspect_Edge(3, 4, Aspect_TOE_VISIBLE);
- aEdges(4) = Aspect_Edge(4, 1, Aspect_TOE_VISIBLE);
-
- aEdges(5) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE);
- aEdges(6) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE);
- aEdges(7) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE);
- aEdges(8) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE);
-
- aEdges(9) = Aspect_Edge(1, 5, Aspect_TOE_VISIBLE);
- aEdges(10) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE);
- aEdges(11) = Aspect_Edge(6, 2, Aspect_TOE_VISIBLE);
- aEdges(12) = Aspect_Edge(2, 1, Aspect_TOE_VISIBLE);
-
- aEdges(13) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE);
- aEdges(14) = Aspect_Edge(7, 3, Aspect_TOE_VISIBLE);
- aEdges(15) = Aspect_Edge(3, 2, Aspect_TOE_VISIBLE);
- aEdges(16) = Aspect_Edge(2, 6, Aspect_TOE_VISIBLE);
-
- aEdges(17) = Aspect_Edge(3, 7, Aspect_TOE_VISIBLE);
- aEdges(18) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE);
- aEdges(19) = Aspect_Edge(8, 4, Aspect_TOE_VISIBLE);
- aEdges(20) = Aspect_Edge(4, 3, Aspect_TOE_VISIBLE);
-
- aEdges(21) = Aspect_Edge(4, 8, Aspect_TOE_VISIBLE);
- aEdges(22) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE);
- aEdges(23) = Aspect_Edge(5, 1, Aspect_TOE_VISIBLE);
- aEdges(24) = Aspect_Edge(1, 4, Aspect_TOE_VISIBLE);
-
- aGroup->QuadrangleSet(aVertexes, aEdges);
- }
- }
- aGroup->EndPrimitives();
-
- if (BooleanTimer) {
- Timer.Stop ();
- Timer.Show (cout);
- }
-}
+++ /dev/null
--- File: QADBMReflex_OCC749PrsUseVertexC.cdl
--- Created: Mon Oct 7 15:01:08 2002
--- Author: QA Admin
--- <qa@russox>
----Copyright: Matra Datavision 2002
-
-class OCC749PrsUseVertexC from QADBMReflex inherits OCC749Prs from QADBMReflex
-
-uses
- PresentationManager3d from PrsMgr,
- Presentation from Prs3d,
- Selection from SelectMgr,
- Color from Quantity,
- MaterialAspect from Graphic3d
-
-is
- Create( Reflection : Boolean from Standard;
- InteriorColor : Color from Quantity;
- EdgeColor : Color from Quantity;
- EdgeColor2 : Color from Quantity;
- XCount : Integer from Standard;
- YCount : Integer from Standard;
- BoxSize : Integer from Standard;
- MaterialAspect : MaterialAspect from Graphic3d;
- Material : Boolean from Standard;
- Timer : Boolean from Standard )
- returns mutable OCC749PrsUseVertexC from QADBMReflex;
-
- Compute(me : mutable;
- aPresentationManager : PresentationManager3d from PrsMgr;
- aPresentation : mutable Presentation from Prs3d;
- aMode : Integer from Standard = 0)
- is redefined virtual protected;
-
-end OCC749PrsUseVertexC;
+++ /dev/null
-// File: QADBMReflex_OCC749PrsUseVertexC.cxx
-// Created: Mon Oct 7 15:01:41 2002
-// Author: QA Admin
-// <qa@russox>
-
-
-#include <QADBMReflex_OCC749PrsUseVertexC.ixx>
-
-#include <Prs3d_Root.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Vertex.hxx>
-#include <Aspect_Array1OfEdge.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_MaterialAspect.hxx>
-#include <Quantity_Color.hxx>
-#include <Graphic3d_Array1OfVertexC.hxx>
-#include <Aspect_Edge.hxx>
-
-
-#include <Graphic3d_Array1OfVertex.hxx>
-#include <OSD_Timer.hxx>
-
-
-//=======================================================================
-//function : QADBMReflex_OCC749PrsUseVertex
-//purpose :
-//=======================================================================
-
- QADBMReflex_OCC749PrsUseVertexC::QADBMReflex_OCC749PrsUseVertexC( const Standard_Boolean Reflection,const Quantity_Color& InteriorColor,const Quantity_Color& EdgeColor,const Quantity_Color& EdgeColor2,const Standard_Integer XCount,const Standard_Integer YCount,const Standard_Integer BoxSize,const Graphic3d_MaterialAspect& MaterialAspect,const Standard_Boolean Material,const Standard_Boolean Timer ):QADBMReflex_OCC749Prs(Reflection,InteriorColor,EdgeColor,EdgeColor2,XCount,YCount,BoxSize,MaterialAspect,Material,Timer) {
-}
-
-static OSD_Timer Timer;
-
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749PrsUseVertexC::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr,
- const Handle(Prs3d_Presentation)& aPresentation,
- const Standard_Integer aMode )
-{
- Standard_Boolean BooleanTimer = GetTimer();
- if (BooleanTimer) {
- Timer.Reset ();
- Timer.Start ();
- }
-
- aPresentation->Clear();
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(aPresentation);
-
- Graphic3d_MaterialAspect aFlatMat;
- Standard_Boolean BooleanMaterial = GetMaterial();
- if (BooleanMaterial) {
- aFlatMat = GetMaterialAspect();
- }
-
- Standard_Boolean BooleanReflection = GetReflection();
- if (BooleanReflection) {
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_AMBIENT);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_DIFFUSE);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_SPECULAR);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_EMISSION);
- } else {
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
- }
-
- Quantity_Color InteriorColor = GetInteriorColor();
- Quantity_Color EdgeColor = GetEdgeColor();
- Quantity_Color EdgeColor2 = GetEdgeColor2();
-
- Standard_Integer XCOUNT = GetXCount();
- Standard_Integer YCOUNT = GetYCount();
- Standard_Integer BOXSIZE = GetBoxSize();
-
- Handle(Graphic3d_AspectFillArea3d) Fill3d;
- Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID,
- InteriorColor,
- EdgeColor,
- Aspect_TOL_SOLID,
- 1.5,
- aFlatMat,
- aFlatMat);
- //Handle(Graphic3d_AspectFillArea3d) Fill3d = new Graphic3d_AspectFillArea3d();
- //Fill3d->SetInteriorStyle(Aspect_IS_SOLID);
-
- aGroup->SetGroupPrimitivesAspect(Fill3d);
- aGroup->SetPrimitivesAspect(Fill3d);
-
- aGroup->BeginPrimitives();
-
- Standard_Integer i,j,z1=0,z2,zmax=XCOUNT;
- if (YCOUNT > XCOUNT) zmax = YCOUNT;
- for (i=0; i < XCOUNT; i++){
- for (j=0; j < YCOUNT; j++){
- //Quantity_NameOfColor aColor = Quantity_Color::Name(1.,
- // (double)j/YCOUNT,
- // (double)i/XCOUNT);
-
- Graphic3d_Array1OfVertexC aVertexes(1, 8);
-
- z2 = BOXSIZE +(i*zmax - j*((Standard_Integer) zmax/2));
- aVertexes(1).SetCoord(i*BOXSIZE, j*BOXSIZE, z1);
- aVertexes(2).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z1);
- aVertexes(3).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z1);
- aVertexes(4).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z1);
- aVertexes(5).SetCoord(i*BOXSIZE, j*BOXSIZE, z2);
- aVertexes(6).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z2);
- aVertexes(7).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z2);
- aVertexes(8).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z2);
-
- /*
- aVertexes(1).SetColor(EdgeColor);
- aVertexes(2).SetColor(EdgeColor);
- aVertexes(3).SetColor(EdgeColor2);
- aVertexes(4).SetColor(EdgeColor2);
- aVertexes(5).SetColor(EdgeColor2);
- aVertexes(6).SetColor(EdgeColor2);
- aVertexes(7).SetColor(EdgeColor);
- aVertexes(8).SetColor(EdgeColor);
- */
- if ( (i!=0 || j!=0) ) {
- aVertexes(1).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(2).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(3).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(4).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
-
- aVertexes(5).SetColor(Quantity_Color(0., 1.-(double)j/YCOUNT, 1.-(double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(6).SetColor(Quantity_Color(0., 1.-(double)j/YCOUNT, 1.-(double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(7).SetColor(Quantity_Color(0., 1.-(double)j/YCOUNT, 1.-(double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(8).SetColor(Quantity_Color(0., 1.-(double)j/YCOUNT, 1.-(double)i/XCOUNT, Quantity_TOC_RGB));
-
-/* aVertexes(5).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(6).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(7).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(8).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
-*/
- }
-
- Aspect_Array1OfEdge aEdges(1, 24);
- aEdges(1) = Aspect_Edge(1, 2, Aspect_TOE_VISIBLE);
- aEdges(2) = Aspect_Edge(2, 3, Aspect_TOE_VISIBLE);
- aEdges(3) = Aspect_Edge(3, 4, Aspect_TOE_VISIBLE);
- aEdges(4) = Aspect_Edge(4, 1, Aspect_TOE_VISIBLE);
-
- aEdges(5) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE);
- aEdges(6) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE);
- aEdges(7) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE);
- aEdges(8) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE);
-
- aEdges(9) = Aspect_Edge(1, 5, Aspect_TOE_VISIBLE);
- aEdges(10) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE);
- aEdges(11) = Aspect_Edge(6, 2, Aspect_TOE_VISIBLE);
- aEdges(12) = Aspect_Edge(2, 1, Aspect_TOE_VISIBLE);
-
- aEdges(13) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE);
- aEdges(14) = Aspect_Edge(7, 3, Aspect_TOE_VISIBLE);
- aEdges(15) = Aspect_Edge(3, 2, Aspect_TOE_VISIBLE);
- aEdges(16) = Aspect_Edge(2, 6, Aspect_TOE_VISIBLE);
-
- aEdges(17) = Aspect_Edge(3, 7, Aspect_TOE_VISIBLE);
- aEdges(18) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE);
- aEdges(19) = Aspect_Edge(8, 4, Aspect_TOE_VISIBLE);
- aEdges(20) = Aspect_Edge(4, 3, Aspect_TOE_VISIBLE);
-
- aEdges(21) = Aspect_Edge(4, 8, Aspect_TOE_VISIBLE);
- aEdges(22) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE);
- aEdges(23) = Aspect_Edge(5, 1, Aspect_TOE_VISIBLE);
- aEdges(24) = Aspect_Edge(1, 4, Aspect_TOE_VISIBLE);
-
- aGroup->QuadrangleSet(aVertexes, aEdges);
- }
- }
- aGroup->EndPrimitives();
-
- if (BooleanTimer) {
- Timer.Stop ();
- Timer.Show (cout);
- }
-
-}
+++ /dev/null
--- File: QADBMReflex_OCC749PrsUseVertexCABV.cdl
--- Created: Mon Oct 7 15:01:08 2002
--- Author: QA Admin
--- <qa@russox>
----Copyright: Matra Datavision 2002
-
-class OCC749PrsUseVertexCABV from QADBMReflex inherits OCC749Prs from QADBMReflex
-
-uses
- PresentationManager3d from PrsMgr,
- Presentation from Prs3d,
- Selection from SelectMgr,
- Color from Quantity,
- MaterialAspect from Graphic3d
-
-is
- Create( Reflection : Boolean from Standard;
- InteriorColor : Color from Quantity;
- EdgeColor : Color from Quantity;
- EdgeColor2 : Color from Quantity;
- XCount : Integer from Standard;
- YCount : Integer from Standard;
- BoxSize : Integer from Standard;
- MaterialAspect : MaterialAspect from Graphic3d;
- Material : Boolean from Standard;
- Timer : Boolean from Standard )
- returns mutable OCC749PrsUseVertexCABV from QADBMReflex;
-
- Compute(me : mutable;
- aPresentationManager : PresentationManager3d from PrsMgr;
- aPresentation : mutable Presentation from Prs3d;
- aMode : Integer from Standard = 0)
- is redefined virtual protected;
-
-end OCC749PrsUseVertexCABV;
+++ /dev/null
-// File: QADBMReflex_OCC749PrsUseVertexCABV.cxx
-// Created: Mon Oct 7 15:01:41 2002
-// Author: QA Admin
-// <qa@russox>
-
-
-#include <QADBMReflex_OCC749PrsUseVertexCABV.ixx>
-
-#include <Prs3d_Root.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Vertex.hxx>
-#include <Aspect_Array1OfEdge.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_MaterialAspect.hxx>
-#include <Quantity_Color.hxx>
-#include <Graphic3d_Array1OfVertexC.hxx>
-#include <Aspect_Edge.hxx>
-
-
-#include <Graphic3d_Array1OfVertex.hxx>
-#include <OSD_Timer.hxx>
-
-
-//=======================================================================
-//function : QADBMReflex_OCC749PrsUseVertex
-//purpose :
-//=======================================================================
-
- QADBMReflex_OCC749PrsUseVertexCABV::QADBMReflex_OCC749PrsUseVertexCABV( const Standard_Boolean Reflection,const Quantity_Color& InteriorColor,const Quantity_Color& EdgeColor,const Quantity_Color& EdgeColor2,const Standard_Integer XCount,const Standard_Integer YCount,const Standard_Integer BoxSize,const Graphic3d_MaterialAspect& MaterialAspect,const Standard_Boolean Material,const Standard_Boolean Timer ):QADBMReflex_OCC749Prs(Reflection,InteriorColor,EdgeColor,EdgeColor2,XCount,YCount,BoxSize,MaterialAspect,Material,Timer) {
-}
-
-static OSD_Timer Timer;
-
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-
-void QADBMReflex_OCC749PrsUseVertexCABV::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr,
- const Handle(Prs3d_Presentation)& aPresentation,
- const Standard_Integer aMode )
-{
- Standard_Boolean BooleanTimer = GetTimer();
- if (BooleanTimer) {
- Timer.Reset ();
- Timer.Start ();
- }
-
- aPresentation->Clear();
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(aPresentation);
-
- Graphic3d_MaterialAspect aFlatMat;
- Standard_Boolean BooleanMaterial = GetMaterial();
- if (BooleanMaterial) {
- aFlatMat = GetMaterialAspect();
- }
-
- Standard_Boolean BooleanReflection = GetReflection();
- if (BooleanReflection) {
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_AMBIENT);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_DIFFUSE);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_SPECULAR);
- aFlatMat.SetReflectionModeOn(Graphic3d_TOR_EMISSION);
- } else {
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
- aFlatMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
- }
-
- Quantity_Color InteriorColor = GetInteriorColor();
- Quantity_Color EdgeColor = GetEdgeColor();
- Quantity_Color EdgeColor2 = GetEdgeColor2();
-
- Standard_Integer XCOUNT = GetXCount();
- Standard_Integer YCOUNT = GetYCount();
- Standard_Integer BOXSIZE = GetBoxSize();
-
- Handle(Graphic3d_AspectFillArea3d) Fill3d;
- Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID,
- InteriorColor,
- EdgeColor,
- Aspect_TOL_SOLID,
- 1.5,
- aFlatMat,
- aFlatMat);
-
- //////////////////Fill3d->SetInteriorColor(InteriorColor);
-
- //Handle(Graphic3d_AspectFillArea3d) Fill3d = new Graphic3d_AspectFillArea3d();
- //Fill3d->SetInteriorStyle(Aspect_IS_SOLID);
-
- aGroup->SetGroupPrimitivesAspect(Fill3d);
- aGroup->SetPrimitivesAspect(Fill3d);
-
- aGroup->BeginPrimitives();
-
- Standard_Integer i,j,z1=0,z2,zmax=XCOUNT;
- if (YCOUNT > XCOUNT) zmax = YCOUNT;
-
- Standard_Integer HMAX = 100;
- BOXSIZE = HMAX / zmax;
- if (BOXSIZE ==0)
- BOXSIZE = 1;
-
- for (i=0; i < XCOUNT; i++){
- for (j=0; j < YCOUNT; j++){
- //Quantity_NameOfColor aColor = Quantity_Color::Name(1.,
- // (double)j/YCOUNT,
- // (double)i/XCOUNT);
-
- Graphic3d_Array1OfVertexC aVertexes(1, 8);
-
- //////////////////z2 = BOXSIZE +(i*zmax - j*((Standard_Integer) zmax/2));
- z2 = BOXSIZE +(i*BOXSIZE - j*BOXSIZE/2);
- aVertexes(1).SetCoord(i*BOXSIZE, j*BOXSIZE, z1);
- aVertexes(2).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z1);
- aVertexes(3).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z1);
- aVertexes(4).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z1);
- aVertexes(5).SetCoord(i*BOXSIZE, j*BOXSIZE, z2);
- aVertexes(6).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z2);
- aVertexes(7).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z2);
- aVertexes(8).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z2);
-
- //aVertexes(1).SetColor(EdgeColor);
- //aVertexes(2).SetColor(EdgeColor);
- //aVertexes(3).SetColor(EdgeColor2);
- //aVertexes(4).SetColor(EdgeColor2);
- //aVertexes(5).SetColor(EdgeColor2);
- //aVertexes(6).SetColor(EdgeColor2);
- //aVertexes(7).SetColor(EdgeColor);
- //aVertexes(8).SetColor(EdgeColor);
-
- //////////////////if (!(i == 0 && j ==0)) {
- aVertexes(1).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(2).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(3).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(4).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(5).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(6).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(7).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- aVertexes(8).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB));
- //////////////////}
-
- Aspect_Array1OfEdge aEdges(1, 24);
- aEdges(1) = Aspect_Edge(1, 2, Aspect_TOE_VISIBLE);
- aEdges(2) = Aspect_Edge(2, 3, Aspect_TOE_VISIBLE);
- aEdges(3) = Aspect_Edge(3, 4, Aspect_TOE_VISIBLE);
- aEdges(4) = Aspect_Edge(4, 1, Aspect_TOE_VISIBLE);
-
- aEdges(5) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE);
- aEdges(6) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE);
- aEdges(7) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE);
- aEdges(8) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE);
-
- aEdges(9) = Aspect_Edge(1, 5, Aspect_TOE_VISIBLE);
- aEdges(10) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE);
- aEdges(11) = Aspect_Edge(6, 2, Aspect_TOE_VISIBLE);
- aEdges(12) = Aspect_Edge(2, 1, Aspect_TOE_VISIBLE);
-
- aEdges(13) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE);
- aEdges(14) = Aspect_Edge(7, 3, Aspect_TOE_VISIBLE);
- aEdges(15) = Aspect_Edge(3, 2, Aspect_TOE_VISIBLE);
- aEdges(16) = Aspect_Edge(2, 6, Aspect_TOE_VISIBLE);
-
- aEdges(17) = Aspect_Edge(3, 7, Aspect_TOE_VISIBLE);
- aEdges(18) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE);
- aEdges(19) = Aspect_Edge(8, 4, Aspect_TOE_VISIBLE);
- aEdges(20) = Aspect_Edge(4, 3, Aspect_TOE_VISIBLE);
-
- aEdges(21) = Aspect_Edge(4, 8, Aspect_TOE_VISIBLE);
- aEdges(22) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE);
- aEdges(23) = Aspect_Edge(5, 1, Aspect_TOE_VISIBLE);
- aEdges(24) = Aspect_Edge(1, 4, Aspect_TOE_VISIBLE);
-
- aGroup->QuadrangleSet(aVertexes, aEdges);
- }
- }
- aGroup->EndPrimitives();
-
- if (BooleanTimer) {
- Timer.Stop ();
- Timer.Show (cout);
- }
-
-}
#include <QANIC.hxx>
#include <QABUC.hxx>
#include <QAAMINO.hxx>
-#include <QADBMReflex.hxx>
#include <QAMARTEC.hxx>
#include <QAQuickPen.hxx>
#if defined(WOKC40)
QANIC::Commands(theCommands);
QABUC::Commands(theCommands);
QAAMINO::Commands(theCommands);
- QADBMReflex::Commands(theCommands);
QAMARTEC::Commands(theCommands);
QAQuickPen::Commands(theCommands);
#if defined(WOKC40)
QAOCC.cdl
QAOCC.cxx
QAOCC_CMPLRS.edl
-QAOCC_OCC749Prs.cdl
-QAOCC_OCC749Prs.cxx
Quantity
is
- class OCC749Prs;
Commands(DI : in out Interpretor from Draw);
end;
return 0;
}
-#include <QAOCC_OCC749Prs.hxx>
-//=======================================================================
-//function : OCC749_sav
-//purpose :
-//=======================================================================
-static Standard_Integer OCC749_sav (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-
- Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
- if(myAISContext.IsNull()) {
- di << "use 'vinit' command before " << argv[0];
- return 1;
- }
- if(argc != 8) {
- di << "Usage : " << argv[0] << " Reflection(=0/1) R1 G1 B1 R2 G2 B2" << "\n";
- return -1;
- }
-
- Standard_Integer IntegerReflection = atoi(argv[1]);
- Standard_Boolean Reflection;
- if (IntegerReflection == 0) {
- Reflection = Standard_False;
- } else {
- Reflection = Standard_True;
- }
- Standard_Integer R1_Integer = atoi(argv[2]);
- Standard_Integer G1_Integer = atoi(argv[3]);
- Standard_Integer B1_Integer = atoi(argv[4]);
- Standard_Integer R2_Integer = atoi(argv[5]);
- Standard_Integer G2_Integer = atoi(argv[6]);
- Standard_Integer B2_Integer = atoi(argv[7]);
- Quantity_Parameter R1 = R1_Integer / 255.;
- Quantity_Parameter G1 = G1_Integer / 255.;
- Quantity_Parameter B1 = B1_Integer / 255.;
- Quantity_Parameter R2 = R2_Integer / 255.;
- Quantity_Parameter G2 = G2_Integer / 255.;
- Quantity_Parameter B2 = B2_Integer / 255.;
-
- Handle(QAOCC_OCC749Prs) anIntearactiveObject =
- new QAOCC_OCC749Prs(Reflection,
- Quantity_Color(R1, G1, B1, Quantity_TOC_RGB),
- Quantity_Color(R2, G2, B2, Quantity_TOC_RGB));
- myAISContext->Display(anIntearactiveObject);
- return 0;
-}
-
#include <Standard_GUID.hxx>
//=======================================================================
//function : OCC669
//theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC578, group);
theCommands.Add("OCC627", "OCC627", __FILE__, OCC627, group);
- theCommands.Add("OCC749_sav", "OCC749_sav Reflection(=0/1) R1 G1 B1 R2 G2 B2", __FILE__, OCC749_sav, group);
theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
+++ /dev/null
--- File: QAOCC_OCC749Prs.cdl
--- Created: Fri Sep 20 16:32:13 2002
--- Author: Michael KUZMITCHEV
--- <mkv@russox>
----Copyright: Matra Datavision 2002
-
-class OCC749Prs from QAOCC inherits InteractiveObject from AIS
-
-uses
- PresentationManager3d from PrsMgr,
- Presentation from Prs3d,
- Selection from SelectMgr,
- Color from Quantity
-
-is
- Create( reflection : Boolean from Standard;
- color : Color from Quantity;
- color1 : Color from Quantity )
- returns mutable OCC749Prs from QAOCC;
-
- Compute(me : mutable;
- aPresentationManager : PresentationManager3d from PrsMgr;
- aPresentation : mutable Presentation from Prs3d;
- aMode : Integer from Standard = 0)
- is redefined virtual protected;
-
- ComputeSelection(me : mutable;
- aSelection : mutable Selection from SelectMgr;
- aMode : Integer from Standard)
- is redefined virtual protected;
-
- SetReflection( me : mutable; reflection : Boolean from Standard );
-
- SetColor( me : mutable; color : Color from Quantity;
- color1 : Color from Quantity );
-
-fields
- myReflection : Boolean from Standard;
- myColor1 : Color from Quantity;
- myColor2 : Color from Quantity;
-end OCC749Prs;
+++ /dev/null
-// File: QAOCC_OCC749Prs.cxx
-// Created: Fri Sep 20 16:33:40 2002
-// Author: Michael KUZMITCHEV
-// <mkv@russox>
-
-
-#include <QAOCC_OCC749Prs.ixx>
-
-#include <Prs3d_Root.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Vertex.hxx>
-#include <Aspect_Array1OfEdge.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_MaterialAspect.hxx>
-#include <Quantity_Color.hxx>
-#include <Graphic3d_Array1OfVertexC.hxx>
-#include <Aspect_Edge.hxx>
-
-QAOCC_OCC749Prs::QAOCC_OCC749Prs( const Standard_Boolean reflection,
- const Quantity_Color& color,
- const Quantity_Color& color1 ) :
-myReflection( reflection ), myColor1( color ), myColor2( color1 )
-{
-}
-
-void QAOCC_OCC749Prs::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr,
- const Handle(Prs3d_Presentation)& aPrs,
- const Standard_Integer aMode )
-{
- aPrs->Clear();
- Handle(Graphic3d_Group) group = Prs3d_Root::NewGroup( aPrs );
-
- Handle_Graphic3d_AspectFillArea3d CTX=new Graphic3d_AspectFillArea3d();
- CTX->SetInteriorStyle(Aspect_IS_SOLID);
- group->SetGroupPrimitivesAspect(CTX);
-
- Graphic3d_MaterialAspect material = CTX->FrontMaterial();
- if ( !myReflection ) {
- material.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
- material.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
- material.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
- material.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
- }
- CTX->SetFrontMaterial(material);
- group->SetPrimitivesAspect(CTX);
-
- Graphic3d_Array1OfVertexC anArray( 1,4 );
- anArray(1).SetCoord( 0.,0.,0 );
- anArray(1).SetColor( myColor1 );
- anArray(2).SetCoord( 50., 0., 0 );
- anArray(2).SetColor( myColor1 );
- anArray(3).SetCoord( 50., 50, 0 );
- anArray(3).SetColor( myColor2 );
- anArray(4).SetCoord( 0., 50., 0 );
- anArray(4).SetColor( myColor2 );
- Aspect_Edge aE1(1,2,Aspect_TOE_VISIBLE);
- Aspect_Edge aE2(2,3,Aspect_TOE_VISIBLE);
- Aspect_Edge aE3(3,4,Aspect_TOE_VISIBLE);
- Aspect_Edge aE4(4,1,Aspect_TOE_VISIBLE);
- Aspect_Array1OfEdge anEdges(1,4);
- anEdges.SetValue(1,aE1);
- anEdges.SetValue(2,aE2);
- anEdges.SetValue(3,aE3);
- anEdges.SetValue(4,aE4);
- group->QuadrangleSet(anArray,anEdges);
-}
-
-void QAOCC_OCC749Prs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
- const Standard_Integer aMode)
-{
-}
-
-void QAOCC_OCC749Prs::SetReflection( const Standard_Boolean reflection )
-{
- myReflection = reflection;
-}
-
-void QAOCC_OCC749Prs::SetColor( const Quantity_Color& color,
- const Quantity_Color& color1 )
-{
- myColor1 = color;
- myColor2 = color1;
-}
QABUC
QACADCAM
QACEADRT
-QADBMReflex
QADNaming
QADraw
QAInsynchro
#include <Aspect_TypeOfLine.hxx>
#include <Graphic3d_CUserDraw.hxx>
-
-#include <OpenGl_tgl_all.hxx>
-#include <OpenGl_tsm.hxx>
-#include <OpenGl_telem.hxx>
-#include <OpenGl_callback.hxx>
+#include <InterfaceGraphic_telem.hxx>
+#include <OpenGl_Element.hxx>
+#include <OpenGl_Callback.hxx>
+#include <OpenGl_NamedStatus.hxx>
#include <GL/gl.h>
#include <GL/glu.h>
/**************************************************************************/
-TStatus VisAdd(TSM_ELEM_DATA d, Tint n, cmn_key * k)
+
+class VoxelClient_VisDrawer::VisElement : public OpenGl_Element
{
- // Retrieve the userdraw structure
- Graphic3d_CUserDraw *userdraw = (Graphic3d_CUserDraw *) (k[0]->data.pdata);
+public:
+
+ VisElement (Voxel_VisData*);
+ virtual ~VisElement();
- if(!userdraw)
- return TFailure;
+ void EvaluateBounds (Graphic3d_CBounds& theMinMax);
- // Retrieve the user structure
- Voxel_VisData *userdata = (Voxel_VisData *) (userdraw->Data);
+ void Render (const Handle(OpenGl_Workspace) &theWorkspace) const;
- if(!userdata)
- return TFailure;
+private:
- // Create the handler
- VoxelClient_VisDrawer *handler = new VoxelClient_VisDrawer(userdata);
+ VoxelClient_VisDrawer* myHandler;
- ((tsm_elem_data) (d.pdata))->pdata = (void *) handler;
+public:
- // Evaluate minmax if needed
- if(userdraw->Bounds)
- handler->EvalMinMax(*(userdraw->Bounds));
+ IMPLEMENT_MEMORY_OPERATORS
- return TSuccess;
+};
+
+//=======================================================================
+//function : VisElement
+//purpose : Constructor
+//=======================================================================
+
+VoxelClient_VisDrawer::VisElement::VisElement (Voxel_VisData* theData)
+{
+ myHandler = new VoxelClient_VisDrawer (theData);
}
-/**************************************************************************/
-TStatus VisDelete(TSM_ELEM_DATA d, Tint n, cmn_key * k)
+//=======================================================================
+//function : ~VisElement
+//purpose : Destructor
+//=======================================================================
+
+VoxelClient_VisDrawer::VisElement::~VisElement ()
{
- delete (VoxelClient_VisDrawer*) (d.pdata);
- return TSuccess;
+ delete myHandler;
}
-/**************************************************************************/
-TStatus VisDisplay(TSM_ELEM_DATA d, Tint n, cmn_key * k)
+//=======================================================================
+//function : EvaluateBounds
+//purpose :
+//=======================================================================
+
+void VoxelClient_VisDrawer::VisElement::EvaluateBounds
+ (Graphic3d_CBounds& theMinMax)
+{
+ myHandler->EvalMinMax (theMinMax);
+}
+
+//=======================================================================
+//function : Render
+//purpose : display element
+//=======================================================================
+
+void VoxelClient_VisDrawer::VisElement::Render
+ (const Handle (OpenGl_Workspace) &theWorkspace) const
{
- const Standard_Boolean hl = (n ? (k[0]->id == TOn) : Standard_False);
+ const Standard_Boolean aHl = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT);
+ myHandler->Display (aHl);
+}
+
+//=======================================================================
+//function : VisDrawerCallBack
+//purpose : visdrawer element create callback, adds an element to graphic
+// driver's structure
+//=======================================================================
+
+static OpenGl_Element* VisDrawerCallBack (const Graphic3d_CUserDraw* theUserDraw)
+{
+ if (theUserDraw == 0)
+ return 0;
+
+ // Retrieve the user structure
+ Voxel_VisData* aUserData = (Voxel_VisData*) (theUserDraw->Data);
+
+ if (aUserData == 0)
+ return 0;
+
+ VoxelClient_VisDrawer::VisElement *aElem =
+ new VoxelClient_VisDrawer::VisElement (aUserData);
+
+ if (theUserDraw->Bounds != 0)
+ aElem->EvaluateBounds (*(theUserDraw->Bounds));
- ((VoxelClient_VisDrawer *) (d.pdata))->Display(hl);
- return TSuccess;
+ return aElem;
}
/**************************************************************************/
if (!isInitializeded)
{
isInitializeded = Standard_True;
- MtblPtr cb = GetCallbackTable();
- cb[DisplayTraverse] = VisDisplay;
- cb[Add] = VisAdd;
- cb[Delete] = VisDelete;
+ OpenGl_UserDrawCallback& aCallback = UserDrawCallback ();
+ aCallback = VisDrawerCallBack;
}
}
#include "Voxel_VisData.h"
#include <Graphic3d_CBounds.hxx>
-class VoxelClient_VisDrawer
+class VoxelClient_VisDrawer
{
+public:
+
+ class VisElement;
+
public:
Standard_EXPORT static void Init();