Merging OCC22105, OCC22354, OCC22150 , OCC22199 , OCC22391 and OCC22108
[occt.git] / src / OpenGl / OpenGl_togl_vieworientation.cxx
CommitLineData
7fd59977 1/***********************************************************************
2
3FONCTION :
4----------
5file OpenGl_togl_vieworientation.c :
6
7
8REMARQUES:
9----------
10
11
12HISTORIQUE DES MODIFICATIONS :
13--------------------------------
14xx-xx-xx : CAL ; Creation.
1510-07-96 : FMN ; Suppression #define sur calcul matrice
16
17************************************************************************/
7fd59977 18
19/*----------------------------------------------------------------------*/
20/*
21* Includes
22*/
23
24#include <OpenGl_tgl_all.hxx>
25#include <InterfaceGraphic_Graphic3d.hxx>
26#include <InterfaceGraphic_Visual3d.hxx>
27#include <OpenGl_tgl_vis.hxx>
28#include <OpenGl_tgl_funcs.hxx>
29
30/*----------------------------------------------------------------------*/
31
32int EXPORT
33call_togl_vieworientation
34(
35 CALL_DEF_VIEW * aview,
36 int wait
37 )
38{
39 int i, j;
40 Tint waitwait;
41 Tint err_ind; /* OUT error indicator */
42
43 Tfloat Vrp[3];
44 Tfloat Vpn[3];
45 Tfloat Vup[3];
46 Tfloat ScaleFactors[3];
47
48 err_ind = 0;
49
50 Vrp[0] = aview->Orientation.ViewReferencePoint.x;
51 Vrp[1] = aview->Orientation.ViewReferencePoint.y;
52 Vrp[2] = aview->Orientation.ViewReferencePoint.z;
53
54 Vpn[0] = aview->Orientation.ViewReferencePlane.x;
55 Vpn[1] = aview->Orientation.ViewReferencePlane.y;
56 Vpn[2] = aview->Orientation.ViewReferencePlane.z;
57
58 Vup[0] = aview->Orientation.ViewReferenceUp.x;
59 Vup[1] = aview->Orientation.ViewReferenceUp.y;
60 Vup[2] = aview->Orientation.ViewReferenceUp.z;
61
62 ScaleFactors[0] = aview->Orientation.ViewScaleX;
63 ScaleFactors[1] = aview->Orientation.ViewScaleY;
64 ScaleFactors[2] = aview->Orientation.ViewScaleZ;
65
66 /* use user-defined matrix */
67 if ( aview->Orientation.IsCustomMatrix ) {
68 for( i = 0; i < 4; i++ )
69 for( j = 0; j < 4; j++ )
70 call_viewrep.orientation_matrix[i][j] = aview->Orientation.ModelViewMatrix[i][j];
71 }
72 else
73 TelEvalViewOrientationMatrix( Vrp, Vpn, Vup, ScaleFactors, &err_ind, call_viewrep.orientation_matrix);
74
75 if( !err_ind && aview->WsId != -1 )
76 {
77 call_viewrep.extra.vrp[0] = Vrp[0],
78 call_viewrep.extra.vrp[1] = Vrp[1],
79 call_viewrep.extra.vrp[2] = Vrp[2];
80
81 call_viewrep.extra.vpn[0] = Vpn[0],
82 call_viewrep.extra.vpn[1] = Vpn[1],
83 call_viewrep.extra.vpn[2] = Vpn[2];
84
85 call_viewrep.extra.vup[0] = Vup[0],
86 call_viewrep.extra.vup[1] = Vup[1],
87 call_viewrep.extra.vup[2] = Vup[2];
88
89 call_viewrep.extra.scaleFactors[0] = ScaleFactors[0],
90 call_viewrep.extra.scaleFactors[1] = ScaleFactors[1],
91 call_viewrep.extra.scaleFactors[2] = ScaleFactors[2];
92
93 if( !wait )
94 {
95 waitwait = 1;
96 call_togl_viewmapping( aview, waitwait );
97 call_togl_cliplimit( aview, waitwait );
7fd59977 98 TelSetViewRepresentation( aview->WsId, aview->ViewId, &call_viewrep );
99 }
100 }
101 return err_ind;
102}
103/*----------------------------------------------------------------------*/