Create and return LightmapCapture.

(cherry picked from commit 2e66730061)
This commit is contained in:
K. S. Ernest (iFire) Lee 2018-02-14 19:25:32 -08:00 committed by Hein-Pieter van Braam
parent bbfec2a7cc
commit 70b082c0d9
1 changed files with 60 additions and 13 deletions

View File

@ -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) {} 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 */ /* LIGHTMAP CAPTURE */
struct LightmapCaptureOctree { struct Instantiable : public RID_Data {
enum { SelfList<RasterizerScene::InstanceBase>::List instance_list;
CHILD_EMPTY = 0xFFFFFFFF
_FORCE_INLINE_ void instance_change_notify() {
SelfList<RasterizerScene::InstanceBase> *instances = instance_list.first();
while (instances) {
instances->self()->base_changed();
instances = instances->next();
}
}
_FORCE_INLINE_ void instance_material_change_notify() {
SelfList<RasterizerScene::InstanceBase> *instances = instance_list.first();
while (instances) {
instances->self()->base_material_changed();
instances = instances->next();
}
}
_FORCE_INLINE_ void instance_remove_deps() {
SelfList<RasterizerScene::InstanceBase> *instances = instance_list.first();
while (instances) {
SelfList<RasterizerScene::InstanceBase> *next = instances->next();
instances->self()->base_removed();
instances = next;
}
}
Instantiable() {}
virtual ~Instantiable() {
}
}; };
uint16_t light[6][3]; //anisotropic light struct LightmapCapture : public Instantiable {
float alpha;
uint32_t children[8]; PoolVector<LightmapCaptureOctree> octree;
AABB bounds;
Transform cell_xform;
int cell_subdiv;
float energy;
LightmapCapture() {
energy = 1.0;
cell_subdiv = 1;
}
}; };
RID lightmap_capture_create() { return RID(); } mutable RID_Owner<LightmapCapture> lightmap_capture_data_owner;
void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {} void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {}
AABB lightmap_capture_get_bounds(RID p_capture) const { return AABB(); } AABB lightmap_capture_get_bounds(RID p_capture) const { return AABB(); }
void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) {} void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) {}
RID lightmap_capture_create() {
LightmapCapture *capture = memnew(LightmapCapture);
return lightmap_capture_data_owner.make_rid(capture);
}
PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const { PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const {
PoolVector<uint8_t> p; const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture);
return p; ERR_FAIL_COND_V(!capture, PoolVector<uint8_t>());
return PoolVector<uint8_t>();
} }
void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) {} 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(); } 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; } int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const { return 0; }
void lightmap_capture_set_energy(RID p_capture, float p_energy) {} void lightmap_capture_set_energy(RID p_capture, float p_energy) {}
float lightmap_capture_get_energy(RID p_capture) const { return 0.0; } float lightmap_capture_get_energy(RID p_capture) const { return 0.0; }
const PoolVector<RasterizerStorage::LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const { const PoolVector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const {
PoolVector<RasterizerStorage::LightmapCaptureOctree> p; const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture);
return &p; ERR_FAIL_COND_V(!capture, NULL);
return &capture->octree;
} }
/* PARTICLES */ /* PARTICLES */