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
|
||||
|
||||
static const zeus::CColor TriColor = {0.75, 0.75, 0.75, 1.0};
|
||||
|
||||
Space::Space(ViewResources& res, View& parentView, ISpaceController& controller,
|
||||
Toolbar::Position tbPos, unsigned tbUnits)
|
||||
: View(res, parentView), m_controller(controller), m_tbPos(tbPos)
|
||||
|
@ -26,9 +28,8 @@ Space::Space(ViewResources& res, View& parentView, ISpaceController& controller,
|
|||
return true;
|
||||
});
|
||||
setBackground(res.themeData().spaceBackground());
|
||||
static const zeus::CColor triColor = {0.75, 0.75, 0.75, 1.0};
|
||||
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)
|
||||
m_toolbar.m_view.reset(new Toolbar(res, *this, tbPos, tbUnits));
|
||||
}
|
||||
|
|
|
@ -8,15 +8,16 @@ namespace specter
|
|||
{
|
||||
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,255},
|
||||
{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,
|
||||
|
|
|
@ -65,12 +65,12 @@ BOO_GLSL_BINDING_HEAD
|
|||
" blendOut = colorOut.a * texture(fontTex, vtf.uv);\n"
|
||||
"}\n";
|
||||
|
||||
static const char* BlockNames[] = {"SpecterViewBlock"};
|
||||
|
||||
void TextView::Resources::init(boo::GLDataFactory::Context& ctx, FontCache* fcache)
|
||||
{
|
||||
m_fcache = fcache;
|
||||
|
||||
static const char* BlockNames[] = {"SpecterViewBlock"};
|
||||
|
||||
m_regular =
|
||||
ctx.newShaderPipeline(GLSLVS, GLSLFSReg, 1, "fontTex", 1, BlockNames,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
|
|
|
@ -9,16 +9,17 @@ namespace specter
|
|||
{
|
||||
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}},
|
||||
{{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)
|
||||
|
|
|
@ -71,10 +71,10 @@ BOO_GLSL_BINDING_HEAD
|
|||
" colorOut = texture(tex, vtf.uv) * vtf.color;\n"
|
||||
"}\n";
|
||||
|
||||
static const char* BlockNames[] = {"SpecterViewBlock"};
|
||||
|
||||
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,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, false, false, false);
|
||||
|
|
Loading…
Reference in New Issue