mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Set up transform notification for VertexLight2D.
This commit is contained in:
parent
9ce6ebc1b5
commit
9df448113d
@ -36,7 +36,7 @@ Color VertexLight2D::get_color() {
|
||||
}
|
||||
void VertexLight2D::set_color(const Color &p_color) {
|
||||
_color = p_color;
|
||||
|
||||
|
||||
VertexLights2DServer::get_singleton()->light_set_color(_vertex_light, _color);
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ VertexLight2D::VertexLight2DMode VertexLight2D::get_mode() {
|
||||
}
|
||||
void VertexLight2D::set_mode(const VertexLight2D::VertexLight2DMode p_mode) {
|
||||
_mode = p_mode;
|
||||
|
||||
|
||||
VertexLights2DServer::get_singleton()->light_set_mode(_vertex_light, (VertexLights2DServer::VertexLight2DMode)_mode);
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ Vector2i VertexLight2D::get_z_range() {
|
||||
}
|
||||
void VertexLight2D::set_z_range(const Vector2i &p_z_range) {
|
||||
_z_range = p_z_range;
|
||||
|
||||
|
||||
VertexLights2DServer::get_singleton()->light_set_z_range(_vertex_light, _z_range);
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ Vector2i VertexLight2D::get_layer_range() {
|
||||
}
|
||||
void VertexLight2D::set_layer_range(const Vector2i &p_layer_range) {
|
||||
_layer_range = p_layer_range;
|
||||
|
||||
|
||||
VertexLights2DServer::get_singleton()->light_set_layer_range(_vertex_light, _layer_range);
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ int VertexLight2D::get_item_cull_mask() {
|
||||
}
|
||||
void VertexLight2D::set_item_cull_mask(const int p_item_cull_mask) {
|
||||
_item_cull_mask = p_item_cull_mask;
|
||||
|
||||
|
||||
VertexLights2DServer::get_singleton()->light_set_item_cull_mask(_vertex_light, _item_cull_mask);
|
||||
}
|
||||
|
||||
@ -83,12 +83,22 @@ VertexLight2D::VertexLight2D() {
|
||||
_item_cull_mask = 1;
|
||||
_z_range = Vector2i(-1024, 1024);
|
||||
_mode = VERTEX_LIGHT_2D_MODE_ADD;
|
||||
|
||||
set_notify_transform(true);
|
||||
}
|
||||
|
||||
VertexLight2D::~VertexLight2D() {
|
||||
VertexLights2DServer::get_singleton()->free(_vertex_light);
|
||||
}
|
||||
|
||||
void VertexLight2D::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||
VertexLights2DServer::get_singleton()->light_set_position(_vertex_light, get_global_transform().get_origin());
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void VertexLight2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_color"), &VertexLight2D::get_color);
|
||||
ClassDB::bind_method(D_METHOD("set_color", "color"), &VertexLight2D::set_color);
|
||||
|
@ -71,6 +71,8 @@ public:
|
||||
~VertexLight2D();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
RID _vertex_light;
|
||||
|
Loading…
Reference in New Issue
Block a user