Skip to content

Commit

Permalink
добавил обработку MT4_TREE_ST, MT4_TREE_PM в иерархических моделях. Т…
Browse files Browse the repository at this point in the history
…еперь должны корректно конвертиться деревья в ЛА
  • Loading branch information
abramcumner committed Oct 4, 2016
1 parent b378e71 commit 2b3ba87
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions sources/utils/converter/level_mesh.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ void level_mesh::push(uint16_t sector, const xr_vbuf& vb, const xr_ibuf& ib,
xr_mesh_builder::__push(vb, ib, 0, face_template);
}

void level_mesh::push(uint16_t sector, const xr_vbuf& vb, const xr_ibuf& ib,
uint16_t texture, uint16_t eshader, const fmatrix& xform)
{
b_face face_template(sector);
face_template.surface.set(texture, eshader);
if (vb.has_lightmaps())
face_template.surface.flags |= RSF_LIGHTMAP;
xr_mesh_builder::__push(vb, ib, &xform, face_template);
}

void level_mesh::push(uint16_t sector, const xr_vbuf& vb, const xr_ibuf& ib, const fmatrix& xform,
uint16_t texture, uint16_t eshader, uint16_t gamemtl)
{
Expand Down
2 changes: 2 additions & 0 deletions sources/utils/converter/level_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ class level_mesh: public xray_re::xr_mesh_builder {
uint16_t texture, uint16_t eshader);
void push(uint16_t sector, const xray_re::shape_def& shape, const xray_re::fmatrix& xform0,
uint16_t texture, uint16_t eshader, uint16_t gamemtl);
void push(uint16_t sector, const xray_re::xr_vbuf& vb, const xray_re::xr_ibuf& ib, uint16_t texture, uint16_t eshader,
const xray_re::fmatrix& xform);
void restore_game_materials(const xray_re::xr_cform& cform);
void separate_terrain(uint16_t texture);
void separate_terrain(uint16_t texture, const xray_re::details_header& header,
Expand Down
9 changes: 8 additions & 1 deletion sources/utils/converter/level_tools_visuals.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,14 @@ void level_tools::push_subdivisions_v13(level_mesh* mesh, uint16_t sector_idx, u
} else if (ogf->hierarchical()) {
for (std::vector<uint32_t>::const_iterator it = ogf->children_l().begin(),
end = ogf->children_l().end(); it != end; ++it) {
push_subdivisions_v13(mesh, sector_idx, *it);
const xr_ogf* child = m_subdivisions->at(*it);
const xr_ogf_v4* child_4 = reinterpret_cast<const xr_ogf_v4*>(child);
if (child->model_type() == MT4_TREE_ST || child->model_type() == MT4_TREE_PM) {
mesh->push(sector_idx, child->vb(), child->ib(), m_uniq_textures[child->texture_l()],
m_uniq_shaders[child->shader_l()], child_4->xform());
}
else
push_subdivisions_v13(mesh, sector_idx, *it);
}
} else if (is_compiled_wallmark(ogf->shader_l())) {
// FIXME: restore wallmarks here even if there is no redundant level.wallmarks
Expand Down

0 comments on commit 2b3ba87

Please sign in to comment.