mirror of
https://github.com/Relintai/props.git
synced 2025-02-14 16:50:05 +01:00
Addes api for lights to PropInstancePropJob. Also now PropInstanceMerger will process lights.
This commit is contained in:
parent
51ee053eed
commit
db6171c48f
@ -50,6 +50,7 @@ typedef class RenderingServer VS;
|
|||||||
#include "./props/prop_data_scene.h"
|
#include "./props/prop_data_scene.h"
|
||||||
#include "jobs/prop_mesher_job_step.h"
|
#include "jobs/prop_mesher_job_step.h"
|
||||||
#include "material_cache/prop_material_cache.h"
|
#include "material_cache/prop_material_cache.h"
|
||||||
|
#include "lights/prop_light.h"
|
||||||
|
|
||||||
#if TEXTURE_PACKER_PRESENT
|
#if TEXTURE_PACKER_PRESENT
|
||||||
#include "./singleton/prop_cache.h"
|
#include "./singleton/prop_cache.h"
|
||||||
@ -516,24 +517,24 @@ void PropInstanceMerger::_prop_preprocess(Transform transform, const Ref<PropDat
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
//Will create a Terralight node, and prop
|
//Will create a Terralight node, and prop
|
||||||
//PropDataLight could use standard godot light nodes
|
//PropDataLight could use standard godot light nodes
|
||||||
Ref<PropDataLight> light_data = entry;
|
Ref<PropDataLight> light_data = e;
|
||||||
|
|
||||||
if (light_data.is_valid()) {
|
if (light_data.is_valid()) {
|
||||||
Ref<VoxelLight> light;
|
Ref<PropLight> light;
|
||||||
light.instance();
|
light.instance();
|
||||||
|
|
||||||
light->set_world_position(wp.x / get_voxel_scale(), wp.y / get_voxel_scale(), wp.z / get_voxel_scale());
|
Vector3 v = t.xform(Vector3());
|
||||||
|
|
||||||
|
light->set_position(v);
|
||||||
light->set_color(light_data->get_light_color());
|
light->set_color(light_data->get_light_color());
|
||||||
light->set_size(light_data->get_light_size());
|
light->set_size(light_data->get_light_size());
|
||||||
|
|
||||||
light_add(light);
|
_job->add_light(light);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
#if MESH_DATA_RESOURCE_PRESENT
|
#if MESH_DATA_RESOURCE_PRESENT
|
||||||
Ref<PropDataMeshData> mesh_data = e;
|
Ref<PropDataMeshData> mesh_data = e;
|
||||||
|
@ -37,6 +37,7 @@ SOFTWARE.
|
|||||||
#include "prop_mesher.h"
|
#include "prop_mesher.h"
|
||||||
#include "singleton/prop_cache.h"
|
#include "singleton/prop_cache.h"
|
||||||
#include "scene/resources/shape.h"
|
#include "scene/resources/shape.h"
|
||||||
|
#include "lights/prop_light.h"
|
||||||
|
|
||||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||||
#include "../mesh_data_resource/mesh_data_resource.h"
|
#include "../mesh_data_resource/mesh_data_resource.h"
|
||||||
@ -131,6 +132,14 @@ void PropInstancePropJob::clear_meshes() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void PropInstancePropJob::add_light(const Ref<PropLight> &light) {
|
||||||
|
_prop_mesher->add_light(light);
|
||||||
|
}
|
||||||
|
void PropInstancePropJob::clear_lights() {
|
||||||
|
_prop_mesher->clear_lights();
|
||||||
|
}
|
||||||
|
|
||||||
void PropInstancePropJob::phase_physics_process() {
|
void PropInstancePropJob::phase_physics_process() {
|
||||||
//TODO this should only update the differences
|
//TODO this should only update the differences
|
||||||
for (int i = 0; i < _prop_instace->collider_get_num(); ++i) {
|
for (int i = 0; i < _prop_instace->collider_get_num(); ++i) {
|
||||||
@ -726,5 +735,8 @@ void PropInstancePropJob::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("set_prop_mesher", "mesher"), &PropInstancePropJob::set_prop_mesher);
|
ClassDB::bind_method(D_METHOD("set_prop_mesher", "mesher"), &PropInstancePropJob::set_prop_mesher);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_mesher", PROPERTY_HINT_RESOURCE_TYPE, "PropMesher", 0), "set_prop_mesher", "get_prop_mesher");
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_mesher", PROPERTY_HINT_RESOURCE_TYPE, "PropMesher", 0), "set_prop_mesher", "get_prop_mesher");
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("add_light", "light"), &PropInstancePropJob::add_light);
|
||||||
|
ClassDB::bind_method(D_METHOD("clear_lights"), &PropInstancePropJob::clear_lights);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("_physics_process", "delta"), &PropInstancePropJob::_physics_process);
|
ClassDB::bind_method(D_METHOD("_physics_process", "delta"), &PropInstancePropJob::_physics_process);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ class PropInstanceMerger;
|
|||||||
class PropMesherJobStep;
|
class PropMesherJobStep;
|
||||||
class PropMaterialCache;
|
class PropMaterialCache;
|
||||||
class Shape;
|
class Shape;
|
||||||
|
class PropLight;
|
||||||
|
|
||||||
#if MESH_DATA_RESOURCE_PRESENT
|
#if MESH_DATA_RESOURCE_PRESENT
|
||||||
class PropDataMeshData;
|
class PropDataMeshData;
|
||||||
@ -64,6 +65,9 @@ public:
|
|||||||
void clear_meshes();
|
void clear_meshes();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void add_light(const Ref<PropLight> &light);
|
||||||
|
void clear_lights();
|
||||||
|
|
||||||
void phase_physics_process();
|
void phase_physics_process();
|
||||||
void phase_prop();
|
void phase_prop();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user