summaryrefslogtreecommitdiffstats
path: root/scene
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-05-04 22:50:23 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-05-04 22:50:23 -0300
commit72ae89c5aa8da9110ec8f89e5558d5d04935f3b5 (patch)
tree453b2c8b8cc0edc588cee2dd3e440b30ff729ae2 /scene
parent3c17e0c91548299b60a6d3998eadb303418512cc (diff)
downloadredot-engine-72ae89c5aa8da9110ec8f89e5558d5d04935f3b5.tar.gz
Lots of 3D improvements:
-Object Manipulator Gizmo keeps proper scale in all windows and projections, (configurable on settings too). -Manipulator gizmos for other objects (camera, shapes, etc) massively improved and bug-fixed. -Manipulator gizmos are different for edited object and other objects. -Properly highlight manipulator gizmo handles when hovered. -Fixed bugs in fragment program when using more than 1 light together. -Reload png/jpg files automatically in editor if edited externally. -Added 4-stages Parallel Split Shadow Mapping, to improve shadow quality in large scenarios -Added PCF13 to improve smoothness of shadow borders -General optimization of directional light shadow mapping for Orthogonal,PSM and PSSM. -Fixed normal mapping when importing DAE files, works nicely now.
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/light.cpp5
-rw-r--r--scene/3d/light.h3
-rw-r--r--scene/gui/popup.cpp16
-rw-r--r--scene/gui/popup.h4
-rw-r--r--scene/resources/mesh.cpp28
-rw-r--r--scene/resources/mesh.h4
6 files changed, 55 insertions, 5 deletions
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 94c56850ef..b4b7b400c6 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -540,14 +540,15 @@ void DirectionalLight::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_shadow_param","param","value"),&DirectionalLight::set_shadow_param);
ObjectTypeDB::bind_method(_MD("get_shadow_param","param"),&DirectionalLight::get_shadow_param);
- ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/mode",PROPERTY_HINT_ENUM,"Orthogonal,Perspective,PSSM"),_SCS("set_shadow_mode"),_SCS("get_shadow_mode"));
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/mode",PROPERTY_HINT_ENUM,"Orthogonal,Perspective,PSSM 2 Splits,PSSM 4 Splits"),_SCS("set_shadow_mode"),_SCS("get_shadow_mode"));
ADD_PROPERTYI( PropertyInfo(Variant::REAL,"shadow/max_distance",PROPERTY_HINT_EXP_RANGE,"0.00,99999,0.01"),_SCS("set_shadow_param"),_SCS("get_shadow_param"), SHADOW_PARAM_MAX_DISTANCE);
ADD_PROPERTYI( PropertyInfo(Variant::REAL,"shadow/split_weight",PROPERTY_HINT_RANGE,"0.01,1.0,0.01"),_SCS("set_shadow_param"),_SCS("get_shadow_param"), SHADOW_PARAM_PSSM_SPLIT_WEIGHT);
ADD_PROPERTYI( PropertyInfo(Variant::REAL,"shadow/zoffset_scale",PROPERTY_HINT_RANGE,"0.01,1024.0,0.01"),_SCS("set_shadow_param"),_SCS("get_shadow_param"), SHADOW_PARAM_PSSM_ZOFFSET_SCALE);
BIND_CONSTANT( SHADOW_ORTHOGONAL );
BIND_CONSTANT( SHADOW_PERSPECTIVE );
- BIND_CONSTANT( SHADOW_PARALLEL_SPLIT );
+ BIND_CONSTANT( SHADOW_PARALLEL_2_SPLITS );
+ BIND_CONSTANT( SHADOW_PARALLEL_4_SPLITS );
BIND_CONSTANT( SHADOW_PARAM_MAX_DISTANCE );
BIND_CONSTANT( SHADOW_PARAM_PSSM_SPLIT_WEIGHT );
BIND_CONSTANT( SHADOW_PARAM_PSSM_ZOFFSET_SCALE );
diff --git a/scene/3d/light.h b/scene/3d/light.h
index 03bf336303..dea7dbee6c 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -138,7 +138,8 @@ public:
enum ShadowMode {
SHADOW_ORTHOGONAL,
SHADOW_PERSPECTIVE,
- SHADOW_PARALLEL_SPLIT
+ SHADOW_PARALLEL_2_SPLITS,
+ SHADOW_PARALLEL_4_SPLITS
};
enum ShadowParam {
SHADOW_PARAM_MAX_DISTANCE,
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 0a5b72d2ed..65ad02723c 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -38,7 +38,13 @@ void Popup::_input_event(InputEvent p_event) {
void Popup::_notification(int p_what) {
-
+ if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
+ if (popped_up && !is_visible()) {
+ popped_up=false;
+ notification(NOTIFICATION_POPUP_HIDE);
+ emit_signal("popup_hide");
+ }
+ }
}
void Popup::_fix_size() {
@@ -101,6 +107,7 @@ void Popup::popup_centered_minsize(const Size2& p_minsize) {
popup_centered( total_minsize );
+ popped_up=true;
}
@@ -127,6 +134,7 @@ void Popup::popup_centered(const Size2& p_size) {
_post_popup();
notification(NOTIFICATION_POST_POPUP);
+ popped_up=true;
}
void Popup::popup_centered_ratio(float p_screen_ratio) {
@@ -153,6 +161,7 @@ void Popup::popup_centered_ratio(float p_screen_ratio) {
_post_popup();
notification(NOTIFICATION_POST_POPUP);
+ popped_up=true;
}
@@ -171,6 +180,7 @@ void Popup::popup() {
_post_popup();
notification(NOTIFICATION_POST_POPUP);
+ popped_up=true;
}
void Popup::set_exclusive(bool p_exclusive) {
@@ -193,8 +203,11 @@ void Popup::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_exclusive","enable"),&Popup::set_exclusive);
ObjectTypeDB::bind_method(_MD("is_exclusive"),&Popup::is_exclusive);
ADD_SIGNAL( MethodInfo("about_to_show") );
+ ADD_SIGNAL( MethodInfo("popup_hide") );
ADD_PROPERTY( PropertyInfo( Variant::BOOL, "popup/exclusive"), _SCS("set_exclusive"),_SCS("is_exclusive") );
BIND_CONSTANT(NOTIFICATION_POST_POPUP);
+ BIND_CONSTANT(NOTIFICATION_POPUP_HIDE);
+
}
@@ -202,6 +215,7 @@ Popup::Popup() {
set_as_toplevel(true);
exclusive=false;
+ popped_up=false;
hide();
}
diff --git a/scene/gui/popup.h b/scene/gui/popup.h
index 3744ff283f..072b66c2c7 100644
--- a/scene/gui/popup.h
+++ b/scene/gui/popup.h
@@ -39,6 +39,7 @@ class Popup : public Control {
OBJ_TYPE( Popup, Control );
bool exclusive;
+ bool popped_up;
protected:
@@ -51,7 +52,8 @@ protected:
public:
enum {
- NOTIFICATION_POST_POPUP=80
+ NOTIFICATION_POST_POPUP=80,
+ NOTIFICATION_POPUP_HIDE=81
};
void set_exclusive(bool p_exclusive);
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 244ee09c22..6d0a1cf76b 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -99,6 +99,12 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) {
return true;
}
+ if (sname=="custom_aabb/custom_aabb") {
+
+ set_custom_aabb(p_value);
+ return true;
+ }
+
if (!sname.begins_with("surfaces"))
return false;
@@ -165,6 +171,10 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const {
int idx=sname.get_slice("/",1).to_int()-1;
r_ret=surface_get_material(idx);
return true;
+ } else if (sname=="custom_aabb/custom_aabb") {
+
+ r_ret=custom_aabb;
+ return true;
} else if (!sname.begins_with("surfaces"))
return false;
@@ -202,6 +212,9 @@ void Mesh::_get_property_list( List<PropertyInfo> *p_list) const {
p_list->push_back( PropertyInfo( Variant::DICTIONARY,"surfaces/"+itos(i), PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR ) );
p_list->push_back( PropertyInfo( Variant::OBJECT,"materials/"+itos(i+1), PROPERTY_HINT_RESOURCE_TYPE,"Material",PROPERTY_USAGE_EDITOR ) );
}
+
+ p_list->push_back( PropertyInfo( Variant::_AABB,"custom_aabb/custom_aabb" ) );
+
}
@@ -473,6 +486,19 @@ AABB Mesh::get_aabb() const {
return aabb;
}
+
+void Mesh::set_custom_aabb(const AABB& p_custom) {
+
+ custom_aabb=p_custom;
+ VS::get_singleton()->mesh_set_custom_aabb(mesh,custom_aabb);
+}
+
+AABB Mesh::get_custom_aabb() const {
+
+ return custom_aabb;
+}
+
+
DVector<Face3> Mesh::get_faces() const {
@@ -700,6 +726,8 @@ void Mesh::_bind_methods() {
ObjectTypeDB::bind_method(_MD("center_geometry"),&Mesh::center_geometry);
ObjectTypeDB::set_method_flags(get_type_static(),_SCS("center_geometry"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
+ ObjectTypeDB::bind_method(_MD("set_custom_aabb","aabb"),&Mesh::set_custom_aabb);
+ ObjectTypeDB::bind_method(_MD("get_custom_aabb"),&Mesh::get_custom_aabb);
BIND_CONSTANT( NO_INDEX_ARRAY );
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index 3a11a8e171..5243163a4d 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -107,6 +107,7 @@ private:
AABB aabb;
MorphTargetMode morph_target_mode;
Vector<StringName> morph_targets;
+ AABB custom_aabb;
mutable Ref<TriangleMesh> triangle_mesh;
@@ -156,6 +157,9 @@ public:
void add_surface_from_mesh_data(const Geometry::MeshData& p_mesh_data);
+ void set_custom_aabb(const AABB& p_custom);
+ AABB get_custom_aabb() const;
+
AABB get_aabb() const;
virtual RID get_rid() const;