You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-03 16:55:53 +00:00
Merge pull request #94744 from matheusmdx/fix-pink-gradient2d
Fix pink GradientTexture2D
This commit is contained in:
@@ -390,8 +390,6 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
|
|||||||
env.AppendUnique(CPPDEFINES=["R128_STDC_ONLY"])
|
env.AppendUnique(CPPDEFINES=["R128_STDC_ONLY"])
|
||||||
env.extra_suffix = ".llvm" + env.extra_suffix
|
env.extra_suffix = ".llvm" + env.extra_suffix
|
||||||
|
|
||||||
env["MAXLINELENGTH"] = 8192 # Windows Vista and beyond, so always applicable.
|
|
||||||
|
|
||||||
if env["silence_msvc"] and not env.GetOption("clean"):
|
if env["silence_msvc"] and not env.GetOption("clean"):
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void GradientTexture1D::_queue_update() {
|
|||||||
callable_mp(this, &GradientTexture1D::update_now).call_deferred();
|
callable_mp(this, &GradientTexture1D::update_now).call_deferred();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GradientTexture1D::_update() {
|
void GradientTexture1D::_update() const {
|
||||||
update_pending = false;
|
update_pending = false;
|
||||||
|
|
||||||
if (gradient.is_null()) {
|
if (gradient.is_null()) {
|
||||||
@@ -172,14 +172,14 @@ RID GradientTexture1D::get_rid() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ref<Image> GradientTexture1D::get_image() const {
|
Ref<Image> GradientTexture1D::get_image() const {
|
||||||
const_cast<GradientTexture1D *>(this)->update_now();
|
update_now();
|
||||||
if (!texture.is_valid()) {
|
if (!texture.is_valid()) {
|
||||||
return Ref<Image>();
|
return Ref<Image>();
|
||||||
}
|
}
|
||||||
return RenderingServer::get_singleton()->texture_2d_get(texture);
|
return RenderingServer::get_singleton()->texture_2d_get(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GradientTexture1D::update_now() {
|
void GradientTexture1D::update_now() const {
|
||||||
if (update_pending) {
|
if (update_pending) {
|
||||||
_update();
|
_update();
|
||||||
}
|
}
|
||||||
@@ -225,7 +225,7 @@ void GradientTexture2D::_queue_update() {
|
|||||||
callable_mp(this, &GradientTexture2D::update_now).call_deferred();
|
callable_mp(this, &GradientTexture2D::update_now).call_deferred();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GradientTexture2D::_update() {
|
void GradientTexture2D::_update() const {
|
||||||
update_pending = false;
|
update_pending = false;
|
||||||
|
|
||||||
if (gradient.is_null()) {
|
if (gradient.is_null()) {
|
||||||
@@ -405,14 +405,14 @@ RID GradientTexture2D::get_rid() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ref<Image> GradientTexture2D::get_image() const {
|
Ref<Image> GradientTexture2D::get_image() const {
|
||||||
const_cast<GradientTexture2D *>(this)->update_now();
|
update_now();
|
||||||
if (!texture.is_valid()) {
|
if (!texture.is_valid()) {
|
||||||
return Ref<Image>();
|
return Ref<Image>();
|
||||||
}
|
}
|
||||||
return RenderingServer::get_singleton()->texture_2d_get(texture);
|
return RenderingServer::get_singleton()->texture_2d_get(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GradientTexture2D::update_now() {
|
void GradientTexture2D::update_now() const {
|
||||||
if (update_pending) {
|
if (update_pending) {
|
||||||
_update();
|
_update();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ class GradientTexture1D : public Texture2D {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ref<Gradient> gradient;
|
Ref<Gradient> gradient;
|
||||||
bool update_pending = false;
|
mutable bool update_pending = false;
|
||||||
mutable RID texture;
|
mutable RID texture;
|
||||||
int width = 256;
|
int width = 256;
|
||||||
bool use_hdr = false;
|
bool use_hdr = false;
|
||||||
|
|
||||||
void _queue_update();
|
void _queue_update();
|
||||||
void _update();
|
void _update() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
virtual bool has_alpha() const override { return true; }
|
virtual bool has_alpha() const override { return true; }
|
||||||
|
|
||||||
virtual Ref<Image> get_image() const override;
|
virtual Ref<Image> get_image() const override;
|
||||||
void update_now();
|
void update_now() const;
|
||||||
|
|
||||||
GradientTexture1D();
|
GradientTexture1D();
|
||||||
virtual ~GradientTexture1D();
|
virtual ~GradientTexture1D();
|
||||||
@@ -102,9 +102,9 @@ private:
|
|||||||
|
|
||||||
float _get_gradient_offset_at(int x, int y) const;
|
float _get_gradient_offset_at(int x, int y) const;
|
||||||
|
|
||||||
bool update_pending = false;
|
mutable bool update_pending = false;
|
||||||
void _queue_update();
|
void _queue_update();
|
||||||
void _update();
|
void _update() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@@ -134,7 +134,7 @@ public:
|
|||||||
virtual RID get_rid() const override;
|
virtual RID get_rid() const override;
|
||||||
virtual bool has_alpha() const override { return true; }
|
virtual bool has_alpha() const override { return true; }
|
||||||
virtual Ref<Image> get_image() const override;
|
virtual Ref<Image> get_image() const override;
|
||||||
void update_now();
|
void update_now() const;
|
||||||
|
|
||||||
GradientTexture2D();
|
GradientTexture2D();
|
||||||
virtual ~GradientTexture2D();
|
virtual ~GradientTexture2D();
|
||||||
|
|||||||
Reference in New Issue
Block a user