2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-02-13 00:57:09 +00:00
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
2016-03-04 23:04:53 +00:00
|
|
|
#include "zeus/CColor.hpp"
|
2016-03-29 23:14:14 +00:00
|
|
|
#include "CFactoryMgr.hpp"
|
|
|
|
#include "CToken.hpp"
|
|
|
|
#include "zeus/CAABox.hpp"
|
2016-03-31 02:44:43 +00:00
|
|
|
#include "DNACommon/CMDL.hpp"
|
|
|
|
#include "DNAMP1/CMDLMaterials.hpp"
|
2016-07-21 05:21:45 +00:00
|
|
|
#include "Shaders/CModelShaders.hpp"
|
2017-12-29 08:08:12 +00:00
|
|
|
#include "hecl/HMDLMeta.hpp"
|
2016-03-30 19:16:01 +00:00
|
|
|
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2016-02-13 00:57:09 +00:00
|
|
|
{
|
2016-03-29 23:14:14 +00:00
|
|
|
class IObjectStore;
|
|
|
|
class CTexture;
|
2016-04-04 02:32:57 +00:00
|
|
|
class CLight;
|
2016-08-21 20:39:18 +00:00
|
|
|
class CSkinRules;
|
|
|
|
class CPoseAsTransforms;
|
2016-09-02 19:32:57 +00:00
|
|
|
class CModel;
|
2016-02-13 00:57:09 +00:00
|
|
|
|
|
|
|
struct CModelFlags
|
|
|
|
{
|
2017-05-06 05:21:42 +00:00
|
|
|
u8 x0_blendMode = 0; /* >6: additive, >4: blend, else opaque */
|
2017-03-20 05:09:53 +00:00
|
|
|
u8 x1_matSetIdx = 0;
|
2018-02-09 07:12:26 +00:00
|
|
|
EExtendedShader m_extendedShader = EExtendedShader::Lighting;
|
2017-12-21 03:19:54 +00:00
|
|
|
bool m_noCull = false;
|
2018-01-06 06:50:42 +00:00
|
|
|
bool m_noZWrite = false;
|
2017-03-20 05:09:53 +00:00
|
|
|
u16 x2_flags = 0; /* Flags */
|
|
|
|
zeus::CColor x4_color; /* Set into kcolor slot specified by material */
|
2016-07-31 04:46:03 +00:00
|
|
|
zeus::CColor addColor = zeus::CColor::skClear;
|
2017-03-06 06:33:51 +00:00
|
|
|
zeus::CAABox mbShadowBox;
|
2016-03-17 02:18:01 +00:00
|
|
|
|
2016-04-03 05:25:34 +00:00
|
|
|
CModelFlags() = default;
|
|
|
|
CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)
|
2018-02-09 07:12:26 +00:00
|
|
|
: x0_blendMode(blendMode), x1_matSetIdx(shadIdx),
|
2017-12-21 03:19:54 +00:00
|
|
|
x2_flags(flags), x4_color(col)
|
2017-05-30 03:45:31 +00:00
|
|
|
{
|
2017-12-21 03:19:54 +00:00
|
|
|
/* Blend mode will override this if the surface's original material is opaque */
|
2017-05-30 03:45:31 +00:00
|
|
|
}
|
2016-04-03 05:25:34 +00:00
|
|
|
|
2016-03-31 06:18:56 +00:00
|
|
|
/* Flags
|
2017-05-06 05:21:42 +00:00
|
|
|
0x1: depth equal
|
|
|
|
0x2: depth update
|
2016-03-31 02:44:43 +00:00
|
|
|
0x4: render without texture lock
|
2016-03-31 06:18:56 +00:00
|
|
|
0x8: depth greater
|
|
|
|
0x10: depth non-inclusive
|
2016-03-17 02:18:01 +00:00
|
|
|
*/
|
2018-02-08 06:18:27 +00:00
|
|
|
|
|
|
|
bool operator==(const CModelFlags& other) const
|
|
|
|
{
|
|
|
|
return x0_blendMode == other.x0_blendMode && x1_matSetIdx == other.x1_matSetIdx &&
|
|
|
|
x2_flags == other.x2_flags && x4_color == other.x4_color;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const CModelFlags& other) const
|
|
|
|
{
|
|
|
|
return x0_blendMode != other.x0_blendMode || x1_matSetIdx != other.x1_matSetIdx ||
|
|
|
|
x2_flags != other.x2_flags || x4_color != other.x4_color;
|
|
|
|
}
|
2016-02-13 00:57:09 +00:00
|
|
|
};
|
|
|
|
|
2016-03-31 02:44:43 +00:00
|
|
|
/* urde addition: doesn't require hacky stashing of
|
|
|
|
* pointers within loaded CMDL buffer */
|
|
|
|
struct CBooSurface
|
2016-03-30 19:16:01 +00:00
|
|
|
{
|
2016-04-04 02:32:57 +00:00
|
|
|
DataSpec::DNACMDL::SurfaceHeader_2 m_data;
|
|
|
|
size_t selfIdx;
|
2016-03-31 02:44:43 +00:00
|
|
|
class CBooModel* m_parent = nullptr;
|
|
|
|
CBooSurface* m_next = nullptr;
|
2016-07-26 22:05:59 +00:00
|
|
|
|
|
|
|
zeus::CAABox GetBounds() const
|
|
|
|
{
|
|
|
|
if (!m_data.aabbSz)
|
|
|
|
return zeus::CAABox(m_data.centroid, m_data.centroid);
|
|
|
|
else
|
|
|
|
return zeus::CAABox(m_data.aabb[0], m_data.aabb[1]);
|
|
|
|
}
|
2016-03-30 19:16:01 +00:00
|
|
|
};
|
|
|
|
|
2017-11-19 23:48:09 +00:00
|
|
|
using MaterialSet = DataSpec::DNAMP1::HMDLMaterialSet;
|
|
|
|
using UVAnimation = DataSpec::DNAMP1::MaterialSet::Material::UVAnimation;
|
|
|
|
|
|
|
|
struct GeometryUniformLayout
|
|
|
|
{
|
2018-01-15 07:39:25 +00:00
|
|
|
boo::ObjToken<boo::IGraphicsBufferD> m_sharedBuffer[2];
|
2017-11-19 23:48:09 +00:00
|
|
|
size_t m_geomBufferSize = 0;
|
|
|
|
size_t m_skinBankCount = 0;
|
|
|
|
size_t m_weightVecCount = 0;
|
|
|
|
|
|
|
|
std::vector<size_t> m_skinOffs;
|
|
|
|
std::vector<size_t> m_skinSizes;
|
|
|
|
|
|
|
|
std::vector<size_t> m_uvOffs;
|
|
|
|
std::vector<size_t> m_uvSizes;
|
|
|
|
|
|
|
|
GeometryUniformLayout(const CModel* model, const MaterialSet* matSet);
|
|
|
|
void Update(const CModelFlags& flags, const CSkinRules* cskr, const CPoseAsTransforms* pose,
|
2018-11-08 00:53:38 +00:00
|
|
|
const MaterialSet* matSet, const boo::ObjToken<boo::IGraphicsBufferD>& buf,
|
|
|
|
const CBooModel* parent) const;
|
2017-11-19 23:48:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SShader
|
|
|
|
{
|
|
|
|
std::vector<TCachedToken<CTexture>> x0_textures;
|
2018-10-07 02:59:17 +00:00
|
|
|
std::unordered_map<int, CModelShaders::ShaderPipelines> m_shaders;
|
2017-11-19 23:48:09 +00:00
|
|
|
MaterialSet m_matSet;
|
|
|
|
std::experimental::optional<GeometryUniformLayout> m_geomLayout;
|
|
|
|
int m_matSetIdx;
|
2018-10-11 22:57:05 +00:00
|
|
|
SShader(int idx) : m_matSetIdx(idx)
|
|
|
|
{
|
|
|
|
x0_textures.clear();
|
|
|
|
m_shaders.clear();
|
|
|
|
}
|
2017-11-19 23:48:09 +00:00
|
|
|
void InitializeLayout(const CModel* model) { m_geomLayout.emplace(model, &m_matSet); }
|
|
|
|
void UnlockTextures();
|
2018-10-07 02:59:17 +00:00
|
|
|
CModelShaders::ShaderPipelines
|
2017-11-19 23:48:09 +00:00
|
|
|
BuildShader(const hecl::HMDLMeta& meta, const MaterialSet::Material& mat);
|
|
|
|
void BuildShaders(const hecl::HMDLMeta& meta,
|
2018-10-07 02:59:17 +00:00
|
|
|
std::unordered_map<int, CModelShaders::ShaderPipelines>& shaders);
|
2017-11-19 23:48:09 +00:00
|
|
|
void BuildShaders(const hecl::HMDLMeta& meta) { BuildShaders(meta, m_shaders); }
|
|
|
|
};
|
|
|
|
|
2016-03-29 23:14:14 +00:00
|
|
|
class CBooModel
|
|
|
|
{
|
2016-03-31 06:18:56 +00:00
|
|
|
friend class CModel;
|
2017-10-17 05:51:53 +00:00
|
|
|
friend class CGameArea;
|
2016-07-25 22:52:02 +00:00
|
|
|
friend class CBooRenderer;
|
2016-08-03 21:53:03 +00:00
|
|
|
friend class CMetroidModelInstance;
|
2016-08-21 20:39:18 +00:00
|
|
|
friend class CSkinnedModel;
|
2017-11-19 23:48:09 +00:00
|
|
|
friend struct GeometryUniformLayout;
|
2016-03-29 23:14:14 +00:00
|
|
|
public:
|
2017-05-06 05:21:42 +00:00
|
|
|
enum class ESurfaceSelection
|
|
|
|
{
|
|
|
|
UnsortedOnly,
|
|
|
|
SortedOnly,
|
|
|
|
All
|
|
|
|
};
|
|
|
|
|
2016-03-29 23:14:14 +00:00
|
|
|
private:
|
2016-09-09 04:19:19 +00:00
|
|
|
CBooModel* m_next = nullptr;
|
|
|
|
CBooModel* m_prev = nullptr;
|
2018-01-16 06:42:28 +00:00
|
|
|
int m_uniUpdateCount = 0;
|
2017-10-22 06:11:22 +00:00
|
|
|
TToken<CModel> m_modelTok;
|
|
|
|
CModel* m_model;
|
2016-03-31 02:44:43 +00:00
|
|
|
std::vector<CBooSurface>* x0_surfaces;
|
2016-03-31 06:18:56 +00:00
|
|
|
const MaterialSet* x4_matSet;
|
2017-11-19 23:48:09 +00:00
|
|
|
const GeometryUniformLayout* m_geomLayout;
|
2016-09-02 19:32:57 +00:00
|
|
|
int m_matSetIdx = -1;
|
2018-10-07 02:59:17 +00:00
|
|
|
const std::unordered_map<int, CModelShaders::ShaderPipelines>* m_pipelines;
|
2016-09-02 19:32:57 +00:00
|
|
|
std::vector<TCachedToken<CTexture>> x1c_textures;
|
2016-03-29 23:14:14 +00:00
|
|
|
zeus::CAABox x20_aabb;
|
2016-03-31 02:44:43 +00:00
|
|
|
CBooSurface* x38_firstUnsortedSurface = nullptr;
|
|
|
|
CBooSurface* x3c_firstSortedSurface = nullptr;
|
|
|
|
bool x40_24_texturesLoaded : 1;
|
2016-07-27 23:06:57 +00:00
|
|
|
bool x40_25_modelVisible : 1;
|
2017-04-18 23:41:01 +00:00
|
|
|
u8 x41_mask;
|
2017-03-07 05:36:02 +00:00
|
|
|
u32 x44_areaInstanceIdx = -1;
|
2016-03-30 19:16:01 +00:00
|
|
|
|
2016-03-31 06:18:56 +00:00
|
|
|
struct UVAnimationBuffer
|
|
|
|
{
|
2016-04-04 02:32:57 +00:00
|
|
|
static void ProcessAnimation(u8*& bufOut, const UVAnimation& anim);
|
|
|
|
static void PadOutBuffer(u8*& bufStart, u8*& bufOut);
|
2018-11-08 00:53:38 +00:00
|
|
|
static void Update(u8*& bufOut, const MaterialSet* matSet,
|
|
|
|
const CModelFlags& flags, const CBooModel* parent);
|
2016-04-04 02:32:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
CModelShaders::LightingUniform m_lightingData;
|
2016-03-31 06:18:56 +00:00
|
|
|
|
2016-03-30 19:16:01 +00:00
|
|
|
/* urde addition: boo! */
|
2016-04-04 02:32:57 +00:00
|
|
|
size_t m_uniformDataSize = 0;
|
2016-09-09 04:19:19 +00:00
|
|
|
struct ModelInstance
|
|
|
|
{
|
2017-11-19 23:48:09 +00:00
|
|
|
boo::ObjToken<boo::IGraphicsBufferD> m_geomUniformBuffer;
|
2017-11-05 06:17:12 +00:00
|
|
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBuffer;
|
|
|
|
std::vector<std::vector<boo::ObjToken<boo::IShaderDataBinding>>> m_shaderDataBindings;
|
|
|
|
boo::ObjToken<boo::IGraphicsBufferD> m_dynamicVbo;
|
|
|
|
|
|
|
|
boo::ObjToken<boo::IGraphicsBuffer> GetBooVBO(const CBooModel& model, boo::IGraphicsDataFactory::Context& ctx);
|
2016-09-09 04:19:19 +00:00
|
|
|
};
|
|
|
|
std::vector<ModelInstance> m_instances;
|
2016-03-30 19:16:01 +00:00
|
|
|
|
2017-11-05 06:17:12 +00:00
|
|
|
boo::ObjToken<boo::IGraphicsBufferS> m_staticVbo;
|
|
|
|
boo::ObjToken<boo::IGraphicsBufferS> m_staticIbo;
|
2017-08-21 05:46:59 +00:00
|
|
|
|
2017-11-05 06:17:12 +00:00
|
|
|
boo::ObjToken<boo::ITexture> m_txtrOverrides[8];
|
2017-05-31 02:51:38 +00:00
|
|
|
|
2017-11-05 06:17:12 +00:00
|
|
|
boo::ObjToken<boo::ITexture> m_lastDrawnShadowMap;
|
2018-11-08 00:53:38 +00:00
|
|
|
boo::ObjToken<boo::ITexture> m_lastDrawnOneTexture;
|
2017-10-01 04:26:46 +00:00
|
|
|
|
2018-01-15 07:39:25 +00:00
|
|
|
ModelInstance* PushNewModelInstance(int sharedLayoutBuf = -1);
|
2016-03-30 19:16:01 +00:00
|
|
|
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;
|
2017-10-17 05:51:53 +00:00
|
|
|
void WarmupDrawSurfaces() const;
|
|
|
|
void WarmupDrawSurface(const CBooSurface& surf) const;
|
2016-03-30 19:16:01 +00:00
|
|
|
|
2017-03-03 07:18:12 +00:00
|
|
|
static zeus::CVector3f g_PlayerPosition;
|
|
|
|
static float g_ModSeconds;
|
|
|
|
static float g_TransformedTime;
|
|
|
|
static float g_TransformedTime2;
|
|
|
|
static CBooModel* g_LastModelCached;
|
|
|
|
|
2017-10-22 06:11:22 +00:00
|
|
|
static bool g_DummyTextures;
|
2018-04-26 21:12:20 +00:00
|
|
|
static bool g_RenderModelBlack;
|
2017-10-22 06:11:22 +00:00
|
|
|
|
2016-03-29 23:14:14 +00:00
|
|
|
public:
|
2016-09-09 04:19:19 +00:00
|
|
|
~CBooModel();
|
2017-10-22 06:11:22 +00:00
|
|
|
CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurface>* surfaces, SShader& shader,
|
2018-10-07 02:59:17 +00:00
|
|
|
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]);
|
2016-03-29 23:14:14 +00:00
|
|
|
|
2017-03-03 07:18:12 +00:00
|
|
|
static void MakeTexturesFromMats(const MaterialSet& matSet,
|
|
|
|
std::vector<TCachedToken<CTexture>>& toksOut,
|
|
|
|
IObjectStore& store);
|
|
|
|
void MakeTexturesFromMats(std::vector<TCachedToken<CTexture>>& toksOut,
|
|
|
|
IObjectStore& store);
|
2016-03-29 23:14:14 +00:00
|
|
|
|
2016-04-14 21:42:47 +00:00
|
|
|
bool IsOpaque() const {return x3c_firstSortedSurface == nullptr;}
|
2016-04-04 02:32:57 +00:00
|
|
|
void ActivateLights(const std::vector<CLight>& lights);
|
2017-05-06 05:21:42 +00:00
|
|
|
void DisableAllLights();
|
2016-03-31 02:44:43 +00:00
|
|
|
void RemapMaterialData(SShader& shader);
|
2017-10-22 06:11:22 +00:00
|
|
|
void RemapMaterialData(SShader& shader,
|
2018-10-07 02:59:17 +00:00
|
|
|
const std::unordered_map<int, CModelShaders::ShaderPipelines>& pipelines);
|
2016-03-31 02:44:43 +00:00
|
|
|
bool TryLockTextures() const;
|
2016-03-30 19:16:01 +00:00
|
|
|
void UnlockTextures() const;
|
2017-10-17 05:51:53 +00:00
|
|
|
void SyncLoadTextures() const;
|
2016-09-02 19:32:57 +00:00
|
|
|
void Touch(int shaderIdx) const;
|
2017-03-05 07:57:12 +00:00
|
|
|
void VerifyCurrentShader(int shaderIdx);
|
2017-11-05 06:17:12 +00:00
|
|
|
boo::ObjToken<boo::IGraphicsBufferD> UpdateUniformData(const CModelFlags& flags,
|
|
|
|
const CSkinRules* cskr,
|
2018-01-15 07:39:25 +00:00
|
|
|
const CPoseAsTransforms* pose,
|
|
|
|
int sharedLayoutBuf = -1) const;
|
2016-08-21 20:39:18 +00:00
|
|
|
void DrawAlpha(const CModelFlags& flags,
|
|
|
|
const CSkinRules* cskr,
|
|
|
|
const CPoseAsTransforms* pose) const;
|
|
|
|
void DrawNormal(const CModelFlags& flags,
|
|
|
|
const CSkinRules* cskr,
|
|
|
|
const CPoseAsTransforms* pose) const;
|
|
|
|
void Draw(const CModelFlags& flags,
|
|
|
|
const CSkinRules* cskr,
|
|
|
|
const CPoseAsTransforms* pose) const;
|
2017-05-06 05:21:42 +00:00
|
|
|
void DrawFlat(ESurfaceSelection sel, EExtendedShader extendedIdx) const;
|
|
|
|
|
2017-10-22 06:11:22 +00:00
|
|
|
void LockParent() { m_modelTok.Lock(); }
|
|
|
|
void UnlockParent() { m_modelTok.Unlock(); }
|
|
|
|
|
2016-03-30 19:16:01 +00:00
|
|
|
|
2016-03-31 06:18:56 +00:00
|
|
|
const MaterialSet::Material& GetMaterialByIndex(int idx) const
|
2016-03-31 02:44:43 +00:00
|
|
|
{
|
|
|
|
return x4_matSet->materials.at(idx);
|
|
|
|
}
|
2016-03-30 19:16:01 +00:00
|
|
|
|
2016-09-09 04:19:19 +00:00
|
|
|
void ClearUniformCounter() { m_uniUpdateCount = 0; }
|
|
|
|
static void ClearModelUniformCounters();
|
|
|
|
|
2016-03-30 19:16:01 +00:00
|
|
|
static bool g_DrawingOccluders;
|
|
|
|
static void SetDrawingOccluders(bool occ) {g_DrawingOccluders = occ;}
|
2017-03-03 07:18:12 +00:00
|
|
|
|
|
|
|
static void SetNewPlayerPositionAndTime(const zeus::CVector3f& pos);
|
2017-03-05 07:57:12 +00:00
|
|
|
|
2017-03-26 05:53:04 +00:00
|
|
|
static zeus::CVector3f g_ReflectViewPos;
|
|
|
|
static void KillCachedViewDepState();
|
|
|
|
static void EnsureViewDepStateCached(const CBooModel& model, const CBooSurface* surf,
|
2017-04-15 05:32:25 +00:00
|
|
|
zeus::CMatrix4f* mtxsOut, float& alphaOut);
|
2017-10-01 04:26:46 +00:00
|
|
|
|
2017-11-05 06:17:12 +00:00
|
|
|
static boo::ObjToken<boo::ITexture> g_shadowMap;
|
2017-10-01 04:26:46 +00:00
|
|
|
static zeus::CTransform g_shadowTexXf;
|
2017-11-05 06:17:12 +00:00
|
|
|
static void EnableShadowMaps(const boo::ObjToken<boo::ITexture>& map, const zeus::CTransform& texXf);
|
2017-10-17 05:51:53 +00:00
|
|
|
static void DisableShadowMaps();
|
2017-10-22 06:11:22 +00:00
|
|
|
|
2018-11-08 00:53:38 +00:00
|
|
|
static boo::ObjToken<boo::ITexture> g_disintegrateTexture;
|
|
|
|
static void SetDisintegrateTexture(const boo::ObjToken<boo::ITexture>& map) { g_disintegrateTexture = map; }
|
|
|
|
|
2017-11-19 23:48:09 +00:00
|
|
|
static void SetDummyTextures(bool b) { g_DummyTextures = b; }
|
2018-04-26 21:12:20 +00:00
|
|
|
static void SetRenderModelBlack(bool b) { g_RenderModelBlack = b; }
|
2018-05-20 06:14:57 +00:00
|
|
|
|
|
|
|
static void AssertAllFreed();
|
2018-11-08 00:53:38 +00:00
|
|
|
|
|
|
|
const zeus::CAABox& GetAABB() const { return x20_aabb; }
|
2016-03-29 23:14:14 +00:00
|
|
|
};
|
|
|
|
|
2016-02-13 00:57:09 +00:00
|
|
|
class CModel
|
|
|
|
{
|
2016-09-02 19:32:57 +00:00
|
|
|
friend class CBooModel;
|
2017-11-19 23:48:09 +00:00
|
|
|
friend struct GeometryUniformLayout;
|
2016-04-05 01:51:25 +00:00
|
|
|
//std::unique_ptr<u8[]> x0_data;
|
|
|
|
//u32 x4_dataLen;
|
2016-09-02 19:32:57 +00:00
|
|
|
TToken<CModel> m_selfToken; /* DO NOT LOCK! */
|
2016-04-05 01:51:25 +00:00
|
|
|
zeus::CAABox m_aabb;
|
2017-04-18 23:41:01 +00:00
|
|
|
u32 m_flags;
|
2016-03-31 02:44:43 +00:00
|
|
|
std::vector<CBooSurface> x8_surfaces;
|
2017-11-19 23:48:09 +00:00
|
|
|
std::vector<SShader> x18_matSets;
|
2016-03-29 23:14:14 +00:00
|
|
|
std::unique_ptr<CBooModel> x28_modelInst;
|
2018-05-20 06:14:57 +00:00
|
|
|
//CModel* x30_next = nullptr;
|
|
|
|
//CModel* x34_prev = nullptr;
|
2017-03-10 03:40:24 +00:00
|
|
|
int x38_lastFrame;
|
2016-03-30 19:16:01 +00:00
|
|
|
|
|
|
|
/* urde addition: boo! */
|
2017-11-05 06:17:12 +00:00
|
|
|
boo::ObjToken<boo::IGraphicsBufferS> m_staticVbo;
|
2017-08-21 05:46:59 +00:00
|
|
|
hecl::HMDLMeta m_hmdlMeta;
|
|
|
|
std::unique_ptr<uint8_t[]> m_dynamicVertexData;
|
2017-11-05 06:17:12 +00:00
|
|
|
boo::ObjToken<boo::IGraphicsBufferS> m_ibo;
|
2016-09-04 22:47:48 +00:00
|
|
|
|
2016-03-29 23:14:14 +00:00
|
|
|
public:
|
2016-03-31 06:18:56 +00:00
|
|
|
using MaterialSet = DataSpec::DNAMP1::HMDLMaterialSet;
|
|
|
|
|
2016-09-02 19:32:57 +00:00
|
|
|
CModel(std::unique_ptr<u8[]>&& in, u32 dataLen, IObjectStore* store, CObjectReference* selfRef);
|
2016-03-31 02:44:43 +00:00
|
|
|
void DrawSortedParts(const CModelFlags& flags) const;
|
|
|
|
void DrawUnsortedParts(const CModelFlags& flags) const;
|
2016-02-13 00:57:09 +00:00
|
|
|
void Draw(const CModelFlags& flags) const;
|
2016-03-31 02:44:43 +00:00
|
|
|
bool IsLoaded(int shaderIdx) const;
|
2017-05-06 05:21:42 +00:00
|
|
|
void Touch(int shaderIdx) { x28_modelInst->Touch(shaderIdx); }
|
2016-04-04 05:02:09 +00:00
|
|
|
|
2016-04-14 21:42:47 +00:00
|
|
|
const zeus::CAABox& GetAABB() const {return m_aabb;}
|
2016-04-04 05:02:09 +00:00
|
|
|
CBooModel& GetInstance() {return *x28_modelInst;}
|
2016-04-14 21:42:47 +00:00
|
|
|
const CBooModel& GetInstance() const {return *x28_modelInst;}
|
2017-10-22 06:11:22 +00:00
|
|
|
std::unique_ptr<CBooModel> MakeNewInstance(int shaderIdx, int subInsts,
|
2017-11-05 06:17:12 +00:00
|
|
|
const boo::ObjToken<boo::ITexture> txtrOverrides[8] = nullptr,
|
2017-10-22 06:11:22 +00:00
|
|
|
bool lockParent = true);
|
2017-03-10 03:40:24 +00:00
|
|
|
void UpdateLastFrame() const { const_cast<CModel&>(*this).x38_lastFrame = CGraphics::GetFrameCounter(); }
|
2017-08-21 05:46:59 +00:00
|
|
|
|
|
|
|
size_t GetPoolVertexOffset(size_t idx) const;
|
|
|
|
zeus::CVector3f GetPoolVertex(size_t idx) const;
|
|
|
|
size_t GetPoolNormalOffset(size_t idx) const;
|
|
|
|
zeus::CVector3f GetPoolNormal(size_t idx) const;
|
2017-11-05 06:17:12 +00:00
|
|
|
void ApplyVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf,
|
2017-08-21 05:46:59 +00:00
|
|
|
const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn) const;
|
2018-05-10 07:25:26 +00:00
|
|
|
void RestoreVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf) const;
|
2017-10-17 05:51:53 +00:00
|
|
|
|
|
|
|
void _WarmupShaders();
|
|
|
|
static void WarmupShaders(const SObjectTag& cmdlTag);
|
2016-02-13 00:57:09 +00:00
|
|
|
};
|
|
|
|
|
2016-03-29 23:14:14 +00:00
|
|
|
CFactoryFnReturn FModelFactory(const urde::SObjectTag& tag,
|
|
|
|
std::unique_ptr<u8[]>&& in, u32 len,
|
2016-09-02 19:32:57 +00:00
|
|
|
const urde::CVParamTransfer& vparms,
|
|
|
|
CObjectReference* selfRef);
|
2016-03-29 23:14:14 +00:00
|
|
|
|
2016-02-13 00:57:09 +00:00
|
|
|
}
|
|
|
|
|