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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Graphic3d_Texture2Dplane_HeaderFile
18 #define _Graphic3d_Texture2Dplane_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Graphic3d_NameOfTexturePlane.hxx>
24 #include <Graphic3d_Texture2D.hxx>
25 #include <Graphic3d_NameOfTexture2D.hxx>
26 #include <Image_PixMap_Handle.hxx>
27 #include <Standard_ShortReal.hxx>
28 class TCollection_AsciiString;
31 class Graphic3d_Texture2Dplane;
32 DEFINE_STANDARD_HANDLE(Graphic3d_Texture2Dplane, Graphic3d_Texture2D)
34 //! This class allows the management of a 2D texture defined from a plane equation
35 //! Use the SetXXX() methods for positioning the texture as you want.
36 class Graphic3d_Texture2Dplane : public Graphic3d_Texture2D
42 //! Creates a texture from a file
43 Standard_EXPORT Graphic3d_Texture2Dplane(const TCollection_AsciiString& theFileName);
45 //! Creates a texture from a predefined texture name set.
46 Standard_EXPORT Graphic3d_Texture2Dplane(const Graphic3d_NameOfTexture2D theNOT);
48 //! Creates a texture from the pixmap.
49 Standard_EXPORT Graphic3d_Texture2Dplane(const Image_PixMap_Handle& thePixMap);
51 //! Defines the texture projection plane for texture coordinate S
52 //! default is <1.0, 0.0, 0.0, 0.0>
53 Standard_EXPORT void SetPlaneS (const Standard_ShortReal A, const Standard_ShortReal B, const Standard_ShortReal C, const Standard_ShortReal D);
55 //! Defines the texture projection plane for texture coordinate T
56 //! default is <0.0, 1.0, 0.0, 0.0>
57 Standard_EXPORT void SetPlaneT (const Standard_ShortReal A, const Standard_ShortReal B, const Standard_ShortReal C, const Standard_ShortReal D);
59 //! Defines the texture projection plane for both S and T texture coordinate
60 //! default is NOTP_XY meaning:
61 //! <1.0, 0.0, 0.0, 0.0> for S
62 //! and <0.0, 1.0, 0.0, 0.0> for T
63 Standard_EXPORT void SetPlane (const Graphic3d_NameOfTexturePlane thePlane);
65 //! Defines the texture scale for the S texture coordinate
66 //! much easier than recomputing the S plane equation
67 //! but the result is the same
69 Standard_EXPORT void SetScaleS (const Standard_ShortReal theVal);
71 //! Defines the texture scale for the T texture coordinate
72 //! much easier than recompution the T plane equation
73 //! but the result is the same
75 Standard_EXPORT void SetScaleT (const Standard_ShortReal theVal);
77 //! Defines the texture translation for the S texture coordinate
78 //! you can obtain the same effect by modifying the S plane
79 //! equation but its not easier.
81 Standard_EXPORT void SetTranslateS (const Standard_ShortReal theVal);
83 //! Defines the texture translation for the T texture coordinate
84 //! you can obtain the same effect by modifying the T plane
85 //! equation but its not easier.
87 Standard_EXPORT void SetTranslateT (const Standard_ShortReal theVal);
89 //! Sets the rotation angle of the whole texture.
90 //! the same result might be achieved by recomputing the
91 //! S and T plane equation but it's not the easiest way...
92 //! the angle is expressed in degrees
94 Standard_EXPORT void SetRotation (const Standard_ShortReal theVal);
96 //! Returns the current texture plane name or NOTP_UNKNOWN
97 //! when the plane is user defined.
98 Standard_EXPORT Graphic3d_NameOfTexturePlane Plane() const;
100 //! Returns the current texture plane S equation
101 Standard_EXPORT void PlaneS (Standard_ShortReal& A, Standard_ShortReal& B, Standard_ShortReal& C, Standard_ShortReal& D) const;
103 //! Returns the current texture plane T equation
104 Standard_EXPORT void PlaneT (Standard_ShortReal& A, Standard_ShortReal& B, Standard_ShortReal& C, Standard_ShortReal& D) const;
106 //! Returns the current texture S translation value
107 Standard_EXPORT void TranslateS (Standard_ShortReal& theVal) const;
109 //! Returns the current texture T translation value
110 Standard_EXPORT void TranslateT (Standard_ShortReal& theVal) const;
112 //! Returns the current texture S scale value
113 Standard_EXPORT void ScaleS (Standard_ShortReal& theVal) const;
115 //! Returns the current texture T scale value
116 Standard_EXPORT void ScaleT (Standard_ShortReal& theVal) const;
118 //! Returns the current texture rotation angle
119 Standard_EXPORT void Rotation (Standard_ShortReal& theVal) const;
124 DEFINE_STANDARD_RTTI(Graphic3d_Texture2Dplane,Graphic3d_Texture2D)
134 Graphic3d_NameOfTexturePlane myPlaneName;
145 #endif // _Graphic3d_Texture2Dplane_HeaderFile