InterfaceGraphic.hxx
InterfaceGraphic_Aspect.hxx
InterfaceGraphic_Graphic3d.hxx
-InterfaceGraphic_Labels.hxx
-InterfaceGraphic_Portability.hxx
InterfaceGraphic_Visual3d.hxx
InterfaceGraphic_WNT.hxx
InterfaceGraphic_X11.hxx
+++ /dev/null
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#ifndef LABELS_HXX_INCLUDED
-#define LABELS_HXX_INCLUDED
-
-/* gestion des labels */
-
-/* structure, begin */
-#define Structure_LABBegin 0
-
-/* structure, transformation */
-#define Structure_LABTransformation 1
-
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-/*#define Structure_LABTransPersistenceFlag 2*/
-#define Structure_LABTransPersistence 2
-/*#define Structure_LABTransPersistencePoint 3*/
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
-/* structure, attributes */
-#define Structure_LABContextLine 11
-#define Structure_LABContextFillArea 12
-#define Structure_LABContextMarker 13
-#define Structure_LABContextText 14
-
-/* structure, highlight, visibility, pick */
-#define Structure_LABHighlight 21
-#define Structure_LABVisibility 22
-#define Structure_LABPick 23
-#define Structure_LABNameSet 31
-
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-/*#define Structure_LABTransPersistence 32*/
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
-
-/* structure, hierarchy */
-#define Structure_LABConnect 33
-
-/* view, index */
-#define View_LABViewIndex 10
-
-/* view, context */
-#define View_LABViewContext 15
-
-/* view, hlhsr */
-#define View_LABHlhsr 20
-
-/* view, light source management */
-#define View_LABLight 25
-
-/* view, clip plane management */
-#define View_LABPlane 30
-
-/* view, aliasing management */
-#define View_LABAliasing 35
-
-/* view, depth cueing management */
-#define View_LABDepthCueing 40
-
-/* view, priority management */
-#define View_LABPriority10 100
-#define View_LABPriority09 99
-#define View_LABPriority08 98
-#define View_LABPriority07 97
-#define View_LABPriority06 96
-#define View_LABPriority05 95
-#define View_LABPriority04 94
-#define View_LABPriority03 93
-#define View_LABPriority02 92
-#define View_LABPriority01 91
-#define View_LABPriority00 90
-
-/* view, end */
-#define View_LABEnd 200
-
-/* view, transient emulation */
-#define View_LABImmediat1 301
-#define View_LABImmediat2 302
-
-#endif
+++ /dev/null
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-#ifndef InterfaceGraphic_PortabilityHeader
-#define InterfaceGraphic_PortabilityHeader
-
-/* structures pour portabilite des differents Phigs */
-/* SUNPHIGS, DECPHIGS, TGSPHIGS, G5GPHIGS, PEX */
-
-/***********************************************************************/
-/******************************** CONST ********************************/
-/***********************************************************************/
-
-#define CALL_DEF_ENABLE_MODE_PAINTERS 0
-#define CALL_DEF_ENABLE_MODE_ZBUFFER 1
-#define CALL_DEF_DISABLE_MODE_ZBUFFER -1
-#define CALL_DEF_ENABLE_ZBUFFER 2
-#define CALL_DEF_DISABLE_ZBUFFER -2
-#define CALL_DEF_TEST_CALL -99999
-
-/***********************************************************************/
-/********************************* DATA ********************************/
-/***********************************************************************/
-
-typedef struct {
- int size;
- char *data;
-} CALL_DEF_DATA;
-
-/***********************************************************************/
-/********************************** 2D *********************************/
-/***********************************************************************/
-
-typedef struct {
- float x;
- float y;
-} CALL_DEF_POINT2;
-
-typedef struct {
- float x;
- float y;
-} CALL_DEF_VECTOR2;
-
-/***********************************************************************/
-/********************************** 3D *********************************/
-/***********************************************************************/
-
-typedef struct {
- float x;
- float y;
- float z;
-} CALL_DEF_POINT3;
-
-typedef struct {
- float x;
- float y;
- float z;
-} CALL_DEF_VECTOR3;
-
-/***********************************************************************/
-/********************************* VIEW ********************************/
-/***********************************************************************/
-
-typedef float CALL_DEF_MATRIX3[4][4];
-
-typedef struct {
- float x_min;
- float x_max;
- float y_min;
- float y_max;
-} CALL_DEF_LIMIT;
-
-typedef struct {
- float x_min;
- float x_max;
- float y_min;
- float y_max;
- float z_min;
- float z_max;
-} CALL_DEF_LIMIT3;
-
-typedef struct {
- CALL_DEF_MATRIX3 ori_matrix;
- CALL_DEF_MATRIX3 map_matrix;
- CALL_DEF_LIMIT3 clip_limit;
- int xy_clip;
- int back_clip;
- int front_clip;
-
-#ifdef TGSPHIGS
- int opacity;
- int back_colr;
- int outline;
- int outline_colr;
- int temporary;
- int active;
-#endif
-} CALL_DEF_VIEWREP3;
-
-typedef struct {
- CALL_DEF_LIMIT win;
- CALL_DEF_LIMIT3 proj_vp;
- int proj_type;
- CALL_DEF_POINT3 proj_ref_point;
- float view_plane;
-
-#if defined (SUNPHIGS) || defined (TGSPHIGS) || defined (G5GPHIGS) || defined (HPPHIGS) || defined (PEX5)
- float back_plane;
- float front_plane;
-#endif
-#ifdef DECPHIGS
- float front_plane;
- float back_plane;
-#endif
-} CALL_DEF_VIEWMAP3;
-
-/***********************************************************************/
-/********************************* LIGHT *******************************/
-/***********************************************************************/
-
-typedef struct {
- int num_ints;
- int *ints;
-} CALL_DEF_INTLIST;
-
-typedef struct {
- float r;
- float g;
- float b;
-} CALL_DEF_RGB;
-
-typedef struct {
- int colr_type;
- CALL_DEF_RGB colr;
-} CALL_DEF_AMBLIGHTSRCREC;
-
-typedef struct {
- int colr_type;
- CALL_DEF_RGB colr;
- CALL_DEF_VECTOR3 dir;
-} CALL_DEF_DIRLIGHTSRCREC;
-
-typedef struct {
- int colr_type;
- CALL_DEF_RGB colr;
- CALL_DEF_POINT3 pos;
- float coef[2];
-} CALL_DEF_POSLIGHTSRCREC;
-
-typedef struct {
- int colr_type;
- CALL_DEF_RGB colr;
- CALL_DEF_POINT3 pos;
- CALL_DEF_VECTOR3 dir;
- float exp;
- float coef[2];
- float angle;
-} CALL_DEF_SPOTLIGHTSRCREC;
-
-typedef union {
- CALL_DEF_AMBLIGHTSRCREC ambient;
- CALL_DEF_DIRLIGHTSRCREC directional;
- CALL_DEF_POSLIGHTSRCREC positional;
- CALL_DEF_SPOTLIGHTSRCREC spot;
-} CALL_DEF_LIGHTSRCREC;
-
-typedef struct {
- int type;
- CALL_DEF_LIGHTSRCREC rec;
-} CALL_DEF_LIGHTSRCBUNDLE;
-
-/***********************************************************************/
-/**************************** CLIPPING PLANE ***************************/
-/***********************************************************************/
-
-typedef struct {
- float a;
- float b;
- float c;
- float d;
- CALL_DEF_POINT3 point;
- CALL_DEF_VECTOR3 norm;
-} CALL_DEF_HALF_SPACE;
-
-typedef struct {
- int num_half_spaces;
- CALL_DEF_HALF_SPACE *half_spaces;
-} CALL_DEF_HALF_SPACE_LIST;
-
-typedef struct {
- int op;
- CALL_DEF_HALF_SPACE_LIST half_spaces;
-} CALL_DEF_PLANEBUNDLE;
-
-/***********************************************************************/
-/******************************** SCREEN *******************************/
-/***********************************************************************/
-
-typedef struct {
- int size_x;
- int size_y;
-} CALL_DEF_INT_SIZE;
-
-typedef struct {
- float size_x;
- float size_y;
-} CALL_DEF_FLOAT_SIZE;
-
-typedef struct {
- int dc_units;
- CALL_DEF_FLOAT_SIZE size_dc;
- CALL_DEF_INT_SIZE size_raster;
-} CALL_DEF_DISP_SPACE_SIZE;
-
-/***********************************************************************/
-/********************************* TEXT ********************************/
-/***********************************************************************/
-
-typedef struct {
- int horizontal;
- int vertical;
-} CALL_DEF_TEXT_ALIGN;
-
-#endif /* InterfaceGraphic_PortabilityHeader */
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-/*
-File: InterfaceGraphic_telem.h
-
-16/06/2000 : ATS : G005 : Copied from OpenGl_telem.h to support required
-for InterfaceGraphic_Parray.hxx definitions
-
-22/03/2004 : SAN : OCC4895 High-level interface for controlling polygon offsets
-
-20/05/2005 : SAN : OCC8854 Number of color components increased to include alpha value
-
-*/
-
-#ifndef INTERFACEGRAPHIC_TELEM_H
-#define INTERFACEGRAPHIC_TELEM_H
+#ifndef INTERFACEGRAPHIC_TELEM_H
+#define INTERFACEGRAPHIC_TELEM_H
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
};
typedef TEL_COLOUR* tel_colour;
-struct TEL_POINT_DATA
-{
- int num;
- TEL_POINT* data;
- DEFINE_STANDARD_ALLOC
-};
-typedef TEL_POINT_DATA* tel_point_data;
-
-struct TEL_TINT_DATA
-{
- int num;
- int* data;
- DEFINE_STANDARD_ALLOC
-};
-typedef TEL_TINT_DATA* tel_tint_data;
-
-struct TEL_MATRIX3_DATA
-{
- TComposeType mode;
- Tmatrix3 mat;
- DEFINE_STANDARD_ALLOC
-};
-typedef TEL_MATRIX3_DATA* tel_matrix3_data;
-
-struct TEL_ALIGN_DATA
-{
- Tint Hmode;
- Tint Vmode;
- DEFINE_STANDARD_ALLOC
-};
-typedef TEL_ALIGN_DATA* tel_align_data;
-
typedef enum
{
TLightAmbient,
TLightSpot
} TLightType;
-typedef enum
-{
- TelHLColour,
- TelHLForcedColour
-} THighlightType;
-
-typedef enum
-{
- TelDCSuppressed,
- TelDCAllowed
-} TDepthCueType;
-
-/* Proprietes materiels */
-struct TEL_SURF_PROP
-{
- float amb, diff, spec, emsv;
- float trans, shine;
- float env_reflexion;
- int isamb, isdiff, isspec, isemsv;
- int isphysic;
- TEL_COLOUR speccol, difcol, ambcol, emscol, matcol;
- DEFINE_STANDARD_ALLOC
-};
-typedef TEL_SURF_PROP* tel_surf_prop;
-
typedef enum
{
TelCullNone,
TelCullBack
} TelCullMode;
-/* Interior Styles */
-#define TSM_SOLID 1
-#define TSM_HOLLOW 2
-#define TSM_EMPTY 3
-#define TSM_HATCH 4
-#define TSM_POINT 5
-#define TSM_HIDDENLINE 6
-
-/* Standard Line Styles */
-#define TEL_LS_SOLID 0
-#define TEL_LS_DOT 2
-#define TEL_LS_DASH_DOT 3
-#define TEL_LS_DASH 1
-#define TEL_LS_DOUBLE_DOT_DASH 4
-
-#define TEL_LS_USER_DEF_START 10
-
/* Standard Hatch Styles */
#define TEL_HS_SOLID 0
#define TEL_HS_CROSS 1
#define TEL_HS_USER_DEF_START 15
-#define TEL_SHAPE_UNKNOWN 1
-#define TEL_SHAPE_COMPLEX 2
-#define TEL_SHAPE_CONCAVE 3
-#define TEL_SHAPE_CONVEX 4
-
-/* Key ids for area type primitives */
-#define NUM_FACETS_ID 1 /* key.data.ldata contains no. of facets */
-#define FNORMALS_ID 2 /* key.data.pdata is array of TEL_POINT */
-#define FACET_COLOUR_VALS_ID 3 /* key.data.pdata is array of TSM_COLOUR */
-#define VERTICES_ID 4 /* key.data.pdata is array of TEL_POINT */
-#define VERTEX_COLOUR_VALS_ID 5 /* key.data.pdata is array of TSM_COLOUR */
-#define VNORMALS_ID 6 /* key.data.pdata is array of TEL_POINT */
-#define NUM_VERTICES_ID 7 /* key.data.ldata is num of vertices */
-#define SHAPE_FLAG_ID 8 /* key.data.ldata is shape flag */
-#define EDGE_DATA_ID 9 /* key.data.pdata is edge data (Tint*) */
-#define CONNECTIVITY_ID 10 /* key.data.pdata is conn data (Tint*) */
-#define BOUNDS_DATA_ID 11 /* key.data.pdata is bounds data (Tint*) */
-#define NUM_LINES_ID 12 /* key.data.ldata is number of lines */
-#define NUM_ROWS_ID 13 /* key.data.ldata is number of rows */
-#define NUM_COLUMNS_ID 14 /* key.data.ldata is number of columns */
-#define VTEXTURECOORD_ID 15 /* key.data.pdata is array of TEL_TEXTURE_COORD */
-
-#define PARRAY_ID 16 /* key.data.pdata is a primitive array */
-
-/* Key ids for text primitives */
-#define TEXT_ATTACH_PT_ID 1 /* key.data.pdata contains tel_point */
-#define TEXT_STRING_ID 2 /* key.data.pdata contains Tchar * */
-
-
-/* Key ids for curve primitives */
-#define CURVE_TYPE_ID 1 /* key.data.ldata is curve type */
-/* TelCurveType :
-* Bezier
-* Cardinal
-* BSpline
-*/
-#define CURVE_NUM_POINTS_ID 2 /* key.data.ldata is num of points */
-#define CURVE_VERTICES_ID 3 /* key.data.pdata is array of TEL_POINT */
-
-
-/* Polymarker Types */
-#define TEL_PM_PLUS 0
-#define TEL_PM_STAR 1
-#define TEL_PM_CROSS 2
-#define TEL_PM_CIRC 3
-#define TEL_PM_DOT 4
-#define TEL_PM_USERDEFINED 5
-
-#define TEL_PM_USER_DEF_START 7
-
-#define TEL_SD_SHADING 0
-#define TEL_SD_TEXTURE 1
-
#define TEL_SM_FLAT 1
#define TEL_SM_GOURAUD 2
-#define TEL_POLYMARKER_FONT (short)1
-
/* Standard Lighting Models */
#define TEL_FRONT_BACK_LM 1
#define TEL_FRONT_MATERIAL 1
#define TEL_BACK_MATERIAL 2
-/* facet flags */
-#define TEL_FAFLAG_NONE 1
-#define TEL_FAFLAG_NORMAL 2
-#define TEL_FAFLAG_COLOUR 3
-#define TEL_FAFLAG_COLOURNORMAL 4
-
-/* internal use */
-#define TEL_FA_NONE TEL_FAFLAG_NONE
-#define TEL_FA_NORMAL TEL_FAFLAG_NORMAL
-
-/* vertex flags */
-#define TEL_VTFLAG_NONE 1
-#define TEL_VTFLAG_NORMAL 2
-#define TEL_VTFLAG_COLOUR 3
-#define TEL_VTFLAG_COLOURNORMAL 4
-
-/* internal use */
-#define TEL_VT_NONE TEL_VTFLAG_NONE
-#define TEL_VT_NORMAL TEL_VTFLAG_NORMAL
-
-/* Defbasis identifier */
-#define TEL_BEZIER 1
-#define TEL_CARDINAL 2
-#define TEL_BSPLINE 3
-
-typedef enum
-{
- TelBezierCurve = TEL_BEZIER,
- TelCardinalCurve = TEL_CARDINAL,
- TelBSplineCurve = TEL_BSPLINE
-} TelCurveType;
-
-typedef enum
-{
- TelHLHSRNone,
- TelHLHSRZBuff
-
-} TelHLHSRId;
-
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
struct TEL_POFFSET_PARAM
{
int mode;
DEFINE_STANDARD_ALLOC
};
typedef TEL_POFFSET_PARAM* tel_poffset_param;
-/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
struct TEL_TRANSFORM_PERSISTENCE
{
int mode;
DEFINE_STANDARD_ALLOC
};
typedef TEL_TRANSFORM_PERSISTENCE* tel_transform_persistence;
-/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
#endif /* INTERFACEGRAPHIC_TELEM_H */
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-/*
-File InterfaceGraphic_tgl_all.h
-
-16/06/2000 : ATS : G005 : Copied from OpenGl_tgl_all.h to support required
-for InterfaceGraphic_Parray.hxx definitions
-23-12-02 : SAV ; Added Tuint type
-*/
-
#ifndef INTERFACEGRAPHIC_TGL_ALL_H
#define INTERFACEGRAPHIC_TGL_ALL_H
typedef int Tint;
typedef float Tfloat;
-/* PCD 04/07/07 */
typedef double Tdouble;
/* Tchar is treated as a signed char in visualization code,
therefore it should be made signed explicitly, as on Linux
/* szv: Techar is an Extended character */
typedef unsigned short Techar;
-#define TGL_SP 1
-#define TGL_DP 0
-
-#if TGL_DP
-#define v3f v3d
-#define c3f c3d
-#define n3f n3d
-#endif
-
-typedef enum
-{
- TFailure = -1,
- TSuccess
-} TStatus;
-
#define TOn 1
#define TOff 0
-#define TDone 1
-#define TNotDone 0
-
typedef Tfloat Tmatrix3[4][4];
-typedef enum
-{
- TPreConcatenate,
- TPostConcatenate,
- TReplace
-} TComposeType;
-
#endif /* INTERFACEGRAPHIC_TGL_ALL_H */
OpenGl_Text.cxx
OpenGl_TextFormatter.hxx
OpenGl_TextFormatter.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_PrimitiveArray.hxx
OpenGl_PrimitiveArray.cxx
Handle_OpenGl_Workspace.hxx
{
switch (aNodeIter->type)
{
- case TelPolyline:
case TelMarker:
case TelMarkerSet:
case TelText:
aNodeIter->elem->Render (theWorkspace);
break;
}
-
- case TelPolygon:
- case TelPolygonIndices:
- case TelQuadrangle:
- case TelTriangleMesh:
- {
- if (isImmediate)
- {
- glDepthMask(GL_FALSE);
- }
-
- if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
- {
- theWorkspace->DisablePolygonOffset();
- }
-
- aNodeIter->elem->Render (theWorkspace);
-
- if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
- {
- theWorkspace->EnablePolygonOffset();
- }
- break;
- }
-
default:
{
aNodeIter->elem->Render (theWorkspace);
+++ /dev/null
-// Created on: 2011-07-13
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#include <OpenGl_GlCore11.hxx>
-
-#include <OpenGl_Polygon.hxx>
-
-#include <OpenGl_telem_util.hxx>
-
-#include <OpenGl_AspectFace.hxx>
-#include <OpenGl_Structure.hxx>
-#include <OpenGl_Workspace.hxx>
-
-#if (defined(_WIN32) || defined(__WIN32__))
- #define STATIC
-#else
- #define STATIC static
-#endif
-
-struct EXTRA_VERTEX
-{
- GLfloat vert[3];
- int ind;
- DEFINE_STANDARD_ALLOC
-};
-typedef EXTRA_VERTEX* extra_vertex;
-
-struct SEQ_
-{
- NCollection_Vector<void *> tmesh_sequence;
- GLenum triangle_type; /* FSXXX OPTI */
- DEFINE_STANDARD_ALLOC
-};
-
-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 */
-
-static const TEL_POLYGON_DATA *DaTa;
-static GLUtesselator *tripak = 0;
-
-STATIC void APIENTRY
-out_bgntmesh( GLenum triangle_type )
-{
- NCollection_Vector<SEQ_> *dis = DaTa->dsply;
-
- SEQ_ aSeq;
-#ifdef JWR_DEC_TRIFAN_BUG
- aSeq.triangle_type = GL_POLYGON;
- dis->Append(aSeq);
- glBegin(GL_POLYGON);
-#else
- aSeq.triangle_type = triangle_type;
- dis->Append(aSeq);
- glBegin(triangle_type);
-#endif
-}
-
-/*----------------------------------------------------------------------*/
-
-STATIC void APIENTRY
-out_vert1( void *data )
-{
- SEQ_ &s = DaTa->dsply->ChangeValue(DaTa->dsply->Length() - 1);
-
- s.tmesh_sequence.Append(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->ChangeValue(DaTa->dsply->Length() - 1);
-
- s.tmesh_sequence.Append(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->ChangeValue(DaTa->dsply->Length() - 1);
-
- s.tmesh_sequence.Append(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 = new 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* theEdgeColor,
- const Aspect_InteriorStyle theInteriorStyle,
- const Handle(OpenGl_Workspace)& theWorkspace) const
-{
- const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace (Standard_True);
-
- if (theInteriorStyle != Aspect_IS_HIDDENLINE
- && anAspectFace->Edge == TOff)
- {
- return;
- }
-
- glDisable (GL_LIGHTING);
- const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture();
-
- // Setup line aspect
- const OpenGl_AspectLine* aPrevAspectLine = theWorkspace->SetAspectLine (anAspectFace->AspectEdge());
- theWorkspace->AspectLine (Standard_True);
-
- glColor3fv (theEdgeColor->rgb);
-
- glBegin (GL_LINE_LOOP);
- tel_point ptr = myData.vertices;
- for (Tint i = 0; i < myData.num_vertices; i++, ptr++)
- {
- glVertex3fv (ptr->xyz);
- }
- glEnd();
-
- // Restore line context
- theWorkspace->SetAspectLine (aPrevAspectLine);
-
- theWorkspace->EnableTexture (aPrevTexture);
-}
-
-/*----------------------------------------------------------------------*/
-
-void OpenGl_Polygon::draw_tmesh ( Tint v ) const
-{
- Tint i, j, k;
- SEQ_ *s;
- extra_vertex b;
-
- NCollection_Vector<SEQ_> *dis = myData.dsply;
- for( i = 0; i < dis->Length(); i++ )
- {
- s = &(dis->ChangeValue(i));
-
- glBegin(s->triangle_type);
- switch( v )
- {
- case 1:
- {
- for( j = 0, k = 0; j < s->tmesh_sequence.Length(); j++ )
- {
- if ( s->tmesh_sequence(j) < (void *)0xffff )
- glVertex3fv( myData.vertices[ (long)s->tmesh_sequence.Value(j) ].xyz );
- else {
- b = (extra_vertex) s->tmesh_sequence(j);
- glVertex3fv( b->vert );
- }
-
- }
- break;
- }
- case 2:
- {
- for( j = 0, k = 0; j < s->tmesh_sequence.Length(); 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->tmesh_sequence.Length(); 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 NCollection_Vector<SEQ_>();
-}
-
-/*----------------------------------------------------------------------*/
-
-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->Length(); i++ )
- {
- for ( j = 0; j < myData.dsply->Value(i).tmesh_sequence.Length() ; j++ )
- {
- if ( myData.dsply->Value(i).tmesh_sequence(j) >= (void *)0xffff )
- delete myData.dsply->Value(i).tmesh_sequence(j);
- }
- }
-
- 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->IntFront.color_mask;
- const Aspect_InteriorStyle interior_style = aspect_face->InteriorStyle;
- const TEL_COLOUR *interior_colour = &aspect_face->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)
- {
- 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);
-
- draw_edges ( edge_colour, interior_style, AWorkspace );
-
- glPopAttrib(); /* skt: GL_ENABLE_BIT*/
-}
-
-void OpenGl_Polygon::Release (const Handle(OpenGl_Context)& theContext)
-{
- //
-}
+++ /dev/null
-// Created on: 2011-07-13
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-#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>
-
-#include <NCollection_Vector.hxx>
-
-struct SEQ_;
-
-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 */
- NCollection_Vector<SEQ_> *dsply;
- DEFINE_STANDARD_ALLOC
-};
-
-class OpenGl_Polygon : public OpenGl_Element
-{
-
-public:
-
- OpenGl_Polygon (const Graphic3d_Array1OfVertex& AListVertex,
- const Graphic3d_TypeOfPolygon AType);
-
- virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
- virtual void Release (const Handle(OpenGl_Context)& theContext);
-
-protected:
-
- virtual ~OpenGl_Polygon();
-
- 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:
-
- DEFINE_STANDARD_ALLOC
-
-};
-
-#endif //OpenGl_Polygon_Header
+++ /dev/null
-// Created on: 2011-07-13
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#include <OpenGl_GlCore11.hxx>
-
-#include <OpenGl_Polyline.hxx>
-
-#include <OpenGl_AspectLine.hxx>
-#include <OpenGl_Structure.hxx>
-#include <OpenGl_Workspace.hxx>
-
-/*----------------------------------------------------------------------*/
-
-OpenGl_Polyline::OpenGl_Polyline (const Graphic3d_Array1OfVertex& AListVertex)
-: myNbVertices(AListVertex.Length()),
- myVertices(NULL)
-{
- myVertices = new TEL_POINT[myNbVertices];
- memcpy( myVertices, &AListVertex(AListVertex.Lower()), myNbVertices*sizeof(TEL_POINT) );
-}
-
-/*----------------------------------------------------------------------*/
-
-OpenGl_Polyline::~OpenGl_Polyline()
-{
- delete[] myVertices;
-}
-
-void OpenGl_Polyline::Release (const Handle(OpenGl_Context)& theContext)
-{
- //
-}
-
-/*----------------------------------------------------------------------*/
-
-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 (GL_LINE_STRIP);
-
- // 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);
-
- glEnd();
-
- glPopAttrib();
-}
+++ /dev/null
-// Created on: 2011-07-13
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-#ifndef OpenGl_Polyline_Header
-#define OpenGl_Polyline_Header
-
-#include <InterfaceGraphic_telem.hxx>
-
-#include <OpenGl_Element.hxx>
-
-#include <Graphic3d_Array1OfVertex.hxx>
-
-class OpenGl_Polyline : public OpenGl_Element
-{
-
-public:
-
- OpenGl_Polyline (const Graphic3d_Array1OfVertex& AListVertex);
-
- virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
- virtual void Release (const Handle(OpenGl_Context)& theContext);
-
-protected:
-
- virtual ~OpenGl_Polyline();
-
-protected:
-
- Tint myNbVertices; // Number of vertices in vertices array
- tel_point myVertices; // Vertices array of length myNbVertices
-
-public:
-
- DEFINE_STANDARD_ALLOC
-
-};
-
-#endif //OpenGl_Polyline_Header
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
#include <OpenGl_GlCore11.hxx>
#include <OpenGl_Structure.hxx>
-#include <OpenGl_Polyline.hxx>
#include <OpenGl_Workspace.hxx>
+#include <OpenGl_Vec.hxx>
#include <OpenGl_View.hxx>
#include <OpenGl_telem_util.hxx>
+//! Auxiliary class for bounding box presentation
+class OpenGl_BndBoxPrs : public OpenGl_Element
+{
+
+public:
+
+ //! Main constructor
+ OpenGl_BndBoxPrs (const CALL_DEF_BOUNDBOX& theBndBox)
+ {
+ const float Xm = theBndBox.Pmin.x;
+ const float Ym = theBndBox.Pmin.y;
+ const float Zm = theBndBox.Pmin.z;
+ const float XM = theBndBox.Pmax.x;
+ const float YM = theBndBox.Pmax.y;
+ const float ZM = theBndBox.Pmax.z;
+ myVerts[0] = OpenGl_Vec3 (Xm, Ym, Zm);
+ myVerts[1] = OpenGl_Vec3 (Xm, Ym, ZM);
+ myVerts[2] = OpenGl_Vec3 (Xm, YM, ZM);
+ myVerts[3] = OpenGl_Vec3 (Xm, YM, Zm);
+ myVerts[4] = OpenGl_Vec3 (Xm, Ym, Zm);
+ myVerts[5] = OpenGl_Vec3 (XM, Ym, Zm);
+ myVerts[6] = OpenGl_Vec3 (XM, Ym, ZM);
+ myVerts[7] = OpenGl_Vec3 (XM, YM, ZM);
+ myVerts[8] = OpenGl_Vec3 (XM, YM, Zm);
+ myVerts[9] = OpenGl_Vec3 (XM, Ym, Zm);
+ myVerts[10] = OpenGl_Vec3 (XM, YM, Zm);
+ myVerts[11] = OpenGl_Vec3 (Xm, YM, Zm);
+ myVerts[12] = OpenGl_Vec3 (Xm, YM, ZM);
+ myVerts[13] = OpenGl_Vec3 (XM, YM, ZM);
+ myVerts[14] = OpenGl_Vec3 (XM, Ym, ZM);
+ myVerts[15] = OpenGl_Vec3 (Xm, Ym, ZM);
+ }
+
+ //! Render presentation
+ virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const
+ {
+ // Apply line aspect
+ const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True);
+ const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture();
+
+ glDisable (GL_LIGHTING);
+ if ((theWorkspace->NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) != 0)
+ {
+ glDepthMask (GL_FALSE);
+ }
+
+ // Use highlight colors
+ glColor3fv ((theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) ? theWorkspace->HighlightColor->rgb : anAspectLine->Color().rgb);
+
+ glEnableClientState (GL_VERTEX_ARRAY);
+ glVertexPointer (3, GL_FLOAT, 0, (GLfloat* )&myVerts);
+ glDrawArrays (GL_LINE_STRIP, 0, 16);
+ glDisableClientState (GL_VERTEX_ARRAY);
+
+ // restore aspects
+ if (!aPrevTexture.IsNull())
+ {
+ theWorkspace->EnableTexture (aPrevTexture);
+ }
+ }
+
+ //! Release graphical resources
+ virtual void Release (const Handle(OpenGl_Context)& )
+ {
+ //
+ }
+
+protected:
+
+ //! Protected destructor
+ virtual ~OpenGl_BndBoxPrs() {}
+
+private:
+
+ OpenGl_Vec3 myVerts[16]; //!< vertices array
+
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+};
/*----------------------------------------------------------------------*/
aContextLine.Width = 1.0f;
myHighlightBox->SetAspectLine (aContextLine);
-#define CALL_MAX_BOUNDBOXSIZE 16
-
- Graphic3d_Array1OfVertex aPoints (1, CALL_MAX_BOUNDBOXSIZE);
- const float Xm = theBoundBox.Pmin.x;
- const float Ym = theBoundBox.Pmin.y;
- const float Zm = theBoundBox.Pmin.z;
- const float XM = theBoundBox.Pmax.x;
- const float YM = theBoundBox.Pmax.y;
- const float ZM = theBoundBox.Pmax.z;
- aPoints( 1).SetCoord (Xm, Ym, Zm);
- aPoints( 2).SetCoord (Xm, Ym, ZM);
- aPoints( 3).SetCoord (Xm, YM, ZM);
- aPoints( 4).SetCoord (Xm, YM, Zm);
- aPoints( 5).SetCoord (Xm, Ym, Zm);
- aPoints( 6).SetCoord (XM, Ym, Zm);
- aPoints( 7).SetCoord (XM, Ym, ZM);
- aPoints( 8).SetCoord (XM, YM, ZM);
- aPoints( 9).SetCoord (XM, YM, Zm);
- aPoints(10).SetCoord (XM, Ym, Zm);
- aPoints(11).SetCoord (XM, YM, Zm);
- aPoints(12).SetCoord (Xm, YM, Zm);
- aPoints(13).SetCoord (Xm, YM, ZM);
- aPoints(14).SetCoord (XM, YM, ZM);
- aPoints(15).SetCoord (XM, Ym, ZM);
- aPoints(16).SetCoord (Xm, Ym, ZM);
-
- OpenGl_Polyline* aPolyline = new OpenGl_Polyline (aPoints);
- myHighlightBox->AddElement (TelPolyline, aPolyline);
+ OpenGl_BndBoxPrs* aBndBoxPrs = new OpenGl_BndBoxPrs (theBoundBox);
+ myHighlightBox->AddElement (TelParray, aBndBoxPrs);
}
/*----------------------------------------------------------------------*/
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-/***********************************************************************
+#ifndef OPENGL_TSM_H
+#define OPENGL_TSM_H
-FONCTION :
-----------
-File OpenGl_tsm :
-
-
-REMARQUES:
-----------
-
-HISTORIQUE DES MODIFICATIONS :
---------------------------------
-xx-xx-xx : xxx ; Creation.
-17-07-96 : FMN ; Suppression de TelHLHSRMode
-05-08-97 : PCT ; support texture mapping
-23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex
-et TelBackInteriorShadingMethod
-30-11-98 : FMN ; S3819 : Textes toujours visibles
-16-06-00 : ATS,SPK : G005 : Group of new primitives: TelParray
-22-03-04 : SAN : OCC4895 High-level interface for controlling polygon offsets
-
-************************************************************************/
-
-#ifndef OPENGL_TSM_H
-#define OPENGL_TSM_H
-
-// OCC1188 SAV 23/12/02 Added structure to control background texture enum to control texture fill method
-
-typedef enum
+typedef enum
{
TelNil = 0,
- TelLabel,
- TelAntiAliasing,
- TelBlink,
- TelExecuteStructure,
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- TelTransformPersistence,
- /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */
- TelPolylineColour,
- TelPolylineType,
- TelPolylineWidth,
- TelInteriorStyle,
- TelInteriorColour,
- TelBackInteriorColour,
- TelEdgeColour,
- TelEdgeType,
- TelEdgeWidth,
- TelEdgeFlag,
- TelInteriorStyleIndex,
- TelFaceDistinguishingMode,
- TelFaceCullingMode,
- TelInteriorReflectanceEquation,
- TelSurfaceAreaProperties,
- TelBackInteriorReflectanceEquation,
- TelBackSurfaceAreaProperties,
- TelPolymarkerColour,
- TelPolymarkerType,
- TelPolymarkerSize,
- TelTextFont,
- TelTextHeight,
- TelCharacterSpacing,
- TelCharacterExpansionFactor,
- TelTextColour,
- TelDepthCueIndex,
- TelPickId,
- TelPolygon,
- TelPolygonSet,
- TelPolygonHoles,
- TelPolygonIndices,
- TelQuadrangle,
- TelPolyline,
TelMarker,
TelMarkerSet,
TelText,
- TelTriangleMesh,
- TelAddNameset,
- TelRemoveNameset,
- TelInteriorShadingMethod,
- TelLocalTran3,
- TelHighlightIndex,
- TelLightSrcState,
- TelClippingPlane,
- TelViewIndex,
- TelApplicationData,
- TelCurve,
- TelTextureId,
- TelDoTextureMap,
- TelTextStyle,
- TelTextDisplayType,
- TelTextColourSubTitle,
- TelTextZoomable,//Text Zoomable attributes
- TelTextAngle,//Text Angle attributes
- TelTextFontAspect,//Text Font Aspect attributes
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
- TelTextAlign,
- /*OCC7456 abd 14.12.2004 Text alingnment attributes */
TelParray,
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- TelPolygonOffset,
- /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
- /* OCC???? SZV 11/08/05 Implementation of callbacks */
TelUserdraw,
- /* OCC???? SZV 11/08/05 Implementation of callbacks */
TelLast
} TelType;