Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:18:38

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   //! Creates new material state.
0027   OpenGl_MaterialState()
0028       : myAlphaCutoff(0.5f),
0029         myToDistinguish(false),
0030         myToMapTexture(false)
0031   {
0032   }
0033 
0034   //! Sets new material aspect.
0035   void Set(const OpenGl_Material& theMat,
0036            const float            theAlphaCutoff,
0037            const bool             theToDistinguish,
0038            const bool             theToMapTexture)
0039   {
0040     myMaterial      = theMat;
0041     myAlphaCutoff   = theAlphaCutoff;
0042     myToDistinguish = theToDistinguish;
0043     myToMapTexture  = theToMapTexture;
0044   }
0045 
0046   //! Return front material.
0047   const OpenGl_Material& Material() const { return myMaterial; }
0048 
0049   //! Alpha cutoff value.
0050   float AlphaCutoff() const { return myAlphaCutoff; }
0051 
0052   //! Return TRUE if alpha test should be enabled.
0053   bool HasAlphaCutoff() const { return myAlphaCutoff <= 1.0f; }
0054 
0055   //! Distinguish front/back flag.
0056   bool ToDistinguish() const { return myToDistinguish; }
0057 
0058   //! Flag for mapping a texture.
0059   bool ToMapTexture() const { return myToMapTexture; }
0060 
0061 private:
0062   OpenGl_Material myMaterial;      //!< material
0063   float           myAlphaCutoff;   //!< alpha cutoff value
0064   bool            myToDistinguish; //!< distinguish front/back flag
0065   bool            myToMapTexture;  //!< flag for mapping a texture
0066 };
0067 
0068 #endif // _OpenGl_MaterialState_HeaderFile