|
@@ -52,6 +52,9 @@ void NoiseTexture::_bind_methods() {
|
|
|
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("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("get_seamless"), &NoiseTexture::get_seamless);
|
|
|
|
|
@@ -71,6 +74,7 @@ void NoiseTexture::_bind_methods() {
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "as_normal_map"), "set_as_normal_map", "is_normal_map");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "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::VECTOR2, "noise_offset"), "set_noise_offset", "get_noise_offset");
|
|
|
}
|
|
|
|
|
|
void NoiseTexture::_validate_property(PropertyInfo &property) const {
|
|
@@ -130,7 +134,7 @@ Ref<Image> NoiseTexture::_generate_texture() {
|
|
|
if (seamless) {
|
|
|
image = ref_noise->get_seamless_image(size.x);
|
|
|
} else {
|
|
|
- image = ref_noise->get_image(size.x, size.y);
|
|
|
+ image = ref_noise->get_image(size.x, size.y, noise_offset);
|
|
|
}
|
|
|
|
|
|
if (as_normal_map) {
|
|
@@ -198,6 +202,14 @@ void NoiseTexture::set_height(int p_height) {
|
|
|
_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) {
|
|
|
if (p_seamless == seamless) {
|
|
|
return;
|
|
@@ -245,6 +257,10 @@ int NoiseTexture::get_height() const {
|
|
|
return size.y;
|
|
|
}
|
|
|
|
|
|
+Vector2 NoiseTexture::get_noise_offset() const {
|
|
|
+ return noise_offset;
|
|
|
+}
|
|
|
+
|
|
|
RID NoiseTexture::get_rid() const {
|
|
|
if (!texture.is_valid()) {
|
|
|
texture = RS::get_singleton()->texture_2d_placeholder_create();
|