diff options
31 files changed, 416 insertions, 182 deletions
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h index f99e16da15..e37d593f9f 100644 --- a/core/command_queue_mt.h +++ b/core/command_queue_mt.h @@ -227,6 +227,27 @@ class CommandQueueMT { virtual void call() { (instance->*method)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } }; + template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class P11, class P12> + struct Command12 : public CommandBase { + + T *instance; + M method; + typename GetSimpleTypeT<P1>::type_t p1; + typename GetSimpleTypeT<P2>::type_t p2; + typename GetSimpleTypeT<P3>::type_t p3; + typename GetSimpleTypeT<P4>::type_t p4; + typename GetSimpleTypeT<P5>::type_t p5; + typename GetSimpleTypeT<P6>::type_t p6; + typename GetSimpleTypeT<P7>::type_t p7; + typename GetSimpleTypeT<P8>::type_t p8; + typename GetSimpleTypeT<P9>::type_t p9; + typename GetSimpleTypeT<P10>::type_t p10; + typename GetSimpleTypeT<P11>::type_t p11; + typename GetSimpleTypeT<P12>::type_t p12; + + virtual void call() { (instance->*method)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } + }; + /* comands that return */ template <class T, class M, class R> @@ -906,6 +927,31 @@ public: if (sync) sync->post(); } + template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class P11, class P12> + void push(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11, P12 p12) { + + Command12<T, M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12> *cmd = allocate_and_lock<Command12<T, M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12> >(); + + cmd->instance = p_instance; + cmd->method = p_method; + cmd->p1 = p1; + cmd->p2 = p2; + cmd->p3 = p3; + cmd->p4 = p4; + cmd->p5 = p5; + cmd->p6 = p6; + cmd->p7 = p7; + cmd->p8 = p8; + cmd->p9 = p9; + cmd->p10 = p10; + cmd->p11 = p11; + cmd->p12 = p12; + + unlock(); + + if (sync) sync->post(); + } + /*** PUSH AND RET COMMANDS ***/ template <class T, class M, class R> diff --git a/doc/classes/ARVRAnchor.xml b/doc/classes/ARVRAnchor.xml index 6e11034073..ecd882cdb0 100644 --- a/doc/classes/ARVRAnchor.xml +++ b/doc/classes/ARVRAnchor.xml @@ -60,6 +60,7 @@ </methods> <members> <member name="anchor_id" type="int" setter="set_anchor_id" getter="get_anchor_id"> + The anchor's id. You can set this before the anchor itself exists. The first anchor gets an id of [code]1[/code], the second an id of [code]2[/code], etc. When anchors get removed, the engine can then assign the corresponding id to new anchors. The most common situation where anchors 'disappear' is when the AR server identifies that two anchors represent different parts of the same plane and merges them. </member> </members> <constants> diff --git a/doc/classes/ARVRController.xml b/doc/classes/ARVRController.xml index 557f915c1d..af1deda2f0 100644 --- a/doc/classes/ARVRController.xml +++ b/doc/classes/ARVRController.xml @@ -31,6 +31,7 @@ <return type="int" enum="ARVRPositionalTracker.TrackerHand"> </return> <description> + Returns the hand holding this controller, if known. See TRACKER_* constants in [ARVRPositionalTracker]. </description> </method> <method name="get_is_active" qualifiers="const"> @@ -77,6 +78,7 @@ </methods> <members> <member name="controller_id" type="int" setter="set_controller_id" getter="get_controller_id"> + The controller's id. The first controller that the [ARVRServer] detects will have id 1, the second id 2, the third id 3, etc. When a controller is turned off, it's slot is freed. This ensures controllers will keep the same id even when controllers with lower ids are turned off. </member> </members> <signals> diff --git a/doc/classes/ARVROrigin.xml b/doc/classes/ARVROrigin.xml index 28864bb3ae..226a69dea4 100644 --- a/doc/classes/ARVROrigin.xml +++ b/doc/classes/ARVROrigin.xml @@ -35,6 +35,8 @@ </methods> <members> <member name="world_scale" type="float" setter="set_world_scale" getter="get_world_scale"> + Allows you to adjust the scale to your game's units. Most AR/VR platforms assume a scale of 1 game world unit = 1 meter in the real world. + Note that this method is a passthrough to the [ARVRServer] itself. </member> </members> <constants> diff --git a/doc/classes/ARVRPositionalTracker.xml b/doc/classes/ARVRPositionalTracker.xml index 1379677344..686ac1db77 100644 --- a/doc/classes/ARVRPositionalTracker.xml +++ b/doc/classes/ARVRPositionalTracker.xml @@ -17,6 +17,7 @@ <return type="int" enum="ARVRPositionalTracker.TrackerHand"> </return> <description> + Returns the hand holding this tracker, if known. See TRACKER_* constants. </description> </method> <method name="get_joy_id" qualifiers="const"> @@ -80,10 +81,13 @@ </methods> <constants> <constant name="TRACKER_HAND_UNKNOWN" value="0"> + The hand this tracker is held in is unknown or not applicable. </constant> <constant name="TRACKER_LEFT_HAND" value="1"> + This tracker is the left hand controller. </constant> <constant name="TRACKER_RIGHT_HAND" value="2"> + This tracker is the right hand controller. </constant> </constants> </class> diff --git a/doc/classes/ARVRServer.xml b/doc/classes/ARVRServer.xml index 0693851203..bb7ac2c052 100644 --- a/doc/classes/ARVRServer.xml +++ b/doc/classes/ARVRServer.xml @@ -121,6 +121,7 @@ </methods> <members> <member name="world_scale" type="float" setter="set_world_scale" getter="get_world_scale"> + Allows you to adjust the scale to your game's units. Most AR/VR platforms assume a scale of 1 game world unit = 1 meter in the real world. </member> </members> <signals> diff --git a/doc/classes/Curve2D.xml b/doc/classes/Curve2D.xml index 4362887be3..99ec2b7d94 100644 --- a/doc/classes/Curve2D.xml +++ b/doc/classes/Curve2D.xml @@ -32,6 +32,7 @@ <return type="void"> </return> <description> + Removes all points from the curve. </description> </method> <method name="get_bake_interval" qualifiers="const"> @@ -191,8 +192,10 @@ </methods> <members> <member name="_data" type="Dictionary" setter="_set_data" getter="_get_data"> + The points describing the curve. Value is a [Dictionary] with the keys [code]in[/code], [code]out[/code], and [code]pos[/code]. The key pos is the position of a vertex of the curve, the key in is the vector from that position to the control point before this vertex, the key out is the vector from that position to the controlpoint after this vertex. </member> <member name="bake_interval" type="float" setter="set_bake_interval" getter="get_bake_interval"> + The distance in pixels between two adjacent cached points. Changing it forces the cache to be recomputed the next time the [method get_baked_points] or [method get_baked_length] function is called. The smaller the distance, the more points in the cache and the more memory it will consume, so use with care. </member> </members> <constants> diff --git a/doc/classes/EditorScript.xml b/doc/classes/EditorScript.xml index 8856e3362a..245dbc078d 100644 --- a/doc/classes/EditorScript.xml +++ b/doc/classes/EditorScript.xml @@ -11,9 +11,9 @@ extends EditorScript func _run(): - print("Hello from the Godot Editor!") + print("Hello from the Godot Editor!") [/codeblock] - Note that the script is run in the Editor context, which means the output is visible in the console window started with the Editor (STDOUT) instead of the usual Godot *Output* dock. + Note that the script is run in the Editor context, which means the output is visible in the console window started with the Editor (STDOUT) instead of the usual Godot [i]Output[/i] dock. </description> <tutorials> </tutorials> diff --git a/doc/classes/Node2D.xml b/doc/classes/Node2D.xml index 084bee92df..b00020b227 100644 --- a/doc/classes/Node2D.xml +++ b/doc/classes/Node2D.xml @@ -26,7 +26,7 @@ <argument index="0" name="pivot" type="Vector2"> </argument> <description> - Set the pivot position of the 2D node to 'pivot' value. Only some Node2Ds implement this method. + Sets the node's pivot position. </description> </method> <method name="get_angle_to" qualifiers="const"> @@ -143,7 +143,7 @@ <argument index="1" name="scaled" type="bool" default="false"> </argument> <description> - Apply a local translation on the node's X axis based on the process's 'delta'. If 'scaled' is false, normalizes the movement. + Applies a local translation on the node's X axis based on the [method Node._process]'s [code]delta[/code]. If [code]scaled[/code] is false, normalizes the movement. </description> </method> <method name="move_local_y"> @@ -154,7 +154,7 @@ <argument index="1" name="scaled" type="bool" default="false"> </argument> <description> - Apply a local translation on the node's Y axis based on the process's 'delta'. If 'scaled' is false, normalizes the movement. + Applies a local translation on the node's Y axis based on the [method Node._process]'s [code]delta[/code]. If [code]scaled[/code] is false, normalizes the movement. </description> </method> <method name="rotate"> @@ -163,7 +163,7 @@ <argument index="0" name="radians" type="float"> </argument> <description> - Apply a rotation to the node, in radians, starting from its current rotation. + Applies a rotation to the node, in radians, starting from its current rotation. </description> </method> <method name="set_global_position"> @@ -172,7 +172,7 @@ <argument index="0" name="position" type="Vector2"> </argument> <description> - Set the node's global position. + Sets the node's global position. </description> </method> <method name="set_global_rotation"> @@ -181,7 +181,7 @@ <argument index="0" name="radians" type="float"> </argument> <description> - Set the node's global rotation in radians. + Sets the node's global rotation in radians. </description> </method> <method name="set_global_rotation_in_degrees"> @@ -190,7 +190,7 @@ <argument index="0" name="degrees" type="float"> </argument> <description> - Set the node's global rotation in degrees. + Sets the node's global rotation in degrees. </description> </method> <method name="set_global_scale"> @@ -199,7 +199,7 @@ <argument index="0" name="scale" type="Vector2"> </argument> <description> - Set the node's global scale. + Sets the node's global scale. </description> </method> <method name="set_global_transform"> @@ -208,7 +208,7 @@ <argument index="0" name="xform" type="Transform2D"> </argument> <description> - Set the node's global [Transform2D]. + Sets the node's global [Transform2D]. </description> </method> <method name="set_position"> @@ -217,7 +217,7 @@ <argument index="0" name="position" type="Vector2"> </argument> <description> - Set the node's position. + Sets the node's position. </description> </method> <method name="set_rotation"> @@ -226,7 +226,7 @@ <argument index="0" name="radians" type="float"> </argument> <description> - Set the node's rotation in radians. + Sets the node's rotation in radians. </description> </method> <method name="set_rotation_in_degrees"> @@ -235,7 +235,7 @@ <argument index="0" name="degrees" type="float"> </argument> <description> - Set the node's rotation in degrees. + Sets the node's rotation in degrees. </description> </method> <method name="set_scale"> @@ -244,7 +244,7 @@ <argument index="0" name="scale" type="Vector2"> </argument> <description> - Set the node's scale. + Sets the node's scale. </description> </method> <method name="set_transform"> @@ -253,7 +253,7 @@ <argument index="0" name="xform" type="Transform2D"> </argument> <description> - Set the node's local [Transform2D]. + Sets the node's local [Transform2D]. </description> </method> <method name="set_z"> @@ -262,7 +262,7 @@ <argument index="0" name="z" type="int"> </argument> <description> - Set the node's Z-index. + Sets the node's Z-index. </description> </method> <method name="set_z_as_relative"> @@ -271,7 +271,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> - Make the node's Z-index relative to its parent's Z-index. If this node's Z-index is 2 and its parent's effective Z-index is 3, then this node's effective Z-index will be 2 + 3 = 5. + Makes the node's Z-index relative to its parent's Z-index. If this node's Z-index is 2 and its parent's effective Z-index is 3, then this node's effective Z-index will be 2 + 3 = 5. </description> </method> <method name="to_global" qualifiers="const"> @@ -280,6 +280,7 @@ <argument index="0" name="local_point" type="Vector2"> </argument> <description> + Converts a local point's coordinates to global coordinates. </description> </method> <method name="to_local" qualifiers="const"> @@ -288,6 +289,7 @@ <argument index="0" name="global_point" type="Vector2"> </argument> <description> + Converts a global point's coordinates to local coordinates. </description> </method> <method name="translate"> @@ -296,7 +298,7 @@ <argument index="0" name="offset" type="Vector2"> </argument> <description> - Translate the node locally by the 'offset' vector, starting from its current local position. + Translates the node by the given [code]offset[/code] in local coordinates. </description> </method> </methods> diff --git a/doc/classes/ParallaxBackground.xml b/doc/classes/ParallaxBackground.xml index a7d616129a..21b6150900 100644 --- a/doc/classes/ParallaxBackground.xml +++ b/doc/classes/ParallaxBackground.xml @@ -4,7 +4,7 @@ A node used to create a parallax scrolling background. </brief_description> <description> - A ParallaxBackground will use one or more [ParallaxLayer] nodes to create a parallax scrolling background. Each [ParallaxLayer] can be set to move at different speeds relative to the camera movement, this can be used to create an illusion of depth in a 2D game. + A ParallaxBackground uses one or more [ParallaxLayer] child nodes to create a parallax effect. Each [ParallaxLayer] can move at a different speed using [member ParallaxLayer.motion_offset]. This creates an illusion of depth in a 2D game. If not used with a [Camera2D], you must manually calculate the [member scroll_offset]. </description> <tutorials> </tutorials> @@ -108,16 +108,22 @@ </methods> <members> <member name="scroll_base_offset" type="Vector2" setter="set_scroll_base_offset" getter="get_scroll_base_offset"> + Base position offset of all [ParallaxLayer] children. </member> <member name="scroll_base_scale" type="Vector2" setter="set_scroll_base_scale" getter="get_scroll_base_scale"> + Base motion scale of all [ParallaxLayer] children. </member> <member name="scroll_ignore_camera_zoom" type="bool" setter="set_ignore_camera_zoom" getter="is_ignore_camera_zoom"> + If [code]true[/code] elements in [ParallaxLayer] child aren't affected by the zoom level of the camera. </member> <member name="scroll_limit_begin" type="Vector2" setter="set_limit_begin" getter="get_limit_begin"> + Top left limits for scrolling to begin. If the camera is outside of this limit the background will stop scrolling. Must be lower than [member scroll_limit_end] to work. </member> <member name="scroll_limit_end" type="Vector2" setter="set_limit_end" getter="get_limit_end"> + Right bottom limits for scrolling to end. If the camera is outside of this limit the background will stop scrolling. Must be higher than [member scroll_limit_begin] to work. </member> <member name="scroll_offset" type="Vector2" setter="set_scroll_offset" getter="get_scroll_offset"> + The ParallaxBackground's scroll value. Calculated automatically when using a [Camera2D], but can be used to manually manage scrolling when no camera is present. </member> </members> <constants> diff --git a/doc/classes/ParallaxLayer.xml b/doc/classes/ParallaxLayer.xml index 6cf5549c8f..8de7e05578 100644 --- a/doc/classes/ParallaxLayer.xml +++ b/doc/classes/ParallaxLayer.xml @@ -4,7 +4,8 @@ A parallax scrolling layer to be used with [ParallaxBackground]. </brief_description> <description> - A ParallaxLayer must be the child of a [ParallaxBackground] node. All child nodes will be affected by the parallax scrolling of this layer. + A ParallaxLayer must be the child of a [ParallaxBackground] node. Each ParallaxLayer can be set to move at different speeds relative to the camera movement or the [member ParallaxBackground.scroll_offset] value. + This node's children will be affected by its scroll offset. </description> <tutorials> </tutorials> @@ -60,10 +61,13 @@ </methods> <members> <member name="motion_mirroring" type="Vector2" setter="set_mirroring" getter="get_mirroring"> + The ParallaxLayer's [Texture] mirroring. Useful for creating an infinite scrolling background. If an axis is set to [code]0[/code] the [Texture] will not be mirrored. Default value: [code](0, 0)[/code]. </member> <member name="motion_offset" type="Vector2" setter="set_motion_offset" getter="get_motion_offset"> + The ParallaxLayer's offset relative to the parent ParallaxBackground's [member ParallaxBackground.scroll_offset]. </member> <member name="motion_scale" type="Vector2" setter="set_motion_scale" getter="get_motion_scale"> + Multiplies the ParallaxLayer's motion. If an axis is set to [code]0[/code] it will not scroll. </member> </members> <constants> diff --git a/doc/classes/Path2D.xml b/doc/classes/Path2D.xml index 839e617375..722e0c1240 100644 --- a/doc/classes/Path2D.xml +++ b/doc/classes/Path2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Path2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Container for a [Curve2D]. + Contains a [Curve2D] path for [PathFollow2D] nodes to follow. </brief_description> <description> - This class is a container/Node-ification of a [Curve2D], so it can have [Node2D] properties and [Node] info. + Can have [PathFollow2D] child-nodes moving along the [Curve2D]. See [PathFollow2D] for more information on this usage. </description> <tutorials> </tutorials> @@ -30,6 +30,7 @@ </methods> <members> <member name="curve" type="Curve2D" setter="set_curve" getter="get_curve"> + A [Curve2D] describing the path. </member> </members> <constants> diff --git a/doc/classes/Quat.xml b/doc/classes/Quat.xml index f07e143aa0..d351cdfbc0 100644 --- a/doc/classes/Quat.xml +++ b/doc/classes/Quat.xml @@ -4,7 +4,10 @@ Quaternion. </brief_description> <description> - Quaternion is a 4 dimensional vector that is used to represent a rotation. It mainly exists to perform SLERP (spherical-linear interpolation) between two rotations. Multiplying quaternions also cheaply reproduces rotation sequences. However quaternions need to be often renormalized, or else they suffer from precision issues. + A 4-dimensional vector representing a rotation. + The vector represents a 4 dimensional complex number where multiplication of the basis elements is not commutative (multiplying i with j gives a different result than multiplying j with i). + Multiplying quaternions reproduces rotation sequences. However quaternions need to be often renormalized, or else they suffer from precision issues. + It can be used to perform SLERP (spherical-linear interpolation) between two rotations. </description> <tutorials> </tutorials> @@ -23,6 +26,7 @@ <argument index="3" name="w" type="float"> </argument> <description> + Returns a quaternion defined by these values. </description> </method> <method name="Quat"> @@ -57,6 +61,7 @@ <argument index="3" name="t" type="float"> </argument> <description> + Performs a cubic spherical-linear interpolation with another quaternion. </description> </method> <method name="dot"> @@ -111,7 +116,7 @@ <argument index="1" name="t" type="float"> </argument> <description> - Perform a spherical-linear interpolation with another quaternion. + Performs a spherical-linear interpolation with another quaternion. </description> </method> <method name="slerpni"> @@ -122,6 +127,7 @@ <argument index="1" name="t" type="float"> </argument> <description> + Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°. </description> </method> <method name="xform"> @@ -130,17 +136,22 @@ <argument index="0" name="v" type="Vector3"> </argument> <description> + Transforms the vector [code]v[/code] by this quaternion. </description> </method> </methods> <members> <member name="w" type="float" setter="" getter=""> + W component of the quaternion. Default value: [code]1[/code] </member> <member name="x" type="float" setter="" getter=""> + X component of the quaternion. Default value: [code]0[/code] </member> <member name="y" type="float" setter="" getter=""> + Y component of the quaternion. Default value: [code]0[/code] </member> <member name="z" type="float" setter="" getter=""> + Z component of the quaternion. Default value: [code]0[/code] </member> </members> <constants> diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml index 13b786908e..5af8c82a7b 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -4,7 +4,7 @@ 2D Axis-aligned bounding box. </brief_description> <description> - Rect2 provides an 2D Axis-Aligned Bounding Box. It consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. + Rect2 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. </description> <tutorials> </tutorials> @@ -19,7 +19,7 @@ <argument index="1" name="size" type="Vector2"> </argument> <description> - Construct a [code]Rect2[/code] by position and size. + Constructs a [code]Rect2[/code] by position and size. </description> </method> <method name="Rect2"> @@ -34,7 +34,7 @@ <argument index="3" name="height" type="float"> </argument> <description> - Construct a [code]Rect2[/code] by x, y, width and height. + Constructs a [code]Rect2[/code] by x, y, width, and height. </description> </method> <method name="clip"> @@ -52,7 +52,7 @@ <argument index="0" name="b" type="Rect2"> </argument> <description> - Returns true if this [code]Rect2[/code] completely encloses another one. + Returns [code]true[/code] if this [code]Rect2[/code] completely encloses another one. </description> </method> <method name="expand"> @@ -61,14 +61,14 @@ <argument index="0" name="to" type="Vector2"> </argument> <description> - Return this [code]Rect2[/code] expanded to include a given point. + Returns this [code]Rect2[/code] expanded to include a given point. </description> </method> <method name="get_area"> <return type="float"> </return> <description> - Get the area of the [code]Rect2[/code]. + Returns the area of the [code]Rect2[/code]. </description> </method> <method name="grow"> @@ -77,7 +77,7 @@ <argument index="0" name="by" type="float"> </argument> <description> - Return a copy of the [code]Rect2[/code] grown a given amount of units towards all the sides. + Returns a copy of the [code]Rect2[/code] grown a given amount of units towards all the sides. </description> </method> <method name="grow_individual"> @@ -92,6 +92,7 @@ <argument index="3" name=" bottom" type="float"> </argument> <description> + Returns a copy of the [code]Rect2[/code] grown a given amount of units towards each direction individually. </description> </method> <method name="grow_margin"> @@ -102,13 +103,14 @@ <argument index="1" name="by" type="float"> </argument> <description> + Returns a copy of the [code]Rect2[/code] grown a given amount of units towards the [Margin] direction. </description> </method> <method name="has_no_area"> <return type="bool"> </return> <description> - Return true if the [code]Rect2[/code] is flat or empty. + Returns [code]true[/code] if the [code]Rect2[/code] is flat or empty. </description> </method> <method name="has_point"> @@ -117,7 +119,7 @@ <argument index="0" name="point" type="Vector2"> </argument> <description> - Return true if the [code]Rect2[/code] contains a point. + Returns [code]true[/code] if the [code]Rect2[/code] contains a point. </description> </method> <method name="intersects"> @@ -126,7 +128,7 @@ <argument index="0" name="b" type="Rect2"> </argument> <description> - Return true if the [code]Rect2[/code] overlaps with another. + Returns [code]true[/code] if the [code]Rect2[/code] overlaps with another. </description> </method> <method name="merge"> @@ -135,7 +137,7 @@ <argument index="0" name="b" type="Rect2"> </argument> <description> - Combine this [code]Rect2[/code] with another, a larger one is returned that contains both. + Returns a larger Rect2 that contains this Rect2 and [code]with[/code]. </description> </method> </methods> diff --git a/doc/classes/Rect3.xml b/doc/classes/Rect3.xml index 7adf4377aa..a56dac57c7 100644 --- a/doc/classes/Rect3.xml +++ b/doc/classes/Rect3.xml @@ -4,7 +4,7 @@ Axis-Aligned Bounding Box. </brief_description> <description> - Rect3 provides an 3D Axis-Aligned Bounding Box. It consists of a position, a size, and several utility functions. It is typically used for simple (fast) overlap tests. + Rect3 consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. </description> <tutorials> </tutorials> @@ -28,7 +28,7 @@ <argument index="0" name="with" type="Rect3"> </argument> <description> - Return true if this [code]Rect3[/code] completely encloses another one. + Returns [code]true[/code] if this [code]Rect3[/code] completely encloses another one. </description> </method> <method name="expand"> @@ -37,14 +37,14 @@ <argument index="0" name="to_point" type="Vector3"> </argument> <description> - Return this [code]Rect3[/code] expanded to include a given point. + Returns this [code]Rect3[/code] expanded to include a given point. </description> </method> <method name="get_area"> <return type="float"> </return> <description> - Get the area of the [code]Rect3[/code]. + Gets the area of the [code]Rect3[/code]. </description> </method> <method name="get_endpoint"> @@ -53,49 +53,49 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Get the position of the 8 endpoints of the [code]Rect3[/code] in space. + Gets the position of the 8 endpoints of the [code]Rect3[/code] in space. </description> </method> <method name="get_longest_axis"> <return type="Vector3"> </return> <description> - Return the normalized longest axis of the [code]Rect3[/code]. + Returns the normalized longest axis of the [code]Rect3[/code]. </description> </method> <method name="get_longest_axis_index"> <return type="int"> </return> <description> - Return the index of the longest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum). + Returns the index of the longest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum). </description> </method> <method name="get_longest_axis_size"> <return type="float"> </return> <description> - Return the scalar length of the longest axis of the [code]Rect3[/code]. + Returns the scalar length of the longest axis of the [code]Rect3[/code]. </description> </method> <method name="get_shortest_axis"> <return type="Vector3"> </return> <description> - Return the normalized shortest axis of the [code]Rect3[/code]. + Returns the normalized shortest axis of the [code]Rect3[/code]. </description> </method> <method name="get_shortest_axis_index"> <return type="int"> </return> <description> - Return the index of the shortest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum). + Returns the index of the shortest axis of the [code]Rect3[/code] (according to [Vector3]::AXIS* enum). </description> </method> <method name="get_shortest_axis_size"> <return type="float"> </return> <description> - Return the scalar length of the shortest axis of the [code]Rect3[/code]. + Returns the scalar length of the shortest axis of the [code]Rect3[/code]. </description> </method> <method name="get_support"> @@ -104,7 +104,7 @@ <argument index="0" name="dir" type="Vector3"> </argument> <description> - Return the support point in a given direction. This is useful for collision detection algorithms. + Returns the support point in a given direction. This is useful for collision detection algorithms. </description> </method> <method name="grow"> @@ -113,21 +113,21 @@ <argument index="0" name="by" type="float"> </argument> <description> - Return a copy of the [code]Rect3[/code] grown a given amount of units towards all the sides. + Returns a copy of the [code]Rect3[/code] grown a given amount of units towards all the sides. </description> </method> <method name="has_no_area"> <return type="bool"> </return> <description> - Return true if the [code]Rect3[/code] is flat or empty. + Returns [code]true[/code] if the [code]Rect3[/code] is flat or empty. </description> </method> <method name="has_no_surface"> <return type="bool"> </return> <description> - Return true if the [code]Rect3[/code] is empty. + Returns [code]true[/code] if the [code]Rect3[/code] is empty. </description> </method> <method name="has_point"> @@ -136,7 +136,7 @@ <argument index="0" name="point" type="Vector3"> </argument> <description> - Return true if the [code]Rect3[/code] contains a point. + Returns [code]true[/code] if the [code]Rect3[/code] contains a point. </description> </method> <method name="intersection"> @@ -145,7 +145,7 @@ <argument index="0" name="with" type="Rect3"> </argument> <description> - Return the intersection between two [code]Rect3[/code]. An empty Rect3 (size 0,0,0) is returned on failure. + Returns the intersection between two [code]Rect3[/code]. An empty Rect3 (size 0,0,0) is returned on failure. </description> </method> <method name="intersects"> @@ -154,7 +154,7 @@ <argument index="0" name="with" type="Rect3"> </argument> <description> - Return true if the [code]Rect3[/code] overlaps with another. + Returns [code]true[/code] if the [code]Rect3[/code] overlaps with another. </description> </method> <method name="intersects_plane"> @@ -163,7 +163,7 @@ <argument index="0" name="plane" type="Plane"> </argument> <description> - Return true if the [code]Rect3[/code] is at both sides of a plane. + Returns [code]true[/code] if the [code]Rect3[/code] is on both sides of a plane. </description> </method> <method name="intersects_segment"> @@ -174,7 +174,7 @@ <argument index="1" name="to" type="Vector3"> </argument> <description> - Return true if the [code]Rect3[/code] intersects the line segment between from and to + Returns [code]true[/code] if the [code]Rect3[/code] intersects the line segment between [code]from[/code] and [code]to[/code]. </description> </method> <method name="merge"> @@ -183,7 +183,7 @@ <argument index="0" name="with" type="Rect3"> </argument> <description> - Combine this [code]Rect3[/code] with another, a larger one is returned that contains both. + Returns a larger Rect3 that contains this Rect3 and [code]with[/code]. </description> </method> </methods> @@ -192,6 +192,7 @@ Ending corner. </member> <member name="position" type="Vector3" setter="" getter=""> + Beginning corner. </member> <member name="size" type="Vector3" setter="" getter=""> Size from position to end. diff --git a/doc/classes/String.xml b/doc/classes/String.xml index c7c19997b9..546712f223 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -17,6 +17,7 @@ <argument index="0" name="from" type="bool"> </argument> <description> + Constructs a new String from the given [bool]. </description> </method> <method name="String"> @@ -25,6 +26,7 @@ <argument index="0" name="from" type="int"> </argument> <description> + Constructs a new String from the given [int]. </description> </method> <method name="String"> @@ -33,6 +35,7 @@ <argument index="0" name="from" type="float"> </argument> <description> + Constructs a new String from the given [float]. </description> </method> <method name="String"> @@ -41,6 +44,7 @@ <argument index="0" name="from" type="Vector2"> </argument> <description> + Constructs a new String from the given [Vector2]. </description> </method> <method name="String"> @@ -49,6 +53,7 @@ <argument index="0" name="from" type="Rect2"> </argument> <description> + Constructs a new String from the given [Rect2]. </description> </method> <method name="String"> @@ -57,6 +62,7 @@ <argument index="0" name="from" type="Vector3"> </argument> <description> + Constructs a new String from the given [Vector3]. </description> </method> <method name="String"> @@ -65,6 +71,7 @@ <argument index="0" name="from" type="Transform2D"> </argument> <description> + Constructs a new String from the given [Transform2D]. </description> </method> <method name="String"> @@ -73,6 +80,7 @@ <argument index="0" name="from" type="Plane"> </argument> <description> + Constructs a new String from the given [Plane]. </description> </method> <method name="String"> @@ -81,6 +89,7 @@ <argument index="0" name="from" type="Quat"> </argument> <description> + Constructs a new String from the given [Quat]. </description> </method> <method name="String"> @@ -89,6 +98,7 @@ <argument index="0" name="from" type="Rect3"> </argument> <description> + Constructs a new String from the given [Rect3]. </description> </method> <method name="String"> @@ -97,6 +107,7 @@ <argument index="0" name="from" type="Basis"> </argument> <description> + Constructs a new String from the given [Basis]. </description> </method> <method name="String"> @@ -105,6 +116,7 @@ <argument index="0" name="from" type="Transform"> </argument> <description> + Constructs a new String from the given [Transform]. </description> </method> <method name="String"> @@ -113,6 +125,7 @@ <argument index="0" name="from" type="Color"> </argument> <description> + Constructs a new String from the given [Color]. </description> </method> <method name="String"> @@ -121,6 +134,7 @@ <argument index="0" name="from" type="NodePath"> </argument> <description> + Constructs a new String from the given [NodePath]. </description> </method> <method name="String"> @@ -129,6 +143,7 @@ <argument index="0" name="from" type="RID"> </argument> <description> + Constructs a new String from the given [RID]. </description> </method> <method name="String"> @@ -137,6 +152,7 @@ <argument index="0" name="from" type="Dictionary"> </argument> <description> + Constructs a new String from the given [Dictionary]. </description> </method> <method name="String"> @@ -145,6 +161,7 @@ <argument index="0" name="from" type="Array"> </argument> <description> + Constructs a new String from the given [Array]. </description> </method> <method name="String"> @@ -153,6 +170,7 @@ <argument index="0" name="from" type="PoolByteArray"> </argument> <description> + Constructs a new String from the given [PoolByteArray]. </description> </method> <method name="String"> @@ -161,6 +179,7 @@ <argument index="0" name="from" type="PoolIntArray"> </argument> <description> + Constructs a new String from the given [PoolIntArray]. </description> </method> <method name="String"> @@ -169,6 +188,7 @@ <argument index="0" name="from" type="PoolRealArray"> </argument> <description> + Constructs a new String from the given [PoolRealArray]. </description> </method> <method name="String"> @@ -177,6 +197,7 @@ <argument index="0" name="from" type="PoolStringArray"> </argument> <description> + Constructs a new String from the given [PoolStringArray]. </description> </method> <method name="String"> @@ -185,6 +206,7 @@ <argument index="0" name="from" type="PoolVector2Array"> </argument> <description> + Constructs a new String from the given [PoolVector2Array]. </description> </method> <method name="String"> @@ -193,6 +215,7 @@ <argument index="0" name="from" type="PoolVector3Array"> </argument> <description> + Constructs a new String from the given [PoolVector3Array]. </description> </method> <method name="String"> @@ -201,6 +224,7 @@ <argument index="0" name="from" type="PoolColorArray"> </argument> <description> + Constructs a new String from the given [PoolColorArray]. </description> </method> <method name="begins_with"> @@ -209,35 +233,35 @@ <argument index="0" name="text" type="String"> </argument> <description> - Return true if the strings begins with the given string. + Returns [code]true[/code] if the string begins with the given string. </description> </method> <method name="bigrams"> <return type="PoolStringArray"> </return> <description> - Return the bigrams (pairs of consecutive letters) of this string. + Returns the bigrams (pairs of consecutive letters) of this string. </description> </method> <method name="c_escape"> <return type="String"> </return> <description> - Return a copy of the string with special characters escaped using the C language standard. + Returns a copy of the string with special characters escaped using the C language standard. </description> </method> <method name="c_unescape"> <return type="String"> </return> <description> - Return a copy of the string with escaped characters replaced by their meanings according to the C language standard. + Returns a copy of the string with escaped characters replaced by their meanings according to the C language standard. </description> </method> <method name="capitalize"> <return type="String"> </return> <description> - Change the case of some letters. Replace underscores with spaces, convert all letters to lowercase then capitalize first and every letter following the space character. For [code]capitalize camelCase mixed_with_underscores[/code] it will return [code]Capitalize Camelcase Mixed With Underscores[/code]. + Changes the case of some letters. Replaces underscores with spaces, converts all letters to lowercase, then capitalizes first and every letter following the space character. For [code]capitalize camelCase mixed_with_underscores[/code] it will return [code]Capitalize Camelcase Mixed With Underscores[/code]. </description> </method> <method name="casecmp_to"> @@ -246,14 +270,14 @@ <argument index="0" name="to" type="String"> </argument> <description> - Perform a case-sensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater. + Performs a case-sensitive comparison to another string. Returns [code]-1[/code] if less than, [code]+1[/code] if greater than, or [code]0[/code] if equal. </description> </method> <method name="empty"> <return type="bool"> </return> <description> - Return true if the string is empty. + Returns [code]true[/code] if the string is empty. </description> </method> <method name="ends_with"> @@ -262,7 +286,7 @@ <argument index="0" name="text" type="String"> </argument> <description> - Return true if the strings ends with the given string. + Returns [code]true[/code] if the string ends with the given string. </description> </method> <method name="erase"> @@ -271,7 +295,7 @@ <argument index="1" name="chars" type="int"> </argument> <description> - Erase [code]chars[/code] characters from the string starting from [code]position[/code]. + Erases [code]chars[/code] characters from the string starting from [code]position[/code]. </description> </method> <method name="find"> @@ -282,7 +306,7 @@ <argument index="1" name="from" type="int" default="0"> </argument> <description> - Find the first occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. + Finds the first occurrence of a substring. Returns the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. </description> </method> <method name="find_last"> @@ -291,7 +315,7 @@ <argument index="0" name="what" type="String"> </argument> <description> - Find the last occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. + Finds the last occurrence of a substring. Returns the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. </description> </method> <method name="findn"> @@ -302,7 +326,7 @@ <argument index="1" name="from" type="int" default="0"> </argument> <description> - Find the first occurrence of a substring but search as case-insensitive, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. + Finds the first occurrence of a substring, ignoring case. Returns the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. </description> </method> <method name="format"> @@ -313,48 +337,49 @@ <argument index="1" name="placeholder" type="String" default="{_}"> </argument> <description> + Formats the string by replacing all occurences of [code]placeholder[/code] with [code]values[/code]. </description> </method> <method name="get_base_dir"> <return type="String"> </return> <description> - If the string is a path to a file, return the base directory. + If the string is a valid file path, returns the base directory name. </description> </method> <method name="get_basename"> <return type="String"> </return> <description> - If the string is a path to a file, return the path to the file without the extension. + If the string is a valid file path, returns the full file path without the extension. </description> </method> <method name="get_extension"> <return type="String"> </return> <description> - If the string is a path to a file, return the extension. + If the string is a valid file path, returns the extension. </description> </method> <method name="get_file"> <return type="String"> </return> <description> - If the string is a path to a file, return the file and ignore the base directory. + If the string is a valid file path, returns the filename. </description> </method> <method name="hash"> <return type="int"> </return> <description> - Hash the string and return a 32 bits integer. + Hashes the string and returns a 32-bit integer. </description> </method> <method name="hex_to_int"> <return type="int"> </return> <description> - Convert a string containing a hexadecimal number into an int. + Converts a string containing a hexadecimal number into an integer. </description> </method> <method name="insert"> @@ -365,21 +390,21 @@ <argument index="1" name="what" type="String"> </argument> <description> - Insert a substring at a given position. + Inserts a substring at a given position. </description> </method> <method name="is_abs_path"> <return type="bool"> </return> <description> - If the string is a path to a file or directory, return true if the path is absolute. + If the string is a path to a file or directory, returns [code]true[/code] if the path is absolute. </description> </method> <method name="is_rel_path"> <return type="bool"> </return> <description> - If the string is a path to a file or directory, return true if the path is relative. + If the string is a path to a file or directory, returns [code]true[/code] if the path is relative. </description> </method> <method name="is_subsequence_of"> @@ -388,7 +413,7 @@ <argument index="0" name="text" type="String"> </argument> <description> - Check whether this string is a subsequence of the given string. + Returns [code]true[/code] if this string is a subsequence of the given string. </description> </method> <method name="is_subsequence_ofi"> @@ -397,49 +422,49 @@ <argument index="0" name="text" type="String"> </argument> <description> - Check whether this string is a subsequence of the given string, without considering case. + Returns [code]true[/code] if this string is a subsequence of the given string, without considering case. </description> </method> <method name="is_valid_float"> <return type="bool"> </return> <description> - Check whether the string contains a valid float. + Returns [code]true[/code] if this string contains a valid float. </description> </method> <method name="is_valid_html_color"> <return type="bool"> </return> <description> - Check whether the string contains a valid color in HTML notation. + Returns [code]true[/code] if this string contains a valid color in HTML notation. </description> </method> <method name="is_valid_identifier"> <return type="bool"> </return> <description> - Check whether the string is a valid identifier. As is common in programming languages, a valid identifier may contain only letters, digits and underscores (_) and the first character may not be a digit. + Returns [code]true[/code] if this string is a valid identifier. A valid identifier may contain only letters, digits and underscores (_) and the first character may not be a digit. </description> </method> <method name="is_valid_integer"> <return type="bool"> </return> <description> - Check whether the string contains a valid integer. + Returns [code]true[/code] if this string contains a valid integer. </description> </method> <method name="is_valid_ip_address"> <return type="bool"> </return> <description> - Check whether the string contains a valid IP address. + Returns [code]true[/code] if this string contains a valid IP address. </description> </method> <method name="json_escape"> <return type="String"> </return> <description> - Return a copy of the string with special characters escaped using the JSON standard. + Returns a copy of the string with special characters escaped using the JSON standard. </description> </method> <method name="left"> @@ -448,14 +473,14 @@ <argument index="0" name="position" type="int"> </argument> <description> - Return an amount of characters from the left of the string. + Returns a number of characters from the left of the string. </description> </method> <method name="length"> <return type="int"> </return> <description> - Return the length of the string in characters. + Returns the string's amount of characters. </description> </method> <method name="match"> @@ -464,7 +489,7 @@ <argument index="0" name="expr" type="String"> </argument> <description> - Do a simple expression match, where '*' matches zero or more arbitrary characters and '?' matches any single character except '.'. + Does a simple expression match, where '*' matches zero or more arbitrary characters and '?' matches any single character except '.'. </description> </method> <method name="matchn"> @@ -473,21 +498,21 @@ <argument index="0" name="expr" type="String"> </argument> <description> - Do a simple case insensitive expression match, using ? and * wildcards (see [method match]). + Does a simple case insensitive expression match, using ? and * wildcards (see [method match]). </description> </method> <method name="md5_buffer"> <return type="PoolByteArray"> </return> <description> - Return the MD5 hash of the string as an array of bytes. + Returns the MD5 hash of the string as an array of bytes. </description> </method> <method name="md5_text"> <return type="String"> </return> <description> - Return the MD5 hash of the string as a string. + Returns the MD5 hash of the string as a string. </description> </method> <method name="nocasecmp_to"> @@ -496,7 +521,7 @@ <argument index="0" name="to" type="String"> </argument> <description> - Perform a case-insensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater. + Performs a case-insensitive comparison to another string. Returns [code]-1[/code] if less than, [code]+1[/code] if greater than, or [code]0[/code] if equal. </description> </method> <method name="ord_at"> @@ -505,7 +530,7 @@ <argument index="0" name="at" type="int"> </argument> <description> - Return the character code at position [code]at[/code]. + Returns the character code at position [code]at[/code]. </description> </method> <method name="pad_decimals"> @@ -514,7 +539,7 @@ <argument index="0" name="digits" type="int"> </argument> <description> - Format a number to have an exact number of [code]digits[/code] after the decimal point. + Formats a number to have an exact number of [code]digits[/code] after the decimal point. </description> </method> <method name="pad_zeros"> @@ -523,7 +548,7 @@ <argument index="0" name="digits" type="int"> </argument> <description> - Format a number to have an exact number of [code]digits[/code] before the decimal point. + Formats a number to have an exact number of [code]digits[/code] before the decimal point. </description> </method> <method name="percent_decode"> @@ -537,7 +562,7 @@ <return type="String"> </return> <description> - Percent-encode a string. This is meant to encode parameters in a URL when sending a HTTP GET request and bodies of form-urlencoded POST request. + Percent-encodes a string. Encodes parameters in a URL when sending a HTTP GET request (and bodies of form-urlencoded POST requests). </description> </method> <method name="plus_file"> @@ -557,7 +582,7 @@ <argument index="1" name="forwhat" type="String"> </argument> <description> - Replace occurrences of a substring for different ones inside the string. + Replaces occurrences of a substring with the given one inside the string. </description> </method> <method name="replacen"> @@ -568,7 +593,7 @@ <argument index="1" name="forwhat" type="String"> </argument> <description> - Replace occurrences of a substring for different ones inside the string, but search case-insensitive. + Replaces occurrences of a substring with the given one inside the string. Ignores case. </description> </method> <method name="rfind"> @@ -579,7 +604,7 @@ <argument index="1" name="from" type="int" default="-1"> </argument> <description> - Perform a search for a substring, but start from the end of the string instead of the beginning. + Performs a search for a substring, but starts from the end of the string instead of the beginning. </description> </method> <method name="rfindn"> @@ -590,7 +615,7 @@ <argument index="1" name="from" type="int" default="-1"> </argument> <description> - Perform a search for a substring, but start from the end of the string instead of the beginning. Also search case-insensitive. + Performs a search for a substring, but starts from the end of the string instead of the beginning. Ignores case. </description> </method> <method name="right"> @@ -599,7 +624,7 @@ <argument index="0" name="position" type="int"> </argument> <description> - Return the right side of the string from a given position. + Returns the right side of the string from a given position. </description> </method> <method name="sha256_buffer"> @@ -612,7 +637,7 @@ <return type="String"> </return> <description> - Return the SHA-256 hash of the string as a string. + Returns the SHA-256 hash of the string as a string. </description> </method> <method name="similarity"> @@ -621,7 +646,7 @@ <argument index="0" name="text" type="String"> </argument> <description> - Return the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar. + Returns the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar. </description> </method> <method name="split"> @@ -632,7 +657,7 @@ <argument index="1" name="allow_empty" type="bool" default="True"> </argument> <description> - Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",". + Splits the string by a divisor string and returns an array of the substrings. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",". </description> </method> <method name="split_floats"> @@ -643,7 +668,7 @@ <argument index="1" name="allow_empty" type="bool" default="True"> </argument> <description> - Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return [1,2.5,3] if split by ",". + Splits the string in floats by using a divisor string and returns an array of the substrings. Example "1,2.5,3" will return [1,2.5,3] if split by ",". </description> </method> <method name="strip_edges"> @@ -654,7 +679,7 @@ <argument index="1" name="right" type="bool" default="True"> </argument> <description> - Return a copy of the string stripped of any non-printable character at the beginning and the end. The optional arguments are used to toggle stripping on the left and right edges respectively. + Returns a copy of the string stripped of any non-printable character at the beginning and the end. The optional arguments are used to toggle stripping on the left and right edges respectively. </description> </method> <method name="substr"> @@ -665,63 +690,63 @@ <argument index="1" name="len" type="int"> </argument> <description> - Return part of the string from the position [code]from[/code], with length [code]len[/code]. + Returns part of the string from the position [code]from[/code] with length [code]len[/code]. </description> </method> <method name="to_ascii"> <return type="PoolByteArray"> </return> <description> - Convert the String (which is a character array) to PoolByteArray (which is an array of bytes). The conversion is speeded up in comparison to to_utf8() with the assumption that all the characters the String contains are only ASCII characters. + Converts the String (which is a character array) to [PoolByteArray] (which is an array of bytes). The conversion is sped up in comparison to to_utf8() with the assumption that all the characters the String contains are only ASCII characters. </description> </method> <method name="to_float"> <return type="float"> </return> <description> - Convert a string, containing a decimal number, into a [code]float[/code]. + Converts a string containing a decimal number into a [code]float[/code]. </description> </method> <method name="to_int"> <return type="int"> </return> <description> - Convert a string, containing an integer number, into an [code]int[/code]. + Converts a string containing an integer number into an [code]int[/code]. </description> </method> <method name="to_lower"> <return type="String"> </return> <description> - Return the string converted to lowercase. + Returns the string converted to lowercase. </description> </method> <method name="to_upper"> <return type="String"> </return> <description> - Return the string converted to uppercase. + Returns the string converted to uppercase. </description> </method> <method name="to_utf8"> <return type="PoolByteArray"> </return> <description> - Convert the String (which is an array of characters) to PoolByteArray (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii(). + Converts the String (which is an array of characters) to [PoolByteArray] (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii(). </description> </method> <method name="xml_escape"> <return type="String"> </return> <description> - Return a copy of the string with special characters escaped using the XML standard. + Returns a copy of the string with special characters escaped using the XML standard. </description> </method> <method name="xml_unescape"> <return type="String"> </return> <description> - Return a copy of the string with escaped characters replaced by their meanings according to the XML standard. + Returns a copy of the string with escaped characters replaced by their meanings according to the XML standard. </description> </method> </methods> diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index fdbdabafd3..a05bc5db9a 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -37,6 +37,7 @@ <argument index="0" name="to" type="Vector3"> </argument> <description> + Returns the vector's minimum angle to the vector [code]to[/code]. </description> </method> <method name="bounce"> @@ -61,7 +62,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Return the cross product with b. + Returns the cross product with [code]b[/code]. </description> </method> <method name="cubic_interpolate"> @@ -76,7 +77,7 @@ <argument index="3" name="t" type="float"> </argument> <description> - Perform a cubic interpolation between vectors pre_a, a, b, post_b (a is current), by the given amount (t). + Performs a cubic interpolation between vectors [code]pre_a[/code], [code]a[/code], [code]b[/code], [code]post_b[/code] ([code]a[/code] is current), by the given amount (t). </description> </method> <method name="distance_squared_to"> @@ -85,7 +86,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - 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. + Returns the squared distance to [code]b[/code]. 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"> @@ -94,7 +95,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Return the distance to b. + Returns the distance to b. </description> </method> <method name="dot"> @@ -103,7 +104,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Return the dot product with b. + Returns the dot product with b. </description> </method> <method name="floor"> @@ -131,14 +132,14 @@ <return type="float"> </return> <description> - Return the length of the vector. + Returns the length of the vector. </description> </method> <method name="length_squared"> <return type="float"> </return> <description> - 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. + Returns 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"> @@ -170,7 +171,7 @@ <return type="Vector3"> </return> <description> - Return a copy of the normalized vector to unit length. This is the same as v / v.length(). + Returns a copy of the normalized vector to unit length. This is the same as v / v.length(). </description> </method> <method name="outer"> @@ -179,7 +180,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Return the outer product with b. + Returns the outer product with b. </description> </method> <method name="reflect"> @@ -217,14 +218,14 @@ <argument index="0" name="by" type="float"> </argument> <description> - Return a copy of the vector, snapped to the lowest neared multiple. + Returns a copy of the vector, snapped to the lowest neared multiple. </description> </method> <method name="to_diagonal_matrix"> <return type="Basis"> </return> <description> - Return a diagonal matrix with the vector as main diagonal. + Returns a diagonal matrix with the vector as main diagonal. </description> </method> </methods> diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 39f027a5aa..ddcb04fa7d 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -895,7 +895,7 @@ void RasterizerSceneGLES3::environment_set_ssr(RID p_env, bool p_enable, int p_m env->ssr_roughness = p_roughness; } -void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, bool p_blur) { +void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) { Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); @@ -909,6 +909,8 @@ void RasterizerSceneGLES3::environment_set_ssao(RID p_env, bool p_enable, float env->ssao_light_affect = p_light_affect; env->ssao_color = p_color; env->ssao_filter = p_blur; + env->ssao_quality = p_quality; + env->ssao_bilateral_sharpness = p_bilateral_sharpness; } void RasterizerSceneGLES3::environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) { @@ -3186,6 +3188,15 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_ glDisable(GL_CULL_FACE); glDisable(GL_BLEND); + if (env->ssao_enabled || env->ssr_enabled) { + + //copy normal and roughness to effect buffer + glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); + glReadBuffer(GL_COLOR_ATTACHMENT2); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->buffers.effect_fbo); + glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT, GL_NEAREST); + } + if (env->ssao_enabled) { //copy diffuse to front buffer glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); @@ -3235,6 +3246,8 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_ // do SSAO! state.ssao_shader.set_conditional(SsaoShaderGLES3::ENABLE_RADIUS2, env->ssao_radius2 > 0.001); state.ssao_shader.set_conditional(SsaoShaderGLES3::USE_ORTHOGONAL_PROJECTION, p_cam_projection.is_orthogonal()); + state.ssao_shader.set_conditional(SsaoShaderGLES3::SSAO_QUALITY_LOW, env->ssao_quality == VS::ENV_SSAO_QUALITY_LOW); + state.ssao_shader.set_conditional(SsaoShaderGLES3::SSAO_QUALITY_HIGH, env->ssao_quality == VS::ENV_SSAO_QUALITY_HIGH); state.ssao_shader.bind(); state.ssao_shader.set_uniform(SsaoShaderGLES3::CAMERA_Z_FAR, p_cam_projection.get_z_far()); state.ssao_shader.set_uniform(SsaoShaderGLES3::CAMERA_Z_NEAR, p_cam_projection.get_z_near()); @@ -3287,6 +3300,9 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_ state.ssao_blur_shader.set_uniform(SsaoBlurShaderGLES3::CAMERA_Z_FAR, p_cam_projection.get_z_far()); state.ssao_blur_shader.set_uniform(SsaoBlurShaderGLES3::CAMERA_Z_NEAR, p_cam_projection.get_z_near()); + state.ssao_blur_shader.set_uniform(SsaoBlurShaderGLES3::EDGE_SHARPNESS, env->ssao_bilateral_sharpness); + state.ssao_blur_shader.set_uniform(SsaoBlurShaderGLES3::FILTER_SCALE, int(env->ssao_filter)); + GLint axis[2] = { i, 1 - i }; glUniform2iv(state.ssao_blur_shader.get_uniform(SsaoBlurShaderGLES3::AXIS), 1, axis); glUniform2iv(state.ssao_blur_shader.get_uniform(SsaoBlurShaderGLES3::SCREEN_SIZE), 1, ss); @@ -3295,6 +3311,8 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_ glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->effects.ssao.blur_red[i]); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->depth); + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->buffers.effect); glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->effects.ssao.blur_fbo[1 - i]); if (i == 0) { glClearBufferfv(GL_COLOR, 0, white.components); // specular @@ -3386,12 +3404,6 @@ void RasterizerSceneGLES3::_render_mrts(Environment *env, const CameraMatrix &p_ if (env->ssr_enabled) { - //copy normal and roughness to effect buffer - glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); - glReadBuffer(GL_COLOR_ATTACHMENT2); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->buffers.effect_fbo); - glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_COLOR_BUFFER_BIT, GL_NEAREST); - //blur diffuse into effect mipmaps using separatable convolution //storage->shaders.copy.set_conditional(CopyShaderGLES3::GAUSSIAN_HORIZONTAL,true); _blur_effect_buffer(); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 28a5cef0ee..ff691ddcec 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -379,7 +379,9 @@ public: float ssao_bias; float ssao_light_affect; Color ssao_color; - bool ssao_filter; + VS::EnvironmentSSAOQuality ssao_quality; + float ssao_bilateral_sharpness; + VS::EnvironmentSSAOBlur ssao_filter; bool glow_enabled; int glow_levels; @@ -456,7 +458,9 @@ public: ssao_radius2 = 0.0; ssao_bias = 0.01; ssao_light_affect = 0; - ssao_filter = true; + ssao_filter = VS::ENV_SSAO_BLUR_3x3; + ssao_quality = VS::ENV_SSAO_QUALITY_LOW; + ssao_bilateral_sharpness = 4; tone_mapper = VS::ENV_TONE_MAPPER_LINEAR; tone_mapper_exposure = 1.0; @@ -532,7 +536,7 @@ public: virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture); virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness); - virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, bool p_blur); + virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness); virtual void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale); diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 317ca91d98..bf0ebae3e3 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -169,7 +169,7 @@ void light_compute(vec3 N, vec3 L,vec3 V, vec3 light_color, float roughness, ino float dotNL = max(dot(N,L), 0.0 ); diffuse += dotNL * light_color / M_PI; - if (roughness < 1.0) { + if (roughness > 0.0) { vec3 H = normalize(V + L); float dotNH = max(dot(N,H), 0.0 ); @@ -1034,7 +1034,7 @@ LIGHT_SHADER_CODE } - if (roughness < 1.0) { + if (roughness > 0.0) { // FIXME: roughness == 0 should not disable specular light entirely // D diff --git a/drivers/gles3/shaders/ssao.glsl b/drivers/gles3/shaders/ssao.glsl index c668e63745..219f0957e0 100644 --- a/drivers/gles3/shaders/ssao.glsl +++ b/drivers/gles3/shaders/ssao.glsl @@ -13,8 +13,24 @@ void main() { #define TWO_PI 6.283185307179586476925286766559 +#ifdef SSAO_QUALITY_HIGH + +#define NUM_SAMPLES (80) + +#endif + +#ifdef SSAO_QUALITY_LOW + #define NUM_SAMPLES (15) +#endif + +#if !defined(SSAO_QUALITY_LOW) && !defined(SSAO_QUALITY_HIGH) + +#define NUM_SAMPLES (40) + +#endif + // If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower // miplevel to maintain reasonable spatial locality in the cache // If this number is too small (< 3), too many taps will land in the same pixel, and we'll get bad variance that manifests as flashing. @@ -212,12 +228,12 @@ void main() { //visibility=-C.z/camera_z_far; //return; - - //vec3 n_C = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0; - +#if 0 + vec3 n_C = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0; +#else vec3 n_C = reconstructCSFaceNormal(C); n_C = -n_C; - +#endif // Hash function used in the HPG12 AlchemyAO paper float randomPatternRotationAngle = mod(float((3 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 10), TWO_PI); diff --git a/drivers/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl index c7c978dc37..472dc21acf 100644 --- a/drivers/gles3/shaders/ssao_blur.glsl +++ b/drivers/gles3/shaders/ssao_blur.glsl @@ -15,6 +15,7 @@ void main() { uniform sampler2D source_ssao; //texunit:0 uniform sampler2D source_depth; //texunit:1 +uniform sampler2D source_normal; //texunit:3 layout(location = 0) out float visibility; @@ -24,7 +25,7 @@ layout(location = 0) out float visibility; // Tunable Parameters: /** Increase to make depth edges crisper. Decrease to reduce flicker. */ -#define EDGE_SHARPNESS (4.0) +uniform float edge_sharpness; /** Step in 2-pixel intervals since we already blurred against neighbors in the first AO pass. This constant can be increased while R decreases to improve @@ -34,7 +35,8 @@ layout(location = 0) out float visibility; unobjectionable after shading was applied but eliminated most temporal incoherence from using small numbers of sample taps. */ -#define SCALE (3) + +uniform int filter_scale; /** Filter radius in pixels. This will be multiplied by SCALE. */ #define R (4) @@ -63,13 +65,14 @@ void main() { ivec2 ssC = ivec2(gl_FragCoord.xy); float depth = texelFetch(source_depth, ssC, 0).r; + //vec3 normal = texelFetch(source_normal,ssC,0).rgb * 2.0 - 1.0; depth = depth * 2.0 - 1.0; depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth * (camera_z_far - camera_z_near)); float depth_divide = 1.0 / camera_z_far; - depth*=depth_divide; +// depth*=depth_divide; /* if (depth > camera_z_far*0.999) { @@ -92,20 +95,23 @@ void main() { // so the IF statement has no runtime cost if (r != 0) { - ivec2 ppos = ssC + axis * (r * SCALE); + ivec2 ppos = ssC + axis * (r * filter_scale); float value = texelFetch(source_ssao, clamp(ppos,ivec2(0),clamp_limit), 0).r; - float temp_depth = texelFetch(source_depth, clamp(ssC,ivec2(0),clamp_limit), 0).r; + ivec2 rpos = clamp(ppos,ivec2(0),clamp_limit); + float temp_depth = texelFetch(source_depth, rpos, 0).r; + //vec3 temp_normal = texelFetch(source_normal, rpos, 0).rgb * 2.0 - 1.0; temp_depth = temp_depth * 2.0 - 1.0; temp_depth = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - temp_depth * (camera_z_far - camera_z_near)); - temp_depth *= depth_divide; +// temp_depth *= depth_divide; // spatial domain: offset gaussian tap float weight = 0.3 + gaussian[abs(r)]; + //weight *= max(0.0,dot(temp_normal,normal)); // range domain (the "bilateral" weight). As depth difference increases, decrease weight. weight *= max(0.0, 1.0 - - (EDGE_SHARPNESS * 2000.0) * abs(temp_depth - depth) + - edge_sharpness * abs(temp_depth - depth) ); sum += value * weight; diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp index 4b370295f3..0d9b137f99 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.cpp +++ b/modules/mono/mono_gd/gd_mono_assembly.cpp @@ -95,7 +95,9 @@ MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **asse (void)user_data; // UNUSED if (search_dirs.empty()) { +#ifdef TOOLS_DOMAIN search_dirs.push_back(GodotSharpDirs::get_res_temp_assemblies_dir()); +#endif search_dirs.push_back(GodotSharpDirs::get_res_assemblies_dir()); search_dirs.push_back(OS::get_singleton()->get_resource_dir()); search_dirs.push_back(OS::get_singleton()->get_executable_path().get_base_dir()); diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 81315ee87a..1643f8cfc5 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -183,19 +183,19 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { // GodotObject if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) { MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); break; } if (CACHED_CLASS(NodePath) == type_class) { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); break; } if (CACHED_CLASS(RID) == type_class) { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); break; } @@ -204,8 +204,6 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { } break; case MONO_TYPE_OBJECT: { - GDMonoClass *type_class = type.type_class; - // Variant switch (p_value.get_type()) { case Variant::BOOL: { @@ -237,11 +235,11 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { case Variant::COLOR: SET_FROM_STRUCT_AND_BREAK(Color); case Variant::NODE_PATH: { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); } break; case Variant::_RID: { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); } break; case Variant::OBJECT: { MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *()); @@ -250,7 +248,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { } case Variant::DICTIONARY: { MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); } break; case Variant::ARRAY: SET_FROM_ARRAY_AND_BREAK(Array); case Variant::POOL_BYTE_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolByteArray); @@ -268,7 +266,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { case MONO_TYPE_GENERICINST: { if (CACHED_RAW_MONO_CLASS(Dictionary) == type.type_class->get_raw()) { MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary()); - mono_field_set_value(p_object, mono_field, &managed); + mono_field_set_value(p_object, mono_field, managed); break; } } break; diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 4c6fa7c8a1..910a2ad2fd 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -377,7 +377,7 @@ bool Environment::is_ssr_rough() const { void Environment::set_ssao_enabled(bool p_enable) { ssao_enabled = p_enable; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); _change_notify(); } @@ -389,7 +389,7 @@ bool Environment::is_ssao_enabled() const { void Environment::set_ssao_radius(float p_radius) { ssao_radius = p_radius; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_radius() const { @@ -399,7 +399,7 @@ float Environment::get_ssao_radius() const { void Environment::set_ssao_intensity(float p_intensity) { ssao_intensity = p_intensity; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_intensity() const { @@ -410,7 +410,7 @@ float Environment::get_ssao_intensity() const { void Environment::set_ssao_radius2(float p_radius) { ssao_radius2 = p_radius; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_radius2() const { @@ -420,7 +420,7 @@ float Environment::get_ssao_radius2() const { void Environment::set_ssao_intensity2(float p_intensity) { ssao_intensity2 = p_intensity; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_intensity2() const { @@ -430,7 +430,7 @@ float Environment::get_ssao_intensity2() const { void Environment::set_ssao_bias(float p_bias) { ssao_bias = p_bias; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_bias() const { @@ -440,7 +440,7 @@ float Environment::get_ssao_bias() const { void Environment::set_ssao_direct_light_affect(float p_direct_light_affect) { ssao_direct_light_affect = p_direct_light_affect; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_direct_light_affect() const { @@ -450,7 +450,7 @@ float Environment::get_ssao_direct_light_affect() const { void Environment::set_ssao_color(const Color &p_color) { ssao_color = p_color; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } Color Environment::get_ssao_color() const { @@ -458,16 +458,38 @@ Color Environment::get_ssao_color() const { return ssao_color; } -void Environment::set_ssao_blur(bool p_enable) { +void Environment::set_ssao_blur(SSAOBlur p_blur) { - ssao_blur = p_enable; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, ssao_blur); + ssao_blur = p_blur; + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } -bool Environment::is_ssao_blur_enabled() const { +Environment::SSAOBlur Environment::get_ssao_blur() const { return ssao_blur; } +void Environment::set_ssao_quality(SSAOQuality p_quality) { + + ssao_quality = p_quality; + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); +} + +Environment::SSAOQuality Environment::get_ssao_quality() const { + + return ssao_quality; +} + +void Environment::set_ssao_edge_sharpness(float p_edge_sharpness) { + + ssao_edge_sharpness = p_edge_sharpness; + VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_radius2, ssao_intensity2, ssao_bias, ssao_direct_light_affect, ssao_color, VS::EnvironmentSSAOQuality(ssao_quality), VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); +} + +float Environment::get_ssao_edge_sharpness() const { + + return ssao_edge_sharpness; +} + void Environment::set_glow_enabled(bool p_enabled) { glow_enabled = p_enabled; @@ -988,8 +1010,14 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_ssao_color", "color"), &Environment::set_ssao_color); ClassDB::bind_method(D_METHOD("get_ssao_color"), &Environment::get_ssao_color); - ClassDB::bind_method(D_METHOD("set_ssao_blur", "enabled"), &Environment::set_ssao_blur); - ClassDB::bind_method(D_METHOD("is_ssao_blur_enabled"), &Environment::is_ssao_blur_enabled); + ClassDB::bind_method(D_METHOD("set_ssao_blur", "mode"), &Environment::set_ssao_blur); + ClassDB::bind_method(D_METHOD("get_ssao_blur"), &Environment::get_ssao_blur); + + ClassDB::bind_method(D_METHOD("set_ssao_quality", "quality"), &Environment::set_ssao_quality); + ClassDB::bind_method(D_METHOD("get_ssao_quality"), &Environment::get_ssao_quality); + + ClassDB::bind_method(D_METHOD("set_ssao_edge_sharpness", "edge_sharpness"), &Environment::set_ssao_edge_sharpness); + ClassDB::bind_method(D_METHOD("get_ssao_edge_sharpness"), &Environment::get_ssao_edge_sharpness); ADD_GROUP("SSAO", "ssao_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ssao_enabled"), "set_ssao_enabled", "is_ssao_enabled"); @@ -1000,7 +1028,9 @@ void Environment::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_bias", PROPERTY_HINT_RANGE, "0.001,8,0.001"), "set_ssao_bias", "get_ssao_bias"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_light_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_direct_light_affect", "get_ssao_direct_light_affect"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ssao_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ssao_color", "get_ssao_color"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ssao_blur"), "set_ssao_blur", "is_ssao_blur_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_quality", PROPERTY_HINT_ENUM, "Low,Medium,High"), "set_ssao_quality", "get_ssao_quality"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_blur", PROPERTY_HINT_ENUM, "Disabled,1x1,2x2,3x3"), "set_ssao_blur", "get_ssao_blur"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_edge_sharpness", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_ssao_edge_sharpness", "get_ssao_edge_sharpness"); ClassDB::bind_method(D_METHOD("set_dof_blur_far_enabled", "enabled"), &Environment::set_dof_blur_far_enabled); ClassDB::bind_method(D_METHOD("is_dof_blur_far_enabled"), &Environment::is_dof_blur_far_enabled); @@ -1134,6 +1164,10 @@ void Environment::_bind_methods() { BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_LOW); BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_MEDIUM); BIND_ENUM_CONSTANT(DOF_BLUR_QUALITY_HIGH); + + BIND_ENUM_CONSTANT(SSAO_QUALITY_LOW); + BIND_ENUM_CONSTANT(SSAO_QUALITY_MEDIUM); + BIND_ENUM_CONSTANT(SSAO_QUALITY_HIGH); } Environment::Environment() { @@ -1179,7 +1213,9 @@ Environment::Environment() { ssao_intensity2 = 1; ssao_bias = 0.01; ssao_direct_light_affect = false; - ssao_blur = true; + ssao_blur = SSAO_BLUR_3x3; + set_ssao_edge_sharpness(4); + set_ssao_quality(SSAO_QUALITY_LOW); glow_enabled = false; glow_levels = (1 << 2) | (1 << 4); diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 5909846074..418949a6ad 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -71,6 +71,19 @@ public: DOF_BLUR_QUALITY_HIGH, }; + enum SSAOBlur { + SSAO_BLUR_DISABLED, + SSAO_BLUR_1x1, + SSAO_BLUR_2x2, + SSAO_BLUR_3x3 + }; + + enum SSAOQuality { + SSAO_QUALITY_LOW, + SSAO_QUALITY_MEDIUM, + SSAO_QUALITY_HIGH + }; + private: RID environment; @@ -114,7 +127,9 @@ private: float ssao_bias; float ssao_direct_light_affect; Color ssao_color; - bool ssao_blur; + SSAOBlur ssao_blur; + float ssao_edge_sharpness; + SSAOQuality ssao_quality; bool glow_enabled; int glow_levels; @@ -261,8 +276,14 @@ public: void set_ssao_color(const Color &p_color); Color get_ssao_color() const; - void set_ssao_blur(bool p_enable); - bool is_ssao_blur_enabled() const; + void set_ssao_blur(SSAOBlur p_blur); + SSAOBlur get_ssao_blur() const; + + void set_ssao_quality(SSAOQuality p_quality); + SSAOQuality get_ssao_quality() const; + + void set_ssao_edge_sharpness(float p_edge_sharpness); + float get_ssao_edge_sharpness() const; void set_glow_enabled(bool p_enabled); bool is_glow_enabled() const; @@ -370,5 +391,7 @@ VARIANT_ENUM_CAST(Environment::BGMode) VARIANT_ENUM_CAST(Environment::ToneMapper) VARIANT_ENUM_CAST(Environment::GlowBlendMode) VARIANT_ENUM_CAST(Environment::DOFBlurQuality) +VARIANT_ENUM_CAST(Environment::SSAOQuality) +VARIANT_ENUM_CAST(Environment::SSAOBlur) #endif // ENVIRONMENT_H diff --git a/servers/server_wrap_mt_common.h b/servers/server_wrap_mt_common.h index 267e5c63b9..51e7f446ea 100644 --- a/servers/server_wrap_mt_common.h +++ b/servers/server_wrap_mt_common.h @@ -775,3 +775,12 @@ server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \ } \ } + +#define FUNC12(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12) \ + virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12) { \ + if (Thread::get_caller_id() != server_thread) { \ + command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); \ + } else { \ + server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); \ + } \ + } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index b3f6b243de..cd4b465d79 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -65,7 +65,7 @@ public: virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) = 0; virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) = 0; - virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, bool p_blur) = 0; + virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0; virtual void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) = 0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 888fb29f93..302f13ee4f 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -652,6 +652,8 @@ public: void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } #define BIND11(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11) \ void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); } +#define BIND12(m_name, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12) \ + void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); } //from now on, calls forwarded to this singleton #define BINDBASE VSG::storage @@ -974,7 +976,7 @@ public: BIND2(environment_set_canvas_max_layer, RID, int) BIND4(environment_set_ambient_light, RID, const Color &, float, float) BIND7(environment_set_ssr, RID, bool, int, float, float, float, bool) - BIND10(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, bool) + BIND12(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float) BIND6(environment_set_dof_blur_near, RID, bool, float, float, float, EnvironmentDOFBlurQuality) BIND6(environment_set_dof_blur_far, RID, bool, float, float, float, EnvironmentDOFBlurQuality) diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index caec890217..67d503dfca 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -387,7 +387,7 @@ public: FUNC2(environment_set_canvas_max_layer, RID, int) FUNC4(environment_set_ambient_light, RID, const Color &, float, float) FUNC7(environment_set_ssr, RID, bool, int, float, float, float, bool) - FUNC10(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, bool) + FUNC12(environment_set_ssao, RID, bool, float, float, float, float, float, float, const Color &, EnvironmentSSAOQuality, EnvironmentSSAOBlur, float) FUNC6(environment_set_dof_blur_near, RID, bool, float, float, float, EnvironmentDOFBlurQuality) FUNC6(environment_set_dof_blur_far, RID, bool, float, float, float, EnvironmentDOFBlurQuality) diff --git a/servers/visual_server.h b/servers/visual_server.h index 7b83bb929d..64ed540501 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -678,7 +678,21 @@ public: virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) = 0; virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness) = 0; - virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, bool p_blur) = 0; + + enum EnvironmentSSAOQuality { + ENV_SSAO_QUALITY_LOW, + ENV_SSAO_QUALITY_MEDIUM, + ENV_SSAO_QUALITY_HIGH, + }; + + enum EnvironmentSSAOBlur { + ENV_SSAO_BLUR_DISABLED, + ENV_SSAO_BLUR_1x1, + ENV_SSAO_BLUR_2x2, + ENV_SSAO_BLUR_3x3, + }; + + virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, EnvironmentSSAOQuality p_quality, EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0; virtual void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) = 0; virtual void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_curve, bool p_transmit, float p_transmit_curve) = 0; |