summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/area.cpp18
-rw-r--r--scene/3d/area.h2
-rw-r--r--scene/3d/arvr_nodes.cpp14
-rw-r--r--scene/3d/arvr_nodes.h2
-rw-r--r--scene/3d/audio_stream_player_3d.cpp23
-rw-r--r--scene/3d/bone_attachment.cpp14
-rw-r--r--scene/3d/bone_attachment.h2
-rw-r--r--scene/3d/camera.cpp31
-rw-r--r--scene/3d/camera.h8
-rw-r--r--scene/3d/character_camera.cpp718
-rw-r--r--scene/3d/character_camera.h167
-rw-r--r--scene/3d/collision_object.cpp3
-rw-r--r--scene/3d/collision_object.h2
-rw-r--r--scene/3d/collision_polygon.cpp6
-rw-r--r--scene/3d/collision_polygon.h2
-rw-r--r--scene/3d/collision_shape.cpp16
-rw-r--r--scene/3d/collision_shape.h2
-rw-r--r--scene/3d/gi_probe.cpp15
-rw-r--r--scene/3d/gi_probe.h2
-rw-r--r--scene/3d/immediate_geometry.cpp2
-rw-r--r--scene/3d/immediate_geometry.h6
-rw-r--r--scene/3d/interpolated_camera.cpp16
-rw-r--r--scene/3d/interpolated_camera.h2
-rw-r--r--scene/3d/light.cpp61
-rw-r--r--scene/3d/light.h9
-rw-r--r--scene/3d/listener.cpp2
-rw-r--r--scene/3d/listener.h2
-rw-r--r--scene/3d/mesh_instance.cpp12
-rw-r--r--scene/3d/mesh_instance.h2
-rw-r--r--scene/3d/multimesh_instance.cpp2
-rw-r--r--scene/3d/multimesh_instance.h2
-rw-r--r--scene/3d/navigation.cpp4
-rw-r--r--scene/3d/navigation.h2
-rw-r--r--scene/3d/navigation_mesh.cpp14
-rw-r--r--scene/3d/navigation_mesh.h2
-rw-r--r--scene/3d/particles.cpp76
-rw-r--r--scene/3d/particles.h4
-rw-r--r--scene/3d/path.cpp35
-rw-r--r--scene/3d/path.h2
-rw-r--r--scene/3d/physics_body.cpp35
-rw-r--r--scene/3d/physics_body.h2
-rw-r--r--scene/3d/physics_joint.cpp436
-rw-r--r--scene/3d/physics_joint.h71
-rw-r--r--scene/3d/portal.cpp5
-rw-r--r--scene/3d/portal.h6
-rw-r--r--scene/3d/position_3d.cpp2
-rw-r--r--scene/3d/position_3d.h2
-rw-r--r--scene/3d/proximity_group.cpp6
-rw-r--r--scene/3d/proximity_group.h2
-rw-r--r--scene/3d/ray_cast.cpp14
-rw-r--r--scene/3d/ray_cast.h2
-rw-r--r--scene/3d/reflection_probe.cpp6
-rw-r--r--scene/3d/reflection_probe.h2
-rw-r--r--scene/3d/remote_transform.cpp10
-rw-r--r--scene/3d/remote_transform.h2
-rw-r--r--scene/3d/room_instance.cpp9
-rw-r--r--scene/3d/room_instance.h7
-rw-r--r--scene/3d/scenario_fx.cpp2
-rw-r--r--scene/3d/scenario_fx.h2
-rw-r--r--scene/3d/skeleton.cpp12
-rw-r--r--scene/3d/skeleton.h8
-rw-r--r--scene/3d/spatial.cpp67
-rw-r--r--scene/3d/spatial.h3
-rw-r--r--scene/3d/spatial_indexer.cpp166
-rw-r--r--scene/3d/spatial_indexer.h84
-rw-r--r--scene/3d/spatial_velocity_tracker.h2
-rw-r--r--scene/3d/sprite_3d.cpp296
-rw-r--r--scene/3d/sprite_3d.h35
-rw-r--r--scene/3d/vehicle_body.cpp21
-rw-r--r--scene/3d/vehicle_body.h4
-rw-r--r--scene/3d/visibility_notifier.cpp22
-rw-r--r--scene/3d/visibility_notifier.h2
-rw-r--r--scene/3d/visual_instance.cpp50
-rw-r--r--scene/3d/visual_instance.h6
74 files changed, 416 insertions, 2289 deletions
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp
index c64b807e43..217cb71230 100644
--- a/scene/3d/area.cpp
+++ b/scene/3d/area.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -115,7 +115,7 @@ real_t Area::get_priority() const {
void Area::_body_enter_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
Map<ObjectID, BodyState>::Element *E = body_map.find(p_id);
@@ -133,7 +133,7 @@ void Area::_body_enter_tree(ObjectID p_id) {
void Area::_body_exit_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
Map<ObjectID, BodyState>::Element *E = body_map.find(p_id);
ERR_FAIL_COND(!E);
@@ -152,7 +152,7 @@ void Area::_body_inout(int p_status, const RID &p_body, int p_instance, int p_bo
ObjectID objid = p_instance;
Object *obj = ObjectDB::get_instance(objid);
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
Map<ObjectID, BodyState>::Element *E = body_map.find(objid);
@@ -228,7 +228,7 @@ void Area::_clear_monitoring() {
for (Map<ObjectID, BodyState>::Element *E = bmcopy.front(); E; E = E->next()) {
Object *obj = ObjectDB::get_instance(E->key());
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
if (!node) //node may have been deleted in previous frame or at other legiminate point
continue;
@@ -258,7 +258,7 @@ void Area::_clear_monitoring() {
for (Map<ObjectID, AreaState>::Element *E = bmcopy.front(); E; E = E->next()) {
Object *obj = ObjectDB::get_instance(E->key());
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
if (!node) //node may have been deleted in previous frame or at other legiminate point
continue;
@@ -312,7 +312,7 @@ void Area::set_monitoring(bool p_enable) {
void Area::_area_enter_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
Map<ObjectID, AreaState>::Element *E = area_map.find(p_id);
@@ -330,7 +330,7 @@ void Area::_area_enter_tree(ObjectID p_id) {
void Area::_area_exit_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
Map<ObjectID, AreaState>::Element *E = area_map.find(p_id);
ERR_FAIL_COND(!E);
@@ -349,7 +349,7 @@ void Area::_area_inout(int p_status, const RID &p_area, int p_instance, int p_ar
ObjectID objid = p_instance;
Object *obj = ObjectDB::get_instance(objid);
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
Map<ObjectID, AreaState>::Element *E = area_map.find(objid);
diff --git a/scene/3d/area.h b/scene/3d/area.h
index 5df308fc47..7ea97d0a8c 100644
--- a/scene/3d/area.h
+++ b/scene/3d/area.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index 3c99f7fb3a..caf313190b 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -40,14 +40,14 @@ void ARVRCamera::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
// need to find our ARVROrigin parent and let it know we're it's camera!
- ARVROrigin *origin = get_parent()->cast_to<ARVROrigin>();
+ ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
if (origin != NULL) {
origin->set_tracked_camera(this);
}
}; break;
case NOTIFICATION_EXIT_TREE: {
// need to find our ARVROrigin parent and let it know we're no longer it's camera!
- ARVROrigin *origin = get_parent()->cast_to<ARVROrigin>();
+ ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
if (origin != NULL) {
origin->clear_tracked_camera_if(this);
}
@@ -60,7 +60,7 @@ String ARVRCamera::get_configuration_warning() const {
return String();
// must be child node of ARVROrigin!
- ARVROrigin *origin = get_parent()->cast_to<ARVROrigin>();
+ ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
if (origin == NULL) {
return TTR("ARVRCamera must have an ARVROrigin node as its parent");
};
@@ -209,7 +209,7 @@ String ARVRController::get_configuration_warning() const {
return String();
// must be child node of ARVROrigin!
- ARVROrigin *origin = get_parent()->cast_to<ARVROrigin>();
+ ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
if (origin == NULL) {
return TTR("ARVRController must have an ARVROrigin node as its parent");
};
@@ -264,7 +264,7 @@ void ARVRAnchor::_notification(int p_what) {
// our basis is scaled to the size of the plane the anchor is tracking
// extract the size from our basis and reset the scale
size = transform.basis.get_scale() * world_scale;
- transform.basis.set_scale(Vector3(1.0, 1.0, 1.0));
+ transform.basis.orthonormalize();
// apply our reference frame and set our transform
set_transform(arvr_server->get_reference_frame() * transform);
@@ -321,7 +321,7 @@ String ARVRAnchor::get_configuration_warning() const {
return String();
// must be child node of ARVROrigin!
- ARVROrigin *origin = get_parent()->cast_to<ARVROrigin>();
+ ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
if (origin == NULL) {
return TTR("ARVRAnchor must have an ARVROrigin node as its parent");
};
diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h
index 936519126b..4c14be71b5 100644
--- a/scene/3d/arvr_nodes.h
+++ b/scene/3d/arvr_nodes.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 6abc2caac8..6efdf25f0d 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -215,7 +215,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
velocity_tracker->reset(get_global_transform().origin);
AudioServer::get_singleton()->add_callback(_mix_audios, this);
- if (autoplay && !get_tree()->is_editor_hint()) {
+ if (autoplay && !Engine::get_singleton()->is_editor_hint()) {
play();
}
}
@@ -266,7 +266,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
if (!sr[i].collider)
continue;
- Area *tarea = sr[i].collider->cast_to<Area>();
+ Area *tarea = Object::cast_to<Area>(sr[i].collider);
if (!tarea)
continue;
@@ -533,6 +533,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
if (!active) {
set_fixed_process_internal(false);
_change_notify("playing"); //update property in editor
+ emit_signal("finished");
}
}
}
@@ -888,16 +889,18 @@ void AudioStreamPlayer3D::_bind_methods() {
ADD_GROUP("Doppler", "doppler_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "doppler_tracking", PROPERTY_HINT_ENUM, "Disabled,Idle,Fixed"), "set_doppler_tracking", "get_doppler_tracking");
- BIND_CONSTANT(ATTENUATION_INVERSE_DISTANCE);
- BIND_CONSTANT(ATTENUATION_INVERSE_SQUARE_DISTANCE);
- BIND_CONSTANT(ATTENUATION_LOGARITHMIC);
+ BIND_ENUM_CONSTANT(ATTENUATION_INVERSE_DISTANCE);
+ BIND_ENUM_CONSTANT(ATTENUATION_INVERSE_SQUARE_DISTANCE);
+ BIND_ENUM_CONSTANT(ATTENUATION_LOGARITHMIC);
- BIND_CONSTANT(OUT_OF_RANGE_MIX);
- BIND_CONSTANT(OUT_OF_RANGE_PAUSE);
+ BIND_ENUM_CONSTANT(OUT_OF_RANGE_MIX);
+ BIND_ENUM_CONSTANT(OUT_OF_RANGE_PAUSE);
- BIND_CONSTANT(DOPPLER_TRACKING_DISABLED);
- BIND_CONSTANT(DOPPLER_TRACKING_IDLE_STEP);
- BIND_CONSTANT(DOPPLER_TRACKING_FIXED_STEP);
+ BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED);
+ BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP);
+ BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP);
+
+ ADD_SIGNAL(MethodInfo("finished"));
}
AudioStreamPlayer3D::AudioStreamPlayer3D() {
diff --git a/scene/3d/bone_attachment.cpp b/scene/3d/bone_attachment.cpp
index b55b788b54..e1a5329fb0 100644
--- a/scene/3d/bone_attachment.cpp
+++ b/scene/3d/bone_attachment.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -51,9 +51,7 @@ bool BoneAttachment::_set(const StringName &p_name, const Variant &p_value) {
}
void BoneAttachment::_get_property_list(List<PropertyInfo> *p_list) const {
- Skeleton *parent = NULL;
- if (get_parent())
- parent = get_parent()->cast_to<Skeleton>();
+ Skeleton *parent = Object::cast_to<Skeleton>(get_parent());
if (parent) {
@@ -73,8 +71,8 @@ void BoneAttachment::_get_property_list(List<PropertyInfo> *p_list) const {
void BoneAttachment::_check_bind() {
- if (get_parent() && get_parent()->cast_to<Skeleton>()) {
- Skeleton *sk = get_parent()->cast_to<Skeleton>();
+ if (Skeleton *sk = Object::cast_to<Skeleton>(get_parent())) {
+
int idx = sk->find_bone(bone_name);
if (idx != -1) {
sk->bind_child_node_to_bone(idx, this);
@@ -88,8 +86,8 @@ void BoneAttachment::_check_unbind() {
if (bound) {
- if (get_parent() && get_parent()->cast_to<Skeleton>()) {
- Skeleton *sk = get_parent()->cast_to<Skeleton>();
+ if (Skeleton *sk = Object::cast_to<Skeleton>(get_parent())) {
+
int idx = sk->find_bone(bone_name);
if (idx != -1) {
sk->unbind_child_node_from_bone(idx, this);
diff --git a/scene/3d/bone_attachment.h b/scene/3d/bone_attachment.h
index 65908d98a8..159d16157a 100644
--- a/scene/3d/bone_attachment.h
+++ b/scene/3d/bone_attachment.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 3c5eb21d38..02a7845e0b 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -339,15 +339,8 @@ Vector3 Camera::project_local_ray_normal(const Point2 &p_pos) const {
ERR_FAIL_COND_V(!is_inside_tree(), Vector3());
}
-#if 0
- Size2 viewport_size = get_viewport()->get_visible_rect().size;
- Vector2 cpos = p_pos;
-#else
-
Size2 viewport_size = get_viewport()->get_camera_rect_size();
Vector2 cpos = get_viewport()->get_camera_coords(p_pos);
-#endif
-
Vector3 ray;
if (mode == PROJECTION_ORTHOGONAL) {
@@ -371,17 +364,9 @@ Vector3 Camera::project_ray_origin(const Point2 &p_pos) const {
ERR_FAIL_COND_V(!is_inside_tree(), Vector3());
}
-#if 0
- Size2 viewport_size = get_viewport()->get_visible_rect().size;
- Vector2 cpos = p_pos;
-#else
-
Size2 viewport_size = get_viewport()->get_camera_rect_size();
Vector2 cpos = get_viewport()->get_camera_coords(p_pos);
-#endif
-
ERR_FAIL_COND_V(viewport_size.y == 0, Vector3());
- //float aspect = viewport_size.x / viewport_size.y;
if (mode == PROJECTION_PERSPECTIVE) {
@@ -564,15 +549,15 @@ void Camera::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_doppler_tracking"), &Camera::get_doppler_tracking);
//ClassDB::bind_method(D_METHOD("_camera_make_current"),&Camera::_camera_make_current );
- BIND_CONSTANT(PROJECTION_PERSPECTIVE);
- BIND_CONSTANT(PROJECTION_ORTHOGONAL);
+ BIND_ENUM_CONSTANT(PROJECTION_PERSPECTIVE);
+ BIND_ENUM_CONSTANT(PROJECTION_ORTHOGONAL);
- BIND_CONSTANT(KEEP_WIDTH);
- BIND_CONSTANT(KEEP_HEIGHT);
+ BIND_ENUM_CONSTANT(KEEP_WIDTH);
+ BIND_ENUM_CONSTANT(KEEP_HEIGHT);
- BIND_CONSTANT(DOPPLER_TRACKING_DISABLED)
- BIND_CONSTANT(DOPPLER_TRACKING_IDLE_STEP)
- BIND_CONSTANT(DOPPLER_TRACKING_FIXED_STEP)
+ BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED)
+ BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP)
+ BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP)
}
float Camera::get_fov() const {
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index 43975892b4..243a7b9b39 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -126,9 +126,9 @@ public:
virtual Transform get_camera_transform() const;
- Vector3 project_ray_normal(const Point2 &p_point) const;
- Vector3 project_ray_origin(const Point2 &p_point) const;
- Vector3 project_local_ray_normal(const Point2 &p_point) const;
+ Vector3 project_ray_normal(const Point2 &p_pos) const;
+ Vector3 project_ray_origin(const Point2 &p_pos) const;
+ Vector3 project_local_ray_normal(const Point2 &p_pos) const;
Point2 unproject_position(const Vector3 &p_pos) const;
bool is_position_behind(const Vector3 &p_pos) const;
Vector3 project_position(const Point2 &p_point) const;
diff --git a/scene/3d/character_camera.cpp b/scene/3d/character_camera.cpp
deleted file mode 100644
index 065e21fccd..0000000000
--- a/scene/3d/character_camera.cpp
+++ /dev/null
@@ -1,718 +0,0 @@
-/*************************************************************************/
-/* character_camera.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#include "character_camera.h"
-
-#include "physics_body.h"
-#if 0
-void CharacterCamera::_set(const String& p_name, const Variant& p_value) {
-
- if (p_name=="type")
- set_camera_type((CameraType)((int)(p_value)));
- else if (p_name=="orbit")
- set_orbit(p_value);
- else if (p_name=="height")
- set_height(p_value);
- else if (p_name=="inclination")
- set_inclination(p_value);
- else if (p_name=="max_orbit_x")
- set_max_orbit_x(p_value);
- else if (p_name=="min_orbit_x")
- set_min_orbit_x(p_value);
- else if (p_name=="max_distance")
- set_max_distance(p_value);
- else if (p_name=="min_distance")
- set_min_distance(p_value);
- else if (p_name=="distance")
- set_distance(p_value);
- else if (p_name=="clip")
- set_clip(p_value);
- else if (p_name=="autoturn")
- set_autoturn(p_value);
- else if (p_name=="autoturn_tolerance")
- set_autoturn_tolerance(p_value);
- else if (p_name=="autoturn_speed")
- set_autoturn_speed(p_value);
-
-}
-Variant CharacterCamera::_get(const String& p_name) const {
-
- if (p_name=="type")
- return get_camera_type();
- else if (p_name=="orbit")
- return get_orbit();
- else if (p_name=="height")
- return get_height();
- else if (p_name=="inclination")
- return get_inclination();
- else if (p_name=="max_orbit_x")
- return get_max_orbit_x();
- else if (p_name=="min_orbit_x")
- return get_min_orbit_x();
- else if (p_name=="max_distance")
- return get_max_distance();
- else if (p_name=="min_distance")
- return get_min_distance();
- else if (p_name=="distance")
- return get_distance();
- else if (p_name=="clip")
- return has_clip();
- else if (p_name=="autoturn")
- return has_autoturn();
- else if (p_name=="autoturn_tolerance")
- return get_autoturn_tolerance();
- else if (p_name=="autoturn_speed")
- return get_autoturn_speed();
-
- return Variant();
-}
-
-void CharacterCamera::_get_property_list( List<PropertyInfo> *p_list) const {
-
- p_list->push_back( PropertyInfo( Variant::INT, "type", PROPERTY_HINT_ENUM, "Fixed,Follow") );
- p_list->push_back( PropertyInfo( Variant::VECTOR2, "orbit" ) );
- p_list->push_back( PropertyInfo( Variant::REAL, "height", PROPERTY_HINT_RANGE,"-1024,1024,0.01" ) );
- p_list->push_back( PropertyInfo( Variant::REAL, "inclination", PROPERTY_HINT_RANGE,"-90,90,0.01" ) );
- p_list->push_back( PropertyInfo( Variant::REAL, "max_orbit_x", PROPERTY_HINT_RANGE,"-90,90,0.01" ) );
- p_list->push_back( PropertyInfo( Variant::REAL, "min_orbit_x", PROPERTY_HINT_RANGE,"-90,90,0.01" ) );
- p_list->push_back( PropertyInfo( Variant::REAL, "min_distance", PROPERTY_HINT_RANGE,"0,100,0.01" ) );
- p_list->push_back( PropertyInfo( Variant::REAL, "max_distance", PROPERTY_HINT_RANGE,"0,100,0.01" ) );
- p_list->push_back( PropertyInfo( Variant::REAL, "distance", PROPERTY_HINT_RANGE,"0.01,1024,0,01") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "clip") );
- p_list->push_back( PropertyInfo( Variant::BOOL, "autoturn") );
- p_list->push_back( PropertyInfo( Variant::REAL, "autoturn_tolerance", PROPERTY_HINT_RANGE,"1,90,0.01") );
- p_list->push_back( PropertyInfo( Variant::REAL, "autoturn_speed", PROPERTY_HINT_RANGE,"1,90,0.01") );
-
-
-}
-
-void CharacterCamera::_compute_camera() {
-
-
- // update the transform with the next proposed transform (camera is 1 logic frame delayed)
-
- /*
- float time = get_root_node()->get_frame_time();
- Vector3 oldp = accepted.get_origin();
- Vector3 newp = proposed.get_origin();
-
- float frame_dist = time *
- if (oldp.distance_to(newp) >
- */
-
- float time = get_root_node()->get_frame_time();
-
- if (true) {
-
- if (clip_ray[0].clipped && clip_ray[1].clipped && clip_ray[2].clipped) {
- //all have been clipped
- proposed.origin=clip_ray[1].clip_pos;
-
-
- } else {
-
- Vector3 rel=proposed.origin-target_pos;
-
- if (clip_ray[0].clipped && !clip_ray[2].clipped) {
-
- float distance = target_pos.distance_to(clip_ray[0].clip_pos);
- real_t amount = 1.0-(distance/clip_len);
- amount = CLAMP(amount,0,1);
-
-
- rel=Matrix3(Vector3(0,1,0)),
- rotate_orbit(Vector2(0,autoturn_speed*time*amount));
- }
- if (clip_ray[2].clipped && !clip_ray[0].clipped) {
-
- float distance = target_pos.distance_to(clip_ray[2].clip_pos);
- real_t amount = 1.0-(distance/clip_len);
- amount = CLAMP(amount,0,1);
-
- rotate_orbit(Vector2(0,-autoturn_speed*time*amount));
- }
-
- }
- }
-
-
- Transform final;
-
- static float pos_ratio = 0.9;
- static float rot_ratio = 10;
-
- Vector3 vec1 = accepted.origin;
- Vector3 vec2 = proposed.origin;
- final.origin = vec2.linear_interpolate(vec1, pos_ratio * time);
-
- Quat q1 = accepted.basis;
- Quat q2 = proposed.basis;
- final.basis = q1.slerp(q2, rot_ratio * time);
-
- accepted=final;
-
- _update_camera();
-
- // calculate the next proposed transform
-
-
- Vector3 new_pos;
- Vector3 character_pos = get_global_transform().origin;
- character_pos.y+=height; // height compensate
-
- if(type==CAMERA_FOLLOW) {
-
-
-
- /* calculate some variables */
-
- Vector3 rel = follow_pos - character_pos;
-
- float l = rel.length();
- Vector3 rel_n = (l > 0) ? (rel/l) : Vector3();
-#if 1
- float ang = Math::acos(rel_n.dot( Vector3(0,1,0) ));
-
- Vector3 tangent = rel_n;
- tangent.y=0; // get rid of y
- if (tangent.length_squared() < CMP_EPSILON2)
- tangent=Vector3(0,0,1); // use Z as tangent if rel is parallel to y
- else
- tangent.normalize();
-
- /* now start applying the rules */
-
- //clip distance
- if (l > max_distance)
- l=max_distance;
- if (l < min_distance)
- l=min_distance;
-
- //fix angle
-
- float ang_min = Math_PI * 0.5 + Math::deg2rad(min_orbit_x);
- float ang_max = Math_PI * 0.5 + Math::deg2rad(max_orbit_x);
-
- if (ang<ang_min)
- ang=ang_min;
- if (ang>ang_max)
- ang=ang_max;
-
- /* finally, rebuild the validated camera position */
-
- new_pos=Vector3(0,Math::cos(ang),0);
- new_pos+=tangent*Math::sin(ang);
- new_pos*=l;
- new_pos+=character_pos;
-#else
- if (l > max_distance)
- l=max_distance;
- if (l < min_distance)
- l=min_distance;
-
- new_pos = character_pos + rel_n * l;
-
-#endif
- follow_pos=new_pos;
-
- } else if (type==CAMERA_FIXED) {
-
-
- if (distance<min_distance)
- distance=min_distance;
- if (distance>max_distance)
- distance=max_distance;
-
- if (orbit.x<min_orbit_x)
- orbit.x=min_orbit_x;
- if (orbit.x>max_orbit_x)
- orbit.x=max_orbit_x;
-
- Matrix3 m;
- m.rotate(Vector3(0,1,0),-Math::deg2rad(orbit.y));
- m.rotate(Vector3(1,0,0),-Math::deg2rad(orbit.x));
-
- new_pos = (m.get_axis(2) * distance) + character_pos;
-
- if (use_lookat_target) {
-
- Transform t = get_global_transform();
- Vector3 y = t.basis.get_axis(1).normalized();
- Vector3 z = lookat_target - character_pos;
- z= (z - y * y.dot(z)).normalized();
- orbit.y = -Math::rad2deg(Math::atan2(z.x,z.z)) + 180;
-
- /*
- Transform t = get_global_transform();
- Vector3 y = t.basis.get_axis(1).normalized();
- Vector3 z = lookat_target - t.origin;
- z= (z - y * y.dot(z)).normalized();
- Vector3 x = z.cross(y).normalized();
- Transform t2;
- t2.basis.set_axis(0,x);
- t2.basis.set_axis(1,y);
- t2.basis.set_axis(2,z);
- t2.origin=t.origin;
-
- Vector3 local = t2.xform_inv(camera_pos);
-
- float ang = Math::atan2(local.x,local.y);
- */
-
- /*
-
- Vector3 vec1 = lookat_target - new_pos;
- vec1.normalize();
- Vector3 vec2 = character_pos - new_pos;
- vec2.normalize();
-
- float dot = vec1.dot(vec2);
- printf("dot %f\n", dot);
- if ( dot < 0.5) {
-
- rotate_orbit(Vector2(0, 90));
- };
- */
-
-
- };
- }
-
- Vector3 target;
- if (use_lookat_target) {
-
- target = lookat_target;
- } else {
- target = character_pos;
- };
-
- proposed.set_look_at(new_pos,target,Vector3(0,1,0));
- proposed = proposed * Transform(Matrix3(Vector3(1,0,0),Math::deg2rad(inclination)),Vector3()); //inclination
-
-
- Vector<RID> exclude;
- exclude.push_back(target_body);
-
-
-
- Vector3 rel = new_pos-target;
-
- for(int i=0;i<3;i++) {
-
- PhysicsServer::get_singleton()->query_intersection(clip_ray[i].query,get_world().get_space(),exclude);
- PhysicsServer::get_singleton()->query_intersection_segment(clip_ray[i].query,target,target+Matrix3(Vector3(0,1,0),Math::deg2rad(autoturn_tolerance*(i-1.0))).xform(rel));
- clip_ray[i].clipped=false;
- clip_ray[i].clip_pos=Vector3();
- }
- target_pos=target;
- clip_len=rel.length();
-
-
-
-}
-
-void CharacterCamera::set_use_lookat_target(bool p_use, const Vector3 &p_lookat) {
-
- use_lookat_target = p_use;
- lookat_target = p_lookat;
-};
-
-
-void CharacterCamera::_notification(int p_what) {
-
- switch(p_what) {
-
- case NOTIFICATION_PROCESS: {
-
-
- _compute_camera();
- } break;
-
- case NOTIFICATION_ENTER_SCENE: {
-
- if (type==CAMERA_FOLLOW) {
-
- set_orbit(orbit);
- set_distance(distance);
- }
-
- accepted=get_global_transform();
- proposed=accepted;
-
- target_body = RID();
-
- Node* parent = get_parent();
- while (parent) {
- PhysicsBody* p = parent->cast_to<PhysicsBody>();
- if (p) {
- target_body = p->get_body();
- break;
- };
- parent = parent->get_parent();
- };
-
- } break;
-
- case NOTIFICATION_TRANSFORM_CHANGED: {
-
- } break;
- case NOTIFICATION_EXIT_SCENE: {
-
- if (type==CAMERA_FOLLOW) {
- distance=get_distance();
- orbit=get_orbit();
-
- }
- } break;
-
- case NOTIFICATION_BECAME_CURRENT: {
-
- set_process(true);
- } break;
- case NOTIFICATION_LOST_CURRENT: {
-
- set_process(false);
- } break;
- }
-
-}
-
-
-void CharacterCamera::set_camera_type(CameraType p_camera_type) {
-
-
- if (p_camera_type==type)
- return;
-
- type=p_camera_type;
-
- // do conversions
-}
-
-CharacterCamera::CameraType CharacterCamera::get_camera_type() const {
-
- return type;
-
-}
-
-void CharacterCamera::set_orbit(const Vector2& p_orbit) {
-
- orbit=p_orbit;
-
- if(type == CAMERA_FOLLOW && is_inside_scene()) {
-
- Vector3 char_pos = get_global_transform().origin;
- char_pos.y+=height;
- float d = char_pos.distance_to(follow_pos);
-
- Matrix3 m;
- m.rotate(Vector3(0,1,0),-orbit.y);
- m.rotate(Vector3(1,0,0),-orbit.x);
-
- follow_pos=char_pos + m.get_axis(2) * d;
-
- }
-
-}
-void CharacterCamera::set_orbit_x(float p_x) {
-
- orbit.x=p_x;
- if(type == CAMERA_FOLLOW && is_inside_scene())
- set_orbit(Vector2( p_x, get_orbit().y ));
-}
-void CharacterCamera::set_orbit_y(float p_y) {
-
-
- orbit.y=p_y;
- if(type == CAMERA_FOLLOW && is_inside_scene())
- set_orbit(Vector2( get_orbit().x, p_y ));
-
-}
-Vector2 CharacterCamera::get_orbit() const {
-
-
- if (type == CAMERA_FOLLOW && is_inside_scene()) {
-
- Vector3 char_pos = get_global_transform().origin;
- char_pos.y+=height;
- Vector3 rel = (follow_pos - char_pos).normalized();
- Vector2 ret_orbit;
- ret_orbit.x = Math::acos( Vector3(0,1,0).dot( rel ) ) - Math_PI * 0.5;
- ret_orbit.y = Math::atan2(rel.x,rel.z);
- return ret_orbit;
- }
- return orbit;
-}
-
-void CharacterCamera::rotate_orbit(const Vector2& p_relative) {
-
- if (type == CAMERA_FOLLOW && is_inside_scene()) {
-
- Matrix3 m;
- m.rotate(Vector3(0,1,0),-Math::deg2rad(p_relative.y));
- m.rotate(Vector3(1,0,0),-Math::deg2rad(p_relative.x));
-
- Vector3 char_pos = get_global_transform().origin;
- char_pos.y+=height;
- Vector3 rel = (follow_pos - char_pos);
- rel = m.xform(rel);
- follow_pos=char_pos+rel;
-
- }
-
- orbit+=p_relative;
-}
-
-void CharacterCamera::set_height(float p_height) {
-
-
- height=p_height;
-}
-
-float CharacterCamera::get_height() const {
-
- return height;
-
-}
-
-void CharacterCamera::set_max_orbit_x(float p_max) {
-
- max_orbit_x=p_max;
-}
-
-float CharacterCamera::get_max_orbit_x() const {
-
- return max_orbit_x;
-}
-
-void CharacterCamera::set_min_orbit_x(float p_min) {
-
- min_orbit_x=p_min;
-}
-
-float CharacterCamera::get_min_orbit_x() const {
-
- return min_orbit_x;
-}
-
-float CharacterCamera::get_min_distance() const {
-
- return min_distance;
-}
-float CharacterCamera::get_max_distance() const {
-
- return max_distance;
-}
-
-void CharacterCamera::set_min_distance(float p_min) {
-
- min_distance=p_min;
-}
-
-void CharacterCamera::set_max_distance(float p_max) {
-
- max_distance = p_max;
-}
-
-
-void CharacterCamera::set_distance(float p_distance) {
-
- if (type == CAMERA_FOLLOW && is_inside_scene()) {
-
- Vector3 char_pos = get_global_transform().origin;
- char_pos.y+=height;
- Vector3 rel = (follow_pos - char_pos).normalized();
- rel*=p_distance;
- follow_pos=char_pos+rel;
-
- }
-
- distance=p_distance;
-}
-
-float CharacterCamera::get_distance() const {
-
- if (type == CAMERA_FOLLOW && is_inside_scene()) {
-
- Vector3 char_pos = get_global_transform().origin;
- char_pos.y+=height;
- return (follow_pos - char_pos).length();
-
- }
-
- return distance;
-}
-
-void CharacterCamera::set_clip(bool p_enabled) {
-
-
- clip=p_enabled;
-}
-
-bool CharacterCamera::has_clip() const {
-
- return clip;
-
-}
-
-
-void CharacterCamera::set_autoturn(bool p_enabled) {
-
-
- autoturn=p_enabled;
-}
-
-bool CharacterCamera::has_autoturn() const {
-
- return autoturn;
-
-}
-
-void CharacterCamera::set_autoturn_tolerance(float p_degrees) {
-
-
- autoturn_tolerance=p_degrees;
-}
-float CharacterCamera::get_autoturn_tolerance() const {
-
-
- return autoturn_tolerance;
-}
-
-void CharacterCamera::set_inclination(float p_degrees) {
-
-
- inclination=p_degrees;
-}
-float CharacterCamera::get_inclination() const {
-
-
- return inclination;
-}
-
-
-void CharacterCamera::set_autoturn_speed(float p_speed) {
-
-
- autoturn_speed=p_speed;
-}
-float CharacterCamera::get_autoturn_speed() const {
-
- return autoturn_speed;
-
-}
-
-
-
-
-
-void CharacterCamera::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("set_camera_type","type"),&CharacterCamera::set_camera_type);
- ClassDB::bind_method(D_METHOD("get_camera_type"),&CharacterCamera::get_camera_type);
- ClassDB::bind_method(D_METHOD("set_orbit","orbit"),&CharacterCamera::set_orbit);
- ClassDB::bind_method(D_METHOD("get_orbit"),&CharacterCamera::get_orbit);
- ClassDB::bind_method(D_METHOD("set_orbit_x","x"),&CharacterCamera::set_orbit_x);
- ClassDB::bind_method(D_METHOD("set_orbit_y","y"),&CharacterCamera::set_orbit_y);
- ClassDB::bind_method(D_METHOD("set_min_orbit_x","x"),&CharacterCamera::set_min_orbit_x);
- ClassDB::bind_method(D_METHOD("get_min_orbit_x"),&CharacterCamera::get_min_orbit_x);
- ClassDB::bind_method(D_METHOD("set_max_orbit_x","x"),&CharacterCamera::set_max_orbit_x);
- ClassDB::bind_method(D_METHOD("get_max_orbit_x"),&CharacterCamera::get_max_orbit_x);
- ClassDB::bind_method(D_METHOD("rotate_orbit"),&CharacterCamera::rotate_orbit);
- ClassDB::bind_method(D_METHOD("set_distance","distance"),&CharacterCamera::set_distance);
- ClassDB::bind_method(D_METHOD("get_distance"),&CharacterCamera::get_distance);
- ClassDB::bind_method(D_METHOD("set_clip","enable"),&CharacterCamera::set_clip);
- ClassDB::bind_method(D_METHOD("has_clip"),&CharacterCamera::has_clip);
- ClassDB::bind_method(D_METHOD("set_autoturn","enable"),&CharacterCamera::set_autoturn);
- ClassDB::bind_method(D_METHOD("has_autoturn"),&CharacterCamera::has_autoturn);
- ClassDB::bind_method(D_METHOD("set_autoturn_tolerance","degrees"),&CharacterCamera::set_autoturn_tolerance);
- ClassDB::bind_method(D_METHOD("get_autoturn_tolerance"),&CharacterCamera::get_autoturn_tolerance);
- ClassDB::bind_method(D_METHOD("set_autoturn_speed","speed"),&CharacterCamera::set_autoturn_speed);
- ClassDB::bind_method(D_METHOD("get_autoturn_speed"),&CharacterCamera::get_autoturn_speed);
- ClassDB::bind_method(D_METHOD("set_use_lookat_target","use","lookat"),&CharacterCamera::set_use_lookat_target, DEFVAL(Vector3()));
-
- ClassDB::bind_method(D_METHOD("_ray_collision"),&CharacterCamera::_ray_collision);
-
- BIND_CONSTANT( CAMERA_FIXED );
- BIND_CONSTANT( CAMERA_FOLLOW );
-}
-
-void CharacterCamera::_ray_collision(Vector3 p_point, Vector3 p_normal, int p_subindex, ObjectID p_against,int p_idx) {
-
-
- clip_ray[p_idx].clip_pos=p_point;
- clip_ray[p_idx].clipped=true;
-};
-
-Transform CharacterCamera::get_camera_transform() const {
-
- return accepted;
-}
-
-
-CharacterCamera::CharacterCamera() {
-
-
- type=CAMERA_FOLLOW;
- height=1;
-
- orbit=Vector2(0,0);
-
- distance=3;
- min_distance=2;
- max_distance=5;
-
- autoturn=false;
- autoturn_tolerance=15;
- autoturn_speed=20;
-
- min_orbit_x=-50;
- max_orbit_x=70;
- inclination=0;
-
- clip=false;
- use_lookat_target = false;
-
- for(int i=0;i<3;i++) {
- clip_ray[i].query=PhysicsServer::get_singleton()->query_create(this, "_ray_collision", i, true);
- clip_ray[i].clipped=false;
- }
-
-
-}
-
-CharacterCamera::~CharacterCamera() {
-
- for(int i=0;i<3;i++) {
- PhysicsServer::get_singleton()->free(clip_ray[i].query);
- }
-
-
-}
-#endif
diff --git a/scene/3d/character_camera.h b/scene/3d/character_camera.h
deleted file mode 100644
index c3a1c70d5e..0000000000
--- a/scene/3d/character_camera.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*************************************************************************/
-/* character_camera.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#ifndef CHARACTER_CAMERA_H
-#define CHARACTER_CAMERA_H
-
-#include "scene/3d/camera.h"
-#if 0
-class CharacterCamera : public Camera {
-
- GDCLASS( CharacterCamera, Camera );
-public:
-
- enum CameraType {
- CAMERA_FIXED,
- CAMERA_FOLLOW
- };
-
-private:
-
-
- CameraType type;
-
- //used for follow
- Vector3 follow_pos;
- //used for fixed
- Vector2 orbit;
- float distance;
-
- float height;
-
- float min_distance;
- float max_distance;
-
- float max_orbit_x;
- float min_orbit_x;
-
- float inclination;
-
- bool clip;
- bool autoturn;
- float autoturn_tolerance;
- float autoturn_speed;
-
-
-
- struct ClipRay {
- RID query;
- bool clipped;
- Vector3 clip_pos;
- };
-
- ClipRay clip_ray[3];
- Vector3 target_pos;
- float clip_len;
-
-
- Transform accepted;
- Vector3 proposed_pos;
-
- bool use_lookat_target;
- Vector3 lookat_target;
-
- void _compute_camera();
-
- RID ray_query;
- RID left_turn_query;
- RID right_turn_query;
- RID target_body;
-
-protected:
-
- virtual void _request_camera_update() {} //ignore
-
- bool _set(const StringName& p_name, const Variant& p_value);
- bool _get(const StringName& p_name,Variant &r_ret) const;
- void _get_property_list( List<PropertyInfo> *p_list) const;
- void _notification(int p_what);
-
- static void _bind_methods();
-
- void _ray_collision(Vector3 p_point, Vector3 p_normal, int p_subindex, ObjectID p_against,int p_idx);
-
-public:
-
-
- void set_camera_type(CameraType p_camera_type);
- CameraType get_camera_type() const;
-
- void set_orbit(const Vector2& p_orbit);
- void set_orbit_x(float p_x);
- void set_orbit_y(float p_y);
- Vector2 get_orbit() const;
-
- void set_height(float p_height);
- float get_height() const;
-
- void set_inclination(float p_degrees);
- float get_inclination() const;
-
- void set_max_orbit_x(float p_max);
- float get_max_orbit_x() const;
-
- void set_min_orbit_x(float p_min);
- float get_min_orbit_x() const;
-
- void rotate_orbit(const Vector2& p_relative);
-
- void set_distance(float p_distance);
- float get_distance() const;
-
- float get_min_distance() const;
- float get_max_distance() const;
- void set_min_distance(float p_min);
- void set_max_distance(float p_max);
-
-
- void set_clip(bool p_enabled);
- bool has_clip() const;
-
- void set_autoturn(bool p_enabled);
- bool has_autoturn() const;
-
- void set_autoturn_tolerance(float p_degrees);
- float get_autoturn_tolerance() const;
-
- void set_autoturn_speed(float p_speed);
- float get_autoturn_speed() const;
-
- void set_use_lookat_target(bool p_use, const Vector3 &p_lookat = Vector3());
-
- virtual Transform get_camera_transform() const;
-
- CharacterCamera();
- ~CharacterCamera();
-};
-
-VARIANT_ENUM_CAST( CharacterCamera::CameraType );
-
-#endif
-#endif // CHARACTER_CAMERA_H
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index 1aba26673c..c121ef4566 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -28,6 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "collision_object.h"
+
#include "scene/scene_string_names.h"
#include "servers/physics_server.h"
diff --git a/scene/3d/collision_object.h b/scene/3d/collision_object.h
index 6c13e5d505..ac35de697c 100644
--- a/scene/3d/collision_object.h
+++ b/scene/3d/collision_object.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp
index 0c61c96d07..382cbb8f38 100644
--- a/scene/3d/collision_polygon.cpp
+++ b/scene/3d/collision_polygon.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -77,7 +77,7 @@ void CollisionPolygon::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_PARENTED: {
- parent = get_parent()->cast_to<CollisionObject>();
+ parent = Object::cast_to<CollisionObject>(get_parent());
if (parent) {
owner_id = parent->create_shape_owner(this);
_build_polygon();
@@ -147,7 +147,7 @@ bool CollisionPolygon::is_disabled() const {
String CollisionPolygon::get_configuration_warning() const {
- if (!get_parent()->cast_to<CollisionObject>()) {
+ if (!Object::cast_to<CollisionObject>(get_parent())) {
return TTR("CollisionPolygon only serves to provide a collision shape to a CollisionObject derived node. Please only use it as a child of Area, StaticBody, RigidBody, KinematicBody, etc. to give them a shape.");
}
diff --git a/scene/3d/collision_polygon.h b/scene/3d/collision_polygon.h
index beefae182c..dbed1d7154 100644
--- a/scene/3d/collision_polygon.h
+++ b/scene/3d/collision_polygon.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp
index 4fd215bd1a..4d4ed30d03 100644
--- a/scene/3d/collision_shape.cpp
+++ b/scene/3d/collision_shape.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -50,9 +50,8 @@ void CollisionShape::make_convex_from_brothers() {
for (int i = 0; i < p->get_child_count(); i++) {
Node *n = p->get_child(i);
- if (n->cast_to<MeshInstance>()) {
+ if (MeshInstance *mi = Object::cast_to<MeshInstance>(n)) {
- MeshInstance *mi = n->cast_to<MeshInstance>();
Ref<Mesh> m = mi->get_mesh();
if (m.is_valid()) {
@@ -68,7 +67,7 @@ void CollisionShape::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_PARENTED: {
- parent = get_parent()->cast_to<CollisionObject>();
+ parent = Object::cast_to<CollisionObject>(get_parent());
if (parent) {
owner_id = parent->create_shape_owner(this);
if (shape.is_valid()) {
@@ -89,13 +88,6 @@ void CollisionShape::_notification(int p_what) {
parent->shape_owner_set_transform(owner_id, get_transform());
}
} break;
- case NOTIFICATION_EXIT_TREE: {
- if (parent) {
- parent->remove_shape_owner(owner_id);
- }
- owner_id = 0;
- parent = NULL;
- } break;
case NOTIFICATION_UNPARENTED: {
if (parent) {
parent->remove_shape_owner(owner_id);
@@ -113,7 +105,7 @@ void CollisionShape::resource_changed(RES res) {
String CollisionShape::get_configuration_warning() const {
- if (!get_parent()->cast_to<CollisionObject>()) {
+ if (!Object::cast_to<CollisionObject>(get_parent())) {
return TTR("CollisionShape only serves to provide a collision shape to a CollisionObject derived node. Please only use it as a child of Area, StaticBody, RigidBody, KinematicBody, etc. to give them a shape.");
}
diff --git a/scene/3d/collision_shape.h b/scene/3d/collision_shape.h
index 277e0dfa77..6d849f42af 100644
--- a/scene/3d/collision_shape.h
+++ b/scene/3d/collision_shape.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index 2174f924ac..0232ce7653 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -1091,7 +1091,7 @@ void GIProbe::_plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, Baker *p_b
void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
- MeshInstance *mi = p_at_node->cast_to<MeshInstance>();
+ MeshInstance *mi = Object::cast_to<MeshInstance>(p_at_node);
if (mi && mi->get_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT)) {
Ref<Mesh> mesh = mi->get_mesh();
if (mesh.is_valid()) {
@@ -1113,9 +1113,8 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
}
}
- if (p_at_node->cast_to<Spatial>()) {
+ if (Spatial *s = Object::cast_to<Spatial>(p_at_node)) {
- Spatial *s = p_at_node->cast_to<Spatial>();
Array meshes = p_at_node->call("get_meshes");
for (int i = 0; i < meshes.size(); i += 2) {
@@ -1488,10 +1487,10 @@ void GIProbe::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress"), "set_compress", "is_compressed");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "GIProbeData"), "set_probe_data", "get_probe_data");
- BIND_CONSTANT(SUBDIV_64);
- BIND_CONSTANT(SUBDIV_128);
- BIND_CONSTANT(SUBDIV_256);
- BIND_CONSTANT(SUBDIV_MAX);
+ BIND_ENUM_CONSTANT(SUBDIV_64);
+ BIND_ENUM_CONSTANT(SUBDIV_128);
+ BIND_ENUM_CONSTANT(SUBDIV_256);
+ BIND_ENUM_CONSTANT(SUBDIV_MAX);
}
GIProbe::GIProbe() {
diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h
index 8346437ebd..5a06984a47 100644
--- a/scene/3d/gi_probe.h
+++ b/scene/3d/gi_probe.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp
index 060e088750..64d3f4fcab 100644
--- a/scene/3d/immediate_geometry.cpp
+++ b/scene/3d/immediate_geometry.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h
index 2eb4bf1e6b..b2bcb5af1a 100644
--- a/scene/3d/immediate_geometry.h
+++ b/scene/3d/immediate_geometry.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -52,8 +52,8 @@ public:
void set_normal(const Vector3 &p_normal);
void set_tangent(const Plane &p_tangent);
void set_color(const Color &p_color);
- void set_uv(const Vector2 &tex_uv);
- void set_uv2(const Vector2 &tex_uv);
+ void set_uv(const Vector2 &p_uv);
+ void set_uv2(const Vector2 &p_uv2);
void add_vertex(const Vector3 &p_vertex);
diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp
index 36a6660bf9..157ae42571 100644
--- a/scene/3d/interpolated_camera.cpp
+++ b/scene/3d/interpolated_camera.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -29,12 +29,14 @@
/*************************************************************************/
#include "interpolated_camera.h"
+#include "engine.h"
+
void InterpolatedCamera::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
- if (get_tree()->is_editor_hint() && enabled)
+ if (Engine::get_singleton()->is_editor_hint() && enabled)
set_fixed_process(false);
} break;
@@ -44,7 +46,7 @@ void InterpolatedCamera::_notification(int p_what) {
break;
if (has_node(target)) {
- Spatial *node = get_node(target)->cast_to<Spatial>();
+ Spatial *node = Object::cast_to<Spatial>(get_node(target));
if (!node)
break;
@@ -54,8 +56,8 @@ void InterpolatedCamera::_notification(int p_what) {
local_transform = local_transform.interpolate_with(target_xform, delta);
set_global_transform(local_transform);
- if (node->cast_to<Camera>()) {
- Camera *cam = node->cast_to<Camera>();
+ if (Camera *cam = Object::cast_to<Camera>(node)) {
+
if (cam->get_projection() == get_projection()) {
float new_near = Math::lerp(get_znear(), cam->get_znear(), delta);
@@ -81,7 +83,7 @@ void InterpolatedCamera::_notification(int p_what) {
void InterpolatedCamera::_set_target(const Object *p_target) {
ERR_FAIL_NULL(p_target);
- set_target(p_target->cast_to<Spatial>());
+ set_target(Object::cast_to<Spatial>(p_target));
}
void InterpolatedCamera::set_target(const Spatial *p_target) {
@@ -106,7 +108,7 @@ void InterpolatedCamera::set_interpolation_enabled(bool p_enable) {
return;
enabled = p_enable;
if (p_enable) {
- if (is_inside_tree() && get_tree()->is_editor_hint())
+ if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
return;
set_process(true);
} else
diff --git a/scene/3d/interpolated_camera.h b/scene/3d/interpolated_camera.h
index c302c32fc9..26e7278c99 100644
--- a/scene/3d/interpolated_camera.h
+++ b/scene/3d/interpolated_camera.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 977f1f81a7..09b253b309 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "light.h"
+#include "engine.h"
#include "project_settings.h"
#include "scene/resources/surface_tool.h"
@@ -106,6 +107,16 @@ Color Light::get_shadow_color() const {
return shadow_color;
}
+void Light::set_shadow_reverse_cull_face(bool p_enable) {
+ reverse_cull = p_enable;
+ VS::get_singleton()->light_set_reverse_cull_face_mode(light, reverse_cull);
+}
+
+bool Light::get_shadow_reverse_cull_face() const {
+
+ return reverse_cull;
+}
+
Rect3 Light::get_aabb() const {
if (type == VisualServer::LIGHT_DIRECTIONAL) {
@@ -140,7 +151,7 @@ void Light::_update_visibility() {
#ifdef TOOLS_ENABLED
if (editor_only) {
- if (!get_tree()->is_editor_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint()) {
editor_ok = false;
} else {
editor_ok = (get_tree()->get_edited_scene_root() && (this == get_tree()->get_edited_scene_root() || get_owner() == get_tree()->get_edited_scene_root()));
@@ -202,6 +213,9 @@ void Light::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_color", "color"), &Light::set_color);
ClassDB::bind_method(D_METHOD("get_color"), &Light::get_color);
+ ClassDB::bind_method(D_METHOD("set_shadow_reverse_cull_face", "enable"), &Light::set_shadow_reverse_cull_face);
+ ClassDB::bind_method(D_METHOD("get_shadow_reverse_cull_face"), &Light::get_shadow_reverse_cull_face);
+
ClassDB::bind_method(D_METHOD("set_shadow_color", "shadow_color"), &Light::set_shadow_color);
ClassDB::bind_method(D_METHOD("get_shadow_color"), &Light::get_shadow_color);
@@ -217,25 +231,26 @@ void Light::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_bias", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_contact", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_CONTACT_SHADOW_SIZE);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_max_distance", PROPERTY_HINT_RANGE, "0,65536,0.1"), "set_param", "get_param", PARAM_SHADOW_MAX_DISTANCE);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shadow_reverse_cull_face"), "set_shadow_reverse_cull_face", "get_shadow_reverse_cull_face");
ADD_GROUP("Editor", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only");
ADD_GROUP("", "");
- BIND_CONSTANT(PARAM_ENERGY);
- BIND_CONSTANT(PARAM_SPECULAR);
- BIND_CONSTANT(PARAM_RANGE);
- BIND_CONSTANT(PARAM_ATTENUATION);
- BIND_CONSTANT(PARAM_SPOT_ANGLE);
- BIND_CONSTANT(PARAM_SPOT_ATTENUATION);
- BIND_CONSTANT(PARAM_CONTACT_SHADOW_SIZE);
- BIND_CONSTANT(PARAM_SHADOW_MAX_DISTANCE);
- BIND_CONSTANT(PARAM_SHADOW_SPLIT_1_OFFSET);
- BIND_CONSTANT(PARAM_SHADOW_SPLIT_2_OFFSET);
- BIND_CONSTANT(PARAM_SHADOW_SPLIT_3_OFFSET);
- BIND_CONSTANT(PARAM_SHADOW_NORMAL_BIAS);
- BIND_CONSTANT(PARAM_SHADOW_BIAS);
+ BIND_ENUM_CONSTANT(PARAM_ENERGY);
+ BIND_ENUM_CONSTANT(PARAM_SPECULAR);
+ BIND_ENUM_CONSTANT(PARAM_RANGE);
+ BIND_ENUM_CONSTANT(PARAM_ATTENUATION);
+ BIND_ENUM_CONSTANT(PARAM_SPOT_ANGLE);
+ BIND_ENUM_CONSTANT(PARAM_SPOT_ATTENUATION);
+ BIND_ENUM_CONSTANT(PARAM_CONTACT_SHADOW_SIZE);
+ BIND_ENUM_CONSTANT(PARAM_SHADOW_MAX_DISTANCE);
+ BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_1_OFFSET);
+ BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_2_OFFSET);
+ BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_3_OFFSET);
+ BIND_ENUM_CONSTANT(PARAM_SHADOW_NORMAL_BIAS);
+ BIND_ENUM_CONSTANT(PARAM_SHADOW_BIAS);
- BIND_CONSTANT(PARAM_MAX);
+ BIND_ENUM_CONSTANT(PARAM_MAX);
}
Light::Light(VisualServer::LightType p_type) {
@@ -244,6 +259,8 @@ Light::Light(VisualServer::LightType p_type) {
light = VisualServer::get_singleton()->light_create(p_type);
VS::get_singleton()->instance_set_base(get_instance(), light);
+ reverse_cull = false;
+
editor_only = false;
set_color(Color(1, 1, 1, 1));
set_shadow(false);
@@ -317,18 +334,20 @@ void DirectionalLight::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_split_3", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_param", "get_param", PARAM_SHADOW_SPLIT_3_OFFSET);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "directional_shadow_blend_splits"), "set_blend_splits", "is_blend_splits_enabled");
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_normal_bias", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_SHADOW_NORMAL_BIAS);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_bias_split_scale", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS_SPLIT_SCALE);
- BIND_CONSTANT(SHADOW_ORTHOGONAL);
- BIND_CONSTANT(SHADOW_PARALLEL_2_SPLITS);
- BIND_CONSTANT(SHADOW_PARALLEL_4_SPLITS);
+ BIND_ENUM_CONSTANT(SHADOW_ORTHOGONAL);
+ BIND_ENUM_CONSTANT(SHADOW_PARALLEL_2_SPLITS);
+ BIND_ENUM_CONSTANT(SHADOW_PARALLEL_4_SPLITS);
}
DirectionalLight::DirectionalLight()
: Light(VisualServer::LIGHT_DIRECTIONAL) {
- set_param(PARAM_SHADOW_NORMAL_BIAS, 0.2);
- set_param(PARAM_SHADOW_BIAS, 1.0);
+ set_param(PARAM_SHADOW_NORMAL_BIAS, 0.8);
+ set_param(PARAM_SHADOW_BIAS, 0.1);
set_param(PARAM_SHADOW_MAX_DISTANCE, 200);
+ set_param(PARAM_SHADOW_BIAS_SPLIT_SCALE, 0.25);
set_shadow_mode(SHADOW_PARALLEL_4_SPLITS);
blend_splits = false;
diff --git a/scene/3d/light.h b/scene/3d/light.h
index 22ff5c0763..5d589d33e5 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -38,8 +38,6 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-class BakedLight;
-
class Light : public VisualInstance {
GDCLASS(Light, VisualInstance);
@@ -60,6 +58,7 @@ public:
PARAM_SHADOW_SPLIT_3_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET,
PARAM_SHADOW_NORMAL_BIAS = VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS,
PARAM_SHADOW_BIAS = VS::LIGHT_PARAM_SHADOW_BIAS,
+ PARAM_SHADOW_BIAS_SPLIT_SCALE = VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE,
PARAM_MAX = VS::LIGHT_PARAM_MAX
};
@@ -69,6 +68,7 @@ private:
Color shadow_color;
bool shadow;
bool negative;
+ bool reverse_cull;
uint32_t cull_mask;
VS::LightType type;
bool editor_only;
@@ -110,6 +110,9 @@ public:
void set_shadow_color(const Color &p_shadow_color);
Color get_shadow_color() const;
+ void set_shadow_reverse_cull_face(bool p_enable);
+ bool get_shadow_reverse_cull_face() const;
+
virtual Rect3 get_aabb() const;
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
diff --git a/scene/3d/listener.cpp b/scene/3d/listener.cpp
index c7d3bac2f8..51cf9fb89b 100644
--- a/scene/3d/listener.cpp
+++ b/scene/3d/listener.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/listener.h b/scene/3d/listener.h
index b66fc7fc38..2c800443b4 100644
--- a/scene/3d/listener.h
+++ b/scene/3d/listener.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp
index da25afbf57..c8215971c4 100644
--- a/scene/3d/mesh_instance.cpp
+++ b/scene/3d/mesh_instance.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -148,7 +148,7 @@ void MeshInstance::_resolve_skeleton_path() {
if (skeleton_path.is_empty())
return;
- Skeleton *skeleton = get_node(skeleton_path) ? get_node(skeleton_path)->cast_to<Skeleton>() : NULL;
+ Skeleton *skeleton = Object::cast_to<Skeleton>(get_node(skeleton_path));
if (skeleton)
VisualServer::get_singleton()->instance_attach_skeleton(get_instance(), skeleton->get_skeleton());
}
@@ -202,13 +202,13 @@ Node *MeshInstance::create_trimesh_collision_node() {
void MeshInstance::create_trimesh_collision() {
- StaticBody *static_body = create_trimesh_collision_node()->cast_to<StaticBody>();
+ StaticBody *static_body = Object::cast_to<StaticBody>(create_trimesh_collision_node());
ERR_FAIL_COND(!static_body);
static_body->set_name(String(get_name()) + "_col");
add_child(static_body);
if (get_owner()) {
- CollisionShape *cshape = static_body->get_child(0)->cast_to<CollisionShape>();
+ CollisionShape *cshape = Object::cast_to<CollisionShape>(static_body->get_child(0));
static_body->set_owner(get_owner());
cshape->set_owner(get_owner());
}
@@ -232,13 +232,13 @@ Node *MeshInstance::create_convex_collision_node() {
void MeshInstance::create_convex_collision() {
- StaticBody *static_body = create_convex_collision_node()->cast_to<StaticBody>();
+ StaticBody *static_body = Object::cast_to<StaticBody>(create_convex_collision_node());
ERR_FAIL_COND(!static_body);
static_body->set_name(String(get_name()) + "_col");
add_child(static_body);
if (get_owner()) {
- CollisionShape *cshape = static_body->get_child(0)->cast_to<CollisionShape>();
+ CollisionShape *cshape = Object::cast_to<CollisionShape>(static_body->get_child(0));
static_body->set_owner(get_owner());
cshape->set_owner(get_owner());
}
diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h
index 1bb2c97d10..8e8c12a592 100644
--- a/scene/3d/mesh_instance.h
+++ b/scene/3d/mesh_instance.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/multimesh_instance.cpp b/scene/3d/multimesh_instance.cpp
index b51953f27c..f90489f1f0 100644
--- a/scene/3d/multimesh_instance.cpp
+++ b/scene/3d/multimesh_instance.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/multimesh_instance.h b/scene/3d/multimesh_instance.h
index 7e14d567ac..cd0e7b463c 100644
--- a/scene/3d/multimesh_instance.h
+++ b/scene/3d/multimesh_instance.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp
index a1183326d7..d8c7a78648 100644
--- a/scene/3d/navigation.cpp
+++ b/scene/3d/navigation.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -584,7 +584,7 @@ Vector3 Navigation::get_closest_point_to_segment(const Vector3 &p_from, const Ve
}
if (closest_navmesh && closest_navmesh->owner) {
- //print_line("navmesh is: "+closest_navmesh->owner->cast_to<Node>()->get_name());
+ //print_line("navmesh is: "+Object::cast_to<Node>(closest_navmesh->owner)->get_name());
}
return closest_point;
diff --git a/scene/3d/navigation.h b/scene/3d/navigation.h
index 80699fce72..010d16dedd 100644
--- a/scene/3d/navigation.h
+++ b/scene/3d/navigation.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp
index 4c93bcfb5e..7a55f956e0 100644
--- a/scene/3d/navigation_mesh.cpp
+++ b/scene/3d/navigation_mesh.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -208,6 +208,8 @@ void NavigationMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_polygon", "idx"), &NavigationMesh::get_polygon);
ClassDB::bind_method(D_METHOD("clear_polygons"), &NavigationMesh::clear_polygons);
+ ClassDB::bind_method(D_METHOD("create_from_mesh", "mesh"), &NavigationMesh::create_from_mesh);
+
ClassDB::bind_method(D_METHOD("_set_polygons", "polygons"), &NavigationMesh::_set_polygons);
ClassDB::bind_method(D_METHOD("_get_polygons"), &NavigationMesh::_get_polygons);
@@ -245,7 +247,7 @@ void NavigationMeshInstance::set_enabled(bool p_enabled) {
}
if (debug_view) {
- MeshInstance *dm = debug_view->cast_to<MeshInstance>();
+ MeshInstance *dm = Object::cast_to<MeshInstance>(debug_view);
if (is_enabled()) {
dm->set_material_override(get_tree()->get_debug_navigation_material());
} else {
@@ -271,7 +273,7 @@ void NavigationMeshInstance::_notification(int p_what) {
Spatial *c = this;
while (c) {
- navigation = c->cast_to<Navigation>();
+ navigation = Object::cast_to<Navigation>(c);
if (navigation) {
if (enabled && navmesh.is_valid()) {
@@ -340,7 +342,7 @@ void NavigationMeshInstance::set_navigation_mesh(const Ref<NavigationMesh> &p_na
}
if (debug_view && navmesh.is_valid()) {
- debug_view->cast_to<MeshInstance>()->set_mesh(navmesh->get_debug_mesh());
+ Object::cast_to<MeshInstance>(debug_view)->set_mesh(navmesh->get_debug_mesh());
}
update_gizmo();
@@ -363,10 +365,10 @@ String NavigationMeshInstance::get_configuration_warning() const {
const Spatial *c = this;
while (c) {
- if (c->cast_to<Navigation>())
+ if (Object::cast_to<Navigation>(c))
return String();
- c = c->get_parent()->cast_to<Spatial>();
+ c = Object::cast_to<Spatial>(c->get_parent());
}
return TTR("NavigationMeshInstance must be a child or grandchild to a Navigation node. It only provides navigation data.");
diff --git a/scene/3d/navigation_mesh.h b/scene/3d/navigation_mesh.h
index e5a3dc7b43..36fe3ee34b 100644
--- a/scene/3d/navigation_mesh.h
+++ b/scene/3d/navigation_mesh.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 081caf4419..80c706898d 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -63,6 +63,8 @@ void Particles::set_one_shot(bool p_one_shot) {
one_shot = p_one_shot;
VS::get_singleton()->particles_set_one_shot(particles, one_shot);
+ if (!one_shot && emitting)
+ VisualServer::get_singleton()->particles_restart(particles);
}
void Particles::set_pre_process_time(float p_time) {
@@ -345,9 +347,10 @@ void Particles::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "draw_pass_" + itos(i + 1), PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_draw_pass_mesh", "get_draw_pass_mesh", i);
}
- BIND_CONSTANT(DRAW_ORDER_INDEX);
- BIND_CONSTANT(DRAW_ORDER_LIFETIME);
- BIND_CONSTANT(DRAW_ORDER_VIEW_DEPTH);
+ BIND_ENUM_CONSTANT(DRAW_ORDER_INDEX);
+ BIND_ENUM_CONSTANT(DRAW_ORDER_LIFETIME);
+ BIND_ENUM_CONSTANT(DRAW_ORDER_VIEW_DEPTH);
+
BIND_CONSTANT(MAX_DRAW_PASSES);
}
@@ -406,7 +409,7 @@ void ParticlesMaterial::init_shaders() {
shader_names->anim_speed = "anim_speed";
shader_names->anim_offset = "anim_offset";
- shader_names->initial_linear_velocity = "initial_linear_velocity_random";
+ shader_names->initial_linear_velocity_random = "initial_linear_velocity_random";
shader_names->initial_angle_random = "initial_angle_random";
shader_names->angular_velocity_random = "angular_velocity_random";
shader_names->orbit_velocity_random = "orbit_velocity_random";
@@ -753,18 +756,20 @@ void ParticlesMaterial::_update_shader() {
code += " pos.z=0.0; \n";
}
code += " //apply linear acceleration\n";
- code += " force+=normalize(VELOCITY) * (linear_accel+tex_linear_accel)*mix(1.0,rand_from_seed(alt_seed),linear_accel_random);\n";
+ code += " force+= length(VELOCITY) > 0.0 ? normalize(VELOCITY) * (linear_accel+tex_linear_accel)*mix(1.0,rand_from_seed(alt_seed),linear_accel_random) : vec3(0.0);\n";
code += " //apply radial acceleration\n";
code += " vec3 org = vec3(0.0);\n";
- code += " // if (!p_system->local_coordinates)\n";
- code += " //org=p_transform.origin;\n";
- code += " force+=normalize(pos-org) * (radial_accel+tex_radial_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random);\n";
+ code += " // if (!p_system->local_coordinates)\n";
+ code += " //org=p_transform.origin;\n";
+ code += " vec3 diff = pos-org;\n";
+ code += " force+=length(diff) > 0.0 ? normalize(diff) * (radial_accel+tex_radial_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random) : vec3(0.0);\n";
code += " //apply tangential acceleration;\n";
if (flags[FLAG_DISABLE_Z]) {
- code += " force+=vec3(normalize((pos-org).yx * vec2(-1.0,1.0)),0.0) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n";
+ code += " force+=length(diff.yx) > 0.0 ? vec3(normalize(diff.yx * vec2(-1.0,1.0)),0.0) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random)) : vec3(0.0);\n";
} else {
- code += " force+=normalize(cross(normalize(pos-org),normalize(gravity))) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n";
+ code += " vec3 crossDiff = cross(normalize(diff),normalize(gravity));\n";
+ code += " force+=length(crossDiff) > 0.0 ? normalize(crossDiff) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random)) : vec3(0.0);\n";
}
code += " //apply attractor forces\n";
code += " VELOCITY+=force * DELTA;\n";
@@ -1264,9 +1269,8 @@ int ParticlesMaterial::get_emission_point_count() const {
void ParticlesMaterial::set_trail_divisor(int p_divisor) {
- VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor);
trail_divisor = p_divisor;
- _change_notify();
+ VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor);
}
int ParticlesMaterial::get_trail_divisor() const {
@@ -1484,29 +1488,29 @@ void ParticlesMaterial::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "anim_offset_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANIM_OFFSET);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "anim_loop"), "set_flag", "get_flag", FLAG_ANIM_LOOP);
- BIND_CONSTANT(PARAM_INITIAL_LINEAR_VELOCITY);
- BIND_CONSTANT(PARAM_ANGULAR_VELOCITY);
- BIND_CONSTANT(PARAM_ORBIT_VELOCITY);
- BIND_CONSTANT(PARAM_LINEAR_ACCEL);
- BIND_CONSTANT(PARAM_RADIAL_ACCEL);
- BIND_CONSTANT(PARAM_TANGENTIAL_ACCEL);
- BIND_CONSTANT(PARAM_DAMPING);
- BIND_CONSTANT(PARAM_ANGLE);
- BIND_CONSTANT(PARAM_SCALE);
- BIND_CONSTANT(PARAM_HUE_VARIATION);
- BIND_CONSTANT(PARAM_ANIM_SPEED);
- BIND_CONSTANT(PARAM_ANIM_OFFSET);
- BIND_CONSTANT(PARAM_MAX);
-
- BIND_CONSTANT(FLAG_ALIGN_Y_TO_VELOCITY);
- BIND_CONSTANT(FLAG_ROTATE_Y);
- BIND_CONSTANT(FLAG_MAX);
-
- BIND_CONSTANT(EMISSION_SHAPE_POINT);
- BIND_CONSTANT(EMISSION_SHAPE_SPHERE);
- BIND_CONSTANT(EMISSION_SHAPE_BOX);
- BIND_CONSTANT(EMISSION_SHAPE_POINTS);
- BIND_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS);
+ BIND_ENUM_CONSTANT(PARAM_INITIAL_LINEAR_VELOCITY);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_VELOCITY);
+ BIND_ENUM_CONSTANT(PARAM_ORBIT_VELOCITY);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_ACCEL);
+ BIND_ENUM_CONSTANT(PARAM_RADIAL_ACCEL);
+ BIND_ENUM_CONSTANT(PARAM_TANGENTIAL_ACCEL);
+ BIND_ENUM_CONSTANT(PARAM_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_ANGLE);
+ BIND_ENUM_CONSTANT(PARAM_SCALE);
+ BIND_ENUM_CONSTANT(PARAM_HUE_VARIATION);
+ BIND_ENUM_CONSTANT(PARAM_ANIM_SPEED);
+ BIND_ENUM_CONSTANT(PARAM_ANIM_OFFSET);
+ BIND_ENUM_CONSTANT(PARAM_MAX);
+
+ BIND_ENUM_CONSTANT(FLAG_ALIGN_Y_TO_VELOCITY);
+ BIND_ENUM_CONSTANT(FLAG_ROTATE_Y);
+ BIND_ENUM_CONSTANT(FLAG_MAX);
+
+ BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINT);
+ BIND_ENUM_CONSTANT(EMISSION_SHAPE_SPHERE);
+ BIND_ENUM_CONSTANT(EMISSION_SHAPE_BOX);
+ BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINTS);
+ BIND_ENUM_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS);
}
ParticlesMaterial::ParticlesMaterial()
diff --git a/scene/3d/particles.h b/scene/3d/particles.h
index 31ca85a59a..2c109d6ec8 100644
--- a/scene/3d/particles.h
+++ b/scene/3d/particles.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -88,7 +88,7 @@ public:
void set_emitting(bool p_emitting);
void set_amount(int p_amount);
void set_lifetime(float p_lifetime);
- void set_one_shot(bool p_enabled);
+ void set_one_shot(bool p_one_shot);
void set_pre_process_time(float p_time);
void set_explosiveness_ratio(float p_ratio);
void set_randomness_ratio(float p_ratio);
diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp
index f8df21004e..ed4d88417c 100644
--- a/scene/3d/path.cpp
+++ b/scene/3d/path.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -28,32 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "path.h"
+
+#include "engine.h"
#include "scene/scene_string_names.h"
void Path::_notification(int p_what) {
-#if 0
- if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && get_scene()->is_editor_hint()) {
- //draw the curve!!
-
- for(int i=0;i<curve->get_point_count();i++) {
-
- Vector2 prev_p=curve->get_point_pos(i);
-
- for(int j=1;j<=8;j++) {
-
- real_t frac = j/8.0;
- Vector2 p = curve->interpolate(i,frac);
- draw_line(prev_p,p,Color(0.5,0.6,1.0,0.7),2);
- prev_p=p;
- }
- }
- }
-#endif
}
void Path::_curve_changed() {
- if (is_inside_tree() && get_tree()->is_editor_hint())
+ if (is_inside_tree() && Engine::get_singleton()->is_editor_hint())
update_gizmo();
}
@@ -172,8 +156,7 @@ void PathFollow::_notification(int p_what) {
Node *parent = get_parent();
if (parent) {
- path = parent->cast_to<Path>();
- if (path) {
+ if ((path = Object::cast_to<Path>(parent))) {
_update_transform();
}
}
@@ -281,10 +264,10 @@ void PathFollow::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_loop", "loop"), &PathFollow::set_loop);
ClassDB::bind_method(D_METHOD("has_loop"), &PathFollow::has_loop);
- BIND_CONSTANT(ROTATION_NONE);
- BIND_CONSTANT(ROTATION_Y);
- BIND_CONSTANT(ROTATION_XY);
- BIND_CONSTANT(ROTATION_XYZ);
+ BIND_ENUM_CONSTANT(ROTATION_NONE);
+ BIND_ENUM_CONSTANT(ROTATION_Y);
+ BIND_ENUM_CONSTANT(ROTATION_XY);
+ BIND_ENUM_CONSTANT(ROTATION_XYZ);
}
void PathFollow::set_offset(float p_offset) {
diff --git a/scene/3d/path.h b/scene/3d/path.h
index eeae0668a7..0f9a169f72 100644
--- a/scene/3d/path.h
+++ b/scene/3d/path.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index dc8f72d77e..9590394211 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "physics_body.h"
+
+#include "engine.h"
#include "method_bind_ext.gen.inc"
#include "scene/scene_string_names.h"
@@ -114,7 +116,7 @@ bool PhysicsBody::get_collision_layer_bit(int p_bit) const {
void PhysicsBody::add_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
- PhysicsBody *physics_body = p_node->cast_to<PhysicsBody>();
+ PhysicsBody *physics_body = Object::cast_to<PhysicsBody>(p_node);
if (!physics_body) {
ERR_EXPLAIN("Collision exception only works between two objects of PhysicsBody type");
}
@@ -125,7 +127,7 @@ void PhysicsBody::add_collision_exception_with(Node *p_node) {
void PhysicsBody::remove_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
- PhysicsBody *physics_body = p_node->cast_to<PhysicsBody>();
+ PhysicsBody *physics_body = Object::cast_to<PhysicsBody>(p_node);
if (!physics_body) {
ERR_EXPLAIN("Collision exception only works between two objects of PhysicsBody type");
}
@@ -252,7 +254,7 @@ StaticBody::~StaticBody() {
void RigidBody::_body_enter_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
Map<ObjectID, BodyState>::Element *E = contact_monitor->body_map.find(p_id);
@@ -276,7 +278,7 @@ void RigidBody::_body_enter_tree(ObjectID p_id) {
void RigidBody::_body_exit_tree(ObjectID p_id) {
Object *obj = ObjectDB::get_instance(p_id);
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
ERR_FAIL_COND(!node);
Map<ObjectID, BodyState>::Element *E = contact_monitor->body_map.find(p_id);
ERR_FAIL_COND(!E);
@@ -301,7 +303,7 @@ void RigidBody::_body_inout(int p_status, ObjectID p_instance, int p_body_shape,
ObjectID objid = p_instance;
Object *obj = ObjectDB::get_instance(objid);
- Node *node = obj ? obj->cast_to<Node>() : NULL;
+ Node *node = Object::cast_to<Node>(obj);
Map<ObjectID, BodyState>::Element *E = contact_monitor->body_map.find(objid);
@@ -367,7 +369,7 @@ void RigidBody::_direct_state_changed(Object *p_state) {
//eh.. fuck
#ifdef DEBUG_ENABLED
- state = p_state->cast_to<PhysicsDirectBodyState>();
+ state = Object::cast_to<PhysicsDirectBodyState>(p_state);
#else
state = (PhysicsDirectBodyState *)p_state; //trust it
#endif
@@ -476,13 +478,13 @@ void RigidBody::_notification(int p_what) {
#ifdef TOOLS_ENABLED
if (p_what == NOTIFICATION_ENTER_TREE) {
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
set_notify_local_transform(true); //used for warnings and only in editor
}
}
if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) {
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
update_configuration_warning();
}
}
@@ -840,7 +842,7 @@ void RigidBody::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_colliding_bodies"), &RigidBody::get_colliding_bodies);
- BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state:PhysicsDirectBodyState")));
+ BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectBodyState")));
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Rigid,Static,Character,Kinematic"), "set_mode", "get_mode");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass");
@@ -868,10 +870,10 @@ void RigidBody::_bind_methods() {
ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body")));
ADD_SIGNAL(MethodInfo("sleeping_state_changed"));
- BIND_CONSTANT(MODE_STATIC);
- BIND_CONSTANT(MODE_KINEMATIC);
- BIND_CONSTANT(MODE_RIGID);
- BIND_CONSTANT(MODE_CHARACTER);
+ BIND_ENUM_CONSTANT(MODE_STATIC);
+ BIND_ENUM_CONSTANT(MODE_KINEMATIC);
+ BIND_ENUM_CONSTANT(MODE_RIGID);
+ BIND_ENUM_CONSTANT(MODE_CHARACTER);
}
RigidBody::RigidBody()
@@ -916,7 +918,7 @@ Dictionary KinematicBody::_move(const Vector3 &p_motion) {
if (move(p_motion, col)) {
Dictionary d;
d["position"] = col.collision;
- d["normal"] = col.collision;
+ d["normal"] = col.normal;
d["local_shape"] = col.local_shape;
d["travel"] = col.travel;
d["remainder"] = col.remainder;
@@ -927,6 +929,7 @@ Dictionary KinematicBody::_move(const Vector3 &p_motion) {
d["collider"] = Variant();
}
+ d["collider_velocity"] = col.collider_vel;
d["collider_shape_index"] = col.collider_shape;
d["collider_metadata"] = col.collider_metadata;
@@ -1103,7 +1106,7 @@ Object *KinematicBody::get_collision_collider_shape(int p_collision) const {
ERR_FAIL_INDEX_V(p_collision, colliders.size(), NULL);
Object *collider = get_collision_collider(p_collision);
if (collider) {
- CollisionObject *obj2d = collider->cast_to<CollisionObject>();
+ CollisionObject *obj2d = Object::cast_to<CollisionObject>(collider);
if (obj2d) {
uint32_t owner = shape_find_owner(colliders[p_collision].collider_shape);
return obj2d->shape_owner_get_owner(owner);
diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h
index 83811a1d93..23d752ad76 100644
--- a/scene/3d/physics_body.h
+++ b/scene/3d/physics_body.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp
index 61d496935b..aa127ab79f 100644
--- a/scene/3d/physics_joint.cpp
+++ b/scene/3d/physics_joint.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -55,8 +55,8 @@ void Joint::_update_joint(bool p_only_free) {
if (!node_a && !node_b)
return;
- PhysicsBody *body_a = node_a ? node_a->cast_to<PhysicsBody>() : (PhysicsBody *)NULL;
- PhysicsBody *body_b = node_b ? node_b->cast_to<PhysicsBody>() : (PhysicsBody *)NULL;
+ PhysicsBody *body_a = Object::cast_to<PhysicsBody>(node_a);
+ PhysicsBody *body_b = Object::cast_to<PhysicsBody>(node_b);
if (!body_a && !body_b)
return;
@@ -188,9 +188,9 @@ void PinJoint::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "params/damping", PROPERTY_HINT_RANGE, "0.01,8.0,0.01"), "set_param", "get_param", PARAM_DAMPING);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "params/impulse_clamp", PROPERTY_HINT_RANGE, "0.0,64.0,0.01"), "set_param", "get_param", PARAM_IMPULSE_CLAMP);
- BIND_CONSTANT(PARAM_BIAS);
- BIND_CONSTANT(PARAM_DAMPING);
- BIND_CONSTANT(PARAM_IMPULSE_CLAMP);
+ BIND_ENUM_CONSTANT(PARAM_BIAS);
+ BIND_ENUM_CONSTANT(PARAM_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_IMPULSE_CLAMP);
}
void PinJoint::set_param(Param p_param, float p_value) {
@@ -282,19 +282,19 @@ void HingeJoint::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "motor/target_velocity", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_param", "get_param", PARAM_MOTOR_TARGET_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "motor/max_impulse", PROPERTY_HINT_RANGE, "0.01,1024,0.01"), "set_param", "get_param", PARAM_MOTOR_MAX_IMPULSE);
- BIND_CONSTANT(PARAM_BIAS);
- BIND_CONSTANT(PARAM_LIMIT_UPPER);
- BIND_CONSTANT(PARAM_LIMIT_LOWER);
- BIND_CONSTANT(PARAM_LIMIT_BIAS);
- BIND_CONSTANT(PARAM_LIMIT_SOFTNESS);
- BIND_CONSTANT(PARAM_LIMIT_RELAXATION);
- BIND_CONSTANT(PARAM_MOTOR_TARGET_VELOCITY);
- BIND_CONSTANT(PARAM_MOTOR_MAX_IMPULSE);
- BIND_CONSTANT(PARAM_MAX);
+ BIND_ENUM_CONSTANT(PARAM_BIAS);
+ BIND_ENUM_CONSTANT(PARAM_LIMIT_UPPER);
+ BIND_ENUM_CONSTANT(PARAM_LIMIT_LOWER);
+ BIND_ENUM_CONSTANT(PARAM_LIMIT_BIAS);
+ BIND_ENUM_CONSTANT(PARAM_LIMIT_SOFTNESS);
+ BIND_ENUM_CONSTANT(PARAM_LIMIT_RELAXATION);
+ BIND_ENUM_CONSTANT(PARAM_MOTOR_TARGET_VELOCITY);
+ BIND_ENUM_CONSTANT(PARAM_MOTOR_MAX_IMPULSE);
+ BIND_ENUM_CONSTANT(PARAM_MAX);
- BIND_CONSTANT(FLAG_USE_LIMIT);
- BIND_CONSTANT(FLAG_ENABLE_MOTOR);
- BIND_CONSTANT(FLAG_MAX);
+ BIND_ENUM_CONSTANT(FLAG_USE_LIMIT);
+ BIND_ENUM_CONSTANT(FLAG_ENABLE_MOTOR);
+ BIND_ENUM_CONSTANT(FLAG_MAX);
}
void HingeJoint::set_param(Param p_param, float p_value) {
@@ -428,31 +428,31 @@ void SliderJoint::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_ortho/restitution", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_ANGULAR_ORTHOGONAL_RESTITUTION);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_ortho/damping", PROPERTY_HINT_RANGE, "0,16.0,0.01"), "set_param", "get_param", PARAM_ANGULAR_ORTHOGONAL_DAMPING);
- BIND_CONSTANT(PARAM_LINEAR_LIMIT_UPPER);
- BIND_CONSTANT(PARAM_LINEAR_LIMIT_LOWER);
- BIND_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS);
- BIND_CONSTANT(PARAM_LINEAR_LIMIT_RESTITUTION);
- BIND_CONSTANT(PARAM_LINEAR_LIMIT_DAMPING);
- BIND_CONSTANT(PARAM_LINEAR_MOTION_SOFTNESS);
- BIND_CONSTANT(PARAM_LINEAR_MOTION_RESTITUTION);
- BIND_CONSTANT(PARAM_LINEAR_MOTION_DAMPING);
- BIND_CONSTANT(PARAM_LINEAR_ORTHOGONAL_SOFTNESS);
- BIND_CONSTANT(PARAM_LINEAR_ORTHOGONAL_RESTITUTION);
- BIND_CONSTANT(PARAM_LINEAR_ORTHOGONAL_DAMPING);
-
- BIND_CONSTANT(PARAM_ANGULAR_LIMIT_UPPER);
- BIND_CONSTANT(PARAM_ANGULAR_LIMIT_LOWER);
- BIND_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS);
- BIND_CONSTANT(PARAM_ANGULAR_LIMIT_RESTITUTION);
- BIND_CONSTANT(PARAM_ANGULAR_LIMIT_DAMPING);
- BIND_CONSTANT(PARAM_ANGULAR_MOTION_SOFTNESS);
- BIND_CONSTANT(PARAM_ANGULAR_MOTION_RESTITUTION);
- BIND_CONSTANT(PARAM_ANGULAR_MOTION_DAMPING);
- BIND_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_SOFTNESS);
- BIND_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_RESTITUTION);
- BIND_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_DAMPING);
-
- BIND_CONSTANT(PARAM_MAX);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_UPPER);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_LOWER);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_RESTITUTION);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTION_SOFTNESS);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTION_RESTITUTION);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTION_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_ORTHOGONAL_SOFTNESS);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_ORTHOGONAL_RESTITUTION);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_ORTHOGONAL_DAMPING);
+
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_UPPER);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_LOWER);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_RESTITUTION);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTION_SOFTNESS);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTION_RESTITUTION);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTION_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_SOFTNESS);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_RESTITUTION);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_DAMPING);
+
+ BIND_ENUM_CONSTANT(PARAM_MAX);
}
void SliderJoint::set_param(Param p_param, float p_value) {
@@ -560,12 +560,12 @@ void ConeTwistJoint::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "softness", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_SOFTNESS);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "relaxation", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_RELAXATION);
- BIND_CONSTANT(PARAM_SWING_SPAN);
- BIND_CONSTANT(PARAM_TWIST_SPAN);
- BIND_CONSTANT(PARAM_BIAS);
- BIND_CONSTANT(PARAM_SOFTNESS);
- BIND_CONSTANT(PARAM_RELAXATION);
- BIND_CONSTANT(PARAM_MAX);
+ BIND_ENUM_CONSTANT(PARAM_SWING_SPAN);
+ BIND_ENUM_CONSTANT(PARAM_TWIST_SPAN);
+ BIND_ENUM_CONSTANT(PARAM_BIAS);
+ BIND_ENUM_CONSTANT(PARAM_SOFTNESS);
+ BIND_ENUM_CONSTANT(PARAM_RELAXATION);
+ BIND_ENUM_CONSTANT(PARAM_MAX);
}
void ConeTwistJoint::set_param(Param p_param, float p_value) {
@@ -773,26 +773,26 @@ void Generic6DOFJoint::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_motor_z/target_velocity"), "set_param_z", "get_param_z", PARAM_ANGULAR_MOTOR_TARGET_VELOCITY);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_motor_z/force_limit"), "set_param_z", "get_param_z", PARAM_ANGULAR_MOTOR_FORCE_LIMIT);
- BIND_CONSTANT(PARAM_LINEAR_LOWER_LIMIT);
- BIND_CONSTANT(PARAM_LINEAR_UPPER_LIMIT);
- BIND_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS);
- BIND_CONSTANT(PARAM_LINEAR_RESTITUTION);
- BIND_CONSTANT(PARAM_LINEAR_DAMPING);
- BIND_CONSTANT(PARAM_ANGULAR_LOWER_LIMIT);
- BIND_CONSTANT(PARAM_ANGULAR_UPPER_LIMIT);
- BIND_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS);
- BIND_CONSTANT(PARAM_ANGULAR_DAMPING);
- BIND_CONSTANT(PARAM_ANGULAR_RESTITUTION);
- BIND_CONSTANT(PARAM_ANGULAR_FORCE_LIMIT);
- BIND_CONSTANT(PARAM_ANGULAR_ERP);
- BIND_CONSTANT(PARAM_ANGULAR_MOTOR_TARGET_VELOCITY);
- BIND_CONSTANT(PARAM_ANGULAR_MOTOR_FORCE_LIMIT);
- BIND_CONSTANT(PARAM_MAX);
-
- BIND_CONSTANT(FLAG_ENABLE_LINEAR_LIMIT);
- BIND_CONSTANT(FLAG_ENABLE_ANGULAR_LIMIT);
- BIND_CONSTANT(FLAG_ENABLE_MOTOR);
- BIND_CONSTANT(FLAG_MAX);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_LOWER_LIMIT);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_UPPER_LIMIT);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_RESTITUTION);
+ BIND_ENUM_CONSTANT(PARAM_LINEAR_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_LOWER_LIMIT);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_UPPER_LIMIT);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_DAMPING);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_RESTITUTION);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_FORCE_LIMIT);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_ERP);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTOR_TARGET_VELOCITY);
+ BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTOR_FORCE_LIMIT);
+ BIND_ENUM_CONSTANT(PARAM_MAX);
+
+ BIND_ENUM_CONSTANT(FLAG_ENABLE_LINEAR_LIMIT);
+ BIND_ENUM_CONSTANT(FLAG_ENABLE_ANGULAR_LIMIT);
+ BIND_ENUM_CONSTANT(FLAG_ENABLE_MOTOR);
+ BIND_ENUM_CONSTANT(FLAG_MAX);
}
void Generic6DOFJoint::set_param_x(Param p_param, float p_value) {
@@ -973,301 +973,3 @@ Generic6DOFJoint::Generic6DOFJoint() {
set_flag_z(FLAG_ENABLE_LINEAR_LIMIT, true);
set_flag_z(FLAG_ENABLE_MOTOR, false);
}
-
-#if 0
-
-void PhysicsJoint::_set(const String& p_name, const Variant& p_value) {
-
- if (p_name=="body_A")
- set_body_a(p_value);
- else if (p_name=="body_B")
- set_body_b(p_value);
- else if (p_name=="active")
- set_active(p_value);
- else if (p_name=="no_collision")
- set_disable_collision(p_value);
-}
-Variant PhysicsJoint::_get(const String& p_name) const {
-
- if (p_name=="body_A")
- return get_body_a();
- else if (p_name=="body_B")
- return get_body_b();
- else if (p_name=="active")
- return is_active();
- else if (p_name=="no_collision")
- return has_disable_collision();
-
- return Variant();
-}
-void PhysicsJoint::_get_property_list( List<PropertyInfo> *p_list) const {
-
-
- p_list->push_back( PropertyInfo( Variant::NODE_PATH, "body_A" ) );
- p_list->push_back( PropertyInfo( Variant::NODE_PATH, "body_B" ) );
- p_list->push_back( PropertyInfo( Variant::BOOL, "active" ) );
- p_list->push_back( PropertyInfo( Variant::BOOL, "no_collision" ) );
-}
-void PhysicsJoint::_notification(int p_what) {
-
-
- switch(p_what) {
-
- case NOTIFICATION_PARENT_CONFIGURED: {
-
- _connect();
- if (get_root_node()->get_editor() && !indicator.is_valid()) {
-
- indicator=VisualServer::get_singleton()->poly_create();
- RID mat=VisualServer::get_singleton()->fixed_material_create();
- VisualServer::get_singleton()->material_set_flag( mat, VisualServer::MATERIAL_FLAG_UNSHADED, true );
- VisualServer::get_singleton()->material_set_flag( mat, VisualServer::MATERIAL_FLAG_ONTOP, true );
- VisualServer::get_singleton()->material_set_flag( mat, VisualServer::MATERIAL_FLAG_WIREFRAME, true );
- VisualServer::get_singleton()->material_set_flag( mat, VisualServer::MATERIAL_FLAG_DOUBLE_SIDED, true );
- VisualServer::get_singleton()->material_set_line_width( mat, 3 );
-
- VisualServer::get_singleton()->poly_set_material(indicator,mat,true);
- _update_indicator();
-
- }
-
- if (indicator.is_valid()) {
-
- indicator_instance=VisualServer::get_singleton()->instance_create(indicator,get_world()->get_scenario());
- VisualServer::get_singleton()->instance_attach_object_instance_id( indicator_instance,get_instance_id() );
- }
- } break;
- case NOTIFICATION_TRANSFORM_CHANGED: {
-
- if (indicator_instance.is_valid()) {
-
- VisualServer::get_singleton()->instance_set_transform(indicator_instance,get_global_transform());
- }
- } break;
- case NOTIFICATION_EXIT_SCENE: {
-
- if (indicator_instance.is_valid()) {
-
- VisualServer::get_singleton()->free(indicator_instance);
- }
- _disconnect();
-
- } break;
-
- }
-}
-
-
-RID PhysicsJoint::_get_visual_instance_rid() const {
-
- return indicator_instance;
-
-}
-
-void PhysicsJoint::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("_get_visual_instance_rid"),&PhysicsJoint::_get_visual_instance_rid);
- ClassDB::bind_method(D_METHOD("set_body_a","path"),&PhysicsJoint::set_body_a);
- ClassDB::bind_method(D_METHOD("set_body_b"),&PhysicsJoint::set_body_b);
- ClassDB::bind_method(D_METHOD("get_body_a","path"),&PhysicsJoint::get_body_a);
- ClassDB::bind_method(D_METHOD("get_body_b"),&PhysicsJoint::get_body_b);
-
- ClassDB::bind_method(D_METHOD("set_active","active"),&PhysicsJoint::set_active);
- ClassDB::bind_method(D_METHOD("is_active"),&PhysicsJoint::is_active);
-
- ClassDB::bind_method(D_METHOD("set_disable_collision","disable"),&PhysicsJoint::set_disable_collision);
- ClassDB::bind_method(D_METHOD("has_disable_collision"),&PhysicsJoint::has_disable_collision);
-
-
- ClassDB::bind_method("reconnect",&PhysicsJoint::reconnect);
-
- ClassDB::bind_method(D_METHOD("get_rid"),&PhysicsJoint::get_rid);
-
-}
-
-void PhysicsJoint::set_body_a(const NodePath& p_path) {
-
- _disconnect();
- body_A=p_path;
- _connect();
- _change_notify("body_A");
-}
-void PhysicsJoint::set_body_b(const NodePath& p_path) {
-
- _disconnect();
- body_B=p_path;
- _connect();
- _change_notify("body_B");
-
-}
-NodePath PhysicsJoint::get_body_a() const {
-
- return body_A;
-}
-NodePath PhysicsJoint::get_body_b() const {
-
- return body_B;
-}
-
-void PhysicsJoint::set_active(bool p_active) {
-
- active=p_active;
- if (is_inside_scene()) {
- PhysicsServer::get_singleton()->joint_set_active(joint,active);
- }
- _change_notify("active");
-}
-
-void PhysicsJoint::set_disable_collision(bool p_active) {
-
- if (no_collision==p_active)
- return;
- _disconnect();
- no_collision=p_active;
- _connect();
-
- _change_notify("no_collision");
-}
-bool PhysicsJoint::has_disable_collision() const {
-
- return no_collision;
-}
-
-
-
-bool PhysicsJoint::is_active() const {
-
- return active;
-}
-
-void PhysicsJoint::_disconnect() {
-
- if (!is_inside_scene())
- return;
-
- if (joint.is_valid())
- PhysicsServer::get_singleton()->free(joint);
-
- joint=RID();
-
- Node *nA = get_node(body_A);
- Node *nB = get_node(body_B);
-
- PhysicsBody *A = nA?nA->cast_to<PhysicsBody>():NULL;
- PhysicsBody *B = nA?nB->cast_to<PhysicsBody>():NULL;
-
- if (!A ||!B)
- return;
-
- if (no_collision)
- PhysicsServer::get_singleton()->body_remove_collision_exception(A->get_body(),B->get_body());
-
-}
-void PhysicsJoint::_connect() {
-
- if (!is_inside_scene())
- return;
-
- ERR_FAIL_COND(joint.is_valid());
-
- Node *nA = get_node(body_A);
- Node *nB = get_node(body_B);
-
- PhysicsBody *A = nA?nA->cast_to<PhysicsBody>():NULL;
- PhysicsBody *B = nA?nB->cast_to<PhysicsBody>():NULL;
-
- if (!A && !B)
- return;
-
- if (B && !A)
- SWAP(B,A);
-
- joint = create(A,B);
-
- if (A<B)
- SWAP(A,B);
-
- if (no_collision)
- PhysicsServer::get_singleton()->body_add_collision_exception(A->get_body(),B->get_body());
-
-
-
-}
-
-void PhysicsJoint::reconnect() {
-
- _disconnect();
- _connect();
-
-}
-
-
-RID PhysicsJoint::get_rid() {
-
- return joint;
-}
-
-
-PhysicsJoint::PhysicsJoint() {
-
- active=true;
- no_collision=true;
-}
-
-
-PhysicsJoint::~PhysicsJoint() {
-
- if (indicator.is_valid()) {
-
- VisualServer::get_singleton()->free(indicator);
- }
-
-}
-
-/* PIN */
-
-void PhysicsJointPin::_update_indicator() {
-
-
- VisualServer::get_singleton()->poly_clear(indicator);
-
- Vector<Color> colors;
- colors.push_back( Color(0.3,0.9,0.2,0.7) );
- colors.push_back( Color(0.3,0.9,0.2,0.7) );
-
- Vector<Vector3> points;
- points.resize(2);
- points[0]=Vector3(Vector3(-0.2,0,0));
- points[1]=Vector3(Vector3(0.2,0,0));
- VisualServer::get_singleton()->poly_add_primitive(indicator,points,Vector<Vector3>(),colors,Vector<Vector3>());
-
- points[0]=Vector3(Vector3(0,-0.2,0));
- points[1]=Vector3(Vector3(0,0.2,0));
- VisualServer::get_singleton()->poly_add_primitive(indicator,points,Vector<Vector3>(),colors,Vector<Vector3>());
-
- points[0]=Vector3(Vector3(0,0,-0.2));
- points[1]=Vector3(Vector3(0,0,0.2));
- VisualServer::get_singleton()->poly_add_primitive(indicator,points,Vector<Vector3>(),colors,Vector<Vector3>());
-
-}
-
-RID PhysicsJointPin::create(PhysicsBody*A,PhysicsBody*B) {
-
- RID body_A = A->get_body();
- RID body_B = B?B->get_body():RID();
-
- ERR_FAIL_COND_V( !body_A.is_valid(), RID() );
-
- Vector3 pin_pos = get_global_transform().origin;
-
- if (body_B.is_valid())
- return PhysicsServer::get_singleton()->joint_create_double_pin_global(body_A,pin_pos,body_B,pin_pos);
- else
- return PhysicsServer::get_singleton()->joint_create_pin(body_A,A->get_global_transform().xform_inv(pin_pos),pin_pos);
-}
-
-PhysicsJointPin::PhysicsJointPin() {
-
-
-}
-#endif
diff --git a/scene/3d/physics_joint.h b/scene/3d/physics_joint.h
index b834aaf6d2..b94297da30 100644
--- a/scene/3d/physics_joint.h
+++ b/scene/3d/physics_joint.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -321,73 +321,4 @@ public:
VARIANT_ENUM_CAST(Generic6DOFJoint::Param);
VARIANT_ENUM_CAST(Generic6DOFJoint::Flag);
-#if 0
-class PhysicsJoint : public Spatial {
-
- GDCLASS(PhysicsJoint,Spatial);
- OBJ_CATEGORY("3D Physics Nodes");
-
- NodePath body_A;
- NodePath body_B;
- bool active;
- bool no_collision;
-
-
- RID indicator_instance;
-
- RID _get_visual_instance_rid() const;
-protected:
-
- RID joint;
- RID indicator;
-
- bool _set(const StringName& p_name, const Variant& p_value);
- bool _get(const StringName& p_name,Variant &r_ret) const;
- void _get_property_list( List<PropertyInfo> *p_list) const;
- void _notification(int p_what);
- static void _bind_methods();
-
- virtual RID create(PhysicsBody*A,PhysicsBody*B)=0;
- virtual void _update_indicator()=0;
-
- void _disconnect();
- void _connect();
-public:
-
- void set_body_a(const NodePath& p_path);
- void set_body_b(const NodePath& p_path);
- NodePath get_body_a() const;
- NodePath get_body_b() const;
-
- void set_active(bool p_active);
- bool is_active() const;
-
- void set_disable_collision(bool p_active);
- bool has_disable_collision() const;
-
- void reconnect();
-
- RID get_rid();
-
- PhysicsJoint();
- ~PhysicsJoint();
-};
-
-
-
-class PhysicsJointPin : public PhysicsJoint {
-
- GDCLASS( PhysicsJointPin, PhysicsJoint );
-
-protected:
-
- virtual void _update_indicator();
- virtual RID create(PhysicsBody*A,PhysicsBody*B);
-public:
-
-
- PhysicsJointPin();
-};
-
#endif // PHYSICS_JOINT_H
-#endif
diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp
index d77dde1dd8..6c14f7dbc9 100644
--- a/scene/3d/portal.cpp
+++ b/scene/3d/portal.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -32,6 +32,8 @@
#include "scene/resources/surface_tool.h"
#include "servers/visual_server.h"
+// FIXME: This will be removed, kept as reference for new implementation
+#if 0
bool Portal::_set(const StringName &p_name, const Variant &p_value) {
if (p_name == "shape") {
@@ -226,3 +228,4 @@ Portal::~Portal() {
VisualServer::get_singleton()->free(portal);
}
+#endif
diff --git a/scene/3d/portal.h b/scene/3d/portal.h
index 7c25e4904b..6de3df8553 100644
--- a/scene/3d/portal.h
+++ b/scene/3d/portal.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -39,7 +39,8 @@
If a portal is placed next (very close to) a similar, opposing portal, they automatically connect,
otherwise, a portal connects to the parent room
*/
-
+//this will be redone and replaced by area portals, left for reference since a new class with this name will have to exist and want to reuse the gizmos
+#if 0
class Portal : public VisualInstance {
GDCLASS(Portal, VisualInstance);
@@ -85,3 +86,4 @@ public:
};
#endif
+#endif
diff --git a/scene/3d/position_3d.cpp b/scene/3d/position_3d.cpp
index 4e66ef13c0..d0df985ac4 100644
--- a/scene/3d/position_3d.cpp
+++ b/scene/3d/position_3d.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/position_3d.h b/scene/3d/position_3d.h
index 0adde19342..8083c33196 100644
--- a/scene/3d/position_3d.h
+++ b/scene/3d/position_3d.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp
index 5441904d81..2288d8b08b 100644
--- a/scene/3d/proximity_group.cpp
+++ b/scene/3d/proximity_group.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -116,9 +116,9 @@ void ProximityGroup::set_group_name(String p_group_name) {
group_name = p_group_name;
};
-void ProximityGroup::_notification(int what) {
+void ProximityGroup::_notification(int p_what) {
- switch (what) {
+ switch (p_what) {
case NOTIFICATION_EXIT_TREE:
++group_version;
diff --git a/scene/3d/proximity_group.h b/scene/3d/proximity_group.h
index fec3add41f..d003d2f525 100644
--- a/scene/3d/proximity_group.h
+++ b/scene/3d/proximity_group.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp
index 67e7fb0e12..72b7706b77 100644
--- a/scene/3d/ray_cast.cpp
+++ b/scene/3d/ray_cast.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -30,12 +30,14 @@
#include "ray_cast.h"
#include "collision_object.h"
+#include "engine.h"
#include "mesh_instance.h"
#include "servers/physics_server.h"
+
void RayCast::set_cast_to(const Vector3 &p_point) {
cast_to = p_point;
- if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_collisions_hint()))
+ if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_collisions_hint()))
update_gizmo();
if (is_inside_tree() && get_tree()->is_debugging_collisions_hint())
_update_debug_shape();
@@ -94,7 +96,7 @@ Vector3 RayCast::get_collision_normal() const {
void RayCast::set_enabled(bool p_enabled) {
enabled = p_enabled;
- if (is_inside_tree() && !get_tree()->is_editor_hint())
+ if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint())
set_fixed_process(p_enabled);
if (!p_enabled)
collided = false;
@@ -118,7 +120,7 @@ void RayCast::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
- if (enabled && !get_tree()->is_editor_hint()) {
+ if (enabled && !Engine::get_singleton()->is_editor_hint()) {
set_fixed_process(true);
if (get_tree()->is_debugging_collisions_hint())
@@ -194,7 +196,7 @@ void RayCast::add_exception_rid(const RID &p_rid) {
void RayCast::add_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object);
- CollisionObject *co = ((Object *)p_object)->cast_to<CollisionObject>();
+ const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
if (!co)
return;
add_exception_rid(co->get_rid());
@@ -208,7 +210,7 @@ void RayCast::remove_exception_rid(const RID &p_rid) {
void RayCast::remove_exception(const Object *p_object) {
ERR_FAIL_NULL(p_object);
- CollisionObject *co = ((Object *)p_object)->cast_to<CollisionObject>();
+ const CollisionObject *co = Object::cast_to<CollisionObject>(p_object);
if (!co)
return;
remove_exception_rid(co->get_rid());
diff --git a/scene/3d/ray_cast.h b/scene/3d/ray_cast.h
index e9b34c4f75..fd566cd343 100644
--- a/scene/3d/ray_cast.h
+++ b/scene/3d/ray_cast.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp
index 0dc5b58e45..46b105cd21 100644
--- a/scene/3d/reflection_probe.cpp
+++ b/scene/3d/reflection_probe.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -252,8 +252,8 @@ void ReflectionProbe::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "interior_ambient_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_interior_ambient_energy", "get_interior_ambient_energy");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "interior_ambient_contrib", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_interior_ambient_probe_contribution", "get_interior_ambient_probe_contribution");
- BIND_CONSTANT(UPDATE_ONCE);
- BIND_CONSTANT(UPDATE_ALWAYS);
+ BIND_ENUM_CONSTANT(UPDATE_ONCE);
+ BIND_ENUM_CONSTANT(UPDATE_ALWAYS);
}
ReflectionProbe::ReflectionProbe() {
diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h
index d2a5facb5f..7c328a8f16 100644
--- a/scene/3d/reflection_probe.h
+++ b/scene/3d/reflection_probe.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp
index 492930ea9b..3d402fa5af 100644
--- a/scene/3d/remote_transform.cpp
+++ b/scene/3d/remote_transform.cpp
@@ -4,7 +4,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -51,11 +51,7 @@ void RemoteTransform::_update_remote() {
if (!cache)
return;
- Object *obj = ObjectDB::get_instance(cache);
- if (!obj)
- return;
-
- Spatial *n = obj->cast_to<Spatial>();
+ Spatial *n = Object::cast_to<Spatial>(ObjectDB::get_instance(cache));
if (!n)
return;
@@ -177,7 +173,7 @@ bool RemoteTransform::get_update_scale() const {
String RemoteTransform::get_configuration_warning() const {
- if (!has_node(remote_node) || !get_node(remote_node) || !get_node(remote_node)->cast_to<Spatial>()) {
+ if (!has_node(remote_node) || !Object::cast_to<Spatial>(get_node(remote_node))) {
return TTR("Path property must point to a valid Spatial node to work.");
}
diff --git a/scene/3d/remote_transform.h b/scene/3d/remote_transform.h
index c25b57966e..51a0bf35a3 100644
--- a/scene/3d/remote_transform.h
+++ b/scene/3d/remote_transform.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp
index c5ea6c54da..439b6bfdf8 100644
--- a/scene/3d/room_instance.cpp
+++ b/scene/3d/room_instance.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -31,6 +31,8 @@
#include "servers/visual_server.h"
+// FIXME: Will be removed, kept as reference for new implementation
+#if 0
#include "geometry.h"
#include "project_settings.h"
#include "scene/resources/surface_tool.h"
@@ -45,7 +47,7 @@ void Room::_notification(int p_what) {
while (parent_room) {
- Room *r = parent_room->cast_to<Room>();
+ Room *r = Object::cast_to<Room>(parent_room);
if (r) {
level = r->level + 1;
@@ -103,7 +105,7 @@ Ref<RoomBounds> Room::get_room() const {
void Room::_parse_node_faces(PoolVector<Face3> &all_faces, const Node *p_node) const {
- const VisualInstance *vi = p_node->cast_to<VisualInstance>();
+ const VisualInstance *vi = Object::cast_to<VisualInstance>(p_node);
if (vi) {
PoolVector<Face3> faces = vi->get_faces(FACES_ENCLOSING);
@@ -158,3 +160,4 @@ Room::Room() {
Room::~Room() {
}
+#endif
diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h
index 4176da92e8..b9a64b6670 100644
--- a/scene/3d/room_instance.h
+++ b/scene/3d/room_instance.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -44,6 +44,9 @@
*/
+//this will be removed, left for reference
+#if 0
+
class Room : public VisualInstance {
GDCLASS(Room, VisualInstance);
@@ -77,5 +80,5 @@ public:
Room();
~Room();
};
-
+#endif
#endif // ROOM_INSTANCE_H
diff --git a/scene/3d/scenario_fx.cpp b/scene/3d/scenario_fx.cpp
index 0780ce22ff..8102b3f15c 100644
--- a/scene/3d/scenario_fx.cpp
+++ b/scene/3d/scenario_fx.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/scenario_fx.h b/scene/3d/scenario_fx.h
index d1e0a63130..acf6a18526 100644
--- a/scene/3d/scenario_fx.h
+++ b/scene/3d/scenario_fx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index 0d91014314..d0e0937eca 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -82,9 +82,9 @@ bool Skeleton::_set(const StringName &p_path, const Variant &p_value) {
return true;
}
-bool Skeleton::_get(const StringName &p_name, Variant &r_ret) const {
+bool Skeleton::_get(const StringName &p_path, Variant &r_ret) const {
- String path = p_name;
+ String path = p_path;
if (!path.begins_with("bones/"))
return false;
@@ -111,7 +111,7 @@ bool Skeleton::_get(const StringName &p_name, Variant &r_ret) const {
Object *obj = ObjectDB::get_instance(E->get());
ERR_CONTINUE(!obj);
- Node *node = obj->cast_to<Node>();
+ Node *node = Object::cast_to<Node>(obj);
ERR_CONTINUE(!node);
NodePath path = get_path_to(node);
children.push_back(path);
@@ -245,7 +245,7 @@ void Skeleton::_notification(int p_what) {
Object *obj = ObjectDB::get_instance(E->get());
ERR_CONTINUE(!obj);
- Spatial *sp = obj->cast_to<Spatial>();
+ Spatial *sp = Object::cast_to<Spatial>(obj);
ERR_CONTINUE(!sp);
sp->set_transform(b.pose_global);
}
@@ -433,7 +433,7 @@ void Skeleton::get_bound_child_nodes_to_bone(int p_bone, List<Node *> *p_bound)
Object *obj = ObjectDB::get_instance(E->get());
ERR_CONTINUE(!obj);
- p_bound->push_back(obj->cast_to<Node>());
+ p_bound->push_back(Object::cast_to<Node>(obj));
}
}
diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h
index dc0adbb337..fdc1100472 100644
--- a/scene/3d/skeleton.h
+++ b/scene/3d/skeleton.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -91,8 +91,8 @@ class Skeleton : public Spatial {
}
protected:
- bool _get(const StringName &p_name, Variant &r_ret) const;
- bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_path, Variant &r_ret) const;
+ bool _set(const StringName &p_path, const Variant &p_value);
void _get_property_list(List<PropertyInfo> *p_list) const;
void _notification(int p_what);
static void _bind_methods();
@@ -113,7 +113,7 @@ public:
void set_bone_parent(int p_bone, int p_parent);
int get_bone_parent(int p_bone) const;
- void unparent_bone_and_rest(int p_idx);
+ void unparent_bone_and_rest(int p_bone);
void set_bone_disable_rest(int p_bone, bool p_disable);
bool is_bone_rest_disabled(int p_bone) const;
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 848b08eb8f..7db3bb18bd 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "spatial.h"
+#include "engine.h"
#include "message_queue.h"
#include "scene/main/viewport.h"
#include "scene/scene_string_names.h"
@@ -127,14 +128,14 @@ void Spatial::_notification(int p_what) {
Node *p = get_parent();
if (p)
- data.parent = p->cast_to<Spatial>();
+ data.parent = Object::cast_to<Spatial>(p);
if (data.parent)
data.C = data.parent->data.children.push_back(this);
else
data.C = NULL;
- if (data.toplevel && !get_tree()->is_editor_hint()) {
+ if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) {
if (data.parent) {
data.local_transform = data.parent->get_global_transform() * get_transform();
@@ -166,7 +167,7 @@ void Spatial::_notification(int p_what) {
data.viewport = NULL;
Node *parent = get_parent();
while (parent && !data.viewport) {
- data.viewport = parent->cast_to<Viewport>();
+ data.viewport = Object::cast_to<Viewport>(parent);
parent = parent->get_parent();
}
@@ -178,14 +179,19 @@ void Spatial::_notification(int p_what) {
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0);
}
#ifdef TOOLS_ENABLED
- if (get_tree()->is_editor_hint()) {
+ if (Engine::get_singleton()->is_editor_hint()) {
//get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this);
get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this);
if (!data.gizmo_disabled) {
- if (data.gizmo.is_valid())
+ if (data.gizmo.is_valid()) {
data.gizmo->create();
+ if (data.gizmo->can_draw()) {
+ data.gizmo->redraw();
+ }
+ data.gizmo->transform();
+ }
}
}
#endif
@@ -280,37 +286,6 @@ Transform Spatial::get_global_transform() const {
return data.global_transform;
}
-#if 0
-void Spatial::add_child_notify(Node *p_child) {
-/*
- Spatial *s=p_child->cast_to<Spatial>();
- if (!s)
- return;
-
- ERR_FAIL_COND(data.children_lock>0);
-
- s->data.dirty=DIRTY_GLOBAL; // don't allow global transform to be valid
- s->data.parent=this;
- data.children.push_back(s);
- s->data.C=data.children.back();
-*/
-}
-
-void Spatial::remove_child_notify(Node *p_child) {
-/*
- Spatial *s=p_child->cast_to<Spatial>();
- if (!s)
- return;
-
- ERR_FAIL_COND(data.children_lock>0);
-
- if (s->data.C)
- data.children.erase(s->data.C);
- s->data.parent=NULL;
- s->data.C=NULL;
-*/
-}
-#endif
Spatial *Spatial::get_parent_spatial() const {
@@ -448,7 +423,9 @@ void Spatial::set_gizmo(const Ref<SpatialGizmo> &p_gizmo) {
if (data.gizmo.is_valid() && is_inside_world()) {
data.gizmo->create();
- data.gizmo->redraw();
+ if (data.gizmo->can_draw()) {
+ data.gizmo->redraw();
+ }
data.gizmo->transform();
}
@@ -470,12 +447,16 @@ Ref<SpatialGizmo> Spatial::get_gizmo() const {
void Spatial::_update_gizmo() {
+ if (!is_inside_world())
+ return;
data.gizmo_dirty = false;
if (data.gizmo.is_valid()) {
- if (is_visible_in_tree())
- data.gizmo->redraw();
- else
- data.gizmo->clear();
+ if (data.gizmo->can_draw()) {
+ if (is_visible_in_tree())
+ data.gizmo->redraw();
+ else
+ data.gizmo->clear();
+ }
}
}
@@ -492,7 +473,7 @@ void Spatial::set_as_toplevel(bool p_enabled) {
if (data.toplevel == p_enabled)
return;
- if (is_inside_tree() && !get_tree()->is_editor_hint()) {
+ if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
if (p_enabled)
set_transform(get_global_transform());
diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h
index f22b19d3cc..3f205ea86b 100644
--- a/scene/3d/spatial.h
+++ b/scene/3d/spatial.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -47,6 +47,7 @@ public:
virtual void clear() = 0;
virtual void redraw() = 0;
virtual void free() = 0;
+ virtual bool can_draw() const = 0;
SpatialGizmo();
};
diff --git a/scene/3d/spatial_indexer.cpp b/scene/3d/spatial_indexer.cpp
deleted file mode 100644
index 7090c974a3..0000000000
--- a/scene/3d/spatial_indexer.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*************************************************************************/
-/* spatial_indexer.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#include "spatial_indexer.h"
-
-#if 0
-
-#include "camera.h"
-#include "proximity_area.h"
-#include "scene/scene_string_names.h"
-
-void SpatialIndexer::add_camera(Camera* p_camera) {
-
- cameras.insert(p_camera);
-}
-
-void SpatialIndexer::remove_camera(Camera* p_camera){
-
- for (Set<ProximityArea*>::Element *F=proximity_areas.front();F;F=F->next()) {
-
- ProximityArea *prox = F->get();
- TK<Camera> k;
- k.against=p_camera;
- k.area=prox;
- if (camera_pairs.has(k)) {
- camera_pairs.erase(k);
- prox->area_exit(ProximityArea::TRACK_CAMERAS,p_camera);
- }
- }
- cameras.erase(p_camera);
-
-}
-
-void SpatialIndexer::update_camera(Camera* p_camera) {
-
-
- _request_update();
-}
-
-void SpatialIndexer::_update_pairs() {
-
- // brute force interseciton code, no broadphase
- // will implement broadphase in the future
-
- for (Set<Camera*>::Element *E=cameras.front();E;E=E->next()) {
-
- Camera *cam = E->get();
- Vector<Plane> cplanes = cam->get_frustum();
-
- for (Set<ProximityArea*>::Element *F=proximity_areas.front();F;F=F->next()) {
-
- ProximityArea *prox = F->get();
-
- bool inters=false;
-
- if (prox->get_track_flag(ProximityArea::TRACK_CAMERAS)) {
-
- AABB aabb = prox->get_global_transform().xform(prox->get_aabb());
- if (aabb.intersects_convex_shape(cplanes.ptr(),cplanes.size()))
- inters=true;
- }
-
- TK<Camera> k;
- k.against=cam;
- k.area=prox;
-
- bool has = camera_pairs.has(k);
-
- if (inters==has)
- continue;
-
- if (inters) {
- camera_pairs.insert(k);
- prox->area_enter(ProximityArea::TRACK_CAMERAS,cam);
- } else {
-
- camera_pairs.erase(k);
- prox->area_exit(ProximityArea::TRACK_CAMERAS,cam);
- }
- }
-
- }
-
- pending_update=false;
-}
-
-void SpatialIndexer::_bind_methods() {
-
-
- ClassDB::bind_method(D_METHOD("_update_pairs"),&SpatialIndexer::_update_pairs);
-}
-
-
-void SpatialIndexer::add_proximity_area(ProximityArea* p_area) {
-
- proximity_areas.insert(p_area);
-
-}
-
-void SpatialIndexer::remove_proximity_area(ProximityArea* p_area) {
-
- for (Set<Camera*>::Element *E=cameras.front();E;E=E->next()) {
-
- Camera *cam = E->get();
- TK<Camera> k;
- k.against=cam;
- k.area=p_area;
- if (camera_pairs.has(k)) {
- camera_pairs.erase(k);
- p_area->area_exit(ProximityArea::TRACK_CAMERAS,cam);
- }
- }
- proximity_areas.erase(p_area);
-
-}
-
-void SpatialIndexer::_request_update() {
-
- if (pending_update)
- return;
- pending_update=true;
- call_deferred(SceneStringNames::get_singleton()->_update_pairs);
-
-}
-
-void SpatialIndexer::update_proximity_area_transform(ProximityArea* p_area) {
-
- _request_update();
-}
-
-void SpatialIndexer::update_proximity_area_flags(ProximityArea* p_area) {
-
- _request_update();
-}
-
-SpatialIndexer::SpatialIndexer() {
-
- pending_update=false;
-}
-#endif
diff --git a/scene/3d/spatial_indexer.h b/scene/3d/spatial_indexer.h
deleted file mode 100644
index c8bdf8950d..0000000000
--- a/scene/3d/spatial_indexer.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*************************************************************************/
-/* spatial_indexer.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#ifndef SPATIAL_INDEXER_H
-#define SPATIAL_INDEXER_H
-
-#include "scene/3d/spatial.h"
-#if 0
-
-class Camera;
-class ProximityArea;
-
-class SpatialIndexer : public Object {
-
- GDCLASS( SpatialIndexer, Object );
-
- template<class T>
- struct TK {
-
- T *against;
- ProximityArea *area;
- bool operator<(const TK<T>& p_k) const { return against==p_k.against ? area < p_k.area : against < p_k.against; }
- };
-
-
- Set<Camera*> cameras; //cameras
- Set<ProximityArea*> proximity_areas;
-
- Set<TK<Camera> > camera_pairs;
-
- bool pending_update;
- void _update_pairs();
- void _request_update();
-
-protected:
-
- static void _bind_methods();
-
-friend class ProximityArea;
-friend class Camera;
-
- void add_proximity_area(ProximityArea* p_area);
- void remove_proximity_area(ProximityArea* p_area);
- void update_proximity_area_transform(ProximityArea* p_area);
- void update_proximity_area_flags(ProximityArea* p_area);
-
- void add_camera(Camera* p_camera);
- void remove_camera(Camera* p_camera);
- void update_camera(Camera* p_camera);
-
-public:
-
-
- SpatialIndexer();
-
-};
-#endif
-#endif // SPATIAL_INDEXER_H
diff --git a/scene/3d/spatial_velocity_tracker.h b/scene/3d/spatial_velocity_tracker.h
index 65f3eaca93..b8237613a7 100644
--- a/scene/3d/spatial_velocity_tracker.h
+++ b/scene/3d/spatial_velocity_tracker.h
@@ -20,7 +20,7 @@ protected:
public:
void reset(const Vector3 &p_new_pos);
- void set_track_fixed_step(bool p_use_fixed_step);
+ void set_track_fixed_step(bool p_track_fixed_step);
bool is_tracking_fixed_step() const;
void update_position(const Vector3 &p_position);
Vector3 get_tracked_linear_velocity() const;
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 978662f7dc..49a3205f21 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -70,13 +70,9 @@ void SpriteBase3D::_notification(int p_what) {
if (!pending_update)
_im_update();
- Node *parent = get_parent();
- if (parent) {
-
- parent_sprite = parent->cast_to<SpriteBase3D>();
- if (parent_sprite) {
- pI = parent_sprite->children.push_back(this);
- }
+ parent_sprite = Object::cast_to<SpriteBase3D>(get_parent());
+ if (parent_sprite) {
+ pI = parent_sprite->children.push_back(this);
}
}
@@ -276,14 +272,14 @@ void SpriteBase3D::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "double_sided"), "set_draw_flag", "get_draw_flag", FLAG_DOUBLE_SIDED);
ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_cut", PROPERTY_HINT_ENUM, "Disabled,Discard,Opaque Pre-Pass"), "set_alpha_cut_mode", "get_alpha_cut_mode");
- BIND_CONSTANT(FLAG_TRANSPARENT);
- BIND_CONSTANT(FLAG_SHADED);
- BIND_CONSTANT(FLAG_DOUBLE_SIDED);
- BIND_CONSTANT(FLAG_MAX);
+ BIND_ENUM_CONSTANT(FLAG_TRANSPARENT);
+ BIND_ENUM_CONSTANT(FLAG_SHADED);
+ BIND_ENUM_CONSTANT(FLAG_DOUBLE_SIDED);
+ BIND_ENUM_CONSTANT(FLAG_MAX);
- BIND_CONSTANT(ALPHA_CUT_DISABLED);
- BIND_CONSTANT(ALPHA_CUT_DISCARD);
- BIND_CONSTANT(ALPHA_CUT_OPAQUE_PREPASS);
+ BIND_ENUM_CONSTANT(ALPHA_CUT_DISABLED);
+ BIND_ENUM_CONSTANT(ALPHA_CUT_DISCARD);
+ BIND_ENUM_CONSTANT(ALPHA_CUT_OPAQUE_PREPASS);
}
SpriteBase3D::SpriteBase3D() {
@@ -602,219 +598,6 @@ Sprite3D::Sprite3D() {
////////////////////////////////////////
-#if 0
-
-void AnimatedSprite3D::_draw() {
-
- RID immediate = get_immediate();
- VS::get_singleton()->immediate_clear(immediate);
-
- if (!frames.is_valid() || !frames->get_frame_count(animation) || frame<0 || frame>=frames->get_frame_count(animation)) {
- return;
- }
-
- Ref<Texture> texture = frames->get_frame(animation,frame);
- if (!texture.is_valid())
- return; //no texuture no life
- Vector2 tsize = texture->get_size();
- if (tsize.x==0 || tsize.y==0)
- return;
-
- Size2i s=tsize;
- Rect2i src_rect;
-
- src_rect.size=s;
-
- Point2i ofs=get_offset();
- if (is_centered())
- ofs-=s/2;
-
- Rect2i dst_rect(ofs,s);
-
-
- Rect2 final_rect;
- Rect2 final_src_rect;
- if (!texture->get_rect_region(dst_rect,src_rect,final_rect,final_src_rect))
- return;
-
-
- if (final_rect.size.x==0 || final_rect.size.y==0)
- return;
-
- Color color=_get_color_accum();
- color.a*=get_opacity();
-
- float pixel_size=get_pixel_size();
-
- Vector2 vertices[4]={
-
- (final_rect.pos+Vector2(0,final_rect.size.y)) * pixel_size,
- (final_rect.pos+final_rect.size) * pixel_size,
- (final_rect.pos+Vector2(final_rect.size.x,0)) * pixel_size,
- final_rect.pos * pixel_size,
-
-
- };
- Vector2 uvs[4]={
- final_src_rect.pos / tsize,
- (final_src_rect.pos+Vector2(final_src_rect.size.x,0)) / tsize,
- (final_src_rect.pos+final_src_rect.size) / tsize,
- (final_src_rect.pos+Vector2(0,final_src_rect.size.y)) / tsize,
- };
-
- if (is_flipped_h()) {
- SWAP(uvs[0],uvs[1]);
- SWAP(uvs[2],uvs[3]);
- }
- if (is_flipped_v()) {
-
- SWAP(uvs[0],uvs[3]);
- SWAP(uvs[1],uvs[2]);
- }
-
-
- Vector3 normal;
- int axis = get_axis();
- normal[axis]=1.0;
-
- RID mat = VS::get_singleton()->material_2d_get(get_draw_flag(FLAG_SHADED),get_draw_flag(FLAG_TRANSPARENT),get_alpha_cut_mode()==ALPHA_CUT_DISCARD,get_alpha_cut_mode()==ALPHA_CUT_OPAQUE_PREPASS);
- VS::get_singleton()->immediate_set_material(immediate,mat);
-
- VS::get_singleton()->immediate_begin(immediate,VS::PRIMITIVE_TRIANGLE_FAN,texture->get_rid());
-
- int x_axis = ((axis + 1) % 3);
- int y_axis = ((axis + 2) % 3);
-
- if (axis!=Vector3::AXIS_Z) {
- SWAP(x_axis,y_axis);
-
- for(int i=0;i<4;i++) {
- //uvs[i] = Vector2(1.0,1.0)-uvs[i];
- //SWAP(vertices[i].x,vertices[i].y);
- if (axis==Vector3::AXIS_Y) {
- vertices[i].y = - vertices[i].y;
- } else if (axis==Vector3::AXIS_X) {
- vertices[i].x = - vertices[i].x;
- }
- }
- }
-
- AABB aabb;
-
- for(int i=0;i<4;i++) {
- VS::get_singleton()->immediate_normal(immediate,normal);
- VS::get_singleton()->immediate_color(immediate,color);
- VS::get_singleton()->immediate_uv(immediate,uvs[i]);
-
- Vector3 vtx;
- vtx[x_axis]=vertices[i][0];
- vtx[y_axis]=vertices[i][1];
- VS::get_singleton()->immediate_vertex(immediate,vtx);
- if (i==0) {
- aabb.pos=vtx;
- aabb.size=Vector3();
- } else {
- aabb.expand_to(vtx);
- }
- }
- set_aabb(aabb);
- VS::get_singleton()->immediate_end(immediate);
-
-}
-
-void AnimatedSprite3D::_bind_methods(){
-
- ClassDB::bind_method(D_METHOD("set_sprite_frames","sprite_frames"),&AnimatedSprite3D::set_sprite_frames);
- ClassDB::bind_method(D_METHOD("get_sprite_frames"),&AnimatedSprite3D::get_sprite_frames);
- ClassDB::bind_method(D_METHOD("set_frame","frame"),&AnimatedSprite3D::set_frame);
- ClassDB::bind_method(D_METHOD("get_frame"),&AnimatedSprite3D::get_frame);
-
- ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "frames", PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), "set_sprite_frames","get_sprite_frames");
- ADD_PROPERTY( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), "set_frame","get_frame");
-
- ADD_SIGNAL(MethodInfo("frame_changed"));
-
-}
-
-
-
-
-void AnimatedSprite3D::set_sprite_frames(const Ref<SpriteFrames>& p_sprite_frames) {
-
-
- if (frames==p_sprite_frames)
- return;
-
- if (frames.is_valid())
- frames->disconnect("changed",this,"_queue_update");
- frames=p_sprite_frames;
- if (frames.is_valid())
- frames->connect("changed",this,"_queue_update");
-
- if (!frames.is_valid() || frame >=frames->get_frame_count(animation)) {
- frame=0;
-
- }
- _queue_update();
-
-}
-
-Ref<SpriteFrames> AnimatedSprite3D::get_sprite_frames() const{
-
- return frames;
-}
-
-void AnimatedSprite3D::set_frame(int p_frame){
-
- if (frames.is_null())
- return;
-
- ERR_FAIL_INDEX(p_frame,frames->get_frame_count(animation));
-
- if (frame==p_frame)
- return;
-
- frame=p_frame;
- _queue_update();
- emit_signal(SceneStringNames::get_singleton()->frame_changed);
-
-}
-int AnimatedSprite3D::get_frame() const{
-
- return frame;
-}
-
-Rect2 AnimatedSprite3D::get_item_rect() const {
-
- if (!frames.is_valid() || !frames->get_frame_count(animation) || frame<0 || frame>=frames->get_frame_count(animation)) {
- return Rect2(0,0,1,1);
- }
-
- Ref<Texture> t = frames->get_frame(animation,frame);
- if (t.is_null())
- return Rect2(0,0,1,1);
- Size2i s = t->get_size();
-
- Point2i ofs=get_offset();
- if (is_centered())
- ofs-=s/2;
-
- if (s==Size2(0,0))
- s=Size2(1,1);
-
- return Rect2(ofs,s);
-}
-
-
-
-AnimatedSprite3D::AnimatedSprite3D() {
-
- animation="current";
- frame=0;
-}
-
-#endif
-
void AnimatedSprite3D::_draw() {
RID immediate = get_immediate();
@@ -1026,63 +809,6 @@ void AnimatedSprite3D::_notification(int p_what) {
timeout -= to_process;
}
} break;
-#if 0
- case NOTIFICATION_DRAW: {
-
- if (frames.is_null()) {
- print_line("no draw no faemos");
- return;
- }
-
- if (frame<0) {
- print_line("no draw frame <0");
- return;
- }
-
- if (!frames->has_animation(animation)) {
- print_line("no draw no anim: "+String(animation));
- return;
- }
-
-
-
- Ref<Texture> texture = frames->get_frame(animation,frame);
- if (texture.is_null()) {
- print_line("no draw texture is null");
- return;
- }
-
- //print_line("DECIDED TO DRAW");
-
- RID ci = get_canvas_item();
-
- /*
- texture->draw(ci,Point2());
- break;
- */
-
- Size2i s;
- s = texture->get_size();
- Point2 ofs=offset;
- if (centered)
- ofs-=s/2;
-
- if (OS::get_singleton()->get_use_pixel_snap()) {
- ofs=ofs.floor();
- }
- Rect2 dst_rect(ofs,s);
-
- if (hflip)
- dst_rect.size.x=-dst_rect.size.x;
- if (vflip)
- dst_rect.size.y=-dst_rect.size.y;
-
- //texture->draw_rect(ci,dst_rect,false,modulate);
- texture->draw_rect_region(ci,dst_rect,Rect2(Vector2(),texture->get_size()),modulate);
- //VisualServer::get_singleton()->canvas_item_add_texture_rect_region(ci,dst_rect,texture->get_rid(),src_rect,modulate);
-
- } break;
-#endif
}
}
diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h
index b4600c00b8..1165392cb2 100644
--- a/scene/3d/sprite_3d.h
+++ b/scene/3d/sprite_3d.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -119,7 +119,7 @@ public:
void set_pixel_size(float p_amount);
float get_pixel_size() const;
- void set_axis(Vector3::Axis p_amount);
+ void set_axis(Vector3::Axis p_axis);
Vector3::Axis get_axis() const;
void set_draw_flag(DrawFlags p_flag, bool p_enable);
@@ -181,37 +181,6 @@ public:
//~Sprite3D();
};
-#if 0
-class AnimatedSprite3D : public SpriteBase3D {
-
- GDCLASS(AnimatedSprite3D,SpriteBase3D);
- Ref<SpriteFrames> frames;
-
-
- StringName animation;
- int frame;
-
-protected:
- virtual void _draw();
- static void _bind_methods();
-public:
-
-
-
- void set_sprite_frames(const Ref<SpriteFrames>& p_sprite_frames);
- Ref<SpriteFrames> get_sprite_frames() const;
-
- void set_frame(int p_frame);
- int get_frame() const;
-
-
- virtual Rect2 get_item_rect() const;
-
- AnimatedSprite3D();
- //~AnimatedSprite3D();
-};
-#endif
-
class AnimatedSprite3D : public SpriteBase3D {
GDCLASS(AnimatedSprite3D, SpriteBase3D);
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index 8d927e529e..d6b3206fbf 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -81,9 +81,7 @@ void VehicleWheel::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- if (!get_parent())
- return;
- VehicleBody *cb = get_parent()->cast_to<VehicleBody>();
+ VehicleBody *cb = Object::cast_to<VehicleBody>(get_parent());
if (!cb)
return;
body = cb;
@@ -96,9 +94,7 @@ void VehicleWheel::_notification(int p_what) {
}
if (p_what == NOTIFICATION_EXIT_TREE) {
- if (!get_parent())
- return;
- VehicleBody *cb = get_parent()->cast_to<VehicleBody>();
+ VehicleBody *cb = Object::cast_to<VehicleBody>(get_parent());
if (!cb)
return;
cb->wheels.erase(this);
@@ -416,7 +412,7 @@ real_t VehicleBody::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
wheel.m_raycastInfo.m_isInContact = true;
if (rr.collider)
- wheel.m_raycastInfo.m_groundObject = rr.collider->cast_to<PhysicsBody>();
+ wheel.m_raycastInfo.m_groundObject = Object::cast_to<PhysicsBody>(rr.collider);
real_t hitDistance = param * raylen;
wheel.m_raycastInfo.m_suspensionLength = hitDistance - wheel.m_wheelRadius;
@@ -559,6 +555,9 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec
b2invinertia,
b2invmass);
+ // FIXME: rel_vel assignment here is overwritten by the following assignment.
+ // What seemes to be intented in the next next assignment is: rel_vel = normal.dot(rel_vel);
+ // Investigate why.
real_t rel_vel = jac.getRelativeVelocity(
s->get_linear_velocity(),
s->get_transform().basis.transposed().xform(s->get_angular_velocity()),
@@ -801,7 +800,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
void VehicleBody::_direct_state_changed(Object *p_state) {
- PhysicsDirectBodyState *s = p_state->cast_to<PhysicsDirectBodyState>();
+ PhysicsDirectBodyState *s = Object::cast_to<PhysicsDirectBodyState>(p_state);
set_ignore_transform_notification(true);
set_global_transform(s->get_transform());
@@ -893,9 +892,9 @@ real_t VehicleBody::get_friction() const {
return friction;
}
-void VehicleBody::set_engine_force(float p_force) {
+void VehicleBody::set_engine_force(float p_engine_force) {
- engine_force = p_force;
+ engine_force = p_engine_force;
}
float VehicleBody::get_engine_force() const {
diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h
index 7ed9bce730..d67209c58f 100644
--- a/scene/3d/vehicle_body.h
+++ b/scene/3d/vehicle_body.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -196,7 +196,7 @@ public:
void set_engine_force(float p_engine_force);
float get_engine_force() const;
- void set_brake(float p_force);
+ void set_brake(float p_brake);
float get_brake() const;
void set_steering(float p_steering);
diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp
index cc81a4cb56..d3203bacec 100644
--- a/scene/3d/visibility_notifier.cpp
+++ b/scene/3d/visibility_notifier.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -29,11 +29,11 @@
/*************************************************************************/
#include "visibility_notifier.h"
+#include "engine.h"
#include "scene/3d/camera.h"
#include "scene/3d/physics_body.h"
#include "scene/animation/animation_player.h"
#include "scene/scene_string_names.h"
-#include "scene/scene_string_names.h"
void VisibilityNotifier::_enter_camera(Camera *p_camera) {
@@ -151,7 +151,7 @@ void VisibilityEnabler::_find_nodes(Node *p_node) {
if (enabler[ENABLER_FREEZE_BODIES]) {
- RigidBody *rb = p_node->cast_to<RigidBody>();
+ RigidBody *rb = Object::cast_to<RigidBody>(p_node);
if (rb && ((rb->get_mode() == RigidBody::MODE_CHARACTER || (rb->get_mode() == RigidBody::MODE_RIGID && !rb->is_able_to_sleep())))) {
add = true;
@@ -161,7 +161,7 @@ void VisibilityEnabler::_find_nodes(Node *p_node) {
if (enabler[ENABLER_PAUSE_ANIMATIONS]) {
- AnimationPlayer *ap = p_node->cast_to<AnimationPlayer>();
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
if (ap) {
add = true;
}
@@ -187,7 +187,7 @@ void VisibilityEnabler::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
return;
Node *from = this;
@@ -200,7 +200,7 @@ void VisibilityEnabler::_notification(int p_what) {
if (p_what == NOTIFICATION_EXIT_TREE) {
- if (get_tree()->is_editor_hint())
+ if (Engine::get_singleton()->is_editor_hint())
return;
for (Map<Node *, Variant>::Element *E = nodes.front(); E; E = E->next()) {
@@ -219,14 +219,14 @@ void VisibilityEnabler::_change_node_state(Node *p_node, bool p_enabled) {
ERR_FAIL_COND(!nodes.has(p_node));
{
- RigidBody *rb = p_node->cast_to<RigidBody>();
+ RigidBody *rb = Object::cast_to<RigidBody>(p_node);
if (rb)
rb->set_sleeping(!p_enabled);
}
{
- AnimationPlayer *ap = p_node->cast_to<AnimationPlayer>();
+ AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
if (ap) {
@@ -252,9 +252,9 @@ void VisibilityEnabler::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "pause_animations"), "set_enabler", "is_enabler_enabled", ENABLER_PAUSE_ANIMATIONS);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "freeze_bodies"), "set_enabler", "is_enabler_enabled", ENABLER_FREEZE_BODIES);
- BIND_CONSTANT(ENABLER_FREEZE_BODIES);
- BIND_CONSTANT(ENABLER_PAUSE_ANIMATIONS);
- BIND_CONSTANT(ENABLER_MAX);
+ BIND_ENUM_CONSTANT(ENABLER_FREEZE_BODIES);
+ BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATIONS);
+ BIND_ENUM_CONSTANT(ENABLER_MAX);
}
void VisibilityEnabler::set_enabler(Enabler p_enabler, bool p_enable) {
diff --git a/scene/3d/visibility_notifier.h b/scene/3d/visibility_notifier.h
index 316b2c3575..0b83e0534e 100644
--- a/scene/3d/visibility_notifier.h
+++ b/scene/3d/visibility_notifier.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp
index 1a294d016a..0464a82f65 100644
--- a/scene/3d/visual_instance.cpp
+++ b/scene/3d/visual_instance.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -29,7 +29,6 @@
/*************************************************************************/
#include "visual_instance.h"
-#include "room_instance.h"
#include "scene/scene_string_names.h"
#include "servers/visual_server.h"
#include "skeleton.h"
@@ -54,32 +53,9 @@ void VisualInstance::_notification(int p_what) {
case NOTIFICATION_ENTER_WORLD: {
- // CHECK ROOM
- Spatial *parent = get_parent_spatial();
- Room *room = NULL;
- bool is_geom = cast_to<GeometryInstance>();
-
- /* while(parent) {
-
- room = parent->cast_to<Room>();
- if (room)
- break;
-
- if (is_geom && parent->cast_to<BakedLightSampler>()) {
- VS::get_singleton()->instance_geometry_set_baked_light_sampler(get_instance(),parent->cast_to<BakedLightSampler>()->get_instance());
- break;
- }
-
- parent=parent->get_parent_spatial();
- }*/
-
- if (room) {
-
- VisualServer::get_singleton()->instance_set_room(instance, room->get_instance());
- }
// CHECK SKELETON => moving skeleton attaching logic to MeshInstance
/*
- Skeleton *skeleton=get_parent()?get_parent()->cast_to<Skeleton>():NULL;
+ Skeleton *skeleton=Object::cast_to<Skeleton>(get_parent());
if (skeleton)
VisualServer::get_singleton()->instance_attach_skeleton( instance, skeleton->get_skeleton() );
*/
@@ -96,7 +72,6 @@ void VisualInstance::_notification(int p_what) {
case NOTIFICATION_EXIT_WORLD: {
VisualServer::get_singleton()->instance_set_scenario(instance, RID());
- VisualServer::get_singleton()->instance_set_room(instance, RID());
VisualServer::get_singleton()->instance_attach_skeleton(instance, RID());
//VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() );
@@ -231,14 +206,6 @@ void GeometryInstance::_notification(int p_what) {
void GeometryInstance::set_flag(Flags p_flag, bool p_value) {
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
- if (p_flag == FLAG_CAST_SHADOW) {
- if (p_value == true) {
- set_cast_shadows_setting(SHADOW_CASTING_SETTING_ON);
- } else {
- set_cast_shadows_setting(SHADOW_CASTING_SETTING_OFF);
- }
- }
-
if (flags[p_flag] == p_value)
return;
@@ -252,14 +219,6 @@ bool GeometryInstance::get_flag(Flags p_flag) const {
ERR_FAIL_INDEX_V(p_flag, FLAG_MAX, false);
- if (p_flag == FLAG_CAST_SHADOW) {
- if (shadow_casting_setting == SHADOW_CASTING_SETTING_OFF) {
- return false;
- } else {
- return true;
- }
- }
-
return flags[p_flag];
}
@@ -319,7 +278,6 @@ void GeometryInstance::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_override", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,SpatialMaterial"), "set_material_override", "get_material_override");
ADD_PROPERTY(PropertyInfo(Variant::INT, "cast_shadow", PROPERTY_HINT_ENUM, "Off,On,Double-Sided,Shadows Only"), "set_cast_shadows_setting", "get_cast_shadows_setting");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "extra_cull_margin", PROPERTY_HINT_RANGE, "0,16384,0"), "set_extra_cull_margin", "get_extra_cull_margin");
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "visible_in_all_rooms"), "set_flag", "get_flag", FLAG_VISIBLE_IN_ALL_ROOMS);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "use_in_baked_light"), "set_flag", "get_flag", FLAG_USE_BAKED_LIGHT);
ADD_GROUP("LOD", "lod_");
@@ -330,8 +288,6 @@ void GeometryInstance::_bind_methods() {
//ADD_SIGNAL( MethodInfo("visibility_changed"));
- BIND_CONSTANT(FLAG_CAST_SHADOW);
- BIND_CONSTANT(FLAG_VISIBLE_IN_ALL_ROOMS);
BIND_CONSTANT(FLAG_MAX);
BIND_CONSTANT(SHADOW_CASTING_SETTING_OFF);
@@ -350,8 +306,6 @@ GeometryInstance::GeometryInstance() {
flags[i] = false;
}
- flags[FLAG_CAST_SHADOW] = true;
-
shadow_casting_setting = SHADOW_CASTING_SETTING_ON;
extra_cull_margin = 0;
//VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0);
diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h
index 9318198e54..c405236d2c 100644
--- a/scene/3d/visual_instance.h
+++ b/scene/3d/visual_instance.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -76,16 +76,12 @@ public:
~VisualInstance();
};
-class BakedLight;
-
class GeometryInstance : public VisualInstance {
GDCLASS(GeometryInstance, VisualInstance);
public:
enum Flags {
- FLAG_CAST_SHADOW = VS::INSTANCE_FLAG_CAST_SHADOW,
- FLAG_VISIBLE_IN_ALL_ROOMS = VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS,
FLAG_USE_BAKED_LIGHT = VS::INSTANCE_FLAG_USE_BAKED_LIGHT,
FLAG_MAX = VS::INSTANCE_FLAG_MAX,
};