Ver Fonte

Delete GLTexture and GLTextureManager

Daniele Bartolini há 13 anos atrás
pai
commit
1393674a26

+ 0 - 191
src/renderers/gl/GLTexture.cpp

@@ -1,191 +0,0 @@
-/*
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include "GLTexture.h"
-#include "Image.h"
-#include "Pixel.h"
-#include "GLTextureManager.h"
-#include "Log.h"
-#include "GLUtils.h"
-#include <GL/glew.h>
-
-namespace crown
-{
-
-//GLTexture::GLTexture() :
-//	mTextureObject(0)
-//{
-//}
-
-//GLTexture::~GLTexture()
-//{
-//}
-
-//GLenum GLTexture::GetGLTarget() const
-//{
-//	return GL::GetTextureTarget(mType);
-//}
-
-//GLuint GLTexture::GetGLObject() const
-//{
-//	return mTextureObject;
-//}
-
-//GLenum GLTexture::GetGLTextureFormat() const
-//{
-//	int32_t value;
-//	glGetTexLevelParameteriv(GetGLTarget(), 0, GL_TEXTURE_INTERNAL_FORMAT, &value);
-//	return value;
-//}
-
-//void GLTexture::Load(const char* name)
-//{
-//	glGenTextures(1, &mTextureObject);
-
-//	LoadFromFile(name);
-//}
-
-//void GLTexture::Unload(const char* name, bool reload)
-//{
-//	glDeleteTextures(1, &mTextureObject);
-
-//	if (reload)
-//	{
-//		Load(name);
-//	}
-//}
-
-//void GLTexture::LoadFromFile(const char* relativePath)
-//{
-//	Image* image;
-
-//	image = ImageLoader::Load(relativePath);
-//	// In case of fail, use the fallback image
-//	if (!image)
-//	{
-//		Log::E("%s: Loading failed, using fallback.", relativePath);
-//		LoadFromImage(GetTextureManager()->GetFallback());
-//		return;
-//	}
-
-//	LoadFromImage(image);
-//	delete image;
-//}
-
-//void GLTexture::LoadFromFile(const char* relativePath, Color4 colorKey)
-//{
-//	Image* image;
-
-//	image = ImageLoader::Load(relativePath);
-//	// In case of fail, use the fallback image
-//	if (!image)
-//	{
-//		Log::E("%s: Loading failed, using fallback.", relativePath);
-//		LoadFromImage(GetTextureManager()->GetFallback());
-//		return;
-//	}
-
-//	image->ApplyColorKeying(colorKey);
-//	LoadFromImage(image);
-//	delete image;
-//}
-
-//void GLTexture::LoadFromFile(const char* relativePath, const char* alphaGreyscale)
-//{
-//	Image* image;
-
-//	image = ImageLoader::Load(relativePath);
-//	// In case of fail, use the fallback image
-//	if (!image)
-//	{
-//		Log::E("%s: Loading failed, using fallback.", relativePath);
-//		LoadFromImage(GetTextureManager()->GetFallback());
-//		return;
-//	}
-
-//	Image* greyscaleImage;
-//	greyscaleImage = ImageLoader::Load(alphaGreyscale);
-//	if (!greyscaleImage)
-//	{
-//		Log::E("%s: Loading failed, no alpha map applied.", alphaGreyscale);
-//	}
-//	else
-//	{
-//		image->ApplyGreyscaleToAlpha(greyscaleImage);
-//		delete greyscaleImage;
-//	}
-
-//	LoadFromImage(image);
-//	delete image;
-//}
-
-//void GLTexture::LoadFromImage(const Image* image)
-//{
-//	GLenum target = GetGLTarget();
-//	glBindTexture(target, mTextureObject);
-
-//	PixelFormat imageFormat = image->GetFormat();
-//	GLint textureFormat = GL::GetPixelFormat(imageFormat); 
-
-//	if (mGenerateMipMaps)
-//	{
-//		glTexParameteri(target, GL_GENERATE_MIPMAP, GL_TRUE);
-//	}
-
-//	glTexImage2D(target, 0, GL_RGBA, image->GetWidth(), image->GetHeight(), 0,
-//		textureFormat, GL_UNSIGNED_BYTE, image->GetBuffer());
-
-//	mWidth = image->GetWidth();
-//	mHeight = image->GetHeight();
-//}
-
-//Image* GLTexture::GetImage() const
-//{
-//	glPixelStoref(GL_UNPACK_ALIGNMENT, 1);
-
-//	GLenum target = GetGLTarget();
-//	glBindTexture(target, mTextureObject);
-
-//	
-
-//	GLenum glFormat = GetGLTextureFormat();
-//	PixelFormat format = GetTextureFormat();
-//	int32_t bytesPerPixel = Pixel::GetBytesPerPixel(format);
-
-//	uint8_t* texData = new uint8_t[GetWidth() * GetHeight() * bytesPerPixel];
-
-//	glGetTexImage(target, 0, glFormat, GL_UNSIGNED_BYTE, texData);
-//	
-//	Image* image = new Image(format, GetWidth(), GetHeight(), texData);
-//	return image;
-//}
-
-//PixelFormat GLTexture::GetTextureFormat() const
-//{
-//	return GL::GetPixelFormatFromGLFormat(GetGLTextureFormat());
-//}
-
-} // namespace crown
-

+ 0 - 66
src/renderers/gl/GLTexture.h

@@ -1,66 +0,0 @@
-/*
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#pragma once
-
-#include <GL/glew.h>
-#include "Types.h"
-#include "TextureResource.h"
-
-namespace crown
-{
-
-class GLTexture
-{
-
-public:
-
-//					GLTexture();
-//					~GLTexture();
-
-//	GLenum			GetGLTarget() const;	//!< Returns the OpenGL's texture target
-//	GLuint			GetGLObject() const;	//!< Returns the OpenGL's texture object
-//	
-//	GLenum			GetGLTextureFormat() const;
-
-//	virtual void	Load(const char* name);
-//	virtual void	Unload(const char* name, bool reload);
-
-//	void			LoadFromFile(const char* relativePath);
-//	void			LoadFromFile(const char* relativePath, Color4 colorKey);
-//	void			LoadFromFile(const char* relativePath, const char* alphaGreyscale);
-
-//	void			LoadFromImage(const Image* image);
-
-//	Image*			GetImage() const;
-//	PixelFormat		GetTextureFormat() const;
-
-private:
-
-	GLuint			mTextureObject;
-};
-
-} // namespace crown
-

+ 0 - 99
src/renderers/gl/GLTextureManager.cpp

@@ -1,99 +0,0 @@
-/*
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include "GLTextureManager.h"
-#include "GLTexture.h"
-
-namespace crown
-{
-
-//Texture* GLTextureManager::Create(const char* name, bool& created)
-//{
-//	Texture* texture = static_cast<GLTexture*>(ResourceManager::Create(name, created));
-
-//	return texture;
-//}
-
-//Texture* GLTextureManager::Load(const char* name, bool generateMipMaps)
-//{
-//	bool created;
-//	Texture* texture = Create(name, created);
-
-//	if (texture != NULL && created)
-//	{
-//		// Populate parameters
-//		texture->SetGenerateMipMaps(generateMipMaps);
-
-//		texture->Load(name);
-//	}
-
-//	return texture;
-//}
-
-//Texture* GLTextureManager::Load(const char* name, bool generateMipMaps, Color4 colorKey)
-//{
-//	bool created;
-//	Texture* texture = Create(name, created);
-
-//	if (texture != NULL && created)
-//	{
-//		// Populate parameters
-//		texture->SetGenerateMipMaps(generateMipMaps);
-
-//		texture->LoadFromFile(name, colorKey);
-//	}
-
-//	return texture;
-//}
-
-//Texture* GLTextureManager::Load(const char* name, const char* greyscaleAlpha, bool generateMipMaps)
-//{
-//	bool created;
-//	Texture* texture = Create(name, created);
-
-//	if (texture != NULL && created)
-//	{
-//		// Populate parameters
-//		texture->SetGenerateMipMaps(generateMipMaps);
-
-//		texture->LoadFromFile(name, greyscaleAlpha);
-//	}
-
-//	return texture;
-//}
-
-//GLTexture* GLTextureManager::CreateSpecific(const char* name)
-//{
-//	return new GLTexture();
-//}
-
-//GLTextureManager textureMgr;
-//TextureManager* GetTextureManager()
-//{
-//	return &textureMgr;
-//}
-
-} // namespace crown
-

+ 0 - 81
src/renderers/gl/GLTextureManager.h

@@ -1,81 +0,0 @@
-/*
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#pragma once
-
-#include "GLTexture.h"
-
-namespace crown
-{
-
-class GLTextureManager
-{
-
-public:
-
-//	GLTextureManager() {}
-
-//	/**
-//	 * Creates a texture resource withe the given name.
-//	 * If a resource with the same name already exists, the
-//	 * already existent resource will be returned. In order
-//	 * to distinguish between a newly created resource or a
-//	 * point32_ter to an existing one, you have to check
-//	 * at the value returned by 'created'.
-//	 * @param name The name of the resource
-//	 * @param created Returns true if newly created, false otherwise
-//	 * @return A point32_ter to the created resource
-//	 */
-//	Texture* Create(const char* name, bool& created);
-
-//	/**
-//	 * Loads a texture resource from file.
-//	 * The name of the file determines the name of the resource and vice-versa.
-//	 * @param name Tha name of the resource
-//	 * @return A point32_ter to the loaded resource
-//	 */
-//	Texture* Load(const char* name, bool generateMipMaps = true);
-
-//	/**
-//	 * Loads a texture resource from file using color keying.
-//	 * The name of the file determines the name of the resource and vice-versa.
-//	 * @param name The name of the resource
-//	 * @param colorKey The color to use as transparent color
-//	 * @return A point32_ter to the loaded resource
-//	 */
-//	Texture* Load(const char* name, bool generateMipMaps, Color4 colorKey);
-
-//	Texture* Load(const char* name, const char* greyscaleAlpha, bool generateMipMaps);
-
-//	GLTexture* CreateSpecific(const char* name);
-
-private:
-
-	GLTextureManager(const GLTextureManager&);
-	GLTextureManager& operator=(const GLTextureManager&);
-};
-
-} // namespace crown
-