Commit 4b442b5b authored by Robert Menzel's avatar Robert Menzel

removed unused/deprecated controller

parent 60510b1d
......@@ -137,7 +137,7 @@ namespace ACGL
* Returns false if a critical error occured, in that case the ACGL behavior is
* not defined.
*/
bool init(void);
bool init();
}
......
......@@ -4,40 +4,10 @@
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_HH
#define ACGL_OPENGL_CONTROLLER_HH
/*
* A shortcut to include all controller of OpenGL objects.
* Will also include the objects themself!
*/
#pragma once
#include <ACGL/ACGL.hh>
#include <ACGL/OpenGL/Objects.hh>
#include <ACGL/Resource/NameManager.hh>
#include <ACGL/Resource/FileManager.hh>
#include <ACGL/OpenGL/Controller/ArrayBufferControl.hh>
#include <ACGL/OpenGL/Controller/ArrayBufferControlFile.hh>
#include <ACGL/OpenGL/Controller/ArrayBufferControlFileATB.hh>
#include <ACGL/OpenGL/Controller/ElementArrayBufferControl.hh>
#include <ACGL/OpenGL/Controller/FrameBufferObjectControl.hh>
#include <ACGL/OpenGL/Controller/RenderBufferControl.hh>
#include <ACGL/OpenGL/Controller/RenderObjectControl.hh>
#include <ACGL/OpenGL/Controller/ShaderControlFile.hh>
#include <ACGL/OpenGL/Controller/ShaderProgramControlFiles.hh>
#include <ACGL/OpenGL/Controller/ShaderProgramObjectControl.hh>
#include <ACGL/OpenGL/Controller/DataControlFileFactory.hh>
#include <ACGL/OpenGL/Controller/TextureDataControlFileJPG.hh>
#include <ACGL/OpenGL/Controller/TextureControl.hh>
#include <ACGL/OpenGL/Controller/TextureControlCubeMap.hh>
#include <ACGL/OpenGL/Controller/TextureControlFile.hh>
#include <ACGL/OpenGL/Controller/VertexArrayObjectControl.hh>
#include <ACGL/OpenGL/Controller/VertexArrayObjectControlFile.hh>
#include <ACGL/OpenGL/Controller/UniformControl.hh>
#include <ACGL/OpenGL/Controller/ViewportControl.hh>
#include <ACGL/OpenGL/Controller/LocationMappingsControl.hh>
#endif // ACGL_OPENGL_CONTROLLER_HH
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROL_HH
#define ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROL_HH
/* *************** DEPRECATED ********************* */
#ifdef ACGL_INCLUDE_DEPRECATED_FUNCTIONALITY
#include <ACGL/ACGL.hh>
#include <ACGL/Resource/BasicCreateInterface.hh>
#include <ACGL/OpenGL/Objects/ArrayBuffer.hh>
#include <ACGL/OpenGL/GL.hh>
namespace ACGL{
namespace OpenGL{
class ArrayBufferControl : public Resource::BasicCreateInterface<ArrayBuffer>
{
// ==================================================================================================== \/
// ============================================================================================ STRUCTS \/
// ==================================================================================================== \/
public:
struct AttributeDefine
{
std::string name;
GLenum type;
GLint dimension;
GLboolean normalized;
GLboolean isInteger;
};
// ===================================================================================================== \/
// ============================================================================================ TYPEDEFS \/
// ===================================================================================================== \/
public:
typedef std::vector< AttributeDefine > AttributeDefineVec;
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
ArrayBufferControl(void)
: mUsage(GL_STATIC_DRAW),
mElements(0),
mpData(NULL),
mAttributeDefines()
{}
virtual ~ArrayBufferControl() {}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
inline ArrayBufferControl& usage (GLenum _usage) { mUsage = _usage; return *this; }
inline ArrayBufferControl& data (const GLvoid* _pData, GLsizei _elements)
{
mpData = _pData;
mElements = _elements;
return *this;
}
inline ArrayBufferControl& attribute (const std::string& _name, GLenum _type, GLint _dimension, GLboolean _normalized = GL_FALSE)
{
AttributeDefine a = {_name, _type, _dimension, _normalized, GL_FALSE};
mAttributeDefines.push_back(a);
return *this;
}
inline ArrayBufferControl& integerAttribute (const std::string& _name, GLenum _type, GLint _dimension)
{
AttributeDefine a = {_name, _type, _dimension, GL_FALSE, GL_TRUE};
mAttributeDefines.push_back(a);
return *this;
}
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
public:
virtual SharedArrayBuffer create(void);
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLenum mUsage;
GLsizei mElements;
const GLvoid* mpData;
AttributeDefineVec mAttributeDefines;
};
} // OpenGL
} // ACGL
#endif
#endif // ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROL_HH
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROLFILE_HH
#define ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROLFILE_HH
#ifdef ACGL_INCLUDE_DEPRECATED_FUNCTIONALITY
#include <ACGL/ACGL.hh>
#include <ACGL/Resource/SingleFileBasedCreator.hh>
#include <ACGL/OpenGL/Objects/ArrayBuffer.hh>
#include <ACGL/OpenGL/Controller/DataControlFile.hh>
#include <map>
#include <string>
namespace ACGL{
namespace OpenGL{
class ArrayBufferControlFile : public Resource::SingleFileBasedCreator<ArrayBuffer>
{
// ===================================================================================================== \/
// ============================================================================================ TYPEDEFS \/
// ===================================================================================================== \/
typedef std::map<uint_t, std::string> AttributeNameMap;
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
ArrayBufferControlFile(const std::string& _filename);
ArrayBufferControlFile(const char* _filename);
template<typename CONTROLLER>
ArrayBufferControlFile(const CONTROLLER& _fileController)
: Resource::SingleFileBasedCreator<ArrayBuffer>(_fileController.getFilename(), Base::Settings::the()->getFullGeometryPath()),
mDataController(new CONTROLLER(_fileController))
{}
virtual ~ArrayBufferControlFile(void) {}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
ArrayBufferControlFile& nameAttribute(uint_t _attributeIndex, const std::string& _name)
{
mAttributeNameMap[_attributeIndex] = _name;
return *this;
}
private:
bool load(SharedArrayBuffer& _ab);
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
public:
virtual SharedArrayBuffer create();
virtual bool update(SharedArrayBuffer& _ab);
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
SharedGeometryDataControlFile mDataController;
AttributeNameMap mAttributeNameMap;
};
} // OpenGL
} // ACGL
#endif
#endif // ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROLFILE_HH
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROLFILEATB_HH
#define ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROLFILEATB_HH
/* *************** DEPRECATED *********************
#include <ACGL/ACGL.hh>
#include <ACGL/Resource/SingleFileBasedCreator.hh>
#include <ACGL/Base/Settings.hh>
#include <ACGL/OpenGL/Objects/ArrayBuffer.hh>
#include <ACGL/OpenGL/Objects/ShaderProgram.hh>
#include <ACGL/OpenGL/GL.hh>
namespace ACGL{
namespace OpenGL{
class ArrayBufferControlFileATB : public Resource::SingleFileBasedCreator<ArrayBuffer>
{
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
ArrayBufferControlFileATB(const std::string& _filename)
: Resource::SingleFileBasedCreator<ArrayBuffer>(_filename, Base::Settings::the()->getFullGeometryPath()),
mpShaderProgram()
{}
virtual ~ArrayBufferControlFileATB() {}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
inline ArrayBufferControlFileATB& shaderProgram (const ConstSharedShaderProgram& _shaderProgram) { mpShaderProgram = _shaderProgram; return *this; }
private:
bool loadATB(SharedArrayBuffer& _arrayBuffer);
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
public:
virtual SharedArrayBuffer create(void);
virtual bool update(SharedArrayBuffer& _arrayBuffer);
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
ConstSharedShaderProgram mpShaderProgram;
};
} // OpenGL
} // ACGL
*/
#endif // ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROLFILEATB_HH
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_TEXTUREDATACONTROLFILE_HH
#define ACGL_OPENGL_CONTROLLER_TEXTUREDATACONTROLFILE_HH
#ifdef ACGL_INCLUDE_DEPRECATED_FUNCTIONALITY
/**
* Basetemplate for file loading.
*
* TextureDataControlFile and GeometryDataControlFile are typedefs below
*
* To support another filetype, derive from those and implement load() and registerType() methods.
* Also: add a call to the InitStaticFileTypes to register the file type globally.
*/
#include <ACGL/ACGL.hh>
#include <ACGL/Resource/SingleFileBasedCreator.hh>
#include <ACGL/Base/Settings.hh>
#include <ACGL/OpenGL/Data/TextureData.hh>
#include <ACGL/OpenGL/Data/GeometryData.hh>
namespace ACGL{
namespace OpenGL{
template<class DATA_FILE_TYPE>
class DataControlFile : public Resource::SingleFileBasedCreator<DATA_FILE_TYPE>
{
private:
typedef ptr::shared_ptr< DATA_FILE_TYPE > SharedDATA_FILE_TYPE;
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
DataControlFile(const std::string& _filename, const std::string& _resourcePath)
: Resource::SingleFileBasedCreator<DATA_FILE_TYPE>(_filename, _resourcePath)
{}
virtual ~DataControlFile(void) {}
// ====================================================================================================== \/
// ============================================================================================ INTERFACE \/
// ====================================================================================================== \/
private:
virtual bool load(SharedDATA_FILE_TYPE& texture) const = 0;
// ====================================================================================================== \/
// ============================================================================================= OVERRIDE \/
// ====================================================================================================== \/
public:
virtual SharedDATA_FILE_TYPE create(void)
{
Resource::SingleFileBasedCreator<DATA_FILE_TYPE>::updateFileModificationTime();
SharedDATA_FILE_TYPE texture(new DATA_FILE_TYPE());
if(load(texture))
return texture;
return SharedDATA_FILE_TYPE();
}
virtual bool update(SharedDATA_FILE_TYPE& _data)
{
if (Resource::SingleFileBasedCreator<DATA_FILE_TYPE>::fileIsUpToDate())
return false;
if(!load(_data))
return false;
Resource::SingleFileBasedCreator<DATA_FILE_TYPE>::updateFileModificationTime();
return true;
}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
static int_t getTypeID(void) { return sTypeID; }
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
static int_t sTypeID;
};
typedef DataControlFile< TextureData > TextureDataControlFile;
ACGL_SMARTPOINTER_TYPEDEFS( TextureDataControlFile )
typedef DataControlFile< GeometryData > GeometryDataControlFile;
ACGL_SMARTPOINTER_TYPEDEFS( GeometryDataControlFile )
} // OpenGL
} // ACGL
#endif
#endif // ACGL_OPENGL_CONTROLLER_TEXTUREDATACONTROLFILE_HH
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_DATACONTROLFILEFACTORY_HH
#define ACGL_OPENGL_CONTROLLER_DATACONTROLFILEFACTORY_HH
#ifdef ACGL_INCLUDE_DEPRECATED_FUNCTIONALITY
/**
* Image loaders can register the supported types at TextureDataControlFileFactory so a call like
* ... = TextureControlFile("bunny.ppm").create();
* will find the correct loader of the given file ending.
*/
#include <ACGL/ACGL.hh>
#include <ACGL/Base/Singleton.hh>
#include <ACGL/OpenGL/Controller/DataControlFile.hh>
#include <ACGL/Utils/StringHelpers.hh>
#include <map>
#include <string>
namespace ACGL{
namespace OpenGL{
//
// Generic FileFactories:
//
template<class DATA_CONTROL_FILE_TYPE>
class DataControlFileFactory : public Base::Singleton< DataControlFileFactory<DATA_CONTROL_FILE_TYPE> >
{
ACGL_SINGLETON(DataControlFileFactory)
// ========================================================================================================= \/
// ================================================================================================ TYPEDEFS \/
// ========================================================================================================= \/
private:
typedef DATA_CONTROL_FILE_TYPE (*factoryCreate)(const std::string&);
typedef std::map<std::string, factoryCreate> FactoryMap;
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
protected:
DataControlFileFactory(void) : mRegisteredTypes(0), mFactoryMap() {}
public:
virtual ~DataControlFileFactory(void) {}
// ========================================================================================================= \/
// ================================================================================================= METHODS \/
// ========================================================================================================= \/
public:
int_t getRegisteredTypes(void) const { return mRegisteredTypes; }
int_t registerType(const std::string& _type, factoryCreate _creator)
{
//ACGL::Utils::debug() << "DataControlFileFactory register type: " << _type << " with id " << mRegisteredTypes << std::endl;
mFactoryMap[_type] = _creator;
return mRegisteredTypes++;
}
DATA_CONTROL_FILE_TYPE create(const std::string& _filename) const
{
std::string file;
std::string extension;
ACGL::Utils::StringHelpers::splitFileExtension(_filename, file, extension);
typename FactoryMap::const_iterator existingCreator = mFactoryMap.find(extension);
if (existingCreator != mFactoryMap.end()) {
return existingCreator->second(_filename);
}
return DATA_CONTROL_FILE_TYPE();
}
// ========================================================================================================= \/
// ================================================================================================== FIELDS \/
// ========================================================================================================= \/
private:
int_t mRegisteredTypes;
FactoryMap mFactoryMap;
};
//
// Individual FileFactories:
//
typedef DataControlFileFactory< SharedTextureDataControlFile > TextureDataControlFileFactory;
typedef DataControlFileFactory< SharedGeometryDataControlFile > GeometryDataControlFileFactory;
} // OpenGL
} // ACGL
#endif
#endif // ACGL_OPENGL_CONTROLLER_DATACONTROLFILEFACTORY_HH
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_ELEMENTARRAYBUFFERCONTROL_HH
#define ACGL_OPENGL_CONTROLLER_ELEMENTARRAYBUFFERCONTROL_HH
#ifdef ACGL_INCLUDE_DEPRECATED_FUNCTIONALITY
#include <ACGL/ACGL.hh>
#include <ACGL/Resource/BasicCreateInterface.hh>
#include <ACGL/OpenGL/Objects/ElementArrayBuffer.hh>
#include <ACGL/OpenGL/GL.hh>
#ifdef ACGL_INCLUDE_DEPRECATED_FUNCTIONALITY
namespace ACGL{
namespace OpenGL{
class ElementArrayBufferControl : public Resource::BasicCreateInterface<ElementArrayBuffer>
{
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
ElementArrayBufferControl(void)
: mUsage(GL_STATIC_DRAW),
mType(GL_UNSIGNED_INT),
mElements(0),
mpData(NULL)
{}
virtual ~ElementArrayBufferControl() {}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
inline ElementArrayBufferControl& usage (GLenum _usage) { mUsage = _usage; return *this; }
inline ElementArrayBufferControl& type (GLenum _type) { mType = _type; return *this; }
inline ElementArrayBufferControl& data (const GLvoid* _pData, GLsizei _elements)
{
mpData = _pData;
mElements = _elements;
return *this;
}
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
public:
virtual SharedElementArrayBuffer create(void)
{
SharedElementArrayBuffer elementArrayBuffer( new ElementArrayBuffer(mType) );
if(mpData != NULL)
{
elementArrayBuffer->bind();
elementArrayBuffer->setDataElements(mElements, mpData, mUsage);
}
return elementArrayBuffer;
}
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLenum mUsage;
GLenum mType;
GLsizei mElements;
const GLvoid* mpData;
};
} // OpenGL
} // ACGL
#endif
#endif
#endif // ACGL_OPENGL_CONTROLLER_ELEMENTARRAYBUFFERCONTROL_HH
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_FRAMEBUFFEROBJECTCONTROL_HH
#define ACGL_OPENGL_CONTROLLER_FRAMEBUFFEROBJECTCONTROL_HH
#ifdef ACGL_INCLUDE_DEPRECATED_FUNCTIONALITY
#include <ACGL/ACGL.hh>
#include <ACGL/Resource/BasicCreateInterface.hh>
#include <ACGL/OpenGL/Objects/FrameBufferObject.hh>
#include <ACGL/OpenGL/Data/LocationMappings.hh>
#include <ACGL/OpenGL/GL.hh>
#include <ACGL/OpenGL/Objects/Texture.hh>
#include <ACGL/OpenGL/Objects/RenderBuffer.hh>
#include <vector>
namespace ACGL{
namespace OpenGL{
class FrameBufferObjectControl : public Resource::BasicCreateInterface<FrameBufferObject>
{
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
FrameBufferObjectControl(void)
: mColorAttachments(),
mDepthAttachment(),
mFragDataLocations()
{
mDepthAttachment.name = "";
mDepthAttachment.texture = ConstSharedTextureBase();
mDepthAttachment.renderBuffer = ConstSharedRenderBuffer();
}
virtual ~FrameBufferObjectControl() {}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
inline FrameBufferObjectControl& depthTexture (const ConstSharedTextureBase& _pDepthTexture) { mDepthAttachment.texture = _pDepthTexture; return *this; }
inline FrameBufferObjectControl& depthRenderBuffer (const ConstSharedRenderBuffer& _pDepthRenderBuffer) { mDepthAttachment.renderBuffer = _pDepthRenderBuffer; return *this; }
inline FrameBufferObjectControl& colorTexture(const std::string& _name, const ConstSharedTextureBase& _texture)
{
FrameBufferObject::Attachment attachment = {_name, _texture, SharedRenderBuffer(), (GLuint) mColorAttachments.size(), Image()};
mColorAttachments.push_back(attachment);
return *this;
}
inline FrameBufferObjectControl& colorRenderBuffer(const std::string& _name, const ConstSharedRenderBuffer& _renderBuffer)
{
FrameBufferObject::Attachment attachment = {_name, SharedTextureBase(), _renderBuffer, (GLuint) mColorAttachments.size(), Image()};
mColorAttachments.push_back(attachment);
return *this;
}
inline FrameBufferObjectControl& externFragmentDataLocations(const SharedLocationMappings& _fragmentDataLocations)
{
mFragDataLocations = _fragmentDataLocations;
return *this;
}
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
public:
virtual SharedFrameBufferObject create (void);
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
FrameBufferObject::AttachmentVec mColorAttachments;
FrameBufferObject::Attachment mDepthAttachment;
SharedLocationMappings mFragDataLocations;
};
} // OpenGL
} // ACGL
#endif // ACGL_INCLUDE_DEPRECATED_FUNCTIONALITY
#endif // ACGL_OPENGL_CONTROLLER_FRAMEBUFFERCONTROL_HH
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_GEOMETRYDATACONTROLFILEATB_HH
#define ACGL_OPENGL_CONTROLLER_GEOMETRYDATACONTROLFILEATB_HH
#ifdef ACGL_INCLUDE_DEPRECATED_FUNCTIONALITY
/**
* A minimal ATB loader.
*
* Creates a GeometryData object with one attribute.
*
* By default, the attribute's name is the name of the provided file (without
* the file extension), prepended with an 'a', i.e. loading a file named
* Tangent.atb would result in an attribute named 'aTangent'.
*
*/
#include <ACGL/ACGL.hh>
#include <ACGL/OpenGL/Controller/DataControlFile.hh>
#include <ACGL/OpenGL/InitStaticFileTypes.hh>
#include <ACGL/OpenGL/Controller/DataControlFileFactory.hh>
namespace ACGL{
namespace OpenGL{
class GeometryDataControlFileATB : public ACGL::OpenGL::GeometryDataControlFile
{
friend void initStaticFileTypes(void);
public:
GeometryDataControlFileATB(const std::string& _filename);