mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-18 13:25:25 +00:00
Added HMDL outputting from blender intermediate
This commit is contained in:
@@ -7,6 +7,7 @@ if(WIN32)
|
||||
list(APPEND PLAT_SRCS winsupport.cpp ../include/HECL/winsupport.hpp)
|
||||
endif()
|
||||
|
||||
atdna(atdna_HMDLMeta.cpp ../include/HECL/HMDLMeta.hpp)
|
||||
atdna(atdna_Frontend.cpp ../include/HECL/Frontend.hpp)
|
||||
atdna(atdna_Runtime.cpp ../include/HECL/Runtime.hpp)
|
||||
|
||||
@@ -15,6 +16,7 @@ add_library(HECLCommon
|
||||
ProjectPath.cpp
|
||||
WideStringConvert.cpp
|
||||
../include/HECL/HECL.hpp
|
||||
../include/HECL/HMDLMeta.hpp
|
||||
../include/HECL/Backend/Backend.hpp
|
||||
../include/HECL/Backend/GX.hpp
|
||||
../include/HECL/Backend/ProgrammableCommon.hpp
|
||||
@@ -22,6 +24,7 @@ add_library(HECLCommon
|
||||
../include/HECL/Frontend.hpp
|
||||
../include/HECL/Database.hpp
|
||||
../include/HECL/Runtime.hpp
|
||||
atdna_HMDLMeta.cpp
|
||||
atdna_Frontend.cpp
|
||||
atdna_Runtime.cpp
|
||||
${PLAT_SRCS})
|
||||
|
||||
@@ -1,12 +1,58 @@
|
||||
#include "HECL/HMDLMeta.hpp"
|
||||
#include "HECL/Runtime.hpp"
|
||||
#include <Athena/MemoryReader.hpp>
|
||||
|
||||
namespace HECL
|
||||
{
|
||||
namespace Runtime
|
||||
{
|
||||
static LogVisor::LogModule Log("HMDL");
|
||||
|
||||
HMDLData::HMDLData(boo::IGraphicsDataFactory* factory, const void *data)
|
||||
HMDLData::HMDLData(boo::IGraphicsDataFactory* factory,
|
||||
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 != FOURCC('TACO'))
|
||||
Log.report(LogVisor::FatalError, "invalid HMDL magic");
|
||||
|
||||
m_vbo = factory->newStaticBuffer(boo::BufferUseVertex, vbo, meta.vertStride, meta.vertCount);
|
||||
m_ibo = factory->newStaticBuffer(boo::BufferUseIndex, ibo, 4, meta.indexCount);
|
||||
|
||||
size_t elemCount = 2 + meta.colorCount + meta.uvCount + meta.weightCount;
|
||||
std::unique_ptr<boo::VertexElementDescriptor[]> vdescs(new boo::VertexElementDescriptor[elemCount]);
|
||||
for (size_t i=0 ; i<elemCount ; ++i)
|
||||
{
|
||||
vdescs[i].vertBuffer = m_vbo;
|
||||
vdescs[i].indexBuffer = m_ibo;
|
||||
}
|
||||
|
||||
vdescs[0].semantic = boo::VertexSemanticPosition;
|
||||
vdescs[1].semantic = boo::VertexSemanticNormal;
|
||||
size_t e = 2;
|
||||
|
||||
for (size_t i=0 ; i<meta.colorCount ; ++i, ++e)
|
||||
{
|
||||
vdescs[e].semantic = boo::VertexSemanticColor;
|
||||
vdescs[e].semanticIdx = i;
|
||||
}
|
||||
|
||||
for (size_t i=0 ; i<meta.uvCount ; ++i, ++e)
|
||||
{
|
||||
vdescs[e].semantic = boo::VertexSemanticUV;
|
||||
vdescs[e].semanticIdx = i;
|
||||
}
|
||||
|
||||
for (size_t i=0 ; i<meta.weightCount ; ++i, ++e)
|
||||
{
|
||||
vdescs[e].semantic = boo::VertexSemanticWeight;
|
||||
vdescs[e].semanticIdx = i;
|
||||
}
|
||||
|
||||
m_vtxFmt = factory->newVertexFormat(elemCount, vdescs.get());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user