1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00
Tom Lint c56db35373 Added some ContentTypeReaders
Added xnbbuild project skeleton
Added Model and supporting classes
Updated files
2013-08-11 22:41:39 +02:00

74 lines
2.2 KiB
C++

/*****************************************************************************
* Texture2D.h *
* *
* XFX::Graphics::Texture2D class definition file *
* Copyright (c) XFX Team. All Rights Reserved *
*****************************************************************************/
#ifndef _XFX_GRAPHICS_TEXTURE2D_
#define _XFX_GRAPHICS_TEXTURE2D_
#include "Texture.h"
#include <System/IO/Stream.h>
#include <System/Types.h>
using namespace System;
using namespace System::IO;
namespace XFX
{
struct Rectangle;
namespace Content
{
class Texture2DReader;
}
namespace Graphics
{
class GraphicsDevice;
/**
* Represents a 2D grid of texels.
*/
class Texture2D : public Texture
{
friend class XFX::Content::Texture2DReader;
private:
bool _isDisposed; // True when the texture has been disposed
int _numberOfLevels; // The number of mip levels for the texture
SurfaceFormat_t _surfaceFormat; // The colour format of the texture
int textureId; // The reference ID of the texture in OpenGL memory
uint* textureData;
void Load(byte buffer[]);
protected:
void Dispose(bool disposing);
public:
Rectangle getBounds() const;
SurfaceFormat_t Format() const;
const int Height;
const int Width;
Texture2D(GraphicsDevice * const graphicsDevice, const int width, const int height);
Texture2D(GraphicsDevice * const graphicsDevice, const int width, const int height, bool mipmap, const SurfaceFormat_t format);
virtual ~Texture2D();
static Texture2D* FromStream(GraphicsDevice * const graphicsDevice, Stream * const stream);
static Texture2D* FromStream(GraphicsDevice * const graphicsDevice, Stream * const stream, int width, int height, bool zoom);
void GetData(uint data[], const int startIndex, const int elementCount) const;
static const Type& GetType();
void SaveAsJpeg(Stream * const stream, int width, int height);
void SaveAsPng(Stream * const stream, int width, int height);
void SetData(uint data[], const int startIndex, const int elementCount);
bool operator ==(const Texture2D& right) const;
bool operator !=(const Texture2D& right) const;
};
}
}
#endif //_XFX_GRAPHICS_TEXTURE2D_