Working commit, do byte based copy
This commit is contained in:
parent
bc8347a161
commit
1e17e17594
|
@ -30,6 +30,24 @@ enum class ACCESSOR_DATA_TYPE : int
|
|||
FLOAT = 5126
|
||||
};
|
||||
|
||||
constexpr size_t SizeOfType(ACCESSOR_DATA_TYPE type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case ACCESSOR_DATA_TYPE::BYTE:
|
||||
case ACCESSOR_DATA_TYPE::U_BYTE:
|
||||
return sizeof(char);
|
||||
case ACCESSOR_DATA_TYPE::SHORT:
|
||||
case ACCESSOR_DATA_TYPE::U_SHORT:
|
||||
return sizeof(short);
|
||||
case ACCESSOR_DATA_TYPE::U_INT:
|
||||
case ACCESSOR_DATA_TYPE::FLOAT:
|
||||
return sizeof(float);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
enum class ACCESSOR_COMPONENT_TYPE : int
|
||||
{
|
||||
SCALAR = 64 + 1,
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace SH_COMP
|
|||
static BufferViewReference bufferViews;
|
||||
static BufferData buffer;
|
||||
|
||||
static void LoadFromFile(AssetPath path, ModelRef asset) noexcept;
|
||||
static inline void LoadFromFile(AssetPath path, ModelRef asset) noexcept;
|
||||
static inline void ProcessModel(ModelData const&, ModelRef asset) noexcept;
|
||||
static inline void BuildHeaders(ModelRef asset) noexcept;
|
||||
|
||||
|
@ -54,3 +54,5 @@ namespace SH_COMP
|
|||
static void LoadAndCompile(AssetPath path) noexcept;
|
||||
};
|
||||
}
|
||||
|
||||
#include "MeshCompiler.hpp"
|
||||
|
|
|
@ -118,13 +118,30 @@ namespace SH_COMP
|
|||
{
|
||||
auto const& accessor = (*accessors)[accessorID];
|
||||
auto const& view = (*bufferViews)[accessor.bufferView];
|
||||
dst.resize(3484);
|
||||
std::cout << "buffer line\n";
|
||||
auto const typeIdentifier{ static_cast<ACCESSOR_DATA_TYPE>(accessor.componentType) };
|
||||
auto const sizeIdentifier{ SizeOfType(typeIdentifier) };
|
||||
if (sizeof(T) == sizeIdentifier)
|
||||
{
|
||||
dst.resize(accessor.count);
|
||||
std::memcpy(
|
||||
dst.data(),
|
||||
buffer + view.byteOffset,
|
||||
view.byteLength
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::byte> tempData(view.byteLength);
|
||||
std::memcpy(
|
||||
tempData.data(),
|
||||
buffer + view.byteOffset,
|
||||
view.byteLength
|
||||
);
|
||||
|
||||
for (auto i{0}; i < accessor.count; i += sizeIdentifier)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
inline void MeshCompiler::BuildHeaders(ModelRef asset) noexcept
|
||||
|
|
|
@ -57,6 +57,8 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
#else
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
SH_COMP::MeshCompiler::LoadAndCompile("racoon_tiny.gltf");
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue