Renamed World to World3D.

This commit is contained in:
Relintai 2022-08-29 16:49:00 +02:00
parent ad72b82a89
commit 2aee6ab0bb
35 changed files with 165 additions and 111 deletions

View File

@ -4,7 +4,7 @@
3D agent used in navigation for collision avoidance.
</brief_description>
<description>
3D agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO (Reciprocal Velocity Obstacles) collision avoidance. The agent needs navigation data to work correctly. By default this node will register to the default [World] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node or the function [method set_navigation] can be used to set the navigation node directly. [NavigationAgent] is physics safe.
3D agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO (Reciprocal Velocity Obstacles) collision avoidance. The agent needs navigation data to work correctly. By default this node will register to the default [World3D] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node or the function [method set_navigation] can be used to set the navigation node directly. [NavigationAgent] is physics safe.
[b]Note:[/b] After [method set_target_location] is used it is required to use the [method get_next_location] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
</description>
<tutorials>

View File

@ -2,7 +2,7 @@
<class name="NavigationMeshInstance" inherits="Spatial" version="3.8">
<brief_description>
An instance of a [NavigationMesh]. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource.
By default this node will register to the default [World] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node.
By default this node will register to the default [World3D] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node.
Two regions can be connected to each other if they share a similar edge. You can set the minimum distance between two vertices required to connect two edges by using [method NavigationServer.map_set_edge_connection_margin].
[b]Note:[/b] Overlapping two regions' navmeshes is not enough for connecting two regions. They must share a similar edge.
The cost of entering this region from another region can be controlled with the [member enter_cost] value.

View File

@ -1296,7 +1296,7 @@
<argument index="0" name="aabb" type="AABB" />
<argument index="1" name="scenario" type="RID" />
<description>
Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update.
Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
</description>
</method>
@ -1305,7 +1305,7 @@
<argument index="0" name="convex" type="Array" />
<argument index="1" name="scenario" type="RID" />
<description>
Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update.
Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
</description>
</method>
@ -1315,7 +1315,7 @@
<argument index="1" name="to" type="Vector3" />
<argument index="2" name="scenario" type="RID" />
<description>
Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update.
Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
</description>
</method>

View File

@ -58,9 +58,9 @@
</description>
</method>
<method name="get_world" qualifiers="const">
<return type="World" />
<return type="World3D" />
<description>
Returns the current [World] resource this [Spatial] node is registered to.
Returns the current [World3D] resource this [Spatial] node is registered to.
</description>
</method>
<method name="global_rotate">
@ -338,10 +338,10 @@
In order for [constant NOTIFICATION_TRANSFORM_CHANGED] to work, users first need to ask for it, with [method set_notify_transform]. The notification is also sent if the node is in the editor context and it has at least one valid gizmo.
</constant>
<constant name="NOTIFICATION_ENTER_WORLD" value="41">
Spatial nodes receives this notification when they are registered to new [World] resource.
Spatial nodes receives this notification when they are registered to new [World3D] resource.
</constant>
<constant name="NOTIFICATION_EXIT_WORLD" value="42">
Spatial nodes receives this notification when they are unregistered from current [World] resource.
Spatial nodes receives this notification when they are unregistered from current [World3D] resource.
</constant>
<constant name="NOTIFICATION_VISIBILITY_CHANGED" value="43">
Spatial nodes receives this notification when their visibility changes.

View File

@ -24,9 +24,9 @@
</tutorials>
<methods>
<method name="find_world" qualifiers="const">
<return type="World" />
<return type="World3D" />
<description>
Returns the first valid [World] for this viewport, searching the [member world] property of itself and any Viewport ancestor.
Returns the first valid [World3D] for this viewport, searching the [member world] property of itself and any Viewport ancestor.
</description>
</method>
<method name="find_world_2d" qualifiers="const">
@ -246,7 +246,7 @@
The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 4 is best unless targeting very high-end systems.
</member>
<member name="own_world" type="bool" setter="set_use_own_world" getter="is_using_own_world" default="false">
If [code]true[/code], the viewport will use a unique copy of the [World] defined in [member world].
If [code]true[/code], the viewport will use a unique copy of the [World3D] defined in [member world].
</member>
<member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking" default="false">
If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process.
@ -301,8 +301,8 @@
[b]Note:[/b] Enabling this setting does not improve rendering quality. Using full floating-point precision is slower, and is generally only needed for advanced shaders that require a high level of precision. To reduce banding, enable [member debanding] instead.
[b]Note:[/b] Only available on the GLES3 backend.
</member>
<member name="world" type="World" setter="set_world" getter="get_world">
The custom [World] which can be used as 3D environment source.
<member name="world" type="World3D" setter="set_world" getter="get_world">
The custom [World3D] which can be used as 3D environment source.
</member>
<member name="world_2d" type="World2D" setter="set_world_2d" getter="get_world_2d">
The custom [World2D] which can be used as 2D environment source.

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="World" inherits="Resource" version="3.8">
<class name="World3D" inherits="Resource" version="3.8">
<brief_description>
Class that has everything pertaining to a world.
</brief_description>

