PixelLightAPI  .
UniformBuffer.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: UniformBuffer.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_UNIFORMBUFFER_H__
00024 #define __PLRENDERER_UNIFORMBUFFER_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLRenderer/Renderer/Buffer.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLRenderer {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Classes                                               ]
00042 //[-------------------------------------------------------]
00043 /**
00044 *  @brief
00045 *    Abstract renderer uniform buffer (UBO, aka "constant buffer") resource
00046 */
00047 class UniformBuffer : public Buffer {
00048 
00049 
00050     //[-------------------------------------------------------]
00051     //[ Public functions                                      ]
00052     //[-------------------------------------------------------]
00053     public:
00054         /**
00055         *  @brief
00056         *    Destructor
00057         */
00058         PLRENDERER_API virtual ~UniformBuffer();
00059 
00060         /**
00061         *  @brief
00062         *    Copy operator
00063         *
00064         *  @param[in] cSource
00065         *    Source to copy from
00066         *
00067         *  @return
00068         *    Reference to this object
00069         */
00070         PLRENDERER_API UniformBuffer &operator =(const UniformBuffer &cSource);
00071 
00072         /**
00073         *  @brief
00074         *    Copies data from a given buffer into this uniform buffer
00075         *
00076         *  @param[in] pData
00077         *    Data to copy into this uniform buffer, must be valid and must have at least "GetSize()" bytes
00078         *
00079         *  @remarks
00080         *    This ease of use method locks the uniform buffer, copies the
00081         *    given data into it and unlocks the uniform buffer when done.
00082         */
00083         inline void CopyFrom(const void *pData);
00084 
00085         /**
00086         *  @brief
00087         *    Copies data from this uniform buffer into a given buffer
00088         *
00089         *  @param[out] pData
00090         *    Buffer to copy into, must be valid and must have at least "GetSize()" bytes
00091         *
00092         *  @remarks
00093         *    This ease of use method locks the uniform buffer, copies the uniform buffer
00094         *    data into the given buffer and unlocks the uniform buffer when done.
00095         */
00096         inline void CopyTo(void *pData);
00097 
00098 
00099     //[-------------------------------------------------------]
00100     //[ Public virtual UniformBuffer functions                ]
00101     //[-------------------------------------------------------]
00102     public:
00103         /**
00104         *  @brief
00105         *    Returns the name of the shader language the uniform buffer is using
00106         *
00107         *  @return
00108         *    The name of the shader language the uniform buffer is using (for example "GLSL" or "Cg")
00109         *
00110         *  @remarks
00111         *    In theory, the uniform buffer is independent of the used shader language because it's just a buffer.
00112         *    In practice, e.g. the Cg shader language comes with it's own way how to create and use uniform buffers,
00113         *    that's the only reason PixelLight connects an uniform buffer with a shader language.
00114         */
00115         virtual PLCore::String GetShaderLanguage() const = 0;
00116 
00117 
00118     //[-------------------------------------------------------]
00119     //[ Protected functions                                   ]
00120     //[-------------------------------------------------------]
00121     protected:
00122         /**
00123         *  @brief
00124         *    Constructor
00125         *
00126         *  @param[in] cRenderer
00127         *    Owner renderer
00128         */
00129         PLRENDERER_API UniformBuffer(Renderer &cRenderer);
00130 
00131 
00132     //[-------------------------------------------------------]
00133     //[ Private functions                                     ]
00134     //[-------------------------------------------------------]
00135     private:
00136         /**
00137         *  @brief
00138         *    Copy constructor
00139         *
00140         *  @param[in] cSource
00141         *    Source to copy from
00142         */
00143         UniformBuffer(const UniformBuffer &cSource);
00144 
00145 
00146     //[-------------------------------------------------------]
00147     //[ Public virtual Buffer functions                       ]
00148     //[-------------------------------------------------------]
00149     public:
00150         PLRENDERER_API virtual void *GetData() override;
00151 
00152 
00153 };
00154 
00155 
00156 //[-------------------------------------------------------]
00157 //[ Namespace                                             ]
00158 //[-------------------------------------------------------]
00159 } // PLRenderer
00160 
00161 
00162 //[-------------------------------------------------------]
00163 //[ Implementation                                        ]
00164 //[-------------------------------------------------------]
00165 #include "PLRenderer/Renderer/UniformBuffer.inl"
00166 
00167 
00168 #endif // __PLRENDERER_UNIFORMBUFFER_H__


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