41 #ifndef _graphicstexture_cpp
42 #define _graphicstexture_cpp
44 #include "Graphics/texture.h"
49 #include <OgrePixelFormat.h>
118 if( BufferSize < TexSize ) {
125 PixelBuffer->lock(Ogre::HardwareBuffer::HBL_NORMAL);
126 const Ogre::PixelBox& Box = PixelBuffer->getCurrentLock();
128 UInt8* SrcBuf =
static_cast<UInt8*
>(Box.data);
133 PixelBuffer->unlock();
140 if( this->
GetSize() != BufferSize ) {
147 PixelBuffer->lock(Ogre::HardwareBuffer::HBL_NORMAL);
148 const Ogre::PixelBox& Box = PixelBuffer->getCurrentLock();
150 UInt8* DestBuf =
static_cast<UInt8*
>(Box.data);
151 Whole PixelCount = BufferSize / Ogre::PixelUtil::getNumElemBytes(static_cast<Ogre::PixelFormat>(SrcFormat));
152 Ogre::PixelUtil::bulkPixelConversion(SrcBuffer,static_cast<Ogre::PixelFormat>(SrcFormat),DestBuf,this->
_GetInternalTexture()->getFormat(),PixelCount);
155 PixelBuffer->unlock();
UInt32 GetOriginalHeight() const
Gets the height of the source Texture in pixels.
InternalTextureData * ITD
A pointer to the internal implementation of the Texture.
const String & GetName() const
Gets the Name of this Texture.
Graphics::PixelFormat GetFormat() const
Gets the pixel format of this Texture.
Whole GetNumMipMaps() const
Gets the number of MipMaps that exist for this Texture.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Ogre::TexturePtr GraphicsTexture
The internal representation of the Texture.
Whole _ReadFromBuffer(UInt8 *DestBuffer, const Whole BufferSize)
Reads from the internal buffer and populates the provided buffer with the texture data...
Whole GetSize() const
Gets the size of this Texture.
uint8_t UInt8
An 8-bit unsigned integer.
This class is used to store the internal structures needed by the Texture class.
This implements the exception hiearchy for Mezzanine.
const String & GetGroup() const
Gets the resource group this Texture belongs to.
uint32_t UInt32
An 32-bit unsigned integer.
PixelFormat
This is used to describe how bits are arraged for each pixel in an image.
~Texture()
Class Destructor.
Thrown when parameters are checked at runtime and found invalid.
UInt32 GetOriginalWidth() const
Gets the width of the source Texture in pixels.
The bulk of the engine components go in this namspace.
void _WriteToBuffer(UInt8 *SrcBuffer, const Whole BufferSize, const Graphics::PixelFormat SrcFormat)
Writes to the textures internal buffer. the size of this texture is smaller than the buffer being wri...
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Texture(Ogre::TexturePtr InternalTexture)
Class Constructor.
Ogre::TexturePtr _GetInternalTexture() const
Gets the internal Texture pointer.
std::string String
A datatype used to a series of characters.
UInt32 GetOriginalDepth() const
Gets the depth of the source Texture in pixels.