mirror of
https://github.com/Relintai/terraman_2d.git
synced 2024-11-14 10:17:23 +01:00
Renamed the blocky mesher, world and chunk to simple.
This commit is contained in:
parent
1b92eb9f61
commit
e7f28eabd3
6
SCsub
6
SCsub
@ -38,7 +38,7 @@ sources = [
|
|||||||
|
|
||||||
"meshers/terrain_2d_mesher.cpp",
|
"meshers/terrain_2d_mesher.cpp",
|
||||||
|
|
||||||
"meshers/blocky/terrain_2d_mesher_blocky.cpp",
|
"meshers/simple/terrain_2d_mesher_simple.cpp",
|
||||||
"meshers/default/terrain_2d_mesher_default.cpp",
|
"meshers/default/terrain_2d_mesher_default.cpp",
|
||||||
|
|
||||||
"world/terrain_2d_world.cpp",
|
"world/terrain_2d_world.cpp",
|
||||||
@ -47,8 +47,8 @@ sources = [
|
|||||||
"world/block_terrain_2d_structure.cpp",
|
"world/block_terrain_2d_structure.cpp",
|
||||||
"world/terrain_2d_environment_data.cpp",
|
"world/terrain_2d_environment_data.cpp",
|
||||||
|
|
||||||
"world/blocky/terrain_2d_chunk_blocky.cpp",
|
"world/simple/terrain_2d_chunk_simple.cpp",
|
||||||
"world/blocky/terrain_2d_world_blocky.cpp",
|
"world/simple/terrain_2d_world_simple.cpp",
|
||||||
|
|
||||||
"world/default/terrain_2d_world_default.cpp",
|
"world/default/terrain_2d_world_default.cpp",
|
||||||
"world/default/terrain_2d_chunk_default.cpp",
|
"world/default/terrain_2d_chunk_default.cpp",
|
||||||
|
@ -20,13 +20,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "terrain_2d_mesher_blocky.h"
|
#include "terrain_2d_mesher_simple.h"
|
||||||
|
|
||||||
#include "core/math/math_funcs.h"
|
#include "core/math/math_funcs.h"
|
||||||
|
|
||||||
#include "../../library/terrain_2d_material_cache.h"
|
#include "../../library/terrain_2d_material_cache.h"
|
||||||
|
|
||||||
void Terrain2DMesherBlocky::_add_chunk(Ref<Terrain2DChunk> p_chunk) {
|
void Terrain2DMesherSimple::_add_chunk(Ref<Terrain2DChunk> p_chunk) {
|
||||||
Ref<Terrain2DChunkDefault> chunk = p_chunk;
|
Ref<Terrain2DChunkDefault> chunk = p_chunk;
|
||||||
|
|
||||||
ERR_FAIL_COND(!chunk.is_valid());
|
ERR_FAIL_COND(!chunk.is_valid());
|
||||||
@ -36,7 +36,7 @@ void Terrain2DMesherBlocky::_add_chunk(Ref<Terrain2DChunk> p_chunk) {
|
|||||||
add_chunk_normal(chunk);
|
add_chunk_normal(chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Terrain2DMesherBlocky::add_chunk_normal(Ref<Terrain2DChunkDefault> chunk) {
|
void Terrain2DMesherSimple::add_chunk_normal(Ref<Terrain2DChunkDefault> chunk) {
|
||||||
//if ((get_build_flags() & Terrain2DChunkDefault::BUILD_FLAG_GENERATE_AO) != 0)
|
//if ((get_build_flags() & Terrain2DChunkDefault::BUILD_FLAG_GENERATE_AO) != 0)
|
||||||
// if (!chunk->get_channel(Terrain2DChunkDefault::DEFAULT_CHANNEL_AO))
|
// if (!chunk->get_channel(Terrain2DChunkDefault::DEFAULT_CHANNEL_AO))
|
||||||
// chunk->generate_ao();
|
// chunk->generate_ao();
|
||||||
@ -340,12 +340,12 @@ void Terrain2DMesherBlocky::add_chunk_normal(Ref<Terrain2DChunkDefault> chunk) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Terrain2DMesherBlocky::Terrain2DMesherBlocky() {
|
Terrain2DMesherSimple::Terrain2DMesherSimple() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Terrain2DMesherBlocky::~Terrain2DMesherBlocky() {
|
Terrain2DMesherSimple::~Terrain2DMesherSimple() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Terrain2DMesherBlocky::_bind_methods() {
|
void Terrain2DMesherSimple::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("_add_chunk", "buffer"), &Terrain2DMesherBlocky::_add_chunk);
|
ClassDB::bind_method(D_METHOD("_add_chunk", "buffer"), &Terrain2DMesherSimple::_add_chunk);
|
||||||
}
|
}
|
@ -20,8 +20,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TERRAIN_2D_MESHER_BLOCKY_H
|
#ifndef TERRAIN_2D_MESHER_SIMPLE_H
|
||||||
#define TERRAIN_2D_MESHER_BLOCKY_H
|
#define TERRAIN_2D_MESHER_SIMPLE_H
|
||||||
|
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
|
|
||||||
@ -37,16 +37,16 @@ SOFTWARE.
|
|||||||
#include "../default/terrain_2d_mesher_default.h"
|
#include "../default/terrain_2d_mesher_default.h"
|
||||||
#include "../../world/default/terrain_2d_chunk_default.h"
|
#include "../../world/default/terrain_2d_chunk_default.h"
|
||||||
|
|
||||||
class Terrain2DMesherBlocky : public Terrain2DMesherDefault {
|
class Terrain2DMesherSimple : public Terrain2DMesherDefault {
|
||||||
GDCLASS(Terrain2DMesherBlocky, Terrain2DMesherDefault);
|
GDCLASS(Terrain2DMesherSimple, Terrain2DMesherDefault);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void _add_chunk(Ref<Terrain2DChunk> p_chunk);
|
void _add_chunk(Ref<Terrain2DChunk> p_chunk);
|
||||||
|
|
||||||
void add_chunk_normal(Ref<Terrain2DChunkDefault> chunk);
|
void add_chunk_normal(Ref<Terrain2DChunkDefault> chunk);
|
||||||
|
|
||||||
Terrain2DMesherBlocky();
|
Terrain2DMesherSimple();
|
||||||
~Terrain2DMesherBlocky();
|
~Terrain2DMesherSimple();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
@ -55,10 +55,10 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "world/terrain_2d_world_editor.h"
|
#include "world/terrain_2d_world_editor.h"
|
||||||
|
|
||||||
#include "meshers/blocky/terrain_2d_mesher_blocky.h"
|
#include "meshers/simple/terrain_2d_mesher_simple.h"
|
||||||
|
|
||||||
#include "world/blocky/terrain_2d_chunk_blocky.h"
|
#include "world/simple/terrain_2d_chunk_simple.h"
|
||||||
#include "world/blocky/terrain_2d_world_blocky.h"
|
#include "world/simple/terrain_2d_world_simple.h"
|
||||||
|
|
||||||
#include "nodes/terrain_2d_light_node.h"
|
#include "nodes/terrain_2d_light_node.h"
|
||||||
|
|
||||||
@ -98,9 +98,9 @@ void register_terraman_2d_types() {
|
|||||||
ClassDB::register_class<Terrain2DChunkDefault>();
|
ClassDB::register_class<Terrain2DChunkDefault>();
|
||||||
ClassDB::register_class<Terrain2DWorldDefault>();
|
ClassDB::register_class<Terrain2DWorldDefault>();
|
||||||
|
|
||||||
ClassDB::register_class<Terrain2DMesherBlocky>();
|
ClassDB::register_class<Terrain2DMesherSimple>();
|
||||||
ClassDB::register_class<Terrain2DWorldBlocky>();
|
ClassDB::register_class<Terrain2DWorldSimple>();
|
||||||
ClassDB::register_class<Terrain2DChunkBlocky>();
|
ClassDB::register_class<Terrain2DChunkSimple>();
|
||||||
|
|
||||||
ClassDB::register_class<Terrain2DLevelGenerator>();
|
ClassDB::register_class<Terrain2DLevelGenerator>();
|
||||||
ClassDB::register_class<Terrain2DLevelGeneratorFlat>();
|
ClassDB::register_class<Terrain2DLevelGeneratorFlat>();
|
||||||
|
@ -20,20 +20,20 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "terrain_2d_chunk_blocky.h"
|
#include "terrain_2d_chunk_simple.h"
|
||||||
|
|
||||||
#include "../../defines.h"
|
#include "../../defines.h"
|
||||||
|
|
||||||
Terrain2DChunkBlocky::Terrain2DChunkBlocky() {
|
Terrain2DChunkSimple::Terrain2DChunkSimple() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Terrain2DChunkBlocky::~Terrain2DChunkBlocky() {
|
Terrain2DChunkSimple::~Terrain2DChunkSimple() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Terrain2DChunkBlocky::_setup_channels() {
|
void Terrain2DChunkSimple::_setup_channels() {
|
||||||
channel_set_count(MAX_DEFAULT_CHANNELS);
|
channel_set_count(MAX_DEFAULT_CHANNELS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Terrain2DChunkBlocky::_bind_methods() {
|
void Terrain2DChunkSimple::_bind_methods() {
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data_channel"), "channel_set_compressed", "channel_get_compressed", 0);
|
ADD_PROPERTYI(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data_channel"), "channel_set_compressed", "channel_get_compressed", 0);
|
||||||
}
|
}
|
@ -20,17 +20,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TERRAIN_2D_CHUNK_BLOCKY_H
|
#ifndef TERRAIN_2D_CHUNK_SIMPLE_H
|
||||||
#define TERRAIN_2D_CHUNK_BLOCKY_H
|
#define TERRAIN_2D_CHUNK_SIMPLE_H
|
||||||
|
|
||||||
#include "../default/terrain_2d_chunk_default.h"
|
#include "../default/terrain_2d_chunk_default.h"
|
||||||
|
|
||||||
class Terrain2DChunkBlocky : public Terrain2DChunkDefault {
|
class Terrain2DChunkSimple : public Terrain2DChunkDefault {
|
||||||
GDCLASS(Terrain2DChunkBlocky, Terrain2DChunkDefault);
|
GDCLASS(Terrain2DChunkSimple, Terrain2DChunkDefault);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Terrain2DChunkBlocky();
|
Terrain2DChunkSimple();
|
||||||
~Terrain2DChunkBlocky();
|
~Terrain2DChunkSimple();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void _setup_channels();
|
virtual void _setup_channels();
|
@ -20,18 +20,18 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "terrain_2d_world_blocky.h"
|
#include "terrain_2d_world_simple.h"
|
||||||
|
|
||||||
#include "terrain_2d_chunk_blocky.h"
|
#include "terrain_2d_chunk_simple.h"
|
||||||
|
|
||||||
#include "../../meshers/blocky/terrain_2d_mesher_blocky.h"
|
#include "../../meshers/simple/terrain_2d_mesher_simple.h"
|
||||||
#include "../jobs/terrain_2d_light_job.h"
|
#include "../jobs/terrain_2d_light_job.h"
|
||||||
#include "../jobs/terrain_2d_prop_job.h"
|
#include "../jobs/terrain_2d_prop_job.h"
|
||||||
#include "../jobs/terrain_2d_terrain_job.h"
|
#include "../jobs/terrain_2d_terrain_job.h"
|
||||||
|
|
||||||
Ref<Terrain2DChunk> Terrain2DWorldBlocky::_create_chunk(int x, int y, Ref<Terrain2DChunk> chunk) {
|
Ref<Terrain2DChunk> Terrain2DWorldSimple::_create_chunk(int x, int y, Ref<Terrain2DChunk> chunk) {
|
||||||
if (!chunk.is_valid()) {
|
if (!chunk.is_valid()) {
|
||||||
chunk = Ref<Terrain2DChunk>(memnew(Terrain2DChunkBlocky));
|
chunk = Ref<Terrain2DChunk>(memnew(Terrain2DChunkSimple));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chunk->job_get_count() == 0) {
|
if (chunk->job_get_count() == 0) {
|
||||||
@ -41,16 +41,16 @@ Ref<Terrain2DChunk> Terrain2DWorldBlocky::_create_chunk(int x, int y, Ref<Terrai
|
|||||||
Ref<Terrain2DLightJob> lj;
|
Ref<Terrain2DLightJob> lj;
|
||||||
lj.instance();
|
lj.instance();
|
||||||
|
|
||||||
tj->set_mesher(Ref<Terrain2DMesher>(memnew(Terrain2DMesherBlocky())));
|
tj->set_mesher(Ref<Terrain2DMesher>(memnew(Terrain2DMesherSimple())));
|
||||||
|
|
||||||
Ref<Terrain2DMesherBlocky> liquid_mesher;
|
Ref<Terrain2DMesherSimple> liquid_mesher;
|
||||||
liquid_mesher.instance();
|
liquid_mesher.instance();
|
||||||
liquid_mesher->set_channel_index_type(Terrain2DChunkDefault::DEFAULT_CHANNEL_LIQUID_TYPE);
|
liquid_mesher->set_channel_index_type(Terrain2DChunkDefault::DEFAULT_CHANNEL_LIQUID_TYPE);
|
||||||
tj->set_liquid_mesher(liquid_mesher);
|
tj->set_liquid_mesher(liquid_mesher);
|
||||||
|
|
||||||
Ref<Terrain2DProp2DJob> pj;
|
Ref<Terrain2DProp2DJob> pj;
|
||||||
pj.instance();
|
pj.instance();
|
||||||
pj->set_prop_mesher(Ref<Terrain2DMesher>(memnew(Terrain2DMesherBlocky)));
|
pj->set_prop_mesher(Ref<Terrain2DMesher>(memnew(Terrain2DMesherSimple)));
|
||||||
|
|
||||||
chunk->job_add(lj);
|
chunk->job_add(lj);
|
||||||
chunk->job_add(tj);
|
chunk->job_add(tj);
|
||||||
@ -60,13 +60,13 @@ Ref<Terrain2DChunk> Terrain2DWorldBlocky::_create_chunk(int x, int y, Ref<Terrai
|
|||||||
return Terrain2DWorld::_create_chunk(x, y, chunk);
|
return Terrain2DWorld::_create_chunk(x, y, chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
Terrain2DWorldBlocky::Terrain2DWorldBlocky() {
|
Terrain2DWorldSimple::Terrain2DWorldSimple() {
|
||||||
set_data_margin_start(1);
|
set_data_margin_start(1);
|
||||||
set_data_margin_end(1);
|
set_data_margin_end(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Terrain2DWorldBlocky ::~Terrain2DWorldBlocky() {
|
Terrain2DWorldSimple ::~Terrain2DWorldSimple() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Terrain2DWorldBlocky::_bind_methods() {
|
void Terrain2DWorldSimple::_bind_methods() {
|
||||||
}
|
}
|
@ -25,12 +25,12 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "../default/terrain_2d_world_default.h"
|
#include "../default/terrain_2d_world_default.h"
|
||||||
|
|
||||||
class Terrain2DWorldBlocky : public Terrain2DWorldDefault {
|
class Terrain2DWorldSimple : public Terrain2DWorldDefault {
|
||||||
GDCLASS(Terrain2DWorldBlocky, Terrain2DWorldDefault);
|
GDCLASS(Terrain2DWorldSimple, Terrain2DWorldDefault);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Terrain2DWorldBlocky();
|
Terrain2DWorldSimple();
|
||||||
~Terrain2DWorldBlocky();
|
~Terrain2DWorldSimple();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Ref<Terrain2DChunk> _create_chunk(int x, int y, Ref<Terrain2DChunk> p_chunk);
|
Ref<Terrain2DChunk> _create_chunk(int x, int y, Ref<Terrain2DChunk> p_chunk);
|
Loading…
Reference in New Issue
Block a user