interface/mesh: namespace interface -> namespace interface::mesh

This commit is contained in:
Perttu Ahola 2014-10-18 10:09:31 +03:00
parent b24190810f
commit 1d8c7c8e3f
5 changed files with 48 additions and 43 deletions

View File

@ -532,7 +532,7 @@ struct Module: public interface::Module, public voxelworld::Interface
return; return;
} }
// Update collision shape // Update collision shape
interface::set_voxel_physics_boxes(n, context, *volume, interface::mesh::set_voxel_physics_boxes(n, context, *volume,
m_voxel_reg.get()); m_voxel_reg.get());
} }
m_nodes_needing_physics_update.clear(); m_nodes_needing_physics_update.clear();

View File

@ -146,7 +146,7 @@ struct Module: public interface::Module
// Load the same model in here and give it to the physics // Load the same model in here and give it to the physics
// subsystem so that it can be collided to // subsystem so that it can be collided to
SharedPtr<Model> model(interface:: SharedPtr<Model> model(interface::mesh::
create_8bit_voxel_physics_model(context, w, h, d, data, create_8bit_voxel_physics_model(context, w, h, d, data,
voxel_reg)); voxel_reg));

View File

@ -36,6 +36,7 @@ using interface::VoxelInstance;
using namespace Urho3D; using namespace Urho3D;
namespace interface { namespace interface {
namespace mesh {
// Create a model from a string; eg. (2, 2, 2, "11101111") // Create a model from a string; eg. (2, 2, 2, "11101111")
Model* create_simple_voxel_model(Context *context, Model* create_simple_voxel_model(Context *context,
@ -942,5 +943,6 @@ z_plane_does_not_fit:
} }
} }
} // namespace mesh
} // namespace interface } // namespace interface
// vim: set noet ts=4 sw=4: // vim: set noet ts=4 sw=4:

View File

@ -15,47 +15,50 @@ namespace Urho3D
namespace interface namespace interface
{ {
using namespace Urho3D; namespace mesh
namespace pv = PolyVox; {
using namespace Urho3D;
namespace pv = PolyVox;
// Create a model from a string; eg. (2, 2, 2, "11101111") // Create a model from a string; eg. (2, 2, 2, "11101111")
Model* create_simple_voxel_model(Context *context, int w, int h, int d, Model* create_simple_voxel_model(Context *context, int w, int h, int d,
const ss_ &source_data); const ss_ &source_data);
// Create a model from 8-bit voxel data, using a voxel registry, without // Create a model from 8-bit voxel data, using a voxel registry, without
// textures or normals, based on the physically_solid flag. // textures or normals, based on the physically_solid flag.
// Returns nullptr if there is no geometry // Returns nullptr if there is no geometry
Model* create_8bit_voxel_physics_model(Context *context, Model* create_8bit_voxel_physics_model(Context *context,
int w, int h, int d, const ss_ &source_data, int w, int h, int d, const ss_ &source_data,
VoxelRegistry *voxel_reg); VoxelRegistry *voxel_reg);
// Set custom geometry from 8-bit voxel data, using a voxel registry // Set custom geometry from 8-bit voxel data, using a voxel registry
void set_8bit_voxel_geometry(CustomGeometry *cg, Context *context, void set_8bit_voxel_geometry(CustomGeometry *cg, Context *context,
int w, int h, int d, const ss_ &source_data, int w, int h, int d, const ss_ &source_data,
VoxelRegistry *voxel_reg, TextureAtlasRegistry *atlas_reg); VoxelRegistry *voxel_reg, TextureAtlasRegistry *atlas_reg);
// Create a model from voxel volume, using a voxel registry, without // Create a model from voxel volume, using a voxel registry, without
// textures or normals, based on the physically_solid flag. // textures or normals, based on the physically_solid flag.
// Returns nullptr if there is no geometry // Returns nullptr if there is no geometry
// Volume should be padded by one voxel on each edge // Volume should be padded by one voxel on each edge
// NOTE: volume is non-const due to PolyVox deficiency // NOTE: volume is non-const due to PolyVox deficiency
Model* create_voxel_physics_model(Context *context, Model* create_voxel_physics_model(Context *context,
pv::RawVolume<VoxelInstance> &volume, pv::RawVolume<VoxelInstance> &volume,
VoxelRegistry *voxel_reg); VoxelRegistry *voxel_reg);
// Set custom geometry from voxel volume, using a voxel registry // Set custom geometry from voxel volume, using a voxel registry
// Volume should be padded by one voxel on each edge // Volume should be padded by one voxel on each edge
// NOTE: volume is non-const due to PolyVox deficiency // NOTE: volume is non-const due to PolyVox deficiency
void set_voxel_geometry(CustomGeometry *cg, Context *context, void set_voxel_geometry(CustomGeometry *cg, Context *context,
pv::RawVolume<VoxelInstance> &volume, pv::RawVolume<VoxelInstance> &volume,
VoxelRegistry *voxel_reg, TextureAtlasRegistry *atlas_reg); VoxelRegistry *voxel_reg, TextureAtlasRegistry *atlas_reg);
// lod=1 -> 1:1, lod=3 -> 1:3 // lod=1 -> 1:1, lod=3 -> 1:3
void set_voxel_lod_geometry(int lod, CustomGeometry *cg, Context *context, void set_voxel_lod_geometry(int lod, CustomGeometry *cg, Context *context,
pv::RawVolume<VoxelInstance> &volume_orig, pv::RawVolume<VoxelInstance> &volume_orig,
VoxelRegistry *voxel_reg, TextureAtlasRegistry *atlas_reg); VoxelRegistry *voxel_reg, TextureAtlasRegistry *atlas_reg);
void set_voxel_physics_boxes(Node *node, Context *context, void set_voxel_physics_boxes(Node *node, Context *context,
pv::RawVolume<VoxelInstance> &volume, pv::RawVolume<VoxelInstance> &volume,
VoxelRegistry *voxel_reg); VoxelRegistry *voxel_reg);
}
} }
// vim: set noet ts=4 sw=4: // vim: set noet ts=4 sw=4:

