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;
|
|
|
|
|
|
|
|
|
|
//
|
2011-01-16 00:47:37 +00:00
|
|
|
|
class Texture2D : public Texture, virtual Object
|
2010-12-04 16:14:34 +00:00
|
|
|
|
{
|
|
|
|
|
private:
|
2011-05-02 17:33:24 +00:00
|
|
|
|
GraphicsDevice* device;
|
2010-12-04 16:14:34 +00:00
|
|
|
|
int _height; // The height of the texture before resizing it
|
|
|
|
|
bool _isDisposed; // True when the texture has been disposed
|
|
|
|
|
int _numberOfLevels; // The number of mip levels for the texture
|
|
|
|
|
TextureUsage_t _textureUsage;
|
|
|
|
|
SurfaceFormat_t _surfaceFormat; // The colour format of the texture
|
|
|
|
|
int _width; // the width of the texture before resizing it
|
|
|
|
|
int textureId; // The reference ID of the texture in OpenGL memory
|
|
|
|
|
int imageId;
|
|
|
|
|
|
|
|
|
|
void Load(byte buffer[]);
|
2011-05-02 17:33:24 +00:00
|
|
|
|
Texture2D(GraphicsDevice* graphicsDevice);
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void Dispose(bool disposing);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
SurfaceFormat_t Format();
|
2011-11-07 01:29:50 +00:00
|
|
|
|
int getHeight();
|
|
|
|
|
TextureUsage_t TextureUsage();
|
|
|
|
|
int getWidth();
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
2011-01-16 00:47:37 +00:00
|
|
|
|
Texture2D();
|
2011-05-02 17:33:24 +00:00
|
|
|
|
Texture2D(GraphicsDevice* graphicsDevice, int width, int height);
|
|
|
|
|
Texture2D(GraphicsDevice* graphicsDevice, int width, int height, int numberLevels, TextureUsage_t usage, SurfaceFormat_t format);
|
2011-06-09 12:57:16 +00:00
|
|
|
|
Texture2D(const Texture2D &obj); // Copy constructor
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
2011-11-07 01:29:50 +00:00
|
|
|
|
static Texture2D FromFile(GraphicsDevice* graphicsDevice, Stream* textureStream);
|
|
|
|
|
static Texture2D FromFile(GraphicsDevice* graphicsDevice, Stream* textureStream, TextureCreationParameters creationParameters);
|
|
|
|
|
static Texture2D FromFile(GraphicsDevice* graphicsDevice, Stream* textureStream, int numberBytes);
|
|
|
|
|
static Texture2D FromFile(GraphicsDevice* graphicsDevice, Stream* textureStream, int numberBytes, TextureCreationParameters creationParameters);
|
|
|
|
|
static Texture2D FromFile(GraphicsDevice* graphicsDevice, char* filename);
|
|
|
|
|
static Texture2D FromFile(GraphicsDevice* graphicsDevice, char* filename, TextureCreationParameters creationParameters);
|
|
|
|
|
static Texture2D FromFile(GraphicsDevice* graphicsDevice, char* filename, int width, int height);
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
|
void GetData(T data[]);
|
|
|
|
|
template <class T>
|
|
|
|
|
void GetData(T data[], int startIndex, int elementCount);
|
|
|
|
|
template <class T>
|
|
|
|
|
void GetData(int level, Rectangle rect, T data[], int startIndex, int elementCount);
|
|
|
|
|
template <class T>
|
|
|
|
|
void SetData(T data[]);
|
|
|
|
|
template <class T>
|
|
|
|
|
void SetData(T data[], int startIndex, int elementCount, SetDataOptions_t options);
|
|
|
|
|
template <class T>
|
|
|
|
|
void SetData(int level, Rectangle rect, T data[], int startIndex, int elementCount, SetDataOptions_t options);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-27 01:01:25 +00:00
|
|
|
|
#endif //_XFX_GRAPHICS_TEXTURE2D_
|