X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=include%2Firender.h;h=169d881a9c59e0c1cadcc8f85d291edb64e5fc16;hb=135e843228b792713136e372ce71e33f8302fdff;hp=d9c40b6f41a72155e1339beff1d3f806043898a2;hpb=231225d6f97d0b926b2e896e5783cccfbc7c5619;p=xonotic%2Fnetradiant.git diff --git a/include/irender.h b/include/irender.h index d9c40b6f..169d881a 100644 --- a/include/irender.h +++ b/include/irender.h @@ -1,29 +1,29 @@ /* -Copyright (C) 2001-2006, William Joseph. -All Rights Reserved. + Copyright (C) 2001-2006, William Joseph. + All Rights Reserved. -This file is part of GtkRadiant. + This file is part of GtkRadiant. -GtkRadiant is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + GtkRadiant is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -GtkRadiant is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + GtkRadiant is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with GtkRadiant; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + You should have received a copy of the GNU General Public License + along with GtkRadiant; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ -#if !defined(INCLUDED_IRENDER_H) +#if !defined( INCLUDED_IRENDER_H ) #define INCLUDED_IRENDER_H #include "generic/constant.h" -#include "generic/callbackfwd.h" +#include "generic/callback.h" // Rendering states to sort by. @@ -67,39 +67,37 @@ class Shader; class RendererLight { public: - virtual Shader* getShader() const = 0; - virtual const AABB& aabb() const = 0; - virtual bool testAABB(const AABB& other) const = 0; - virtual const Matrix4& rotation() const = 0; - virtual const Vector3& offset() const = 0; - virtual const Vector3& colour() const = 0; - virtual bool isProjected() const = 0; - virtual const Matrix4& projection() const = 0; +virtual Shader* getShader() const = 0; +virtual const AABB& aabb() const = 0; +virtual bool testAABB( const AABB& other ) const = 0; +virtual const Matrix4& rotation() const = 0; +virtual const Vector3& offset() const = 0; +virtual const Vector3& colour() const = 0; +virtual bool isProjected() const = 0; +virtual const Matrix4& projection() const = 0; }; class LightCullable { public: - virtual bool testLight(const RendererLight& light) const = 0; - virtual void insertLight(const RendererLight& light) - { - } - virtual void clearLights() - { - } +virtual bool testLight( const RendererLight& light ) const = 0; +virtual void insertLight( const RendererLight& light ){ +} +virtual void clearLights(){ +} }; class Renderable; -typedef Callback1 RenderableCallback; +typedef Callback RenderableCallback; -typedef Callback1 RendererLightCallback; +typedef Callback RendererLightCallback; class LightList { public: - virtual void evaluateLights() const = 0; - virtual void lightsChanged() const = 0; - virtual void forEachLight(const RendererLightCallback& callback) const = 0; +virtual void evaluateLights() const = 0; +virtual void lightsChanged() const = 0; +virtual void forEachLight( const RendererLightCallback& callback ) const = 0; }; const int c_attr_TexCoord0 = 1; @@ -109,7 +107,8 @@ const int c_attr_Binormal = 4; class OpenGLRenderable { public: - virtual void render(RenderStateFlags state) const = 0; +virtual ~OpenGLRenderable() = default; +virtual void render( RenderStateFlags state ) const = 0; }; class Matrix4; @@ -121,42 +120,43 @@ class ModuleObserver; class Shader { public: - virtual void addRenderable(const OpenGLRenderable& renderable, const Matrix4& modelview, const LightList* lights = 0) = 0; - virtual void incrementUsed() = 0; - virtual void decrementUsed() = 0; - virtual void attach(ModuleObserver& observer) = 0; - virtual void detach(ModuleObserver& observer) = 0; - virtual qtexture_t& getTexture() const = 0; - virtual unsigned int getFlags() const = 0; +virtual ~Shader() = default; +virtual void addRenderable( const OpenGLRenderable& renderable, const Matrix4& modelview, const LightList* lights = 0 ) = 0; +virtual void incrementUsed() = 0; +virtual void decrementUsed() = 0; +virtual void attach( ModuleObserver& observer ) = 0; +virtual void detach( ModuleObserver& observer ) = 0; +virtual qtexture_t& getTexture() const = 0; +virtual unsigned int getFlags() const = 0; }; class ShaderCache { public: - INTEGER_CONSTANT(Version, 1); - STRING_CONSTANT(Name, "renderstate"); - - virtual Shader* capture(const char* name) = 0; - virtual void release(const char* name) = 0; - /*! Render all Shader objects. */ - virtual void render(RenderStateFlags globalstate, const Matrix4& modelview, const Matrix4& projection, const Vector3& viewer = Vector3(0, 0, 0)) = 0; - - virtual void realise() = 0; - virtual void unrealise() = 0; - - virtual bool lightingSupported() const = 0; - virtual bool useShaderLanguage() const = 0; - - virtual const LightList& attach(LightCullable& cullable) = 0; - virtual void detach(LightCullable& cullable) = 0; - virtual void changed(LightCullable& cullable) = 0; - virtual void attach(RendererLight& light) = 0; - virtual void detach(RendererLight& light) = 0; - virtual void changed(RendererLight& light) = 0; - - virtual void attachRenderable(const Renderable& renderable) = 0; - virtual void detachRenderable(const Renderable& renderable) = 0; - virtual void forEachRenderable(const RenderableCallback& callback) const = 0; +INTEGER_CONSTANT( Version, 1 ); +STRING_CONSTANT( Name, "renderstate" ); + +virtual Shader* capture( const char* name ) = 0; +virtual void release( const char* name ) = 0; +/*! Render all Shader objects. */ +virtual void render( RenderStateFlags globalstate, const Matrix4& modelview, const Matrix4& projection, const Vector3& viewer = Vector3( 0, 0, 0 ) ) = 0; + +virtual void realise() = 0; +virtual void unrealise() = 0; + +virtual bool lightingSupported() const = 0; +virtual bool useShaderLanguage() const = 0; + +virtual const LightList& attach( LightCullable& cullable ) = 0; +virtual void detach( LightCullable& cullable ) = 0; +virtual void changed( LightCullable& cullable ) = 0; +virtual void attach( RendererLight& light ) = 0; +virtual void detach( RendererLight& light ) = 0; +virtual void changed( RendererLight& light ) = 0; + +virtual void attachRenderable( const Renderable& renderable ) = 0; +virtual void detachRenderable( const Renderable& renderable ) = 0; +virtual void forEachRenderable( const RenderableCallback& callback ) const = 0; }; #include "modulesystem.h" @@ -169,9 +169,8 @@ template class GlobalModuleRef; typedef GlobalModuleRef GlobalShaderCacheModuleRef; -inline ShaderCache& GlobalShaderCache() -{ - return GlobalShaderCacheModule::getTable(); +inline ShaderCache& GlobalShaderCache(){ + return GlobalShaderCacheModule::getTable(); } #endif