mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-26 21:57:16 +01:00
Added missing z_index parameter to VertexLights2DServer::sample_light().
This commit is contained in:
parent
7f5b9650d9
commit
2007ef0f90
@ -245,6 +245,7 @@
|
||||
<argument index="1" name="position" type="Vector2" />
|
||||
<argument index="2" name="item_cull_mask" type="int" default="1" />
|
||||
<argument index="3" name="layer" type="int" default="0" />
|
||||
<argument index="4" name="z_index" type="int" default="0" />
|
||||
<description>
|
||||
Sample the lighing information at a specific position.
|
||||
</description>
|
||||
|
@ -39,7 +39,7 @@ void VertexLights2DServer::VertexLightQuadrant2D::get_lights(List<VertexLightDat
|
||||
}
|
||||
}
|
||||
|
||||
Color VertexLights2DServer::VertexLightQuadrant2D::sample_light(const Color &p_current_color, const Vector2 &p_position, const int p_item_cull_mask, const int p_layer) {
|
||||
Color VertexLights2DServer::VertexLightQuadrant2D::sample_light(const Color &p_current_color, const Vector2 &p_position, const int p_item_cull_mask, const int p_layer, const int p_z_index) {
|
||||
Color c = p_current_color;
|
||||
|
||||
for (uint32_t i = 0; i < lights.size(); ++i) {
|
||||
@ -61,7 +61,9 @@ Color VertexLights2DServer::VertexLightQuadrant2D::sample_light(const Color &p_c
|
||||
continue;
|
||||
}
|
||||
|
||||
//TODO z_range
|
||||
if (p_z_index < l->z_range.x || p_z_index > l->z_range.y) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Vector2 light_to_pos = p_position - l->position;
|
||||
|
||||
@ -185,7 +187,7 @@ void VertexLights2DServer::VertexLightMap2D::clear() {
|
||||
}
|
||||
}
|
||||
|
||||
Color VertexLights2DServer::VertexLightMap2D::sample_light(const Vector2 &p_position, const int p_item_cull_mask, const int p_layer) {
|
||||
Color VertexLights2DServer::VertexLightMap2D::sample_light(const Vector2 &p_position, const int p_item_cull_mask, const int p_layer, const int p_z_index) {
|
||||
Color c = base_color;
|
||||
|
||||
Vector2i quadrant_position = to_quadrant_position(p_position);
|
||||
@ -197,7 +199,7 @@ Color VertexLights2DServer::VertexLightMap2D::sample_light(const Vector2 &p_posi
|
||||
if (quadrants.has(qp)) {
|
||||
VertexLightQuadrant2D *q = quadrants[qp];
|
||||
|
||||
c = q->sample_light(c, p_position, p_item_cull_mask, p_layer);
|
||||
c = q->sample_light(c, p_position, p_item_cull_mask, p_layer, p_z_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -294,11 +294,11 @@ void VertexLights2DServer::light_set_item_cull_mask(RID p_light, const int p_ite
|
||||
|
||||
// Sampling
|
||||
|
||||
Color VertexLights2DServer::sample_light(RID p_map, const Vector2 &p_position, const int p_item_cull_mask, const int p_layer) {
|
||||
Color VertexLights2DServer::sample_light(RID p_map, const Vector2 &p_position, const int p_item_cull_mask, const int p_layer, const int p_z_index) {
|
||||
VertexLightMap2D *map = map_owner.getornull(p_map);
|
||||
ERR_FAIL_COND_V(map == NULL, Color());
|
||||
|
||||
return map->sample_light(p_position, p_item_cull_mask, p_layer);
|
||||
return map->sample_light(p_position, p_item_cull_mask, p_layer, p_z_index);
|
||||
}
|
||||
|
||||
// Rest
|
||||
@ -432,9 +432,9 @@ void VertexLights2DServer::_bind_methods() {
|
||||
|
||||
// Sampling
|
||||
|
||||
ClassDB::bind_method(D_METHOD("sample_light", "map", "position", "item_cull_mask", "layer"), &VertexLights2DServer::sample_light, DEFVAL(1), DEFVAL(0));
|
||||
ClassDB::bind_method(D_METHOD("sample_light", "map", "position", "item_cull_mask", "layer", "z_index"), &VertexLights2DServer::sample_light, DEFVAL(1), DEFVAL(0), DEFVAL(0));
|
||||
|
||||
// Rest
|
||||
// Rest, DEFVAL(0)
|
||||
|
||||
ClassDB::bind_method(D_METHOD("free", "rid"), &VertexLights2DServer::free);
|
||||
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
|
||||
// Sampling
|
||||
|
||||
Color sample_light(RID p_map, const Vector2 &p_position, const int p_item_cull_mask = 1, const int p_layer = 0);
|
||||
Color sample_light(RID p_map, const Vector2 &p_position, const int p_item_cull_mask = 1, const int p_layer = 0, const int p_z_index = 0);
|
||||
|
||||
// Rest
|
||||
|
||||
@ -175,7 +175,7 @@ protected:
|
||||
|
||||
void get_lights(List<VertexLightData2D *> *p_lights);
|
||||
|
||||
Color sample_light(const Color &p_current_color, const Vector2 &p_local_position, const int p_item_cull_mask, const int p_layer);
|
||||
Color sample_light(const Color &p_current_color, const Vector2 &p_local_position, const int p_item_cull_mask, const int p_layer, const int p_z_index);
|
||||
|
||||
VertexLightQuadrant2D() {
|
||||
map = NULL;
|
||||
@ -203,7 +203,7 @@ protected:
|
||||
|
||||
void clear();
|
||||
|
||||
Color sample_light(const Vector2 &p_position, const int p_item_cull_mask = 1, const int p_layer = 0);
|
||||
Color sample_light(const Vector2 &p_position, const int p_item_cull_mask = 1, const int p_layer = 0, const int p_z_index = 0);
|
||||
|
||||
_FORCE_INLINE_ Vector2i to_quadrant_position(const Vector2 &p_position) {
|
||||
return Vector2i(p_position.x / quadrant_size.x, p_position.y / quadrant_size.y);
|
||||
|
Loading…
Reference in New Issue
Block a user