2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 04:27:42 +00:00

Massive fmtlib refactor

This commit is contained in:
Jack Andersen
2019-07-19 18:27:21 -10:00
parent e38a3ece89
commit 7a3da1f7a6
228 changed files with 2071 additions and 2116 deletions

View File

@@ -1,4 +1,6 @@
#include "shader_CFluidPlaneShader.hpp"
#include <fmt/ostream.h>
#include <sstream>
#define FOG_STRUCT_GLSL \
"struct Fog\n" \
@@ -38,7 +40,7 @@
" fogZ = 0.0;\n" \
" break;\n" \
" }\n" \
"#if %d\n" \
"#if IS_ADDITIVE\n" \
" return vec4(mix(colorIn, vec4(0.0), clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);\n" \
"#else\n" \
" return vec4(mix(colorIn, fog.color, clamp(fogZ, 0.0, 1.0)).rgb, colorIn.a);\n" \
@@ -83,7 +85,7 @@ static const char* VS =
" vtf.uvs[0] = (texMtxs[0] * pos).xy;\n"
" vtf.uvs[1] = (texMtxs[1] * pos).xy;\n"
" vtf.uvs[2] = (texMtxs[2] * pos).xy;\n"
"%s" // Additional TCGs here
" ADDITIONAL_TCGS\n" // Additional TCGs here
"}\n";
static const char* TessVS =
@@ -164,7 +166,7 @@ static const char* TessES =
"SBINDING(0) patch in vec4 minMaxPos;\n"
"SBINDING(0) out VertToFrag vtf;\n"
"\n"
"TBINDING%d uniform sampler2D RippleMap;\n"
"TBINDING##RIPPLE_TEXTURE_IDX uniform sampler2D RippleMap;\n"
"\n"
"const float PI_X2 = 6.283185307179586;\n"
"\n"
@@ -208,7 +210,7 @@ static const char* TessES =
" vtf.uvs[0] = (texMtxs[0] * pos).xy;\n"
" vtf.uvs[1] = (texMtxs[1] * pos).xy;\n"
" vtf.uvs[2] = (texMtxs[2] * pos).xy;\n"
"%s\n" // Additional TCGs here
" ADDITIONAL_TCGS\n" // Additional TCGs here
"}\n";
static const char* FS =
@@ -270,11 +272,11 @@ FOG_STRUCT_GLSL
FOG_ALGORITHM_GLSL
"\n"
"layout(location=0) out vec4 colorOut;\n"
"%s" // Textures here
"TEXTURE_DECLS\n" // Textures here
"void main()\n"
"{\n"
" vec4 lighting = LightingFunc(vtf.mvPos.xyz, normalize(vtf.mvNorm.xyz));\n"
"%s" // Combiner expression here
" COMBINER_EXPRS\n" // Combiner expression here
" colorOut = MainPostFunc(colorOut);\n"
"}\n";
@@ -315,61 +317,52 @@ FOG_ALGORITHM_GLSL
"\n"
"SBINDING(0) in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n"
"%s" // Textures here
"TEXTURE_DECLS\n" // Textures here
"void main()\n"
"{\n"
"%s" // Combiner expression here
" COMBINER_EXPRS\n" // Combiner expression here
" colorOut = MainPostFunc(colorOut);\n"
"}\n";
static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
std::string textures;
std::string combiner;
std::stringstream out;
int nextTex = 0;
int nextTCG = 3;
int bumpMapUv, envBumpMapUv, envMapUv, lightmapUv;
if (info.m_hasPatternTex1) {
textures += hecl::Format("TBINDING%d uniform sampler2D patternTex1;\n", nextTex++);
}
if (info.m_hasPatternTex2) {
textures += hecl::Format("TBINDING%d uniform sampler2D patternTex2;\n", nextTex++);
}
if (info.m_hasColorTex) {
textures += hecl::Format("TBINDING%d uniform sampler2D colorTex;\n", nextTex++);
}
if (info.m_hasBumpMap) {
textures += hecl::Format("TBINDING%d uniform sampler2D bumpMap;\n", nextTex++);
}
if (info.m_hasEnvMap) {
textures += hecl::Format("TBINDING%d uniform sampler2D envMap;\n", nextTex++);
}
if (info.m_hasEnvBumpMap) {
textures += hecl::Format("TBINDING%d uniform sampler2D envBumpMap;\n", nextTex++);
}
if (info.m_hasLightmap) {
textures += hecl::Format("TBINDING%d uniform sampler2D lightMap;\n", nextTex++);
}
out << "#define TEXTURE_DECLS ";
if (info.m_hasPatternTex1)
fmt::print(out, fmt("TBINDING{} uniform sampler2D patternTex1;"), nextTex++);
if (info.m_hasPatternTex2)
fmt::print(out, fmt("TBINDING{} uniform sampler2D patternTex2;"), nextTex++);
if (info.m_hasColorTex)
fmt::print(out, fmt("TBINDING{} uniform sampler2D colorTex;"), nextTex++);
if (info.m_hasBumpMap)
fmt::print(out, fmt("TBINDING{} uniform sampler2D bumpMap;"), nextTex++);
if (info.m_hasEnvMap)
fmt::print(out, fmt("TBINDING{} uniform sampler2D envMap;"), nextTex++);
if (info.m_hasEnvBumpMap)
fmt::print(out, fmt("TBINDING{} uniform sampler2D envBumpMap;"), nextTex++);
if (info.m_hasLightmap)
fmt::print(out, fmt("TBINDING{} uniform sampler2D lightMap;"), nextTex++);
out << '\n';
if (info.m_hasBumpMap) {
if (info.m_hasBumpMap)
bumpMapUv = nextTCG++;
}
if (info.m_hasEnvBumpMap) {
if (info.m_hasEnvBumpMap)
envBumpMapUv = nextTCG++;
}
if (info.m_hasEnvMap) {
if (info.m_hasEnvMap)
envMapUv = nextTCG++;
}
if (info.m_hasLightmap) {
if (info.m_hasLightmap)
lightmapUv = nextTCG;
}
out << "#define COMBINER_EXPRS ";
switch (info.m_type) {
case EFluidType::NormalWater:
case EFluidType::PhazonFluid:
case EFluidType::Four:
if (info.m_hasLightmap) {
combiner += hecl::Format(" vec4 lightMapTexel = texture(lightMap, vtf.uvs[%d]);\n", lightmapUv);
fmt::print(out, fmt("vec4 lightMapTexel = texture(lightMap, vtf.uvs[{}]);"), lightmapUv);
// 0: Tex4TCG, Tex4, doubleLightmapBlend ? NULL : GX_COLOR1A1
// ZERO, TEX, KONST, doubleLightmapBlend ? ZERO : RAS
// Output reg 2
@@ -380,10 +373,10 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
// Output reg 2
// KColor 3
// Tex * K2 + Lighting
combiner += " lighting += mix(lightMapTexel * kColor2, lightMapTexel, kColor3);\n";
out << "lighting += mix(lightMapTexel * kColor2, lightMapTexel, kColor3);";
} else {
// mix(Tex * K2, Tex, K3) + Lighting
combiner += " lighting += lightMapTexel * kColor2;\n";
out << "lighting += lightMapTexel * kColor2;";
}
}
@@ -403,22 +396,22 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
// (Tex0 * kColor0 + Lighting) * Tex1 + VertColor + Tex2 * Lighting
if (info.m_hasPatternTex2) {
if (info.m_hasPatternTex1)
combiner +=
" colorOut = (texture(patternTex1, vtf.uvs[0]) * kColor0 + lighting) *\n"
" texture(patternTex2, vtf.uvs[1]) + vtf.color;\n";
out <<
"colorOut = (texture(patternTex1, vtf.uvs[0]) * kColor0 + lighting) * "
"texture(patternTex2, vtf.uvs[1]) + vtf.color;";
else
combiner += " colorOut = lighting * texture(patternTex2, vtf.uvs[1]) + vtf.color;\n";
out << "colorOut = lighting * texture(patternTex2, vtf.uvs[1]) + vtf.color;";
} else {
combiner += " colorOut = vtf.color;\n";
out << "colorOut = vtf.color;";
}
if (info.m_hasColorTex && !info.m_hasEnvMap && info.m_hasEnvBumpMap) {
// Make previous stage indirect, mtx0
combiner += hecl::Format(
" vec2 indUvs = (texture(envBumpMap, vtf.uvs[%d]).ra - vec2(0.5, 0.5)) *\n"
" vec2(fog.indScale, -fog.indScale);\n",
fmt::print(out, fmt(
"vec2 indUvs = (texture(envBumpMap, vtf.uvs[{}]).ra - vec2(0.5, 0.5)) * "
"vec2(fog.indScale, -fog.indScale);"),
envBumpMapUv);
combiner += " colorOut += texture(colorTex, indUvs + vtf.uvs[2]) * lighting;\n";
out << "colorOut += texture(colorTex, indUvs + vtf.uvs[2]) * lighting;";
} else if (info.m_hasEnvMap) {
// Next: envTCG, envTex, NULL
// PREV, TEX, KONST, ZERO
@@ -427,22 +420,21 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
// Make previous stage indirect, mtx0
if (info.m_hasColorTex)
combiner += " colorOut += texture(colorTex, vtf.uvs[2]) * lighting;\n";
combiner += hecl::Format(
" vec2 indUvs = (texture(envBumpMap, vtf.uvs[%d]).ra - vec2(0.5, 0.5)) *\n"
" vec2(fog.indScale, -fog.indScale);\n",
out << "colorOut += texture(colorTex, vtf.uvs[2]) * lighting;";
fmt::print(out, fmt(
"vec2 indUvs = (texture(envBumpMap, vtf.uvs[{}]).ra - vec2(0.5, 0.5)) * "
"vec2(fog.indScale, -fog.indScale);"),
envBumpMapUv);
combiner +=
hecl::Format(" colorOut = mix(colorOut, texture(envMap, indUvs + vtf.uvs[%d]), kColor1);\n", envMapUv);
fmt::print(out, fmt("colorOut = mix(colorOut, texture(envMap, indUvs + vtf.uvs[{}]), kColor1);"), envMapUv);
} else if (info.m_hasColorTex) {
combiner += " colorOut += texture(colorTex, vtf.uvs[2]) * lighting;\n";
out << "colorOut += texture(colorTex, vtf.uvs[2]) * lighting;";
}
break;
case EFluidType::PoisonWater:
if (info.m_hasLightmap) {
combiner += hecl::Format(" vec4 lightMapTexel = texture(lightMap, vtf.uvs[%d]);\n", lightmapUv);
fmt::print(out, fmt("vec4 lightMapTexel = texture(lightMap, vtf.uvs[{}]);"), lightmapUv);
// 0: Tex4TCG, Tex4, doubleLightmapBlend ? NULL : GX_COLOR1A1
// ZERO, TEX, KONST, doubleLightmapBlend ? ZERO : RAS
// Output reg 2
@@ -453,10 +445,10 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
// Output reg 2
// KColor 3
// Tex * K2 + Lighting
combiner += " lighting += mix(lightMapTexel * kColor2, lightMapTexel, kColor3);\n";
out << "lighting += mix(lightMapTexel * kColor2, lightMapTexel, kColor3);";
} else {
// mix(Tex * K2, Tex, K3) + Lighting
combiner += " lighting += lightMapTexel * kColor2;\n";
out << "lighting += lightMapTexel * kColor2;";
}
}
@@ -476,25 +468,25 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
// (Tex0 * kColor0 + Lighting) * Tex1 + VertColor + Tex2 * Lighting
if (info.m_hasPatternTex2) {
if (info.m_hasPatternTex1)
combiner +=
" colorOut = (texture(patternTex1, vtf.uvs[0]) * kColor0 + lighting) *\n"
" texture(patternTex2, vtf.uvs[1]) + vtf.color;\n";
out <<
"colorOut = (texture(patternTex1, vtf.uvs[0]) * kColor0 + lighting) * "
"texture(patternTex2, vtf.uvs[1]) + vtf.color;";
else
combiner += " colorOut = lighting * texture(patternTex2, vtf.uvs[1]) + vtf.color;\n";
out << "colorOut = lighting * texture(patternTex2, vtf.uvs[1]) + vtf.color;";
} else {
combiner += " colorOut = vtf.color;\n";
out << "colorOut = vtf.color;";
}
if (info.m_hasColorTex) {
if (info.m_hasEnvBumpMap) {
// Make previous stage indirect, mtx0
combiner += hecl::Format(
" vec2 indUvs = (texture(envBumpMap, vtf.uvs[%d]).ra - vec2(0.5, 0.5)) *\n"
" vec2(fog.indScale, -fog.indScale);\n",
fmt::print(out, fmt(
"vec2 indUvs = (texture(envBumpMap, vtf.uvs[{}]).ra - vec2(0.5, 0.5)) * "
"vec2(fog.indScale, -fog.indScale);"),
envBumpMapUv);
combiner += " colorOut += texture(colorTex, indUvs + vtf.uvs[2]) * lighting;\n";
out << "colorOut += texture(colorTex, indUvs + vtf.uvs[2]) * lighting;";
} else {
combiner += " colorOut += texture(colorTex, vtf.uvs[2]) * lighting;\n";
out << "colorOut += texture(colorTex, vtf.uvs[2]) * lighting;";
}
}
@@ -517,17 +509,17 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
// (Tex0 * kColor0 + VertColor) * Tex1 + VertColor + Tex2
if (info.m_hasPatternTex2) {
if (info.m_hasPatternTex1)
combiner +=
" colorOut = (texture(patternTex1, vtf.uvs[0]) * kColor0 + vtf.color) *\n"
" texture(patternTex2, vtf.uvs[1]) + vtf.color;\n";
out <<
"colorOut = (texture(patternTex1, vtf.uvs[0]) * kColor0 + vtf.color) * "
"texture(patternTex2, vtf.uvs[1]) + vtf.color;";
else
combiner += " colorOut = vtf.color * texture(patternTex2, vtf.uvs[1]) + vtf.color;\n";
out << "colorOut = vtf.color * texture(patternTex2, vtf.uvs[1]) + vtf.color;";
} else {
combiner += " colorOut = vtf.color;\n";
out << "colorOut = vtf.color;";
}
if (info.m_hasColorTex)
combiner += " colorOut += texture(colorTex, vtf.uvs[2]);\n";
out << "colorOut += texture(colorTex, vtf.uvs[2]);";
if (info.m_hasBumpMap) {
// 3: bumpMapTCG, bumpMap, NULL
@@ -538,13 +530,13 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
// ZERO, TEX, ONE, C0
// Output reg 0, subtract, clamp, no bias
combiner +=
" vec3 lightVec = lights[3].pos.xyz - vtf.mvPos.xyz;\n"
" float lx = dot(vtf.mvTangent.xyz, lightVec);\n"
" float ly = dot(vtf.mvBinorm.xyz, lightVec);\n";
combiner += hecl::Format(
" vec4 emboss1 = texture(bumpMap, vtf.uvs[%d]) + vec4(0.5);\n"
" vec4 emboss2 = texture(bumpMap, vtf.uvs[%d] + vec2(lx, ly));\n",
out <<
"vec3 lightVec = lights[3].pos.xyz - vtf.mvPos.xyz;"
"float lx = dot(vtf.mvTangent.xyz, lightVec);"
"float ly = dot(vtf.mvBinorm.xyz, lightVec);";
fmt::print(out, fmt(
"vec4 emboss1 = texture(bumpMap, vtf.uvs[{}]) + vec4(0.5);"
"vec4 emboss2 = texture(bumpMap, vtf.uvs[{}] + vec2(lx, ly));"),
bumpMapUv, bumpMapUv);
// 5: NULL, NULL, NULL
@@ -552,7 +544,7 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
// Output reg prev, scale 2, clamp
// colorOut * clamp(emboss1 + 0.5 - emboss2, 0.0, 1.0) * 2.0
combiner += "colorOut *= clamp((emboss1 + vec4(0.5) - emboss2) * vec4(2.0), vec4(0.0), vec4(1.0));\n";
out << "colorOut *= clamp((emboss1 + vec4(0.5) - emboss2) * vec4(2.0), vec4(0.0), vec4(1.0));";
}
break;
@@ -574,70 +566,59 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
// (Tex0 * kColor0 + VertColor) * Tex1 + VertColor + Tex2
if (info.m_hasPatternTex2) {
if (info.m_hasPatternTex1)
combiner +=
" colorOut = (texture(patternTex1, vtf.uvs[0]) * kColor0 + vtf.color) *\n"
" texture(patternTex2, vtf.uvs[1]) + vtf.color;\n";
out <<
"colorOut = (texture(patternTex1, vtf.uvs[0]) * kColor0 + vtf.color) * "
"texture(patternTex2, vtf.uvs[1]) + vtf.color;";
else
combiner += " colorOut = vtf.color * texture(patternTex2, vtf.uvs[1]) + vtf.color;\n";
out << "colorOut = vtf.color * texture(patternTex2, vtf.uvs[1]) + vtf.color;";
} else {
combiner += " colorOut = vtf.color;\n";
out << "colorOut = vtf.color;";
}
if (info.m_hasColorTex)
combiner += " colorOut += texture(colorTex, vtf.uvs[2]);\n";
out << "colorOut += texture(colorTex, vtf.uvs[2]);";
if (info.m_hasBumpMap) {
// 3: bumpMapTCG, bumpMap, NULL
// ZERO, TEX, PREV, ZERO
// Output reg prev, scale 2
combiner += hecl::Format(" vec4 emboss1 = texture(bumpMap, vtf.uvs[%d]) + vec4(0.5);\n", bumpMapUv);
combiner += "colorOut *= emboss1 * vec4(2.0);\n";
fmt::print(out, fmt("vec4 emboss1 = texture(bumpMap, vtf.uvs[{}]) + vec4(0.5);"), bumpMapUv);
out << "colorOut *= emboss1 * vec4(2.0);";
}
break;
}
combiner += " colorOut.a = kColor0.a;\n";
out << "colorOut.a = kColor0.a;\n";
char* finalFSs;
asprintf(&finalFSs, FS, int(info.m_additive), textures.c_str(), combiner.c_str());
std::string ret(finalFSs);
free(finalFSs);
return ret;
out << "#define IS_ADDITIVE " << int(info.m_additive) << '\n';
out << FS;
return out.str();
}
static std::string _BuildAdditionalTCGs(const SFluidPlaneShaderInfo& info) {
std::string additionalTCGs;
static void _BuildAdditionalTCGs(std::stringstream& out, const SFluidPlaneShaderInfo& info) {
int nextTCG = 3;
int nextMtx = 4;
if (info.m_hasBumpMap) {
additionalTCGs += hecl::Format(" vtf.uvs[%d] = (texMtxs[0] * pos).xy;\n", nextTCG++);
}
if (info.m_hasEnvBumpMap) {
additionalTCGs += hecl::Format(" vtf.uvs[%d] = (texMtxs[3] * vec4(normalIn.xyz, 1.0)).xy;\n", nextTCG++);
}
if (info.m_hasEnvMap) {
additionalTCGs += hecl::Format(" vtf.uvs[%d] = (texMtxs[%d] * pos).xy;\n", nextTCG++, nextMtx++);
}
if (info.m_hasLightmap) {
additionalTCGs += hecl::Format(" vtf.uvs[%d] = (texMtxs[%d] * pos).xy;\n", nextTCG, nextMtx);
}
return additionalTCGs;
if (info.m_hasBumpMap)
fmt::print(out, fmt("vtf.uvs[{}] = (texMtxs[0] * pos).xy;"), nextTCG++);
if (info.m_hasEnvBumpMap)
fmt::print(out, fmt("vtf.uvs[{}] = (texMtxs[3] * vec4(normalIn.xyz, 1.0)).xy;"), nextTCG++);
if (info.m_hasEnvMap)
fmt::print(out, fmt("vtf.uvs[{}] = (texMtxs[{}] * pos).xy;"), nextTCG++, nextMtx++);
if (info.m_hasLightmap)
fmt::print(out, fmt("vtf.uvs[{}] = (texMtxs[{}] * pos).xy;"), nextTCG, nextMtx);
out << '\n';
}
static std::string _BuildVS(const SFluidPlaneShaderInfo& info, bool tessellation) {
if (tessellation)
return TessVS;
std::string additionalTCGs = _BuildAdditionalTCGs(info);
char* finalVSs;
asprintf(&finalVSs, VS, additionalTCGs.c_str());
std::string ret(finalVSs);
free(finalVSs);
return ret;
std::stringstream out;
_BuildAdditionalTCGs(out, info);
out << VS;
return out.str();
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::OpenGL, hecl::PipelineStage::Vertex>::BuildShader(
@@ -704,14 +685,11 @@ static std::string BuildES(const SFluidPlaneShaderInfo& info) {
if (info.m_hasLightmap)
nextTex++;
std::string additionalTCGs = _BuildAdditionalTCGs(info);
char* finalESs;
asprintf(&finalESs, TessES, nextTex, additionalTCGs.c_str());
std::string ret(finalESs);
free(finalESs);
return ret;
std::stringstream out;
_BuildAdditionalTCGs(out, info);
out << "#define RIPPLE_TEXTURE_IDX " << nextTex << '\n';
out << TessES;
return out.str();
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::OpenGL, hecl::PipelineStage::Evaluation>::BuildShader(
@@ -730,48 +708,44 @@ std::string StageObject_CFluidPlaneShader<hecl::PlatformType::NX, hecl::Pipeline
}
static std::string _BuildVS(const SFluidPlaneDoorShaderInfo& info) {
char* finalVSs;
asprintf(&finalVSs, VS, "");
std::string ret(finalVSs);
free(finalVSs);
return ret;
std::stringstream out;
out << "#define ADDITIONAL_TCGS\n";
out << VS;
return out.str();
}
static std::string _BuildFS(const SFluidPlaneDoorShaderInfo& info) {
int nextTex = 0;
std::string textures;
std::string combiner;
std::stringstream out;
if (info.m_hasPatternTex1) {
textures += hecl::Format("TBINDING%d uniform sampler2D patternTex1;\n", nextTex++);
}
if (info.m_hasPatternTex2) {
textures += hecl::Format("TBINDING%d uniform sampler2D patternTex2;\n", nextTex++);
}
if (info.m_hasColorTex) {
textures += hecl::Format("TBINDING%d uniform sampler2D colorTex;\n", nextTex++);
}
out << "#define TEXTURE_PARAMS ";
if (info.m_hasPatternTex1)
fmt::print(out, fmt("TBINDING{} uniform sampler2D patternTex1;"), nextTex++);
if (info.m_hasPatternTex2)
fmt::print(out, fmt("TBINDING{} uniform sampler2D patternTex2;"), nextTex++);
if (info.m_hasColorTex)
fmt::print(out, fmt("TBINDING{} uniform sampler2D colorTex;"), nextTex++);
out << '\n';
// Tex0 * kColor0 * Tex1 + Tex2
out << "#define COMBINER_EXPRS ";
if (info.m_hasPatternTex1 && info.m_hasPatternTex2) {
combiner +=
" colorOut = texture(patternTex1, vtf.uvs[0]) * kColor0 *\n"
" texture(patternTex2, vtf.uvs[1]);\n";
out <<
"colorOut = texture(patternTex1, vtf.uvs[0]) * kColor0 * "
"texture(patternTex2, vtf.uvs[1]);";
} else {
combiner += " colorOut = vec4(0.0);\n";
out << "colorOut = vec4(0.0);";
}
if (info.m_hasColorTex) {
combiner += " colorOut += texture(colorTex, vtf.uvs[2]);\n";
out << "colorOut += texture(colorTex, vtf.uvs[2]);";
}
combiner += " colorOut.a = kColor0.a;\n";
out << "colorOut.a = kColor0.a;\n";
char* finalFSs;
asprintf(&finalFSs, FSDoor, 0, textures.c_str(), combiner.c_str());
std::string ret(finalFSs);
free(finalFSs);
return ret;
out << "#define IS_ADDITIVE 0\n";
out << FSDoor;
return out.str();
}
template <>