mirror of
https://github.com/Relintai/voxelman.git
synced 2025-04-13 21:00:47 +02: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 "voxel_chunk_blocky.h"
|
||||||
|
|
||||||
|
#include "../../defines.h"
|
||||||
#include "../../meshers/blocky/voxel_mesher_blocky.h"
|
#include "../../meshers/blocky/voxel_mesher_blocky.h"
|
||||||
#include "../../meshers/blocky/voxel_mesher_liquid_blocky.h"
|
#include "../../meshers/blocky/voxel_mesher_liquid_blocky.h"
|
||||||
#include "../jobs/voxel_light_job.h"
|
#include "../jobs/voxel_light_job.h"
|
||||||
#include "../jobs/voxel_prop_job.h"
|
#include "../jobs/voxel_prop_job.h"
|
||||||
#include "../jobs/voxel_terrain_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) {
|
Ref<VoxelChunk> VoxelWorldBlocky::_create_chunk(int x, int y, int z, Ref<VoxelChunk> chunk) {
|
||||||
|
|
||||||
if (!chunk.is_valid()) {
|
if (!chunk.is_valid()) {
|
||||||
chunk = Ref<VoxelChunk>(memnew(VoxelChunkBlocky));
|
chunk = Ref<VoxelChunk>(memnew(VoxelChunkBlocky));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chunk->job_get_count() == 0) {
|
if (chunk->job_get_count() == 0) {
|
||||||
|
Ref<VoxelLightJob> lj;
|
||||||
|
lj.INSTANCE();
|
||||||
|
|
||||||
Ref<VoxelTerrainJob> tj;
|
Ref<VoxelTerrainJob> tj;
|
||||||
tj.INSTANCE();
|
tj.INSTANCE();
|
||||||
|
|
||||||
Ref<VoxelLightJob> lj;
|
Ref<VoxelMesherJobStep> s;
|
||||||
lj.INSTANCE();
|
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;
|
Ref<VoxelPropJob> pj;
|
||||||
pj.INSTANCE();
|
pj.INSTANCE();
|
||||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherBlocky)));
|
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(lj);
|
||||||
chunk->job_add(tj);
|
chunk->job_add(tj);
|
||||||
chunk->job_add(pj);
|
chunk->job_add(pj);
|
||||||
|
@ -30,29 +30,53 @@ SOFTWARE.
|
|||||||
#include "../jobs/voxel_terrain_job.h"
|
#include "../jobs/voxel_terrain_job.h"
|
||||||
|
|
||||||
Ref<VoxelChunk> VoxelWorldCubic::_create_chunk(int x, int y, int z, Ref<VoxelChunk> chunk) {
|
Ref<VoxelChunk> VoxelWorldCubic::_create_chunk(int x, int y, int z, Ref<VoxelChunk> chunk) {
|
||||||
|
|
||||||
if (!chunk.is_valid()) {
|
if (!chunk.is_valid()) {
|
||||||
chunk = Ref<VoxelChunk>(memnew(VoxelChunkCubic));
|
chunk = Ref<VoxelChunk>(memnew(VoxelChunkCubic));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chunk->job_get_count() == 0) {
|
if (chunk->job_get_count() == 0) {
|
||||||
Ref<VoxelTerrainJob> tj;
|
|
||||||
tj.INSTANCE();
|
|
||||||
|
|
||||||
Ref<VoxelLightJob> lj;
|
Ref<VoxelLightJob> lj;
|
||||||
lj.INSTANCE();
|
lj.INSTANCE();
|
||||||
|
|
||||||
Ref<VoxelPropJob> pj;
|
Ref<VoxelTerrainJob> tj;
|
||||||
pj.INSTANCE();
|
tj.INSTANCE();
|
||||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherCubic)));
|
|
||||||
|
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()));
|
Ref<VoxelMesher> m = Ref<VoxelMesher>(memnew(VoxelMesherCubic()));
|
||||||
m->set_channel_index_type(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
m->set_channel_index_type(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
||||||
m->set_channel_index_isolevel(VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
m->set_channel_index_isolevel(VoxelChunkDefault::DEFAULT_CHANNEL_ISOLEVEL);
|
||||||
|
|
||||||
tj->add_mesher(m);
|
tj->add_mesher(m);
|
||||||
//add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidMarchingCubes())));
|
//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(lj);
|
||||||
chunk->job_add(tj);
|
chunk->job_add(tj);
|
||||||
chunk->job_add(pj);
|
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) {
|
if (chunk->job_get_count() == 0) {
|
||||||
Ref<VoxelTerrainJob> tj;
|
|
||||||
tj.instance();
|
|
||||||
|
|
||||||
Ref<VoxelLightJob> lj;
|
Ref<VoxelLightJob> lj;
|
||||||
lj.instance();
|
lj.instance();
|
||||||
|
|
||||||
Ref<VoxelPropJob> pj;
|
Ref<VoxelTerrainJob> tj;
|
||||||
pj.instance();
|
tj.instance();
|
||||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherDefault)));
|
|
||||||
|
|
||||||
Ref<VoxelMesherJobStep> s;
|
Ref<VoxelMesherJobStep> s;
|
||||||
s.instance();
|
s.instance();
|
||||||
@ -218,6 +214,14 @@ Ref<VoxelChunk> VoxelWorldDefault::_create_chunk(int x, int y, int z, Ref<VoxelC
|
|||||||
tj->add_jobs_step(s);
|
tj->add_jobs_step(s);
|
||||||
#endif
|
#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(lj);
|
||||||
chunk->job_add(tj);
|
chunk->job_add(tj);
|
||||||
chunk->job_add(pj);
|
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) {
|
if (chunk->job_get_count() == 0) {
|
||||||
Ref<VoxelTerrainJob> tj;
|
|
||||||
tj.INSTANCE();
|
|
||||||
|
|
||||||
Ref<VoxelLightJob> lj;
|
Ref<VoxelLightJob> lj;
|
||||||
lj.INSTANCE();
|
lj.INSTANCE();
|
||||||
|
|
||||||
Ref<VoxelPropJob> pj;
|
Ref<VoxelTerrainJob> tj;
|
||||||
pj.INSTANCE();
|
tj.INSTANCE();
|
||||||
pj->set_prop_mesher(Ref<VoxelMesher>(memnew(VoxelMesherMarchingCubes)));
|
|
||||||
|
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()));
|
Ref<VoxelMesher> m = Ref<VoxelMesher>(memnew(VoxelMesherMarchingCubes()));
|
||||||
m->set_channel_index_type(VoxelChunkDefault::DEFAULT_CHANNEL_TYPE);
|
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);
|
tj->add_mesher(m);
|
||||||
//add_liquid_mesher(Ref<VoxelMesher>(memnew(VoxelMesherLiquidMarchingCubes())));
|
//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(lj);
|
||||||
chunk->job_add(tj);
|
chunk->job_add(tj);
|
||||||
chunk->job_add(pj);
|
chunk->job_add(pj);
|
||||||
|
Loading…
Reference in New Issue
Block a user