mirror of https://github.com/AxioDL/metaforce.git
Function-scope statics aren't as efficient as file-scope ones
This commit is contained in:
parent
3886f4409c
commit
7803681352
|
@ -16,6 +16,8 @@ static logvisor::Module Log("specter::Space");
|
||||||
|
|
||||||
#define CORNER_DRAG_THRESHOLD 20
|
#define CORNER_DRAG_THRESHOLD 20
|
||||||
|
|
||||||
|
static const zeus::CColor TriColor = {0.75, 0.75, 0.75, 1.0};
|
||||||
|
|
||||||
Space::Space(ViewResources& res, View& parentView, ISpaceController& controller,
|
Space::Space(ViewResources& res, View& parentView, ISpaceController& controller,
|
||||||
Toolbar::Position tbPos, unsigned tbUnits)
|
Toolbar::Position tbPos, unsigned tbUnits)
|
||||||
: View(res, parentView), m_controller(controller), m_tbPos(tbPos)
|
: View(res, parentView), m_controller(controller), m_tbPos(tbPos)
|
||||||
|
@ -26,9 +28,8 @@ Space::Space(ViewResources& res, View& parentView, ISpaceController& controller,
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
setBackground(res.themeData().spaceBackground());
|
setBackground(res.themeData().spaceBackground());
|
||||||
static const zeus::CColor triColor = {0.75, 0.75, 0.75, 1.0};
|
|
||||||
if (controller.spaceSplitAllowed())
|
if (controller.spaceSplitAllowed())
|
||||||
m_cornerView.m_view.reset(new CornerView(res, *this, triColor));
|
m_cornerView.m_view.reset(new CornerView(res, *this, TriColor));
|
||||||
if (tbPos != Toolbar::Position::None)
|
if (tbPos != Toolbar::Position::None)
|
||||||
m_toolbar.m_view.reset(new Toolbar(res, *this, tbPos, tbUnits));
|
m_toolbar.m_view.reset(new Toolbar(res, *this, tbPos, tbUnits));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,16 @@ namespace specter
|
||||||
{
|
{
|
||||||
static logvisor::Module Log("specter::SplitView");
|
static logvisor::Module Log("specter::SplitView");
|
||||||
|
|
||||||
void SplitView::Resources::init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme)
|
static const zeus::RGBA32 Tex[3] =
|
||||||
{
|
{
|
||||||
static const zeus::RGBA32 tex[3] =
|
|
||||||
{
|
|
||||||
{0,0,0,64},
|
{0,0,0,64},
|
||||||
{0,0,0,255},
|
{0,0,0,255},
|
||||||
{255,255,255,64}
|
{255,255,255,64}
|
||||||
};
|
};
|
||||||
m_shadingTex = ctx.newStaticTexture(3, 1, 1, boo::TextureFormat::RGBA8, tex, 12);
|
|
||||||
|
void SplitView::Resources::init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme)
|
||||||
|
{
|
||||||
|
m_shadingTex = ctx.newStaticTexture(3, 1, 1, boo::TextureFormat::RGBA8, Tex, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
SplitView::SplitView(ViewResources& res, View& parentView, ISplitSpaceController* controller,
|
SplitView::SplitView(ViewResources& res, View& parentView, ISplitSpaceController* controller,
|
||||||
|
|
|
@ -65,12 +65,12 @@ BOO_GLSL_BINDING_HEAD
|
||||||
" blendOut = colorOut.a * texture(fontTex, vtf.uv);\n"
|
" blendOut = colorOut.a * texture(fontTex, vtf.uv);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
|
static const char* BlockNames[] = {"SpecterViewBlock"};
|
||||||
|
|
||||||
void TextView::Resources::init(boo::GLDataFactory::Context& ctx, FontCache* fcache)
|
void TextView::Resources::init(boo::GLDataFactory::Context& ctx, FontCache* fcache)
|
||||||
{
|
{
|
||||||
m_fcache = fcache;
|
m_fcache = fcache;
|
||||||
|
|
||||||
static const char* BlockNames[] = {"SpecterViewBlock"};
|
|
||||||
|
|
||||||
m_regular =
|
m_regular =
|
||||||
ctx.newShaderPipeline(GLSLVS, GLSLFSReg, 1, "fontTex", 1, BlockNames,
|
ctx.newShaderPipeline(GLSLVS, GLSLFSReg, 1, "fontTex", 1, BlockNames,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
|
|
|
@ -9,16 +9,17 @@ namespace specter
|
||||||
{
|
{
|
||||||
static logvisor::Module Log("specter::Space");
|
static logvisor::Module Log("specter::Space");
|
||||||
|
|
||||||
void Toolbar::Resources::init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme)
|
static const zeus::RGBA32 Tex[] =
|
||||||
{
|
{
|
||||||
static const zeus::RGBA32 tex[] =
|
|
||||||
{
|
|
||||||
{{255,255,255,64}},
|
{{255,255,255,64}},
|
||||||
{{255,255,255,64}},
|
{{255,255,255,64}},
|
||||||
{{0,0,0,64}},
|
{{0,0,0,64}},
|
||||||
{{0,0,0,64}}
|
{{0,0,0,64}}
|
||||||
};
|
};
|
||||||
m_shadingTex = ctx.newStaticTexture(4, 1, 1, boo::TextureFormat::RGBA8, tex, 16);
|
|
||||||
|
void Toolbar::Resources::init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme)
|
||||||
|
{
|
||||||
|
m_shadingTex = ctx.newStaticTexture(4, 1, 1, boo::TextureFormat::RGBA8, Tex, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
Toolbar::Toolbar(ViewResources& res, View& parentView, Position tbPos, unsigned units)
|
Toolbar::Toolbar(ViewResources& res, View& parentView, Position tbPos, unsigned units)
|
||||||
|
|
|
@ -71,10 +71,10 @@ BOO_GLSL_BINDING_HEAD
|
||||||
" colorOut = texture(tex, vtf.uv) * vtf.color;\n"
|
" colorOut = texture(tex, vtf.uv) * vtf.color;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
|
static const char* BlockNames[] = {"SpecterViewBlock"};
|
||||||
|
|
||||||
void View::Resources::init(boo::GLDataFactory::Context& ctx, const IThemeData& theme)
|
void View::Resources::init(boo::GLDataFactory::Context& ctx, const IThemeData& theme)
|
||||||
{
|
{
|
||||||
static const char* BlockNames[] = {"SpecterViewBlock"};
|
|
||||||
|
|
||||||
m_solidShader = ctx.newShaderPipeline(GLSLSolidVS, GLSLSolidFS, 0, nullptr, 1, BlockNames,
|
m_solidShader = ctx.newShaderPipeline(GLSLSolidVS, GLSLSolidFS, 0, nullptr, 1, BlockNames,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, false, false, false);
|
boo::Primitive::TriStrips, false, false, false);
|
||||||
|
|
Loading…
Reference in New Issue