summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/audio_stream_sample.cpp32
-rw-r--r--scene/resources/capsule_shape_2d.cpp2
-rw-r--r--scene/resources/circle_shape_2d.cpp2
-rw-r--r--scene/resources/concave_polygon_shape_2d.cpp2
-rw-r--r--scene/resources/convex_polygon_shape_2d.cpp2
-rw-r--r--scene/resources/default_theme/default_theme.cpp33
-rw-r--r--scene/resources/dynamic_font.cpp2
-rw-r--r--scene/resources/dynamic_font_stb.cpp5
-rw-r--r--scene/resources/environment.cpp3
-rw-r--r--scene/resources/material.cpp27
-rw-r--r--scene/resources/material.h12
-rw-r--r--scene/resources/mesh.cpp20
-rw-r--r--scene/resources/mesh.h5
-rw-r--r--scene/resources/primitive_meshes.cpp38
-rw-r--r--scene/resources/primitive_meshes.h5
-rw-r--r--scene/resources/rectangle_shape_2d.cpp2
-rw-r--r--scene/resources/segment_shape_2d.cpp4
-rw-r--r--scene/resources/shape_line_2d.cpp2
-rw-r--r--scene/resources/tile_set.cpp20
-rw-r--r--scene/resources/tile_set.h3
-rw-r--r--scene/resources/video_stream.h4
21 files changed, 145 insertions, 80 deletions
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index fdc3b79db6..f81f460521 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -31,17 +31,23 @@
void AudioStreamPlaybackSample::start(float p_from_pos) {
- for (int i = 0; i < 2; i++) {
- ima_adpcm[i].step_index = 0;
- ima_adpcm[i].predictor = 0;
- ima_adpcm[i].loop_step_index = 0;
- ima_adpcm[i].loop_predictor = 0;
- ima_adpcm[i].last_nibble = -1;
- ima_adpcm[i].loop_pos = 0x7FFFFFFF;
- ima_adpcm[i].window_ofs = 0;
+ if (base->format == AudioStreamSample::FORMAT_IMA_ADPCM) {
+ //no seeking in IMA_ADPCM
+ for (int i = 0; i < 2; i++) {
+ ima_adpcm[i].step_index = 0;
+ ima_adpcm[i].predictor = 0;
+ ima_adpcm[i].loop_step_index = 0;
+ ima_adpcm[i].loop_predictor = 0;
+ ima_adpcm[i].last_nibble = -1;
+ ima_adpcm[i].loop_pos = 0x7FFFFFFF;
+ ima_adpcm[i].window_ofs = 0;
+ }
+
+ offset = 0;
+ } else {
+ seek(p_from_pos);
}
- seek(p_from_pos);
sign = 1;
active = true;
}
@@ -373,6 +379,14 @@ void AudioStreamPlaybackSample::mix(AudioFrame *p_buffer, float p_rate_scale, in
dst_buff += target;
}
+
+ if (todo) {
+ //bit was missing from mix
+ int todo_ofs = p_frames - todo;
+ for (int i = todo_ofs; i < p_frames; i++) {
+ p_buffer[i] = AudioFrame(0, 0);
+ }
+ }
}
float AudioStreamPlaybackSample::get_length() const {
diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp
index 56a09bc3bf..912150b939 100644
--- a/scene/resources/capsule_shape_2d.cpp
+++ b/scene/resources/capsule_shape_2d.cpp
@@ -98,7 +98,7 @@ void CapsuleShape2D::_bind_methods() {
}
CapsuleShape2D::CapsuleShape2D()
- : Shape2D(Physics2DServer::get_singleton()->shape_create(Physics2DServer::SHAPE_CAPSULE)) {
+ : Shape2D(Physics2DServer::get_singleton()->capsule_shape_create()) {
radius = 10;
height = 20;
diff --git a/scene/resources/circle_shape_2d.cpp b/scene/resources/circle_shape_2d.cpp
index ecfc98ea60..287bde4bfb 100644
--- a/scene/resources/circle_shape_2d.cpp
+++ b/scene/resources/circle_shape_2d.cpp
@@ -77,7 +77,7 @@ void CircleShape2D::draw(const RID &p_to_rid, const Color &p_color) {
}
CircleShape2D::CircleShape2D()
- : Shape2D(Physics2DServer::get_singleton()->shape_create(Physics2DServer::SHAPE_CIRCLE)) {
+ : Shape2D(Physics2DServer::get_singleton()->circle_shape_create()) {
radius = 10;
_update_shape();
diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp
index 7f4abf7ae0..bb91e33ec2 100644
--- a/scene/resources/concave_polygon_shape_2d.cpp
+++ b/scene/resources/concave_polygon_shape_2d.cpp
@@ -85,5 +85,5 @@ void ConcavePolygonShape2D::_bind_methods() {
}
ConcavePolygonShape2D::ConcavePolygonShape2D()
- : Shape2D(Physics2DServer::get_singleton()->shape_create(Physics2DServer::SHAPE_CONCAVE_POLYGON)) {
+ : Shape2D(Physics2DServer::get_singleton()->concave_polygon_shape_create()) {
}
diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp
index 7588909d90..a76b6a7cf4 100644
--- a/scene/resources/convex_polygon_shape_2d.cpp
+++ b/scene/resources/convex_polygon_shape_2d.cpp
@@ -87,7 +87,7 @@ Rect2 ConvexPolygonShape2D::get_rect() const {
}
ConvexPolygonShape2D::ConvexPolygonShape2D()
- : Shape2D(Physics2DServer::get_singleton()->shape_create(Physics2DServer::SHAPE_CONVEX_POLYGON)) {
+ : Shape2D(Physics2DServer::get_singleton()->convex_polygon_shape_create()) {
int pcount = 3;
for (int i = 0; i < pcount; i++)
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index ce439fece6..cd28c9d203 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -836,39 +836,6 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("autohide", "HSplitContainer", 1 * scale);
theme->set_constant("autohide", "VSplitContainer", 1 * scale);
- // HButtonArray
- theme->set_stylebox("normal", "HButtonArray", sb_button_normal);
- theme->set_stylebox("selected", "HButtonArray", sb_button_pressed);
- theme->set_stylebox("hover", "HButtonArray", sb_button_hover);
-
- theme->set_font("font", "HButtonArray", default_font);
- theme->set_font("font_selected", "HButtonArray", default_font);
-
- theme->set_color("font_color", "HButtonArray", control_font_color_low);
- theme->set_color("font_color_selected", "HButtonArray", control_font_color_hover);
-
- theme->set_constant("icon_separator", "HButtonArray", 2 * scale);
- theme->set_constant("button_separator", "HButtonArray", 4 * scale);
-
- theme->set_stylebox("focus", "HButtonArray", focus);
-
- // VButtonArray
-
- theme->set_stylebox("normal", "VButtonArray", sb_button_normal);
- theme->set_stylebox("selected", "VButtonArray", sb_button_pressed);
- theme->set_stylebox("hover", "VButtonArray", sb_button_hover);
-
- theme->set_font("font", "VButtonArray", default_font);
- theme->set_font("font_selected", "VButtonArray", default_font);
-
- theme->set_color("font_color", "VButtonArray", control_font_color_low);
- theme->set_color("font_color_selected", "VButtonArray", control_font_color_hover);
-
- theme->set_constant("icon_separator", "VButtonArray", 2 * scale);
- theme->set_constant("button_separator", "VButtonArray", 4 * scale);
-
- theme->set_stylebox("focus", "VButtonArray", focus);
-
// ReferenceRect
Ref<StyleBoxTexture> ttnc = make_stylebox(full_panel_bg_png, 8, 8, 8, 8);
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 1ee76a4216..48c6add586 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -571,7 +571,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
wr[ofs + 0] = 255; //grayscale as 1
wr[ofs + 1] = slot->bitmap.buffer[i * slot->bitmap.pitch + j];
break;
- // TODO: FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_BGRA
+ // TODO: FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_BGRA
default:
ERR_EXPLAIN("Font uses unsupported pixel format: " + itos(slot->bitmap.pixel_mode));
ERR_FAIL();
diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp
index 91263fb125..4aa47cb664 100644
--- a/scene/resources/dynamic_font_stb.cpp
+++ b/scene/resources/dynamic_font_stb.cpp
@@ -333,8 +333,7 @@ void DynamicFontAtSize::_update_char(CharType p_char) {
//blit to image and texture
{
-
- Image img(tex.texture_size, tex.texture_size, 0, Image::FORMAT_LA8, tex.imgdata);
+ Ref<Image> img = memnew(Image(tex.texture_size, tex.texture_size, 0, Image::FORMAT_LA8, tex.imgdata));
if (tex.texture.is_null()) {
tex.texture.instance();
@@ -518,7 +517,7 @@ bool ResourceFormatLoaderDynamicFont::handles_type(const String &p_type) const {
String ResourceFormatLoaderDynamicFont::get_resource_type(const String &p_path) const {
- String el = p_path.extension().to_lower();
+ String el = p_path.get_extension().to_lower();
if (el == "ttf")
return "DynamicFontData";
return "";
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 232f690074..fe59450f2e 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -1184,7 +1184,8 @@ Environment::Environment() {
bg_energy = 1.0;
bg_canvas_max_layer = 0;
ambient_energy = 1.0;
- ambient_sky_contribution = 1.0;
+ //ambient_sky_contribution = 1.0;
+ set_ambient_light_sky_contribution(1.0);
tone_mapper = TONE_MAPPER_LINEAR;
tonemap_exposure = 1.0;
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 12434b39fa..286840656b 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -723,7 +723,11 @@ void SpatialMaterial::_update_shader() {
} else {
code += "\tvec3 emission_tex = texture(texture_emission,base_uv).rgb;\n";
}
- code += "\tEMISSION = (emission.rgb+emission_tex)*emission_energy;\n";
+ if (emission_op == EMISSION_OP_ADD) {
+ code += "\tEMISSION = (emission.rgb+emission_tex)*emission_energy;\n";
+ } else {
+ code += "\tEMISSION = (emission.rgb*emission_tex)*emission_energy;\n";
+ }
}
if (features[FEATURE_REFRACTION] && !flags[FLAG_UV1_USE_TRIPLANAR]) { //refraction not supported with triplanar
@@ -1635,6 +1639,19 @@ float SpatialMaterial::get_distance_fade_min_distance() const {
return distance_fade_min_distance;
}
+void SpatialMaterial::set_emission_operator(EmissionOperator p_op) {
+
+ if (emission_op == p_op)
+ return;
+ emission_op = p_op;
+ _queue_shader_change();
+}
+
+SpatialMaterial::EmissionOperator SpatialMaterial::get_emission_operator() const {
+
+ return emission_op;
+}
+
RID SpatialMaterial::get_shader_rid() const {
ERR_FAIL_COND_V(!shader_map.has(current_key), RID());
@@ -1769,6 +1786,9 @@ void SpatialMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_grow", "amount"), &SpatialMaterial::set_grow);
ClassDB::bind_method(D_METHOD("get_grow"), &SpatialMaterial::get_grow);
+ ClassDB::bind_method(D_METHOD("set_emission_operator", "operator"), &SpatialMaterial::set_emission_operator);
+ ClassDB::bind_method(D_METHOD("get_emission_operator"), &SpatialMaterial::get_emission_operator);
+
ClassDB::bind_method(D_METHOD("set_ao_light_affect", "amount"), &SpatialMaterial::set_ao_light_affect);
ClassDB::bind_method(D_METHOD("get_ao_light_affect"), &SpatialMaterial::get_ao_light_affect);
@@ -1854,6 +1874,7 @@ void SpatialMaterial::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "emission_enabled"), "set_feature", "get_feature", FEATURE_EMISSION);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "emission", PROPERTY_HINT_COLOR_NO_ALPHA), "set_emission", "get_emission");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_emission_energy", "get_emission_energy");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_operator", PROPERTY_HINT_ENUM, "Add,Multiply"), "set_emission_operator", "get_emission_operator");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "emission_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_EMISSION);
ADD_GROUP("NormalMap", "normal_");
@@ -2022,6 +2043,9 @@ void SpatialMaterial::_bind_methods() {
BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_BLUE);
BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_ALPHA);
BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_GRAYSCALE);
+
+ BIND_ENUM_CONSTANT(EMISSION_OP_ADD);
+ BIND_ENUM_CONSTANT(EMISSION_OP_MULTIPLY);
}
SpatialMaterial::SpatialMaterial()
@@ -2057,6 +2081,7 @@ SpatialMaterial::SpatialMaterial()
set_particles_anim_v_frames(1);
set_particles_anim_loop(false);
set_alpha_scissor_threshold(0.98);
+ emission_op = EMISSION_OP_ADD;
proximity_fade_enabled = false;
distance_fade_enabled = false;
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 2425f1a174..877d4dfd41 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -215,6 +215,11 @@ public:
TEXTURE_CHANNEL_GRAYSCALE
};
+ enum EmissionOperator {
+ EMISSION_OP_ADD,
+ EMISSION_OP_MULTIPLY
+ };
+
private:
union MaterialKey {
@@ -234,6 +239,7 @@ private:
uint64_t grow : 1;
uint64_t proximity_fade : 1;
uint64_t distance_fade : 1;
+ uint64_t emission_op : 1;
};
uint64_t key;
@@ -278,6 +284,7 @@ private:
mk.grow = grow_enabled;
mk.proximity_fade = proximity_fade_enabled;
mk.distance_fade = distance_fade_enabled;
+ mk.emission_op = emission_op;
return mk;
}
@@ -394,6 +401,7 @@ private:
SpecularMode specular_mode;
DiffuseMode diffuse_mode;
BillboardMode billboard_mode;
+ EmissionOperator emission_op;
TextureChannel metallic_texture_channel;
TextureChannel roughness_texture_channel;
@@ -571,6 +579,9 @@ public:
void set_distance_fade_min_distance(float p_distance);
float get_distance_fade_min_distance() const;
+ void set_emission_operator(EmissionOperator p_op);
+ EmissionOperator get_emission_operator() const;
+
void set_metallic_texture_channel(TextureChannel p_channel);
TextureChannel get_metallic_texture_channel() const;
void set_roughness_texture_channel(TextureChannel p_channel);
@@ -603,6 +614,7 @@ VARIANT_ENUM_CAST(SpatialMaterial::DiffuseMode)
VARIANT_ENUM_CAST(SpatialMaterial::SpecularMode)
VARIANT_ENUM_CAST(SpatialMaterial::BillboardMode)
VARIANT_ENUM_CAST(SpatialMaterial::TextureChannel)
+VARIANT_ENUM_CAST(SpatialMaterial::EmissionOperator)
//////////////////////
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index db5d87d703..3e86daf3a7 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -574,7 +574,6 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
ERR_FAIL_COND_V(!d.has("format"), false);
uint32_t format = d["format"];
- ERR_FAIL_COND_V(!d.has("primitive"), false);
uint32_t primitive = d["primitive"];
ERR_FAIL_COND_V(!d.has("vertex_count"), false);
@@ -598,8 +597,8 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) {
Rect3 aabb = d["aabb"];
Vector<Rect3> bone_aabb;
- if (d.has("bone_aabb")) {
- Array baabb = d["bone_aabb"];
+ if (d.has("skeleton_aabb")) {
+ Array baabb = d["skeleton_aabb"];
bone_aabb.resize(baabb.size());
for (int i = 0; i < baabb.size(); i++) {
@@ -921,6 +920,12 @@ String ArrayMesh::surface_get_name(int p_idx) const {
return surfaces[p_idx].name;
}
+void ArrayMesh::surface_update_region(int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) {
+
+ ERR_FAIL_INDEX(p_surface, surfaces.size());
+ VS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data);
+}
+
void ArrayMesh::surface_set_custom_aabb(int p_idx, const Rect3 &p_aabb) {
ERR_FAIL_INDEX(p_idx, surfaces.size());
@@ -1042,6 +1047,7 @@ void ArrayMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_surface_from_arrays", "primitive", "arrays", "blend_shapes", "compress_flags"), &ArrayMesh::add_surface_from_arrays, DEFVAL(Array()), DEFVAL(ARRAY_COMPRESS_DEFAULT));
ClassDB::bind_method(D_METHOD("get_surface_count"), &ArrayMesh::get_surface_count);
ClassDB::bind_method(D_METHOD("surface_remove", "surf_idx"), &ArrayMesh::surface_remove);
+ ClassDB::bind_method(D_METHOD("surface_update_region", "surf_idx", "offset", "data"), &ArrayMesh::surface_update_region);
ClassDB::bind_method(D_METHOD("surface_get_array_len", "surf_idx"), &ArrayMesh::surface_get_array_len);
ClassDB::bind_method(D_METHOD("surface_get_array_index_len", "surf_idx"), &ArrayMesh::surface_get_array_index_len);
ClassDB::bind_method(D_METHOD("surface_get_format", "surf_idx"), &ArrayMesh::surface_get_format);
@@ -1090,6 +1096,14 @@ void ArrayMesh::_bind_methods() {
BIND_ENUM_CONSTANT(ARRAY_FORMAT_INDEX);
}
+void ArrayMesh::reload_from_file() {
+ for (int i = 0; i < get_surface_count(); i++) {
+ surface_remove(i);
+ }
+ Resource::reload_from_file();
+ String path = get_path();
+}
+
ArrayMesh::ArrayMesh() {
mesh = VisualServer::get_singleton()->mesh_create();
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index f4edb258b6..75927079c7 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -95,6 +95,7 @@ public:
ARRAY_FLAG_USE_2D_VERTICES = ARRAY_COMPRESS_INDEX << 1,
ARRAY_FLAG_USE_16_BIT_BONES = ARRAY_COMPRESS_INDEX << 2,
+ ARRAY_FLAG_USE_DYNAMIC_UPDATE = ARRAY_COMPRESS_INDEX << 3,
ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_VERTEX | ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS
@@ -185,6 +186,8 @@ public:
void set_blend_shape_mode(BlendShapeMode p_mode);
BlendShapeMode get_blend_shape_mode() const;
+ void surface_update_region(int p_surface, int p_offset, const PoolVector<uint8_t> &p_data);
+
int get_surface_count() const;
void surface_remove(int p_idx);
@@ -213,6 +216,8 @@ public:
void center_geometry();
void regen_normalmaps();
+ virtual void reload_from_file();
+
ArrayMesh();
~ArrayMesh();
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index ba356d89b1..8e3899315c 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -1299,14 +1299,16 @@ void QuadMesh::_create_mesh_array(Array &p_arr) const {
tangents.resize(4 * 4);
uvs.resize(4);
- for (int i = 0; i < 4; i++) {
+ Vector2 _size = Vector2(size.x / 2.0f, size.y / 2.0f);
- static const Vector3 quad_faces[4] = {
- Vector3(-1, -1, 0),
- Vector3(-1, 1, 0),
- Vector3(1, 1, 0),
- Vector3(1, -1, 0),
- };
+ Vector3 quad_faces[4] = {
+ Vector3(-_size.x, -_size.y, 0),
+ Vector3(-_size.x, _size.y, 0),
+ Vector3(_size.x, _size.y, 0),
+ Vector3(_size.x, -_size.y, 0),
+ };
+
+ for (int i = 0; i < 4; i++) {
faces.set(i, quad_faces[i]);
normals.set(i, Vector3(0, 0, 1));
@@ -1325,18 +1327,30 @@ void QuadMesh::_create_mesh_array(Array &p_arr) const {
uvs.set(i, quad_uv[i]);
}
- p_arr[ARRAY_VERTEX] = faces;
- p_arr[ARRAY_NORMAL] = normals;
- p_arr[ARRAY_TANGENT] = tangents;
- p_arr[ARRAY_TEX_UV] = uvs;
+ p_arr[VS::ARRAY_VERTEX] = faces;
+ p_arr[VS::ARRAY_NORMAL] = normals;
+ p_arr[VS::ARRAY_TANGENT] = tangents;
+ p_arr[VS::ARRAY_TEX_UV] = uvs;
};
void QuadMesh::_bind_methods() {
- // nothing here yet...
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &QuadMesh::set_size);
+ ClassDB::bind_method(D_METHOD("get_size"), &QuadMesh::get_size);
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size");
}
QuadMesh::QuadMesh() {
primitive_type = PRIMITIVE_TRIANGLE_FAN;
+ size = Size2(1.0, 1.0);
+}
+
+void QuadMesh::set_size(const Size2 &p_size) {
+ size = p_size;
+ _request_update();
+}
+
+Size2 QuadMesh::get_size() const {
+ return size;
}
/**
diff --git a/scene/resources/primitive_meshes.h b/scene/resources/primitive_meshes.h
index 38a5695883..f0c8935261 100644
--- a/scene/resources/primitive_meshes.h
+++ b/scene/resources/primitive_meshes.h
@@ -263,7 +263,7 @@ class QuadMesh : public PrimitiveMesh {
GDCLASS(QuadMesh, PrimitiveMesh)
private:
- // nothing? really? Maybe add size some day atleast... :)
+ Size2 size;
protected:
static void _bind_methods();
@@ -271,6 +271,9 @@ protected:
public:
QuadMesh();
+
+ void set_size(const Size2 &p_size);
+ Size2 get_size() const;
};
/**
diff --git a/scene/resources/rectangle_shape_2d.cpp b/scene/resources/rectangle_shape_2d.cpp
index 507dbce861..69dbb76744 100644
--- a/scene/resources/rectangle_shape_2d.cpp
+++ b/scene/resources/rectangle_shape_2d.cpp
@@ -67,7 +67,7 @@ void RectangleShape2D::_bind_methods() {
}
RectangleShape2D::RectangleShape2D()
- : Shape2D(Physics2DServer::get_singleton()->shape_create(Physics2DServer::SHAPE_RECTANGLE)) {
+ : Shape2D(Physics2DServer::get_singleton()->rectangle_shape_create()) {
extents = Vector2(10, 10);
_update_shape();
diff --git a/scene/resources/segment_shape_2d.cpp b/scene/resources/segment_shape_2d.cpp
index 1171db5c02..7c7ec0d112 100644
--- a/scene/resources/segment_shape_2d.cpp
+++ b/scene/resources/segment_shape_2d.cpp
@@ -87,7 +87,7 @@ void SegmentShape2D::_bind_methods() {
}
SegmentShape2D::SegmentShape2D()
- : Shape2D(Physics2DServer::get_singleton()->shape_create(Physics2DServer::SHAPE_SEGMENT)) {
+ : Shape2D(Physics2DServer::get_singleton()->segment_shape_create()) {
a = Vector2();
b = Vector2(0, 10);
@@ -146,7 +146,7 @@ real_t RayShape2D::get_length() const {
}
RayShape2D::RayShape2D()
- : Shape2D(Physics2DServer::get_singleton()->shape_create(Physics2DServer::SHAPE_RAY)) {
+ : Shape2D(Physics2DServer::get_singleton()->ray_shape_create()) {
length = 20;
_update_shape();
diff --git a/scene/resources/shape_line_2d.cpp b/scene/resources/shape_line_2d.cpp
index 4dcc5ac981..d046ce876c 100644
--- a/scene/resources/shape_line_2d.cpp
+++ b/scene/resources/shape_line_2d.cpp
@@ -96,7 +96,7 @@ void LineShape2D::_bind_methods() {
}
LineShape2D::LineShape2D()
- : Shape2D(Physics2DServer::get_singleton()->shape_create(Physics2DServer::SHAPE_LINE)) {
+ : Shape2D(Physics2DServer::get_singleton()->line_shape_create()) {
normal = Vector2(0, -1);
d = 0;
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 50e8c28c22..29ac7852bf 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -57,11 +57,9 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
tile_set_region(id, p_value);
else if (what == "shape")
tile_set_shape(id, 0, p_value);
- else if (what == "shape_offset") {
- Transform2D xform = tile_get_shape_transform(id, 0);
- xform.set_origin(p_value);
- tile_set_shape_transform(id, 0, xform);
- } else if (what == "shape_transform")
+ else if (what == "shape_offset")
+ tile_set_shape_offset(id, 0, p_value);
+ else if (what == "shape_transform")
tile_set_shape_transform(id, 0, p_value);
else if (what == "shape_one_way")
tile_set_shape_one_way(id, 0, p_value);
@@ -110,7 +108,7 @@ bool TileSet::_get(const StringName &p_name, Variant &r_ret) const {
else if (what == "shape")
r_ret = tile_get_shape(id, 0);
else if (what == "shape_offset")
- r_ret = tile_get_shape_transform(id, 0).get_origin();
+ r_ret = tile_get_shape_offset(id, 0);
else if (what == "shape_transform")
r_ret = tile_get_shape_transform(id, 0);
else if (what == "shape_one_way")
@@ -313,6 +311,16 @@ Transform2D TileSet::tile_get_shape_transform(int p_id, int p_shape_id) const {
return Transform2D();
}
+void TileSet::tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset) {
+ Transform2D transform = tile_get_shape_transform(p_id, p_shape_id);
+ transform.set_origin(p_offset);
+ tile_set_shape_transform(p_id, p_shape_id, transform);
+}
+
+Vector2 TileSet::tile_get_shape_offset(int p_id, int p_shape_id) const {
+ return tile_get_shape_transform(p_id, p_shape_id).get_origin();
+}
+
void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) {
ERR_FAIL_COND(!tile_map.has(p_id));
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index fe782ff987..3ef3f00cef 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -108,6 +108,9 @@ public:
void tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset);
Transform2D tile_get_shape_transform(int p_id, int p_shape_id) const;
+ void tile_set_shape_offset(int p_id, int p_shape_id, const Vector2 &p_offset);
+ Vector2 tile_get_shape_offset(int p_id, int p_shape_id) const;
+
void tile_set_shape_one_way(int p_id, int p_shape_id, bool p_one_way);
bool tile_get_shape_one_way(int p_id, int p_shape_id) const;
diff --git a/scene/resources/video_stream.h b/scene/resources/video_stream.h
index 3f79858056..fbe52909e7 100644
--- a/scene/resources/video_stream.h
+++ b/scene/resources/video_stream.h
@@ -40,7 +40,7 @@ protected:
static void _bind_methods();
public:
- typedef int (*AudioMixCallback)(void *p_udata, const int16_t *p_data, int p_frames);
+ typedef int (*AudioMixCallback)(void *p_udata, const float *p_data, int p_frames);
virtual void stop() = 0;
virtual void play() = 0;
@@ -48,7 +48,7 @@ public:
virtual bool is_playing() const = 0;
virtual void set_paused(bool p_paused) = 0;
- virtual bool is_paused(bool p_paused) const = 0;
+ virtual bool is_paused() const = 0;
virtual void set_loop(bool p_enable) = 0;
virtual bool has_loop() const = 0;