summaryrefslogtreecommitdiff
path: root/scene/3d/sprite_3d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/sprite_3d.cpp')
-rw-r--r--scene/3d/sprite_3d.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 036a748c83..8e00fbe735 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "sprite_3d.h"
-#include "core_string_names.h"
+#include "core/core_string_names.h"
#include "scene/scene_string_names.h"
Color SpriteBase3D::_get_color_accum() {
@@ -388,7 +388,7 @@ void Sprite3D::_draw() {
return;
Size2i s;
- Rect2i src_rect;
+ Rect2 src_rect;
if (region) {
@@ -396,18 +396,18 @@ void Sprite3D::_draw() {
src_rect = region_rect;
} else {
s = texture->get_size();
- s = s / Size2i(hframes, vframes);
+ s = s / Size2(hframes, vframes);
src_rect.size = s;
src_rect.position.x += (frame % hframes) * s.x;
src_rect.position.y += (frame / hframes) * s.y;
}
- Point2i ofs = get_offset();
+ Point2 ofs = get_offset();
if (is_centered())
ofs -= s / 2;
- Rect2i dst_rect(ofs, s);
+ Rect2 dst_rect(ofs, s);
Rect2 final_rect;
Rect2 final_src_rect;
@@ -431,7 +431,7 @@ void Sprite3D::_draw() {
};
- Vector2 src_tsize = Vector2(texture->get_width(), texture->get_height());
+ Vector2 src_tsize = tsize;
// Properly setup UVs for impostor textures (AtlasTexture).
Ref<AtlasTexture> atlas_tex = texture;
@@ -441,10 +441,10 @@ void Sprite3D::_draw() {
}
Vector2 uvs[4] = {
- final_src_rect.position / tsize,
- (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize,
- (final_src_rect.position + final_src_rect.size) / tsize,
- (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / tsize,
+ final_src_rect.position / src_tsize,
+ (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / src_tsize,
+ (final_src_rect.position + final_src_rect.size) / src_tsize,
+ (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / src_tsize,
};
if (is_flipped_h()) {
@@ -612,7 +612,7 @@ Rect2 Sprite3D::get_item_rect() const {
s = s / Point2(hframes, vframes);
}
- Point2i ofs = get_offset();
+ Point2 ofs = get_offset();
if (is_centered())
ofs -= s / 2;
@@ -699,15 +699,15 @@ void AnimatedSprite3D::_draw() {
return;
Size2i s = tsize;
- Rect2i src_rect;
+ Rect2 src_rect;
src_rect.size = s;
- Point2i ofs = get_offset();
+ Point2 ofs = get_offset();
if (is_centered())
ofs -= s / 2;
- Rect2i dst_rect(ofs, s);
+ Rect2 dst_rect(ofs, s);
Rect2 final_rect;
Rect2 final_src_rect;
@@ -731,7 +731,7 @@ void AnimatedSprite3D::_draw() {
};
- Vector2 src_tsize = Vector2(texture->get_width(), texture->get_height());
+ Vector2 src_tsize = tsize;
// Properly setup UVs for impostor textures (AtlasTexture).
Ref<AtlasTexture> atlas_tex = texture;
@@ -741,10 +741,10 @@ void AnimatedSprite3D::_draw() {
}
Vector2 uvs[4] = {
- final_src_rect.position / tsize,
- (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize,
- (final_src_rect.position + final_src_rect.size) / tsize,
- (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / tsize,
+ final_src_rect.position / src_tsize,
+ (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / src_tsize,
+ (final_src_rect.position + final_src_rect.size) / src_tsize,
+ (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / src_tsize,
};
if (is_flipped_h()) {
@@ -1078,10 +1078,10 @@ void AnimatedSprite3D::_bind_methods() {
ADD_SIGNAL(MethodInfo("frame_changed"));
- ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "frames", PROPERTY_HINT_RESOURCE_TYPE, "SpriteFrames"), "set_sprite_frames", "get_sprite_frames");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "frames", PROPERTY_HINT_RESOURCE_TYPE, "SpriteFrames"), "set_sprite_frames", "get_sprite_frames");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "animation"), "set_animation", "get_animation");
- ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "frame", PROPERTY_HINT_SPRITE_FRAME), "set_frame", "get_frame");
- ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "playing"), "_set_playing", "_is_playing");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "frame", PROPERTY_HINT_SPRITE_FRAME), "set_frame", "get_frame");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playing"), "_set_playing", "_is_playing");
}
AnimatedSprite3D::AnimatedSprite3D() {