PixelLightAPI  .
SamplerStates.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SamplerStates.h                                *
00003  *
00004  *  Copyright (C) 2002-2011 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_SAMPLERSTATES_H__
00024 #define __PLRENDERER_SAMPLERSTATES_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/Base/Object.h>
00032 #include "PLRenderer/PLRenderer.h"
00033 #include "PLRenderer/Renderer/Types.h"
00034 
00035 
00036 //[-------------------------------------------------------]
00037 //[ Namespace                                             ]
00038 //[-------------------------------------------------------]
00039 namespace PLRenderer {
00040 
00041 
00042 //[-------------------------------------------------------]
00043 //[ Classes                                               ]
00044 //[-------------------------------------------------------]
00045 /**
00046 *  @brief
00047 *    Sampler states RTTI wrapper class
00048 */
00049 class SamplerStates : public PLCore::Object {
00050 
00051 
00052     //[-------------------------------------------------------]
00053     //[ RTTI interface                                        ]
00054     //[-------------------------------------------------------]
00055     pl_class(PLRENDERER_RTTI_EXPORT, SamplerStates, "PLRenderer", PLCore::Object, "Sampler states RTTI wrapper class")
00056         // Attributes
00057             // Address modes
00058         pl_attribute(AddressU,      pl_enum_type(TextureAddressing::Enum),  TextureAddressing::Wrap,    ReadWrite,  GetSet, "Texture-address mode for the u/s coordinate",                                          "")
00059         pl_attribute(AddressV,      pl_enum_type(TextureAddressing::Enum),  TextureAddressing::Wrap,    ReadWrite,  GetSet, "Texture-address mode for the v/t coordinate",                                          "")
00060         pl_attribute(AddressW,      pl_enum_type(TextureAddressing::Enum),  TextureAddressing::Wrap,    ReadWrite,  GetSet, "Texture-address mode for the w/r coordinate",                                          "")
00061             // Filter
00062         pl_attribute(MagFilter,     pl_enum_type(TextureFiltering::Enum),   TextureFiltering::Linear,   ReadWrite,  GetSet, "Magnification filter",                                                                 "")
00063         pl_attribute(MinFilter,     pl_enum_type(TextureFiltering::Enum),   TextureFiltering::Linear,   ReadWrite,  GetSet, "Minification filter",                                                                  "")
00064         pl_attribute(MipFilter,     pl_enum_type(TextureFiltering::Enum),   TextureFiltering::Linear,   ReadWrite,  GetSet, "Mipmap filter to use during minification",                                             "")
00065             // Filter
00066         pl_attribute(MipmapLODBias, float,                                  0.0f,                       ReadWrite,  GetSet, "Mipmap level of detail (LOD) bias",                                                    "")
00067         pl_attribute(MaxMapLevel,   PLCore::uint32,                         1000,                       ReadWrite,  GetSet, "LOD index of largest map to use. Values range from 0 to (n-1) where 0 is the largest", "")
00068         pl_attribute(MaxAnisotropy, PLCore::uint32,                         1,                          ReadWrite,  GetSet, "Maximum anisotropy",                                                                   "")
00069     pl_class_end
00070 
00071 
00072     //[-------------------------------------------------------]
00073     //[ Public RTTI get/set functions                         ]
00074     //[-------------------------------------------------------]
00075     public:
00076         // Address modes
00077         inline TextureAddressing::Enum GetAddressU() const;
00078         inline void SetAddressU(TextureAddressing::Enum nValue);
00079         inline TextureAddressing::Enum GetAddressV() const;
00080         inline void SetAddressV(TextureAddressing::Enum nValue);
00081         inline TextureAddressing::Enum GetAddressW() const;
00082         inline void SetAddressW(TextureAddressing::Enum nValue);
00083         // Filter
00084         inline TextureFiltering::Enum GetMagFilter() const;
00085         inline void SetMagFilter(TextureFiltering::Enum nValue);
00086         inline TextureFiltering::Enum GetMinFilter() const;
00087         inline void SetMinFilter(TextureFiltering::Enum nValue);
00088         inline TextureFiltering::Enum GetMipFilter() const;
00089         inline void SetMipFilter(TextureFiltering::Enum nValue);
00090         // Filter
00091         inline float GetMipmapLODBias() const;
00092         inline void SetMipmapLODBias(float fValue);
00093         inline PLCore::uint32 GetMaxMapLevel() const;
00094         inline void SetMaxMapLevel(int nValue);
00095         inline PLCore::uint32 GetMaxAnisotropy() const;
00096         inline void SetMaxAnisotropy(PLCore::uint32 nValue);
00097 
00098 
00099     //[-------------------------------------------------------]
00100     //[ Public functions                                      ]
00101     //[-------------------------------------------------------]
00102     public:
00103         /**
00104         *  @brief
00105         *    Constructor
00106         */
00107         PLRENDERER_API SamplerStates();
00108 
00109         /**
00110         *  @brief
00111         *    Copy constructor
00112         *
00113         *  @param[in] cSource
00114         *    Source to copy from
00115         */
00116         PLRENDERER_API SamplerStates(const SamplerStates &cSource);
00117 
00118         /**
00119         *  @brief
00120         *    Destructor
00121         */
00122         PLRENDERER_API virtual ~SamplerStates();
00123 
00124         /**
00125         *  @brief
00126         *    Retrieves a sampler-state value
00127         *
00128         *  @param[in] nState
00129         *    State variable that is being queried. This parameter can
00130         *    be any member of the sampler enumerated type.
00131         *
00132         *  @return
00133         *    The value of the queried sampler state variable
00134         */
00135         inline PLCore::uint32 Get(Sampler::Enum nState) const;
00136 
00137         /**
00138         *  @brief
00139         *    Sets a single sampler-state parameter
00140         *
00141         *  @param[in] nState
00142         *    State variable that is being modified. This parameter
00143         *    can be any member of the sampler enumerated type.
00144         *  @param[in] nValue
00145         *    New value for the sampler state to be set. The meaning of
00146         *    this parameter is dependent on the value specified for nState.
00147         *    For example, if nState is Sampler::AddressU, the second parameter
00148         *    must be one member of the Sampler::AddressU enumerated type. (e.g. TextureAddressing::Wrap)
00149         *    You can also set the value to unknown - then this state is ignored.
00150         *
00151         *  @return
00152         *    'true' if all went fine, else 'false'
00153         */
00154         inline bool Set(Sampler::Enum nState, PLCore::uint32 nValue);
00155 
00156         /**
00157         *  @brief
00158         *    Copy operator
00159         *
00160         *  @param[in] cSource
00161         *    Source to copy from
00162         *
00163         *  @return
00164         *    This class
00165         */
00166         inline SamplerStates &operator =(const SamplerStates &cSource);
00167 
00168 
00169     //[-------------------------------------------------------]
00170     //[ Private data                                          ]
00171     //[-------------------------------------------------------]
00172     private:
00173         // Exported variables
00174         PLCore::uint32 m_nSS[Sampler::Number];  /**< List of sampler states (see Sampler) */
00175 
00176 
00177 };
00178 
00179 
00180 //[-------------------------------------------------------]
00181 //[ Namespace                                             ]
00182 //[-------------------------------------------------------]
00183 } // PLRenderer
00184 
00185 
00186 //[-------------------------------------------------------]
00187 //[ Implementation                                        ]
00188 //[-------------------------------------------------------]
00189 #include "PLRenderer/Renderer/SamplerStates.inl"
00190 
00191 
00192 #endif // __PLRENDERER_SAMPLERSTATES_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:00
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported