From b4a190e0bc4885e33282ba68e4970f00601fa3c9 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Wed, 23 Dec 2020 09:34:26 +0000 Subject: Consistently use normal_map --- modules/basis_universal/register_types.cpp | 2 +- modules/cvtt/image_compress_cvtt.cpp | 2 +- modules/opensimplex/doc_classes/NoiseTexture.xml | 4 ++-- modules/opensimplex/noise_texture.cpp | 26 ++++++++++++------------ modules/opensimplex/noise_texture.h | 6 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'modules') diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index 27b299a65d..dadcdabf03 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -216,7 +216,7 @@ static Ref basis_universal_unpacker(const Vector &p_buffer) { format = basist::transcoder_texture_format::cTFETC2; // get this from renderer imgfmt = Image::FORMAT_ETC2_RGBA8; } else { - //gles2 most likely, bad for normalmaps, nothing to do about this. + //gles2 most likely, bad for normal maps, nothing to do about this. format = basist::transcoder_texture_format::cTFRGBA32; imgfmt = Image::FORMAT_RGBA8; } diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp index 787b6dbf80..e34455bca2 100644 --- a/modules/cvtt/image_compress_cvtt.cpp +++ b/modules/cvtt/image_compress_cvtt.cpp @@ -168,7 +168,7 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::UsedChann flags |= cvtt::Flags::BC7_RespectPunchThrough; - if (p_channels == Image::USED_CHANNELS_RG) { //guessing this is a normalmap + if (p_channels == Image::USED_CHANNELS_RG) { //guessing this is a normal map flags |= cvtt::Flags::Uniform; } options.flags = flags; diff --git a/modules/opensimplex/doc_classes/NoiseTexture.xml b/modules/opensimplex/doc_classes/NoiseTexture.xml index c06f3096de..7df261d2ba 100644 --- a/modules/opensimplex/doc_classes/NoiseTexture.xml +++ b/modules/opensimplex/doc_classes/NoiseTexture.xml @@ -5,7 +5,7 @@ Uses an [OpenSimplexNoise] to fill the texture data. You can specify the texture size but keep in mind that larger textures will take longer to generate and seamless noise only works with square sized textures. - NoiseTexture can also generate normalmap textures. + NoiseTexture can also generate normal map textures. The class uses [Thread]s to generate the texture data internally, so [method Texture2D.get_data] may return [code]null[/code] if the generation process has not completed yet. In that case, you need to wait for the texture to be generated before accessing the data: [codeblock] var texture = preload("res://noise.tres") @@ -18,7 +18,7 @@ - + If [code]true[/code], the resulting texture contains a normal map created from the original noise interpreted as a bump map. diff --git a/modules/opensimplex/noise_texture.cpp b/modules/opensimplex/noise_texture.cpp index 1181e69cd3..b29c2f84ce 100644 --- a/modules/opensimplex/noise_texture.cpp +++ b/modules/opensimplex/noise_texture.cpp @@ -40,7 +40,7 @@ NoiseTexture::NoiseTexture() { size = Vector2i(512, 512); seamless = false; - as_normalmap = false; + as_normal_map = false; bump_strength = 8.0; noise = Ref(); @@ -68,8 +68,8 @@ void NoiseTexture::_bind_methods() { 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("set_as_normalmap", "as_normalmap"), &NoiseTexture::set_as_normalmap); - ClassDB::bind_method(D_METHOD("is_normalmap"), &NoiseTexture::is_normalmap); + ClassDB::bind_method(D_METHOD("set_as_normal_map", "as_normal_map"), &NoiseTexture::set_as_normal_map); + ClassDB::bind_method(D_METHOD("is_normal_map"), &NoiseTexture::is_normal_map); ClassDB::bind_method(D_METHOD("set_bump_strength", "bump_strength"), &NoiseTexture::set_bump_strength); ClassDB::bind_method(D_METHOD("get_bump_strength"), &NoiseTexture::get_bump_strength); @@ -81,14 +81,14 @@ void NoiseTexture::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "width", PROPERTY_HINT_RANGE, "1,2048,1,or_greater"), "set_width", "get_width"); ADD_PROPERTY(PropertyInfo(Variant::INT, "height", PROPERTY_HINT_RANGE, "1,2048,1,or_greater"), "set_height", "get_height"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "seamless"), "set_seamless", "get_seamless"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "as_normalmap"), "set_as_normalmap", "is_normalmap"); + 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"); } void NoiseTexture::_validate_property(PropertyInfo &property) const { if (property.name == "bump_strength") { - if (!as_normalmap) { + if (!as_normal_map) { property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL; } } @@ -148,8 +148,8 @@ Ref NoiseTexture::_generate_texture() { image = ref_noise->get_image(size.x, size.y); } - if (as_normalmap) { - image->bumpmap_to_normalmap(bump_strength); + if (as_normal_map) { + image->bump_map_to_normal_map(bump_strength); } return image; @@ -225,17 +225,17 @@ bool NoiseTexture::get_seamless() { return seamless; } -void NoiseTexture::set_as_normalmap(bool p_as_normalmap) { - if (p_as_normalmap == as_normalmap) { +void NoiseTexture::set_as_normal_map(bool p_as_normal_map) { + if (p_as_normal_map == as_normal_map) { return; } - as_normalmap = p_as_normalmap; + as_normal_map = p_as_normal_map; _queue_update(); _change_notify(); } -bool NoiseTexture::is_normalmap() { - return as_normalmap; +bool NoiseTexture::is_normal_map() { + return as_normal_map; } void NoiseTexture::set_bump_strength(float p_bump_strength) { @@ -243,7 +243,7 @@ void NoiseTexture::set_bump_strength(float p_bump_strength) { return; } bump_strength = p_bump_strength; - if (as_normalmap) { + if (as_normal_map) { _queue_update(); } } diff --git a/modules/opensimplex/noise_texture.h b/modules/opensimplex/noise_texture.h index 73960ba85f..6f0d4aa5e1 100644 --- a/modules/opensimplex/noise_texture.h +++ b/modules/opensimplex/noise_texture.h @@ -57,7 +57,7 @@ private: Ref noise; Vector2i size; bool seamless; - bool as_normalmap; + bool as_normal_map; float bump_strength; void _thread_done(const Ref &p_image); @@ -82,8 +82,8 @@ public: void set_seamless(bool p_seamless); bool get_seamless(); - void set_as_normalmap(bool p_as_normalmap); - bool is_normalmap(); + void set_as_normal_map(bool p_as_normal_map); + bool is_normal_map(); void set_bump_strength(float p_bump_strength); float get_bump_strength(); -- cgit v1.2.3