2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 12:27:43 +00:00

boo lambda-API refactor

This commit is contained in:
Jack Andersen
2016-03-30 09:16:01 -10:00
parent 6b1c435d0c
commit 77a8ce5f17
21 changed files with 517 additions and 395 deletions

View File

@@ -7,6 +7,8 @@
#include "CToken.hpp"
#include "zeus/CAABox.hpp"
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
namespace urde
{
class IObjectStore;
@@ -25,37 +27,67 @@ struct CModelFlags
*/
};
class CBooSurface
{
};
class CBooModel
{
public:
struct CSurface
/* urde addition: doesn't require hacky stashing of
* pointers within loaded CMDL buffer */
struct CSurfaceView
{
const u8* m_data;
CBooModel* m_parent = nullptr;
CSurface* m_next = nullptr;
CSurfaceView* m_next = nullptr;
};
private:
std::vector<CSurface>* x0_surfaces;
std::vector<CSurfaceView>* x0_surfaces;
const u8* x4_matSet;
const void* x8_vbo;
const void* xc_ibo;
boo::IGraphicsBufferS* x8_vbo;
boo::IGraphicsBufferS* xc_ibo;
std::vector<TLockedToken<CTexture>>* x1c_textures;
zeus::CAABox x20_aabb;
CSurface* x38_firstUnsortedSurface = nullptr;
CSurface* x3c_firstSortedSurface = nullptr;
CSurfaceView* x38_firstUnsortedSurface = nullptr;
CSurfaceView* x3c_firstSortedSurface = nullptr;
bool x40_24_ : 1;
bool x40_25_ : 1;
u8 x41_shortNormals;
/* urde addition: boo! */
boo::GraphicsDataToken m_gfxToken;
boo::IGraphicsBufferD* m_uniformBuffer;
boo::IShaderDataBinding* m_shaderDataBinding;
void DrawAlphaSurfaces(const CModelFlags& flags) const;
void DrawNormalSurfaces(const CModelFlags& flags) const;
void DrawSurfaces(const CModelFlags& flags) const;
void DrawSurface(const CBooSurface& surf, const CModelFlags& flags) const;
public:
CBooModel(std::vector<CSurface>* surfaces, std::vector<TLockedToken<CTexture>>* textures,
const u8* matSet, const void* vbo, const void* ibo, const zeus::CAABox& aabb,
CBooModel(std::vector<CSurfaceView>* surfaces,
std::vector<TLockedToken<CTexture>>* textures,
const u8* matSet,
boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
const zeus::CAABox& aabb,
u8 shortNormals, bool unk);
static void MakeTexuresFromMats(const u8* dataIn,
std::vector<TLockedToken<CTexture>>& toksOut,
IObjectStore& store);
void TryLockTextures() const;
void UnlockTextures() const;
void DrawAlpha(const CModelFlags& flags) const;
void DrawNormal(const CModelFlags& flags) const;
void Draw(const CModelFlags& flags) const;
const u8* GetMaterialByIndex(int idx) const;
static bool g_DrawingOccluders;
static void SetDrawingOccluders(bool occ) {g_DrawingOccluders = occ;}
};
class CModel
@@ -69,11 +101,17 @@ public:
private:
std::unique_ptr<u8[]> x0_data;
u32 x4_dataLen;
std::vector<CBooModel::CSurface> x8_surfaces;
std::vector<CBooModel::CSurfaceView> x8_surfaces;
std::vector<SShader> x18_matSets;
std::unique_ptr<CBooModel> x28_modelInst;
CModel* x30_next = nullptr;
CModel* x34_prev = nullptr;
/* urde addition: boo! */
boo::GraphicsDataToken m_gfxToken;
boo::IGraphicsBufferS* m_vbo;
boo::IGraphicsBufferS* m_ibo;
public:
CModel(std::unique_ptr<u8[]>&& in, u32 dataLen, IObjectStore* store);
void Draw(const CModelFlags& flags) const;