2010-12-04 16:14:34 +00:00
|
|
|
|
/********************************************************
|
|
|
|
|
* Texture2D.h *
|
|
|
|
|
* *
|
|
|
|
|
* XFX Texture2D definition file *
|
|
|
|
|
* Copyright <EFBFBD> XFX Team. All Rights Reserved *
|
|
|
|
|
********************************************************/
|
2010-12-27 01:01:25 +00:00
|
|
|
|
#ifndef _XFX_GRAPHICS_TEXTURE2D_
|
|
|
|
|
#define _XFX_GRAPHICS_TEXTURE2D_
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
#include "Texture.h"
|
|
|
|
|
#include <System/IO/Stream.h>
|
2011-06-09 12:57:16 +00:00
|
|
|
|
#include <System/Types.h>
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
using namespace System;
|
|
|
|
|
using namespace System::IO;
|
|
|
|
|
|
|
|
|
|
namespace XFX
|
|
|
|
|
{
|
2010-12-27 01:01:25 +00:00
|
|
|
|
struct Rectangle;
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
namespace Graphics
|
|
|
|
|
{
|
2011-11-07 01:29:50 +00:00
|
|
|
|
class GraphicsDevice;
|
|
|
|
|
|
2012-09-28 20:36:02 +00:00
|
|
|
|
//
|
|
|
|
|
class Texture2D : public Texture
|
2010-12-04 16:14:34 +00:00
|
|
|
|
{
|
|
|
|
|
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
|
2012-09-28 20:36:02 +00:00
|
|
|
|
uint* textureData;
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
void Load(byte buffer[]);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void Dispose(bool disposing);
|
|
|
|
|
|
|
|
|
|
public:
|
2012-09-28 20:36:02 +00:00
|
|
|
|
Rectangle getBounds() const;
|
2012-03-29 22:02:43 +00:00
|
|
|
|
SurfaceFormat_t Format() const;
|
|
|
|
|
const int Height;
|
|
|
|
|
const int Width;
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
2012-09-28 20:36:02 +00:00
|
|
|
|
Texture2D();
|
|
|
|
|
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;
|
|
|
|
|
int GetType() const;
|
|
|
|
|
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, const SetDataOptions_t options);
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
2012-09-28 20:36:02 +00:00
|
|
|
|
bool operator ==(const Texture2D& right) const;
|
|
|
|
|
bool operator !=(const Texture2D& right) const;
|
2010-12-04 16:14:34 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-27 01:01:25 +00:00
|
|
|
|
#endif //_XFX_GRAPHICS_TEXTURE2D_
|