View File

@ -73,7 +73,7 @@ static int l_set_simple_voxel_model(lua_State *L)
Context *context = buildat_app->get_scene()->GetContext(); Context *context = buildat_app->get_scene()->GetContext();
SharedPtr<Model> fromScratchModel( SharedPtr<Model> fromScratchModel(
interface::create_simple_voxel_model(context, w, h, d, data)); interface::mesh::create_simple_voxel_model(context, w, h, d, data));
StaticModel *object = node->GetOrCreateComponent<StaticModel>(); StaticModel *object = node->GetOrCreateComponent<StaticModel>();
object->SetModel(fromScratchModel); object->SetModel(fromScratchModel);
@ -116,7 +116,7 @@ static int l_set_8bit_voxel_geometry(lua_State *L)
CustomGeometry *cg = node->GetOrCreateComponent<CustomGeometry>(); CustomGeometry *cg = node->GetOrCreateComponent<CustomGeometry>();
interface::set_8bit_voxel_geometry(cg, context, w, h, d, data, interface::mesh::set_8bit_voxel_geometry(cg, context, w, h, d, data,
voxel_reg, atlas_reg); voxel_reg, atlas_reg);
// Maybe appropriate // Maybe appropriate
@ -156,7 +156,7 @@ static int l_set_voxel_geometry(lua_State *L)
up_<pv::RawVolume<VoxelInstance>> volume = interface::deserialize_volume(data); up_<pv::RawVolume<VoxelInstance>> volume = interface::deserialize_volume(data);
interface::set_voxel_geometry(cg, context, *volume, voxel_reg, atlas_reg); interface::mesh::set_voxel_geometry(cg, context, *volume, voxel_reg, atlas_reg);
// Maybe appropriate // Maybe appropriate
cg->SetOccluder(true); cg->SetOccluder(true);
@ -197,7 +197,7 @@ static int l_set_voxel_lod_geometry(lua_State *L)
up_<pv::RawVolume<VoxelInstance>> volume = interface::deserialize_volume(data); up_<pv::RawVolume<VoxelInstance>> volume = interface::deserialize_volume(data);
interface::set_voxel_lod_geometry(lod, cg, context, *volume, interface::mesh::set_voxel_lod_geometry(lod, cg, context, *volume,
voxel_reg, atlas_reg); voxel_reg, atlas_reg);
// Maybe appropriate // Maybe appropriate
@ -255,7 +255,7 @@ static int l_set_voxel_physics_boxes(lua_State *L)
up_<pv::RawVolume<VoxelInstance>> volume = interface::deserialize_volume(data); up_<pv::RawVolume<VoxelInstance>> volume = interface::deserialize_volume(data);
node->GetOrCreateComponent<RigidBody>(LOCAL); node->GetOrCreateComponent<RigidBody>(LOCAL);
interface::set_voxel_physics_boxes(node, context, *volume, voxel_reg); interface::mesh::set_voxel_physics_boxes(node, context, *volume, voxel_reg);
return 0; return 0;
} }