Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:17:18

0001 // Created on: 1997-07-28
0002 // Created by: Pierre CHALAMET
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Graphic3d_Texture2Dplane_HeaderFile
0018 #define _Graphic3d_Texture2Dplane_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Graphic3d_NameOfTexturePlane.hxx>
0023 #include <Graphic3d_Texture2D.hxx>
0024 #include <Graphic3d_NameOfTexture2D.hxx>
0025 class TCollection_AsciiString;
0026 
0027 //! This class allows the management of a 2D texture defined from a plane equation
0028 //! Use the SetXXX() methods for positioning the texture as you want.
0029 class Graphic3d_Texture2Dplane : public Graphic3d_Texture2D
0030 {
0031 
0032 public:
0033   //! Creates a texture from a file
0034   Standard_EXPORT Graphic3d_Texture2Dplane(const TCollection_AsciiString& theFileName);
0035 
0036   //! Creates a texture from a predefined texture name set.
0037   Standard_EXPORT Graphic3d_Texture2Dplane(const Graphic3d_NameOfTexture2D theNOT);
0038 
0039   //! Creates a texture from the pixmap.
0040   Standard_EXPORT Graphic3d_Texture2Dplane(const occ::handle<Image_PixMap>& thePixMap);
0041 
0042   //! Defines the texture projection plane for texture coordinate S
0043   //! default is <1.0, 0.0, 0.0, 0.0>
0044   Standard_EXPORT void SetPlaneS(const float A, const float B, const float C, const float D);
0045 
0046   //! Defines the texture projection plane for texture coordinate T
0047   //! default is <0.0, 1.0, 0.0, 0.0>
0048   Standard_EXPORT void SetPlaneT(const float A, const float B, const float C, const float D);
0049 
0050   //! Defines the texture projection plane for both S and T texture coordinate
0051   //! default is NOTP_XY meaning:
0052   //! <1.0, 0.0, 0.0, 0.0> for S and
0053   //! <0.0, 1.0, 0.0, 0.0> for T
0054   Standard_EXPORT void SetPlane(const Graphic3d_NameOfTexturePlane thePlane);
0055 
0056   //! Defines the texture scale for the S texture coordinate
0057   //! much easier than recomputing the S plane equation
0058   //! but the result is the same
0059   //! default to 1.0
0060   Standard_EXPORT void SetScaleS(const float theVal);
0061 
0062   //! Defines the texture scale for the T texture coordinate
0063   //! much easier than recompution the T plane equation
0064   //! but the result is the same
0065   //! default to 1.0
0066   Standard_EXPORT void SetScaleT(const float theVal);
0067 
0068   //! Defines the texture translation for the S texture coordinate
0069   //! you can obtain the same effect by modifying the S plane
0070   //! equation but its not easier.
0071   //! default to 0.0
0072   Standard_EXPORT void SetTranslateS(const float theVal);
0073 
0074   //! Defines the texture translation for the T texture coordinate
0075   //! you can obtain the same effect by modifying the T plane
0076   //! equation but its not easier.
0077   //! default to 0.0
0078   Standard_EXPORT void SetTranslateT(const float theVal);
0079 
0080   //! Sets the rotation angle of the whole texture.
0081   //! the same result might be achieved by recomputing the
0082   //! S and T plane equation but it's not the easiest way...
0083   //! the angle is expressed in degrees
0084   //! default is 0.0
0085   Standard_EXPORT void SetRotation(const float theVal);
0086 
0087   //! Returns the current texture plane name or NOTP_UNKNOWN
0088   //! when the plane is user defined.
0089   Standard_EXPORT Graphic3d_NameOfTexturePlane Plane() const;
0090 
0091   //! Returns the current texture plane S equation
0092   Standard_EXPORT void PlaneS(float& A, float& B, float& C, float& D) const;
0093 
0094   //! Returns the current texture plane T equation
0095   Standard_EXPORT void PlaneT(float& A, float& B, float& C, float& D) const;
0096 
0097   //! Returns the current texture S translation value
0098   Standard_EXPORT void TranslateS(float& theVal) const;
0099 
0100   //! Returns the current texture T translation value
0101   Standard_EXPORT void TranslateT(float& theVal) const;
0102 
0103   //! Returns the current texture S scale value
0104   Standard_EXPORT void ScaleS(float& theVal) const;
0105 
0106   //! Returns the current texture T scale value
0107   Standard_EXPORT void ScaleT(float& theVal) const;
0108 
0109   //! Returns the current texture rotation angle
0110   Standard_EXPORT void Rotation(float& theVal) const;
0111 
0112   DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture2Dplane, Graphic3d_Texture2D)
0113 
0114 private:
0115   Graphic3d_NameOfTexturePlane myPlaneName;
0116 };
0117 
0118 #endif // _Graphic3d_Texture2Dplane_HeaderFile