Skip to content

Commit

Permalink
#6092: Add infrastructure to handle FX declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Sep 4, 2022
1 parent 08b6798 commit 61179c9
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/idecltypes.h
Expand Up @@ -23,6 +23,7 @@ enum class Type
ModelDef,
Particle,
Skin,
Fx,

// These are used in unit tests only
TestDecl,
Expand All @@ -42,6 +43,7 @@ inline std::string getTypeName(Type type)
case Type::ModelDef: return "ModelDef";
case Type::Particle: return "Particle";
case Type::Skin: return "Skin";
case Type::Fx: return "Fx";
case Type::TestDecl: return "TestDecl";
case Type::TestDecl2: return "TestDecl2";
default:
Expand Down
15 changes: 15 additions & 0 deletions include/ifx.h
@@ -0,0 +1,15 @@
#pragma once

#include "ideclmanager.h"

namespace fx
{

class IFxDeclaration :
public decl::IDeclaration
{
public:

};

}
2 changes: 2 additions & 0 deletions radiantcore/CMakeLists.txt
Expand Up @@ -70,6 +70,8 @@ add_library(radiantcore MODULE
fonts/FontManager.cpp
fonts/GlyphInfo.cpp
fonts/GlyphSet.cpp
fx/FxDeclaration.cpp
fx/FxManager.cpp
grid/GridManager.cpp
imagefile/BMPLoader.cpp
imagefile/dds.cpp
Expand Down
15 changes: 15 additions & 0 deletions radiantcore/fx/FxDeclaration.cpp
@@ -0,0 +1,15 @@
#include "FxDeclaration.h"

namespace fx
{

FxDeclaration::FxDeclaration(const std::string& name) :
DeclarationBase<IFxDeclaration>(decl::Type::Fx, name)
{}

void FxDeclaration::parseFromTokens(parser::DefTokeniser& tokeniser)
{

}

}
19 changes: 19 additions & 0 deletions radiantcore/fx/FxDeclaration.h
@@ -0,0 +1,19 @@
#pragma once

#include "ifx.h"
#include "decl/DeclarationBase.h"

namespace fx
{

class FxDeclaration :
public decl::DeclarationBase<IFxDeclaration>
{
public:
FxDeclaration(const std::string& name);

protected:
void parseFromTokens(parser::DefTokeniser& tokeniser) override;
};

}
35 changes: 35 additions & 0 deletions radiantcore/fx/FxManager.cpp
@@ -0,0 +1,35 @@
#include "FxManager.h"

#include "decl/DeclarationCreator.h"
#include "module/StaticModule.h"
#include "FxDeclaration.h"

namespace fx
{

const std::string& FxManager::getName() const
{
static std::string _name("FxManager");
return _name;
}

const StringSet& FxManager::getDependencies() const
{
static StringSet _dependencies
{
MODULE_DECLMANAGER,
};

return _dependencies;
}

void FxManager::initialiseModule(const IApplicationContext& ctx)
{
GlobalDeclarationManager().registerDeclType("fx", std::make_shared<decl::DeclarationCreator<FxDeclaration>>(decl::Type::Fx));
GlobalDeclarationManager().registerDeclFolder(decl::Type::Fx, "fx/", ".fx");
}

// Static module instance
module::StaticModuleRegistration<FxManager> fxManagerModule;

}
18 changes: 18 additions & 0 deletions radiantcore/fx/FxManager.h
@@ -0,0 +1,18 @@
#pragma once

#include "imodule.h"

namespace fx
{

class FxManager final :
public RegisterableModule
{
public:
// RegisterableModule implementation
const std::string& getName() const override;
const StringSet& getDependencies() const override;
void initialiseModule(const IApplicationContext& ctx) override;
};

}
4 changes: 4 additions & 0 deletions tools/msvc/DarkRadiantCore.vcxproj
Expand Up @@ -85,6 +85,8 @@
<ClCompile Include="..\..\radiantcore\fonts\FontManager.cpp" />
<ClCompile Include="..\..\radiantcore\fonts\GlyphInfo.cpp" />
<ClCompile Include="..\..\radiantcore\fonts\GlyphSet.cpp" />
<ClCompile Include="..\..\radiantcore\fx\FxDeclaration.cpp" />
<ClCompile Include="..\..\radiantcore\fx\FxManager.cpp" />
<ClCompile Include="..\..\radiantcore\grid\GridManager.cpp" />
<ClCompile Include="..\..\radiantcore\imagefile\BMPLoader.cpp" />
<ClCompile Include="..\..\radiantcore\imagefile\dds.cpp" />
Expand Down Expand Up @@ -829,6 +831,8 @@
<ClInclude Include="..\..\radiantcore\fonts\FontManager.h" />
<ClInclude Include="..\..\radiantcore\fonts\GlyphInfo.h" />
<ClInclude Include="..\..\radiantcore\fonts\GlyphSet.h" />
<ClInclude Include="..\..\radiantcore\fx\FxDeclaration.h" />
<ClInclude Include="..\..\radiantcore\fx\FxManager.h" />
<ClInclude Include="..\..\radiantcore\grid\GridItem.h" />
<ClInclude Include="..\..\radiantcore\grid\GridManager.h" />
<ClInclude Include="..\..\radiantcore\imagefile\BMPLoader.h" />
Expand Down
15 changes: 15 additions & 0 deletions tools/msvc/DarkRadiantCore.vcxproj.filters
Expand Up @@ -215,6 +215,9 @@
<Filter Include="gl">
<UniqueIdentifier>{dc88a10c-1b0d-4e9b-844a-952046f324e5}</UniqueIdentifier>
</Filter>
<Filter Include="src\fx">
<UniqueIdentifier>{8090888b-90cb-49eb-b203-f30f0635ab17}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\radiantcore\modulesystem\ModuleLoader.cpp">
Expand Down Expand Up @@ -1153,6 +1156,12 @@
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\BlendLightProgram.cpp">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\fx\FxManager.cpp">
<Filter>src\fx</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\fx\FxDeclaration.cpp">
<Filter>src\fx</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\radiantcore\modulesystem\ModuleLoader.h">
Expand Down Expand Up @@ -2373,6 +2382,12 @@
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\BlendLightProgram.h">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\fx\FxManager.h">
<Filter>src\fx</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\fx\FxDeclaration.h">
<Filter>src\fx</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\install\gl\cubemap_fp.glsl">
Expand Down
1 change: 1 addition & 0 deletions tools/msvc/include.vcxproj
Expand Up @@ -125,6 +125,7 @@
<ClInclude Include="..\..\include\ifiletypes.h" />
<ClInclude Include="..\..\include\ifilter.h" />
<ClInclude Include="..\..\include\ifonts.h" />
<ClInclude Include="..\..\include\ifx.h" />
<ClInclude Include="..\..\include\igame.h" />
<ClInclude Include="..\..\include\igameresource.h" />
<ClInclude Include="..\..\include\igeometryrenderer.h" />
Expand Down
1 change: 1 addition & 0 deletions tools/msvc/include.vcxproj.filters
Expand Up @@ -169,6 +169,7 @@
<ClInclude Include="..\..\include\iobjectrenderer.h" />
<ClInclude Include="..\..\include\ideclmanager.h" />
<ClInclude Include="..\..\include\igameresource.h" />
<ClInclude Include="..\..\include\ifx.h" />
</ItemGroup>
<ItemGroup>
<Filter Include="ui">
Expand Down

0 comments on commit 61179c9

Please sign in to comment.