summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-08-27 21:07:15 +0200
committerRémi Verschelde <rverschelde@gmail.com>2017-08-27 22:13:45 +0200
commit7ad14e7a3e6f87ddc450f7e34621eb5200808451 (patch)
tree8804d0dd24cc126087462edfbbbf73ed61b56b0e /scene/3d
parent37da8155a4500a9386027b4d791a86186bc7ab4a (diff)
Dead code tells no tales
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/camera.cpp15
-rw-r--r--scene/3d/character_camera.cpp718
-rw-r--r--scene/3d/character_camera.h167
-rw-r--r--scene/3d/collision_object.cpp1
-rw-r--r--scene/3d/light.h2
-rw-r--r--scene/3d/path.cpp18
-rw-r--r--scene/3d/physics_joint.cpp298
-rw-r--r--scene/3d/physics_joint.h69
-rw-r--r--scene/3d/portal.cpp1
-rw-r--r--scene/3d/room_instance.cpp1
-rw-r--r--scene/3d/spatial.cpp31
-rw-r--r--scene/3d/spatial_indexer.cpp166
-rw-r--r--scene/3d/spatial_indexer.h84
-rw-r--r--scene/3d/sprite_3d.cpp270
-rw-r--r--scene/3d/sprite_3d.h31
-rw-r--r--scene/3d/visual_instance.h2
16 files changed, 3 insertions, 1871 deletions
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index d229c6381f..02a7845e0b 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -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) {
diff --git a/scene/3d/character_camera.cpp b/scene/3d/character_camera.cpp
deleted file mode 100644
index c9dfed5185..0000000000
--- a/scene/3d/character_camera.cpp
+++ /dev/null
@@ -1,718 +0,0 @@
-/*************************************************************************/
-/* character_camera.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://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 = Object::cast_to<PhysicsBody>(parent);
- 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_ENUM_CONSTANT( CAMERA_FIXED );
- BIND_ENUM_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 739e4c783d..0000000000
--- a/scene/3d/character_camera.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*************************************************************************/
-/* character_camera.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://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 78439c245d..c121ef4566 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -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/light.h b/scene/3d/light.h
index 48e50f09e8..93dd4828da 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -38,8 +38,6 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-class BakedLight;
-
class Light : public VisualInstance {
GDCLASS(Light, VisualInstance);
diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp
index 30fc2c9d12..ed4d88417c 100644
--- a/scene/3d/path.cpp
+++ b/scene/3d/path.cpp
@@ -33,24 +33,6 @@
#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() && Engine::get_singleton()->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() {
diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp
index fe1612fcbd..aa127ab79f 100644
--- a/scene/3d/physics_joint.cpp
+++ b/scene/3d/physics_joint.cpp
@@ -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 = Object::cast_to<PhysicsBody>(nA);
- PhysicsBody *B = Object::cast_to<PhysicsBody>(nB);
-
- 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 = Object::cast_to<PhysicsBody>(nA);
- PhysicsBody *B = Object::cast_to<PhysicsBody>(nB);
-
- 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 5f66a7c35e..b94297da30 100644
--- a/scene/3d/physics_joint.h
+++ b/scene/3d/physics_joint.h
@@ -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 b60f88b09d..6c14f7dbc9 100644
--- a/scene/3d/portal.cpp
+++ b/scene/3d/portal.cpp
@@ -32,6 +32,7 @@
#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) {
diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp
index 9306902d7d..439b6bfdf8 100644
--- a/scene/3d/room_instance.cpp
+++ b/scene/3d/room_instance.cpp
@@ -31,6 +31,7 @@
#include "servers/visual_server.h"
+// FIXME: Will be removed, kept as reference for new implementation
#if 0
#include "geometry.h"
#include "project_settings.h"
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 484d12422a..7db3bb18bd 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -286,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=Object::cast_to<Spatial>(p_child);
- 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=Object::cast_to<Spatial>(p_child);
- 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 {
diff --git a/scene/3d/spatial_indexer.cpp b/scene/3d/spatial_indexer.cpp
deleted file mode 100644
index 0a10e9c4b0..0000000000
--- a/scene/3d/spatial_indexer.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*************************************************************************/
-/* spatial_indexer.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://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 2b591f3ff3..0000000000
--- a/scene/3d/spatial_indexer.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*************************************************************************/
-/* spatial_indexer.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://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/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 39c6971d66..49a3205f21 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -598,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();
@@ -1022,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 e3a65e1e8c..1165392cb2 100644
--- a/scene/3d/sprite_3d.h
+++ b/scene/3d/sprite_3d.h
@@ -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/visual_instance.h b/scene/3d/visual_instance.h
index d15045d023..c405236d2c 100644
--- a/scene/3d/visual_instance.h
+++ b/scene/3d/visual_instance.h
@@ -76,8 +76,6 @@ public:
~VisualInstance();
};
-class BakedLight;
-
class GeometryInstance : public VisualInstance {
GDCLASS(GeometryInstance, VisualInstance);