1 /***********************************************************************
5 file OpenGl_togl_viewmapping.c :
12 HISTORIQUE DES MODIFICATIONS :
13 --------------------------------
14 xx-xx-xx : CAL ; Creation.
15 10-07-96 : FMN ; Suppression #define sur calcul matrice
16 25-07-96 : FMN ; Suppression code inutile
17 18-11-98 : FMN ; Correction sur la gestion de la perspective (cf Programming Guide)
18 09-12-98 : FMN ; Correction erreur de compilation sur WNT
19 17-12-98 : FMN ; Correction erreur de compilation sur WNT
21 ************************************************************************/
23 /*----------------------------------------------------------------------*/
28 #include <OpenGl_tgl_all.hxx>
29 #include <InterfaceGraphic_Graphic3d.hxx>
30 #include <InterfaceGraphic_Visual3d.hxx>
31 #include <OpenGl_tgl_vis.hxx>
32 #include <OpenGl_tgl_funcs.hxx>
36 /*----------------------------------------------------------------------*/
41 EXPORT extern GLboolean env_walkthrow; /* definit dans OpenGl_togl_begin.c */
43 /*----------------------------------------------------------------------*/
48 CALL_DEF_VIEW * aview,
60 ratio = aview->DefWindow.dy / aview->DefWindow.dx;
62 Map.window.xmin = aview->Mapping.WindowLimit.um;
63 Map.window.ymin = aview->Mapping.WindowLimit.vm;
64 Map.window.xmax = aview->Mapping.WindowLimit.uM;
65 Map.window.ymax = aview->Mapping.WindowLimit.vM;
67 Map.viewport.xmin = ( float )0.0;
68 Map.viewport.xmax = ( ( float )1. < ( float )1./ratio ? ( float )1. : ( float )1./ratio );
69 Map.viewport.ymin = ( float )0.0;
70 Map.viewport.ymax = ( ( float )1. < ratio ? ( float )1. : ratio );
71 Map.viewport.zmin = ( float )0.0;
72 Map.viewport.zmax = ( float )1.0;
75 switch( aview->Mapping.Projection )
78 Map.proj = CALL_PHIGS_TYPE_PERSPECT;
81 Map.proj = CALL_PHIGS_TYPE_PARAL;
85 /* projection reference point */
86 Map.prp[0] = aview->Mapping.ProjectionReferencePoint.x;
87 Map.prp[1] = aview->Mapping.ProjectionReferencePoint.y;
89 Map.prp[2] = aview->Mapping.ProjectionReferencePoint.z;
91 Map.prp[2] = aview->Mapping.FrontPlaneDistance +
92 aview->Mapping.ProjectionReferencePoint.z;
94 /* view plane distance */
95 Map.vpd = aview->Mapping.ViewPlaneDistance;
97 /* back plane distance */
98 Map.bpd = aview->Mapping.BackPlaneDistance;
100 /* front plane distance */
101 Map.fpd = aview->Mapping.FrontPlaneDistance;
103 /* use user-defined matrix */
104 if ( aview->Mapping.IsCustomMatrix ) {
105 for( i = 0; i < 4; i++ )
106 for( j = 0; j < 4; j++ )
107 call_viewrep.mapping_matrix[i][j] = aview->Mapping.ProjectionMatrix[i][j];
110 TelEvalViewMappingMatrix( &Map, &err_ind, call_viewrep.mapping_matrix );
112 if( !err_ind && aview->WsId != -1 )
114 call_viewrep.extra.map = Map;
118 call_togl_vieworientation( aview, waitwait );
119 call_togl_cliplimit( aview, waitwait );
120 TelSetViewRepresentation( aview->WsId, aview->ViewId, &call_viewrep );
121 call_togl_ratio_window( aview );
126 /*----------------------------------------------------------------------*/