Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
renderbuffer.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2003-2005 by Marten Svanfeldt 00003 Anders Stenberg 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_CSGFX_RENDERBUFFER_H__ 00021 #define __CS_CSGFX_RENDERBUFFER_H__ 00022 00026 #include "csextern.h" 00027 #include "csutil/leakguard.h" 00028 #include "ivideo/rndbuf.h" 00029 00034 SCF_VERSION (csRenderBuffer, 0, 2, 0); 00035 00040 struct csInterleavedSubBufferOptions 00041 { 00043 csRenderBufferComponentType componentType; 00045 uint componentCount; 00046 }; 00047 00051 class CS_CRYSTALSPACE_EXPORT csRenderBuffer : public iRenderBuffer 00052 { 00053 protected: 00057 csRenderBuffer (size_t size, csRenderBufferType type, 00058 csRenderBufferComponentType componentType, uint componentCount, 00059 size_t rangeStart, size_t rangeEnd, bool copy); 00060 public: 00061 SCF_DECLARE_IBASE; 00062 CS_LEAKGUARD_DECLARE (csRenderBuffer); 00063 00067 virtual ~csRenderBuffer (); 00068 00074 virtual void* Lock (csRenderBufferLockType lockType); 00075 00077 virtual void Release(); 00078 00082 virtual void CopyInto (const void *data, size_t elementCount, 00083 size_t elemOffset = 0); 00084 00086 virtual int GetComponentCount () const 00087 { 00088 return compCount; 00089 } 00090 00092 virtual csRenderBufferComponentType GetComponentType () const 00093 { 00094 return comptype; 00095 } 00096 00098 virtual csRenderBufferType GetBufferType() const 00099 { 00100 return bufferType; 00101 } 00102 00104 virtual size_t GetSize() const 00105 { 00106 return bufferSize; 00107 } 00108 00110 virtual size_t GetStride() const 00111 { 00112 return stride; 00113 } 00114 00115 virtual size_t GetElementDistance() const 00116 { 00117 return stride ? stride : 00118 compCount * csRenderBufferComponentSizes[comptype]; 00119 } 00120 00121 virtual size_t GetOffset() const 00122 { return offset; } 00123 00125 virtual uint GetVersion () 00126 { 00127 return version; 00128 } 00129 00130 virtual bool IsMasterBuffer () 00131 { 00132 return !masterBuffer.IsValid(); 00133 } 00134 00135 virtual iRenderBuffer* GetMasterBuffer () const 00136 { 00137 return masterBuffer; 00138 } 00139 00140 virtual bool IsIndexBuffer() const 00141 { return isIndex; } 00142 00143 virtual size_t GetRangeStart() const 00144 { return rangeStart; } 00145 virtual size_t GetRangeEnd() const 00146 { return rangeEnd; } 00147 00148 virtual size_t GetElementCount() const; 00149 00165 static csRef<iRenderBuffer> CreateRenderBuffer (size_t elementCount, 00166 csRenderBufferType type, csRenderBufferComponentType componentType, 00167 uint componentCount, bool copy = true); 00185 static csRef<iRenderBuffer> CreateIndexRenderBuffer (size_t elementCount, 00186 csRenderBufferType type, csRenderBufferComponentType componentType, 00187 size_t rangeStart, size_t rangeEnd, bool copy = true); 00210 static csRef<iRenderBuffer> CreateInterleavedRenderBuffers (size_t elementCount, 00211 csRenderBufferType type, uint count, 00212 const csInterleavedSubBufferOptions* elements, 00213 csRef<iRenderBuffer>* buffers); 00214 00219 static const char* GetDescrFromBufferName (csRenderBufferName bufferName); 00224 static csRenderBufferName GetBufferNameFromDescr (const char* name); 00225 protected: 00227 csRenderBufferType bufferType; 00229 csRenderBufferComponentType comptype; 00230 00232 size_t bufferSize; 00234 uint compCount; 00236 size_t stride; 00238 size_t offset; 00239 00241 size_t rangeStart; 00243 size_t rangeEnd; 00244 00246 unsigned int version; 00247 00249 bool doCopy; 00251 bool doDelete; 00253 bool isLocked; 00255 bool isIndex; 00256 00258 unsigned char *buffer; 00260 csRenderBufferLockType lastLock; 00261 00262 csRef<iRenderBuffer> masterBuffer; 00263 }; 00264 00267 #endif // __CS_CSGFX_RENDERBUFFER_H__
Generated for Crystal Space by doxygen 1.4.4