summaryrefslogtreecommitdiff
path: root/src/OpenGl/OpenGl_togl_cliplimit.cxx
blob: d4ddb89a5233f8f828da795f373cbd5000d03ac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/***********************************************************************

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;
}
/*----------------------------------------------------------------------*/