#include "hecl/HMDLMeta.hpp" #include "hecl/Runtime.hpp" #include namespace hecl { namespace Runtime { static logvisor::Module Log("HMDL"); HMDLData::HMDLData(boo::IGraphicsDataFactory::Context& ctx, const void* metaData, const void* vbo, const void* ibo) { HMDLMeta meta; { athena::io::MemoryReader r((atUint8*)metaData, HECL_HMDL_META_SZ); meta.read(r); } if (meta.magic != 'TACO') Log.report(logvisor::Fatal, "invalid HMDL magic"); m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, vbo, meta.vertStride, meta.vertCount); m_ibo = ctx.newStaticBuffer(boo::BufferUse::Index, ibo, 4, meta.indexCount); if (ctx.bindingNeedsVertexFormat()) m_vtxFmt = NewVertexFormat(ctx, meta, m_vbo, m_ibo); } /* For binding constructors that require vertex format up front (GLSL) */ boo::IVertexFormat* HMDLData::NewVertexFormat(boo::IGraphicsDataFactory::Context& ctx, const HMDLMeta& meta, boo::IGraphicsBuffer* vbo, boo::IGraphicsBuffer* ibo) { size_t elemCount = 2 + meta.colorCount + meta.uvCount + meta.weightCount; std::unique_ptr vdescs(new boo::VertexElementDescriptor[elemCount]); for (size_t i=0 ; i vdescs(new boo::VertexElementDescriptor[elemCount]); for (size_t i=0 ; i