View File

@ -52644,7 +52644,7 @@ msgstr ""
#: doc/classes/Spatial.xml
msgid ""
"Returns the current [World] resource this [Spatial] node is registered to."
"Returns the current [World3D] resource this [Spatial] node is registered to."
msgstr ""
#: doc/classes/Spatial.xml
@ -52905,13 +52905,13 @@ msgstr ""
#: doc/classes/Spatial.xml
msgid ""
"Spatial nodes receives this notification when they are registered to new "
"[World] resource."
"[World3D] resource."
msgstr ""
#: doc/classes/Spatial.xml
msgid ""
"Spatial nodes receives this notification when they are unregistered from "
"current [World] resource."
"current [World3D] resource."
msgstr ""
#: doc/classes/Spatial.xml
@ -63061,7 +63061,7 @@ msgstr ""
#: doc/classes/Viewport.xml
msgid ""
"Returns the first valid [World] for this viewport, searching the [member "
"Returns the first valid [World3D] for this viewport, searching the [member "
"world] property of itself and any Viewport ancestor."
msgstr ""
@ -63282,7 +63282,7 @@ msgstr ""
#: doc/classes/Viewport.xml
msgid ""
"If [code]true[/code], the viewport will use [World] defined in [code]world[/"
"If [code]true[/code], the viewport will use [World3D] defined in [code]world[/"
"code] property."
msgstr ""
@ -63385,7 +63385,7 @@ msgid ""
msgstr ""
#: doc/classes/Viewport.xml
msgid "The custom [World] which can be used as 3D environment source."
msgid "The custom [World3D] which can be used as 3D environment source."
msgstr ""
#: doc/classes/Viewport.xml
@ -66605,7 +66605,7 @@ msgid ""
"visual 3D nodes are considered, such as [MeshInstance] or "
"[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the "
"actual nodes. A scenario RID must be provided, which is available in the "
"[World] you want to query. This forces an update for all resources queued to "
"[World3D] you want to query. This forces an update for all resources queued to "
"update.\n"
"[b]Warning:[/b] This function is primarily intended for editor usage. For in-"
"game use cases, prefer physics collision."
@ -66617,7 +66617,7 @@ msgid ""
"Only visual 3D nodes are considered, such as [MeshInstance] or "
"[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the "
"actual nodes. A scenario RID must be provided, which is available in the "
"[World] you want to query. This forces an update for all resources queued to "
"[World3D] you want to query. This forces an update for all resources queued to "
"update.\n"
"[b]Warning:[/b] This function is primarily intended for editor usage. For in-"
"game use cases, prefer physics collision."
@ -66629,7 +66629,7 @@ msgid ""
"visual 3D nodes are considered, such as [MeshInstance] or "
"[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the "
"actual nodes. A scenario RID must be provided, which is available in the "
"[World] you want to query. This forces an update for all resources queued to "
"[World3D] you want to query. This forces an update for all resources queued to "
"update.\n"
"[b]Warning:[/b] This function is primarily intended for editor usage. For in-"
"game use cases, prefer physics collision."

View File

