2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 21:47:42 +00:00

Merge branch 'shader-refactor'

This commit is contained in:
Jack Andersen
2018-10-15 17:17:37 -10:00
1013 changed files with 10142 additions and 18510 deletions

View File

@@ -1,5 +1,4 @@
#ifndef __URDE_CMODEL_HPP__
#define __URDE_CMODEL_HPP__
#pragma once
#include "RetroTypes.hpp"
#include "zeus/CColor.hpp"
@@ -104,7 +103,7 @@ struct GeometryUniformLayout
struct SShader
{
std::vector<TCachedToken<CTexture>> x0_textures;
std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>> m_shaders;
std::unordered_map<int, CModelShaders::ShaderPipelines> m_shaders;
MaterialSet m_matSet;
std::experimental::optional<GeometryUniformLayout> m_geomLayout;
int m_matSetIdx;
@@ -115,10 +114,10 @@ struct SShader
}
void InitializeLayout(const CModel* model) { m_geomLayout.emplace(model, &m_matSet); }
void UnlockTextures();
std::shared_ptr<hecl::Runtime::ShaderPipelines>
CModelShaders::ShaderPipelines
BuildShader(const hecl::HMDLMeta& meta, const MaterialSet::Material& mat);
void BuildShaders(const hecl::HMDLMeta& meta,
std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>>& shaders);
std::unordered_map<int, CModelShaders::ShaderPipelines>& shaders);
void BuildShaders(const hecl::HMDLMeta& meta) { BuildShaders(meta, m_shaders); }
};
@@ -148,7 +147,7 @@ private:
const MaterialSet* x4_matSet;
const GeometryUniformLayout* m_geomLayout;
int m_matSetIdx = -1;
const std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>>* m_pipelines;
const std::unordered_map<int, CModelShaders::ShaderPipelines>* m_pipelines;
std::vector<TCachedToken<CTexture>> x1c_textures;
zeus::CAABox x20_aabb;
CBooSurface* x38_firstUnsortedSurface = nullptr;
@@ -174,15 +173,12 @@ private:
boo::ObjToken<boo::IGraphicsBufferD> m_geomUniformBuffer;
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBuffer;
std::vector<std::vector<boo::ObjToken<boo::IShaderDataBinding>>> m_shaderDataBindings;
boo::ObjToken<boo::IVertexFormat> m_dynamicVtxFmt;
boo::ObjToken<boo::IGraphicsBufferD> m_dynamicVbo;
boo::ObjToken<boo::IGraphicsBuffer> GetBooVBO(const CBooModel& model, boo::IGraphicsDataFactory::Context& ctx);
boo::ObjToken<boo::IVertexFormat> GetBooVtxFmt(const CBooModel& model, boo::IGraphicsDataFactory::Context& ctx);
};
std::vector<ModelInstance> m_instances;
boo::ObjToken<boo::IVertexFormat> m_staticVtxFmt;
boo::ObjToken<boo::IGraphicsBufferS> m_staticVbo;
boo::ObjToken<boo::IGraphicsBufferS> m_staticIbo;
@@ -210,9 +206,8 @@ private:
public:
~CBooModel();
CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurface>* surfaces, SShader& shader,
const boo::ObjToken<boo::IVertexFormat>& vtxFmt, const boo::ObjToken<boo::IGraphicsBufferS>& vbo,
const boo::ObjToken<boo::IGraphicsBufferS>& ibo, const zeus::CAABox& aabb, u8 renderMask,
int numInsts, const boo::ObjToken<boo::ITexture> txtrOverrides[8]);
const boo::ObjToken<boo::IGraphicsBufferS>& vbo, const boo::ObjToken<boo::IGraphicsBufferS>& ibo,
const zeus::CAABox& aabb, u8 renderMask, int numInsts, const boo::ObjToken<boo::ITexture> txtrOverrides[8]);
static void MakeTexturesFromMats(const MaterialSet& matSet,
std::vector<TCachedToken<CTexture>>& toksOut,
@@ -225,7 +220,7 @@ public:
void DisableAllLights();
void RemapMaterialData(SShader& shader);
void RemapMaterialData(SShader& shader,
const std::unordered_map<int, std::shared_ptr<hecl::Runtime::ShaderPipelines>>& pipelines);
const std::unordered_map<int, CModelShaders::ShaderPipelines>& pipelines);
bool TryLockTextures() const;
void UnlockTextures() const;
void SyncLoadTextures() const;
@@ -296,7 +291,6 @@ class CModel
int x38_lastFrame;
/* urde addition: boo! */
boo::ObjToken<boo::IVertexFormat> m_staticVtxFmt;
boo::ObjToken<boo::IGraphicsBufferS> m_staticVbo;
hecl::HMDLMeta m_hmdlMeta;
std::unique_ptr<uint8_t[]> m_dynamicVertexData;
@@ -339,4 +333,3 @@ CFactoryFnReturn FModelFactory(const urde::SObjectTag& tag,
}
#endif // __URDE_CMODEL_HPP__