mirror of https://github.com/AxioDL/metaforce.git
Merge pull request #285 from lioncash/text
Revert "Revert "CTextRenderBuffer: Forward declare structs where applicable"
This commit is contained in:
commit
387e6a5733
|
@ -12,13 +12,37 @@
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
|
||||||
CTextRenderBuffer::CTextRenderBuffer(EMode mode, CGuiWidget::EGuiModelDrawFlags df) : x0_mode(mode), m_drawFlags(df) {}
|
struct CTextRenderBuffer::BooFontCharacters {
|
||||||
|
TLockedToken<CRasterFont> m_font;
|
||||||
|
hecl::VertexBufferPool<CTextSupportShader::CharacterInstance>::Token m_instBuf;
|
||||||
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBinding;
|
||||||
|
boo::ObjToken<boo::IShaderDataBinding> m_dataBinding2;
|
||||||
|
std::vector<CTextSupportShader::CharacterInstance> m_charData;
|
||||||
|
u32 m_charCount = 0;
|
||||||
|
bool m_dirty = true;
|
||||||
|
|
||||||
CTextRenderBuffer::BooImage::BooImage(const CFontImageDef& imgDef, const zeus::CVector2i& offset) : m_imageDef(imgDef) {
|
BooFontCharacters(const CToken& token) : m_font(token) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CTextRenderBuffer::BooImage {
|
||||||
|
CFontImageDef m_imageDef;
|
||||||
|
hecl::VertexBufferPool<CTextSupportShader::ImageInstance>::Token m_instBuf;
|
||||||
|
std::vector<boo::ObjToken<boo::IShaderDataBinding>> m_dataBinding;
|
||||||
|
std::vector<boo::ObjToken<boo::IShaderDataBinding>> m_dataBinding2;
|
||||||
|
CTextSupportShader::ImageInstance m_imageData;
|
||||||
|
bool m_dirty = true;
|
||||||
|
|
||||||
|
BooImage(const CFontImageDef& imgDef, const zeus::CVector2i& offset) : m_imageDef(imgDef) {
|
||||||
m_imageData.SetMetrics(imgDef, offset);
|
m_imageData.SetMetrics(imgDef, offset);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void CTextRenderBuffer::BooPrimitiveMark::SetOpacity(CTextRenderBuffer& rb, float opacity) {
|
struct CTextRenderBuffer::BooPrimitiveMark {
|
||||||
|
Command m_cmd;
|
||||||
|
u32 m_bindIdx;
|
||||||
|
u32 m_instIdx;
|
||||||
|
|
||||||
|
void SetOpacity(CTextRenderBuffer& rb, float opacity) {
|
||||||
switch (m_cmd) {
|
switch (m_cmd) {
|
||||||
case Command::CharacterRender: {
|
case Command::CharacterRender: {
|
||||||
BooFontCharacters& fc = rb.m_fontCharacters[m_bindIdx];
|
BooFontCharacters& fc = rb.m_fontCharacters[m_bindIdx];
|
||||||
|
@ -37,6 +61,15 @@ void CTextRenderBuffer::BooPrimitiveMark::SetOpacity(CTextRenderBuffer& rb, floa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CTextRenderBuffer::CTextRenderBuffer(CTextRenderBuffer&&) noexcept = default;
|
||||||
|
|
||||||
|
CTextRenderBuffer::CTextRenderBuffer(EMode mode, CGuiWidget::EGuiModelDrawFlags df) : x0_mode(mode), m_drawFlags(df) {}
|
||||||
|
|
||||||
|
CTextRenderBuffer::~CTextRenderBuffer() = default;
|
||||||
|
|
||||||
|
CTextRenderBuffer& CTextRenderBuffer::operator=(CTextRenderBuffer&&) noexcept = default;
|
||||||
|
|
||||||
void CTextRenderBuffer::CommitResources() {
|
void CTextRenderBuffer::CommitResources() {
|
||||||
if (m_committed)
|
if (m_committed)
|
||||||
|
@ -125,6 +158,8 @@ void CTextRenderBuffer::SetPrimitiveOpacity(int idx, float opacity) {
|
||||||
m_primitiveMarks[idx].SetOpacity(*this, opacity);
|
m_primitiveMarks[idx].SetOpacity(*this, opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 CTextRenderBuffer::GetPrimitiveCount() const { return m_primitiveMarks.size(); }
|
||||||
|
|
||||||
void CTextRenderBuffer::Render(const zeus::CColor& col, float time) const {
|
void CTextRenderBuffer::Render(const zeus::CColor& col, float time) const {
|
||||||
const_cast<CTextRenderBuffer*>(this)->CommitResources();
|
const_cast<CTextRenderBuffer*>(this)->CommitResources();
|
||||||
|
|
||||||
|
|
|
@ -65,35 +65,13 @@ private:
|
||||||
hecl::UniformBufferPool<CTextSupportShader::Uniform>::Token m_uniBuf;
|
hecl::UniformBufferPool<CTextSupportShader::Uniform>::Token m_uniBuf;
|
||||||
hecl::UniformBufferPool<CTextSupportShader::Uniform>::Token m_uniBuf2;
|
hecl::UniformBufferPool<CTextSupportShader::Uniform>::Token m_uniBuf2;
|
||||||
|
|
||||||
struct BooFontCharacters {
|
struct BooFontCharacters;
|
||||||
TLockedToken<CRasterFont> m_font;
|
|
||||||
hecl::VertexBufferPool<CTextSupportShader::CharacterInstance>::Token m_instBuf;
|
|
||||||
boo::ObjToken<boo::IShaderDataBinding> m_dataBinding;
|
|
||||||
boo::ObjToken<boo::IShaderDataBinding> m_dataBinding2;
|
|
||||||
std::vector<CTextSupportShader::CharacterInstance> m_charData;
|
|
||||||
u32 m_charCount = 0;
|
|
||||||
bool m_dirty = true;
|
|
||||||
BooFontCharacters(const CToken& token) : m_font(token) {}
|
|
||||||
};
|
|
||||||
std::vector<BooFontCharacters> m_fontCharacters;
|
std::vector<BooFontCharacters> m_fontCharacters;
|
||||||
|
|
||||||
struct BooImage {
|
struct BooImage;
|
||||||
CFontImageDef m_imageDef;
|
|
||||||
hecl::VertexBufferPool<CTextSupportShader::ImageInstance>::Token m_instBuf;
|
|
||||||
std::vector<boo::ObjToken<boo::IShaderDataBinding>> m_dataBinding;
|
|
||||||
std::vector<boo::ObjToken<boo::IShaderDataBinding>> m_dataBinding2;
|
|
||||||
CTextSupportShader::ImageInstance m_imageData;
|
|
||||||
bool m_dirty = true;
|
|
||||||
BooImage(const CFontImageDef& imgDef, const zeus::CVector2i& offset);
|
|
||||||
};
|
|
||||||
std::vector<BooImage> m_images;
|
std::vector<BooImage> m_images;
|
||||||
|
|
||||||
struct BooPrimitiveMark {
|
struct BooPrimitiveMark;
|
||||||
Command m_cmd;
|
|
||||||
u32 m_bindIdx;
|
|
||||||
u32 m_instIdx;
|
|
||||||
void SetOpacity(CTextRenderBuffer& rb, float opacity);
|
|
||||||
};
|
|
||||||
std::vector<BooPrimitiveMark> m_primitiveMarks;
|
std::vector<BooPrimitiveMark> m_primitiveMarks;
|
||||||
u32 m_imagesCount = 0;
|
u32 m_imagesCount = 0;
|
||||||
u32 m_activeFontCh = UINT32_MAX;
|
u32 m_activeFontCh = UINT32_MAX;
|
||||||
|
@ -108,7 +86,12 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
CTextRenderBuffer(CTextRenderBuffer&& other) noexcept;
|
||||||
CTextRenderBuffer(EMode mode, CGuiWidget::EGuiModelDrawFlags df);
|
CTextRenderBuffer(EMode mode, CGuiWidget::EGuiModelDrawFlags df);
|
||||||
|
~CTextRenderBuffer();
|
||||||
|
|
||||||
|
CTextRenderBuffer& operator=(CTextRenderBuffer&& other) noexcept;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void SetPrimitive(const Primitive&, int);
|
void SetPrimitive(const Primitive&, int);
|
||||||
Primitive GetPrimitive(int) const;
|
Primitive GetPrimitive(int) const;
|
||||||
|
@ -119,7 +102,7 @@ public:
|
||||||
void AddPaletteChange(const CGraphicsPalette& palette);
|
void AddPaletteChange(const CGraphicsPalette& palette);
|
||||||
#else
|
#else
|
||||||
void SetPrimitiveOpacity(int idx, float opacity);
|
void SetPrimitiveOpacity(int idx, float opacity);
|
||||||
u32 GetPrimitiveCount() const { return m_primitiveMarks.size(); }
|
u32 GetPrimitiveCount() const;
|
||||||
#endif
|
#endif
|
||||||
void SetMode(EMode mode);
|
void SetMode(EMode mode);
|
||||||
void Render(const zeus::CColor& col, float) const;
|
void Render(const zeus::CColor& col, float) const;
|
||||||
|
|
Loading…
Reference in New Issue