42cf5bc1 |
1 | // Created on: 1997-07-28 |
2 | // Created by: Pierre CHALAMET |
3 | // Copyright (c) 1997-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Graphic3d_Texture2Dplane_HeaderFile |
18 | #define _Graphic3d_Texture2Dplane_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Graphic3d_NameOfTexturePlane.hxx> |
24 | #include <Graphic3d_Texture2D.hxx> |
25 | #include <Graphic3d_NameOfTexture2D.hxx> |
42cf5bc1 |
26 | #include <Standard_ShortReal.hxx> |
27 | class TCollection_AsciiString; |
28 | |
29 | |
30 | class Graphic3d_Texture2Dplane; |
31 | DEFINE_STANDARD_HANDLE(Graphic3d_Texture2Dplane, Graphic3d_Texture2D) |
32 | |
33 | //! This class allows the management of a 2D texture defined from a plane equation |
34 | //! Use the SetXXX() methods for positioning the texture as you want. |
35 | class Graphic3d_Texture2Dplane : public Graphic3d_Texture2D |
36 | { |
37 | |
38 | public: |
39 | |
40 | |
41 | //! Creates a texture from a file |
42 | Standard_EXPORT Graphic3d_Texture2Dplane(const TCollection_AsciiString& theFileName); |
43 | |
44 | //! Creates a texture from a predefined texture name set. |
45 | Standard_EXPORT Graphic3d_Texture2Dplane(const Graphic3d_NameOfTexture2D theNOT); |
46 | |
47 | //! Creates a texture from the pixmap. |
a13f2dc4 |
48 | Standard_EXPORT Graphic3d_Texture2Dplane(const Handle(Image_PixMap)& thePixMap); |
42cf5bc1 |
49 | |
50 | //! Defines the texture projection plane for texture coordinate S |
51 | //! default is <1.0, 0.0, 0.0, 0.0> |
52 | Standard_EXPORT void SetPlaneS (const Standard_ShortReal A, const Standard_ShortReal B, const Standard_ShortReal C, const Standard_ShortReal D); |
53 | |
54 | //! Defines the texture projection plane for texture coordinate T |
55 | //! default is <0.0, 1.0, 0.0, 0.0> |
56 | Standard_EXPORT void SetPlaneT (const Standard_ShortReal A, const Standard_ShortReal B, const Standard_ShortReal C, const Standard_ShortReal D); |
57 | |
58 | //! Defines the texture projection plane for both S and T texture coordinate |
59 | //! default is NOTP_XY meaning: |
60 | //! <1.0, 0.0, 0.0, 0.0> for S |
61 | //! and <0.0, 1.0, 0.0, 0.0> for T |
62 | Standard_EXPORT void SetPlane (const Graphic3d_NameOfTexturePlane thePlane); |
63 | |
64 | //! Defines the texture scale for the S texture coordinate |
65 | //! much easier than recomputing the S plane equation |
66 | //! but the result is the same |
67 | //! default to 1.0 |
68 | Standard_EXPORT void SetScaleS (const Standard_ShortReal theVal); |
69 | |
70 | //! Defines the texture scale for the T texture coordinate |
71 | //! much easier than recompution the T plane equation |
72 | //! but the result is the same |
73 | //! default to 1.0 |
74 | Standard_EXPORT void SetScaleT (const Standard_ShortReal theVal); |
75 | |
76 | //! Defines the texture translation for the S texture coordinate |
77 | //! you can obtain the same effect by modifying the S plane |
78 | //! equation but its not easier. |
79 | //! default to 0.0 |
80 | Standard_EXPORT void SetTranslateS (const Standard_ShortReal theVal); |
81 | |
82 | //! Defines the texture translation for the T texture coordinate |
83 | //! you can obtain the same effect by modifying the T plane |
84 | //! equation but its not easier. |
85 | //! default to 0.0 |
86 | Standard_EXPORT void SetTranslateT (const Standard_ShortReal theVal); |
87 | |
88 | //! Sets the rotation angle of the whole texture. |
89 | //! the same result might be achieved by recomputing the |
90 | //! S and T plane equation but it's not the easiest way... |
91 | //! the angle is expressed in degrees |
92 | //! default is 0.0 |
93 | Standard_EXPORT void SetRotation (const Standard_ShortReal theVal); |
94 | |
95 | //! Returns the current texture plane name or NOTP_UNKNOWN |
96 | //! when the plane is user defined. |
97 | Standard_EXPORT Graphic3d_NameOfTexturePlane Plane() const; |
98 | |
99 | //! Returns the current texture plane S equation |
100 | Standard_EXPORT void PlaneS (Standard_ShortReal& A, Standard_ShortReal& B, Standard_ShortReal& C, Standard_ShortReal& D) const; |
101 | |
102 | //! Returns the current texture plane T equation |
103 | Standard_EXPORT void PlaneT (Standard_ShortReal& A, Standard_ShortReal& B, Standard_ShortReal& C, Standard_ShortReal& D) const; |
104 | |
105 | //! Returns the current texture S translation value |
106 | Standard_EXPORT void TranslateS (Standard_ShortReal& theVal) const; |
107 | |
108 | //! Returns the current texture T translation value |
109 | Standard_EXPORT void TranslateT (Standard_ShortReal& theVal) const; |
110 | |
111 | //! Returns the current texture S scale value |
112 | Standard_EXPORT void ScaleS (Standard_ShortReal& theVal) const; |
113 | |
114 | //! Returns the current texture T scale value |
115 | Standard_EXPORT void ScaleT (Standard_ShortReal& theVal) const; |
116 | |
117 | //! Returns the current texture rotation angle |
118 | Standard_EXPORT void Rotation (Standard_ShortReal& theVal) const; |
119 | |
120 | |
121 | |
122 | |
92efcf78 |
123 | DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture2Dplane,Graphic3d_Texture2D) |
42cf5bc1 |
124 | |
125 | protected: |
126 | |
127 | |
128 | |
129 | |
130 | private: |
131 | |
132 | |
133 | Graphic3d_NameOfTexturePlane myPlaneName; |
134 | |
135 | |
136 | }; |
137 | |
138 | |
139 | |
140 | |
141 | |
142 | |
143 | |
144 | #endif // _Graphic3d_Texture2Dplane_HeaderFile |