2015-11-21 23:45:02 +00:00
|
|
|
#include "Specter/View.hpp"
|
2015-12-02 01:32:15 +00:00
|
|
|
#include "Specter/ViewResources.hpp"
|
2015-11-29 02:55:30 +00:00
|
|
|
#include "Specter/RootView.hpp"
|
2015-11-21 23:45:02 +00:00
|
|
|
|
|
|
|
namespace Specter
|
|
|
|
{
|
2016-01-07 00:39:18 +00:00
|
|
|
static LogVisor::LogModule Log("Specter::View");
|
2015-11-21 23:45:02 +00:00
|
|
|
|
2015-12-04 01:35:01 +00:00
|
|
|
void View::Resources::init(boo::GLDataFactory* factory, const ThemeData& theme)
|
2015-11-26 00:24:01 +00:00
|
|
|
{
|
2015-11-30 00:21:42 +00:00
|
|
|
static const char* SolidVS =
|
2015-11-26 00:24:01 +00:00
|
|
|
"#version 330\n"
|
|
|
|
"layout(location=0) in vec3 posIn;\n"
|
|
|
|
"layout(location=1) in vec4 colorIn;\n"
|
|
|
|
SPECTER_VIEW_VERT_BLOCK_GLSL
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
|
|
|
" vec4 color;\n"
|
|
|
|
"};\n"
|
|
|
|
"out VertToFrag vtf;\n"
|
|
|
|
"void main()\n"
|
|
|
|
"{\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" vtf.color = colorIn * mulColor;\n"
|
2015-11-26 23:03:56 +00:00
|
|
|
" gl_Position = mv * vec4(posIn, 1.0);\n"
|
2015-11-26 00:24:01 +00:00
|
|
|
"}\n";
|
|
|
|
|
2015-11-30 00:21:42 +00:00
|
|
|
static const char* SolidFS =
|
2015-11-26 00:24:01 +00:00
|
|
|
"#version 330\n"
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
|
|
|
" vec4 color;\n"
|
|
|
|
"};\n"
|
|
|
|
"in VertToFrag vtf;\n"
|
|
|
|
"layout(location=0) out vec4 colorOut;\n"
|
|
|
|
"void main()\n"
|
|
|
|
"{\n"
|
|
|
|
" colorOut = vtf.color;\n"
|
|
|
|
"}\n";
|
|
|
|
|
2015-11-30 00:21:42 +00:00
|
|
|
static const char* TexVS =
|
|
|
|
"#version 330\n"
|
|
|
|
"layout(location=0) in vec3 posIn;\n"
|
|
|
|
"layout(location=1) in vec2 uvIn;\n"
|
|
|
|
SPECTER_VIEW_VERT_BLOCK_GLSL
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" vec4 color;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
" vec2 uv;\n"
|
|
|
|
"};\n"
|
|
|
|
"out VertToFrag vtf;\n"
|
|
|
|
"void main()\n"
|
|
|
|
"{\n"
|
|
|
|
" vtf.uv = uvIn;\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" vtf.color = mulColor;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
" gl_Position = mv * vec4(posIn, 1.0);\n"
|
|
|
|
"}\n";
|
|
|
|
|
|
|
|
static const char* TexFS =
|
|
|
|
"#version 330\n"
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" vec4 color;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
" vec2 uv;\n"
|
|
|
|
"};\n"
|
|
|
|
"in VertToFrag vtf;\n"
|
|
|
|
"uniform sampler2D tex;\n"
|
|
|
|
"layout(location=0) out vec4 colorOut;\n"
|
|
|
|
"void main()\n"
|
|
|
|
"{\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" colorOut = texture(tex, vtf.uv) * vtf.color;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
"}\n";
|
|
|
|
|
2015-11-26 00:24:01 +00:00
|
|
|
static const char* BlockNames[] = {"SpecterViewBlock"};
|
|
|
|
|
2015-11-30 00:21:42 +00:00
|
|
|
m_solidShader = factory->newShaderPipeline(SolidVS, SolidFS, 0, nullptr, 1, BlockNames,
|
2015-11-26 00:24:01 +00:00
|
|
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
|
|
|
false, false, false);
|
2015-11-30 00:21:42 +00:00
|
|
|
|
|
|
|
m_texShader = factory->newShaderPipeline(TexVS, TexFS, 1, "tex", 1, BlockNames,
|
|
|
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
|
|
|
false, false, false);
|
2015-11-26 00:24:01 +00:00
|
|
|
}
|
2015-11-28 04:05:27 +00:00
|
|
|
|
|
|
|
#if _WIN32
|
2015-11-26 00:24:01 +00:00
|
|
|
|
2015-12-04 01:53:55 +00:00
|
|
|
void View::Resources::init(boo::ID3DDataFactory* factory, const ThemeData& theme)
|
2015-11-27 22:20:22 +00:00
|
|
|
{
|
2015-11-30 00:21:42 +00:00
|
|
|
static const char* SolidVS =
|
2015-11-27 22:20:22 +00:00
|
|
|
"struct VertData\n"
|
|
|
|
"{\n"
|
|
|
|
" float3 posIn : POSITION;\n"
|
|
|
|
" float4 colorIn : COLOR;\n"
|
|
|
|
"};\n"
|
|
|
|
SPECTER_VIEW_VERT_BLOCK_HLSL
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
|
|
|
" float4 position : SV_Position;\n"
|
|
|
|
" float4 color : COLOR;\n"
|
|
|
|
"};\n"
|
|
|
|
"VertToFrag main(in VertData v)\n"
|
|
|
|
"{\n"
|
|
|
|
" VertToFrag vtf;\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" vtf.color = v.colorIn * mulColor;\n"
|
2015-11-27 22:20:22 +00:00
|
|
|
" vtf.position = mul(mv, float4(v.posIn, 1.0));\n"
|
|
|
|
" return vtf;\n"
|
|
|
|
"}\n";
|
|
|
|
|
2015-11-30 00:21:42 +00:00
|
|
|
static const char* SolidFS =
|
2015-11-27 22:20:22 +00:00
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
|
|
|
" float4 position : SV_Position;\n"
|
|
|
|
" float4 color : COLOR;\n"
|
|
|
|
"};\n"
|
|
|
|
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
|
|
|
"{\n"
|
|
|
|
" return vtf.color;\n"
|
|
|
|
"}\n";
|
|
|
|
|
2015-11-30 00:21:42 +00:00
|
|
|
static const char* TexVS =
|
|
|
|
"struct VertData\n"
|
|
|
|
"{\n"
|
|
|
|
" float3 posIn : POSITION;\n"
|
|
|
|
" float2 uvIn : UV;\n"
|
|
|
|
"};\n"
|
|
|
|
SPECTER_VIEW_VERT_BLOCK_HLSL
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
|
|
|
" float4 position : SV_Position;\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" float4 color : COLOR;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
" float2 uv : UV;\n"
|
|
|
|
"};\n"
|
|
|
|
"VertToFrag main(in VertData v)\n"
|
|
|
|
"{\n"
|
|
|
|
" VertToFrag vtf;\n"
|
|
|
|
" vtf.uv = v.uvIn;\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" vtf.color = mulColor;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
" vtf.position = mul(mv, float4(v.posIn, 1.0));\n"
|
|
|
|
" return vtf;\n"
|
|
|
|
"}\n";
|
|
|
|
|
|
|
|
static const char* TexFS =
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
|
|
|
" float4 position : SV_Position;\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" float4 color : COLOR;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
" float2 uv : UV;\n"
|
|
|
|
"};\n"
|
|
|
|
"Texture2D tex : register(t0);\n"
|
|
|
|
"SamplerState samp : register(s0);\n"
|
|
|
|
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
|
|
|
"{\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" return tex.Sample(samp, vtf.uv) * vtf.color;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
"}\n";
|
|
|
|
|
2015-11-30 03:41:53 +00:00
|
|
|
boo::VertexElementDescriptor solidvdescs[] =
|
2015-11-27 22:20:22 +00:00
|
|
|
{
|
|
|
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
2015-12-05 00:42:46 +00:00
|
|
|
{nullptr, nullptr, boo::VertexSemantic::Color}
|
2015-11-27 22:20:22 +00:00
|
|
|
};
|
2015-11-30 03:41:53 +00:00
|
|
|
m_solidVtxFmt = factory->newVertexFormat(2, solidvdescs);
|
2015-11-27 22:20:22 +00:00
|
|
|
|
|
|
|
ComPtr<ID3DBlob> vertBlob;
|
|
|
|
ComPtr<ID3DBlob> fragBlob;
|
|
|
|
ComPtr<ID3DBlob> pipeBlob;
|
2015-11-30 00:21:42 +00:00
|
|
|
m_solidShader = factory->newShaderPipeline(SolidVS, SolidFS, vertBlob, fragBlob, pipeBlob, m_solidVtxFmt,
|
|
|
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
|
|
|
false, false, false);
|
|
|
|
|
2015-11-30 03:41:53 +00:00
|
|
|
boo::VertexElementDescriptor texvdescs[] =
|
2015-11-30 00:21:42 +00:00
|
|
|
{
|
|
|
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
|
|
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
|
|
|
};
|
2015-11-30 03:41:53 +00:00
|
|
|
m_texVtxFmt = factory->newVertexFormat(2, texvdescs);
|
2015-11-30 00:21:42 +00:00
|
|
|
|
|
|
|
vertBlob.Reset();
|
|
|
|
fragBlob.Reset();
|
|
|
|
pipeBlob.Reset();
|
2015-12-01 00:35:45 +00:00
|
|
|
m_texShader = factory->newShaderPipeline(TexVS, TexFS, vertBlob, fragBlob, pipeBlob, m_texVtxFmt,
|
|
|
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
|
|
|
false, false, false);
|
2015-11-27 22:20:22 +00:00
|
|
|
}
|
2015-11-28 04:05:27 +00:00
|
|
|
|
|
|
|
#elif BOO_HAS_METAL
|
|
|
|
|
2015-12-04 01:53:55 +00:00
|
|
|
void View::Resources::init(boo::MetalDataFactory* factory, const ThemeData& theme)
|
2015-11-28 04:05:27 +00:00
|
|
|
{
|
2015-11-30 00:21:42 +00:00
|
|
|
static const char* SolidVS =
|
2015-11-28 04:05:27 +00:00
|
|
|
"#include <metal_stdlib>\n"
|
|
|
|
"using namespace metal;\n"
|
|
|
|
"struct VertData\n"
|
|
|
|
"{\n"
|
|
|
|
" float3 posIn [[ attribute(0) ]];\n"
|
|
|
|
" float4 colorIn [[ attribute(1) ]];\n"
|
|
|
|
"};\n"
|
|
|
|
SPECTER_VIEW_VERT_BLOCK_METAL
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
|
|
|
" float4 position [[ position ]];\n"
|
|
|
|
" float4 color;\n"
|
|
|
|
"};\n"
|
|
|
|
"vertex VertToFrag vmain(VertData v [[ stage_in ]], constant SpecterViewBlock& view [[ buffer(2) ]])\n"
|
|
|
|
"{\n"
|
|
|
|
" VertToFrag vtf;\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" vtf.color = v.colorIn * view.mulColor;\n"
|
2015-11-28 04:05:27 +00:00
|
|
|
" vtf.position = view.mv * float4(v.posIn, 1.0);\n"
|
|
|
|
" return vtf;\n"
|
|
|
|
"}\n";
|
|
|
|
|
2015-11-30 00:21:42 +00:00
|
|
|
static const char* SolidFS =
|
2015-11-28 04:05:27 +00:00
|
|
|
"#include <metal_stdlib>\n"
|
|
|
|
"using namespace metal;\n"
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
|
|
|
" float4 position [[ position ]];\n"
|
|
|
|
" float4 color;\n"
|
|
|
|
"};\n"
|
|
|
|
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]])\n"
|
|
|
|
"{\n"
|
|
|
|
" return vtf.color;\n"
|
|
|
|
"}\n";
|
2015-11-30 00:21:42 +00:00
|
|
|
|
|
|
|
static const char* TexVS =
|
|
|
|
"#include <metal_stdlib>\n"
|
|
|
|
"using namespace metal;\n"
|
|
|
|
"struct VertData\n"
|
|
|
|
"{\n"
|
|
|
|
" float3 posIn [[ attribute(0) ]];\n"
|
|
|
|
" float2 uvIn [[ attribute(1) ]];\n"
|
|
|
|
"};\n"
|
|
|
|
SPECTER_VIEW_VERT_BLOCK_METAL
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
|
|
|
" float4 position [[ position ]];\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" float4 color;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
" float2 uv;\n"
|
|
|
|
"};\n"
|
|
|
|
"vertex VertToFrag vmain(VertData v [[ stage_in ]], constant SpecterViewBlock& view [[ buffer(2) ]])\n"
|
|
|
|
"{\n"
|
|
|
|
" VertToFrag vtf;\n"
|
|
|
|
" vtf.uv = v.uvIn;\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" vtf.color = view.mulColor;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
" vtf.position = view.mv * float4(v.posIn, 1.0);\n"
|
|
|
|
" return vtf;\n"
|
|
|
|
"}\n";
|
|
|
|
|
|
|
|
static const char* TexFS =
|
|
|
|
"#include <metal_stdlib>\n"
|
|
|
|
"using namespace metal;\n"
|
|
|
|
"constexpr sampler samp(address::repeat);\n"
|
|
|
|
"struct VertToFrag\n"
|
|
|
|
"{\n"
|
|
|
|
" float4 position [[ position ]];\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" float4 color;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
" float2 uv;\n"
|
|
|
|
"};\n"
|
|
|
|
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]], texture2d<float> tex [[ texture(0) ]])\n"
|
|
|
|
"{\n"
|
2015-12-15 21:53:15 +00:00
|
|
|
" return tex.sample(samp, vtf.uv) * vtf.color;\n"
|
2015-11-30 00:21:42 +00:00
|
|
|
"}\n";
|
2015-11-28 04:05:27 +00:00
|
|
|
|
2015-11-30 03:41:53 +00:00
|
|
|
boo::VertexElementDescriptor solidvdescs[] =
|
2015-11-28 04:05:27 +00:00
|
|
|
{
|
|
|
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
2015-12-05 00:42:46 +00:00
|
|
|
{nullptr, nullptr, boo::VertexSemantic::Color}
|
2015-11-28 04:05:27 +00:00
|
|
|
};
|
2015-11-30 03:41:53 +00:00
|
|
|
m_solidVtxFmt = factory->newVertexFormat(2, solidvdescs);
|
2015-11-28 04:05:27 +00:00
|
|
|
|
2015-11-30 00:21:42 +00:00
|
|
|
m_solidShader = factory->newShaderPipeline(SolidVS, SolidFS, m_solidVtxFmt, 1,
|
2015-11-28 04:05:27 +00:00
|
|
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
|
|
|
false, false, false);
|
2015-11-30 00:21:42 +00:00
|
|
|
|
2015-11-30 03:41:53 +00:00
|
|
|
boo::VertexElementDescriptor texvdescs[] =
|
2015-11-30 00:21:42 +00:00
|
|
|
{
|
|
|
|
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
|
|
|
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
|
|
|
};
|
2015-11-30 03:41:53 +00:00
|
|
|
m_texVtxFmt = factory->newVertexFormat(2, texvdescs);
|
2015-11-30 00:21:42 +00:00
|
|
|
|
|
|
|
m_texShader = factory->newShaderPipeline(TexVS, TexFS, m_texVtxFmt, 1,
|
|
|
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
|
|
|
false, false, false);
|
2015-11-28 04:05:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2015-11-27 22:20:22 +00:00
|
|
|
|
2015-12-29 02:02:43 +00:00
|
|
|
void View::buildResources(ViewResources& res)
|
2015-11-26 00:24:01 +00:00
|
|
|
{
|
|
|
|
m_bgVertBuf =
|
2015-12-29 02:02:43 +00:00
|
|
|
res.m_factory->newDynamicBuffer(boo::BufferUse::Vertex,
|
|
|
|
sizeof(SolidShaderVert), 4);
|
2015-11-26 00:24:01 +00:00
|
|
|
|
2015-11-26 07:35:43 +00:00
|
|
|
m_viewVertBlockBuf =
|
2015-12-29 02:02:43 +00:00
|
|
|
res.m_factory->newDynamicBuffer(boo::BufferUse::Uniform,
|
|
|
|
sizeof(ViewBlock), 1);
|
2015-11-26 00:24:01 +00:00
|
|
|
|
2015-12-29 02:02:43 +00:00
|
|
|
if (!res.m_viewRes.m_solidVtxFmt)
|
2015-11-26 00:24:01 +00:00
|
|
|
{
|
|
|
|
boo::VertexElementDescriptor vdescs[] =
|
|
|
|
{
|
2015-11-27 22:20:22 +00:00
|
|
|
{m_bgVertBuf, nullptr, boo::VertexSemantic::Position4},
|
2015-12-05 00:42:46 +00:00
|
|
|
{m_bgVertBuf, nullptr, boo::VertexSemantic::Color}
|
2015-11-26 00:24:01 +00:00
|
|
|
};
|
2015-12-29 02:02:43 +00:00
|
|
|
m_bgVtxFmt = res.m_factory->newVertexFormat(2, vdescs);
|
2015-11-26 00:24:01 +00:00
|
|
|
m_bgShaderBinding =
|
2015-12-29 02:02:43 +00:00
|
|
|
res.m_factory->newShaderDataBinding(res.m_viewRes.m_solidShader, m_bgVtxFmt,
|
|
|
|
m_bgVertBuf, nullptr, nullptr, 1,
|
|
|
|
(boo::IGraphicsBuffer**)&m_viewVertBlockBuf,
|
|
|
|
0, nullptr);
|
2015-11-27 22:20:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_bgShaderBinding =
|
2015-12-29 02:02:43 +00:00
|
|
|
res.m_factory->newShaderDataBinding(res.m_viewRes.m_solidShader, res.m_viewRes.m_solidVtxFmt,
|
|
|
|
m_bgVertBuf, nullptr, nullptr, 1,
|
|
|
|
(boo::IGraphicsBuffer**)&m_viewVertBlockBuf,
|
|
|
|
0, nullptr);
|
2015-11-26 00:24:01 +00:00
|
|
|
}
|
2015-11-29 02:55:30 +00:00
|
|
|
}
|
|
|
|
|
2015-12-29 02:02:43 +00:00
|
|
|
View::View(ViewResources& res)
|
2015-12-03 03:26:50 +00:00
|
|
|
: m_rootView(*static_cast<RootView*>(this)),
|
|
|
|
m_parentView(*static_cast<RootView*>(this))
|
2015-11-29 02:55:30 +00:00
|
|
|
{
|
2015-12-29 02:02:43 +00:00
|
|
|
buildResources(res);
|
2015-11-29 02:55:30 +00:00
|
|
|
}
|
2015-11-26 00:24:01 +00:00
|
|
|
|
2015-12-29 02:02:43 +00:00
|
|
|
View::View(ViewResources& res, View& parentView)
|
2015-12-05 00:42:46 +00:00
|
|
|
: m_rootView(parentView.rootView()),
|
2015-11-29 02:55:30 +00:00
|
|
|
m_parentView(parentView)
|
|
|
|
{
|
2015-12-29 02:02:43 +00:00
|
|
|
buildResources(res);
|
2015-11-29 02:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void View::updateSize()
|
|
|
|
{
|
|
|
|
resized(m_rootView.rootRect(), m_subRect);
|
2015-11-26 00:24:01 +00:00
|
|
|
}
|
|
|
|
|
2015-11-26 23:03:56 +00:00
|
|
|
void View::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
2015-11-26 07:35:43 +00:00
|
|
|
{
|
2015-11-29 02:55:30 +00:00
|
|
|
m_subRect = sub;
|
2015-11-26 23:03:56 +00:00
|
|
|
m_viewVertBlock.setViewRect(root, sub);
|
2015-12-05 00:42:46 +00:00
|
|
|
m_bgRect[0].m_pos.assign(0.f, sub.size[1], 0.f);
|
|
|
|
m_bgRect[1].m_pos.assign(0.f, 0.f, 0.f);
|
|
|
|
m_bgRect[2].m_pos.assign(sub.size[0], sub.size[1], 0.f);
|
|
|
|
m_bgRect[3].m_pos.assign(sub.size[0], 0.f, 0.f);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_viewVertBlockBuf->load(&m_viewVertBlock, sizeof(ViewBlock));
|
2015-12-05 00:42:46 +00:00
|
|
|
m_bgVertBuf->load(m_bgRect, sizeof(SolidShaderVert) * 4);
|
2015-11-26 07:35:43 +00:00
|
|
|
}
|
|
|
|
|
2015-11-26 00:24:01 +00:00
|
|
|
void View::draw(boo::IGraphicsCommandQueue* gfxQ)
|
|
|
|
{
|
2015-11-26 07:35:43 +00:00
|
|
|
gfxQ->setShaderDataBinding(m_bgShaderBinding);
|
2015-11-26 23:03:56 +00:00
|
|
|
gfxQ->setDrawPrimitive(boo::Primitive::TriStrips);
|
2015-11-26 00:24:01 +00:00
|
|
|
gfxQ->draw(0, 4);
|
|
|
|
}
|
|
|
|
|
2015-12-29 02:02:43 +00:00
|
|
|
void View::commitResources(ViewResources& res)
|
2015-11-30 00:21:42 +00:00
|
|
|
{
|
2016-01-07 00:39:18 +00:00
|
|
|
if (m_gfxData)
|
|
|
|
Log.report(LogVisor::FatalError, "multiple resource commits not allowed");
|
2015-12-29 02:02:43 +00:00
|
|
|
m_gfxData = res.m_factory->commit();
|
2015-11-30 00:21:42 +00:00
|
|
|
}
|
|
|
|
|
2015-11-21 23:45:02 +00:00
|
|
|
}
|