PixelLightAPI  .
FixedFunctionsRenderStates.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: FixedFunctionsRenderStates.h                   *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLRENDERER_FIXEDFUNCTIONSRENDERSTATES_H__
00024 #define __PLRENDERER_FIXEDFUNCTIONSRENDERSTATES_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/Base/Object.h>
00032 #include <PLGraphics/Color/Color4.h>
00033 #include "PLRenderer/Renderer/FixedFunctions.h"
00034 
00035 
00036 //[-------------------------------------------------------]
00037 //[ Namespace                                             ]
00038 //[-------------------------------------------------------]
00039 namespace PLRenderer {
00040 
00041 
00042 //[-------------------------------------------------------]
00043 //[ Classes                                               ]
00044 //[-------------------------------------------------------]
00045 /**
00046 *  @brief
00047 *    Fixed functions render states RTTI wrapper class
00048 */
00049 class FixedFunctionsRenderStates : public PLCore::Object {
00050 
00051 
00052     //[-------------------------------------------------------]
00053     //[ RTTI interface                                        ]
00054     //[-------------------------------------------------------]
00055     pl_class(PLRENDERER_RTTI_EXPORT, FixedFunctionsRenderStates, "PLRenderer", PLCore::Object, "Fixed functions render states RTTI wrapper class")
00056         // Attributes
00057             // Fog
00058         pl_attribute(FogEnable,             bool,                                       false,                                      ReadWrite,  GetSet, "Enable/disable fog",               "")
00059         pl_attribute(FogColor,              PLGraphics::Color4,                         PLGraphics::Color4(0.0f, 0.0f, 0.0f, 0.0f), ReadWrite,  GetSet, "RGBA fog color",                   "")
00060         pl_attribute(FogDensity,            float,                                      1.0f,                                       ReadWrite,  GetSet, "Fog density",                      "")
00061         pl_attribute(FogStart,              float,                                      0.0f,                                       ReadWrite,  GetSet, "Fog start",                        "")
00062         pl_attribute(FogEnd,                float,                                      1.0f,                                       ReadWrite,  GetSet, "Fog end",                          "")
00063         pl_attribute(FogMode,               pl_enum_type(FixedFunctions::Fog::Enum),    FixedFunctions::Fog::Exp,                   ReadWrite,  GetSet, "Fog mode",                         "")
00064             // Alpha test
00065         pl_attribute(AlphaTestEnable,       bool,                                       false,                                      ReadWrite,  GetSet, "Enable/disable alpha test",        "")
00066         pl_attribute(AlphaTestFunction,     pl_enum_type(Compare::Enum),                Compare::GreaterEqual,                      ReadWrite,  GetSet, "Alpha test comparison function",   "")
00067         pl_attribute(AlphaTestReference,    float,                                      1.0f,                                       ReadWrite,  GetSet, "Alpha test reference value",       "")
00068             // Misc
00069         pl_attribute(Lighting,              bool,                                       true,                                       ReadWrite,  GetSet, "Enable/disable lighting",          "")
00070         pl_attribute(Ambient,               PLGraphics::Color4,                         PLGraphics::Color4(0.0f, 0.0f, 0.0f, 0.0f), ReadWrite,  GetSet, "General RGBA ambient color",       "")
00071         pl_attribute(NormalizeNormals,      bool,                                       true,                                       ReadWrite,  GetSet, "Enable/disable normalize normals", "")
00072         pl_attribute(ShadeMode,             pl_enum_type(FixedFunctions::Shade::Enum),  FixedFunctions::Shade::Smooth,              ReadWrite,  GetSet, "Shade mode",                       "")
00073     pl_class_end
00074 
00075 
00076     //[-------------------------------------------------------]
00077     //[ Public RTTI get/set functions                         ]
00078     //[-------------------------------------------------------]
00079     public:
00080         // Fog
00081         PLRENDERER_API bool GetFogEnable() const;
00082         PLRENDERER_API void SetFogEnable(bool bValue);
00083         PLRENDERER_API PLGraphics::Color4 GetFogColor() const;
00084         PLRENDERER_API void SetFogColor(const PLGraphics::Color4 &cValue);
00085         PLRENDERER_API float GetFogDensity() const;
00086         PLRENDERER_API void SetFogDensity(float fValue);
00087         PLRENDERER_API float GetFogStart() const;
00088         PLRENDERER_API void SetFogStart(float fValue);
00089         PLRENDERER_API float GetFogEnd() const;
00090         PLRENDERER_API void SetFogEnd(float fValue);
00091         PLRENDERER_API FixedFunctions::Fog::Enum GetFogMode() const;
00092         PLRENDERER_API void SetFogMode(FixedFunctions::Fog::Enum nValue);
00093         // Alpha test
00094         PLRENDERER_API bool GetAlphaTestEnable() const;
00095         PLRENDERER_API void SetAlphaTestEnable(bool bValue);
00096         PLRENDERER_API Compare::Enum GetAlphaTestFunction() const;
00097         PLRENDERER_API void SetAlphaTestFunction(Compare::Enum nValue);
00098         PLRENDERER_API float GetAlphaTestReference() const;
00099         PLRENDERER_API void SetAlphaTestReference(float fValue);
00100         // Misc
00101         PLRENDERER_API bool GetLighting() const;
00102         PLRENDERER_API void SetLighting(bool bValue);
00103         PLRENDERER_API PLGraphics::Color4 GetAmbient() const;
00104         PLRENDERER_API void SetAmbient(const PLGraphics::Color4 &cValue);
00105         PLRENDERER_API bool GetNormalizeNormals() const;
00106         PLRENDERER_API void SetNormalizeNormals(bool bValue);
00107         PLRENDERER_API FixedFunctions::Shade::Enum GetShadeMode() const;
00108         PLRENDERER_API void SetShadeMode(FixedFunctions::Shade::Enum nValue);
00109 
00110 
00111     //[-------------------------------------------------------]
00112     //[ Public functions                                      ]
00113     //[-------------------------------------------------------]
00114     public:
00115         /**
00116         *  @brief
00117         *    Constructor
00118         */
00119         PLRENDERER_API FixedFunctionsRenderStates();
00120 
00121         /**
00122         *  @brief
00123         *    Copy constructor
00124         *
00125         *  @param[in] cSource
00126         *    Source to copy from
00127         */
00128         PLRENDERER_API FixedFunctionsRenderStates(const FixedFunctionsRenderStates &cSource);
00129 
00130         /**
00131         *  @brief
00132         *    Destructor
00133         */
00134         PLRENDERER_API virtual ~FixedFunctionsRenderStates();
00135 
00136         /**
00137         *  @brief
00138         *    Retrieves a render-state value
00139         *
00140         *  @param[in] nState
00141         *    State variable that is being queried. This parameter can
00142         *    be any member of the render state enumerated type.
00143         *
00144         *  @return
00145         *    The value of the queried render state variable
00146         *
00147         *  @note
00148         *    - Some settings aren't set by the material through the default setting
00149         */
00150         PLRENDERER_API PLCore::uint32 Get(FixedFunctions::RenderState::Enum nState) const;
00151 
00152         /**
00153         *  @brief
00154         *    Sets a single render-state parameter
00155         *
00156         *  @param[in] nState
00157         *    State variable that is being modified. This parameter can
00158         *    be any member of the render state enumerated type.
00159         *  @param[in] nValue
00160         *    New value for the render state to be set. The meaning of
00161         *    this parameter is dependent on the value specified for nState.
00162         *    For example, if nState is FogMode, the second parameter
00163         *    must be one member of the FogMode enumerated type. (e.g. Fog::Exp)
00164         *    You can also set the value to unknown - then this state is ignored.
00165         *
00166         *  @return
00167         *    'true' if all went fine, else 'false'
00168         */
00169         PLRENDERER_API bool Set(FixedFunctions::RenderState::Enum nState, PLCore::uint32 nValue);
00170 
00171         /**
00172         *  @brief
00173         *    Copy operator
00174         *
00175         *  @param[in] cSource
00176         *    Source to copy from
00177         *
00178         *  @return
00179         *    This class
00180         */
00181         PLRENDERER_API FixedFunctionsRenderStates &operator =(const FixedFunctionsRenderStates &cSource);
00182 
00183 
00184     //[-------------------------------------------------------]
00185     //[ Private data                                          ]
00186     //[-------------------------------------------------------]
00187     private:
00188         // Exported variables
00189         PLCore::uint32 m_nRS[FixedFunctions::RenderState::Number];  /**< List of render states (see FixedFunctions::RenderState) */
00190 
00191 
00192 };
00193 
00194 
00195 //[-------------------------------------------------------]
00196 //[ Namespace                                             ]
00197 //[-------------------------------------------------------]
00198 } // PLRenderer
00199 
00200 
00201 #endif // __PLRENDERER_FIXEDFUNCTIONSRENDERSTATES_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:53
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported