summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/physics_body.cpp3
-rw-r--r--scene/main/viewport.cpp26
-rw-r--r--scene/main/viewport.h15
-rw-r--r--scene/resources/material.cpp2
4 files changed, 24 insertions, 22 deletions
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index a0a393e8ed..9590394211 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -918,7 +918,7 @@ Dictionary KinematicBody::_move(const Vector3 &p_motion) {
if (move(p_motion, col)) {
Dictionary d;
d["position"] = col.collision;
- d["normal"] = col.collision;
+ d["normal"] = col.normal;
d["local_shape"] = col.local_shape;
d["travel"] = col.travel;
d["remainder"] = col.remainder;
@@ -929,6 +929,7 @@ Dictionary KinematicBody::_move(const Vector3 &p_motion) {
d["collider"] = Variant();
}
+ d["collider_velocity"] = col.collider_vel;
d["collider_shape_index"] = col.collider_shape;
d["collider_metadata"] = col.collider_metadata;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 02da926e50..36dbd14b40 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1202,15 +1202,15 @@ bool Viewport::get_vflip() const {
return vflip;
}
-void Viewport::set_clear_on_new_frame(bool p_enable) {
+void Viewport::set_clear_mode(ClearMode p_mode) {
- clear_on_new_frame = p_enable;
- //VisualServer::get_singleton()->viewport_set_clear_on_new_frame(viewport,p_enable);
+ clear_mode = p_mode;
+ VS::get_singleton()->viewport_set_clear_mode(viewport, VS::ViewportClearMode(p_mode));
}
-bool Viewport::get_clear_on_new_frame() const {
+Viewport::ClearMode Viewport::get_clear_mode() const {
- return clear_on_new_frame;
+ return clear_mode;
}
void Viewport::set_shadow_atlas_size(int p_size) {
@@ -1246,12 +1246,6 @@ Viewport::ShadowAtlasQuadrantSubdiv Viewport::get_shadow_atlas_quadrant_subdiv(i
return shadow_atlas_quadrant_subdiv[p_quadrant];
}
-void Viewport::clear() {
-
- //clear=true;
- //VisualServer::get_singleton()->viewport_clear(viewport);
-}
-
Transform2D Viewport::_get_input_pre_xform() const {
Transform2D pre_xf;
@@ -2625,10 +2619,9 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_vflip", "enable"), &Viewport::set_vflip);
ClassDB::bind_method(D_METHOD("get_vflip"), &Viewport::get_vflip);
- ClassDB::bind_method(D_METHOD("set_clear_on_new_frame", "enable"), &Viewport::set_clear_on_new_frame);
- ClassDB::bind_method(D_METHOD("get_clear_on_new_frame"), &Viewport::get_clear_on_new_frame);
+ ClassDB::bind_method(D_METHOD("set_clear_mode", "mode"), &Viewport::set_clear_mode);
+ ClassDB::bind_method(D_METHOD("get_clear_mode"), &Viewport::get_clear_mode);
- ClassDB::bind_method(D_METHOD("clear"), &Viewport::clear);
ClassDB::bind_method(D_METHOD("set_update_mode", "mode"), &Viewport::set_update_mode);
ClassDB::bind_method(D_METHOD("get_update_mode"), &Viewport::get_update_mode);
@@ -2705,7 +2698,7 @@ void Viewport::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_draw", PROPERTY_HINT_ENUM, "Disabled,Unshaded,Overdraw,Wireframe"), "set_debug_draw", "get_debug_draw");
ADD_GROUP("Render Target", "render_target_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_v_flip"), "set_vflip", "get_vflip");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_clear_on_new_frame"), "set_clear_on_new_frame", "get_clear_on_new_frame");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_clear_mode", PROPERTY_HINT_ENUM, "Always,Never,NextFrame"), "set_clear_mode", "get_clear_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "render_target_update_mode", PROPERTY_HINT_ENUM, "Disabled,Once,When Visible,Always"), "set_update_mode", "get_update_mode");
ADD_GROUP("Audio Listener", "audio_listener_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_listener_enable_2d"), "set_as_audio_listener_2d", "is_audio_listener_2d");
@@ -2784,7 +2777,7 @@ Viewport::Viewport() {
gen_mipmaps = false;
vflip = false;
- clear_on_new_frame = true;
+
//clear=true;
update_mode = UPDATE_WHEN_VISIBLE;
@@ -2828,6 +2821,7 @@ Viewport::Viewport() {
usage = USAGE_3D;
debug_draw = DEBUG_DRAW_DISABLED;
+ clear_mode = CLEAR_MODE_ALWAYS;
}
Viewport::~Viewport() {
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index f527fa4f5b..ce2bc991f5 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -140,6 +140,13 @@ public:
DEBUG_DRAW_WIREFRAME,
};
+ enum ClearMode {
+
+ CLEAR_MODE_ALWAYS,
+ CLEAR_MODE_NEVER,
+ CLEAR_MODE_ONLY_NEXT_FRAME
+ };
+
private:
friend class ViewportTexture;
@@ -182,7 +189,7 @@ private:
bool transparent_bg;
bool vflip;
- bool clear_on_new_frame;
+ ClearMode clear_mode;
bool filter;
bool gen_mipmaps;
@@ -395,9 +402,8 @@ public:
void set_vflip(bool p_enable);
bool get_vflip() const;
- void set_clear_on_new_frame(bool p_enable);
- bool get_clear_on_new_frame() const;
- void clear();
+ void set_clear_mode(ClearMode p_mode);
+ ClearMode get_clear_mode() const;
void set_update_mode(UpdateMode p_mode);
UpdateMode get_update_mode() const;
@@ -466,6 +472,7 @@ VARIANT_ENUM_CAST(Viewport::ShadowAtlasQuadrantSubdiv);
VARIANT_ENUM_CAST(Viewport::MSAA);
VARIANT_ENUM_CAST(Viewport::Usage);
VARIANT_ENUM_CAST(Viewport::DebugDraw);
+VARIANT_ENUM_CAST(Viewport::ClearMode);
VARIANT_ENUM_CAST(Viewport::RenderInfo);
#endif
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 5236461ad3..315351d039 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -530,7 +530,7 @@ void SpatialMaterial::_update_shader() {
}
if (detail_uv == DETAIL_UV_2 && !flags[FLAG_UV2_USE_TRIPLANAR]) {
- code += "\tUV2=UV2*uv2_scale+uv2_offset;\n";
+ code += "\tUV2=UV2*uv2_scale.xy+uv2_offset.xy;\n";
}
if (flags[FLAG_UV1_USE_TRIPLANAR] || flags[FLAG_UV2_USE_TRIPLANAR]) {
//generate tangent and binormal in world space