@ -52729,7 +52729,7 @@ msgstr ""
#: doc/classes/Spatial.xml
msgid ""
"Returns the current [World] resource this [Spatial] node is registered to."
"Returns the current [World3D] resource this [Spatial] node is registered to."
msgstr ""
#: doc/classes/Spatial.xml
@ -52990,13 +52990,13 @@ msgstr ""
#: doc/classes/Spatial.xml
msgid ""
"Spatial nodes receives this notification when they are registered to new "
"[World] resource."
"[World3D] resource."
msgstr ""
#: doc/classes/Spatial.xml
msgid ""
"Spatial nodes receives this notification when they are unregistered from "
"current [World] resource."
"current [World3D] resource."
msgstr ""
#: doc/classes/Spatial.xml
@ -63146,7 +63146,7 @@ msgstr ""
#: doc/classes/Viewport.xml
msgid ""
"Returns the first valid [World] for this viewport, searching the [member "
"Returns the first valid [World3D] for this viewport, searching the [member "
"world] property of itself and any Viewport ancestor."
msgstr ""
@ -63367,7 +63367,7 @@ msgstr ""
#: doc/classes/Viewport.xml
msgid ""
"If [code]true[/code], the viewport will use [World] defined in [code]world[/"
"If [code]true[/code], the viewport will use [World3D] defined in [code]world[/"
"code] property."
msgstr ""
@ -63470,7 +63470,7 @@ msgid ""
msgstr ""
#: doc/classes/Viewport.xml
msgid "The custom [World] which can be used as 3D environment source."
msgid "The custom [World3D] which can be used as 3D environment source."
msgstr ""
#: doc/classes/Viewport.xml
@ -66690,7 +66690,7 @@ msgid ""
"visual 3D nodes are considered, such as [MeshInstance] or "
"[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the "
"actual nodes. A scenario RID must be provided, which is available in the "
"[World] you want to query. This forces an update for all resources queued to "
"[World3D] you want to query. This forces an update for all resources queued to "
"update.\n"
"[b]Warning:[/b] This function is primarily intended for editor usage. For in-"
"game use cases, prefer physics collision."
@ -66702,7 +66702,7 @@ msgid ""
"Only visual 3D nodes are considered, such as [MeshInstance] or "
"[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the "
"actual nodes. A scenario RID must be provided, which is available in the "
"[World] you want to query. This forces an update for all resources queued to "
"[World3D] you want to query. This forces an update for all resources queued to "
"update.\n"
"[b]Warning:[/b] This function is primarily intended for editor usage. For in-"
"game use cases, prefer physics collision."
@ -66714,7 +66714,7 @@ msgid ""
"visual 3D nodes are considered, such as [MeshInstance] or "
"[DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the "
"actual nodes. A scenario RID must be provided, which is available in the "
"[World] you want to query. This forces an update for all resources queued to "
"[World3D] you want to query. This forces an update for all resources queued to "
"update.\n"
"[b]Warning:[/b] This function is primarily intended for editor usage. For in-"
"game use cases, prefer physics collision."

View File

@ -1 +1,53 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m12 2a1 1 0 0 0 -1 1 1 1 0 0 0 1 1 1 1 0 0 0 1-1 1 1 0 0 0 -1-1zm-6 3a5 5 0 0 0 -5 5 5 5 0 0 0 5 5 5 5 0 0 0 5-5 5 5 0 0 0 -5-5z" fill="#e0e0e0"/></svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height="16"
viewBox="0 0 16 16"
width="16"
version="1.1"
id="svg8"
sodipodi:docname="icon_world.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs12" />
<sodipodi:namedview
id="namedview10"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="54.3125"
inkscape:cx="7.3003452"
inkscape:cy="8.009206"
inkscape:window-width="1920"
inkscape:window-height="1023"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg8" />
<g
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
id="g6"
style="fill:#008890;fill-opacity:1">
<path
d="m8 1a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0 -7-7zm-1.7305 2.3125c-.83125 1.5372-1.2685 3.1037-1.2695 4.6816-.64057-.11251-1.3005-.27158-1.9766-.47266a5 5 0 0 1 3.2461-4.209zm3.4629.0039062a5 5 0 0 1 3.2383 4.1875c-.65187.17448-1.3077.32867-1.9727.44922-.00845-1.5627-.44294-3.1141-1.2656-4.6367zm-1.7324.0078126c1.0126 1.593 1.5 3.1425 1.5 4.6758 0 .054042-.0066161.10803-.0078125.16211-.96392.096801-1.9566.1103-2.9844.027344-.0016335-.063192-.0078125-.12632-.0078125-.18945 0-1.5333.48744-3.0828 1.5-4.6758zm4.8789 5.7578a5 5 0 0 1 -3.1484 3.6055c.57106-1.0564.95277-2.1268 1.1367-3.2051.68204-.10905 1.3556-.23789 2.0117-.40039zm-9.7461.033203c.68377.18153 1.3555.33345 2.0098.43164.18781 1.0551.56647 2.1026 1.125 3.1367a5 5 0 0 1 -3.1348-3.5684zm6.168.55469c-.22615.98866-.65424 1.9884-1.3008 3.0059-.63811-1.0042-1.0645-1.9908-1.293-2.9668.89027.054126 1.7517.029377 2.5938-.039062z"
fill="#fc9c9c"
fill-opacity=".99608"
id="path2"
style="fill:#008890;fill-opacity:1" />
<path
d="m8 1v2.3242c1.0126 1.593 1.5 3.1425 1.5 4.6758 0 .054042-.0066161.10803-.0078125.16211-.4894.049148-.98713.077552-1.4922.082031v1.4922c.43915-.0075968.87287-.031628 1.3008-.066406-.22615.98866-.65424 1.9884-1.3008 3.0059v2.3242a7 7 0 0 0 7-7 7 7 0 0 0 -7-7zm1.7324 2.3164a5 5 0 0 1 3.2383 4.1875c-.65187.17448-1.3077.32867-1.9727.44922-.00845-1.5627-.44294-3.1141-1.2656-4.6367zm3.1465 5.7656a5 5 0 0 1 -3.1484 3.6055c.57106-1.0564.95277-2.1268 1.1367-3.2051.68204-.10905 1.3556-.23789 2.0117-.40039z"
fill="#a5b7f3"
id="path4"
style="fill:#008890;fill-opacity:1" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m12 2a1 1 0 0 0 -1 1 1 1 0 0 0 1 1 1 1 0 0 0 1-1 1 1 0 0 0 -1-1zm-6 3a5 5 0 0 0 -5 5 5 5 0 0 0 5 5 5 5 0 0 0 5-5 5 5 0 0 0 -5-5z" fill="#e0e0e0"/></svg>

