summaryrefslogtreecommitdiff
path: root/inc/Visual3d_ViewMapping.hxx
blob: ab26170496d58c633bd36de8e64fb922255f77e6 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _Visual3d_ViewMapping_HeaderFile
#define _Visual3d_ViewMapping_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _Graphic3d_Vertex_HeaderFile
#include <Graphic3d_Vertex.hxx>
#endif
#ifndef _Visual3d_TypeOfProjection_HeaderFile
#include <Visual3d_TypeOfProjection.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Handle_TColStd_HArray2OfReal_HeaderFile
#include <Handle_TColStd_HArray2OfReal.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class TColStd_HArray2OfReal;
class Visual3d_ViewMappingDefinitionError;
class Visual3d_View;
class Graphic3d_Vertex;


//! This class allows the definition of a projection and <br>
//!	    a system of coordinates called NPC. <br>
//!	    (Normalized Projection Coordinates). <br>
//!	    The projection can be parallel or perspective. <br>
//!  References: The definitions are Phigs oriented. <br>
//!  Keywords: View, Mapping, Window, View Plane, Front Plane, <br>
//!    BackPlane, Projection Type, Reset, Projection <br>
//! Summary of 3D View Mapping                   -- <br>
//! The view mapping transformation  defines the -- <br>
//! window-to-viewport mapping of View Reference -- <br>
//! Coordinates (VRC)  to Normalized  Projection -- <br>
//! Coordinates (NPC).                           -- <br>
//! CAS.CADE supports two kinds of projection :  -- <br>
//! 	Parallel :                              -- <br>
//!	The Projection Reference Point (PRP)    -- <br>
//!	determines the direction of projection. -- <br>
//! 	Perspective :                           -- <br>
//!	The projector lines converge at the     -- <br>
//!	Projection Reference Point (PRP).       -- <br>
//! To define a  view mapping transformation you -- <br>
//! must define :                                -- <br>
//!	The Projection Type                     -- <br>
//!	The Projection Reference Point (PRP)    -- <br>
//!	The Distance from Back Plane (BPD)      -- <br>
//!	The Distance from Front Plane (FPD)     -- <br>
//!	The Distance from View Plane (VPD)      -- <br>
//!	The Window in the View Plane.           -- <br>
class Visual3d_ViewMapping  {
public:

  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  //! Creates a projection. <br>
  Standard_EXPORT   Visual3d_ViewMapping();
  //! Creates a projection. <br>
  Standard_EXPORT   Visual3d_ViewMapping(const Visual3d_TypeOfProjection AType,const Graphic3d_Vertex& PRP,const Standard_Real BPD,const Standard_Real FPD,const Standard_Real VPD,const Standard_Real WUmin,const Standard_Real WVmin,const Standard_Real WUmax,const Standard_Real WVmax);
  //! Modifies the back clipping plane. <br>
//!  Category: Methods to modify the class definition <br>
//!  Warning: Raises ViewMappingDefinitionError <br>
//!	    if <PRP> is between the front and back planes. <br>
//!	    if <PRP> is positioned on the view plane. <br>
//!	    if the back plane is in front of the front plane. <br>
  Standard_EXPORT     void SetBackPlaneDistance(const Standard_Real BPD) ;
  //! Modifies the front clipping plane. <br>
//!  Category: Methods to modify the class definition <br>
//!  Warning: Raises ViewMappingDefinitionError <br>
//!	    if <PRP> is between the front and back planes. <br>
//!	    if <PRP> is positioned on the view plane. <br>
//!	    if the back plane is in front of the front plane. <br>
  Standard_EXPORT     void SetFrontPlaneDistance(const Standard_Real FPD) ;
  //! Modifies the type of projection. <br>
  Standard_EXPORT     void SetProjection(const Visual3d_TypeOfProjection AType) ;
  //! Modifies the PRP. <br>
//!  Category: Methods to modify the class definition <br>
//!  Warning: Raises ViewMappingDefinitionError <br>
//!	    if <PRP> is between the front and back planes. <br>
//!	    if <PRP> is positioned on the view plane. <br>
  Standard_EXPORT     void SetProjectionReferencePoint(const Graphic3d_Vertex& PRP) ;
  //! Modifies the distance of the view plane of projection. <br>
//!  Category: Methods to modify the class definition <br>
//!  Warning: Raises ViewMappingDefinitionError <br>
//!	    if <PRP> is positioned on the view plane. <br>
  Standard_EXPORT     void SetViewPlaneDistance(const Standard_Real VPD) ;
  //! Modifies the visible part of the projection plane. <br>
//!  Category: Methods to modify the class definition <br>
//!  Warning: Raises ViewMappingDefinitionError if the <br>
//!	    specified window is invalid. <br>
  Standard_EXPORT     void SetWindowLimit(const Standard_Real Umin,const Standard_Real Vmin,const Standard_Real Umax,const Standard_Real Vmax) ;
  //! Sets custom PROJECTION matrix for the OpenGl context <br>
  Standard_EXPORT     void SetCustomProjectionMatrix(const Handle(TColStd_HArray2OfReal)& Mat) ;
  //! Returns the distance from the back clipping plane <br>
//! of this view mapping. <br>
  Standard_EXPORT     Standard_Real BackPlaneDistance() const;
  //! Returns the distance from the front clipping plane <br>
//! of this view mapping. <br>
  Standard_EXPORT     Standard_Real FrontPlaneDistance() const;
  //! Returns the type of projection. <br>
  Standard_EXPORT     Visual3d_TypeOfProjection Projection() const;
  //! Returns the PRP. <br>
  Standard_EXPORT     Graphic3d_Vertex ProjectionReferencePoint() const;
  //! Returns the distance from the projection plane. <br>
  Standard_EXPORT     Standard_Real ViewPlaneDistance() const;
  //! Returns the visible part of the projection plane. <br>
  Standard_EXPORT     void WindowLimit(Standard_Real& Umin,Standard_Real& Vmin,Standard_Real& Umax,Standard_Real& Vmax) const;
  //! Returns whether the custom PROJECTION matrix is used. <br>
  Standard_EXPORT     Standard_Boolean IsCustomMatrix() const;


friend class Visual3d_View;



protected:





private:

  //! Copies the content of <Other> into <me>. <br>
  Standard_EXPORT     void Assign(const Visual3d_ViewMapping& Other) ;


Graphic3d_Vertex MyReferencePoint;
Visual3d_TypeOfProjection MyProjectionType;
Standard_Real MyBackPlaneDistance;
Standard_Real MyFrontPlaneDistance;
Standard_Real MyViewPlaneDistance;
Standard_Real MyWindowLimits[4];
Handle_TColStd_HArray2OfReal MyProjectionMatrix;


};





// other Inline functions and methods (like "C++: function call" methods)


#endif