mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-14 14:41:15 +01:00
Moved away from the MESH_DATA_RESOURCE_PRESENT define aswell.
This commit is contained in:
parent
73742e947d
commit
2fdaacfa66
@ -4,9 +4,6 @@ Import('env')
|
||||
|
||||
module_env = env.Clone()
|
||||
|
||||
if os.path.isdir('../mesh_data_resource'):
|
||||
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
|
||||
|
||||
sources = [
|
||||
"register_types.cpp",
|
||||
|
||||
|
@ -24,6 +24,8 @@ SOFTWARE.
|
||||
|
||||
#include "../../singletons/ess.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
const String ModelVisualEntry::BINDING_STRING_MODEL_VISUAL_ENTRY_TYPES = "Bone,Attachment";
|
||||
|
||||
ModelVisualEntry::ModenVisualEntryType ModelVisualEntry::get_type() const {
|
||||
@ -61,7 +63,7 @@ void ModelVisualEntry::set_group(const int value) {
|
||||
_group = value;
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<MeshDataResource> ModelVisualEntry::get_mesh(const int index) {
|
||||
ERR_FAIL_INDEX_V(index, _entries.size(), Ref<MeshDataResource>());
|
||||
|
||||
@ -155,7 +157,7 @@ bool ModelVisualEntry::_set(const StringName &p_name, const Variant &p_value) {
|
||||
_entries.write[index].texture = p_value;
|
||||
|
||||
return true;
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
} else if (p == "mesh") {
|
||||
_entries.write[index].mesh = p_value;
|
||||
|
||||
@ -194,7 +196,7 @@ bool ModelVisualEntry::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
r_ret = _entries[index].texture;
|
||||
|
||||
return true;
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
} else if (p == "mesh") {
|
||||
r_ret = _entries[index].mesh;
|
||||
|
||||
@ -220,7 +222,7 @@ bool ModelVisualEntry::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
void ModelVisualEntry::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
for (int i = 0; i < _entries.size(); ++i) {
|
||||
if (_type == ModelVisualEntry::MODEL_VISUAL_ENTRY_TYPE_BONE) {
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "entry_" + itos(i) + "/mesh", PROPERTY_HINT_RESOURCE_TYPE, "MeshDataResource", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
|
||||
#endif
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "entry_" + itos(i) + "/texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
|
||||
@ -282,7 +284,7 @@ void ModelVisualEntry::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_group", "value"), &ModelVisualEntry::set_group);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "group", PROPERTY_HINT_ENUM), "set_group", "get_group");
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("get_mesh", "index"), &ModelVisualEntry::get_mesh);
|
||||
ClassDB::bind_method(D_METHOD("set_mesh", "index", "value"), &ModelVisualEntry::set_mesh);
|
||||
#endif
|
||||
|
@ -34,7 +34,9 @@ SOFTWARE.
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -65,7 +67,7 @@ public:
|
||||
int get_group() const;
|
||||
void set_group(const int value);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<MeshDataResource> get_mesh(const int index);
|
||||
void set_mesh(const int index, const Ref<MeshDataResource> &mesh);
|
||||
#endif
|
||||
@ -90,7 +92,7 @@ public:
|
||||
|
||||
protected:
|
||||
struct MVEE {
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<MeshDataResource> mesh;
|
||||
#endif
|
||||
Ref<Texture> texture;
|
||||
@ -104,7 +106,7 @@ protected:
|
||||
}
|
||||
|
||||
~MVEE() {
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
mesh.unref();
|
||||
#endif
|
||||
texture.unref();
|
||||
|
@ -30,7 +30,7 @@ SOFTWARE.
|
||||
#include "../../props/props/prop_data_tiled_wall.h"
|
||||
#include "../../props/tiled_wall/tiled_wall_data.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
@ -180,7 +180,7 @@ void ESSMaterialCache::prop_add_textures(const Ref<PropData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
@ -221,7 +221,7 @@ void ESSMaterialCache::prop_remove_textures(const Ref<PropData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
|
@ -5,9 +5,6 @@ Import('env')
|
||||
|
||||
module_env = env.Clone()
|
||||
|
||||
if os.path.isdir('../mesh_data_resource'):
|
||||
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
|
||||
|
||||
sources = [
|
||||
"register_types.cpp",
|
||||
"mesh_utils.cpp",
|
||||
|
@ -26,6 +26,8 @@ SOFTWARE.
|
||||
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
bool MeshMerger::Vertex::operator==(const Vertex &p_vertex) const {
|
||||
if (vertex != p_vertex.vertex)
|
||||
return false;
|
||||
@ -432,7 +434,7 @@ void MeshMerger::reset() {
|
||||
_last_tangent = Plane();
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
|
||||
void MeshMerger::add_mesh_data_resource(Ref<MeshDataResource> mesh, const Transform transform, Rect2 uv_rect) {
|
||||
ERR_FAIL_COND(mesh->get_array().size() == 0);
|
||||
@ -933,7 +935,7 @@ void MeshMerger::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_uv_margin", "value"), &MeshMerger::set_uv_margin);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "uv_margin"), "set_uv_margin", "get_uv_margin");
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource", "mesh", "transform", "uv_rect"), &MeshMerger::add_mesh_data_resource, DEFVAL(Transform()), DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_bone", "mesh", "bones", "wrights", "transform", "uv_rect"), &MeshMerger::add_mesh_data_resource_bone, DEFVAL(Transform()), DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
#endif
|
||||
|
@ -40,7 +40,9 @@ SOFTWARE.
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -103,7 +105,7 @@ public:
|
||||
|
||||
void reset();
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void add_mesh_data_resource(Ref<MeshDataResource> mesh, const Transform transform = Transform(), const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_bone(Ref<MeshDataResource> mesh, const Vector<int> &bones, const Vector<float> &weights, const Transform transform = Transform(), const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
#endif
|
||||
|
@ -6,9 +6,6 @@ module_env = env.Clone()
|
||||
|
||||
import version
|
||||
|
||||
if os.path.isdir('../mesh_data_resource'):
|
||||
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
|
||||
|
||||
if os.path.isdir('../mesh_utils'):
|
||||
module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT'])
|
||||
|
||||
|
@ -28,7 +28,9 @@ SOFTWARE.
|
||||
#include "../singleton/prop_cache.h"
|
||||
#include "../tiled_wall/tiled_wall_data.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
@ -173,7 +175,7 @@ void PropMaterialCache::prop_add_textures(const Ref<PropData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
@ -214,7 +216,7 @@ void PropMaterialCache::prop_remove_textures(const Ref<PropData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
|
@ -4,7 +4,9 @@
|
||||
|
||||
#include "scene/3d/light.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
@ -195,7 +197,7 @@ void PropInstance::_prop_preprocess(Transform transform, const Ref<PropData> &pr
|
||||
continue;
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> mesh_data = e;
|
||||
|
||||
if (mesh_data.is_valid()) {
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "./singleton/prop_cache.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
@ -669,7 +669,7 @@ void PropInstanceMerger::_prop_preprocess(Transform transform, const Ref<PropDat
|
||||
continue;
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> mesh_data = e;
|
||||
|
||||
if (mesh_data.is_valid()) {
|
||||
|
@ -35,7 +35,7 @@ SOFTWARE.
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -47,7 +47,7 @@ SOFTWARE.
|
||||
#include "../texture_packer/texture_packer.h"
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
@ -114,7 +114,7 @@ void PropInstancePropJob::set_prop_mesher(const Ref<PropMesher> &mesher) {
|
||||
_prop_mesher = mesher;
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void PropInstancePropJob::add_mesh(const Ref<PropDataMeshData> &mesh_data, const Transform &base_transform) {
|
||||
PMDREntry e;
|
||||
e.mesh_data = mesh_data;
|
||||
@ -150,7 +150,7 @@ void PropInstancePropJob::clear_lights() {
|
||||
void PropInstancePropJob::_physics_process(float delta) {
|
||||
if (_phase == 0) {
|
||||
phase_physics_process();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PropInstancePropJob::_execute_phase() {
|
||||
@ -161,7 +161,7 @@ void PropInstancePropJob::_execute_phase() {
|
||||
finished();
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
if (_prop_mesh_datas.size() == 0 && _prop_tiled_wall_datas.size() == 0) {
|
||||
//reset_meshes();
|
||||
set_complete(true);
|
||||
@ -200,7 +200,9 @@ void PropInstancePropJob::_reset() {
|
||||
|
||||
_prop_tiled_wall_datas.clear();
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
_prop_mesh_datas.clear();
|
||||
#endif
|
||||
clear_collision_shapes();
|
||||
|
||||
set_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS);
|
||||
@ -291,14 +293,18 @@ void PropInstancePropJob::phase_prop() {
|
||||
}
|
||||
|
||||
if (should_do()) {
|
||||
if (_prop_mesh_datas.size() == 0 && _prop_tiled_wall_datas.size() == 0) {
|
||||
if (
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
_prop_mesh_datas.size() == 0 &&
|
||||
#endif
|
||||
_prop_tiled_wall_datas.size() == 0) {
|
||||
//reset_meshes();
|
||||
reset_stages();
|
||||
set_complete(true); //So threadpool knows it's done
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < _prop_mesh_datas.size(); ++i) {
|
||||
PMDREntry &e = _prop_mesh_datas.write[i];
|
||||
|
||||
@ -419,7 +425,7 @@ void PropInstancePropJob::phase_steps() {
|
||||
|
||||
if (RS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) {
|
||||
RS::get_singleton()->mesh_remove_surface(mesh_rid, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -605,7 +611,7 @@ Array PropInstancePropJob::merge_mesh_array(Array arr) const {
|
||||
|
||||
if (Math::is_equal_approx(v.x, vc.x) && Math::is_equal_approx(v.y, vc.y) && Math::is_equal_approx(v.z, vc.z)) {
|
||||
equals.push_back(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < equals.size(); ++k) {
|
||||
@ -616,22 +622,22 @@ Array PropInstancePropJob::merge_mesh_array(Array arr) const {
|
||||
|
||||
if (has_normals) {
|
||||
normals.remove(remk);
|
||||
}
|
||||
}
|
||||
if (has_uvs) {
|
||||
uvs.remove(remk);
|
||||
}
|
||||
}
|
||||
if (has_colors) {
|
||||
colors.remove(remk);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < indices.size(); ++j) {
|
||||
int indx = indices[j];
|
||||
|
||||
if (indx == remk) {
|
||||
indices.set(j, i);
|
||||
} else if (indx > remk) {
|
||||
} else if (indx > remk) {
|
||||
indices.set(j, indx - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -642,13 +648,13 @@ Array PropInstancePropJob::merge_mesh_array(Array arr) const {
|
||||
|
||||
if (has_normals) {
|
||||
arr[RenderingServer::ARRAY_NORMAL] = normals;
|
||||
}
|
||||
}
|
||||
if (has_uvs) {
|
||||
arr[RenderingServer::ARRAY_TEX_UV] = uvs;
|
||||
}
|
||||
}
|
||||
if (has_colors) {
|
||||
arr[RenderingServer::ARRAY_COLOR] = colors;
|
||||
}
|
||||
}
|
||||
|
||||
arr[RenderingServer::ARRAY_INDEX] = indices;
|
||||
|
||||
@ -669,7 +675,7 @@ Array PropInstancePropJob::bake_mesh_array_uv(Array arr, Ref<Texture> tex, const
|
||||
|
||||
if (colors.size() < uvs.size()) {
|
||||
colors.resize(uvs.size());
|
||||
}
|
||||
}
|
||||
|
||||
img->lock();
|
||||
|
||||
@ -706,7 +712,7 @@ void PropInstancePropJob::reset_meshes() {
|
||||
|
||||
if (RS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) {
|
||||
RS::get_singleton()->mesh_remove_surface(mesh_rid, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ SOFTWARE.
|
||||
|
||||
#include "prop_instance_job.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
class PropMesher;
|
||||
class PropInstance;
|
||||
class PropInstanceMerger;
|
||||
@ -33,7 +35,7 @@ class Shape;
|
||||
class PropLight;
|
||||
class PropDataTiledWall;
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
class PropDataMeshData;
|
||||
#endif
|
||||
|
||||
@ -60,7 +62,7 @@ public:
|
||||
Ref<PropMesher> get_prop_mesher() const;
|
||||
void set_prop_mesher(const Ref<PropMesher> &mesher);
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void add_mesh(const Ref<PropDataMeshData> &mesh_data, const Transform &base_transform);
|
||||
void clear_meshes();
|
||||
#endif
|
||||
@ -99,7 +101,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
protected:
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
struct PMDREntry {
|
||||
Ref<PropDataMeshData> mesh_data;
|
||||
Transform base_transform;
|
||||
@ -130,7 +132,7 @@ protected:
|
||||
Ref<PropMesher> _prop_mesher;
|
||||
PropInstanceMerger *_prop_instace;
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Vector<PMDREntry> _prop_mesh_datas;
|
||||
#endif
|
||||
|
||||
|
@ -743,7 +743,7 @@ Vector2 PropMesher::transform_uv_scaled(const Vector2 &uv, const Rect2 &rect, co
|
||||
}
|
||||
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void PropMesher::add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position, const Vector3 rotation, const Vector3 scale, const Rect2 uv_rect) {
|
||||
Transform transform = Transform(Basis(rotation).scaled(scale), position);
|
||||
|
||||
@ -1488,7 +1488,7 @@ void PropMesher::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("transform_uv", "uv", "rect"), &PropMesher::transform_uv);
|
||||
ClassDB::bind_method(D_METHOD("transform_uv_scaled", "uv", "rect", "x", "y", "texture_scale"), &PropMesher::transform_uv_scaled);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource", "mesh", "position", "rotation", "scale", "uv_rect"), &PropMesher::add_mesh_data_resource, DEFVAL(Rect2(0, 0, 1, 1)), DEFVAL(Vector3(1.0, 1.0, 1.0)), DEFVAL(Vector3()), DEFVAL(Vector3()));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform", "mesh", "transform", "uv_rect"), &PropMesher::add_mesh_data_resource_transform, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform_colored", "mesh", "transform", "colors", "uv_rect"), &PropMesher::add_mesh_data_resource_transform_colored, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
|
@ -37,7 +37,7 @@ SOFTWARE.
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -136,7 +136,7 @@ public:
|
||||
Vector2 transform_uv(const Vector2 &uv, const Rect2 &rect) const;
|
||||
Vector2 transform_uv_scaled(const Vector2 &uv, const Rect2 &rect, const int x, const int y, const int texture_scale) const;
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position = Vector3(0, 0, 0), const Vector3 rotation = Vector3(0, 0, 0), const Vector3 scale = Vector3(1.0, 1.0, 1.0), const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform(Ref<MeshDataResource> mesh, const Transform transform, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform_colored(Ref<MeshDataResource> mesh, const Transform transform, const PoolColorArray &colors, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
|
@ -31,8 +31,11 @@ SOFTWARE.
|
||||
#include "scene/3d/room_manager.h"
|
||||
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/nodes/mesh_data_instance.h"
|
||||
#endif
|
||||
|
||||
@ -340,7 +343,7 @@ void PropUtils::get_mesh_arrays(Node *node, Vector<PoolVector<Vector3>> *arrs) {
|
||||
}
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
{
|
||||
MeshDataInstance *mdi = Object::cast_to<MeshDataInstance>(node);
|
||||
|
||||
|
@ -6,9 +6,6 @@ module_env = env.Clone()
|
||||
|
||||
import version
|
||||
|
||||
if os.path.isdir('../mesh_data_resource'):
|
||||
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
|
||||
|
||||
if os.path.isdir('../terraman_2d'):
|
||||
module_env.Append(CPPDEFINES=['TERRAMAN_2D_PRESENT'])
|
||||
|
||||
|
@ -28,7 +28,9 @@ SOFTWARE.
|
||||
#include "../singleton/prop_2d_cache.h"
|
||||
#include "../tiled_wall/tiled_wall_2d_data.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
//define PROPS_PRESENT, so things compile. That module's scsub will define this too while compiling,
|
||||
//but not when included from here.
|
||||
#define PROPS_2D_PRESENT 1
|
||||
@ -139,7 +141,7 @@ void Prop2DMaterialCache::prop_add_textures(const Ref<Prop2DData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<Prop2DDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
@ -180,7 +182,7 @@ void Prop2DMaterialCache::prop_remove_textures(const Ref<Prop2DData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<Prop2DDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
|
@ -4,7 +4,9 @@
|
||||
|
||||
#include "scene/3d/light.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
//define PROPS_PRESENT, so things compile. That module's scsub will define this too while compiling,
|
||||
//but not when included from here.
|
||||
#define PROPS_2D_PRESENT 1
|
||||
@ -193,7 +195,7 @@ void Prop2DInstance::_prop_preprocess(Transform2D transform, const Ref<Prop2DDat
|
||||
continue;
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
//TODO
|
||||
/*
|
||||
Ref<Prop2DDataMeshData> mesh_data = e;
|
||||
|
@ -21,7 +21,9 @@
|
||||
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
//define PROPS_PRESENT, so things compile. That module's scsub will define this too while compiling,
|
||||
//but not when included from here.
|
||||
#define PROPS_2D_PRESENT 1
|
||||
@ -458,7 +460,7 @@ void Prop2DInstanceMerger::_prop_preprocess(Transform2D transform, const Ref<Pro
|
||||
continue;
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<Prop2DDataMeshData> mesh_data = e;
|
||||
|
||||
if (mesh_data.is_valid()) {
|
||||
|
@ -30,7 +30,9 @@ SOFTWARE.
|
||||
#include "scene/resources/shape.h"
|
||||
#include "singleton/prop_2d_cache.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -42,7 +44,7 @@ SOFTWARE.
|
||||
#include "../texture_packer/texture_packer.h"
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
//define PROPS_PRESENT, so things compile. That module's scsub will define this too while compiling,
|
||||
//but not when included from here.
|
||||
#define PROPS_2D_PRESENT 1
|
||||
@ -90,7 +92,7 @@ void Prop2DInstanceProp2DJob::set_prop_mesher(const Ref<Prop2DMesher> &mesher) {
|
||||
_prop_mesher = mesher;
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void Prop2DInstanceProp2DJob::add_mesh(const Ref<Prop2DDataMeshData> &mesh_data, const Transform2D &base_transform) {
|
||||
PMDREntry e;
|
||||
e.mesh_data = mesh_data;
|
||||
@ -137,7 +139,7 @@ void Prop2DInstanceProp2DJob::_execute_phase() {
|
||||
finished();
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
if (_prop_mesh_datas.size() == 0 && _prop_tiled_wall_datas.size() == 0) {
|
||||
//reset_meshes();
|
||||
set_complete(true);
|
||||
@ -172,8 +174,9 @@ void Prop2DInstanceProp2DJob::_reset() {
|
||||
}
|
||||
|
||||
_prop_tiled_wall_datas.clear();
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
_prop_mesh_datas.clear();
|
||||
#endif
|
||||
clear_collision_shapes();
|
||||
|
||||
set_build_phase_type(BUILD_PHASE_TYPE_PHYSICS_PROCESS);
|
||||
@ -267,14 +270,19 @@ void Prop2DInstanceProp2DJob::phase_prop() {
|
||||
}
|
||||
|
||||
if (should_do()) {
|
||||
if (_prop_mesh_datas.size() == 0 && _prop_tiled_wall_datas.size() == 0) {
|
||||
if (
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
_prop_mesh_datas.size() == 0 &&
|
||||
#endif
|
||||
_prop_tiled_wall_datas.size() == 0
|
||||
) {
|
||||
//reset_meshes();
|
||||
reset_stages();
|
||||
set_complete(true); //So threadpool knows it's done
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < _prop_mesh_datas.size(); ++i) {
|
||||
PMDREntry &e = _prop_mesh_datas.write[i];
|
||||
|
||||
|
@ -26,6 +26,8 @@ SOFTWARE.
|
||||
|
||||
#include "scene/resources/shape_2d.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
class Prop2DMesher;
|
||||
class Prop2DInstance;
|
||||
class Prop2DInstanceMerger;
|
||||
@ -35,7 +37,7 @@ class Shape;
|
||||
class Prop2DLight;
|
||||
class Prop2DDataTiledWall2D;
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
class Prop2DDataMeshData;
|
||||
#endif
|
||||
|
||||
@ -56,7 +58,7 @@ public:
|
||||
Ref<Prop2DMesher> get_prop_mesher() const;
|
||||
void set_prop_mesher(const Ref<Prop2DMesher> &mesher);
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void add_mesh(const Ref<Prop2DDataMeshData> &mesh_data, const Transform2D &base_transform);
|
||||
void clear_meshes();
|
||||
#endif
|
||||
@ -90,7 +92,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
protected:
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
struct PMDREntry {
|
||||
Ref<Prop2DDataMeshData> mesh_data;
|
||||
Transform2D base_transform;
|
||||
@ -117,7 +119,7 @@ protected:
|
||||
Ref<Prop2DMesher> _prop_mesher;
|
||||
Prop2DInstanceMerger *_prop_instace;
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Vector<PMDREntry> _prop_mesh_datas;
|
||||
#endif
|
||||
|
||||
|
@ -29,6 +29,8 @@ SOFTWARE.
|
||||
#include "material_cache/prop_2d_material_cache.h"
|
||||
#include "tiled_wall/tiled_wall_2d_data.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
const String Prop2DMesher::BINDING_STRING_BUILD_FLAGS = "Use Lighting,Use AO,Use RAO,Bake Lights";
|
||||
|
||||
bool Prop2DMesher::Vertex::operator==(const Vertex &p_vertex) const {
|
||||
@ -528,7 +530,7 @@ _FORCE_INLINE_ Vector2 Prop2DMesher::transform_uv(const Vector2 &uv, const Rect2
|
||||
return ruv;
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void Prop2DMesher::add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position, const Vector3 rotation, const Vector3 scale, const Rect2 uv_rect) {
|
||||
Transform transform = Transform(Basis(rotation).scaled(scale), position);
|
||||
|
||||
@ -1170,7 +1172,7 @@ void Prop2DMesher::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("add_tiled_wall_mesh_rect_simple", "x", "y", "transform", "texture_rect"), &Prop2DMesher::add_tiled_wall_mesh_rect_simple);
|
||||
ClassDB::bind_method(D_METHOD("transform_uv", "uv", "rect"), &Prop2DMesher::transform_uv);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource", "mesh", "position", "rotation", "scale", "uv_rect"), &Prop2DMesher::add_mesh_data_resource, DEFVAL(Rect2(0, 0, 1, 1)), DEFVAL(Vector3(1.0, 1.0, 1.0)), DEFVAL(Vector3()), DEFVAL(Vector3()));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform", "mesh", "transform", "uv_rect"), &Prop2DMesher::add_mesh_data_resource_transform, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform_colored", "mesh", "transform", "colors", "uv_rect"), &Prop2DMesher::add_mesh_data_resource_transform_colored, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
|
@ -35,7 +35,9 @@ SOFTWARE.
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -122,7 +124,7 @@ public:
|
||||
void add_tiled_wall_mesh_rect_simple(const int x, const int y, const Transform2D &transform, const Rect2 &texture_uv_rect, const Vector2 &size);
|
||||
Vector2 transform_uv(const Vector2 &uv, const Rect2 &rect) const;
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position = Vector3(0, 0, 0), const Vector3 rotation = Vector3(0, 0, 0), const Vector3 scale = Vector3(1.0, 1.0, 1.0), const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform(Ref<MeshDataResource> mesh, const Transform transform, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform_colored(Ref<MeshDataResource> mesh, const Transform transform, const PoolColorArray &colors, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
|
@ -32,7 +32,9 @@ SOFTWARE.
|
||||
|
||||
#include "scene/3d/mesh_instance.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/nodes/mesh_data_instance.h"
|
||||
#endif
|
||||
|
||||
|
@ -4,9 +4,6 @@ Import('env')
|
||||
|
||||
module_env = env.Clone()
|
||||
|
||||
if os.path.isdir('../mesh_data_resource'):
|
||||
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
|
||||
|
||||
if os.path.isdir('../mesh_utils'):
|
||||
module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT'])
|
||||
|
||||
|
@ -32,7 +32,7 @@ SOFTWARE.
|
||||
|
||||
#include "../../props/props/prop_data_prop.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
@ -411,7 +411,7 @@ bool TerrainLibraryMerger::process_prop_textures(Ref<PropData> prop) {
|
||||
bool texture_added = false;
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
|
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include "../../props/props/prop_data_prop.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
@ -415,7 +415,7 @@ void TerrainLibraryMergerPCM::_prop_material_cache_get_key(Ref<TerrainChunk> chu
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<Texture> tex = chunk->mesh_data_resource_get_texture(i);
|
||||
|
||||
@ -510,7 +510,7 @@ void TerrainLibraryMergerPCM::_prop_material_cache_get_key(Ref<TerrainChunk> chu
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<Texture> tex = chunk->mesh_data_resource_get_texture(i);
|
||||
|
||||
|
@ -30,7 +30,7 @@ SOFTWARE.
|
||||
#include "../../props/props/prop_data.h"
|
||||
#include "../../props/props/prop_data_prop.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
@ -205,7 +205,7 @@ void TerrainMaterialCache::prop_add_textures(const Ref<PropData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
@ -231,7 +231,7 @@ void TerrainMaterialCache::prop_remove_textures(const Ref<PropData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
|
@ -29,6 +29,8 @@ SOFTWARE.
|
||||
#include "../world/default/terrain_chunk_default.h"
|
||||
#include "../world/terrain_chunk.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
bool TerrainMesher::Vertex::operator==(const Vertex &p_vertex) const {
|
||||
if (vertex != p_vertex.vertex)
|
||||
return false;
|
||||
@ -433,7 +435,7 @@ void TerrainMesher::add_chunk(Ref<TerrainChunk> chunk) {
|
||||
call("_add_chunk", chunk);
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void TerrainMesher::add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position, const Vector3 rotation, const Vector3 scale, const Rect2 uv_rect) {
|
||||
Transform transform = Transform(Basis(rotation).scaled(scale), position);
|
||||
|
||||
@ -992,7 +994,7 @@ void TerrainMesher::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_chunk", "chunk"), &TerrainMesher::add_chunk);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource", "mesh", "position", "rotation", "scale", "uv_rect"), &TerrainMesher::add_mesh_data_resource, DEFVAL(Rect2(0, 0, 1, 1)), DEFVAL(Vector3(1.0, 1.0, 1.0)), DEFVAL(Vector3()), DEFVAL(Vector3()));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform", "mesh", "transform", "uv_rect"), &TerrainMesher::add_mesh_data_resource_transform, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform_colored", "mesh", "transform", "colors", "uv_rect"), &TerrainMesher::add_mesh_data_resource_transform_colored, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
|
@ -39,7 +39,9 @@ SOFTWARE.
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -127,7 +129,7 @@ public:
|
||||
|
||||
void add_chunk(Ref<TerrainChunk> chunk);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position = Vector3(0, 0, 0), const Vector3 rotation = Vector3(0, 0, 0), const Vector3 scale = Vector3(1.0, 1.0, 1.0), const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform(Ref<MeshDataResource> mesh, const Transform transform, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform_colored(Ref<MeshDataResource> mesh, const Transform transform, const PoolColorArray &colors, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
|
@ -34,7 +34,9 @@ SOFTWARE.
|
||||
#include "scene/resources/world_3d.h"
|
||||
#include "servers/physics_server.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -85,7 +87,7 @@ void TerrainPropJob::phase_physics_process() {
|
||||
|
||||
chunk->colliders_clear();
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<MeshDataResource> mdr = chunk->mesh_data_resource_get(i);
|
||||
|
||||
@ -134,7 +136,7 @@ void TerrainPropJob::phase_physics_process() {
|
||||
}
|
||||
|
||||
void TerrainPropJob::phase_prop() {
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<TerrainChunkDefault> chunk = _chunk;
|
||||
|
||||
if (!get_prop_mesher().is_valid()) {
|
||||
@ -235,7 +237,7 @@ void TerrainPropJob::_execute_phase() {
|
||||
Ref<TerrainChunkDefault> chunk = _chunk;
|
||||
|
||||
if (!chunk.is_valid()
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
|| chunk->mesh_data_resource_get_count() == 0
|
||||
#endif
|
||||
) {
|
||||
@ -302,7 +304,7 @@ void TerrainPropJob::phase_setup() {
|
||||
OS::get_singleton()->delay_usec(100);
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < _chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<Texture> tex = _chunk->mesh_data_resource_get_texture(i);
|
||||
|
||||
|
@ -736,7 +736,7 @@ void TerrainChunk::props_clear() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
int TerrainChunk::mesh_data_resource_addv(const Vector3 &local_data_pos, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture, const Color &color, const bool apply_voxel_scale) {
|
||||
ERR_FAIL_COND_V(!mesh.is_valid(), 0);
|
||||
|
||||
@ -1097,7 +1097,7 @@ TerrainChunk::~TerrainChunk() {
|
||||
props_clear();
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
mesh_data_resource_clear();
|
||||
#endif
|
||||
|
||||
@ -1470,7 +1470,7 @@ void TerrainChunk::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("props_clear"), &TerrainChunk::props_clear);
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("mesh_data_resource_addv", "local_data_pos", "mesh", "texture", "color", "apply_voxel_scale"), &TerrainChunk::mesh_data_resource_addv, DEFVAL(Ref<Texture>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(true));
|
||||
ClassDB::bind_method(D_METHOD("mesh_data_resource_add", "local_transform", "mesh", "texture", "color", "apply_voxel_scale"), &TerrainChunk::mesh_data_resource_add, DEFVAL(Ref<Texture>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(true));
|
||||
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
void props_clear();
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
int mesh_data_resource_addv(const Vector3 &local_data_pos, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture = Ref<Texture>(), const Color &color = Color(1, 1, 1, 1), const bool apply_voxel_scale = true);
|
||||
int mesh_data_resource_add(const Transform &local_transform, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture = Ref<Texture>(), const Color &color = Color(1, 1, 1, 1), const bool apply_voxel_scale = true);
|
||||
|
||||
@ -310,7 +310,7 @@ protected:
|
||||
};
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
struct MeshDataResourceEntry {
|
||||
Ref<MeshDataResource> mesh;
|
||||
Ref<Texture> texture;
|
||||
@ -389,7 +389,7 @@ protected:
|
||||
Vector<PropDataStore> _props;
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Vector<MeshDataResourceEntry> _mesh_data_resources;
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,7 @@ SOFTWARE.
|
||||
#include "../../props/props/prop_data_scene.h"
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
@ -656,7 +656,7 @@ void TerrainWorld::prop_add(Transform transform, const Ref<PropData> &prop, cons
|
||||
continue;
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> mesh_data = entry;
|
||||
|
||||
if (mesh_data.is_valid()) {
|
||||
|
@ -4,9 +4,6 @@ Import('env')
|
||||
|
||||
module_env = env.Clone()
|
||||
|
||||
if os.path.isdir('../mesh_data_resource'):
|
||||
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
|
||||
|
||||
if os.path.isdir('../props_2d'):
|
||||
module_env.Append(CPPDEFINES=['PROPS_2D_PRESENT'])
|
||||
|
||||
|
@ -25,12 +25,14 @@ SOFTWARE.
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.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
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
@ -363,7 +365,7 @@ bool Terrain2DLibraryMerger::process_prop_textures(Ref<Prop2DData> prop) {
|
||||
bool texture_added = false;
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<Prop2DDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
|
@ -26,12 +26,14 @@ SOFTWARE.
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.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
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
@ -260,7 +262,7 @@ void Terrain2DLibraryMergerPCM::_prop_material_cache_get_key(Ref<Terrain2DChunk>
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<Texture> tex = chunk->mesh_data_resource_get_texture(i);
|
||||
|
||||
@ -349,7 +351,7 @@ void Terrain2DLibraryMergerPCM::_prop_material_cache_get_key(Ref<Terrain2DChunk>
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<Texture> tex = chunk->mesh_data_resource_get_texture(i);
|
||||
|
||||
|
@ -24,11 +24,13 @@ SOFTWARE.
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.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
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
@ -166,7 +168,7 @@ void Terrain2DMaterialCache::prop_add_textures(const Ref<Prop2DData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<Prop2DDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
@ -192,7 +194,7 @@ void Terrain2DMaterialCache::prop_remove_textures(const Ref<Prop2DData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<Prop2DDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
|
@ -31,6 +31,8 @@ SOFTWARE.
|
||||
#include "scene/resources/rectangle_shape_2d.h"
|
||||
#include "servers/physics_2d_server.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
bool Terrain2DMesher::Vertex::operator==(const Vertex &p_vertex) const {
|
||||
if (vertex != p_vertex.vertex)
|
||||
return false;
|
||||
@ -482,7 +484,7 @@ void Terrain2DMesher::add_chunk(Ref<Terrain2DChunk> chunk) {
|
||||
call("_add_chunk", chunk);
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void Terrain2DMesher::add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position, const Vector3 rotation, const Vector3 scale, const Rect2 uv_rect) {
|
||||
//Transform2D transform = Transform(Basis(rotation).scaled(scale), position);
|
||||
//TODO
|
||||
@ -935,7 +937,7 @@ void Terrain2DMesher::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_chunk", "chunk"), &Terrain2DMesher::add_chunk);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource", "mesh", "position", "rotation", "scale", "uv_rect"), &Terrain2DMesher::add_mesh_data_resource, DEFVAL(Rect2(0, 0, 1, 1)), DEFVAL(Vector3(1.0, 1.0, 1.0)), DEFVAL(Vector3()), DEFVAL(Vector3()));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform", "mesh", "transform", "uv_rect"), &Terrain2DMesher::add_mesh_data_resource_transform, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform_colored", "mesh", "transform", "colors", "uv_rect"), &Terrain2DMesher::add_mesh_data_resource_transform_colored, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
|
@ -38,7 +38,9 @@ SOFTWARE.
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -118,7 +120,7 @@ public:
|
||||
|
||||
void add_chunk(Ref<Terrain2DChunk> chunk);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position = Vector3(0, 0, 0), const Vector3 rotation = Vector3(0, 0, 0), const Vector3 scale = Vector3(1.0, 1.0, 1.0), const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform(Ref<MeshDataResource> mesh, const Transform2D transform, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform_colored(Ref<MeshDataResource> mesh, const Transform2D transform, const PoolColorArray &colors, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
|
@ -32,7 +32,9 @@ SOFTWARE.
|
||||
#include "../../meshers/terrain_2d_mesher.h"
|
||||
#include "../default/terrain_2d_chunk_default.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -62,7 +64,7 @@ void Terrain2DProp2DJob::phase_physics_process() {
|
||||
|
||||
chunk->colliders_clear();
|
||||
*/
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
//TODO
|
||||
/*
|
||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
||||
@ -114,7 +116,7 @@ void Terrain2DProp2DJob::phase_physics_process() {
|
||||
}
|
||||
|
||||
void Terrain2DProp2DJob::phase_prop() {
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<Terrain2DChunkDefault> chunk = _chunk;
|
||||
|
||||
if (!get_prop_mesher().is_valid()) {
|
||||
@ -218,7 +220,7 @@ void Terrain2DProp2DJob::_execute_phase() {
|
||||
Ref<Terrain2DChunkDefault> chunk = _chunk;
|
||||
|
||||
if (!chunk.is_valid()
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
|| chunk->mesh_data_resource_get_count() == 0
|
||||
#endif
|
||||
) {
|
||||
@ -282,7 +284,7 @@ void Terrain2DProp2DJob::phase_setup() {
|
||||
OS::get_singleton()->delay_usec(100);
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < _chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<Texture> tex = _chunk->mesh_data_resource_get_texture(i);
|
||||
|
||||
|
@ -34,6 +34,8 @@ SOFTWARE.
|
||||
|
||||
#include "core/os/thread_pool.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
_FORCE_INLINE_ bool Terrain2DChunk::get_process() const {
|
||||
return _is_processing;
|
||||
}
|
||||
@ -770,7 +772,7 @@ void Terrain2DChunk::props_clear() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
int Terrain2DChunk::mesh_data_resource_addv(const Vector2 &local_data_pos, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture, const Color &color, const bool apply_voxel_scale) {
|
||||
//TODO
|
||||
/*
|
||||
@ -1173,7 +1175,7 @@ Terrain2DChunk::~Terrain2DChunk() {
|
||||
props_clear();
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
mesh_data_resource_clear();
|
||||
#endif
|
||||
|
||||
@ -1590,7 +1592,7 @@ void Terrain2DChunk::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("props_clear"), &Terrain2DChunk::props_clear);
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("mesh_data_resource_addv", "local_data_pos", "mesh", "texture", "color", "apply_voxel_scale"), &Terrain2DChunk::mesh_data_resource_addv, DEFVAL(Ref<Texture>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(true));
|
||||
ClassDB::bind_method(D_METHOD("mesh_data_resource_add", "local_transform", "mesh", "texture", "color", "apply_voxel_scale"), &Terrain2DChunk::mesh_data_resource_add, DEFVAL(Ref<Texture>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(true));
|
||||
|
||||
|
@ -43,6 +43,8 @@ SOFTWARE.
|
||||
|
||||
#include "../meshers/terrain_2d_mesher.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#if PROPS_2D_PRESENT
|
||||
#include "../../props_2d/props/prop_2d_data.h"
|
||||
#endif
|
||||
@ -267,7 +269,7 @@ public:
|
||||
void props_clear();
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
int mesh_data_resource_addv(const Vector2 &local_data_pos, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture = Ref<Texture>(), const Color &color = Color(1, 1, 1, 1), const bool apply_scale = true);
|
||||
int mesh_data_resource_add(const Transform2D &local_transform, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture = Ref<Texture>(), const Color &color = Color(1, 1, 1, 1), const bool apply_scale = true);
|
||||
|
||||
@ -364,7 +366,7 @@ protected:
|
||||
};
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
struct MeshDataResourceEntry {
|
||||
Ref<MeshDataResource> mesh;
|
||||
Ref<Texture> texture;
|
||||
@ -442,7 +444,7 @@ protected:
|
||||
Vector<Prop2DDataStore> _props;
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Vector<MeshDataResourceEntry> _mesh_data_resources;
|
||||
#endif
|
||||
|
||||
|
@ -28,6 +28,8 @@ SOFTWARE.
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#if PROPS_2D_PRESENT
|
||||
#include "../../props_2d/props/prop_2d_data.h"
|
||||
#include "../../props_2d/props/prop_2d_data_entry.h"
|
||||
@ -36,7 +38,7 @@ SOFTWARE.
|
||||
#include "../../props_2d/props/prop_2d_data_scene.h"
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props_2d/prop_2d_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
@ -709,7 +711,7 @@ void Terrain2DWorld::prop_add(Transform transform, const Ref<Prop2DData> &prop,
|
||||
continue;
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<Prop2DDataMeshData> mesh_data = entry;
|
||||
|
||||
if (mesh_data.is_valid()) {
|
||||
|
@ -4,9 +4,6 @@ Import('env')
|
||||
|
||||
module_env = env.Clone()
|
||||
|
||||
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'])
|
||||
|
||||
|
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
#include "../../props/props/prop_data_prop.h"
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
@ -410,6 +410,7 @@ bool VoxelLibraryMerger::process_prop_textures(Ref<PropData> prop) {
|
||||
|
||||
bool texture_added = false;
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
@ -432,6 +433,7 @@ bool VoxelLibraryMerger::process_prop_textures(Ref<PropData> prop) {
|
||||
texture_added = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return texture_added;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include "../../props/props/prop_data_prop.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
@ -235,7 +235,7 @@ void VoxelLibraryMergerPCM::_prop_material_cache_get_key(Ref<VoxelChunk> chunk)
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<Texture> tex = chunk->mesh_data_resource_get_texture(i);
|
||||
|
||||
@ -330,7 +330,7 @@ void VoxelLibraryMergerPCM::_prop_material_cache_get_key(Ref<VoxelChunk> chunk)
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<Texture> tex = chunk->mesh_data_resource_get_texture(i);
|
||||
|
||||
@ -753,6 +753,7 @@ bool VoxelLibraryMergerPCM::process_prop_textures(Ref<PropData> prop) {
|
||||
|
||||
bool texture_added = false;
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
@ -775,6 +776,7 @@ bool VoxelLibraryMergerPCM::process_prop_textures(Ref<PropData> prop) {
|
||||
texture_added = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return texture_added;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ SOFTWARE.
|
||||
#include "../../props/props/prop_data.h"
|
||||
#include "../../props/props/prop_data_prop.h"
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
#endif
|
||||
@ -205,7 +205,7 @@ void VoxelMaterialCache::prop_add_textures(const Ref<PropData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
@ -231,7 +231,7 @@ void VoxelMaterialCache::prop_remove_textures(const Ref<PropData> &prop) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < prop->get_prop_count(); ++i) {
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> pdm = prop->get_prop(i);
|
||||
|
||||
if (pdm.is_valid()) {
|
||||
|
@ -29,6 +29,8 @@ SOFTWARE.
|
||||
#include "../world/default/voxel_chunk_default.h"
|
||||
#include "../world/voxel_chunk.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
bool VoxelMesher::Vertex::operator==(const Vertex &p_vertex) const {
|
||||
if (vertex != p_vertex.vertex)
|
||||
return false;
|
||||
@ -429,7 +431,7 @@ void VoxelMesher::add_chunk(Ref<VoxelChunk> chunk) {
|
||||
call("_add_chunk", chunk);
|
||||
}
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void VoxelMesher::add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position, const Vector3 rotation, const Vector3 scale, const Rect2 uv_rect) {
|
||||
Transform transform = Transform(Basis(rotation).scaled(scale), position);
|
||||
|
||||
@ -981,7 +983,7 @@ void VoxelMesher::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_chunk", "chunk"), &VoxelMesher::add_chunk);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource", "mesh", "position", "rotation", "scale", "uv_rect"), &VoxelMesher::add_mesh_data_resource, DEFVAL(Rect2(0, 0, 1, 1)), DEFVAL(Vector3(1.0, 1.0, 1.0)), DEFVAL(Vector3()), DEFVAL(Vector3()));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform", "mesh", "transform", "uv_rect"), &VoxelMesher::add_mesh_data_resource_transform, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
ClassDB::bind_method(D_METHOD("add_mesh_data_resource_transform_colored", "mesh", "transform", "colors", "uv_rect"), &VoxelMesher::add_mesh_data_resource_transform_colored, DEFVAL(Rect2(0, 0, 1, 1)));
|
||||
|
@ -37,7 +37,9 @@ SOFTWARE.
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -123,7 +125,7 @@ public:
|
||||
|
||||
void add_chunk(Ref<VoxelChunk> chunk);
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
void add_mesh_data_resource(Ref<MeshDataResource> mesh, const Vector3 position = Vector3(0, 0, 0), const Vector3 rotation = Vector3(0, 0, 0), const Vector3 scale = Vector3(1.0, 1.0, 1.0), const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform(Ref<MeshDataResource> mesh, const Transform transform, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
void add_mesh_data_resource_transform_colored(Ref<MeshDataResource> mesh, const Transform transform, const PoolColorArray &colors, const Rect2 uv_rect = Rect2(0, 0, 1, 1));
|
||||
|
@ -35,7 +35,9 @@ SOFTWARE.
|
||||
#include "scene/resources/world_3d.h"
|
||||
#include "servers/physics_server.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../../mesh_data_resource/mesh_data_resource.h"
|
||||
#endif
|
||||
|
||||
@ -86,7 +88,7 @@ void VoxelPropJob::phase_physics_process() {
|
||||
|
||||
chunk->colliders_clear();
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<MeshDataResource> mdr = chunk->mesh_data_resource_get(i);
|
||||
|
||||
@ -135,7 +137,7 @@ void VoxelPropJob::phase_physics_process() {
|
||||
}
|
||||
|
||||
void VoxelPropJob::phase_prop() {
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<VoxelChunkDefault> chunk = _chunk;
|
||||
|
||||
if (!get_prop_mesher().is_valid()) {
|
||||
@ -236,7 +238,7 @@ void VoxelPropJob::_execute_phase() {
|
||||
Ref<VoxelChunkDefault> chunk = _chunk;
|
||||
|
||||
if (!chunk.is_valid()
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
|| chunk->mesh_data_resource_get_count() == 0
|
||||
#endif
|
||||
) {
|
||||
@ -303,7 +305,7 @@ void VoxelPropJob::phase_setup() {
|
||||
OS::get_singleton()->delay_usec(100);
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
for (int i = 0; i < _chunk->mesh_data_resource_get_count(); ++i) {
|
||||
Ref<Texture> tex = _chunk->mesh_data_resource_get_texture(i);
|
||||
|
||||
|
@ -733,7 +733,7 @@ void VoxelChunk::props_clear() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
int VoxelChunk::mesh_data_resource_addv(const Vector3 &local_data_pos, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture, const Color &color, const bool apply_voxel_scale) {
|
||||
ERR_FAIL_COND_V(!mesh.is_valid(), 0);
|
||||
|
||||
@ -1093,7 +1093,7 @@ VoxelChunk::~VoxelChunk() {
|
||||
props_clear();
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
mesh_data_resource_clear();
|
||||
#endif
|
||||
|
||||
@ -1458,7 +1458,7 @@ void VoxelChunk::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("props_clear"), &VoxelChunk::props_clear);
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
ClassDB::bind_method(D_METHOD("mesh_data_resource_addv", "local_data_pos", "mesh", "texture", "color", "apply_voxel_scale"), &VoxelChunk::mesh_data_resource_addv, DEFVAL(Ref<Texture>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(true));
|
||||
ClassDB::bind_method(D_METHOD("mesh_data_resource_add", "local_transform", "mesh", "texture", "color", "apply_voxel_scale"), &VoxelChunk::mesh_data_resource_add, DEFVAL(Ref<Texture>()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(true));
|
||||
|
||||
|
@ -233,7 +233,7 @@ public:
|
||||
void props_clear();
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
int mesh_data_resource_addv(const Vector3 &local_data_pos, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture = Ref<Texture>(), const Color &color = Color(1, 1, 1, 1), const bool apply_voxel_scale = true);
|
||||
int mesh_data_resource_add(const Transform &local_transform, const Ref<MeshDataResource> &mesh, const Ref<Texture> &texture = Ref<Texture>(), const Color &color = Color(1, 1, 1, 1), const bool apply_voxel_scale = true);
|
||||
|
||||
@ -315,7 +315,7 @@ protected:
|
||||
};
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
struct MeshDataResourceEntry {
|
||||
Ref<MeshDataResource> mesh;
|
||||
Ref<Texture> texture;
|
||||
@ -397,7 +397,7 @@ protected:
|
||||
Vector<PropDataStore> _props;
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Vector<MeshDataResourceEntry> _mesh_data_resources;
|
||||
#endif
|
||||
|
||||
|
@ -37,7 +37,7 @@ SOFTWARE.
|
||||
#include "../../props/props/prop_data_scene.h"
|
||||
#endif
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
#include "../../mesh_data_resource/props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
@ -620,7 +620,7 @@ void VoxelWorld::prop_add(Transform tarnsform, const Ref<PropData> &prop, const
|
||||
continue;
|
||||
}
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
#ifdef MODULE_MESH_DATA_RESOURCE_ENABLED
|
||||
Ref<PropDataMeshData> mesh_data = entry;
|
||||
|
||||
if (mesh_data.is_valid()) {
|
||||
|
Loading…
Reference in New Issue
Block a user