本文整理汇总了C++中model::info方法的典型用法代码示例。如果您正苦于以下问题:C++ model::info方法的具体用法?C++ model::info怎么用?C++ model::info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model::info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: encode_omdl
blob encode_omdl(const model& mdl
, const allocator& file_alloc
, const allocator& temp_alloc)
{
const auto& info = mdl.info();
uint32_t nslots = info.num_slots;
const auto subsets_bytes = info.num_subsets * (uint32_t)sizeof(subset_t);
const auto indices_bytes = info.num_indices * (uint32_t)sizeof(uint16_t);
const auto vertices_bytes = info.num_vertices * layout_size(info.layout);
const auto bytes = sizeof(file_header)
+ sizeof(file_chunk) + sizeof(info_t)
+ sizeof(file_chunk) + subsets_bytes
+ sizeof(file_chunk) + indices_bytes
+ sizeof(file_chunk) * nslots + vertices_bytes;
auto mem = file_alloc.scoped_allocate(bytes, "encoded model");
auto hdr = (file_header*)mem;
hdr->fourcc = omdl_signature;
hdr->num_chunks = 4;
hdr->compression = compression_type::none; // not yet implemented, though here's where it gets done
hdr->reserved = 0;
hdr->version_hash = 0; // not yet implemented
auto chk = hdr->first_chunk();
chk->fourcc = omdl_info_signature;
chk->chunk_bytes = sizeof(info_t);
chk->uncompressed_bytes = chk->chunk_bytes;
memcpy(chk->data<info_t>(), &info, sizeof(info_t));
chk = chk->next();
chk->fourcc = omdl_subsets_signature;
chk->chunk_bytes = subsets_bytes;
chk->uncompressed_bytes = chk->chunk_bytes;
memcpy(chk->data<subset_t>(), mdl.subsets(), chk->chunk_bytes);
chk = chk->next();
chk->fourcc = omdl_indices_signature;
chk->chunk_bytes = indices_bytes;
chk->uncompressed_bytes = chk->chunk_bytes;
memcpy(chk->data<uint16_t>(), mdl.indices(), chk->chunk_bytes);
for (uint32_t slot = 0; slot < nslots; slot++)
{
chk = chk->next();
chk->fourcc = omdl_vertex_slot_signature;
chk->chunk_bytes = vertices_bytes;
chk->uncompressed_bytes = chk->chunk_bytes;
memcpy(chk->data<void>(), mdl.vertices(slot), chk->chunk_bytes);
}
return mem;
}