From 70b082c0d9a554c47a5b3a8d5f01153ec3ab7222 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Wed, 14 Feb 2018 19:25:32 -0800 Subject: [PATCH] Create and return LightmapCapture. (cherry picked from commit 2e66730061bd4b0a84f50df9bcc50b8fe6015d2f) --- drivers/dummy/rasterizer_dummy.h | 73 ++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index 1e9c7971598..4a7b8fd3a42 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -451,24 +451,70 @@ public: void gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) {} /* LIGHTMAP CAPTURE */ - struct LightmapCaptureOctree { + struct Instantiable : public RID_Data { - enum { - CHILD_EMPTY = 0xFFFFFFFF - }; + SelfList::List instance_list; - uint16_t light[6][3]; //anisotropic light - float alpha; - uint32_t children[8]; + _FORCE_INLINE_ void instance_change_notify() { + + SelfList *instances = instance_list.first(); + while (instances) { + + instances->self()->base_changed(); + instances = instances->next(); + } + } + + _FORCE_INLINE_ void instance_material_change_notify() { + + SelfList *instances = instance_list.first(); + while (instances) { + + instances->self()->base_material_changed(); + instances = instances->next(); + } + } + + _FORCE_INLINE_ void instance_remove_deps() { + SelfList *instances = instance_list.first(); + while (instances) { + + SelfList *next = instances->next(); + instances->self()->base_removed(); + instances = next; + } + } + + Instantiable() {} + virtual ~Instantiable() { + } }; - RID lightmap_capture_create() { return RID(); } + struct LightmapCapture : public Instantiable { + + PoolVector octree; + AABB bounds; + Transform cell_xform; + int cell_subdiv; + float energy; + LightmapCapture() { + energy = 1.0; + cell_subdiv = 1; + } + }; + + mutable RID_Owner lightmap_capture_data_owner; void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {} AABB lightmap_capture_get_bounds(RID p_capture) const { return AABB(); } void lightmap_capture_set_octree(RID p_capture, const PoolVector &p_octree) {} + RID lightmap_capture_create() { + LightmapCapture *capture = memnew(LightmapCapture); + return lightmap_capture_data_owner.make_rid(capture); + } PoolVector lightmap_capture_get_octree(RID p_capture) const { - PoolVector p; - return p; + const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); + ERR_FAIL_COND_V(!capture, PoolVector()); + return PoolVector(); } void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) {} Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const { return Transform(); } @@ -476,9 +522,10 @@ public: int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const { return 0; } void lightmap_capture_set_energy(RID p_capture, float p_energy) {} float lightmap_capture_get_energy(RID p_capture) const { return 0.0; } - const PoolVector *lightmap_capture_get_octree_ptr(RID p_capture) const { - PoolVector p; - return &p; + const PoolVector *lightmap_capture_get_octree_ptr(RID p_capture) const { + const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); + ERR_FAIL_COND_V(!capture, NULL); + return &capture->octree; } /* PARTICLES */