|
@@ -2566,73 +2566,6 @@ void GradientTexture2D::_bind_methods() {
|
|
|
|
|
|
//////////////////////////////////////
|
|
//////////////////////////////////////
|
|
|
|
|
|
-void ProxyTexture::set_base(const Ref<Texture2D> &p_texture) {
|
|
|
|
- ERR_FAIL_COND(p_texture == this);
|
|
|
|
-
|
|
|
|
- base = p_texture;
|
|
|
|
- if (base.is_valid()) {
|
|
|
|
- ERR_FAIL_NULL(RenderingServer::get_singleton());
|
|
|
|
- if (proxy_ph.is_valid()) {
|
|
|
|
- RS::get_singleton()->texture_proxy_update(proxy, base->get_rid());
|
|
|
|
- RS::get_singleton()->free(proxy_ph);
|
|
|
|
- proxy_ph = RID();
|
|
|
|
- } else if (proxy.is_valid()) {
|
|
|
|
- RS::get_singleton()->texture_proxy_update(proxy, base->get_rid());
|
|
|
|
- } else {
|
|
|
|
- proxy = RS::get_singleton()->texture_proxy_create(base->get_rid());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-Ref<Texture2D> ProxyTexture::get_base() const {
|
|
|
|
- return base;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-int ProxyTexture::get_width() const {
|
|
|
|
- if (base.is_valid()) {
|
|
|
|
- return base->get_width();
|
|
|
|
- }
|
|
|
|
- return 1;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-int ProxyTexture::get_height() const {
|
|
|
|
- if (base.is_valid()) {
|
|
|
|
- return base->get_height();
|
|
|
|
- }
|
|
|
|
- return 1;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-RID ProxyTexture::get_rid() const {
|
|
|
|
- if (proxy.is_null()) {
|
|
|
|
- proxy_ph = RS::get_singleton()->texture_2d_placeholder_create();
|
|
|
|
- proxy = RS::get_singleton()->texture_proxy_create(proxy_ph);
|
|
|
|
- }
|
|
|
|
- return proxy;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-bool ProxyTexture::has_alpha() const {
|
|
|
|
- if (base.is_valid()) {
|
|
|
|
- return base->has_alpha();
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-ProxyTexture::ProxyTexture() {
|
|
|
|
- //proxy = RS::get_singleton()->texture_create();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-ProxyTexture::~ProxyTexture() {
|
|
|
|
- ERR_FAIL_NULL(RenderingServer::get_singleton());
|
|
|
|
- if (proxy_ph.is_valid()) {
|
|
|
|
- RS::get_singleton()->free(proxy_ph);
|
|
|
|
- }
|
|
|
|
- if (proxy.is_valid()) {
|
|
|
|
- RS::get_singleton()->free(proxy);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-//////////////////////////////////////////////
|
|
|
|
-
|
|
|
|
void AnimatedTexture::_update_proxy() {
|
|
void AnimatedTexture::_update_proxy() {
|
|
RWLockRead r(rw_lock);
|
|
RWLockRead r(rw_lock);
|
|
|
|
|