summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/register_scene_types.cpp4
-rw-r--r--scene/resources/texture.cpp56
-rw-r--r--scene/resources/texture.h8
-rw-r--r--scene/resources/visual_shader_nodes.cpp42
-rw-r--r--scene/resources/visual_shader_nodes.h12
5 files changed, 61 insertions, 61 deletions
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 9efe5c58fc..2d83f59bb5 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -586,7 +586,7 @@ void register_scene_types() {
GDREGISTER_CLASS(VisualShaderNodeTransformDecompose);
GDREGISTER_CLASS(VisualShaderNodeTexture);
GDREGISTER_CLASS(VisualShaderNodeCurveTexture);
- GDREGISTER_CLASS(VisualShaderNodeCurve3Texture);
+ GDREGISTER_CLASS(VisualShaderNodeCurveXYZTexture);
GDREGISTER_VIRTUAL_CLASS(VisualShaderNodeSample3D);
GDREGISTER_CLASS(VisualShaderNodeTexture2DArray);
GDREGISTER_CLASS(VisualShaderNodeTexture3D);
@@ -775,7 +775,7 @@ void register_scene_types() {
GDREGISTER_CLASS(AtlasTexture);
GDREGISTER_CLASS(MeshTexture);
GDREGISTER_CLASS(CurveTexture);
- GDREGISTER_CLASS(Curve3Texture);
+ GDREGISTER_CLASS(CurveXYZTexture);
GDREGISTER_CLASS(GradientTexture);
GDREGISTER_CLASS(ProxyTexture);
GDREGISTER_CLASS(AnimatedTexture);
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 98997e482a..26c0d432a9 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -1545,19 +1545,19 @@ CurveTexture::~CurveTexture() {
//////////////////
-void Curve3Texture::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_width", "width"), &Curve3Texture::set_width);
+void CurveXYZTexture::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_width", "width"), &CurveXYZTexture::set_width);
- ClassDB::bind_method(D_METHOD("set_curve_x", "curve"), &Curve3Texture::set_curve_x);
- ClassDB::bind_method(D_METHOD("get_curve_x"), &Curve3Texture::get_curve_x);
+ ClassDB::bind_method(D_METHOD("set_curve_x", "curve"), &CurveXYZTexture::set_curve_x);
+ ClassDB::bind_method(D_METHOD("get_curve_x"), &CurveXYZTexture::get_curve_x);
- ClassDB::bind_method(D_METHOD("set_curve_y", "curve"), &Curve3Texture::set_curve_y);
- ClassDB::bind_method(D_METHOD("get_curve_y"), &Curve3Texture::get_curve_y);
+ ClassDB::bind_method(D_METHOD("set_curve_y", "curve"), &CurveXYZTexture::set_curve_y);
+ ClassDB::bind_method(D_METHOD("get_curve_y"), &CurveXYZTexture::get_curve_y);
- ClassDB::bind_method(D_METHOD("set_curve_z", "curve"), &Curve3Texture::set_curve_z);
- ClassDB::bind_method(D_METHOD("get_curve_z"), &Curve3Texture::get_curve_z);
+ ClassDB::bind_method(D_METHOD("set_curve_z", "curve"), &CurveXYZTexture::set_curve_z);
+ ClassDB::bind_method(D_METHOD("get_curve_z"), &CurveXYZTexture::get_curve_z);
- ClassDB::bind_method(D_METHOD("_update"), &Curve3Texture::_update);
+ ClassDB::bind_method(D_METHOD("_update"), &CurveXYZTexture::_update);
ADD_PROPERTY(PropertyInfo(Variant::INT, "width", PROPERTY_HINT_RANGE, "1,4096"), "set_width", "get_width");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve_x", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_curve_x", "get_curve_x");
@@ -1565,7 +1565,7 @@ void Curve3Texture::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve_z", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_curve_z", "get_curve_z");
}
-void Curve3Texture::set_width(int p_width) {
+void CurveXYZTexture::set_width(int p_width) {
ERR_FAIL_COND(p_width < 32 || p_width > 4096);
if (_width == p_width) {
@@ -1576,11 +1576,11 @@ void Curve3Texture::set_width(int p_width) {
_update();
}
-int Curve3Texture::get_width() const {
+int CurveXYZTexture::get_width() const {
return _width;
}
-void Curve3Texture::ensure_default_setup(float p_min, float p_max) {
+void CurveXYZTexture::ensure_default_setup(float p_min, float p_max) {
if (_curve_x.is_null()) {
Ref<Curve> curve = Ref<Curve>(memnew(Curve));
curve->add_point(Vector2(0, 1));
@@ -1609,46 +1609,46 @@ void Curve3Texture::ensure_default_setup(float p_min, float p_max) {
}
}
-void Curve3Texture::set_curve_x(Ref<Curve> p_curve) {
+void CurveXYZTexture::set_curve_x(Ref<Curve> p_curve) {
if (_curve_x != p_curve) {
if (_curve_x.is_valid()) {
- _curve_x->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Curve3Texture::_update));
+ _curve_x->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveXYZTexture::_update));
}
_curve_x = p_curve;
if (_curve_x.is_valid()) {
- _curve_x->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Curve3Texture::_update), varray(), CONNECT_REFERENCE_COUNTED);
+ _curve_x->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveXYZTexture::_update), varray(), CONNECT_REFERENCE_COUNTED);
}
_update();
}
}
-void Curve3Texture::set_curve_y(Ref<Curve> p_curve) {
+void CurveXYZTexture::set_curve_y(Ref<Curve> p_curve) {
if (_curve_y != p_curve) {
if (_curve_y.is_valid()) {
- _curve_y->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Curve3Texture::_update));
+ _curve_y->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveXYZTexture::_update));
}
_curve_y = p_curve;
if (_curve_y.is_valid()) {
- _curve_y->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Curve3Texture::_update), varray(), CONNECT_REFERENCE_COUNTED);
+ _curve_y->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveXYZTexture::_update), varray(), CONNECT_REFERENCE_COUNTED);
}
_update();
}
}
-void Curve3Texture::set_curve_z(Ref<Curve> p_curve) {
+void CurveXYZTexture::set_curve_z(Ref<Curve> p_curve) {
if (_curve_z != p_curve) {
if (_curve_z.is_valid()) {
- _curve_z->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Curve3Texture::_update));
+ _curve_z->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveXYZTexture::_update));
}
_curve_z = p_curve;
if (_curve_z.is_valid()) {
- _curve_z->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Curve3Texture::_update), varray(), CONNECT_REFERENCE_COUNTED);
+ _curve_z->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveXYZTexture::_update), varray(), CONNECT_REFERENCE_COUNTED);
}
_update();
}
}
-void Curve3Texture::_update() {
+void CurveXYZTexture::_update() {
Vector<uint8_t> data;
data.resize(_width * sizeof(float) * 3);
@@ -1714,28 +1714,28 @@ void Curve3Texture::_update() {
emit_changed();
}
-Ref<Curve> Curve3Texture::get_curve_x() const {
+Ref<Curve> CurveXYZTexture::get_curve_x() const {
return _curve_x;
}
-Ref<Curve> Curve3Texture::get_curve_y() const {
+Ref<Curve> CurveXYZTexture::get_curve_y() const {
return _curve_y;
}
-Ref<Curve> Curve3Texture::get_curve_z() const {
+Ref<Curve> CurveXYZTexture::get_curve_z() const {
return _curve_z;
}
-RID Curve3Texture::get_rid() const {
+RID CurveXYZTexture::get_rid() const {
if (!_texture.is_valid()) {
_texture = RS::get_singleton()->texture_2d_placeholder_create();
}
return _texture;
}
-Curve3Texture::Curve3Texture() {}
+CurveXYZTexture::CurveXYZTexture() {}
-Curve3Texture::~Curve3Texture() {
+CurveXYZTexture::~CurveXYZTexture() {
if (_texture.is_valid()) {
RS::get_singleton()->free(_texture);
}
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 73390039cb..98aa61138d 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -628,8 +628,8 @@ public:
VARIANT_ENUM_CAST(CurveTexture::TextureMode)
-class Curve3Texture : public Texture2D {
- GDCLASS(Curve3Texture, Texture2D);
+class CurveXYZTexture : public Texture2D {
+ GDCLASS(CurveXYZTexture, Texture2D);
RES_BASE_EXTENSION("curvetex")
private:
@@ -665,8 +665,8 @@ public:
virtual int get_height() const override { return 1; }
virtual bool has_alpha() const override { return false; }
- Curve3Texture();
- ~Curve3Texture();
+ CurveXYZTexture();
+ ~CurveXYZTexture();
};
class GradientTexture : public Texture2D {
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index 4e73b8db44..79ea9d72df 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -889,56 +889,56 @@ VisualShaderNodeCurveTexture::VisualShaderNodeCurveTexture() {
allow_v_resize = false;
}
-////////////// Curve3Texture
+////////////// CurveXYZTexture
-String VisualShaderNodeCurve3Texture::get_caption() const {
- return "Curve3Texture";
+String VisualShaderNodeCurveXYZTexture::get_caption() const {
+ return "CurveXYZTexture";
}
-int VisualShaderNodeCurve3Texture::get_input_port_count() const {
+int VisualShaderNodeCurveXYZTexture::get_input_port_count() const {
return 1;
}
-VisualShaderNodeCurve3Texture::PortType VisualShaderNodeCurve3Texture::get_input_port_type(int p_port) const {
+VisualShaderNodeCurveXYZTexture::PortType VisualShaderNodeCurveXYZTexture::get_input_port_type(int p_port) const {
return PORT_TYPE_SCALAR;
}
-String VisualShaderNodeCurve3Texture::get_input_port_name(int p_port) const {
+String VisualShaderNodeCurveXYZTexture::get_input_port_name(int p_port) const {
return String();
}
-int VisualShaderNodeCurve3Texture::get_output_port_count() const {
+int VisualShaderNodeCurveXYZTexture::get_output_port_count() const {
return 1;
}
-VisualShaderNodeCurve3Texture::PortType VisualShaderNodeCurve3Texture::get_output_port_type(int p_port) const {
+VisualShaderNodeCurveXYZTexture::PortType VisualShaderNodeCurveXYZTexture::get_output_port_type(int p_port) const {
return PORT_TYPE_VECTOR;
}
-String VisualShaderNodeCurve3Texture::get_output_port_name(int p_port) const {
+String VisualShaderNodeCurveXYZTexture::get_output_port_name(int p_port) const {
return String();
}
-void VisualShaderNodeCurve3Texture::set_texture(Ref<Curve3Texture> p_texture) {
+void VisualShaderNodeCurveXYZTexture::set_texture(Ref<CurveXYZTexture> p_texture) {
texture = p_texture;
emit_changed();
}
-Ref<Curve3Texture> VisualShaderNodeCurve3Texture::get_texture() const {
+Ref<CurveXYZTexture> VisualShaderNodeCurveXYZTexture::get_texture() const {
return texture;
}
-Vector<StringName> VisualShaderNodeCurve3Texture::get_editable_properties() const {
+Vector<StringName> VisualShaderNodeCurveXYZTexture::get_editable_properties() const {
Vector<StringName> props;
props.push_back("texture");
return props;
}
-String VisualShaderNodeCurve3Texture::generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const {
+String VisualShaderNodeCurveXYZTexture::generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const {
return "uniform sampler2D " + make_unique_id(p_type, p_id, "curve3d") + ";\n";
}
-String VisualShaderNodeCurve3Texture::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
+String VisualShaderNodeCurveXYZTexture::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const {
if (p_input_vars[0] == String()) {
return "\t" + p_output_vars[0] + " = vec3(0.0);\n";
}
@@ -948,7 +948,7 @@ String VisualShaderNodeCurve3Texture::generate_code(Shader::Mode p_mode, VisualS
return code;
}
-Vector<VisualShader::DefaultTextureParam> VisualShaderNodeCurve3Texture::get_default_texture_parameters(VisualShader::Type p_type, int p_id) const {
+Vector<VisualShader::DefaultTextureParam> VisualShaderNodeCurveXYZTexture::get_default_texture_parameters(VisualShader::Type p_type, int p_id) const {
VisualShader::DefaultTextureParam dtp;
dtp.name = make_unique_id(p_type, p_id, "curve3d");
dtp.param = texture;
@@ -957,18 +957,18 @@ Vector<VisualShader::DefaultTextureParam> VisualShaderNodeCurve3Texture::get_def
return ret;
}
-void VisualShaderNodeCurve3Texture::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_texture", "texture"), &VisualShaderNodeCurve3Texture::set_texture);
- ClassDB::bind_method(D_METHOD("get_texture"), &VisualShaderNodeCurve3Texture::get_texture);
+void VisualShaderNodeCurveXYZTexture::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_texture", "texture"), &VisualShaderNodeCurveXYZTexture::set_texture);
+ ClassDB::bind_method(D_METHOD("get_texture"), &VisualShaderNodeCurveXYZTexture::get_texture);
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Curve3Texture"), "set_texture", "get_texture");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "CurveXYZTexture"), "set_texture", "get_texture");
}
-bool VisualShaderNodeCurve3Texture::is_use_prop_slots() const {
+bool VisualShaderNodeCurveXYZTexture::is_use_prop_slots() const {
return true;
}
-VisualShaderNodeCurve3Texture::VisualShaderNodeCurve3Texture() {
+VisualShaderNodeCurveXYZTexture::VisualShaderNodeCurveXYZTexture() {
simple_decl = true;
allow_v_resize = false;
}
diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h
index 3ae79723e9..33a45a4384 100644
--- a/scene/resources/visual_shader_nodes.h
+++ b/scene/resources/visual_shader_nodes.h
@@ -338,9 +338,9 @@ public:
///////////////////////////////////////
-class VisualShaderNodeCurve3Texture : public VisualShaderNodeResizableBase {
- GDCLASS(VisualShaderNodeCurve3Texture, VisualShaderNodeResizableBase);
- Ref<Curve3Texture> texture;
+class VisualShaderNodeCurveXYZTexture : public VisualShaderNodeResizableBase {
+ GDCLASS(VisualShaderNodeCurveXYZTexture, VisualShaderNodeResizableBase);
+ Ref<CurveXYZTexture> texture;
protected:
static void _bind_methods();
@@ -360,13 +360,13 @@ public:
virtual String generate_global(Shader::Mode p_mode, VisualShader::Type p_type, int p_id) const override;
virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override;
- void set_texture(Ref<Curve3Texture> p_value);
- Ref<Curve3Texture> get_texture() const;
+ void set_texture(Ref<CurveXYZTexture> p_value);
+ Ref<CurveXYZTexture> get_texture() const;
virtual Vector<StringName> get_editable_properties() const override;
virtual bool is_use_prop_slots() const override;
- VisualShaderNodeCurve3Texture();
+ VisualShaderNodeCurveXYZTexture();
};
///////////////////////////////////////