After

Width:  |  Height:  |  Size: 245 B

View File

@ -141,7 +141,7 @@ MaterialEditor::MaterialEditor() {
add_child(vc);
vc->set_anchors_and_margins_preset(PRESET_WIDE);
viewport = memnew(Viewport);
Ref<World> world;
Ref<World3D> world;
world.instance();
viewport->set_world(world); //use own world
vc->add_child(viewport);

View File

@ -133,7 +133,7 @@ void MeshEditor::_bind_methods() {
MeshEditor::MeshEditor() {
viewport = memnew(Viewport);
Ref<World> world;
Ref<World3D> world;
world.instance();
viewport->set_world(world); //use own world
add_child(viewport);

View File

@ -118,7 +118,7 @@ MainLoop *test() {
OAHashMap<String, int> map;
map.set("Hello", 1);
map.set("World", 2);
map.set("World3D", 2);
map.set("Pandemonium rocks", 42);
for (OAHashMap<String, int>::Iterator it = map.iter(); it.valid; it = map.next_iter(it)) {

View File

@ -235,7 +235,7 @@ void PropInstancePropJob::phase_physics_process() {
PhysicsServer::get_singleton()->body_set_collision_mask(body, _prop_instace->get_collision_mask());
if (_prop_instace->is_inside_tree() && _prop_instace->is_inside_world()) {
Ref<World> world = _prop_instace->get_world();
Ref<World3D> world = _prop_instace->get_world();
if (world.is_valid() && world->get_space() != RID()) {
PhysicsServer::get_singleton()->body_set_space(body, world->get_space());

View File

@ -199,7 +199,7 @@ void SkeletonModification3DJiggle::_execute_jiggle_joint(int p_joint_idx, Spatia
// Collision detection/response
if (use_colliders) {
if (execution_mode == SkeletonModificationStack3D::EXECUTION_MODE::execution_mode_physics_process) {
Ref<World> world_3d = stack->skeleton->get_world();
Ref<World3D> world_3d = stack->skeleton->get_world();
ERR_FAIL_COND(world_3d.is_null());
PhysicsDirectSpaceState *space_state = PhysicsServer::get_singleton()->space_get_direct_state(world_3d->get_space());
PhysicsDirectSpaceState::RayResult ray_result;

View File

@ -382,7 +382,7 @@ void TerrainChunkDefault::colliders_create(const int mesh_index, const int layer
PhysicsServer::get_singleton()->body_set_state(body_rid, PhysicsServer::BODY_STATE_TRANSFORM, get_transform());
if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) {
Ref<World> world = get_voxel_world()->get_world();
Ref<World3D> world = get_voxel_world()->get_world();
if (world.is_valid() && world->get_space() != RID())
PhysicsServer::get_singleton()->body_set_space(body_rid, world->get_space());
@ -420,7 +420,7 @@ void TerrainChunkDefault::colliders_create_area(const int mesh_index, const int
PhysicsServer::get_singleton()->area_set_collision_mask(area_rid, layer_mask);
if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) {
Ref<World> world = get_voxel_world()->get_world();
Ref<World3D> world = get_voxel_world()->get_world();
if (world.is_valid() && world->get_space() != RID())
PhysicsServer::get_singleton()->area_set_space(area_rid, world->get_space());

View File

@ -109,7 +109,7 @@ void TerrainPropJob::phase_physics_process() {
PhysicsServer::get_singleton()->body_set_collision_mask(body, 1);
if (chunk->get_voxel_world()->is_inside_tree() && chunk->get_voxel_world()->is_inside_world()) {
Ref<World> world = chunk->get_voxel_world()->get_world();
Ref<World3D> world = chunk->get_voxel_world()->get_world();
if (world.is_valid() && world->get_space() != RID()) {
PhysicsServer::get_singleton()->body_set_space(body, world->get_space());

View File

@ -348,7 +348,7 @@ void Terrain2DChunkDefault::colliders_create(const int mesh_index, const int lay
Physics2DServer::get_singleton()->body_set_state(body_rid, Physics2DServer::BODY_STATE_TRANSFORM, get_transform());
if (get_voxel_world()->is_inside_tree()) {
Ref<World> world = get_voxel_world()->get_world_2d();
Ref<World3D> world = get_voxel_world()->get_world_2d();
if (world.is_valid() && world->get_space() != RID())
Physics2DServer::get_singleton()->body_set_space(body_rid, world->get_space());

View File

@ -88,7 +88,7 @@ void Terrain2DProp2DJob::phase_physics_process() {
PhysicsServer::get_singleton()->body_set_collision_mask(body, 1);
if (chunk->get_voxel_world()->is_inside_tree() && chunk->get_voxel_world()->is_inside_world()) {
Ref<World> world = chunk->get_voxel_world()->get_world_2d();
Ref<World3D> world = chunk->get_voxel_world()->get_world_2d();
if (world.is_valid() && world->get_space() != RID()) {
PhysicsServer::get_singleton()->body_set_space(body, world->get_space());

View File

@ -380,7 +380,7 @@ void VoxelChunkDefault::colliders_create(const int mesh_index, const int layer_m
PhysicsServer::get_singleton()->body_set_state(body_rid, PhysicsServer::BODY_STATE_TRANSFORM, get_transform());
if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) {
Ref<World> world = get_voxel_world()->get_world();
Ref<World3D> world = get_voxel_world()->get_world();
if (world.is_valid() && world->get_space() != RID())
PhysicsServer::get_singleton()->body_set_space(body_rid, world->get_space());
@ -418,7 +418,7 @@ void VoxelChunkDefault::colliders_create_area(const int mesh_index, const int la
PhysicsServer::get_singleton()->area_set_collision_mask(area_rid, layer_mask);
if (get_voxel_world()->is_inside_tree() && get_voxel_world()->is_inside_world()) {
Ref<World> world = get_voxel_world()->get_world();
Ref<World3D> world = get_voxel_world()->get_world();
if (world.is_valid() && world->get_space() != RID())
PhysicsServer::get_singleton()->area_set_space(area_rid, world->get_space());

View File

@ -110,7 +110,7 @@ void VoxelPropJob::phase_physics_process() {
PhysicsServer::get_singleton()->body_set_collision_mask(body, 1);
if (chunk->get_voxel_world()->is_inside_tree() && chunk->get_voxel_world()->is_inside_world()) {
Ref<World> world = chunk->get_voxel_world()->get_world();
Ref<World3D> world = chunk->get_voxel_world()->get_world();
if (world.is_valid() && world->get_space() != RID()) {
PhysicsServer::get_singleton()->body_set_space(body, world->get_space());

View File

@ -375,7 +375,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
linear_velocity = velocity_tracker->get_tracked_linear_velocity();
}
Ref<World> world = get_world();
Ref<World3D> world = get_world();
ERR_FAIL_COND(world.is_null());
int new_output_count = 0;

View File

@ -62,7 +62,7 @@ void CollisionObject::_notification(int p_what) {
PhysicsServer::get_singleton()->body_set_state(rid, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
}
Ref<World> world_ref = get_world();
Ref<World3D> world_ref = get_world();
ERR_FAIL_COND(!world_ref.is_valid());
RID space = world_ref->get_space();
if (area) {

View File

@ -199,7 +199,7 @@ void RayCast::_notification(int p_what) {
}
void RayCast::_update_raycast_state() {
Ref<World> w3d = get_world();
Ref<World3D> w3d = get_world();
ERR_FAIL_COND(w3d.is_null());
PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space());

View File

@ -86,7 +86,7 @@ bool RoomManager::static_rooms_get_active() {
bool RoomManager::static_rooms_get_active_and_loaded() {
if (active_room_manager) {
if (active_room_manager->rooms_get_active()) {
Ref<World> world = active_room_manager->get_world();
Ref<World3D> world = active_room_manager->get_world();
RID scenario = world->get_scenario();
return active_room_manager->rooms_get_active() && RenderingServer::get_singleton()->rooms_is_loaded(scenario);
}
@ -148,7 +148,7 @@ String RoomManager::get_configuration_warning() const {
}
void RoomManager::_preview_camera_update() {
Ref<World> world = get_world();
Ref<World3D> world = get_world();
RID scenario = world->get_scenario();
if (_pandemonium_preview_camera_ID != (ObjectID)-1) {
@ -237,7 +237,7 @@ void RoomManager::_notification(int p_what) {
}
if (_settings_gameplay_monitor_enabled) {
Ref<World> world = get_world();
Ref<World3D> world = get_world();
RID scenario = world->get_scenario();
List<Camera *> cameras;

View File

@ -378,7 +378,7 @@ void ShapeCast::_update_shapecast_state() {
ERR_FAIL_COND_MSG(shape.is_null(), "Null reference to shape. ShapeCast requires a Shape3D to sweep for collisions.");
Ref<World> w3d = get_world();
Ref<World3D> w3d = get_world();
ERR_FAIL_COND(w3d.is_null());
PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space());

View File

@ -701,9 +701,9 @@ bool Spatial::is_set_as_toplevel() const {
return data.toplevel;
}
Ref<World> Spatial::get_world() const {
ERR_FAIL_COND_V(!is_inside_world(), Ref<World>());
ERR_FAIL_COND_V(!data.viewport, Ref<World>());
Ref<World3D> Spatial::get_world() const {
ERR_FAIL_COND_V(!is_inside_world(), Ref<World3D>());
ERR_FAIL_COND_V(!data.viewport, Ref<World3D>());
return data.viewport->find_world();
}

View File

@ -33,7 +33,7 @@
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
class World;
class World3D;
class SpatialGizmo : public Reference {
GDCLASS(SpatialGizmo, Reference);
@ -152,7 +152,7 @@ public:
virtual void notification_callback(int p_message_type);
Spatial *get_parent_spatial() const;
Ref<World> get_world() const;
Ref<World3D> get_world() const;
void set_translation(const Vector3 &p_translation);
void set_rotation(const Vector3 &p_euler_rad);

View File

@ -32,13 +32,13 @@
#include "scene/3d/cull_instance.h"
class World;
class World3D;
class Camera;
class VisibilityNotifier : public CullInstance {
GDCLASS(VisibilityNotifier, CullInstance);
Ref<World> world;
Ref<World3D> world;
Set<Camera *> cameras;
AABB aabb;

View File

@ -2208,7 +2208,7 @@ SceneTree::SceneTree() {
root->set_name("root");
root->set_handle_input_locally(false);
if (!root->get_world().is_valid()) {
root->set_world(Ref<World>(memnew(World)));
root->set_world(Ref<World3D>(memnew(World3D)));
}
set_physics_interpolation_enabled(GLOBAL_DEF("physics/common/physics_interpolation", false));

View File

@ -1110,7 +1110,7 @@ void Viewport::_propagate_exit_world(Node *p_node) {
}
}
void Viewport::set_world(const Ref<World> &p_world) {
void Viewport::set_world(const Ref<World3D> &p_world) {
if (world == p_world) {
return;
}
@ -1130,7 +1130,7 @@ void Viewport::set_world(const Ref<World> &p_world) {
own_world = world->duplicate();
world->connect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed");
} else {
own_world = Ref<World>(memnew(World));
own_world = Ref<World3D>(memnew(World3D));
}
}
@ -1145,7 +1145,7 @@ void Viewport::set_world(const Ref<World> &p_world) {
_update_listener();
}
Ref<World> Viewport::get_world() const {
Ref<World3D> Viewport::get_world() const {
return world;
}
@ -1153,7 +1153,7 @@ Ref<World2D> Viewport::get_world_2d() const {
return world_2d;
}
Ref<World> Viewport::find_world() const {
Ref<World3D> Viewport::find_world() const {
if (own_world.is_valid()) {
return own_world;
} else if (world.is_valid()) {
@ -1161,7 +1161,7 @@ Ref<World> Viewport::find_world() const {
} else if (parent) {
return parent->find_world();
} else {
return Ref<World>();
return Ref<World3D>();
}
}
@ -2911,10 +2911,10 @@ void Viewport::set_use_own_world(bool p_use_own_world) {
own_world = world->duplicate();
world->connect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed");
} else {
own_world = Ref<World>(memnew(World));
own_world = Ref<World3D>(memnew(World3D));
}
} else {
own_world = Ref<World>();
own_world = Ref<World3D>();
if (world.is_valid()) {
world->disconnect(CoreStringNames::get_singleton()->changed, this, "_own_world_changed");
}
@ -3333,7 +3333,7 @@ void Viewport::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "size_override_stretch"), "set_size_override_stretch", "is_size_override_stretch_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "own_world"), "set_use_own_world", "is_using_own_world");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world", PROPERTY_HINT_RESOURCE_TYPE, "World"), "set_world", "get_world");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world", PROPERTY_HINT_RESOURCE_TYPE, "World3D"), "set_world", "get_world");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_2d", PROPERTY_HINT_RESOURCE_TYPE, "World2D", 0), "set_world_2d", "get_world_2d");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transparent_bg"), "set_transparent_background", "has_transparent_background");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "handle_input_locally"), "set_handle_input_locally", "is_handling_input_locally");

View File

@ -48,7 +48,7 @@ class Timer;
class Viewport;
class CollisionObject;
class SceneTreeTimer;
class World;
class World3D;
class World2D;
class ViewportTexture : public Texture {
@ -251,8 +251,8 @@ private:
Map<ObjectID, uint64_t> physics_2d_mouseover;
Ref<World2D> world_2d;
Ref<World> world;
Ref<World> own_world;
Ref<World3D> world;
Ref<World3D> own_world;
StringName input_group;
StringName gui_input_group;
@ -459,10 +459,10 @@ public:
Rect2 get_visible_rect() const;
RID get_viewport_rid() const;
void set_world(const Ref<World> &p_world);
void set_world(const Ref<World3D> &p_world);
void set_world_2d(const Ref<World2D> &p_world_2d);
Ref<World> get_world() const;
Ref<World> find_world() const;
Ref<World3D> get_world() const;
Ref<World3D> find_world() const;
Ref<World2D> get_world_2d() const;
Ref<World2D> find_world_2d() const;

View File

@ -601,7 +601,7 @@ void register_scene_types() {
#endif
ClassDB::register_class<PhysicsMaterial>();
ClassDB::register_class<World>();
ClassDB::register_class<World3D>();
ClassDB::register_class<Environment>();
ClassDB::register_class<World2D>();
ClassDB::register_virtual_class<Texture>();

View File

@ -214,59 +214,59 @@ struct SpatialIndexer {
}
};
void World::_register_camera(Camera *p_camera) {
void World3D::_register_camera(Camera *p_camera) {
#ifndef _3D_DISABLED
indexer->_add_camera(p_camera);
#endif
}
void World::_update_camera(Camera *p_camera) {
void World3D::_update_camera(Camera *p_camera) {
#ifndef _3D_DISABLED
indexer->_update_camera(p_camera);
#endif
}
void World::_remove_camera(Camera *p_camera) {
void World3D::_remove_camera(Camera *p_camera) {
#ifndef _3D_DISABLED
indexer->_remove_camera(p_camera);
#endif
}
void World::_register_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) {
void World3D::_register_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) {
#ifndef _3D_DISABLED
indexer->_notifier_add(p_notifier, p_rect);
#endif
}
void World::_update_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) {
void World3D::_update_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) {
#ifndef _3D_DISABLED
indexer->_notifier_update(p_notifier, p_rect);
#endif
}
void World::_remove_notifier(VisibilityNotifier *p_notifier) {
void World3D::_remove_notifier(VisibilityNotifier *p_notifier) {
#ifndef _3D_DISABLED
indexer->_notifier_remove(p_notifier);
#endif
}
void World::_update(uint64_t p_frame) {
void World3D::_update(uint64_t p_frame) {
#ifndef _3D_DISABLED
indexer->_update(p_frame);
#endif
}
RID World::get_space() const {
RID World3D::get_space() const {
return space;
}
RID World::get_scenario() const {
RID World3D::get_scenario() const {
return scenario;
}
RID World::get_navigation_map() const {
RID World3D::get_navigation_map() const {
return navigation_map;
}
void World::set_environment(const Ref<Environment> &p_environment) {
void World3D::set_environment(const Ref<Environment> &p_environment) {
if (environment == p_environment) {
return;
}
@ -281,11 +281,11 @@ void World::set_environment(const Ref<Environment> &p_environment) {
emit_changed();
}
Ref<Environment> World::get_environment() const {
Ref<Environment> World3D::get_environment() const {
return environment;
}
void World::set_fallback_environment(const Ref<Environment> &p_environment) {
void World3D::set_fallback_environment(const Ref<Environment> &p_environment) {
if (fallback_environment == p_environment) {
return;
}
@ -300,29 +300,29 @@ void World::set_fallback_environment(const Ref<Environment> &p_environment) {
emit_changed();
}
Ref<Environment> World::get_fallback_environment() const {
Ref<Environment> World3D::get_fallback_environment() const {
return fallback_environment;
}
PhysicsDirectSpaceState *World::get_direct_space_state() {
PhysicsDirectSpaceState *World3D::get_direct_space_state() {
return PhysicsServer::get_singleton()->space_get_direct_state(space);
}
void World::get_camera_list(List<Camera *> *r_cameras) {
void World3D::get_camera_list(List<Camera *> *r_cameras) {
for (Map<Camera *, SpatialIndexer::CameraData>::Element *E = indexer->cameras.front(); E; E = E->next()) {
r_cameras->push_back(E->key());
}
}
void World::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_space"), &World::get_space);
ClassDB::bind_method(D_METHOD("get_scenario"), &World::get_scenario);
ClassDB::bind_method(D_METHOD("get_navigation_map"), &World::get_navigation_map);
ClassDB::bind_method(D_METHOD("set_environment", "env"), &World::set_environment);
ClassDB::bind_method(D_METHOD("get_environment"), &World::get_environment);
ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World::set_fallback_environment);
ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World::get_fallback_environment);
ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state);
void World3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_space"), &World3D::get_space);
ClassDB::bind_method(D_METHOD("get_scenario"), &World3D::get_scenario);
ClassDB::bind_method(D_METHOD("get_navigation_map"), &World3D::get_navigation_map);
ClassDB::bind_method(D_METHOD("set_environment", "env"), &World3D::set_environment);
ClassDB::bind_method(D_METHOD("get_environment"), &World3D::get_environment);
ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World3D::set_fallback_environment);
ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World3D::get_fallback_environment);
ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World3D::get_direct_space_state);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment");
ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space");
@ -331,7 +331,7 @@ void World::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state");
}
World::World() {
World3D::World3D() {
space = RID_PRIME(PhysicsServer::get_singleton()->space_create());
scenario = RID_PRIME(RenderingServer::get_singleton()->scenario_create());
@ -358,7 +358,7 @@ World::World() {
#endif
}
World::~World() {
World3D::~World3D() {
PhysicsServer::get_singleton()->free(space);
RenderingServer::get_singleton()->free(scenario);
NavigationServer::get_singleton()->free(navigation_map);

View File

@ -1,5 +1,6 @@
#ifndef WORLD_H
#define WORLD_H
#ifndef WORLD_3D_H
#define WORLD_3D_H
/*************************************************************************/
/* world.h */
/*************************************************************************/
@ -39,9 +40,9 @@ class Camera;
class VisibilityNotifier;
struct SpatialIndexer;
class World : public Resource {
GDCLASS(World, Resource);
RES_BASE_EXTENSION("world");
class World3D : public Resource {
GDCLASS(World3D, Resource);
RES_BASE_EXTENSION("world3d");
private:
RID space;
@ -82,8 +83,8 @@ public:
PhysicsDirectSpaceState *get_direct_space_state();
World();
~World();
World3D();
~World3D();
};
#endif // WORLD_H