worldspawn/plugins/shaders/plugin.cpp

93 lines
2.2 KiB
C++
Raw Normal View History

2020-11-17 11:16:16 +00:00
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
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 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
*/
#include "ishaders.h"
#include "ifilesystem.h"
#include "itextures.h"
#include "iscriplib.h"
#include "qerplugin.h"
#include "string/string.h"
#include "modulesystem/singletonmodule.h"
#include "shaders.h"
class ShadersDependencies :
public GlobalFileSystemModuleRef,
public GlobalTexturesModuleRef,
public GlobalScripLibModuleRef,
public GlobalRadiantModuleRef {
ImageModuleRef m_bitmapModule;
public:
ShadersDependencies() :
m_bitmapModule("tga")
{
}
ImageModuleRef &getBitmapModule()
{
return m_bitmapModule;
}
};
class MaterialAPI {
ShaderSystem *m_shadersq3;
public:
typedef ShaderSystem Type;
STRING_CONSTANT(Name, "mat");
MaterialAPI(ShadersDependencies &dependencies)
{
g_shadersExtension = "mat";
g_shadersDirectory = "textures/";
g_enableDefaultShaders = false;
g_useShaderList = false;
g_bitmapModule = dependencies.getBitmapModule().getTable();
Shaders_Construct();
m_shadersq3 = &GetShaderSystem();
}
~MaterialAPI()
{
Shaders_Destroy();
}
ShaderSystem *getTable()
{
return m_shadersq3;
}
};
typedef SingletonModule<MaterialAPI, ShadersDependencies, DependenciesAPIConstructor<MaterialAPI, ShadersDependencies> > MaterialModule;
MaterialModule g_MaterialModule;
2021-06-02 08:49:27 +00:00
extern "C" void
#ifdef _WIN32
__declspec(dllexport)
#else
__attribute__((visibility("default")))
#endif
Radiant_RegisterModules(ModuleServer &server)
2020-11-17 11:16:16 +00:00
{
initialiseModule(server);
g_MaterialModule.selfRegister();
}