mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-20 10:47:19 +01:00
Update initialization of all 3 VoxelWorld implementations to use the new style. (It is not yet enabled.)
This commit is contained in:
parent
277182a73e
commit
a01988fb06
@ -24,33 +24,58 @@ SOFTWARE.
|
||||
|
||||
#include "voxel_chunk_blocky.h"
|
||||
|
||||
#include "../../defines.h"
|
||||
#include "../../meshers/blocky/voxel_mesher_blocky.h"
|
||||
#include "../../meshers/blocky/voxel_mesher_liquid_blocky.h"
|
||||
#include "../jobs/voxel_light_job.h"
|
||||
#include "../jobs/voxel_prop_job.h"
|
||||
#include "../jobs/voxel_terrain_job.h"
|
||||
#include "../../defines.h"
|
||||
|
||||
Ref<VoxelChunk> VoxelWorldBlocky::_create_chunk(int x, int y, int z, Ref<VoxelChunk> chunk) {
|
||||
|
||||
if (!chunk.is_valid()) {
|
||||
chunk = Ref<VoxelChunk>(memnew(VoxelChunkBlocky));
|
||||
}
|
||||
|
||||
if (chunk->job_get_count() == 0) {
|
||||
Ref<VoxelLightJob> lj;
|
||||
lj.INSTANCE();
|
||||
|
||||
Ref<VoxelTerrainJob> tj;
|
||||
tj.INSTANCE();
|
||||
|
||||
Ref<VoxelLightJob> lj;
|
||||
lj.INSTANCE();
|
||||
Ref<VoxelMesherJobStep> s;
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_NORMAL);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_DROP_UV2);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_MERGE_VERTS);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
#ifdef MESH_UTILS_PRESENT
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH);
|
||||
s->set_simplification_step_ratio(0.8);
|
||||
s->set_simplification_agressiveness(7);
|
||||
s->set_simplification_steps(1);
|
||||
tj->add_jobs_step(s);
|
||||
#endif
|
||||
|
||||
tj->add_mesher(Ref<VoxelMesher>(memnew(VoxelMesherBlocky())));
|
||||
tj->add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidBlocky())));
|
||||
|
||||
Ref<VoxelPropJob> pj;
|
||||
pj.INSTANCE();
|
||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherBlocky)));
|
||||
|
||||
tj->add_mesher(Ref<VoxelMesher>(memnew(VoxelMesherBlocky())));
|
||||
tj->add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidBlocky())));
|
||||
|
||||
chunk->job_add(lj);
|
||||
chunk->job_add(tj);
|
||||
chunk->job_add(pj);
|
||||
|
@ -30,29 +30,53 @@ SOFTWARE.
|
||||
#include "../jobs/voxel_terrain_job.h"
|
||||
|
||||
Ref<VoxelChunk> VoxelWorldCubic::_create_chunk(int x, int y, int z, Ref<VoxelChunk> chunk) {
|
||||
|
||||
if (!chunk.is_valid()) {
|
||||
chunk = Ref<VoxelChunk>(memnew(VoxelChunkCubic));
|
||||
}
|
||||
|
||||
if (chunk->job_get_count() == 0) {
|
||||
Ref<VoxelTerrainJob> tj;
|
||||
tj.INSTANCE();
|
||||
|
||||
Ref<VoxelLightJob> lj;
|
||||
lj.INSTANCE();
|
||||
|
||||
Ref<VoxelPropJob> pj;
|
||||
pj.INSTANCE();
|
||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherCubic)));
|
||||
Ref<VoxelTerrainJob> tj;
|
||||
tj.INSTANCE();
|
||||
|
||||
Ref<VoxelMesherJobStep> s;
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_NORMAL);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_DROP_UV2);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_MERGE_VERTS);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
#ifdef MESH_UTILS_PRESENT
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH);
|
||||
s->set_simplification_step_ratio(0.8);
|
||||
s->set_simplification_agressiveness(7);
|
||||
s->set_simplification_steps(1);
|
||||
tj->add_jobs_step(s);
|
||||
#endif
|
||||
|
||||
Ref<VoxelMesher> m = Ref<VoxelMesher>(memnew(VoxelMesherCubic()));
|
||||
m->set_channel_index_type(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
||||
m->set_channel_index_isolevel(VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
||||
|
||||
tj->add_mesher(m);
|
||||
//add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidMarchingCubes())));
|
||||
|
||||
Ref<VoxelPropJob> pj;
|
||||
pj.INSTANCE();
|
||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherCubic)));
|
||||
|
||||
chunk->job_add(lj);
|
||||
chunk->job_add(tj);
|
||||
chunk->job_add(pj);
|
||||
|
@ -182,15 +182,11 @@ Ref<VoxelChunk> VoxelWorldDefault::_create_chunk(int x, int y, int z, Ref<VoxelC
|
||||
}
|
||||
|
||||
if (chunk->job_get_count() == 0) {
|
||||
Ref<VoxelTerrainJob> tj;
|
||||
tj.instance();
|
||||
|
||||
Ref<VoxelLightJob> lj;
|
||||
lj.instance();
|
||||
|
||||
Ref<VoxelPropJob> pj;
|
||||
pj.instance();
|
||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherDefault)));
|
||||
Ref<VoxelTerrainJob> tj;
|
||||
tj.instance();
|
||||
|
||||
Ref<VoxelMesherJobStep> s;
|
||||
s.instance();
|
||||
@ -218,6 +214,14 @@ Ref<VoxelChunk> VoxelWorldDefault::_create_chunk(int x, int y, int z, Ref<VoxelC
|
||||
tj->add_jobs_step(s);
|
||||
#endif
|
||||
|
||||
tj->add_mesher(Ref<VoxelMesher>(memnew(VoxelMesherDefault())));
|
||||
//tj->add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherDefault())));
|
||||
|
||||
Ref<VoxelPropJob> pj;
|
||||
pj.instance();
|
||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherDefault)));
|
||||
|
||||
// Order matters!
|
||||
chunk->job_add(lj);
|
||||
chunk->job_add(tj);
|
||||
chunk->job_add(pj);
|
||||
|
@ -35,15 +35,37 @@ Ref<VoxelChunk> VoxelWorldMarchingCubes::_create_chunk(int x, int y, int z, Ref<
|
||||
}
|
||||
|
||||
if (chunk->job_get_count() == 0) {
|
||||
Ref<VoxelTerrainJob> tj;
|
||||
tj.INSTANCE();
|
||||
|
||||
Ref<VoxelLightJob> lj;
|
||||
lj.INSTANCE();
|
||||
|
||||
Ref<VoxelPropJob> pj;
|
||||
pj.INSTANCE();
|
||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherMarchingCubes)));
|
||||
Ref<VoxelTerrainJob> tj;
|
||||
tj.INSTANCE();
|
||||
|
||||
Ref<VoxelMesherJobStep> s;
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_NORMAL);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_DROP_UV2);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_MERGE_VERTS);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE);
|
||||
tj->add_jobs_step(s);
|
||||
|
||||
#ifdef MESH_UTILS_PRESENT
|
||||
s.instance();
|
||||
s->set_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH);
|
||||
s->set_simplification_step_ratio(0.8);
|
||||
s->set_simplification_agressiveness(7);
|
||||
s->set_simplification_steps(1);
|
||||
tj->add_jobs_step(s);
|
||||
#endif
|
||||
|
||||
Ref<VoxelMesher> m = Ref<VoxelMesher>(memnew(VoxelMesherMarchingCubes()));
|
||||
m->set_channel_index_type(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
||||
@ -52,6 +74,10 @@ Ref<VoxelChunk> VoxelWorldMarchingCubes::_create_chunk(int x, int y, int z, Ref<
|
||||
tj->add_mesher(m);
|
||||
//add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidMarchingCubes())));
|
||||
|
||||
Ref<VoxelPropJob> pj;
|
||||
pj.INSTANCE();
|
||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherMarchingCubes)));
|
||||
|
||||
chunk->job_add(lj);
|
||||
chunk->job_add(tj);
|
||||
chunk->job_add(pj);
|
||||
|
Loading…
Reference in New Issue
Block a user