0012121: Optimization of existing selection classes
[occt.git] / src / OpenGl / OpenGl_togl_cliplimit.cxx
CommitLineData
7fd59977 1/***********************************************************************
2
3FONCTION :
4----------
5file OpenGl_togl_cliplimit.c :
6
7
8REMARQUES:
9----------
10
11
12HISTORIQUE DES MODIFICATIONS :
13--------------------------------
14xx-xx-xx : CAL ; Creation.
1505-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h
1610-07-96 : FMN ; Suppression #define sur calcul matrice
17
18************************************************************************/
19
20/*----------------------------------------------------------------------*/
21/*
22* Includes
23*/
24
25#include <OpenGl_tgl_all.hxx>
26#include <InterfaceGraphic_Graphic3d.hxx>
27#include <InterfaceGraphic_Visual3d.hxx>
28#include <OpenGl_tgl_funcs.hxx>
29#include <OpenGl_telem_view.hxx>
30
31/*----------------------------------------------------------------------*/
32/*
33* Variables globales
34*/
35
36TEL_VIEW_REP call_viewrep;
37
38/*----------------------------------------------------------------------*/
39
40void EXPORT
41call_togl_cliplimit
42(
43 CALL_DEF_VIEW * aview,
44 int wait
45 )
46{
47 Tint waitwait;
48
49 call_viewrep.clip_limit.xmin = ( float )0.0;
50 call_viewrep.clip_limit.xmax = ( float )1.0;
51 call_viewrep.clip_limit.ymin = ( float )0.0;
52 call_viewrep.clip_limit.ymax = ( float )1.0;
53
54 call_viewrep.clip_limit.zmax =
55 ( aview->Context.ZClipFrontPlane - aview->Mapping.BackPlaneDistance ) /
56 ( aview->Mapping.FrontPlaneDistance - aview->Mapping.BackPlaneDistance );
57 call_viewrep.clip_limit.zmin =
58 ( aview->Context.ZClipBackPlane - aview->Mapping.BackPlaneDistance ) /
59 ( aview->Mapping.FrontPlaneDistance - aview->Mapping.BackPlaneDistance );
60 if( call_viewrep.clip_limit.zmin < 0.0 )
61 call_viewrep.clip_limit.zmin = ( float )0.0;
62 if( call_viewrep.clip_limit.zmax > 1.0 )
63 call_viewrep.clip_limit.zmax = ( float )1.0;
64 if( call_viewrep.clip_limit.zmin > call_viewrep.clip_limit.zmax )
65 {
66 call_viewrep.clip_limit.zmin = ( float )0.0;
67 call_viewrep.clip_limit.zmax = ( float )1.0;
68 }
69
70 call_viewrep.clip_xy = CALL_PHIGS_IND_NO_CLIP;
71 call_viewrep.clip_back = CALL_PHIGS_IND_NO_CLIP;
72 call_viewrep.clip_front = CALL_PHIGS_IND_NO_CLIP;
73 if( aview->Context.BackZClipping )
74 call_viewrep.clip_back = CALL_PHIGS_IND_CLIP;
75 if( aview->Context.FrontZClipping )
76 call_viewrep.clip_front = CALL_PHIGS_IND_CLIP;
77
78 if( (!wait) && (aview->WsId != -1) )
79 {
80 waitwait = 1;
81 call_togl_viewmapping( aview, waitwait );
82 call_togl_vieworientation( aview, waitwait );
83 TelSetViewRepresentation( aview->WsId, aview->ViewId, &call_viewrep );
84 }
85 return;
86}
87/*----------------------------------------------------------------------*/