#include "dxstdafx.h" #include ".\sharedresourcetexture.h" SharedResourceTexture::SharedResourceTexture(void) : SharedResource() { this->texture = NULL; this->creator = false; } SharedResourceTexture::~SharedResourceTexture(void) { SAFE_RELEASE(this->texture); } void SharedResourceTexture::createTexture(int _width, int _height, D3DFORMAT _format, DWORD _usage, D3DPOOL _pool) { HRESULT hr; this->width = _width; this->height = _height; this->format = _format; this->usage = _usage; this->pool = _pool; V( DXUTGetD3DDevice()->CreateTexture( this->width, this->height, 1, this->usage, this->format, this->pool, &this->texture, NULL ) ); this->creator = true; } void SharedResourceTexture::setTexture(IDirect3DTexture9* _texture) { this->texture = _texture; } IDirect3DTexture9* SharedResourceTexture::getTexture() { return this->texture; } void SharedResourceTexture::OnLostDevice() { if(this->creator) { SAFE_RELEASE(this->texture); } }