metaforce/specter/include/Specter/View.hpp

68 lines
1.6 KiB
C++
Raw Normal View History

2015-11-21 01:14:49 +00:00
#ifndef SPECTER_VIEW_HPP
#define SPECTER_VIEW_HPP
2015-11-21 23:45:02 +00:00
#include <boo/boo.hpp>
2015-11-25 01:46:30 +00:00
#include "CVector3f.hpp"
#include "CMatrix4f.hpp"
#include "CTransform.hpp"
#include "CColor.hpp"
2015-11-21 23:45:02 +00:00
2015-11-26 00:24:01 +00:00
#include <boo/graphicsdev/GL.hpp>
#include <boo/graphicsdev/D3D.hpp>
#include <boo/graphicsdev/Metal.hpp>
2015-11-21 01:14:49 +00:00
namespace Specter
{
2015-11-26 00:24:01 +00:00
class ViewSystem;
2015-11-21 01:14:49 +00:00
class View
{
2015-11-26 00:24:01 +00:00
boo::IGraphicsBufferD* m_bgVertBuf;
boo::IGraphicsBufferD* m_bgInstBuf;
boo::IVertexFormat* m_bgVtxFmt = nullptr; /* OpenGL only */
boo::IShaderDataBinding* m_bgShaderBinding;
Zeus::CVector3f m_bgRect[4];
Zeus::CColor m_bgColor;
public:
class System
{
friend class ViewSystem;
friend class View;
boo::IShaderPipeline* m_solidShader = nullptr;
boo::IVertexFormat* m_vtxFmt = nullptr; /* Not OpenGL */
void init(boo::GLDataFactory* factory);
#if _WIN32
void init(boo::ID3DDataFactory* factory);
#elif BOO_HAS_METAL
void init(boo::MetalDataFactory* factory);
#endif
};
struct VertexBlock
{
Zeus::CMatrix4f m_mv;
};
#define SPECTER_VIEW_VERT_BLOCK_GLSL\
"uniform SpecterViewBlock\n"\
"{\n"\
" mat4 mv;\n"\
"};\n"
2015-11-25 01:46:30 +00:00
protected:
2015-11-26 00:24:01 +00:00
View(ViewSystem& system);
int m_validDynamicSlots = 0;
boo::IGraphicsBufferD* m_specterVertBlock;
boo::SWindowRect m_absWindowRect;
void bindScissor(boo::IGraphicsCommandQueue* gfxQ) {gfxQ->setScissor(m_absWindowRect);}
2015-11-21 23:45:02 +00:00
public:
2015-11-26 00:24:01 +00:00
void setBackground(Zeus::CColor color) {m_bgColor = color; m_validDynamicSlots = 0;}
virtual void draw(boo::IGraphicsCommandQueue* gfxQ);
2015-11-21 01:14:49 +00:00
};
}
#endif // SPECTER_VIEW_HPP