Commit ed97990b authored by Robert Menzel's avatar Robert Menzel
Browse files

corrected include guards, added comments

parent b77d4d33
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_RESOURCE_VERTEXBUFFERCONTROLFILEOBJ_HH
#define ACGL_RESOURCE_VERTEXBUFFERCONTROLFILEOBJ_HH
#ifndef ACGL_OPENGL_CONTROLLER_VERTEXBUFFERCONTROLFILEOBJ_HH
#define ACGL_OPENGL_CONTROLLER_VERTEXBUFFERCONTROLFILEOBJ_HH
#include <ACGL/ACGL.hh>
......@@ -41,4 +41,4 @@ public:
} // OpenGL
} // ACGL
#endif // ACGL_RESOURCE_TEXTURE_HH
#endif // ACGL_OPENGL_CONTROLLER_VERTEXBUFFERCONTROLFILEOBJ_HH
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_GL_HH
#define ACGL_GL_HH
#ifndef ACGL_OPENGL_GL_HH
#define ACGL_OPENGL_GL_HH
/*
* This simple OpenGL wrapper is used to include OpenGL and GLEW
......@@ -89,4 +89,4 @@
#include <QtOpenGL/qgl.h>
#endif // USE_QT
#endif // ACGL_GL_HH
#endif // ACGL_OPENGL_GL_HH
......@@ -3,8 +3,13 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_MANAGER_HH
#define ACGL_MANAGER_HH
#ifndef ACGL_OPENGL_MANAGER_HH
#define ACGL_OPENGL_MANAGER_HH
/*
* A shortcut to include all manager of OpenGL objects.
* Will also include the Objects & Controllers!
*/
#include <ACGL/ACGL.hh>
......@@ -39,10 +44,11 @@ typedef Resource::NameManager<ElementArrayBuffer> ElementArrayBufferNameManager;
} // OpenGL
} // ACGL
//note: when we start having managers for non-OpenGL objects we should move this ;-)
#define ACGL_FOR_EACH_RESOURCE(MANAGER,RESOURCE,ELEMENT) \
for(ACGL::Resource::MANAGER<RESOURCE>::ResourceContainer::const_iterator ELEMENT = ACGL::Resource::MANAGER<RESOURCE>::the()->begin(); \
ELEMENT != MANAGER<RESOURCE>::the()->end(); \
++ELEMENT)
#endif // ACGL_MANAGER_HH
#endif // ACGL_OPENGL_MANAGER_HH
......@@ -3,8 +3,12 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_OBJECTS_HH
#define ACGL_OBJECTS_HH
#ifndef ACGL_OPENGL_OBJECTS_HH
#define ACGL_OPENGL_OBJECTS_HH
/*
* A shortcut to include all OpenGL objects.
*/
#include <ACGL/ACGL.hh>
......@@ -18,4 +22,4 @@
#include <ACGL/OpenGL/Objects/ElementArrayBuffer.hh>
#endif // ACGL_OBJECTS_HH
#endif // ACGL_OPENGL_OBJECTS_HH
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_RESOURCE_ARRAYBUFFER_HH
#define ACGL_RESOURCE_ARRAYBUFFER_HH
#ifndef ACGL_OPENGL_OBJECTS_ARRAYBUFFER_HH
#define ACGL_OPENGL_OBJECTS_ARRAYBUFFER_HH
#include <ACGL/ACGL.hh>
......@@ -185,4 +185,4 @@ typedef std::tr1::shared_ptr<ArrayBuffer> SharedArrayBuffer;
} // OpenGL
} // ACGL
#endif // ACGL_RESOURCE_ARRAYBUFFER_HH
#endif // ACGL_OPENGL_OBJECTS_ARRAYBUFFER_HH
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_RESOURCE_ELEMENTBUFFERDATA_HH
#define ACGL_RESOURCE_ELEMENTBUFFERDATA_HH
#ifndef ACGL_OPENGL_OBJECTS_ELEMENTBUFFERDATA_HH
#define ACGL_OPENGL_OBJECTS_ELEMENTBUFFERDATA_HH
#include <ACGL/ACGL.hh>
......@@ -126,4 +126,4 @@ typedef std::tr1::shared_ptr<ElementArrayBuffer> SharedElementArrayBuffer;
} // OpenGL
} // ACGL
#endif // ACGL_RESOURCE_ELEMENTBUFFERDATA_HH
#endif // ACGL_OPENGL_OBJECTS_ELEMENTBUFFERDATA_HH
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_RESOURCE_FRAMEBUFFER_HH
#define ACGL_RESOURCE_FRAMEBUFFER_HH
#ifndef ACGL_OPENGL_OBJECTS_FRAMEBUFFER_HH
#define ACGL_OPENGL_OBJECTS_FRAMEBUFFER_HH
/*
* This FrameBuffer class encapsulates an OpenGL frame buffer object (FBO).
......@@ -251,4 +251,4 @@ typedef std::tr1::shared_ptr<FrameBuffer> SharedFrameBuffer;
} // OpenGL
} // ACGL
#endif // ACGL_RESOURCE_FRAMEBUFFER_HH
#endif // ACGL_OPENGL_OBJECTS_FRAMEBUFFER_HH
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_RESOURCE_RENDERBUFFER_HH
#define ACGL_RESOURCE_RENDERBUFFER_HH
#ifndef ACGL_OPENGL_OBJECTS_RENDERBUFFER_HH
#define ACGL_OPENGL_OBJECTS_RENDERBUFFER_HH
#include <ACGL/ACGL.hh>
......@@ -72,4 +72,4 @@ typedef std::tr1::shared_ptr<RenderBuffer> SharedRenderBuffer;
} // OpenGL
} // ACGL
#endif // ACGL_RESOURCE_FRAMEBUFFER_HH
#endif // ACGL_OPENGL_OBJECTS_RENDERBUFFER_HH
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_RESOURCE_SHADER_HH
#define ACGL_RESOURCE_SHADER_HH
#ifndef ACGL_OPENGL_OBJECTS_SHADER_HH
#define ACGL_OPENGL_OBJECTS_SHADER_HH
#include <vector>
#include <string>
......@@ -92,4 +92,4 @@ typedef std::tr1::shared_ptr<Shader> SharedShader;
} // OpenGL
} // ACGL
#endif // ACGL_RESOURCE_SHADER_HH
#endif // ACGL_OPENGL_OBJECTS_SHADER_HH
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_RESOURCE_SHADERPROGRAM_HH
#define ACGL_RESOURCE_SHADERPROGRAM_HH
#ifndef ACGL_OPENGL_OBJECTS_SHADERPROGRAM_HH
#define ACGL_OPENGL_OBJECTS_SHADERPROGRAM_HH
#include <ACGL/ACGL.hh>
......@@ -121,4 +121,4 @@ typedef std::tr1::shared_ptr<ShaderProgram> SharedShaderProgram;
} // OpenGL
} // ACGL
#endif // ACGL_RESOURCE_SHADERPROGRAM_HH
#endif // ACGL_OPENGL_OBJECTS_SHADERPROGRAM_HH
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_RESOURCE_TEXTURE_HH
#define ACGL_RESOURCE_TEXTURE_HH
#ifndef ACGL_OPENGL_OBJECTS_TEXTURE_HH
#define ACGL_OPENGL_OBJECTS_TEXTURE_HH
#include <ACGL/ACGL.hh>
......@@ -252,4 +252,4 @@ typedef std::tr1::shared_ptr<Texture> SharedTexture;
} // OpenGL
} // ACGL
#endif // ACGL_RESOURCE_TEXTURE_HH
#endif // ACGL_OPENGL_OBJECTS_TEXTURE_HH
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_RESOURCE_UNIFORM_HH
#define ACGL_RESOURCE_UNIFORM_HH
#ifndef ACGL_OPENGL_OBJECTS_UNIFORM_HH
#define ACGL_OPENGL_OBJECTS_UNIFORM_HH
#include <ACGL/ACGL.hh>
......@@ -93,4 +93,4 @@ public:
} // ACGL
*/
#endif // ACGL_RESOURCE_SHADERPROGRAM_HH
#endif // ACGL_OPENGL_OBJECTS_UNIFORM_HH
......@@ -3,8 +3,8 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_RESOURCE_VERTEXBUFFER_HH
#define ACGL_RESOURCE_VERTEXBUFFER_HH
#ifndef ACGL_OPENGL_OBJECTS_VERTEXBUFFER_HH
#define ACGL_OPENGL_OBJECTS_VERTEXBUFFER_HH
#include <ACGL/ACGL.hh>
......@@ -140,4 +140,4 @@ typedef std::tr1::shared_ptr<VertexBuffer> SharedVertexBuffer;
} // OpenGL
} // ACGL
#endif // ACGL_RESOURCE_VERTEXBUFFER_HH
#endif // ACGL_OPENGL_OBJECTS_VERTEXBUFFER_HH
......@@ -3,8 +3,13 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_GLUTILS_TOOLS_HH
#define ACGL_GLUTILS_TOOLS_HH
#ifndef ACGL_OPENGL_TOOLS_HH
#define ACGL_OPENGL_TOOLS_HH
/*
* Some OpeGL related helper functions.
* All the error checking functions are in here.
*/
#include <ACGL/ACGL.hh>
#include <ACGL/OpenGL/GL.hh>
......@@ -113,5 +118,5 @@ inline bool openGLErrorOccuredDummy() { return false; }
} // OpenGL
} // ACGL
#endif // ACGL_GLUTILS_TOOLS_HH
#endif // ACGL_OPENGL_TOOLS_HH
......@@ -6,6 +6,13 @@
#ifndef ACGL_RESOURCE_BASICCONTROLLER_HH
#define ACGL_RESOURCE_BASICCONTROLLER_HH
/*
* Base class for all controllers.
*
* Controllers can provide more flexible ways of creating objects, they are also
* making managers more flexibe.
*/
#include <tr1/memory>
#include <ACGL/ACGL.hh>
......
......@@ -3,8 +3,12 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_GLUTILS_CAMERA_HH
#define ACGL_GLUTILS_CAMERA_HH
#ifndef ACGL_SCENE_CAMERA_HH
#define ACGL_SCENE_CAMERA_HH
/*
* A generic camera class.
*/
#include <ACGL/ACGL.hh>
#include <ACGL/Math/Math.hh>
......@@ -143,4 +147,4 @@ private:
} // Scene
} // ACGL
#endif // ACGL_GLUTILS_CAMERA_HH
#endif // ACGL_SCENE_CAMERA_HH
......@@ -3,8 +3,13 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_GLUTILS_COORDINATESYSTEM_HH
#define ACGL_GLUTILS_COORDINATESYSTEM_HH
#ifndef ACGL_SCENE_COORDINATESYSTEM_HH
#define ACGL_SCENE_COORDINATESYSTEM_HH
/*
* The coordinate system can be used to draw a simple grid to visualize the
* worlds coordinate system. Drawing itself is not implemented here!
*/
#include <ACGL/ACGL.hh>
#include <ACGL/Math/Math.hh>
......@@ -59,4 +64,4 @@ private:
} // Scene
} // ACGL
#endif // ACGL_GLUTILS_COORDINATESYSTEM_HH
#endif // ACGL_SCENE_COORDINATESYSTEM_HH
......@@ -3,8 +3,16 @@
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_GLUTILS_MATRIXSTACK_HH
#define ACGL_GLUTILS_MATRIXSTACK_HH
#ifndef ACGL_SCENE_MATRIXSTACK_HH
#define ACGL_SCENE_MATRIXSTACK_HH
/*
* A matrix stack that can mimic the old OpenGL matrix stack. It is only based on
* glm, so it can be used without OpenGL easily.
*
* You can create as many independent stacks as you like or just use the
* pre-defined ModelViewMatrixStack singleton.
*/
#include <ACGL/ACGL.hh>
#include <ACGL/Base/Singleton.hh>
......@@ -108,4 +116,4 @@ typedef Base::Singleton< MatrixStack > ModelViewMatrixStack;
} // Scene
} // ACGL
#endif // ACGL_GLUTILS_MATRIXSTACK_HH
#endif // ACGL_SCENE_MATRIXSTACK_HH
......@@ -28,4 +28,4 @@ typedef uint64_t ulong_t;
} // ACGL
#endif
#endif // ACGL_TYPES_HH
......@@ -6,6 +6,31 @@
#ifndef ACGL_UTILS_LOG_HH
#define ACGL_UTILS_LOG_HH
/*
* Some classes, typedefs and defines to create a simple logging system:
*
* Can be used excactly like std::cout
*
* message stream: log() << "foo " << "bar" << var << std::endl;
* warning stream: warning() << "memory low" << std::endl;
* error stream: error() << "shader compile failed: " << getErrorMsg() << std::endl;
* debug stream: debug() << "i = " << i << std::endl;
*
* Streams can get muted and unmuted at runtime:
* debug().mute();
* debug() << "you will never see me!" << std::endl;
* debug().unmute();
*
* The Application can create own streams and set own prefixes:
*
* log<6>().setPrefix("app specific: ");
* log<6>() << "logging" << std::endl;
*
* If no prefix was set, the number will be used as a prefix:
*
* log<11>() << "up to 11!" << std::endl;
*/
#include <ACGL/ACGL.hh>
#include <ACGL/Base/Singleton.hh>
......@@ -18,16 +43,9 @@
namespace ACGL{
namespace Utils{
/*
* Can be used excactly like std::cout
*
* message stream ACGL::Utils::log() << "foo" << "bar" << var << std::endl;
* warning stream ACGL::Utils::warning() <<
* error stream ACGL::Utils::error() <<
* debug stream ACGL::Utils::debug() <<
* The stream buffer is internally used in the CoutLikeStream (see below).
*/
class CoutLikeStreamBuffer : public std::basic_streambuf<char, std::char_traits<char> >
{
typedef std::basic_streambuf<char, std::char_traits<char> > base_type;
......@@ -61,7 +79,10 @@ private:
bool mNewLineIsAboutToStart;
};
/*
* This is the stream itself that behaves like an std::ostream with some custom
* extensions (like adding the debug level prefix).
*/
template < unsigned int DEBUG_LEVEL >
class CoutLikeStream : public std::ostream, public Base::Singleton<CoutLikeStream<DEBUG_LEVEL> >
{
......@@ -104,19 +125,26 @@ private:
CoutLikeStreamBuffer *mStreamBuffer;
};
/*
* Defines the stream functions that should be used:
*/
inline CoutLikeStream<0>& debug() { return (*CoutLikeStream<0>::the()); }
inline CoutLikeStream<1>& message() { return (*CoutLikeStream<1>::the()); }
inline CoutLikeStream<2>& warning() { return (*CoutLikeStream<2>::the()); }
inline CoutLikeStream<3>& error() { return (*CoutLikeStream<3>::the()); }
/*
* Generic streams: this way application specific streams can be created:
*/
template < unsigned int N >
inline CoutLikeStream<N>& log() { return (*CoutLikeStream<N>::the()); }
// alternative syntax
#define ACGL_DEBUG(STREAM) ACGL::Utils::debug() << STREAM;
#define ACGL_MESSAGE(STREAM) ACGL::Utils::message() << STREAM;
#define ACGL_WARNING(STREAM) ACGL::Utils::warning() << STREAM;
#define ACGL_ERROR(STREAM) ACGL::Utils::error() << STREAM;
template < unsigned int N >
inline CoutLikeStream<N>& log() { return (*CoutLikeStream<N>::the()); }
#define ACGL_LOG(N,STREAM) ACGL::Utils::log<N>() << STREAM;
} // Utils
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment