|
@@ -62,6 +62,9 @@ void NoiseTexture::_bind_methods() {
|
|
ClassDB::bind_method(D_METHOD("set_noise", "noise"), &NoiseTexture::set_noise);
|
|
ClassDB::bind_method(D_METHOD("set_noise", "noise"), &NoiseTexture::set_noise);
|
|
ClassDB::bind_method(D_METHOD("get_noise"), &NoiseTexture::get_noise);
|
|
ClassDB::bind_method(D_METHOD("get_noise"), &NoiseTexture::get_noise);
|
|
|
|
|
|
|
|
+ ClassDB::bind_method(D_METHOD("set_noise_offset", "noise_offset"), &NoiseTexture::set_noise_offset);
|
|
|
|
+ ClassDB::bind_method(D_METHOD("get_noise_offset"), &NoiseTexture::get_noise_offset);
|
|
|
|
+
|
|
ClassDB::bind_method(D_METHOD("set_seamless", "seamless"), &NoiseTexture::set_seamless);
|
|
ClassDB::bind_method(D_METHOD("set_seamless", "seamless"), &NoiseTexture::set_seamless);
|
|
ClassDB::bind_method(D_METHOD("get_seamless"), &NoiseTexture::get_seamless);
|
|
ClassDB::bind_method(D_METHOD("get_seamless"), &NoiseTexture::get_seamless);
|
|
|
|
|
|
@@ -82,6 +85,7 @@ void NoiseTexture::_bind_methods() {
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "as_normalmap"), "set_as_normalmap", "is_normalmap");
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "as_normalmap"), "set_as_normalmap", "is_normalmap");
|
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bump_strength", PROPERTY_HINT_RANGE, "0,32,0.1,or_greater"), "set_bump_strength", "get_bump_strength");
|
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bump_strength", PROPERTY_HINT_RANGE, "0,32,0.1,or_greater"), "set_bump_strength", "get_bump_strength");
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "OpenSimplexNoise"), "set_noise", "get_noise");
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "OpenSimplexNoise"), "set_noise", "get_noise");
|
|
|
|
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "noise_offset"), "set_noise_offset", "get_noise_offset");
|
|
}
|
|
}
|
|
|
|
|
|
void NoiseTexture::_validate_property(PropertyInfo &property) const {
|
|
void NoiseTexture::_validate_property(PropertyInfo &property) const {
|
|
@@ -137,7 +141,7 @@ Ref<Image> NoiseTexture::_generate_texture() {
|
|
if (seamless) {
|
|
if (seamless) {
|
|
image = ref_noise->get_seamless_image(size.x);
|
|
image = ref_noise->get_seamless_image(size.x);
|
|
} else {
|
|
} else {
|
|
- image = ref_noise->get_image(size.x, size.y);
|
|
|
|
|
|
+ image = ref_noise->get_image(size.x, size.y, noise_offset);
|
|
}
|
|
}
|
|
|
|
|
|
if (as_normalmap) {
|
|
if (as_normalmap) {
|
|
@@ -205,6 +209,14 @@ void NoiseTexture::set_height(int p_height) {
|
|
_queue_update();
|
|
_queue_update();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void NoiseTexture::set_noise_offset(Vector2 p_noise_offset) {
|
|
|
|
+ if (noise_offset == p_noise_offset) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ noise_offset = p_noise_offset;
|
|
|
|
+ _queue_update();
|
|
|
|
+}
|
|
|
|
+
|
|
void NoiseTexture::set_seamless(bool p_seamless) {
|
|
void NoiseTexture::set_seamless(bool p_seamless) {
|
|
if (p_seamless == seamless) {
|
|
if (p_seamless == seamless) {
|
|
return;
|
|
return;
|
|
@@ -252,6 +264,10 @@ int NoiseTexture::get_height() const {
|
|
return size.y;
|
|
return size.y;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+Vector2 NoiseTexture::get_noise_offset() const {
|
|
|
|
+ return noise_offset;
|
|
|
|
+}
|
|
|
|
+
|
|
void NoiseTexture::set_flags(uint32_t p_flags) {
|
|
void NoiseTexture::set_flags(uint32_t p_flags) {
|
|
flags = p_flags;
|
|
flags = p_flags;
|
|
VS::get_singleton()->texture_set_flags(texture, flags);
|
|
VS::get_singleton()->texture_set_flags(texture, flags);
|