summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--core/globals.cpp12
-rw-r--r--doc/base/classes.xml48
-rw-r--r--doc/core_classes.xml4
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp3
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp10
-rw-r--r--drivers/gles2/shaders/material.glsl8
-rw-r--r--scene/gui/dialogs.cpp4
-rw-r--r--scene/gui/popup_menu.cpp9
-rw-r--r--scene/resources/shader_graph.cpp1
-rw-r--r--servers/visual/shader_language.cpp3
11 files changed, 81 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index a7ac2d2fc7..f24d91a7ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -296,3 +296,4 @@ cscope.po.out
godot.creator.*
projects/
+platform/windows/godot_res.res
diff --git a/core/globals.cpp b/core/globals.cpp
index ffd4cf5d5e..aee708d0cd 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -332,6 +332,7 @@ Error Globals::setup(const String& p_path,const String & p_main_pack) {
String candidate = d->get_current_dir();
String current_dir = d->get_current_dir();
+ String exec_name = OS::get_singleton()->get_executable_path().get_file().basename();
bool found = false;
bool first_time=true;
@@ -339,7 +340,16 @@ Error Globals::setup(const String& p_path,const String & p_main_pack) {
//try to load settings in ascending through dirs shape!
//tries to open pack, but only first time
- if (first_time && (_load_resource_pack(current_dir+"/data.pck") || _load_resource_pack(current_dir+"/data.pcz") )) {
+ if (first_time && (_load_resource_pack(current_dir+"/"+exec_name+".pck") || _load_resource_pack(current_dir+"/"+exec_name+".pcz") )) {
+ if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) {
+
+ _load_settings("res://override.cfg");
+ found=true;
+
+
+ }
+ break;
+ } else if (first_time && (_load_resource_pack(current_dir+"/data.pck") || _load_resource_pack(current_dir+"/data.pcz") )) {
if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) {
_load_settings("res://override.cfg");
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 44a7cccfe5..a26458a14f 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -4371,7 +4371,7 @@
Stop a given voice.
</description>
</method>
- <method name="free">
+ <method name="free_rid">
<argument index="0" name="rid" type="RID">
</argument>
<description>
@@ -37623,7 +37623,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="vec" type="Vector2">
</argument>
<description>
- Reflects/mirrors the vector around another vector.
+ Like "slide", but reflects the Vector instead of continuing along the wall.
</description>
</method>
<method name="rotated">
@@ -37687,10 +37687,10 @@ This method controls whether the position between two cached points is interpola
</class>
<class name="Vector2Array" category="Built-In Types">
<brief_description>
- An Array of Vector2's.
+ An Array of Vector2.
</brief_description>
<description>
- An Array specifically designed to hold Vector2's.
+ An Array specifically designed to hold Vector2.
</description>
<methods>
<method name="get">
@@ -37699,21 +37699,21 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="idx" type="int">
</argument>
<description>
- Get the Vector2 at the given index.
+ Returns the Vector2 at the given index.
</description>
</method>
<method name="push_back">
<argument index="0" name="vector2" type="Vector2">
</argument>
<description>
- Insert a new Vector2.
+ Inserts a Vector2 at the end.
</description>
</method>
<method name="resize">
<argument index="0" name="idx" type="int">
</argument>
<description>
- Set the size of the Vector2Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array.
+ Sets the size of the Vector2Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array.
</description>
</method>
<method name="set">
@@ -37722,7 +37722,7 @@ This method controls whether the position between two cached points is interpola
<argument index="1" name="vector2" type="Vector2">
</argument>
<description>
- Set the Vector2 at the given index.
+ Changes the Vector2 at the given index.
</description>
</method>
<method name="size">
@@ -37757,12 +37757,14 @@ This method controls whether the position between two cached points is interpola
<return type="Vector3">
</return>
<description>
+ Returns a new vector with all components in absolute values (e.g. positive).
</description>
</method>
<method name="ceil">
<return type="Vector3">
</return>
<description>
+ Returns a new vector with all components rounded up.
</description>
</method>
<method name="cross">
@@ -37786,7 +37788,7 @@ This method controls whether the position between two cached points is interpola
<argument index="3" name="t" type="float">
</argument>
<description>
- Perform a cubic interpolation between vectors a,b,c,d (b is current), by the given amount (i).
+ Perform a cubic interpolation between vectors pre_a, a, b, post_b (a is current), by the given amount (t).
</description>
</method>
<method name="distance_squared_to">
@@ -37795,7 +37797,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="b" type="Vector3">
</argument>
<description>
- Return the squared distance (distance minus the last square root) to b.
+ Return the squared distance (distance minus the last square root) to b. Prefer this function over distance_to if you need to sort vectors or need the squared distance for some formula.
</description>
</method>
<method name="distance_to">
@@ -37820,13 +37822,14 @@ This method controls whether the position between two cached points is interpola
<return type="Vector3">
</return>
<description>
+ Returns a new vector with all components rounded down.
</description>
</method>
<method name="inverse">
<return type="Vector3">
</return>
<description>
- Returns the inverse of the vector. this is the same as Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z )
+ Returns the inverse of the vector. This is the same as Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z )
</description>
</method>
<method name="length">
@@ -37840,7 +37843,7 @@ This method controls whether the position between two cached points is interpola
<return type="float">
</return>
<description>
- Return the length of the vector, squared.
+ Return the length of the vector, squared. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula.
</description>
</method>
<method name="linear_interpolate">
@@ -37851,26 +37854,28 @@ This method controls whether the position between two cached points is interpola
<argument index="1" name="t" type="float">
</argument>
<description>
- Linearly interpolates the vector to a given one (b), by the given amount (i).
+ Linearly interpolates the vector to a given one (b), by the given amount (t).
</description>
</method>
<method name="max_axis">
<return type="int">
</return>
<description>
+ Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the largest.
</description>
</method>
<method name="min_axis">
<return type="int">
</return>
<description>
+ Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the smallest.
</description>
</method>
<method name="normalized">
<return type="Vector3">
</return>
<description>
- Return a copy of the normalized vector to unit length. This is the same as v / v.length()
+ Return a copy of the normalized vector to unit length. This is the same as v / v.length().
</description>
</method>
<method name="reflect">
@@ -37879,6 +37884,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="by" type="Vector3">
</argument>
<description>
+ Like "slide", but reflects the Vector instead of continuing along the wall.
</description>
</method>
<method name="rotated">
@@ -37889,6 +37895,7 @@ This method controls whether the position between two cached points is interpola
<argument index="1" name="phi" type="float">
</argument>
<description>
+ Rotates the vector around some axis by phi radians.
</description>
</method>
<method name="slide">
@@ -37897,6 +37904,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="by" type="Vector3">
</argument>
<description>
+ Slides the vector along a wall.
</description>
</method>
<method name="snapped">
@@ -37918,6 +37926,7 @@ This method controls whether the position between two cached points is interpola
<argument index="2" name="z" type="float">
</argument>
<description>
+ Returns a Vector3 with the given components.
</description>
</method>
</methods>
@@ -37931,17 +37940,22 @@ This method controls whether the position between two cached points is interpola
</members>
<constants>
<constant name="AXIS_X" value="0">
+ Enumerated value for the X axis. Returned by functions like max_axis or min_axis.
</constant>
<constant name="AXIS_Y" value="1">
+ Enumerated value for the Y axis.
</constant>
<constant name="AXIS_Z" value="2">
+ Enumerated value for the Z axis.
</constant>
</constants>
</class>
<class name="Vector3Array" category="Built-In Types">
<brief_description>
+ An Array of Vector3.
</brief_description>
<description>
+ An Array specifically designed to hold Vector3.
</description>
<methods>
<method name="get">
@@ -37950,18 +37964,21 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the Vector3 at the given index.
</description>
</method>
<method name="push_back">
<argument index="0" name="vector3" type="Vector3">
</argument>
<description>
+ Inserts a Vector3 at the end.
</description>
</method>
<method name="resize">
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Sets the size of the Vector3Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array.
</description>
</method>
<method name="set">
@@ -37970,12 +37987,14 @@ This method controls whether the position between two cached points is interpola
<argument index="1" name="vector3" type="Vector3">
</argument>
<description>
+ Changes the Vector3 at the given index.
</description>
</method>
<method name="size">
<return type="int">
</return>
<description>
+ Returns the size of the array.
</description>
</method>
<method name="Vector3Array">
@@ -37984,6 +38003,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="from" type="Array">
</argument>
<description>
+ Constructs a new Vector3Array. Optionally, you can pass in an Array that will be converted.
</description>
</method>
</methods>
diff --git a/doc/core_classes.xml b/doc/core_classes.xml
index 02b46ac4b9..c37b50f122 100644
--- a/doc/core_classes.xml
+++ b/doc/core_classes.xml
@@ -575,8 +575,8 @@
3x3 Matrix.
</brief_description>
<description>
- </description>
Matrix represent a 3x3 (3 rows by 3 columns) transformation matrix. it is used mainly to represent and accumulate transformations such as rotation or scale when used as an OCS (oriented coordinate system).
+ </description>
<methods>
<method name="invert">
<description>
@@ -937,8 +937,8 @@
Vector used for 2D Math.
</brief_description>
<description>
- </description>
Vector class, which performs basic 2D vector math operations.
+ </description>
<methods>
<method name="operator+">
<argument index="0" name="b" type="Vector2">
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index b473e8493f..39b448d6e0 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -4641,6 +4641,9 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const {
if (light_flags.uses_light) {
enablers.push_back("#define USE_LIGHT_SHADER_CODE\n");
}
+ if (light_flags.uses_shadow_color) {
+ enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n");
+ }
if (light_flags.uses_time || fragment_flags.uses_time || vertex_flags.uses_time) {
enablers.push_back("#define USE_TIME\n");
uses_time=true;
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index c8f59ce22b..f981529ee3 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -221,6 +221,10 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a
uses_light=true;
}
+ if (vnode->name==vname_shadow) {
+ uses_shadow_color=true;
+ }
+
}
if (type==ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX) {
@@ -783,13 +787,14 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
replace_table["texscreen"]= "texscreen";
replace_table["texpos"]= "texpos";
- mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["POSITION"] = "gl_Position";
+
mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SRC_VERTEX"] = "vertex_in.xyz";
mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SRC_NORMAL"] = "normal_in";
mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SRC_TANGENT"]="tangent_in";
mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SRC_BINORMALF"]="binormalf";
-
+
+ mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["POSITION"] = "gl_Position";
mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["VERTEX"]="vertex_interp";
mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["NORMAL"]="normal_interp";
mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["TANGENT"]="tangent_interp";
@@ -858,6 +863,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
mode_replace_table[ShaderLanguage::SHADER_MATERIAL_LIGHT]["LIGHT"]="light";
mode_replace_table[ShaderLanguage::SHADER_MATERIAL_LIGHT]["POINT_COORD"]="gl_PointCoord";
mode_replace_table[ShaderLanguage::SHADER_MATERIAL_LIGHT]["TIME"]="time";
+ mode_replace_table[ShaderLanguage::SHADER_MATERIAL_LIGHT]["SHADOW"]="shadow_color";
mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX]["SRC_VERTEX"]="src_vtx";
mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX]["VERTEX"]="outvec.xy";
diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl
index 38fb03ab5c..ccd80bf2f0 100644
--- a/drivers/gles2/shaders/material.glsl
+++ b/drivers/gles2/shaders/material.glsl
@@ -1175,6 +1175,10 @@ FRAGMENT_SHADER_CODE
vec3 mdiffuse = diffuse.rgb;
vec3 light;
+#if defined(USE_LIGHT_SHADOW_COLOR)
+ vec3 shadow_color=vec3(0.0,0.0,0.0);
+#endif
+
#if defined(USE_LIGHT_SHADER_CODE)
//light is written by the light shader
{
@@ -1195,6 +1199,10 @@ LIGHT_SHADER_CODE
#endif
diffuse.rgb = const_light_mult * ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation;
+#if defined(USE_LIGHT_SHADOW_COLOR)
+ diffuse.rgb += light * shadow_color * attenuation * (1.0 - shadow_attenuation);
+#endif
+
#ifdef USE_FOG
diffuse.rgb = mix(diffuse.rgb,fog_interp.rgb,fog_interp.a);
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 0c0f924f52..efda8a66e1 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -308,7 +308,9 @@ void AcceptDialog::_bind_methods() {
ADD_SIGNAL( MethodInfo("confirmed") );
ADD_SIGNAL( MethodInfo("custom_action",PropertyInfo(Variant::STRING,"action")) );
-
+ ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"dialog/text",PROPERTY_HINT_MULTILINE_TEXT,"",PROPERTY_USAGE_DEFAULT_INTL),_SCS("set_text"),_SCS("get_text"));
+ ADD_PROPERTY( PropertyInfo(Variant::BOOL, "dialog/hide_on_ok"),_SCS("set_hide_on_ok"),_SCS("get_hide_on_ok") );
+
}
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 99663fb2e2..20f28ecf10 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -170,7 +170,14 @@ void PopupMenu::_activate_submenu(int over) {
Point2 p = get_global_pos();
Rect2 pr(p,get_size());
Ref<StyleBox> style = get_stylebox("panel");
- pm->set_pos(p+Point2(get_size().width,items[over]._ofs_cache-style->get_offset().y));
+
+ Point2 pos = p+Point2(get_size().width,items[over]._ofs_cache-style->get_offset().y);
+ Size2 size = pm->get_size();
+ // fix pos
+ if (pos.x+size.width > get_viewport_rect().size.width)
+ pos.x=p.x-size.width;
+
+ pm->set_pos(pos);
pm->popup();
PopupMenu *pum = pm->cast_to<PopupMenu>();
diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp
index d5204f45d5..7b67eaeda8 100644
--- a/scene/resources/shader_graph.cpp
+++ b/scene/resources/shader_graph.cpp
@@ -1435,6 +1435,7 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={
{MODE_MATERIAL,SHADER_TYPE_LIGHT,"ShadeParam","SHADE_PARAM","",SLOT_TYPE_SCALAR,SLOT_IN},
//light out
{MODE_MATERIAL,SHADER_TYPE_LIGHT,"Light","LIGHT","",SLOT_TYPE_VEC,SLOT_OUT},
+ {MODE_MATERIAL,SHADER_TYPE_LIGHT,"Shadow", "SHADOW", "",SLOT_TYPE_VEC, SLOT_OUT },
//canvas item vertex in
{MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"Vertex","vec3(SRC_VERTEX,0)","",SLOT_TYPE_VEC,SLOT_IN},
{MODE_CANVAS_ITEM,SHADER_TYPE_VERTEX,"UV","SRC_UV","",SLOT_TYPE_VEC,SLOT_IN},
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 6532c3f0ac..6c5f64edd9 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -1113,7 +1113,8 @@ const ShaderLanguage::BuiltinsDef ShaderLanguage::light_builtins_defs[]={
{ "SPECULAR_EXP", TYPE_FLOAT},
{ "SHADE_PARAM", TYPE_FLOAT},
{ "LIGHT", TYPE_VEC3},
- { "POINT_COORD", TYPE_VEC2},
+ { "SHADOW", TYPE_VEC3 },
+ { "POINT_COORD", TYPE_VEC2 },
// { "SCREEN_POS", TYPE_VEC2},
// { "SCREEN_TEXEL_SIZE", TYPE_VEC2},
{ "TIME", TYPE_FLOAT},