mirror of
https://github.com/Relintai/terraman_2d.git
synced 2024-11-12 10:15:18 +01:00
Depend on props_2d instead of the props module.
This commit is contained in:
parent
6272c56664
commit
e74b23b8de
@ -124,7 +124,7 @@ This will generate your terrain collider and mesh (with lods) for you, using the
|
||||
|
||||
Your lod setup is easily customizable with [TerraMesherJobSteps](https://github.com/Relintai/terraman/blob/master/world/jobs/voxel_mesher_job_step.h). The setup happens in your selected world's `_create_chunk` method.
|
||||
|
||||
### TerraPropJob
|
||||
### TerraProp2DJob
|
||||
|
||||
This will generate your prop meshes (with lods).
|
||||
|
||||
|
6
SCsub
6
SCsub
@ -15,8 +15,8 @@ if os.path.isdir('../thread_pool'):
|
||||
if os.path.isdir('../mesh_data_resource'):
|
||||
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
|
||||
|
||||
if os.path.isdir('../props'):
|
||||
module_env.Append(CPPDEFINES=['PROPS_PRESENT'])
|
||||
if os.path.isdir('../props_2d'):
|
||||
module_env.Append(CPPDEFINES=['PROPS_2D_PRESENT'])
|
||||
|
||||
if os.path.isdir('../mesh_utils'):
|
||||
module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT'])
|
||||
@ -79,7 +79,7 @@ if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
|
||||
# Shared lib compilation
|
||||
module_env.Append(CCFLAGS=['-fPIC'])
|
||||
module_env['LIBS'] = []
|
||||
shared_lib = module_env.SharedLibrary(target='#bin/terraman', source=sources)
|
||||
shared_lib = module_env.SharedLibrary(target='#bin/terraman_2d', source=sources)
|
||||
shared_lib_shim = shared_lib[0].name.rsplit('.', 1)[0]
|
||||
env.Append(LIBS=[shared_lib_shim])
|
||||
env.Append(LIBPATH=['#bin'])
|
||||
|
@ -62,7 +62,7 @@ def get_doc_classes():
|
||||
"Terrain2DJob",
|
||||
"Terrain2DTerrain2DJob",
|
||||
"Terrain2DLightJob",
|
||||
"Terrain2DPropJob",
|
||||
"Terrain2DProp2DJob",
|
||||
|
||||
"Terrain2DEnvironmentData",
|
||||
"Terrain2DMesherJobStep",
|
||||
|
@ -531,12 +531,12 @@
|
||||
<method name="prop_add">
|
||||
<return type="void" />
|
||||
<argument index="0" name="prop" type="Transform" />
|
||||
<argument index="1" name="arg1" type="PropData" />
|
||||
<argument index="1" name="arg1" type="Prop2DData" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="prop_get">
|
||||
<return type="PropData" />
|
||||
<return type="Prop2DData" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
|
@ -193,12 +193,12 @@
|
||||
</method>
|
||||
<method name="prop_add">
|
||||
<return type="void" />
|
||||
<argument index="0" name="value" type="PropData" />
|
||||
<argument index="0" name="value" type="Prop2DData" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="prop_get">
|
||||
<return type="PropData" />
|
||||
<return type="Prop2DData" />
|
||||
<argument index="0" name="id" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
@ -210,7 +210,7 @@
|
||||
</method>
|
||||
<method name="prop_has" qualifiers="const">
|
||||
<return type="bool" />
|
||||
<argument index="0" name="prop" type="PropData" />
|
||||
<argument index="0" name="prop" type="Prop2DData" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
@ -282,7 +282,7 @@
|
||||
<method name="prop_set">
|
||||
<return type="void" />
|
||||
<argument index="0" name="id" type="int" />
|
||||
<argument index="1" name="surface" type="PropData" />
|
||||
<argument index="1" name="surface" type="Prop2DData" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
|
@ -118,13 +118,13 @@
|
||||
</method>
|
||||
<method name="prop_add_textures">
|
||||
<return type="void" />
|
||||
<argument index="0" name="prop" type="PropData" />
|
||||
<argument index="0" name="prop" type="Prop2DData" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="prop_remove_textures">
|
||||
<return type="void" />
|
||||
<argument index="0" name="prop" type="PropData" />
|
||||
<argument index="0" name="prop" type="Prop2DData" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="Terrain2DPropJob" inherits="Terrain2DJob" version="3.5">
|
||||
<class name="Terrain2DProp2DJob" inherits="Terrain2DJob" version="3.5">
|
||||
<brief_description>
|
||||
</brief_description>
|
||||
<description>
|
||||
|
@ -255,7 +255,7 @@
|
||||
<method name="prop_add">
|
||||
<return type="void" />
|
||||
<argument index="0" name="transform" type="Transform" />
|
||||
<argument index="1" name="prop" type="PropData" />
|
||||
<argument index="1" name="prop" type="Prop2DData" />
|
||||
<argument index="2" name="apply_voxel_scale" type="bool" default="true" />
|
||||
<description>
|
||||
</description>
|
||||
|
@ -26,8 +26,8 @@ SOFTWARE.
|
||||
|
||||
#include "terrain_2d_material_cache.h"
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
#include "../../props/props/prop_data.h"
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
#include "../../props_2d/props/prop_2d_data.h"
|
||||
#endif
|
||||
|
||||
#include "scene/resources/packed_scene.h"
|
||||
@ -319,7 +319,7 @@ void Terrain2DLibrary::liquid_materials_set(const Vector<Variant> &materials) {
|
||||
}
|
||||
}
|
||||
|
||||
//Prop Materials
|
||||
//Prop2D Materials
|
||||
Ref<Material> Terrain2DLibrary::prop_material_get(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _prop_materials.size(), Ref<Material>());
|
||||
|
||||
@ -424,16 +424,16 @@ int Terrain2DLibrary::scene_get_num() const {
|
||||
void Terrain2DLibrary::scenes_clear() {
|
||||
}
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
Ref<PropData> Terrain2DLibrary::prop_get(const int id) {
|
||||
return Ref<PropData>();
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
Ref<Prop2DData> Terrain2DLibrary::prop_get(const int id) {
|
||||
return Ref<Prop2DData>();
|
||||
}
|
||||
void Terrain2DLibrary::prop_add(Ref<PropData> value) {
|
||||
void Terrain2DLibrary::prop_add(Ref<Prop2DData> value) {
|
||||
}
|
||||
bool Terrain2DLibrary::prop_has(const Ref<PropData> &value) const {
|
||||
bool Terrain2DLibrary::prop_has(const Ref<Prop2DData> &value) const {
|
||||
return false;
|
||||
}
|
||||
void Terrain2DLibrary::prop_set(int id, Ref<PropData> value) {
|
||||
void Terrain2DLibrary::prop_set(int id, Ref<Prop2DData> value) {
|
||||
}
|
||||
void Terrain2DLibrary::prop_remove(const int id) {
|
||||
}
|
||||
@ -607,7 +607,7 @@ void Terrain2DLibrary::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("scene_get_num"), &Terrain2DLibrary::scene_get_num);
|
||||
ClassDB::bind_method(D_METHOD("scenes_clear"), &Terrain2DLibrary::scenes_clear);
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("prop_get", "id"), &Terrain2DLibrary::prop_get);
|
||||
ClassDB::bind_method(D_METHOD("prop_add", "value"), &Terrain2DLibrary::prop_add);
|
||||
ClassDB::bind_method(D_METHOD("prop_has", "prop"), &Terrain2DLibrary::prop_has);
|
||||
|
@ -67,8 +67,8 @@ class Terrain2DSurface;
|
||||
class Terrain2DMesher;
|
||||
class PackedScene;
|
||||
class Terrain2DChunk;
|
||||
#ifdef PROPS_PRESENT
|
||||
class PropData;
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
class Prop2DData;
|
||||
#endif
|
||||
|
||||
class Terrain2DLibrary : public Resource {
|
||||
@ -159,11 +159,11 @@ public:
|
||||
virtual int scene_get_num() const;
|
||||
virtual void scenes_clear();
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
virtual Ref<PropData> prop_get(const int id);
|
||||
virtual void prop_add(Ref<PropData> value);
|
||||
virtual bool prop_has(const Ref<PropData> &value) const;
|
||||
virtual void prop_set(const int id, Ref<PropData> value);
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
virtual Ref<Prop2DData> prop_get(const int id);
|
||||
virtual void prop_add(Ref<Prop2DData> value);
|
||||
virtual bool prop_has(const Ref<Prop2DData> &value) const;
|
||||
virtual void prop_set(const int id, Ref<Prop2DData> value);
|
||||
virtual void prop_remove(const int id);
|
||||
virtual int prop_get_num() const;
|
||||
virtual void props_clear();
|
||||
|
@ -25,13 +25,13 @@ SOFTWARE.
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
#include "../../props/props/prop_data.h"
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
#include "../../props_2d/props/prop_2d_data.h"
|
||||
|
||||
#include "../../props/props/prop_data_prop.h"
|
||||
#include "../../props_2d/props/prop_2d_data_prop.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -151,19 +151,19 @@ void Terrain2DLibraryMerger::set_terra_surfaces(const Vector<Variant> &surfaces)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
Ref<PropData> Terrain2DLibraryMerger::get_prop(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _props.size(), Ref<PropData>());
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
Ref<Prop2DData> Terrain2DLibraryMerger::get_prop(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _props.size(), Ref<Prop2DData>());
|
||||
|
||||
return _props[index];
|
||||
}
|
||||
void Terrain2DLibraryMerger::add_prop(Ref<PropData> value) {
|
||||
void Terrain2DLibraryMerger::add_prop(Ref<Prop2DData> value) {
|
||||
_props.push_back(value);
|
||||
}
|
||||
bool Terrain2DLibraryMerger::has_prop(const Ref<PropData> &value) const {
|
||||
bool Terrain2DLibraryMerger::has_prop(const Ref<Prop2DData> &value) const {
|
||||
return _props.find(value) != -1;
|
||||
}
|
||||
void Terrain2DLibraryMerger::set_prop(const int index, const Ref<PropData> &value) {
|
||||
void Terrain2DLibraryMerger::set_prop(const int index, const Ref<Prop2DData> &value) {
|
||||
ERR_FAIL_INDEX(index, _props.size());
|
||||
|
||||
_props.write[index] = value;
|
||||
@ -185,7 +185,7 @@ Vector<Variant> Terrain2DLibraryMerger::get_props() {
|
||||
}
|
||||
|
||||
void Terrain2DLibraryMerger::set_props(const Vector<Variant> &props) {
|
||||
VARIANT_ARRAY_SET(props, _props, PropData);
|
||||
VARIANT_ARRAY_SET(props, _props, Prop2DData);
|
||||
}
|
||||
|
||||
Rect2 Terrain2DLibraryMerger::get_prop_uv_rect(const Ref<Texture> &texture) {
|
||||
@ -260,11 +260,11 @@ void Terrain2DLibraryMerger::refresh_rects() {
|
||||
setup_material_albedo(MATERIAL_INDEX_LIQUID, tex);
|
||||
}
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
//todo add this back
|
||||
//texture_added = false;
|
||||
for (int i = 0; i < _props.size(); i++) {
|
||||
Ref<PropData> prop = _props.get(i);
|
||||
Ref<Prop2DData> prop = _props.get(i);
|
||||
|
||||
if (prop.is_valid()) {
|
||||
if (process_prop_textures(prop))
|
||||
@ -408,8 +408,8 @@ Terrain2DLibraryMerger::~Terrain2DLibraryMerger() {
|
||||
_prop_packer.unref();
|
||||
}
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
bool Terrain2DLibraryMerger::process_prop_textures(Ref<PropData> prop) {
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
bool Terrain2DLibraryMerger::process_prop_textures(Ref<Prop2DData> prop) {
|
||||
if (!prop.is_valid()) {
|
||||
return false;
|
||||
}
|
||||
@ -418,7 +418,7 @@ bool Terrain2DLibraryMerger::process_prop_textures(Ref<PropData> prop) {
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
Ref<Prop2DDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
Ref<Texture> tex = pdm->get_texture();
|
||||
@ -433,7 +433,7 @@ bool Terrain2DLibraryMerger::process_prop_textures(Ref<PropData> prop) {
|
||||
}
|
||||
#endif
|
||||
|
||||
Ref<PropDataProp> pdp = prop->get_prop(i);
|
||||
Ref<Prop2DDataProp2D> pdp = prop->get_prop(i);
|
||||
|
||||
if (pdp.is_valid()) {
|
||||
if (process_prop_textures(pdp))
|
||||
@ -470,10 +470,10 @@ void Terrain2DLibraryMerger::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &Terrain2DLibraryMerger::set_terra_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "17/17:Terrain2DSurfaceMerger", PROPERTY_USAGE_DEFAULT, "Terrain2DSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces");
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("get_props"), &Terrain2DLibraryMerger::get_props);
|
||||
ClassDB::bind_method(D_METHOD("set_props"), &Terrain2DLibraryMerger::set_props);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "17/17:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "17/17:Prop2DData", PROPERTY_USAGE_DEFAULT, "Prop2DData"), "set_props", "get_props");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_prop_uv_rect", "texture"), &Terrain2DLibraryMerger::get_prop_uv_rect);
|
||||
|
||||
|
@ -73,11 +73,11 @@ public:
|
||||
Vector<Variant> get_terra_surfaces();
|
||||
void set_terra_surfaces(const Vector<Variant> &surfaces);
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
Ref<PropData> get_prop(const int index);
|
||||
void add_prop(Ref<PropData> value);
|
||||
bool has_prop(const Ref<PropData> &value) const;
|
||||
void set_prop(const int index, const Ref<PropData> &value);
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
Ref<Prop2DData> get_prop(const int index);
|
||||
void add_prop(Ref<Prop2DData> value);
|
||||
bool has_prop(const Ref<Prop2DData> &value) const;
|
||||
void set_prop(const int index, const Ref<Prop2DData> &value);
|
||||
void remove_prop(const int index);
|
||||
int get_num_props() const;
|
||||
void clear_props();
|
||||
@ -98,15 +98,15 @@ public:
|
||||
~Terrain2DLibraryMerger();
|
||||
|
||||
protected:
|
||||
#ifdef PROPS_PRESENT
|
||||
bool process_prop_textures(Ref<PropData> prop);
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
bool process_prop_textures(Ref<Prop2DData> prop);
|
||||
#endif
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
Vector<Ref<Terrain2DSurfaceMerger> > _terra_surfaces;
|
||||
#ifdef PROPS_PRESENT
|
||||
Vector<Ref<PropData> > _props;
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
Vector<Ref<Prop2DData> > _props;
|
||||
#endif
|
||||
|
||||
Ref<TexturePacker> _packer;
|
||||
|
@ -26,13 +26,13 @@ SOFTWARE.
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
#include "../../props/props/prop_data.h"
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
#include "../../props_2d/props/prop_2d_data.h"
|
||||
|
||||
#include "../../props/props/prop_data_prop.h"
|
||||
#include "../../props_2d/props/prop_2d_data_prop.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -242,14 +242,14 @@ void Terrain2DLibraryMergerPCM::_prop_material_cache_get_key(Ref<Terrain2DChunk>
|
||||
Vector<uint64_t> props;
|
||||
|
||||
/*
|
||||
#ifdef PROPS_PRESENT
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
for (int i = 0; i < chunk->prop_get_count(); ++i) {
|
||||
Ref<PropData> prop = chunk->prop_get(i);
|
||||
Ref<Prop2DData> prop = chunk->prop_get(i);
|
||||
|
||||
ERR_CONTINUE(!prop.is_valid());
|
||||
|
||||
//get pointer's value as uint64
|
||||
uint64_t v = make_uint64_t<PropData *>(*prop);
|
||||
uint64_t v = make_uint64_t<Prop2DData *>(*prop);
|
||||
|
||||
int psize = props.size();
|
||||
bool found = false;
|
||||
@ -351,9 +351,9 @@ void Terrain2DLibraryMergerPCM::_prop_material_cache_get_key(Ref<Terrain2DChunk>
|
||||
}
|
||||
|
||||
/*
|
||||
#ifdef PROPS_PRESENT
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
for (int i = 0; i < chunk->prop_get_count(); ++i) {
|
||||
Ref<PropData> prop = chunk->prop_get(i);
|
||||
Ref<Prop2DData> prop = chunk->prop_get(i);
|
||||
|
||||
ERR_CONTINUE(!prop.is_valid());
|
||||
|
||||
@ -539,19 +539,19 @@ void Terrain2DLibraryMergerPCM::set_terra_surfaces(const Vector<Variant> &surfac
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
Ref<PropData> Terrain2DLibraryMergerPCM::get_prop(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _props.size(), Ref<PropData>());
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
Ref<Prop2DData> Terrain2DLibraryMergerPCM::get_prop(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _props.size(), Ref<Prop2DData>());
|
||||
|
||||
return _props[index];
|
||||
}
|
||||
void Terrain2DLibraryMergerPCM::add_prop(Ref<PropData> value) {
|
||||
void Terrain2DLibraryMergerPCM::add_prop(Ref<Prop2DData> value) {
|
||||
_props.push_back(value);
|
||||
}
|
||||
bool Terrain2DLibraryMergerPCM::has_prop(const Ref<PropData> &value) const {
|
||||
bool Terrain2DLibraryMergerPCM::has_prop(const Ref<Prop2DData> &value) const {
|
||||
return _props.find(value) != -1;
|
||||
}
|
||||
void Terrain2DLibraryMergerPCM::set_prop(const int index, const Ref<PropData> &value) {
|
||||
void Terrain2DLibraryMergerPCM::set_prop(const int index, const Ref<Prop2DData> &value) {
|
||||
ERR_FAIL_INDEX(index, _props.size());
|
||||
|
||||
_props.write[index] = value;
|
||||
@ -573,7 +573,7 @@ Vector<Variant> Terrain2DLibraryMergerPCM::get_props() {
|
||||
}
|
||||
|
||||
void Terrain2DLibraryMergerPCM::set_props(const Vector<Variant> &props) {
|
||||
VARIANT_ARRAY_SET(props, _props, PropData);
|
||||
VARIANT_ARRAY_SET(props, _props, Prop2DData);
|
||||
}
|
||||
|
||||
Rect2 Terrain2DLibraryMergerPCM::get_prop_uv_rect(const Ref<Texture> &texture) {
|
||||
@ -648,11 +648,11 @@ void Terrain2DLibraryMergerPCM::refresh_rects() {
|
||||
setup_material_albedo(MATERIAL_INDEX_LIQUID, tex);
|
||||
}
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
//todo add this back
|
||||
//texture_added = false;
|
||||
for (int i = 0; i < _props.size(); i++) {
|
||||
Ref<PropData> prop = _props.get(i);
|
||||
Ref<Prop2DData> prop = _props.get(i);
|
||||
|
||||
if (prop.is_valid()) {
|
||||
if (process_prop_textures(prop))
|
||||
@ -796,8 +796,8 @@ Terrain2DLibraryMergerPCM::~Terrain2DLibraryMergerPCM() {
|
||||
_prop_packer.unref();
|
||||
}
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
bool Terrain2DLibraryMergerPCM::process_prop_textures(Ref<PropData> prop) {
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
bool Terrain2DLibraryMergerPCM::process_prop_textures(Ref<Prop2DData> prop) {
|
||||
if (!prop.is_valid()) {
|
||||
return false;
|
||||
}
|
||||
@ -805,7 +805,7 @@ bool Terrain2DLibraryMergerPCM::process_prop_textures(Ref<PropData> prop) {
|
||||
bool texture_added = false;
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
Ref<Prop2DDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
Ref<Texture> tex = pdm->get_texture();
|
||||
@ -819,7 +819,7 @@ bool Terrain2DLibraryMergerPCM::process_prop_textures(Ref<PropData> prop) {
|
||||
}
|
||||
}
|
||||
|
||||
Ref<PropDataProp> pdp = prop->get_prop(i);
|
||||
Ref<Prop2DDataProp2D> pdp = prop->get_prop(i);
|
||||
|
||||
if (pdp.is_valid()) {
|
||||
if (process_prop_textures(pdp))
|
||||
@ -856,10 +856,10 @@ void Terrain2DLibraryMergerPCM::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &Terrain2DLibraryMergerPCM::set_terra_surfaces);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "17/17:Terrain2DSurfaceMerger", PROPERTY_USAGE_DEFAULT, "Terrain2DSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces");
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("get_props"), &Terrain2DLibraryMergerPCM::get_props);
|
||||
ClassDB::bind_method(D_METHOD("set_props"), &Terrain2DLibraryMergerPCM::set_props);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "17/17:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "17/17:Prop2DData", PROPERTY_USAGE_DEFAULT, "Prop2DData"), "set_props", "get_props");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_prop_uv_rect", "texture"), &Terrain2DLibraryMergerPCM::get_prop_uv_rect);
|
||||
|
||||
|
@ -88,11 +88,11 @@ public:
|
||||
Vector<Variant> get_terra_surfaces();
|
||||
void set_terra_surfaces(const Vector<Variant> &surfaces);
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
Ref<PropData> get_prop(const int index);
|
||||
void add_prop(Ref<PropData> value);
|
||||
bool has_prop(const Ref<PropData> &value) const;
|
||||
void set_prop(const int index, const Ref<PropData> &value);
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
Ref<Prop2DData> get_prop(const int index);
|
||||
void add_prop(Ref<Prop2DData> value);
|
||||
bool has_prop(const Ref<Prop2DData> &value) const;
|
||||
void set_prop(const int index, const Ref<Prop2DData> &value);
|
||||
void remove_prop(const int index);
|
||||
int get_num_props() const;
|
||||
void clear_props();
|
||||
@ -113,8 +113,8 @@ public:
|
||||
~Terrain2DLibraryMergerPCM();
|
||||
|
||||
protected:
|
||||
#ifdef PROPS_PRESENT
|
||||
bool process_prop_textures(Ref<PropData> prop);
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
bool process_prop_textures(Ref<Prop2DData> prop);
|
||||
#endif
|
||||
|
||||
static void _bind_methods();
|
||||
@ -123,8 +123,8 @@ protected:
|
||||
Map<int, Ref<Terrain2DMaterialCachePCM> > _prop_material_cache;
|
||||
|
||||
Vector<Ref<Terrain2DSurfaceMerger> > _terra_surfaces;
|
||||
#ifdef PROPS_PRESENT
|
||||
Vector<Ref<PropData> > _props;
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
Vector<Ref<Prop2DData> > _props;
|
||||
#endif
|
||||
|
||||
//todo remove these
|
||||
|
@ -24,12 +24,12 @@ SOFTWARE.
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
#include "../../props/props/prop_data.h"
|
||||
#include "../../props/props/prop_data_prop.h"
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
#include "../../props_2d/props/prop_2d_data.h"
|
||||
#include "../../props_2d/props/prop_2d_data_prop.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -196,15 +196,15 @@ Rect2 Terrain2DMaterialCache::additional_texture_get_uv_rect(const Ref<Texture>
|
||||
return Rect2(0, 0, 1, 1);
|
||||
}
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
void Terrain2DMaterialCache::prop_add_textures(const Ref<PropData> &prop) {
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
void Terrain2DMaterialCache::prop_add_textures(const Ref<Prop2DData> &prop) {
|
||||
if (!prop.is_valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
Ref<Prop2DDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
Ref<Texture> tex = pdm->get_texture();
|
||||
@ -216,21 +216,21 @@ void Terrain2DMaterialCache::prop_add_textures(const Ref<PropData> &prop) {
|
||||
}
|
||||
#endif
|
||||
|
||||
Ref<PropDataProp> pdp = prop->get_prop(i);
|
||||
Ref<Prop2DDataProp2D> pdp = prop->get_prop(i);
|
||||
|
||||
if (pdp.is_valid()) {
|
||||
prop_add_textures(pdp);
|
||||
}
|
||||
}
|
||||
}
|
||||
void Terrain2DMaterialCache::prop_remove_textures(const Ref<PropData> &prop) {
|
||||
void Terrain2DMaterialCache::prop_remove_textures(const Ref<Prop2DData> &prop) {
|
||||
if (!prop.is_valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
Ref<Prop2DDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
Ref<Texture> tex = pdm->get_texture();
|
||||
@ -242,7 +242,7 @@ void Terrain2DMaterialCache::prop_remove_textures(const Ref<PropData> &prop) {
|
||||
}
|
||||
#endif
|
||||
|
||||
Ref<PropDataProp> pdp = prop->get_prop(i);
|
||||
Ref<Prop2DDataProp2D> pdp = prop->get_prop(i);
|
||||
|
||||
if (pdp.is_valid()) {
|
||||
prop_remove_textures(pdp);
|
||||
@ -323,7 +323,7 @@ void Terrain2DMaterialCache::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("additional_texture_get_atlas_tex", "index"), &Terrain2DMaterialCache::additional_texture_get_atlas_tex);
|
||||
ClassDB::bind_method(D_METHOD("additional_texture_get_uv_rect", "texture"), &Terrain2DMaterialCache::additional_texture_get_uv_rect);
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("prop_add_textures", "prop"), &Terrain2DMaterialCache::prop_add_textures);
|
||||
ClassDB::bind_method(D_METHOD("prop_remove_textures", "prop"), &Terrain2DMaterialCache::prop_remove_textures);
|
||||
#endif
|
||||
|
@ -85,9 +85,9 @@ public:
|
||||
virtual Ref<AtlasTexture> additional_texture_get_atlas_tex(const Ref<Texture> &texture);
|
||||
virtual Rect2 additional_texture_get_uv_rect(const Ref<Texture> &texture);
|
||||
|
||||
#ifdef PROPS_PRESENT
|
||||
void prop_add_textures(const Ref<PropData> &prop);
|
||||
void prop_remove_textures(const Ref<PropData> &prop);
|
||||
#ifdef PROPS_2D_PRESENT
|
||||
void prop_add_textures(const Ref<Prop2DData> &prop);
|
||||
void prop_remove_textures(const Ref<Prop2DData> &prop);
|
||||
#endif
|
||||
|
||||
virtual void refresh_rects();
|
||||
|
@ -44,7 +44,7 @@ SOFTWARE.
|
||||
|
||||
class Terrain2DSurface;
|
||||
class TexturePacker;
|
||||
class PropData;
|
||||
class Prop2DData;
|
||||
|
||||
class Terrain2DMaterialCachePCM : public Terrain2DMaterialCache {
|
||||
GDCLASS(Terrain2DMaterialCachePCM, Terrain2DMaterialCache);
|
||||
|
@ -37,7 +37,7 @@ SOFTWARE.
|
||||
|
||||
class Terrain2DLightNode : public Spatial {
|
||||
GDCLASS(Terrain2DLightNode, Spatial);
|
||||
OBJ_CATEGORY("Props");
|
||||
OBJ_CATEGORY("Prop2Ds");
|
||||
|
||||
public:
|
||||
//make it turn into a normal light if voxelman isn't present?
|
||||
|
@ -112,7 +112,7 @@ void register_terraman_2d_types() {
|
||||
ClassDB::register_class<Terrain2DTerrain2DJob>();
|
||||
ClassDB::register_class<Terrain2DMesherJobStep>();
|
||||
ClassDB::register_class<Terrain2DLightJob>();
|
||||
ClassDB::register_class<Terrain2DPropJob>();
|
||||
ClassDB::register_class<Terrain2DProp2DJob>();
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
EditorPlugins::add_by_type<Terrain2DWorldEditorPlugin>();
|
||||
|
2
thirdparty/lz4/lz4.c
vendored
2
thirdparty/lz4/lz4.c
vendored
@ -1888,7 +1888,7 @@ LZ4_decompress_generic(
|
||||
}
|
||||
|
||||
/* The second stage didn't work out, but the info is ready.
|
||||
* Propel it right to the point of match copying. */
|
||||
* Prop2Del it right to the point of match copying. */
|
||||
goto _copy_match;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ Ref<Terrain2DChunk> Terrain2DWorldBlocky::_create_chunk(int x, int z, Ref<Terrai
|
||||
liquid_mesher->set_channel_index_isolevel(Terrain2DChunkDefault::DEFAULT_CHANNEL_LIQUID_ISOLEVEL);
|
||||
tj->set_liquid_mesher(liquid_mesher);
|
||||
|
||||
Ref<Terrain2DPropJob> pj;
|
||||
Ref<Terrain2DProp2DJob> pj;
|
||||
pj.instance();
|
||||
pj->set_prop_mesher(Ref<Terrain2DMesher>(memnew(Terrain2DMesherBlocky)));
|
||||
|
||||
|
@ -187,7 +187,7 @@ Ref<Terrain2DChunk> Terrain2DWorldDefault::_create_chunk(int x, int z, Ref<Terra
|
||||
Ref<Terrain2DLightJob> lj;
|
||||
lj.instance();
|
||||
|
||||
Ref<Terrain2DPropJob> pj;
|
||||
Ref<Terrain2DProp2DJob> pj;
|
||||
pj.instance();
|
||||
pj->set_prop_mesher(Ref<Terrain2DMesher>(memnew(Terrain2DMesherDefault)));
|
||||
|
||||
|
@ -42,36 +42,36 @@ SOFTWARE.
|
||||
#include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h"
|
||||
#endif
|
||||
|
||||
Ref<Terrain2DMesher> Terrain2DPropJob::get_prop_mesher() const {
|
||||
Ref<Terrain2DMesher> Terrain2DProp2DJob::get_prop_mesher() const {
|
||||
return _prop_mesher;
|
||||
}
|
||||
void Terrain2DPropJob::set_prop_mesher(const Ref<Terrain2DMesher> &mesher) {
|
||||
void Terrain2DProp2DJob::set_prop_mesher(const Ref<Terrain2DMesher> &mesher) {
|
||||
_prop_mesher = mesher;
|
||||
}
|
||||
|
||||
Ref<Terrain2DMesherJobStep> Terrain2DPropJob::get_jobs_step(int index) const {
|
||||
Ref<Terrain2DMesherJobStep> Terrain2DProp2DJob::get_jobs_step(int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _job_steps.size(), Ref<Terrain2DMesherJobStep>());
|
||||
|
||||
return _job_steps.get(index);
|
||||
}
|
||||
void Terrain2DPropJob::set_jobs_step(int index, const Ref<Terrain2DMesherJobStep> &step) {
|
||||
void Terrain2DProp2DJob::set_jobs_step(int index, const Ref<Terrain2DMesherJobStep> &step) {
|
||||
ERR_FAIL_INDEX(index, _job_steps.size());
|
||||
|
||||
_job_steps.set(index, step);
|
||||
}
|
||||
void Terrain2DPropJob::remove_jobs_step(const int index) {
|
||||
void Terrain2DProp2DJob::remove_jobs_step(const int index) {
|
||||
ERR_FAIL_INDEX(index, _job_steps.size());
|
||||
|
||||
_job_steps.remove(index);
|
||||
}
|
||||
void Terrain2DPropJob::add_jobs_step(const Ref<Terrain2DMesherJobStep> &step) {
|
||||
void Terrain2DProp2DJob::add_jobs_step(const Ref<Terrain2DMesherJobStep> &step) {
|
||||
_job_steps.push_back(step);
|
||||
}
|
||||
int Terrain2DPropJob::get_jobs_step_count() const {
|
||||
int Terrain2DProp2DJob::get_jobs_step_count() const {
|
||||
return _job_steps.size();
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::phase_physics_process() {
|
||||
void Terrain2DProp2DJob::phase_physics_process() {
|
||||
Ref<Terrain2DChunkDefault> chunk = _chunk;
|
||||
|
||||
//TODO this should only update the differences
|
||||
@ -129,7 +129,7 @@ void Terrain2DPropJob::phase_physics_process() {
|
||||
next_phase();
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::phase_prop() {
|
||||
void Terrain2DProp2DJob::phase_prop() {
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
Ref<Terrain2DChunkDefault> chunk = _chunk;
|
||||
|
||||
@ -216,12 +216,12 @@ void Terrain2DPropJob::phase_prop() {
|
||||
next_phase();
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::_physics_process(float delta) {
|
||||
void Terrain2DProp2DJob::_physics_process(float delta) {
|
||||
if (_phase == 0)
|
||||
phase_physics_process();
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::_execute_phase() {
|
||||
void Terrain2DProp2DJob::_execute_phase() {
|
||||
ERR_FAIL_COND(!_chunk.is_valid());
|
||||
|
||||
Ref<Terrain2DLibrary> library = _chunk->get_library();
|
||||
@ -249,11 +249,11 @@ void Terrain2DPropJob::_execute_phase() {
|
||||
} else if (_phase > 3) {
|
||||
set_complete(true); //So threadpool knows it's done
|
||||
next_job();
|
||||
ERR_FAIL_MSG("Terrain2DPropJob: _phase is too high!");
|
||||
ERR_FAIL_MSG("Terrain2DProp2DJob: _phase is too high!");
|
||||
}
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::_reset() {
|
||||
void Terrain2DProp2DJob::_reset() {
|
||||
Terrain2DJob::_reset();
|
||||
|
||||
_build_done = false;
|
||||
@ -270,7 +270,7 @@ void Terrain2DPropJob::_reset() {
|
||||
set_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS);
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::phase_setup() {
|
||||
void Terrain2DProp2DJob::phase_setup() {
|
||||
Ref<Terrain2DLibrary> library = _chunk->get_library();
|
||||
|
||||
if (!library->supports_caching()) {
|
||||
@ -319,7 +319,7 @@ void Terrain2DPropJob::phase_setup() {
|
||||
}
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::phase_steps() {
|
||||
void Terrain2DProp2DJob::phase_steps() {
|
||||
Ref<Terrain2DChunkDefault> chunk = _chunk;
|
||||
|
||||
ERR_FAIL_COND(!_prop_mesher.is_valid());
|
||||
@ -441,7 +441,7 @@ void Terrain2DPropJob::phase_steps() {
|
||||
next_job();
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::step_type_normal() {
|
||||
void Terrain2DProp2DJob::step_type_normal() {
|
||||
//TODO add a lighting generation step
|
||||
|
||||
Ref<Terrain2DChunkDefault> chunk = _chunk;
|
||||
@ -467,13 +467,13 @@ void Terrain2DPropJob::step_type_normal() {
|
||||
++_current_mesh;
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::step_type_normal_lod() {
|
||||
print_error("Error: step_type_normal_lod doesn't work for Terrain2DPropJobs!");
|
||||
void Terrain2DProp2DJob::step_type_normal_lod() {
|
||||
print_error("Error: step_type_normal_lod doesn't work for Terrain2DProp2DJobs!");
|
||||
|
||||
++_current_mesh;
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::step_type_drop_uv2() {
|
||||
void Terrain2DProp2DJob::step_type_drop_uv2() {
|
||||
Ref<Terrain2DChunkDefault> chunk = _chunk;
|
||||
|
||||
RID mesh_rid = chunk->mesh_rid_get_index(Terrain2DChunkDefault::MESH_INDEX_PROP, Terrain2DChunkDefault::MESH_TYPE_INDEX_MESH, _current_mesh);
|
||||
@ -497,7 +497,7 @@ void Terrain2DPropJob::step_type_drop_uv2() {
|
||||
++_current_mesh;
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::step_type_merge_verts() {
|
||||
void Terrain2DProp2DJob::step_type_merge_verts() {
|
||||
Array temp_mesh_arr2 = merge_mesh_array(temp_mesh_arr);
|
||||
temp_mesh_arr = temp_mesh_arr2;
|
||||
|
||||
@ -521,7 +521,7 @@ void Terrain2DPropJob::step_type_merge_verts() {
|
||||
++_current_mesh;
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::step_type_bake_texture() {
|
||||
void Terrain2DProp2DJob::step_type_bake_texture() {
|
||||
Ref<Terrain2DChunkDefault> chunk = _chunk;
|
||||
|
||||
Ref<ShaderMaterial> mat = chunk->get_library()->material_lod_get(0);
|
||||
@ -558,7 +558,7 @@ void Terrain2DPropJob::step_type_bake_texture() {
|
||||
++_current_mesh;
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::step_type_simplify_mesh() {
|
||||
void Terrain2DProp2DJob::step_type_simplify_mesh() {
|
||||
#ifdef MESH_UTILS_PRESENT
|
||||
|
||||
Ref<Terrain2DChunkDefault> chunk = _chunk;
|
||||
@ -595,26 +595,26 @@ void Terrain2DPropJob::step_type_simplify_mesh() {
|
||||
#endif
|
||||
}
|
||||
|
||||
Terrain2DPropJob::Terrain2DPropJob() {
|
||||
Terrain2DProp2DJob::Terrain2DProp2DJob() {
|
||||
set_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS);
|
||||
|
||||
_current_job_step = 0;
|
||||
_current_mesh = 0;
|
||||
}
|
||||
|
||||
Terrain2DPropJob::~Terrain2DPropJob() {
|
||||
Terrain2DProp2DJob::~Terrain2DProp2DJob() {
|
||||
}
|
||||
|
||||
void Terrain2DPropJob::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_prop_mesher"), &Terrain2DPropJob::get_prop_mesher);
|
||||
ClassDB::bind_method(D_METHOD("set_prop_mesher", "mesher"), &Terrain2DPropJob::set_prop_mesher);
|
||||
void Terrain2DProp2DJob::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_prop_mesher"), &Terrain2DProp2DJob::get_prop_mesher);
|
||||
ClassDB::bind_method(D_METHOD("set_prop_mesher", "mesher"), &Terrain2DProp2DJob::set_prop_mesher);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_mesher", PROPERTY_HINT_RESOURCE_TYPE, "Terrain2DMesher", 0), "set_prop_mesher", "get_prop_mesher");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_jobs_step", "index"), &Terrain2DPropJob::get_jobs_step);
|
||||
ClassDB::bind_method(D_METHOD("set_jobs_step", "index", "mesher"), &Terrain2DPropJob::set_jobs_step);
|
||||
ClassDB::bind_method(D_METHOD("remove_jobs_step", "index"), &Terrain2DPropJob::remove_jobs_step);
|
||||
ClassDB::bind_method(D_METHOD("add_jobs_step", "mesher"), &Terrain2DPropJob::add_jobs_step);
|
||||
ClassDB::bind_method(D_METHOD("get_jobs_step_count"), &Terrain2DPropJob::get_jobs_step_count);
|
||||
ClassDB::bind_method(D_METHOD("get_jobs_step", "index"), &Terrain2DProp2DJob::get_jobs_step);
|
||||
ClassDB::bind_method(D_METHOD("set_jobs_step", "index", "mesher"), &Terrain2DProp2DJob::set_jobs_step);
|
||||
ClassDB::bind_method(D_METHOD("remove_jobs_step", "index"), &Terrain2DProp2DJob::remove_jobs_step);
|
||||
ClassDB::bind_method(D_METHOD("add_jobs_step", "mesher"), &Terrain2DProp2DJob::add_jobs_step);
|
||||
ClassDB::bind_method(D_METHOD("get_jobs_step_count"), &Terrain2DProp2DJob::get_jobs_step_count);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_physics_process", "delta"), &Terrain2DPropJob::_physics_process);
|
||||
ClassDB::bind_method(D_METHOD("_physics_process", "delta"), &Terrain2DProp2DJob::_physics_process);
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ SOFTWARE.
|
||||
|
||||
class Terrain2DMesher;
|
||||
|
||||
class Terrain2DPropJob : public Terrain2DJob {
|
||||
GDCLASS(Terrain2DPropJob, Terrain2DJob);
|
||||
class Terrain2DProp2DJob : public Terrain2DJob {
|
||||
GDCLASS(Terrain2DProp2DJob, Terrain2DJob);
|
||||
|
||||
public:
|
||||
Ref<Terrain2DMesher> get_prop_mesher() const;
|
||||
@ -60,8 +60,8 @@ public:
|
||||
void step_type_bake_texture();
|
||||
void step_type_simplify_mesh();
|
||||
|
||||
Terrain2DPropJob();
|
||||
~Terrain2DPropJob();
|
||||
Terrain2DProp2DJob();
|
||||
~Terrain2DProp2DJob();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
@ -719,18 +719,18 @@ void Terrain2DChunk::clear_baked_lights() {
|
||||
call("_clear_baked_lights");
|
||||
}
|
||||
|
||||
#if PROPS_PRESENT
|
||||
void Terrain2DChunk::prop_add(const Transform &tarnsform, const Ref<PropData> &prop) {
|
||||
#if PROPS_2D_PRESENT
|
||||
void Terrain2DChunk::prop_add(const Transform &tarnsform, const Ref<Prop2DData> &prop) {
|
||||
ERR_FAIL_COND(!prop.is_valid());
|
||||
|
||||
PropDataStore s;
|
||||
Prop2DDataStore s;
|
||||
s.transform = tarnsform;
|
||||
s.prop = prop;
|
||||
|
||||
_props.push_back(s);
|
||||
}
|
||||
Ref<PropData> Terrain2DChunk::prop_get(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _props.size(), Ref<PropData>());
|
||||
Ref<Prop2DData> Terrain2DChunk::prop_get(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _props.size(), Ref<Prop2DData>());
|
||||
|
||||
return _props.get(index).prop;
|
||||
}
|
||||
@ -775,7 +775,7 @@ int Terrain2DChunk::mesh_data_resource_addv(const Vector3 &local_data_pos, const
|
||||
AABB mesh_aabb = e.transform.xform(mesh->get_aabb());
|
||||
e.is_inside = aabb.encloses(mesh_aabb);
|
||||
|
||||
#if PROPS_PRESENT
|
||||
#if PROPS_2D_PRESENT
|
||||
if (get_library().is_valid() && texture.is_valid()) {
|
||||
e.uv_rect = get_library()->get_prop_uv_rect(texture);
|
||||
} else {
|
||||
@ -815,7 +815,7 @@ int Terrain2DChunk::mesh_data_resource_add(const Transform &local_transform, con
|
||||
AABB mesh_aabb = e.transform.xform(mesh->get_aabb());
|
||||
e.is_inside = aabb.encloses(mesh_aabb);
|
||||
|
||||
#if PROPS_PRESENT
|
||||
#if PROPS_2D_PRESENT
|
||||
if (get_library().is_valid() && texture.is_valid())
|
||||
e.uv_rect = get_library()->get_prop_uv_rect(texture);
|
||||
else
|
||||
@ -1113,7 +1113,7 @@ Terrain2DChunk::~Terrain2DChunk() {
|
||||
_library.unref();
|
||||
}
|
||||
|
||||
#if PROPS_PRESENT
|
||||
#if PROPS_2D_PRESENT
|
||||
props_clear();
|
||||
#endif
|
||||
|
||||
@ -1490,7 +1490,7 @@ void Terrain2DChunk::_bind_methods() {
|
||||
|
||||
//Meshes
|
||||
|
||||
#if PROPS_PRESENT
|
||||
#if PROPS_2D_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("prop_add", "prop"), &Terrain2DChunk::prop_add);
|
||||
ClassDB::bind_method(D_METHOD("prop_get", "index"), &Terrain2DChunk::prop_get);
|
||||
ClassDB::bind_method(D_METHOD("prop_get_count"), &Terrain2DChunk::prop_get_count);
|
||||
|
@ -54,8 +54,8 @@ include_pool_vector
|
||||
|
||||
#include "../meshers/terrain_2d_mesher.h"
|
||||
|
||||
#if PROPS_PRESENT
|
||||
#include "../../props/props/prop_data.h"
|
||||
#if PROPS_2D_PRESENT
|
||||
#include "../../props_2d/props/prop_2d_data.h"
|
||||
#endif
|
||||
|
||||
#include "core/version.h"
|
||||
@ -233,9 +233,9 @@ public:
|
||||
void bake_light(Ref<Terrain2DLight> light);
|
||||
void clear_baked_lights();
|
||||
|
||||
#if PROPS_PRESENT
|
||||
void prop_add(const Transform &tarnsform, const Ref<PropData> &prop);
|
||||
Ref<PropData> prop_get(const int index);
|
||||
#if PROPS_2D_PRESENT
|
||||
void prop_add(const Transform &tarnsform, const Ref<Prop2DData> &prop);
|
||||
Ref<Prop2DData> prop_get(const int index);
|
||||
Transform prop_get_tarnsform(const int index);
|
||||
int prop_get_count() const;
|
||||
void prop_remove(const int index);
|
||||
@ -319,10 +319,10 @@ protected:
|
||||
virtual void _generation_physics_process(const float delta);
|
||||
|
||||
protected:
|
||||
#if PROPS_PRESENT
|
||||
struct PropDataStore {
|
||||
#if PROPS_2D_PRESENT
|
||||
struct Prop2DDataStore {
|
||||
Transform transform;
|
||||
Ref<PropData> prop;
|
||||
Ref<Prop2DData> prop;
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -401,8 +401,8 @@ protected:
|
||||
|
||||
Vector<Ref<Terrain2DStructure>> _voxel_structures;
|
||||
|
||||
#if PROPS_PRESENT
|
||||
Vector<PropDataStore> _props;
|
||||
#if PROPS_2D_PRESENT
|
||||
Vector<Prop2DDataStore> _props;
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
|
@ -30,16 +30,16 @@ SOFTWARE.
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#if PROPS_PRESENT
|
||||
#include "../../props/props/prop_data.h"
|
||||
#include "../../props/props/prop_data_entry.h"
|
||||
#include "../../props/props/prop_data_light.h"
|
||||
#include "../../props/props/prop_data_prop.h"
|
||||
#include "../../props/props/prop_data_scene.h"
|
||||
#if PROPS_2D_PRESENT
|
||||
#include "../../props_2d/props/prop_2d_data.h"
|
||||
#include "../../props_2d/props/prop_2d_data_entry.h"
|
||||
#include "../../props_2d/props/prop_2d_data_light.h"
|
||||
#include "../../props_2d/props/prop_2d_data_prop.h"
|
||||
#include "../../props_2d/props/prop_2d_data_scene.h"
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
#if TOOLS_ENABLED
|
||||
@ -586,8 +586,8 @@ int Terrain2DWorld::generation_get_size() const {
|
||||
return _generating.size();
|
||||
}
|
||||
|
||||
#if PROPS_PRESENT
|
||||
void Terrain2DWorld::prop_add(Transform transform, const Ref<PropData> &prop, const bool apply_voxel_scale) {
|
||||
#if PROPS_2D_PRESENT
|
||||
void Terrain2DWorld::prop_add(Transform transform, const Ref<Prop2DData> &prop, const bool apply_voxel_scale) {
|
||||
ERR_FAIL_COND(!prop.is_valid());
|
||||
|
||||
if (apply_voxel_scale) {
|
||||
@ -602,7 +602,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref<PropData> &prop, co
|
||||
|
||||
int count = prop->get_prop_count();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
Ref<PropDataEntry> entry = prop->get_prop(i);
|
||||
Ref<Prop2DDataEntry> entry = prop->get_prop(i);
|
||||
|
||||
if (!entry.is_valid())
|
||||
continue;
|
||||
@ -612,10 +612,10 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref<PropData> &prop, co
|
||||
wp = t.xform(Vector3());
|
||||
chunk = get_or_create_chunk_at_world_position(wp);
|
||||
|
||||
Ref<PropDataProp> prop_entry_data = entry;
|
||||
Ref<Prop2DDataProp2D> prop_entry_data = entry;
|
||||
|
||||
if (prop_entry_data.is_valid()) {
|
||||
Ref<PropData> p = prop_entry_data->get_prop();
|
||||
Ref<Prop2DData> p = prop_entry_data->get_prop();
|
||||
|
||||
if (!p.is_valid())
|
||||
continue;
|
||||
@ -625,7 +625,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref<PropData> &prop, co
|
||||
continue;
|
||||
}
|
||||
|
||||
Ref<PropDataScene> scene_data = entry;
|
||||
Ref<Prop2DDataScene> scene_data = entry;
|
||||
|
||||
if (scene_data.is_valid()) {
|
||||
Ref<PackedScene> sc = scene_data->get_scene();
|
||||
@ -646,7 +646,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref<PropData> &prop, co
|
||||
continue;
|
||||
}
|
||||
|
||||
Ref<PropDataLight> light_data = entry;
|
||||
Ref<Prop2DDataLight> light_data = entry;
|
||||
|
||||
if (light_data.is_valid()) {
|
||||
Ref<Terrain2DLight> light;
|
||||
@ -662,7 +662,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref<PropData> &prop, co
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
Ref<PropDataMeshData> mesh_data = entry;
|
||||
Ref<Prop2DDataMeshData> mesh_data = entry;
|
||||
|
||||
if (mesh_data.is_valid()) {
|
||||
Ref<MeshDataResource> mdr = mesh_data->get_mesh();
|
||||
@ -1219,7 +1219,7 @@ void Terrain2DWorld::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("is_position_walkable", "position"), &Terrain2DWorld::is_position_walkable);
|
||||
ClassDB::bind_method(D_METHOD("on_chunk_mesh_generation_finished", "chunk"), &Terrain2DWorld::on_chunk_mesh_generation_finished);
|
||||
|
||||
#if PROPS_PRESENT
|
||||
#if PROPS_2D_PRESENT
|
||||
ClassDB::bind_method(D_METHOD("prop_add", "transform", "prop", "apply_voxel_scale"), &Terrain2DWorld::prop_add, DEFVAL(true));
|
||||
#endif
|
||||
|
||||
|
@ -43,13 +43,13 @@ SOFTWARE.
|
||||
|
||||
#include "core/os/os.h"
|
||||
|
||||
#if PROPS_PRESENT
|
||||
#include "../../props/props/prop_data.h"
|
||||
#if PROPS_2D_PRESENT
|
||||
#include "../../props_2d/props/prop_2d_data.h"
|
||||
#endif
|
||||
|
||||
class Terrain2DStructure;
|
||||
class Terrain2DChunk;
|
||||
class PropData;
|
||||
class Prop2DData;
|
||||
|
||||
class Terrain2DWorld : public Navigation {
|
||||
GDCLASS(Terrain2DWorld, Navigation);
|
||||
@ -169,8 +169,8 @@ public:
|
||||
void generation_remove_index(const int index);
|
||||
int generation_get_size() const;
|
||||
|
||||
#if PROPS_PRESENT
|
||||
void prop_add(Transform transform, const Ref<PropData> &prop, const bool apply_voxel_scale = true);
|
||||
#if PROPS_2D_PRESENT
|
||||
void prop_add(Transform transform, const Ref<Prop2DData> &prop, const bool apply_voxel_scale = true);
|
||||
#endif
|
||||
|
||||
//Lights
|
||||
|
Loading…
Reference in New Issue
Block a user