0026348: Visualization, TKOpenGl - eliminate invalid NULL checks for transformation...
[occt.git] / src / Graphic3d / Graphic3d_Texture2Dplane.hxx
CommitLineData
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>
26#include <Image_PixMap_Handle.hxx>
27#include <Standard_ShortReal.hxx>
28class TCollection_AsciiString;
29
30
31class Graphic3d_Texture2Dplane;
32DEFINE_STANDARD_HANDLE(Graphic3d_Texture2Dplane, Graphic3d_Texture2D)
33
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.
36class Graphic3d_Texture2Dplane : public Graphic3d_Texture2D
37{
38
39public:
40
41
42 //! Creates a texture from a file
43 Standard_EXPORT Graphic3d_Texture2Dplane(const TCollection_AsciiString& theFileName);
44
45 //! Creates a texture from a predefined texture name set.
46 Standard_EXPORT Graphic3d_Texture2Dplane(const Graphic3d_NameOfTexture2D theNOT);
47
48 //! Creates a texture from the pixmap.
49 Standard_EXPORT Graphic3d_Texture2Dplane(const Image_PixMap_Handle& thePixMap);
50
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);
54
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);
58
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);
64
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
68 //! default to 1.0
69 Standard_EXPORT void SetScaleS (const Standard_ShortReal theVal);
70
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
74 //! default to 1.0
75 Standard_EXPORT void SetScaleT (const Standard_ShortReal theVal);
76
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.
80 //! default to 0.0
81 Standard_EXPORT void SetTranslateS (const Standard_ShortReal theVal);
82
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.
86 //! default to 0.0
87 Standard_EXPORT void SetTranslateT (const Standard_ShortReal theVal);
88
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
93 //! default is 0.0
94 Standard_EXPORT void SetRotation (const Standard_ShortReal theVal);
95
96 //! Returns the current texture plane name or NOTP_UNKNOWN
97 //! when the plane is user defined.
98 Standard_EXPORT Graphic3d_NameOfTexturePlane Plane() const;
99
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;
102
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;
105
106 //! Returns the current texture S translation value
107 Standard_EXPORT void TranslateS (Standard_ShortReal& theVal) const;
108
109 //! Returns the current texture T translation value
110 Standard_EXPORT void TranslateT (Standard_ShortReal& theVal) const;
111
112 //! Returns the current texture S scale value
113 Standard_EXPORT void ScaleS (Standard_ShortReal& theVal) const;
114
115 //! Returns the current texture T scale value
116 Standard_EXPORT void ScaleT (Standard_ShortReal& theVal) const;
117
118 //! Returns the current texture rotation angle
119 Standard_EXPORT void Rotation (Standard_ShortReal& theVal) const;
120
121
122
123
124 DEFINE_STANDARD_RTTI(Graphic3d_Texture2Dplane,Graphic3d_Texture2D)
125
126protected:
127
128
129
130
131private:
132
133
134 Graphic3d_NameOfTexturePlane myPlaneName;
135
136
137};
138
139
140
141
142
143
144
145#endif // _Graphic3d_Texture2Dplane_HeaderFile