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 <Standard_ShortReal.hxx>
27 class TCollection_AsciiString;
30 class Graphic3d_Texture2Dplane;
31 DEFINE_STANDARD_HANDLE(Graphic3d_Texture2Dplane, Graphic3d_Texture2D)
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
41 //! Creates a texture from a file
42 Standard_EXPORT Graphic3d_Texture2Dplane(const TCollection_AsciiString& theFileName);
44 //! Creates a texture from a predefined texture name set.
45 Standard_EXPORT Graphic3d_Texture2Dplane(const Graphic3d_NameOfTexture2D theNOT);
47 //! Creates a texture from the pixmap.
48 Standard_EXPORT Graphic3d_Texture2Dplane(const Handle(Image_PixMap)& thePixMap);
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);
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);
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);
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
68 Standard_EXPORT void SetScaleS (const Standard_ShortReal theVal);
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
74 Standard_EXPORT void SetScaleT (const Standard_ShortReal theVal);
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.
80 Standard_EXPORT void SetTranslateS (const Standard_ShortReal theVal);
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.
86 Standard_EXPORT void SetTranslateT (const Standard_ShortReal theVal);
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
93 Standard_EXPORT void SetRotation (const Standard_ShortReal theVal);
95 //! Returns the current texture plane name or NOTP_UNKNOWN
96 //! when the plane is user defined.
97 Standard_EXPORT Graphic3d_NameOfTexturePlane Plane() const;
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;
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;
105 //! Returns the current texture S translation value
106 Standard_EXPORT void TranslateS (Standard_ShortReal& theVal) const;
108 //! Returns the current texture T translation value
109 Standard_EXPORT void TranslateT (Standard_ShortReal& theVal) const;
111 //! Returns the current texture S scale value
112 Standard_EXPORT void ScaleS (Standard_ShortReal& theVal) const;
114 //! Returns the current texture T scale value
115 Standard_EXPORT void ScaleT (Standard_ShortReal& theVal) const;
117 //! Returns the current texture rotation angle
118 Standard_EXPORT void Rotation (Standard_ShortReal& theVal) const;
123 DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture2Dplane,Graphic3d_Texture2D)
133 Graphic3d_NameOfTexturePlane myPlaneName;
144 #endif // _Graphic3d_Texture2Dplane_HeaderFile