Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:34

0001 // Created on: 2013-10-02
0002 // Created by: Denis BOGOLEPOV
0003 // Copyright (c) 2013-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _OpenGl_MaterialState_HeaderFile
0017 #define _OpenGl_MaterialState_HeaderFile
0018 
0019 #include <OpenGl_ShaderStates.hxx>
0020 #include <OpenGl_Material.hxx>
0021 
0022 //! Defines generic state of material properties.
0023 class OpenGl_MaterialState : public OpenGl_StateInterface
0024 {
0025 public:
0026 
0027   //! Creates new material state.
0028   OpenGl_MaterialState() : myAlphaCutoff (0.5f), myToDistinguish (false), myToMapTexture (false) {}
0029 
0030   //! Sets new material aspect.
0031   void Set (const OpenGl_Material& theMat,
0032             const float theAlphaCutoff,
0033             const bool theToDistinguish,
0034             const bool theToMapTexture)
0035   {
0036     myMaterial      = theMat;
0037     myAlphaCutoff   = theAlphaCutoff;
0038     myToDistinguish = theToDistinguish;
0039     myToMapTexture  = theToMapTexture;
0040   }
0041 
0042   //! Return front material.
0043   const OpenGl_Material& Material() const { return myMaterial; }
0044 
0045   //! Alpha cutoff value.
0046   float AlphaCutoff() const { return myAlphaCutoff; }
0047 
0048   //! Return TRUE if alpha test should be enabled.
0049   bool HasAlphaCutoff() const { return myAlphaCutoff <= 1.0f; }
0050 
0051   //! Distinguish front/back flag.
0052   bool ToDistinguish() const { return myToDistinguish; }
0053 
0054   //! Flag for mapping a texture.
0055   bool ToMapTexture()  const { return myToMapTexture; }
0056 
0057 private:
0058 
0059   OpenGl_Material myMaterial;      //!< material
0060   float           myAlphaCutoff;   //!< alpha cutoff value
0061   bool            myToDistinguish; //!< distinguish front/back flag
0062   bool            myToMapTexture;  //!< flag for mapping a texture
0063 
0064 };
0065 
0066 #endif // _OpenGl_MaterialState_HeaderFile