本文整理汇总了C++中bgfx::VertexDecl::has方法的典型用法代码示例。如果您正苦于以下问题:C++ VertexDecl::has方法的具体用法?C++ VertexDecl::has怎么用?C++ VertexDecl::has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bgfx::VertexDecl
的用法示例。
在下文中一共展示了VertexDecl::has方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseMeshesOld
bool Model::parseMeshesOld(bgfx::VertexDecl global_vertex_decl, FS::IFile& file, FileVersion version, u32 global_flags)
{
int object_count = 0;
file.read(&object_count, sizeof(object_count));
if (object_count <= 0) return false;
m_meshes.reserve(object_count);
char model_dir[MAX_PATH_LENGTH];
PathUtils::getDir(model_dir, MAX_PATH_LENGTH, getPath().c_str());
struct Offsets
{
i32 attribute_array_offset;
i32 attribute_array_size;
i32 indices_offset;
i32 mesh_tri_count;
};
Array<Offsets> mesh_offsets(m_allocator);
for (int i = 0; i < object_count; ++i)
{
i32 str_size;
file.read(&str_size, sizeof(str_size));
char material_name[MAX_PATH_LENGTH];
file.read(material_name, str_size);
if (str_size >= MAX_PATH_LENGTH) return false;
material_name[str_size] = 0;
char material_path[MAX_PATH_LENGTH];
copyString(material_path, model_dir);
catString(material_path, material_name);
catString(material_path, ".mat");
auto* material_manager = m_resource_manager.getOwner().get(Material::TYPE);
Material* material = static_cast<Material*>(material_manager->load(Path(material_path)));
Offsets& offsets = mesh_offsets.emplace();
file.read(&offsets.attribute_array_offset, sizeof(offsets.attribute_array_offset));
file.read(&offsets.attribute_array_size, sizeof(offsets.attribute_array_size));
file.read(&offsets.indices_offset, sizeof(offsets.indices_offset));
file.read(&offsets.mesh_tri_count, sizeof(offsets.mesh_tri_count));
file.read(&str_size, sizeof(str_size));
if (str_size >= MAX_PATH_LENGTH)
{
material_manager->unload(*material);
return false;
}
char mesh_name[MAX_PATH_LENGTH];
mesh_name[str_size] = 0;
file.read(mesh_name, str_size);
bgfx::VertexDecl vertex_decl = global_vertex_decl;
if (version <= FileVersion::SINGLE_VERTEX_DECL)
{
parseVertexDecl(file, &vertex_decl);
if (i != 0 && global_vertex_decl.m_hash != vertex_decl.m_hash)
{
g_log_error.log("Renderer") << "Model " << getPath().c_str()
<< " contains meshes with different vertex declarations.";
}
if(i == 0) global_vertex_decl = vertex_decl;
}
m_meshes.emplace(material,
vertex_decl,
mesh_name,
m_allocator);
addDependency(*material);
}
i32 indices_count = 0;
file.read(&indices_count, sizeof(indices_count));
if (indices_count <= 0) return false;
u32 INDICES_16BIT_FLAG = 1;
int index_size = global_flags & INDICES_16BIT_FLAG ? 2 : 4;
Array<u8> indices(m_allocator);
indices.resize(indices_count * index_size);
file.read(&indices[0], indices.size());
i32 vertices_size = 0;
file.read(&vertices_size, sizeof(vertices_size));
if (vertices_size <= 0) return false;
Array<u8> vertices(m_allocator);
vertices.resize(vertices_size);
file.read(&vertices[0], vertices.size());
int vertex_count = 0;
for (const Offsets& offsets : mesh_offsets)
{
vertex_count += offsets.attribute_array_size / global_vertex_decl.getStride();
}
if (version > FileVersion::BOUNDING_SHAPES_PRECOMPUTED)
{
file.read(&m_bounding_radius, sizeof(m_bounding_radius));
file.read(&m_aabb, sizeof(m_aabb));
//.........这里部分代码省略.........