X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=include%2Fmodelskin.h;h=b070cc778255c021d716d2b6114cde9e624cf691;hb=ec255b5639a353343c8b8b6b049839d262713480;hp=c01b5f307935713c708756be76e2855428529138;hpb=231225d6f97d0b926b2e896e5783cccfbc7c5619;p=xonotic%2Fnetradiant.git diff --git a/include/modelskin.h b/include/modelskin.h index c01b5f30..b070cc77 100644 --- a/include/modelskin.h +++ b/include/modelskin.h @@ -1,76 +1,77 @@ /* -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_MODELSKIN_H) +#if !defined( INCLUDED_MODELSKIN_H ) #define INCLUDED_MODELSKIN_H #include "generic/constant.h" -#include "generic/callbackfwd.h" +#include "generic/callback.h" class SkinRemap { public: - const char* m_from; - const char* m_to; - SkinRemap(const char* from, const char* to) : m_from(from), m_to(to) - { - } +const char* m_from; +const char* m_to; +SkinRemap( const char* from, const char* to ) : m_from( from ), m_to( to ){ +} }; -typedef Callback1 SkinRemapCallback; +typedef Callback SkinRemapCallback; class ModuleObserver; class ModelSkin { public: - STRING_CONSTANT(Name, "ModelSkin"); - /// \brief Attach an \p observer whose realise() and unrealise() methods will be called when the skin is loaded or unloaded. - virtual void attach(ModuleObserver& observer) = 0; - /// \brief Detach an \p observer previously-attached by calling \c attach. - virtual void detach(ModuleObserver& observer) = 0; - /// \brief Returns true if this skin is currently loaded. - virtual bool realised() const = 0; - /// \brief Returns the shader identifier that \p name remaps to, or "" if not found or not realised. - virtual const char* getRemap(const char* name) const = 0; - /// \brief Calls \p callback for each remap pair. Has no effect if not realised. - virtual void forEachRemap(const SkinRemapCallback& callback) const = 0; +virtual ~ModelSkin() = default; +STRING_CONSTANT( Name, "ModelSkin" ); +/// \brief Attach an \p observer whose realise() and unrealise() methods will be called when the skin is loaded or unloaded. +virtual void attach( ModuleObserver& observer ) = 0; +/// \brief Detach an \p observer previously-attached by calling \c attach. +virtual void detach( ModuleObserver& observer ) = 0; +/// \brief Returns true if this skin is currently loaded. +virtual bool realised() const = 0; +/// \brief Returns the shader identifier that \p name remaps to, or "" if not found or not realised. +virtual const char* getRemap( const char* name ) const = 0; +/// \brief Calls \p callback for each remap pair. Has no effect if not realised. +virtual void forEachRemap( const SkinRemapCallback& callback ) const = 0; }; class SkinnedModel { public: - STRING_CONSTANT(Name, "SkinnedModel"); - /// \brief Instructs the skinned model to update its skin. - virtual void skinChanged() = 0; +STRING_CONSTANT( Name, "SkinnedModel" ); +/// \brief Instructs the skinned model to update its skin. +virtual void skinChanged() = 0; }; class ModelSkinCache { public: - INTEGER_CONSTANT(Version, 1); - STRING_CONSTANT(Name, "modelskin"); - /// \brief Increments the reference count of and returns a reference to the skin uniquely identified by 'name'. - virtual ModelSkin& capture(const char* name) = 0; - /// \brief Decrements the reference-count of the skin uniquely identified by 'name'. - virtual void release(const char* name) = 0; +virtual ~ModelSkinCache() = default; +INTEGER_CONSTANT( Version, 1 ); +STRING_CONSTANT( Name, "modelskin" ); +/// \brief Increments the reference count of and returns a reference to the skin uniquely identified by 'name'. +virtual ModelSkin& capture( const char* name ) = 0; +/// \brief Decrements the reference-count of the skin uniquely identified by 'name'. +virtual void release( const char* name ) = 0; }; @@ -84,9 +85,8 @@ template class GlobalModuleRef; typedef GlobalModuleRef GlobalModelSkinCacheModuleRef; -inline ModelSkinCache& GlobalModelSkinCache() -{ - return GlobalModelSkinCacheModule::getTable(); +inline ModelSkinCache& GlobalModelSkinCache(){ + return GlobalModelSkinCacheModule::getTable(); } #endif