Rename more 2D and 3D nodes to follow convention
Rename editor plugins to match the new node names.
This commit is contained in:
@ -31,8 +31,8 @@
|
||||
#include "cpu_particles_2d.h"
|
||||
|
||||
#include "core/core_string_names.h"
|
||||
#include "scene/2d/canvas_item.h"
|
||||
#include "scene/2d/particles_2d.h"
|
||||
#include "scene/2d/gpu_particles_2d.h"
|
||||
#include "scene/main/canvas_item.h"
|
||||
#include "scene/resources/particles_material.h"
|
||||
#include "servers/visual_server.h"
|
||||
|
||||
@ -1144,7 +1144,7 @@ void CPUParticles2D::_notification(int p_what) {
|
||||
|
||||
void CPUParticles2D::convert_from_particles(Node *p_particles) {
|
||||
|
||||
Particles2D *particles = Object::cast_to<Particles2D>(p_particles);
|
||||
GPUParticles2D *particles = Object::cast_to<GPUParticles2D>(p_particles);
|
||||
ERR_FAIL_COND_MSG(!particles, "Only Particles2D nodes can be converted to CPUParticles2D.");
|
||||
|
||||
set_emitting(particles->is_emitting());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* particles_2d.cpp */
|
||||
/* gpu_particles_2d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -28,7 +28,7 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "particles_2d.h"
|
||||
#include "gpu_particles_2d.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "scene/resources/particles_material.h"
|
||||
@ -38,7 +38,7 @@
|
||||
#include "core/engine.h"
|
||||
#endif
|
||||
|
||||
void Particles2D::set_emitting(bool p_emitting) {
|
||||
void GPUParticles2D::set_emitting(bool p_emitting) {
|
||||
|
||||
VS::get_singleton()->particles_set_emitting(particles, p_emitting);
|
||||
|
||||
@ -49,20 +49,20 @@ void Particles2D::set_emitting(bool p_emitting) {
|
||||
}
|
||||
}
|
||||
|
||||
void Particles2D::set_amount(int p_amount) {
|
||||
void GPUParticles2D::set_amount(int p_amount) {
|
||||
|
||||
ERR_FAIL_COND_MSG(p_amount < 1, "Amount of particles cannot be smaller than 1.");
|
||||
amount = p_amount;
|
||||
VS::get_singleton()->particles_set_amount(particles, amount);
|
||||
}
|
||||
void Particles2D::set_lifetime(float p_lifetime) {
|
||||
void GPUParticles2D::set_lifetime(float p_lifetime) {
|
||||
|
||||
ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0.");
|
||||
lifetime = p_lifetime;
|
||||
VS::get_singleton()->particles_set_lifetime(particles, lifetime);
|
||||
}
|
||||
|
||||
void Particles2D::set_one_shot(bool p_enable) {
|
||||
void GPUParticles2D::set_one_shot(bool p_enable) {
|
||||
|
||||
one_shot = p_enable;
|
||||
VS::get_singleton()->particles_set_one_shot(particles, one_shot);
|
||||
@ -77,22 +77,22 @@ void Particles2D::set_one_shot(bool p_enable) {
|
||||
if (!one_shot)
|
||||
set_process_internal(false);
|
||||
}
|
||||
void Particles2D::set_pre_process_time(float p_time) {
|
||||
void GPUParticles2D::set_pre_process_time(float p_time) {
|
||||
|
||||
pre_process_time = p_time;
|
||||
VS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
|
||||
}
|
||||
void Particles2D::set_explosiveness_ratio(float p_ratio) {
|
||||
void GPUParticles2D::set_explosiveness_ratio(float p_ratio) {
|
||||
|
||||
explosiveness_ratio = p_ratio;
|
||||
VS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio);
|
||||
}
|
||||
void Particles2D::set_randomness_ratio(float p_ratio) {
|
||||
void GPUParticles2D::set_randomness_ratio(float p_ratio) {
|
||||
|
||||
randomness_ratio = p_ratio;
|
||||
VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
|
||||
}
|
||||
void Particles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
|
||||
void GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
|
||||
|
||||
visibility_rect = p_visibility_rect;
|
||||
AABB aabb;
|
||||
@ -106,7 +106,7 @@ void Particles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
|
||||
_change_notify("visibility_rect");
|
||||
update();
|
||||
}
|
||||
void Particles2D::set_use_local_coordinates(bool p_enable) {
|
||||
void GPUParticles2D::set_use_local_coordinates(bool p_enable) {
|
||||
|
||||
local_coords = p_enable;
|
||||
VS::get_singleton()->particles_set_use_local_coordinates(particles, local_coords);
|
||||
@ -116,7 +116,7 @@ void Particles2D::set_use_local_coordinates(bool p_enable) {
|
||||
}
|
||||
}
|
||||
|
||||
void Particles2D::_update_particle_emission_transform() {
|
||||
void GPUParticles2D::_update_particle_emission_transform() {
|
||||
|
||||
Transform2D xf2d = get_global_transform();
|
||||
Transform xf;
|
||||
@ -127,7 +127,7 @@ void Particles2D::_update_particle_emission_transform() {
|
||||
VS::get_singleton()->particles_set_emission_transform(particles, xf);
|
||||
}
|
||||
|
||||
void Particles2D::set_process_material(const Ref<Material> &p_material) {
|
||||
void GPUParticles2D::set_process_material(const Ref<Material> &p_material) {
|
||||
|
||||
process_material = p_material;
|
||||
Ref<ParticlesMaterial> pm = p_material;
|
||||
@ -144,89 +144,89 @@ void Particles2D::set_process_material(const Ref<Material> &p_material) {
|
||||
update_configuration_warning();
|
||||
}
|
||||
|
||||
void Particles2D::set_speed_scale(float p_scale) {
|
||||
void GPUParticles2D::set_speed_scale(float p_scale) {
|
||||
|
||||
speed_scale = p_scale;
|
||||
VS::get_singleton()->particles_set_speed_scale(particles, p_scale);
|
||||
}
|
||||
|
||||
bool Particles2D::is_emitting() const {
|
||||
bool GPUParticles2D::is_emitting() const {
|
||||
|
||||
return VS::get_singleton()->particles_get_emitting(particles);
|
||||
}
|
||||
int Particles2D::get_amount() const {
|
||||
int GPUParticles2D::get_amount() const {
|
||||
|
||||
return amount;
|
||||
}
|
||||
float Particles2D::get_lifetime() const {
|
||||
float GPUParticles2D::get_lifetime() const {
|
||||
|
||||
return lifetime;
|
||||
}
|
||||
|
||||
bool Particles2D::get_one_shot() const {
|
||||
bool GPUParticles2D::get_one_shot() const {
|
||||
|
||||
return one_shot;
|
||||
}
|
||||
float Particles2D::get_pre_process_time() const {
|
||||
float GPUParticles2D::get_pre_process_time() const {
|
||||
|
||||
return pre_process_time;
|
||||
}
|
||||
float Particles2D::get_explosiveness_ratio() const {
|
||||
float GPUParticles2D::get_explosiveness_ratio() const {
|
||||
|
||||
return explosiveness_ratio;
|
||||
}
|
||||
float Particles2D::get_randomness_ratio() const {
|
||||
float GPUParticles2D::get_randomness_ratio() const {
|
||||
|
||||
return randomness_ratio;
|
||||
}
|
||||
Rect2 Particles2D::get_visibility_rect() const {
|
||||
Rect2 GPUParticles2D::get_visibility_rect() const {
|
||||
|
||||
return visibility_rect;
|
||||
}
|
||||
bool Particles2D::get_use_local_coordinates() const {
|
||||
bool GPUParticles2D::get_use_local_coordinates() const {
|
||||
|
||||
return local_coords;
|
||||
}
|
||||
Ref<Material> Particles2D::get_process_material() const {
|
||||
Ref<Material> GPUParticles2D::get_process_material() const {
|
||||
|
||||
return process_material;
|
||||
}
|
||||
|
||||
float Particles2D::get_speed_scale() const {
|
||||
float GPUParticles2D::get_speed_scale() const {
|
||||
|
||||
return speed_scale;
|
||||
}
|
||||
|
||||
void Particles2D::set_draw_order(DrawOrder p_order) {
|
||||
void GPUParticles2D::set_draw_order(DrawOrder p_order) {
|
||||
|
||||
draw_order = p_order;
|
||||
VS::get_singleton()->particles_set_draw_order(particles, VS::ParticlesDrawOrder(p_order));
|
||||
}
|
||||
|
||||
Particles2D::DrawOrder Particles2D::get_draw_order() const {
|
||||
GPUParticles2D::DrawOrder GPUParticles2D::get_draw_order() const {
|
||||
|
||||
return draw_order;
|
||||
}
|
||||
|
||||
void Particles2D::set_fixed_fps(int p_count) {
|
||||
void GPUParticles2D::set_fixed_fps(int p_count) {
|
||||
fixed_fps = p_count;
|
||||
VS::get_singleton()->particles_set_fixed_fps(particles, p_count);
|
||||
}
|
||||
|
||||
int Particles2D::get_fixed_fps() const {
|
||||
int GPUParticles2D::get_fixed_fps() const {
|
||||
return fixed_fps;
|
||||
}
|
||||
|
||||
void Particles2D::set_fractional_delta(bool p_enable) {
|
||||
void GPUParticles2D::set_fractional_delta(bool p_enable) {
|
||||
fractional_delta = p_enable;
|
||||
VS::get_singleton()->particles_set_fractional_delta(particles, p_enable);
|
||||
}
|
||||
|
||||
bool Particles2D::get_fractional_delta() const {
|
||||
bool GPUParticles2D::get_fractional_delta() const {
|
||||
return fractional_delta;
|
||||
}
|
||||
|
||||
String Particles2D::get_configuration_warning() const {
|
||||
String GPUParticles2D::get_configuration_warning() const {
|
||||
|
||||
if (VisualServer::get_singleton()->is_low_end()) {
|
||||
return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles\" option for this purpose.");
|
||||
@ -257,7 +257,7 @@ String Particles2D::get_configuration_warning() const {
|
||||
return warnings;
|
||||
}
|
||||
|
||||
Rect2 Particles2D::capture_rect() const {
|
||||
Rect2 GPUParticles2D::capture_rect() const {
|
||||
|
||||
AABB aabb = VS::get_singleton()->particles_get_current_aabb(particles);
|
||||
Rect2 r;
|
||||
@ -268,34 +268,34 @@ Rect2 Particles2D::capture_rect() const {
|
||||
return r;
|
||||
}
|
||||
|
||||
void Particles2D::set_texture(const Ref<Texture2D> &p_texture) {
|
||||
void GPUParticles2D::set_texture(const Ref<Texture2D> &p_texture) {
|
||||
texture = p_texture;
|
||||
update();
|
||||
}
|
||||
|
||||
Ref<Texture2D> Particles2D::get_texture() const {
|
||||
Ref<Texture2D> GPUParticles2D::get_texture() const {
|
||||
return texture;
|
||||
}
|
||||
|
||||
void Particles2D::set_normal_map(const Ref<Texture2D> &p_normal_map) {
|
||||
void GPUParticles2D::set_normal_map(const Ref<Texture2D> &p_normal_map) {
|
||||
|
||||
normal_map = p_normal_map;
|
||||
update();
|
||||
}
|
||||
|
||||
Ref<Texture2D> Particles2D::get_normal_map() const {
|
||||
Ref<Texture2D> GPUParticles2D::get_normal_map() const {
|
||||
return normal_map;
|
||||
}
|
||||
|
||||
void Particles2D::_validate_property(PropertyInfo &property) const {
|
||||
void GPUParticles2D::_validate_property(PropertyInfo &property) const {
|
||||
}
|
||||
|
||||
void Particles2D::restart() {
|
||||
void GPUParticles2D::restart() {
|
||||
VS::get_singleton()->particles_restart(particles);
|
||||
VS::get_singleton()->particles_set_emitting(particles, true);
|
||||
}
|
||||
|
||||
void Particles2D::_notification(int p_what) {
|
||||
void GPUParticles2D::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_DRAW) {
|
||||
|
||||
@ -338,48 +338,48 @@ void Particles2D::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
void Particles2D::_bind_methods() {
|
||||
void GPUParticles2D::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &Particles2D::set_emitting);
|
||||
ClassDB::bind_method(D_METHOD("set_amount", "amount"), &Particles2D::set_amount);
|
||||
ClassDB::bind_method(D_METHOD("set_lifetime", "secs"), &Particles2D::set_lifetime);
|
||||
ClassDB::bind_method(D_METHOD("set_one_shot", "secs"), &Particles2D::set_one_shot);
|
||||
ClassDB::bind_method(D_METHOD("set_pre_process_time", "secs"), &Particles2D::set_pre_process_time);
|
||||
ClassDB::bind_method(D_METHOD("set_explosiveness_ratio", "ratio"), &Particles2D::set_explosiveness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("set_randomness_ratio", "ratio"), &Particles2D::set_randomness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("set_visibility_rect", "visibility_rect"), &Particles2D::set_visibility_rect);
|
||||
ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles2D::set_use_local_coordinates);
|
||||
ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles2D::set_fixed_fps);
|
||||
ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles2D::set_fractional_delta);
|
||||
ClassDB::bind_method(D_METHOD("set_process_material", "material"), &Particles2D::set_process_material);
|
||||
ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &Particles2D::set_speed_scale);
|
||||
ClassDB::bind_method(D_METHOD("set_emitting", "emitting"), &GPUParticles2D::set_emitting);
|
||||
ClassDB::bind_method(D_METHOD("set_amount", "amount"), &GPUParticles2D::set_amount);
|
||||
ClassDB::bind_method(D_METHOD("set_lifetime", "secs"), &GPUParticles2D::set_lifetime);
|
||||
ClassDB::bind_method(D_METHOD("set_one_shot", "secs"), &GPUParticles2D::set_one_shot);
|
||||
ClassDB::bind_method(D_METHOD("set_pre_process_time", "secs"), &GPUParticles2D::set_pre_process_time);
|
||||
ClassDB::bind_method(D_METHOD("set_explosiveness_ratio", "ratio"), &GPUParticles2D::set_explosiveness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("set_randomness_ratio", "ratio"), &GPUParticles2D::set_randomness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("set_visibility_rect", "visibility_rect"), &GPUParticles2D::set_visibility_rect);
|
||||
ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &GPUParticles2D::set_use_local_coordinates);
|
||||
ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &GPUParticles2D::set_fixed_fps);
|
||||
ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &GPUParticles2D::set_fractional_delta);
|
||||
ClassDB::bind_method(D_METHOD("set_process_material", "material"), &GPUParticles2D::set_process_material);
|
||||
ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &GPUParticles2D::set_speed_scale);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_emitting"), &Particles2D::is_emitting);
|
||||
ClassDB::bind_method(D_METHOD("get_amount"), &Particles2D::get_amount);
|
||||
ClassDB::bind_method(D_METHOD("get_lifetime"), &Particles2D::get_lifetime);
|
||||
ClassDB::bind_method(D_METHOD("get_one_shot"), &Particles2D::get_one_shot);
|
||||
ClassDB::bind_method(D_METHOD("get_pre_process_time"), &Particles2D::get_pre_process_time);
|
||||
ClassDB::bind_method(D_METHOD("get_explosiveness_ratio"), &Particles2D::get_explosiveness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("get_randomness_ratio"), &Particles2D::get_randomness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("get_visibility_rect"), &Particles2D::get_visibility_rect);
|
||||
ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &Particles2D::get_use_local_coordinates);
|
||||
ClassDB::bind_method(D_METHOD("get_fixed_fps"), &Particles2D::get_fixed_fps);
|
||||
ClassDB::bind_method(D_METHOD("get_fractional_delta"), &Particles2D::get_fractional_delta);
|
||||
ClassDB::bind_method(D_METHOD("get_process_material"), &Particles2D::get_process_material);
|
||||
ClassDB::bind_method(D_METHOD("get_speed_scale"), &Particles2D::get_speed_scale);
|
||||
ClassDB::bind_method(D_METHOD("is_emitting"), &GPUParticles2D::is_emitting);
|
||||
ClassDB::bind_method(D_METHOD("get_amount"), &GPUParticles2D::get_amount);
|
||||
ClassDB::bind_method(D_METHOD("get_lifetime"), &GPUParticles2D::get_lifetime);
|
||||
ClassDB::bind_method(D_METHOD("get_one_shot"), &GPUParticles2D::get_one_shot);
|
||||
ClassDB::bind_method(D_METHOD("get_pre_process_time"), &GPUParticles2D::get_pre_process_time);
|
||||
ClassDB::bind_method(D_METHOD("get_explosiveness_ratio"), &GPUParticles2D::get_explosiveness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("get_randomness_ratio"), &GPUParticles2D::get_randomness_ratio);
|
||||
ClassDB::bind_method(D_METHOD("get_visibility_rect"), &GPUParticles2D::get_visibility_rect);
|
||||
ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &GPUParticles2D::get_use_local_coordinates);
|
||||
ClassDB::bind_method(D_METHOD("get_fixed_fps"), &GPUParticles2D::get_fixed_fps);
|
||||
ClassDB::bind_method(D_METHOD("get_fractional_delta"), &GPUParticles2D::get_fractional_delta);
|
||||
ClassDB::bind_method(D_METHOD("get_process_material"), &GPUParticles2D::get_process_material);
|
||||
ClassDB::bind_method(D_METHOD("get_speed_scale"), &GPUParticles2D::get_speed_scale);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &Particles2D::set_draw_order);
|
||||
ClassDB::bind_method(D_METHOD("get_draw_order"), &Particles2D::get_draw_order);
|
||||
ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &GPUParticles2D::set_draw_order);
|
||||
ClassDB::bind_method(D_METHOD("get_draw_order"), &GPUParticles2D::get_draw_order);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Particles2D::set_texture);
|
||||
ClassDB::bind_method(D_METHOD("get_texture"), &Particles2D::get_texture);
|
||||
ClassDB::bind_method(D_METHOD("set_texture", "texture"), &GPUParticles2D::set_texture);
|
||||
ClassDB::bind_method(D_METHOD("get_texture"), &GPUParticles2D::get_texture);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_normal_map", "texture"), &Particles2D::set_normal_map);
|
||||
ClassDB::bind_method(D_METHOD("get_normal_map"), &Particles2D::get_normal_map);
|
||||
ClassDB::bind_method(D_METHOD("set_normal_map", "texture"), &GPUParticles2D::set_normal_map);
|
||||
ClassDB::bind_method(D_METHOD("get_normal_map"), &GPUParticles2D::get_normal_map);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("capture_rect"), &Particles2D::capture_rect);
|
||||
ClassDB::bind_method(D_METHOD("capture_rect"), &GPUParticles2D::capture_rect);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("restart"), &Particles2D::restart);
|
||||
ClassDB::bind_method(D_METHOD("restart"), &GPUParticles2D::restart);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_EXP_RANGE, "1,1000000,1"), "set_amount", "get_amount");
|
||||
@ -406,7 +406,7 @@ void Particles2D::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(DRAW_ORDER_LIFETIME);
|
||||
}
|
||||
|
||||
Particles2D::Particles2D() {
|
||||
GPUParticles2D::GPUParticles2D() {
|
||||
|
||||
particles = VS::get_singleton()->particles_create();
|
||||
|
||||
@ -426,7 +426,7 @@ Particles2D::Particles2D() {
|
||||
set_speed_scale(1);
|
||||
}
|
||||
|
||||
Particles2D::~Particles2D() {
|
||||
GPUParticles2D::~GPUParticles2D() {
|
||||
|
||||
VS::get_singleton()->free(particles);
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* particles_2d.h */
|
||||
/* gpu_particles_2d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -35,9 +35,9 @@
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
class Particles2D : public Node2D {
|
||||
class GPUParticles2D : public Node2D {
|
||||
private:
|
||||
GDCLASS(Particles2D, Node2D);
|
||||
GDCLASS(GPUParticles2D, Node2D);
|
||||
|
||||
public:
|
||||
enum DrawOrder {
|
||||
@ -118,10 +118,10 @@ public:
|
||||
|
||||
void restart();
|
||||
Rect2 capture_rect() const;
|
||||
Particles2D();
|
||||
~Particles2D();
|
||||
GPUParticles2D();
|
||||
~GPUParticles2D();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(Particles2D::DrawOrder)
|
||||
VARIANT_ENUM_CAST(GPUParticles2D::DrawOrder)
|
||||
|
||||
#endif // PARTICLES_2D_H
|
||||
@ -31,7 +31,7 @@
|
||||
#ifndef NAVIGATION_2D_H
|
||||
#define NAVIGATION_2D_H
|
||||
|
||||
#include "scene/2d/navigation_polygon.h"
|
||||
#include "scene/2d/navigation_region_2d.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
|
||||
class Navigation2D : public Node2D {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* navigation_polygon.cpp */
|
||||
/* navigation_region_2d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -28,7 +28,7 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "navigation_polygon.h"
|
||||
#include "navigation_region_2d.h"
|
||||
|
||||
#include "core/core_string_names.h"
|
||||
#include "core/engine.h"
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* navigation_polygon.h */
|
||||
/* navigation_region_2d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -28,8 +28,8 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef NAVIGATION_POLYGON_H
|
||||
#define NAVIGATION_POLYGON_H
|
||||
#ifndef NAVIGATION_REGION_2D_H
|
||||
#define NAVIGATION_REGION_2D_H
|
||||
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/resources/navigation_mesh.h"
|
||||
@ -127,4 +127,4 @@ public:
|
||||
~NavigationRegion2D();
|
||||
};
|
||||
|
||||
#endif // NAVIGATIONPOLYGON_H
|
||||
#endif // NAVIGATION_REGION_2D_H
|
||||
@ -31,7 +31,7 @@
|
||||
#ifndef NODE2D_H
|
||||
#define NODE2D_H
|
||||
|
||||
#include "scene/2d/canvas_item.h"
|
||||
#include "scene/main/canvas_item.h"
|
||||
|
||||
class Node2D : public CanvasItem {
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
#include "visibility_notifier_2d.h"
|
||||
|
||||
#include "core/engine.h"
|
||||
#include "particles_2d.h"
|
||||
#include "gpu_particles_2d.h"
|
||||
#include "scene/2d/animated_sprite_2d.h"
|
||||
#include "scene/2d/physics_body_2d.h"
|
||||
#include "scene/animation/animation_player.h"
|
||||
@ -212,7 +212,7 @@ void VisibilityEnabler2D::_find_nodes(Node *p_node) {
|
||||
}
|
||||
|
||||
{
|
||||
Particles2D *ps = Object::cast_to<Particles2D>(p_node);
|
||||
GPUParticles2D *ps = Object::cast_to<GPUParticles2D>(p_node);
|
||||
if (ps) {
|
||||
add = true;
|
||||
}
|
||||
@ -304,7 +304,7 @@ void VisibilityEnabler2D::_change_node_state(Node *p_node, bool p_enabled) {
|
||||
}
|
||||
|
||||
if (enabler[ENABLER_PAUSE_PARTICLES]) {
|
||||
Particles2D *ps = Object::cast_to<Particles2D>(p_node);
|
||||
GPUParticles2D *ps = Object::cast_to<GPUParticles2D>(p_node);
|
||||
|
||||
if (ps) {
|
||||
|
||||
|
||||
@ -384,7 +384,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
|
||||
linear_velocity = velocity_tracker->get_tracked_linear_velocity();
|
||||
}
|
||||
|
||||
Ref<World> world = get_world();
|
||||
Ref<World3D> world = get_world();
|
||||
ERR_FAIL_COND(world.is_null());
|
||||
|
||||
int new_output_count = 0;
|
||||
|
||||
@ -726,13 +726,13 @@ Camera3D::~Camera3D() {
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
void ClippedCamera::set_margin(float p_margin) {
|
||||
void ClippedCamera3D::set_margin(float p_margin) {
|
||||
margin = p_margin;
|
||||
}
|
||||
float ClippedCamera::get_margin() const {
|
||||
float ClippedCamera3D::get_margin() const {
|
||||
return margin;
|
||||
}
|
||||
void ClippedCamera::set_process_mode(ProcessMode p_mode) {
|
||||
void ClippedCamera3D::set_process_mode(ProcessMode p_mode) {
|
||||
|
||||
if (process_mode == p_mode) {
|
||||
return;
|
||||
@ -741,18 +741,18 @@ void ClippedCamera::set_process_mode(ProcessMode p_mode) {
|
||||
set_process_internal(process_mode == CLIP_PROCESS_IDLE);
|
||||
set_physics_process_internal(process_mode == CLIP_PROCESS_PHYSICS);
|
||||
}
|
||||
ClippedCamera::ProcessMode ClippedCamera::get_process_mode() const {
|
||||
ClippedCamera3D::ProcessMode ClippedCamera3D::get_process_mode() const {
|
||||
return process_mode;
|
||||
}
|
||||
|
||||
Transform ClippedCamera::get_camera_transform() const {
|
||||
Transform ClippedCamera3D::get_camera_transform() const {
|
||||
|
||||
Transform t = Camera3D::get_camera_transform();
|
||||
t.origin += -t.basis.get_axis(Vector3::AXIS_Z).normalized() * clip_offset;
|
||||
return t;
|
||||
}
|
||||
|
||||
void ClippedCamera::_notification(int p_what) {
|
||||
void ClippedCamera3D::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_INTERNAL_PROCESS || p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
|
||||
|
||||
Node3D *parent = Object::cast_to<Node3D>(get_parent());
|
||||
@ -813,17 +813,17 @@ void ClippedCamera::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
void ClippedCamera::set_collision_mask(uint32_t p_mask) {
|
||||
void ClippedCamera3D::set_collision_mask(uint32_t p_mask) {
|
||||
|
||||
collision_mask = p_mask;
|
||||
}
|
||||
|
||||
uint32_t ClippedCamera::get_collision_mask() const {
|
||||
uint32_t ClippedCamera3D::get_collision_mask() const {
|
||||
|
||||
return collision_mask;
|
||||
}
|
||||
|
||||
void ClippedCamera::set_collision_mask_bit(int p_bit, bool p_value) {
|
||||
void ClippedCamera3D::set_collision_mask_bit(int p_bit, bool p_value) {
|
||||
|
||||
uint32_t mask = get_collision_mask();
|
||||
if (p_value)
|
||||
@ -833,17 +833,17 @@ void ClippedCamera::set_collision_mask_bit(int p_bit, bool p_value) {
|
||||
set_collision_mask(mask);
|
||||
}
|
||||
|
||||
bool ClippedCamera::get_collision_mask_bit(int p_bit) const {
|
||||
bool ClippedCamera3D::get_collision_mask_bit(int p_bit) const {
|
||||
|
||||
return get_collision_mask() & (1 << p_bit);
|
||||
}
|
||||
|
||||
void ClippedCamera::add_exception_rid(const RID &p_rid) {
|
||||
void ClippedCamera3D::add_exception_rid(const RID &p_rid) {
|
||||
|
||||
exclude.insert(p_rid);
|
||||
}
|
||||
|
||||
void ClippedCamera::add_exception(const Object *p_object) {
|
||||
void ClippedCamera3D::add_exception(const Object *p_object) {
|
||||
|
||||
ERR_FAIL_NULL(p_object);
|
||||
const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object);
|
||||
@ -852,12 +852,12 @@ void ClippedCamera::add_exception(const Object *p_object) {
|
||||
add_exception_rid(co->get_rid());
|
||||
}
|
||||
|
||||
void ClippedCamera::remove_exception_rid(const RID &p_rid) {
|
||||
void ClippedCamera3D::remove_exception_rid(const RID &p_rid) {
|
||||
|
||||
exclude.erase(p_rid);
|
||||
}
|
||||
|
||||
void ClippedCamera::remove_exception(const Object *p_object) {
|
||||
void ClippedCamera3D::remove_exception(const Object *p_object) {
|
||||
|
||||
ERR_FAIL_NULL(p_object);
|
||||
const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object);
|
||||
@ -866,65 +866,65 @@ void ClippedCamera::remove_exception(const Object *p_object) {
|
||||
remove_exception_rid(co->get_rid());
|
||||
}
|
||||
|
||||
void ClippedCamera::clear_exceptions() {
|
||||
void ClippedCamera3D::clear_exceptions() {
|
||||
|
||||
exclude.clear();
|
||||
}
|
||||
|
||||
float ClippedCamera::get_clip_offset() const {
|
||||
float ClippedCamera3D::get_clip_offset() const {
|
||||
|
||||
return clip_offset;
|
||||
}
|
||||
|
||||
void ClippedCamera::set_clip_to_areas(bool p_clip) {
|
||||
void ClippedCamera3D::set_clip_to_areas(bool p_clip) {
|
||||
|
||||
clip_to_areas = p_clip;
|
||||
}
|
||||
|
||||
bool ClippedCamera::is_clip_to_areas_enabled() const {
|
||||
bool ClippedCamera3D::is_clip_to_areas_enabled() const {
|
||||
|
||||
return clip_to_areas;
|
||||
}
|
||||
|
||||
void ClippedCamera::set_clip_to_bodies(bool p_clip) {
|
||||
void ClippedCamera3D::set_clip_to_bodies(bool p_clip) {
|
||||
|
||||
clip_to_bodies = p_clip;
|
||||
}
|
||||
|
||||
bool ClippedCamera::is_clip_to_bodies_enabled() const {
|
||||
bool ClippedCamera3D::is_clip_to_bodies_enabled() const {
|
||||
|
||||
return clip_to_bodies;
|
||||
}
|
||||
|
||||
void ClippedCamera::_bind_methods() {
|
||||
void ClippedCamera3D::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_margin", "margin"), &ClippedCamera::set_margin);
|
||||
ClassDB::bind_method(D_METHOD("get_margin"), &ClippedCamera::get_margin);
|
||||
ClassDB::bind_method(D_METHOD("set_margin", "margin"), &ClippedCamera3D::set_margin);
|
||||
ClassDB::bind_method(D_METHOD("get_margin"), &ClippedCamera3D::get_margin);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_process_mode", "process_mode"), &ClippedCamera::set_process_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_process_mode"), &ClippedCamera::get_process_mode);
|
||||
ClassDB::bind_method(D_METHOD("set_process_mode", "process_mode"), &ClippedCamera3D::set_process_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_process_mode"), &ClippedCamera3D::get_process_mode);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &ClippedCamera::set_collision_mask);
|
||||
ClassDB::bind_method(D_METHOD("get_collision_mask"), &ClippedCamera::get_collision_mask);
|
||||
ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &ClippedCamera3D::set_collision_mask);
|
||||
ClassDB::bind_method(D_METHOD("get_collision_mask"), &ClippedCamera3D::get_collision_mask);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &ClippedCamera::set_collision_mask_bit);
|
||||
ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &ClippedCamera::get_collision_mask_bit);
|
||||
ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &ClippedCamera3D::set_collision_mask_bit);
|
||||
ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &ClippedCamera3D::get_collision_mask_bit);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_exception_rid", "rid"), &ClippedCamera::add_exception_rid);
|
||||
ClassDB::bind_method(D_METHOD("add_exception", "node"), &ClippedCamera::add_exception);
|
||||
ClassDB::bind_method(D_METHOD("add_exception_rid", "rid"), &ClippedCamera3D::add_exception_rid);
|
||||
ClassDB::bind_method(D_METHOD("add_exception", "node"), &ClippedCamera3D::add_exception);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("remove_exception_rid", "rid"), &ClippedCamera::remove_exception_rid);
|
||||
ClassDB::bind_method(D_METHOD("remove_exception", "node"), &ClippedCamera::remove_exception);
|
||||
ClassDB::bind_method(D_METHOD("remove_exception_rid", "rid"), &ClippedCamera3D::remove_exception_rid);
|
||||
ClassDB::bind_method(D_METHOD("remove_exception", "node"), &ClippedCamera3D::remove_exception);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_clip_to_areas", "enable"), &ClippedCamera::set_clip_to_areas);
|
||||
ClassDB::bind_method(D_METHOD("is_clip_to_areas_enabled"), &ClippedCamera::is_clip_to_areas_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_clip_to_areas", "enable"), &ClippedCamera3D::set_clip_to_areas);
|
||||
ClassDB::bind_method(D_METHOD("is_clip_to_areas_enabled"), &ClippedCamera3D::is_clip_to_areas_enabled);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_clip_offset"), &ClippedCamera::get_clip_offset);
|
||||
ClassDB::bind_method(D_METHOD("get_clip_offset"), &ClippedCamera3D::get_clip_offset);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_clip_to_bodies", "enable"), &ClippedCamera::set_clip_to_bodies);
|
||||
ClassDB::bind_method(D_METHOD("is_clip_to_bodies_enabled"), &ClippedCamera::is_clip_to_bodies_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_clip_to_bodies", "enable"), &ClippedCamera3D::set_clip_to_bodies);
|
||||
ClassDB::bind_method(D_METHOD("is_clip_to_bodies_enabled"), &ClippedCamera3D::is_clip_to_bodies_enabled);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("clear_exceptions"), &ClippedCamera::clear_exceptions);
|
||||
ClassDB::bind_method(D_METHOD("clear_exceptions"), &ClippedCamera3D::clear_exceptions);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_margin", "get_margin");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_process_mode", "get_process_mode");
|
||||
@ -937,7 +937,7 @@ void ClippedCamera::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(CLIP_PROCESS_PHYSICS);
|
||||
BIND_ENUM_CONSTANT(CLIP_PROCESS_IDLE);
|
||||
}
|
||||
ClippedCamera::ClippedCamera() {
|
||||
ClippedCamera3D::ClippedCamera3D() {
|
||||
margin = 0;
|
||||
clip_offset = 0;
|
||||
process_mode = CLIP_PROCESS_PHYSICS;
|
||||
@ -949,6 +949,6 @@ ClippedCamera::ClippedCamera() {
|
||||
clip_to_areas = false;
|
||||
clip_to_bodies = true;
|
||||
}
|
||||
ClippedCamera::~ClippedCamera() {
|
||||
ClippedCamera3D::~ClippedCamera3D() {
|
||||
PhysicsServer::get_singleton()->free(pyramid_shape);
|
||||
}
|
||||
|
||||
@ -48,10 +48,8 @@ public:
|
||||
PROJECTION_FRUSTUM
|
||||
};
|
||||
|
||||
enum KeepAspect {
|
||||
KEEP_WIDTH,
|
||||
KEEP_HEIGHT
|
||||
};
|
||||
enum KeepAspect { KEEP_WIDTH,
|
||||
KEEP_HEIGHT };
|
||||
|
||||
enum DopplerTracking {
|
||||
DOPPLER_TRACKING_DISABLED,
|
||||
@ -77,7 +75,7 @@ private:
|
||||
RID camera;
|
||||
RID scenario_id;
|
||||
|
||||
//String camera_group;
|
||||
// String camera_group;
|
||||
|
||||
uint32_t layers;
|
||||
|
||||
@ -86,7 +84,7 @@ private:
|
||||
|
||||
virtual bool _can_gizmo_scale() const;
|
||||
|
||||
//void _camera_make_current(Node *p_camera);
|
||||
// void _camera_make_current(Node *p_camera);
|
||||
friend class Viewport;
|
||||
void _update_audio_listener_state();
|
||||
|
||||
@ -112,7 +110,8 @@ public:
|
||||
|
||||
void set_perspective(float p_fovy_degrees, float p_z_near, float p_z_far);
|
||||
void set_orthogonal(float p_size, float p_z_near, float p_z_far);
|
||||
void set_frustum(float p_size, Vector2 p_offset, float p_z_near, float p_z_far);
|
||||
void set_frustum(float p_size, Vector2 p_offset, float p_z_near,
|
||||
float p_z_far);
|
||||
void set_projection(Camera3D::Projection p_mode);
|
||||
|
||||
void make_current();
|
||||
@ -143,7 +142,8 @@ public:
|
||||
virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const;
|
||||
virtual Point2 unproject_position(const Vector3 &p_pos) const;
|
||||
bool is_position_behind(const Vector3 &p_pos) const;
|
||||
virtual Vector3 project_position(const Point2 &p_point, float p_z_depth) const;
|
||||
virtual Vector3 project_position(const Point2 &p_point,
|
||||
float p_z_depth) const;
|
||||
|
||||
Vector<Vector3> get_near_plane_points() const;
|
||||
|
||||
@ -183,9 +183,9 @@ VARIANT_ENUM_CAST(Camera3D::Projection);
|
||||
VARIANT_ENUM_CAST(Camera3D::KeepAspect);
|
||||
VARIANT_ENUM_CAST(Camera3D::DopplerTracking);
|
||||
|
||||
class ClippedCamera : public Camera3D {
|
||||
class ClippedCamera3D : public Camera3D {
|
||||
|
||||
GDCLASS(ClippedCamera, Camera3D);
|
||||
GDCLASS(ClippedCamera3D, Camera3D);
|
||||
|
||||
public:
|
||||
enum ProcessMode {
|
||||
@ -238,9 +238,9 @@ public:
|
||||
|
||||
float get_clip_offset() const;
|
||||
|
||||
ClippedCamera();
|
||||
~ClippedCamera();
|
||||
ClippedCamera3D();
|
||||
~ClippedCamera3D();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(ClippedCamera::ProcessMode);
|
||||
VARIANT_ENUM_CAST(ClippedCamera3D::ProcessMode);
|
||||
#endif
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
#include "scene/resources/capsule_shape_3d.h"
|
||||
#include "scene/resources/concave_polygon_shape_3d.h"
|
||||
#include "scene/resources/convex_polygon_shape_3d.h"
|
||||
#include "scene/resources/ray_shape.h"
|
||||
#include "scene/resources/ray_shape_3d.h"
|
||||
#include "scene/resources/sphere_shape_3d.h"
|
||||
#include "scene/resources/world_margin_shape_3d.h"
|
||||
#include "servers/visual_server.h"
|
||||
|
||||
@ -507,10 +507,10 @@ bool Node3D::is_set_as_toplevel() const {
|
||||
return data.toplevel;
|
||||
}
|
||||
|
||||
Ref<World> Node3D::get_world() const {
|
||||
Ref<World3D> Node3D::get_world() const {
|
||||
|
||||
ERR_FAIL_COND_V(!is_inside_world(), Ref<World>());
|
||||
ERR_FAIL_COND_V(!data.viewport, Ref<World>());
|
||||
ERR_FAIL_COND_V(!is_inside_world(), Ref<World3D>());
|
||||
ERR_FAIL_COND_V(!data.viewport, Ref<World3D>());
|
||||
|
||||
return data.viewport->find_world();
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ public:
|
||||
|
||||
Node3D *get_parent_spatial() const;
|
||||
|
||||
Ref<World> get_world() const;
|
||||
Ref<World3D> get_world() const;
|
||||
|
||||
void set_translation(const Vector3 &p_translation);
|
||||
void set_rotation(const Vector3 &p_euler_rad);
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
#include "servers/navigation_server.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/plugins/spatial_editor_plugin.h"
|
||||
#include "editor/plugins/node_3d_editor_plugin.h"
|
||||
#endif
|
||||
|
||||
Vector3 PhysicsBody3D::get_linear_velocity() const {
|
||||
|
||||
@ -196,7 +196,7 @@ void RayCast3D::_notification(int p_what) {
|
||||
}
|
||||
|
||||
void RayCast3D::_update_raycast_state() {
|
||||
Ref<World> w3d = get_world();
|
||||
Ref<World3D> w3d = get_world();
|
||||
ERR_FAIL_COND(w3d.is_null());
|
||||
|
||||
PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* skeleton_ik.cpp */
|
||||
/* skeleton_ik_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -32,7 +32,7 @@
|
||||
* @author AndreaCatania
|
||||
*/
|
||||
|
||||
#include "skeleton_ik.h"
|
||||
#include "skeleton_ik_3d.h"
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* skeleton_ik.h */
|
||||
/* skeleton_ik_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* vehicle_body.cpp */
|
||||
/* vehicle_body_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -28,7 +28,7 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "vehicle_body.h"
|
||||
#include "vehicle_body_3d.h"
|
||||
|
||||
#define ROLLING_INFLUENCE_FIX
|
||||
|
||||
@ -78,11 +78,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
void VehicleWheel::_notification(int p_what) {
|
||||
void VehicleWheel3D::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
|
||||
VehicleBody *cb = Object::cast_to<VehicleBody>(get_parent());
|
||||
VehicleBody3D *cb = Object::cast_to<VehicleBody3D>(get_parent());
|
||||
if (!cb)
|
||||
return;
|
||||
body = cb;
|
||||
@ -95,7 +95,7 @@ void VehicleWheel::_notification(int p_what) {
|
||||
}
|
||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
||||
|
||||
VehicleBody *cb = Object::cast_to<VehicleBody>(get_parent());
|
||||
VehicleBody3D *cb = Object::cast_to<VehicleBody3D>(get_parent());
|
||||
if (!cb)
|
||||
return;
|
||||
cb->wheels.erase(this);
|
||||
@ -103,15 +103,15 @@ void VehicleWheel::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
String VehicleWheel::get_configuration_warning() const {
|
||||
if (!Object::cast_to<VehicleBody>(get_parent())) {
|
||||
String VehicleWheel3D::get_configuration_warning() const {
|
||||
if (!Object::cast_to<VehicleBody3D>(get_parent())) {
|
||||
return TTR("VehicleWheel serves to provide a wheel system to a VehicleBody. Please use it as a child of a VehicleBody.");
|
||||
}
|
||||
|
||||
return String();
|
||||
}
|
||||
|
||||
void VehicleWheel::_update(PhysicsDirectBodyState *s) {
|
||||
void VehicleWheel3D::_update(PhysicsDirectBodyState *s) {
|
||||
|
||||
if (m_raycastInfo.m_isInContact)
|
||||
|
||||
@ -144,142 +144,142 @@ void VehicleWheel::_update(PhysicsDirectBodyState *s) {
|
||||
}
|
||||
}
|
||||
|
||||
void VehicleWheel::set_radius(float p_radius) {
|
||||
void VehicleWheel3D::set_radius(float p_radius) {
|
||||
|
||||
m_wheelRadius = p_radius;
|
||||
update_gizmo();
|
||||
}
|
||||
|
||||
float VehicleWheel::get_radius() const {
|
||||
float VehicleWheel3D::get_radius() const {
|
||||
|
||||
return m_wheelRadius;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_suspension_rest_length(float p_length) {
|
||||
void VehicleWheel3D::set_suspension_rest_length(float p_length) {
|
||||
|
||||
m_suspensionRestLength = p_length;
|
||||
update_gizmo();
|
||||
}
|
||||
float VehicleWheel::get_suspension_rest_length() const {
|
||||
float VehicleWheel3D::get_suspension_rest_length() const {
|
||||
|
||||
return m_suspensionRestLength;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_suspension_travel(float p_length) {
|
||||
void VehicleWheel3D::set_suspension_travel(float p_length) {
|
||||
|
||||
m_maxSuspensionTravelCm = p_length / 0.01;
|
||||
}
|
||||
float VehicleWheel::get_suspension_travel() const {
|
||||
float VehicleWheel3D::get_suspension_travel() const {
|
||||
|
||||
return m_maxSuspensionTravelCm * 0.01;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_suspension_stiffness(float p_value) {
|
||||
void VehicleWheel3D::set_suspension_stiffness(float p_value) {
|
||||
|
||||
m_suspensionStiffness = p_value;
|
||||
}
|
||||
float VehicleWheel::get_suspension_stiffness() const {
|
||||
float VehicleWheel3D::get_suspension_stiffness() const {
|
||||
|
||||
return m_suspensionStiffness;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_suspension_max_force(float p_value) {
|
||||
void VehicleWheel3D::set_suspension_max_force(float p_value) {
|
||||
|
||||
m_maxSuspensionForce = p_value;
|
||||
}
|
||||
float VehicleWheel::get_suspension_max_force() const {
|
||||
float VehicleWheel3D::get_suspension_max_force() const {
|
||||
|
||||
return m_maxSuspensionForce;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_damping_compression(float p_value) {
|
||||
void VehicleWheel3D::set_damping_compression(float p_value) {
|
||||
|
||||
m_wheelsDampingCompression = p_value;
|
||||
}
|
||||
float VehicleWheel::get_damping_compression() const {
|
||||
float VehicleWheel3D::get_damping_compression() const {
|
||||
|
||||
return m_wheelsDampingCompression;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_damping_relaxation(float p_value) {
|
||||
void VehicleWheel3D::set_damping_relaxation(float p_value) {
|
||||
|
||||
m_wheelsDampingRelaxation = p_value;
|
||||
}
|
||||
float VehicleWheel::get_damping_relaxation() const {
|
||||
float VehicleWheel3D::get_damping_relaxation() const {
|
||||
|
||||
return m_wheelsDampingRelaxation;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_friction_slip(float p_value) {
|
||||
void VehicleWheel3D::set_friction_slip(float p_value) {
|
||||
|
||||
m_frictionSlip = p_value;
|
||||
}
|
||||
float VehicleWheel::get_friction_slip() const {
|
||||
float VehicleWheel3D::get_friction_slip() const {
|
||||
|
||||
return m_frictionSlip;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_roll_influence(float p_value) {
|
||||
void VehicleWheel3D::set_roll_influence(float p_value) {
|
||||
m_rollInfluence = p_value;
|
||||
}
|
||||
|
||||
float VehicleWheel::get_roll_influence() const {
|
||||
float VehicleWheel3D::get_roll_influence() const {
|
||||
return m_rollInfluence;
|
||||
}
|
||||
|
||||
bool VehicleWheel::is_in_contact() const {
|
||||
bool VehicleWheel3D::is_in_contact() const {
|
||||
return m_raycastInfo.m_isInContact;
|
||||
}
|
||||
|
||||
void VehicleWheel::_bind_methods() {
|
||||
void VehicleWheel3D::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_radius", "length"), &VehicleWheel::set_radius);
|
||||
ClassDB::bind_method(D_METHOD("get_radius"), &VehicleWheel::get_radius);
|
||||
ClassDB::bind_method(D_METHOD("set_radius", "length"), &VehicleWheel3D::set_radius);
|
||||
ClassDB::bind_method(D_METHOD("get_radius"), &VehicleWheel3D::get_radius);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_rest_length", "length"), &VehicleWheel::set_suspension_rest_length);
|
||||
ClassDB::bind_method(D_METHOD("get_suspension_rest_length"), &VehicleWheel::get_suspension_rest_length);
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_rest_length", "length"), &VehicleWheel3D::set_suspension_rest_length);
|
||||
ClassDB::bind_method(D_METHOD("get_suspension_rest_length"), &VehicleWheel3D::get_suspension_rest_length);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_travel", "length"), &VehicleWheel::set_suspension_travel);
|
||||
ClassDB::bind_method(D_METHOD("get_suspension_travel"), &VehicleWheel::get_suspension_travel);
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_travel", "length"), &VehicleWheel3D::set_suspension_travel);
|
||||
ClassDB::bind_method(D_METHOD("get_suspension_travel"), &VehicleWheel3D::get_suspension_travel);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_stiffness", "length"), &VehicleWheel::set_suspension_stiffness);
|
||||
ClassDB::bind_method(D_METHOD("get_suspension_stiffness"), &VehicleWheel::get_suspension_stiffness);
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_stiffness", "length"), &VehicleWheel3D::set_suspension_stiffness);
|
||||
ClassDB::bind_method(D_METHOD("get_suspension_stiffness"), &VehicleWheel3D::get_suspension_stiffness);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_max_force", "length"), &VehicleWheel::set_suspension_max_force);
|
||||
ClassDB::bind_method(D_METHOD("get_suspension_max_force"), &VehicleWheel::get_suspension_max_force);
|
||||
ClassDB::bind_method(D_METHOD("set_suspension_max_force", "length"), &VehicleWheel3D::set_suspension_max_force);
|
||||
ClassDB::bind_method(D_METHOD("get_suspension_max_force"), &VehicleWheel3D::get_suspension_max_force);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_damping_compression", "length"), &VehicleWheel::set_damping_compression);
|
||||
ClassDB::bind_method(D_METHOD("get_damping_compression"), &VehicleWheel::get_damping_compression);
|
||||
ClassDB::bind_method(D_METHOD("set_damping_compression", "length"), &VehicleWheel3D::set_damping_compression);
|
||||
ClassDB::bind_method(D_METHOD("get_damping_compression"), &VehicleWheel3D::get_damping_compression);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_damping_relaxation", "length"), &VehicleWheel::set_damping_relaxation);
|
||||
ClassDB::bind_method(D_METHOD("get_damping_relaxation"), &VehicleWheel::get_damping_relaxation);
|
||||
ClassDB::bind_method(D_METHOD("set_damping_relaxation", "length"), &VehicleWheel3D::set_damping_relaxation);
|
||||
ClassDB::bind_method(D_METHOD("get_damping_relaxation"), &VehicleWheel3D::get_damping_relaxation);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_use_as_traction", "enable"), &VehicleWheel::set_use_as_traction);
|
||||
ClassDB::bind_method(D_METHOD("is_used_as_traction"), &VehicleWheel::is_used_as_traction);
|
||||
ClassDB::bind_method(D_METHOD("set_use_as_traction", "enable"), &VehicleWheel3D::set_use_as_traction);
|
||||
ClassDB::bind_method(D_METHOD("is_used_as_traction"), &VehicleWheel3D::is_used_as_traction);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_use_as_steering", "enable"), &VehicleWheel::set_use_as_steering);
|
||||
ClassDB::bind_method(D_METHOD("is_used_as_steering"), &VehicleWheel::is_used_as_steering);
|
||||
ClassDB::bind_method(D_METHOD("set_use_as_steering", "enable"), &VehicleWheel3D::set_use_as_steering);
|
||||
ClassDB::bind_method(D_METHOD("is_used_as_steering"), &VehicleWheel3D::is_used_as_steering);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_friction_slip", "length"), &VehicleWheel::set_friction_slip);
|
||||
ClassDB::bind_method(D_METHOD("get_friction_slip"), &VehicleWheel::get_friction_slip);
|
||||
ClassDB::bind_method(D_METHOD("set_friction_slip", "length"), &VehicleWheel3D::set_friction_slip);
|
||||
ClassDB::bind_method(D_METHOD("get_friction_slip"), &VehicleWheel3D::get_friction_slip);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_in_contact"), &VehicleWheel::is_in_contact);
|
||||
ClassDB::bind_method(D_METHOD("is_in_contact"), &VehicleWheel3D::is_in_contact);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_roll_influence", "roll_influence"), &VehicleWheel::set_roll_influence);
|
||||
ClassDB::bind_method(D_METHOD("get_roll_influence"), &VehicleWheel::get_roll_influence);
|
||||
ClassDB::bind_method(D_METHOD("set_roll_influence", "roll_influence"), &VehicleWheel3D::set_roll_influence);
|
||||
ClassDB::bind_method(D_METHOD("get_roll_influence"), &VehicleWheel3D::get_roll_influence);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_skidinfo"), &VehicleWheel::get_skidinfo);
|
||||
ClassDB::bind_method(D_METHOD("get_skidinfo"), &VehicleWheel3D::get_skidinfo);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_rpm"), &VehicleWheel::get_rpm);
|
||||
ClassDB::bind_method(D_METHOD("get_rpm"), &VehicleWheel3D::get_rpm);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleWheel::set_engine_force);
|
||||
ClassDB::bind_method(D_METHOD("get_engine_force"), &VehicleWheel::get_engine_force);
|
||||
ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleWheel3D::set_engine_force);
|
||||
ClassDB::bind_method(D_METHOD("get_engine_force"), &VehicleWheel3D::get_engine_force);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_brake", "brake"), &VehicleWheel::set_brake);
|
||||
ClassDB::bind_method(D_METHOD("get_brake"), &VehicleWheel::get_brake);
|
||||
ClassDB::bind_method(D_METHOD("set_brake", "brake"), &VehicleWheel3D::set_brake);
|
||||
ClassDB::bind_method(D_METHOD("get_brake"), &VehicleWheel3D::get_brake);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleWheel::set_steering);
|
||||
ClassDB::bind_method(D_METHOD("get_steering"), &VehicleWheel::get_steering);
|
||||
ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleWheel3D::set_steering);
|
||||
ClassDB::bind_method(D_METHOD("get_steering"), &VehicleWheel3D::get_steering);
|
||||
|
||||
ADD_GROUP("Per-Wheel Motion", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01,or_greater"), "set_engine_force", "get_engine_force");
|
||||
@ -302,65 +302,65 @@ void VehicleWheel::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "damping_relaxation"), "set_damping_relaxation", "get_damping_relaxation");
|
||||
}
|
||||
|
||||
void VehicleWheel::set_engine_force(float p_engine_force) {
|
||||
void VehicleWheel3D::set_engine_force(float p_engine_force) {
|
||||
|
||||
m_engineForce = p_engine_force;
|
||||
}
|
||||
|
||||
float VehicleWheel::get_engine_force() const {
|
||||
float VehicleWheel3D::get_engine_force() const {
|
||||
|
||||
return m_engineForce;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_brake(float p_brake) {
|
||||
void VehicleWheel3D::set_brake(float p_brake) {
|
||||
|
||||
m_brake = p_brake;
|
||||
}
|
||||
float VehicleWheel::get_brake() const {
|
||||
float VehicleWheel3D::get_brake() const {
|
||||
|
||||
return m_brake;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_steering(float p_steering) {
|
||||
void VehicleWheel3D::set_steering(float p_steering) {
|
||||
|
||||
m_steering = p_steering;
|
||||
}
|
||||
float VehicleWheel::get_steering() const {
|
||||
float VehicleWheel3D::get_steering() const {
|
||||
|
||||
return m_steering;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_use_as_traction(bool p_enable) {
|
||||
void VehicleWheel3D::set_use_as_traction(bool p_enable) {
|
||||
|
||||
engine_traction = p_enable;
|
||||
}
|
||||
|
||||
bool VehicleWheel::is_used_as_traction() const {
|
||||
bool VehicleWheel3D::is_used_as_traction() const {
|
||||
|
||||
return engine_traction;
|
||||
}
|
||||
|
||||
void VehicleWheel::set_use_as_steering(bool p_enabled) {
|
||||
void VehicleWheel3D::set_use_as_steering(bool p_enabled) {
|
||||
|
||||
steers = p_enabled;
|
||||
}
|
||||
|
||||
bool VehicleWheel::is_used_as_steering() const {
|
||||
bool VehicleWheel3D::is_used_as_steering() const {
|
||||
|
||||
return steers;
|
||||
}
|
||||
|
||||
float VehicleWheel::get_skidinfo() const {
|
||||
float VehicleWheel3D::get_skidinfo() const {
|
||||
|
||||
return m_skidInfo;
|
||||
}
|
||||
|
||||
float VehicleWheel::get_rpm() const {
|
||||
float VehicleWheel3D::get_rpm() const {
|
||||
|
||||
return m_rpm;
|
||||
}
|
||||
|
||||
VehicleWheel::VehicleWheel() {
|
||||
VehicleWheel3D::VehicleWheel3D() {
|
||||
|
||||
steers = false;
|
||||
engine_traction = false;
|
||||
@ -388,7 +388,7 @@ VehicleWheel::VehicleWheel() {
|
||||
body = NULL;
|
||||
}
|
||||
|
||||
void VehicleBody::_update_wheel_transform(VehicleWheel &wheel, PhysicsDirectBodyState *s) {
|
||||
void VehicleBody3D::_update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirectBodyState *s) {
|
||||
|
||||
wheel.m_raycastInfo.m_isInContact = false;
|
||||
|
||||
@ -405,9 +405,9 @@ void VehicleBody::_update_wheel_transform(VehicleWheel &wheel, PhysicsDirectBody
|
||||
wheel.m_raycastInfo.m_wheelAxleWS = chassisTrans.get_basis().xform(wheel.m_wheelAxleCS).normalized();
|
||||
}
|
||||
|
||||
void VehicleBody::_update_wheel(int p_idx, PhysicsDirectBodyState *s) {
|
||||
void VehicleBody3D::_update_wheel(int p_idx, PhysicsDirectBodyState *s) {
|
||||
|
||||
VehicleWheel &wheel = *wheels[p_idx];
|
||||
VehicleWheel3D &wheel = *wheels[p_idx];
|
||||
_update_wheel_transform(wheel, s);
|
||||
|
||||
Vector3 up = -wheel.m_raycastInfo.m_wheelDirectionWS;
|
||||
@ -430,9 +430,9 @@ void VehicleBody::_update_wheel(int p_idx, PhysicsDirectBodyState *s) {
|
||||
wheel.m_raycastInfo.m_hardPointWS + wheel.m_raycastInfo.m_wheelDirectionWS * wheel.m_raycastInfo.m_suspensionLength);
|
||||
}
|
||||
|
||||
real_t VehicleBody::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
|
||||
real_t VehicleBody3D::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
|
||||
|
||||
VehicleWheel &wheel = *wheels[p_idx];
|
||||
VehicleWheel3D &wheel = *wheels[p_idx];
|
||||
|
||||
_update_wheel_transform(wheel, s);
|
||||
|
||||
@ -513,12 +513,12 @@ real_t VehicleBody::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
|
||||
return depth;
|
||||
}
|
||||
|
||||
void VehicleBody::_update_suspension(PhysicsDirectBodyState *s) {
|
||||
void VehicleBody3D::_update_suspension(PhysicsDirectBodyState *s) {
|
||||
|
||||
real_t chassisMass = mass;
|
||||
|
||||
for (int w_it = 0; w_it < wheels.size(); w_it++) {
|
||||
VehicleWheel &wheel_info = *wheels[w_it];
|
||||
VehicleWheel3D &wheel_info = *wheels[w_it];
|
||||
|
||||
if (wheel_info.m_raycastInfo.m_isInContact) {
|
||||
real_t force;
|
||||
@ -558,7 +558,7 @@ void VehicleBody::_update_suspension(PhysicsDirectBodyState *s) {
|
||||
}
|
||||
|
||||
//bilateral constraint between two dynamic objects
|
||||
void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vector3 &pos1,
|
||||
void VehicleBody3D::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vector3 &pos1,
|
||||
PhysicsBody3D *body2, const Vector3 &pos2, const Vector3 &normal, real_t &impulse, const real_t p_rollInfluence) {
|
||||
|
||||
real_t normalLenSqr = normal.length_squared();
|
||||
@ -636,7 +636,7 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec
|
||||
#endif
|
||||
}
|
||||
|
||||
VehicleBody::btVehicleWheelContactPoint::btVehicleWheelContactPoint(PhysicsDirectBodyState *s, PhysicsBody3D *body1, const Vector3 &frictionPosWorld, const Vector3 &frictionDirectionWorld, real_t maxImpulse) :
|
||||
VehicleBody3D::btVehicleWheelContactPoint::btVehicleWheelContactPoint(PhysicsDirectBodyState *s, PhysicsBody3D *body1, const Vector3 &frictionPosWorld, const Vector3 &frictionDirectionWorld, real_t maxImpulse) :
|
||||
m_s(s),
|
||||
m_body1(body1),
|
||||
m_frictionPositionWorld(frictionPosWorld),
|
||||
@ -667,7 +667,7 @@ VehicleBody::btVehicleWheelContactPoint::btVehicleWheelContactPoint(PhysicsDirec
|
||||
m_jacDiagABInv = relaxation / (denom0 + denom1);
|
||||
}
|
||||
|
||||
real_t VehicleBody::_calc_rolling_friction(btVehicleWheelContactPoint &contactPoint) {
|
||||
real_t VehicleBody3D::_calc_rolling_friction(btVehicleWheelContactPoint &contactPoint) {
|
||||
|
||||
real_t j1 = 0.f;
|
||||
|
||||
@ -698,7 +698,7 @@ real_t VehicleBody::_calc_rolling_friction(btVehicleWheelContactPoint &contactPo
|
||||
}
|
||||
|
||||
static const real_t sideFrictionStiffness2 = real_t(1.0);
|
||||
void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
|
||||
void VehicleBody3D::_update_friction(PhysicsDirectBodyState *s) {
|
||||
|
||||
//calculate the impulse, so that the wheels don't move sidewards
|
||||
int numWheel = wheels.size();
|
||||
@ -720,7 +720,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
|
||||
|
||||
for (int i = 0; i < wheels.size(); i++) {
|
||||
|
||||
VehicleWheel &wheelInfo = *wheels[i];
|
||||
VehicleWheel3D &wheelInfo = *wheels[i];
|
||||
|
||||
if (wheelInfo.m_raycastInfo.m_isInContact) {
|
||||
|
||||
@ -754,7 +754,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
|
||||
bool sliding = false;
|
||||
{
|
||||
for (int wheel = 0; wheel < wheels.size(); wheel++) {
|
||||
VehicleWheel &wheelInfo = *wheels[wheel];
|
||||
VehicleWheel3D &wheelInfo = *wheels[wheel];
|
||||
|
||||
//class btRigidBody* groundObject = (class btRigidBody*) wheelInfo.m_raycastInfo.m_groundObject;
|
||||
|
||||
@ -816,7 +816,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
|
||||
// apply the impulses
|
||||
{
|
||||
for (int wheel = 0; wheel < wheels.size(); wheel++) {
|
||||
VehicleWheel &wheelInfo = *wheels[wheel];
|
||||
VehicleWheel3D &wheelInfo = *wheels[wheel];
|
||||
|
||||
Vector3 rel_pos = wheelInfo.m_raycastInfo.m_contactPointWS -
|
||||
s->get_transform().origin;
|
||||
@ -850,7 +850,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
|
||||
}
|
||||
}
|
||||
|
||||
void VehicleBody::_direct_state_changed(Object *p_state) {
|
||||
void VehicleBody3D::_direct_state_changed(Object *p_state) {
|
||||
|
||||
RigidBody3D::_direct_state_changed(p_state);
|
||||
|
||||
@ -874,7 +874,7 @@ void VehicleBody::_direct_state_changed(Object *p_state) {
|
||||
for (int i = 0; i < wheels.size(); i++) {
|
||||
|
||||
//apply suspension force
|
||||
VehicleWheel &wheel = *wheels[i];
|
||||
VehicleWheel3D &wheel = *wheels[i];
|
||||
|
||||
real_t suspensionForce = wheel.m_wheelsSuspensionForce;
|
||||
|
||||
@ -891,7 +891,7 @@ void VehicleBody::_direct_state_changed(Object *p_state) {
|
||||
_update_friction(state);
|
||||
|
||||
for (int i = 0; i < wheels.size(); i++) {
|
||||
VehicleWheel &wheel = *wheels[i];
|
||||
VehicleWheel3D &wheel = *wheels[i];
|
||||
Vector3 relpos = wheel.m_raycastInfo.m_hardPointWS - state->get_transform().origin;
|
||||
Vector3 vel = state->get_linear_velocity() + (state->get_angular_velocity()).cross(relpos); // * mPos);
|
||||
|
||||
@ -920,58 +920,58 @@ void VehicleBody::_direct_state_changed(Object *p_state) {
|
||||
state = NULL;
|
||||
}
|
||||
|
||||
void VehicleBody::set_engine_force(float p_engine_force) {
|
||||
void VehicleBody3D::set_engine_force(float p_engine_force) {
|
||||
|
||||
engine_force = p_engine_force;
|
||||
for (int i = 0; i < wheels.size(); i++) {
|
||||
VehicleWheel &wheelInfo = *wheels[i];
|
||||
VehicleWheel3D &wheelInfo = *wheels[i];
|
||||
if (wheelInfo.engine_traction)
|
||||
wheelInfo.m_engineForce = p_engine_force;
|
||||
}
|
||||
}
|
||||
|
||||
float VehicleBody::get_engine_force() const {
|
||||
float VehicleBody3D::get_engine_force() const {
|
||||
|
||||
return engine_force;
|
||||
}
|
||||
|
||||
void VehicleBody::set_brake(float p_brake) {
|
||||
void VehicleBody3D::set_brake(float p_brake) {
|
||||
|
||||
brake = p_brake;
|
||||
for (int i = 0; i < wheels.size(); i++) {
|
||||
VehicleWheel &wheelInfo = *wheels[i];
|
||||
VehicleWheel3D &wheelInfo = *wheels[i];
|
||||
wheelInfo.m_brake = p_brake;
|
||||
}
|
||||
}
|
||||
float VehicleBody::get_brake() const {
|
||||
float VehicleBody3D::get_brake() const {
|
||||
|
||||
return brake;
|
||||
}
|
||||
|
||||
void VehicleBody::set_steering(float p_steering) {
|
||||
void VehicleBody3D::set_steering(float p_steering) {
|
||||
|
||||
m_steeringValue = p_steering;
|
||||
for (int i = 0; i < wheels.size(); i++) {
|
||||
VehicleWheel &wheelInfo = *wheels[i];
|
||||
VehicleWheel3D &wheelInfo = *wheels[i];
|
||||
if (wheelInfo.steers)
|
||||
wheelInfo.m_steering = p_steering;
|
||||
}
|
||||
}
|
||||
float VehicleBody::get_steering() const {
|
||||
float VehicleBody3D::get_steering() const {
|
||||
|
||||
return m_steeringValue;
|
||||
}
|
||||
|
||||
void VehicleBody::_bind_methods() {
|
||||
void VehicleBody3D::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleBody::set_engine_force);
|
||||
ClassDB::bind_method(D_METHOD("get_engine_force"), &VehicleBody::get_engine_force);
|
||||
ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleBody3D::set_engine_force);
|
||||
ClassDB::bind_method(D_METHOD("get_engine_force"), &VehicleBody3D::get_engine_force);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_brake", "brake"), &VehicleBody::set_brake);
|
||||
ClassDB::bind_method(D_METHOD("get_brake"), &VehicleBody::get_brake);
|
||||
ClassDB::bind_method(D_METHOD("set_brake", "brake"), &VehicleBody3D::set_brake);
|
||||
ClassDB::bind_method(D_METHOD("get_brake"), &VehicleBody3D::get_brake);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleBody::set_steering);
|
||||
ClassDB::bind_method(D_METHOD("get_steering"), &VehicleBody::get_steering);
|
||||
ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleBody3D::set_steering);
|
||||
ClassDB::bind_method(D_METHOD("get_steering"), &VehicleBody3D::get_steering);
|
||||
|
||||
ADD_GROUP("Motion", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01,or_greater"), "set_engine_force", "get_engine_force");
|
||||
@ -979,7 +979,7 @@ void VehicleBody::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering");
|
||||
}
|
||||
|
||||
VehicleBody::VehicleBody() {
|
||||
VehicleBody3D::VehicleBody3D() {
|
||||
|
||||
m_pitchControl = 0;
|
||||
m_currentVehicleSpeedKmHour = real_t(0.);
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* vehicle_body.h */
|
||||
/* vehicle_body_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -33,13 +33,13 @@
|
||||
|
||||
#include "scene/3d/physics_body_3d.h"
|
||||
|
||||
class VehicleBody;
|
||||
class VehicleBody3D;
|
||||
|
||||
class VehicleWheel : public Node3D {
|
||||
class VehicleWheel3D : public Node3D {
|
||||
|
||||
GDCLASS(VehicleWheel, Node3D);
|
||||
GDCLASS(VehicleWheel3D, Node3D);
|
||||
|
||||
friend class VehicleBody;
|
||||
friend class VehicleBody3D;
|
||||
|
||||
Transform m_worldTransform;
|
||||
Transform local_xform;
|
||||
@ -61,7 +61,7 @@ class VehicleWheel : public Node3D {
|
||||
real_t m_maxSuspensionForce;
|
||||
bool m_bIsFrontWheel;
|
||||
|
||||
VehicleBody *body;
|
||||
VehicleBody3D *body;
|
||||
|
||||
//btVector3 m_wheelAxleCS; // const or modified by steering ?
|
||||
|
||||
@ -148,12 +148,12 @@ public:
|
||||
|
||||
String get_configuration_warning() const;
|
||||
|
||||
VehicleWheel();
|
||||
VehicleWheel3D();
|
||||
};
|
||||
|
||||
class VehicleBody : public RigidBody3D {
|
||||
class VehicleBody3D : public RigidBody3D {
|
||||
|
||||
GDCLASS(VehicleBody, RigidBody3D);
|
||||
GDCLASS(VehicleBody3D, RigidBody3D);
|
||||
|
||||
float engine_force;
|
||||
float brake;
|
||||
@ -186,11 +186,11 @@ class VehicleBody : public RigidBody3D {
|
||||
void _update_friction(PhysicsDirectBodyState *s);
|
||||
void _update_suspension(PhysicsDirectBodyState *s);
|
||||
real_t _ray_cast(int p_idx, PhysicsDirectBodyState *s);
|
||||
void _update_wheel_transform(VehicleWheel &wheel, PhysicsDirectBodyState *s);
|
||||
void _update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirectBodyState *s);
|
||||
void _update_wheel(int p_idx, PhysicsDirectBodyState *s);
|
||||
|
||||
friend class VehicleWheel;
|
||||
Vector<VehicleWheel *> wheels;
|
||||
friend class VehicleWheel3D;
|
||||
Vector<VehicleWheel3D *> wheels;
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
@ -206,7 +206,7 @@ public:
|
||||
void set_steering(float p_steering);
|
||||
float get_steering() const;
|
||||
|
||||
VehicleBody();
|
||||
VehicleBody3D();
|
||||
};
|
||||
|
||||
#endif // VEHICLE_BODY_H
|
||||
@ -33,8 +33,8 @@
|
||||
|
||||
#include "core/math/transform_2d.h"
|
||||
#include "core/rid.h"
|
||||
#include "scene/2d/canvas_item.h"
|
||||
#include "scene/gui/shortcut.h"
|
||||
#include "scene/main/canvas_item.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/main/timer.h"
|
||||
#include "scene/resources/theme.h"
|
||||
|
||||
@ -1410,7 +1410,7 @@ SceneTree::SceneTree() {
|
||||
root = memnew(Window);
|
||||
root->set_name("root");
|
||||
if (!root->get_world().is_valid())
|
||||
root->set_world(Ref<World>(memnew(World)));
|
||||
root->set_world(Ref<World3D>(memnew(World3D)));
|
||||
|
||||
// Initialize network state
|
||||
multiplayer_poll = true;
|
||||
|
||||
@ -36,8 +36,8 @@
|
||||
#include "core/os/thread_safe.h"
|
||||
#include "core/self_list.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "scene/resources/world.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
#include "scene/resources/world_3d.h"
|
||||
|
||||
#undef Window
|
||||
|
||||
|
||||
0
scene/main/timer.cpp
Executable file → Normal file
0
scene/main/timer.cpp
Executable file → Normal file
0
scene/main/timer.h
Executable file → Normal file
0
scene/main/timer.h
Executable file → Normal file
@ -1285,7 +1285,7 @@ void Viewport::_propagate_exit_world(Node *p_node) {
|
||||
}
|
||||
}
|
||||
|
||||
void Viewport::set_world(const Ref<World> &p_world) {
|
||||
void Viewport::set_world(const Ref<World3D> &p_world) {
|
||||
|
||||
if (world == p_world)
|
||||
return;
|
||||
@ -1304,7 +1304,7 @@ void Viewport::set_world(const Ref<World> &p_world) {
|
||||
own_world = world->duplicate();
|
||||
world->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
|
||||
} else {
|
||||
own_world = Ref<World>(memnew(World));
|
||||
own_world = Ref<World3D>(memnew(World3D));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1318,7 +1318,7 @@ void Viewport::set_world(const Ref<World> &p_world) {
|
||||
_update_listener();
|
||||
}
|
||||
|
||||
Ref<World> Viewport::get_world() const {
|
||||
Ref<World3D> Viewport::get_world() const {
|
||||
|
||||
return world;
|
||||
}
|
||||
@ -1328,7 +1328,7 @@ Ref<World2D> Viewport::get_world_2d() const {
|
||||
return world_2d;
|
||||
}
|
||||
|
||||
Ref<World> Viewport::find_world() const {
|
||||
Ref<World3D> Viewport::find_world() const {
|
||||
|
||||
if (own_world.is_valid())
|
||||
return own_world;
|
||||
@ -1337,7 +1337,7 @@ Ref<World> Viewport::find_world() const {
|
||||
else if (parent)
|
||||
return parent->find_world();
|
||||
else
|
||||
return Ref<World>();
|
||||
return Ref<World3D>();
|
||||
}
|
||||
|
||||
Listener3D *Viewport::get_listener() const {
|
||||
@ -3092,7 +3092,7 @@ void Viewport::set_use_own_world(bool p_world) {
|
||||
_propagate_exit_world(this);
|
||||
|
||||
if (!p_world) {
|
||||
own_world = Ref<World>();
|
||||
own_world = Ref<World3D>();
|
||||
if (world.is_valid()) {
|
||||
world->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
|
||||
}
|
||||
@ -3101,7 +3101,7 @@ void Viewport::set_use_own_world(bool p_world) {
|
||||
own_world = world->duplicate();
|
||||
world->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
|
||||
} else {
|
||||
own_world = Ref<World>(memnew(World));
|
||||
own_world = Ref<World3D>(memnew(World3D));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -245,8 +245,8 @@ private:
|
||||
Map<ObjectID, uint64_t> physics_2d_mouseover;
|
||||
|
||||
Ref<World2D> world_2d;
|
||||
Ref<World> world;
|
||||
Ref<World> own_world;
|
||||
Ref<World3D> world;
|
||||
Ref<World3D> own_world;
|
||||
|
||||
Rect2i to_screen_rect;
|
||||
StringName input_group;
|
||||
@ -467,10 +467,10 @@ public:
|
||||
Rect2 get_visible_rect() const;
|
||||
RID get_viewport_rid() const;
|
||||
|
||||
void set_world(const Ref<World> &p_world);
|
||||
void set_world(const Ref<World3D> &p_world);
|
||||
void set_world_2d(const Ref<World2D> &p_world_2d);
|
||||
Ref<World> get_world() const;
|
||||
Ref<World> find_world() const;
|
||||
Ref<World3D> get_world() const;
|
||||
Ref<World3D> find_world() const;
|
||||
|
||||
Ref<World2D> get_world_2d() const;
|
||||
Ref<World2D> find_world_2d() const;
|
||||
|
||||
@ -38,11 +38,11 @@
|
||||
#include "scene/2d/audio_stream_player_2d.h"
|
||||
#include "scene/2d/back_buffer_copy.h"
|
||||
#include "scene/2d/camera_2d.h"
|
||||
#include "scene/2d/canvas_item.h"
|
||||
#include "scene/2d/canvas_modulate.h"
|
||||
#include "scene/2d/collision_polygon_2d.h"
|
||||
#include "scene/2d/collision_shape_2d.h"
|
||||
#include "scene/2d/cpu_particles_2d.h"
|
||||
#include "scene/2d/gpu_particles_2d.h"
|
||||
#include "scene/2d/joints_2d.h"
|
||||
#include "scene/2d/light_2d.h"
|
||||
#include "scene/2d/light_occluder_2d.h"
|
||||
@ -54,7 +54,6 @@
|
||||
#include "scene/2d/navigation_obstacle_2d.h"
|
||||
#include "scene/2d/parallax_background.h"
|
||||
#include "scene/2d/parallax_layer.h"
|
||||
#include "scene/2d/particles_2d.h"
|
||||
#include "scene/2d/path_2d.h"
|
||||
#include "scene/2d/physics_body_2d.h"
|
||||
#include "scene/2d/polygon_2d.h"
|
||||
@ -121,6 +120,7 @@
|
||||
#include "scene/gui/tree.h"
|
||||
#include "scene/gui/video_player.h"
|
||||
#include "scene/gui/viewport_container.h"
|
||||
#include "scene/main/canvas_item.h"
|
||||
#include "scene/main/canvas_layer.h"
|
||||
#include "scene/main/http_request.h"
|
||||
#include "scene/main/instance_placeholder.h"
|
||||
@ -143,7 +143,7 @@
|
||||
#include "scene/resources/default_theme/default_theme.h"
|
||||
#include "scene/resources/dynamic_font.h"
|
||||
#include "scene/resources/gradient.h"
|
||||
#include "scene/resources/height_map_shape.h"
|
||||
#include "scene/resources/height_map_shape_3d.h"
|
||||
#include "scene/resources/line_shape_2d.h"
|
||||
#include "scene/resources/material.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
@ -154,7 +154,7 @@
|
||||
#include "scene/resources/physics_material.h"
|
||||
#include "scene/resources/polygon_path_finder.h"
|
||||
#include "scene/resources/primitive_meshes.h"
|
||||
#include "scene/resources/ray_shape.h"
|
||||
#include "scene/resources/ray_shape_3d.h"
|
||||
#include "scene/resources/rectangle_shape_2d.h"
|
||||
#include "scene/resources/resource_format_text.h"
|
||||
#include "scene/resources/segment_shape_2d.h"
|
||||
@ -168,8 +168,8 @@
|
||||
#include "scene/resources/video_stream.h"
|
||||
#include "scene/resources/visual_shader.h"
|
||||
#include "scene/resources/visual_shader_nodes.h"
|
||||
#include "scene/resources/world.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
#include "scene/resources/world_3d.h"
|
||||
#include "scene/resources/world_margin_shape_3d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
@ -206,13 +206,13 @@
|
||||
#include "scene/3d/ray_cast_3d.h"
|
||||
#include "scene/3d/reflection_probe.h"
|
||||
#include "scene/3d/remote_transform_3d.h"
|
||||
#include "scene/3d/skeleton_ik_3d.h"
|
||||
#include "scene/3d/soft_body_3d.h"
|
||||
#include "scene/3d/spring_arm_3d.h"
|
||||
#include "scene/3d/sprite_3d.h"
|
||||
#include "scene/3d/vehicle_body.h"
|
||||
#include "scene/3d/vehicle_body_3d.h"
|
||||
#include "scene/3d/visibility_notifier_3d.h"
|
||||
#include "scene/3d/world_environment.h"
|
||||
#include "scene/animation/skeleton_ik.h"
|
||||
#include "scene/resources/environment.h"
|
||||
#include "scene/resources/mesh_library.h"
|
||||
#endif
|
||||
@ -279,6 +279,7 @@ void register_scene_types() {
|
||||
ClassDB::register_class<Window>();
|
||||
|
||||
/* REGISTER GUI */
|
||||
|
||||
ClassDB::register_class<ButtonGroup>();
|
||||
ClassDB::register_virtual_class<BaseButton>();
|
||||
|
||||
@ -335,7 +336,6 @@ void register_scene_types() {
|
||||
ClassDB::register_class<VideoPlayer>();
|
||||
|
||||
#ifndef ADVANCED_GUI_DISABLED
|
||||
|
||||
ClassDB::register_class<FileDialog>();
|
||||
|
||||
ClassDB::register_class<PopupMenu>();
|
||||
@ -351,9 +351,10 @@ void register_scene_types() {
|
||||
ClassDB::register_class<RichTextLabel>();
|
||||
ClassDB::register_class<RichTextEffect>();
|
||||
ClassDB::register_class<CharFXTransform>();
|
||||
;
|
||||
|
||||
ClassDB::register_class<AcceptDialog>();
|
||||
ClassDB::register_class<ConfirmationDialog>();
|
||||
|
||||
ClassDB::register_class<MarginContainer>();
|
||||
ClassDB::register_class<ViewportContainer>();
|
||||
ClassDB::register_virtual_class<SplitContainer>();
|
||||
@ -364,6 +365,7 @@ void register_scene_types() {
|
||||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
AcceptDialog::set_swap_ok_cancel(GLOBAL_DEF("gui/common/swap_ok_cancel", bool(DisplayServer::get_singleton()->get_swap_ok_cancel())));
|
||||
#endif
|
||||
|
||||
/* REGISTER 3D */
|
||||
@ -405,7 +407,7 @@ void register_scene_types() {
|
||||
ClassDB::register_virtual_class<VisualInstance3D>();
|
||||
ClassDB::register_virtual_class<GeometryInstance3D>();
|
||||
ClassDB::register_class<Camera3D>();
|
||||
ClassDB::register_class<ClippedCamera>();
|
||||
ClassDB::register_class<ClippedCamera3D>();
|
||||
ClassDB::register_class<Listener3D>();
|
||||
ClassDB::register_class<ARVRCamera>();
|
||||
ClassDB::register_class<ARVRController>();
|
||||
@ -448,8 +450,8 @@ void register_scene_types() {
|
||||
ClassDB::register_class<SkeletonIK3D>();
|
||||
ClassDB::register_class<BoneAttachment3D>();
|
||||
|
||||
ClassDB::register_class<VehicleBody>();
|
||||
ClassDB::register_class<VehicleWheel>();
|
||||
ClassDB::register_class<VehicleBody3D>();
|
||||
ClassDB::register_class<VehicleWheel3D>();
|
||||
ClassDB::register_class<Area3D>();
|
||||
ClassDB::register_class<ProximityGroup3D>();
|
||||
ClassDB::register_class<CollisionShape3D>();
|
||||
@ -478,11 +480,9 @@ void register_scene_types() {
|
||||
ClassDB::register_class<NavigationObstacle3D>();
|
||||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
#endif
|
||||
ClassDB::register_class<NavigationMesh>();
|
||||
|
||||
AcceptDialog::set_swap_ok_cancel(GLOBAL_DEF("gui/common/swap_ok_cancel", bool(DisplayServer::get_singleton()->get_swap_ok_cancel())));
|
||||
/* REGISTER SHADER */
|
||||
|
||||
ClassDB::register_class<Shader>();
|
||||
ClassDB::register_class<VisualShader>();
|
||||
@ -556,12 +556,13 @@ void register_scene_types() {
|
||||
ClassDB::register_class<CanvasItemMaterial>();
|
||||
SceneTree::add_idle_callback(CanvasItemMaterial::flush_changes);
|
||||
CanvasItemMaterial::init_shaders();
|
||||
|
||||
/* REGISTER 2D */
|
||||
|
||||
ClassDB::register_class<Node2D>();
|
||||
ClassDB::register_class<CPUParticles2D>();
|
||||
ClassDB::register_class<Particles2D>();
|
||||
//ClassDB::register_class<ParticleAttractor2D>();
|
||||
ClassDB::register_class<GPUParticles2D>();
|
||||
ClassDB::register_class<Sprite2D>();
|
||||
//ClassDB::register_type<ViewportSprite>();
|
||||
ClassDB::register_class<SpriteFrames>();
|
||||
ClassDB::register_class<AnimatedSprite2D>();
|
||||
ClassDB::register_class<Position2D>();
|
||||
@ -649,7 +650,7 @@ void register_scene_types() {
|
||||
ClassDB::register_class<BoxShape3D>();
|
||||
ClassDB::register_class<CapsuleShape3D>();
|
||||
ClassDB::register_class<CylinderShape3D>();
|
||||
ClassDB::register_class<HeightMapShape>();
|
||||
ClassDB::register_class<HeightMapShape3D>();
|
||||
ClassDB::register_class<WorldMarginShape3D>();
|
||||
ClassDB::register_class<ConvexPolygonShape3D>();
|
||||
ClassDB::register_class<ConcavePolygonShape3D>();
|
||||
@ -657,10 +658,10 @@ void register_scene_types() {
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
ClassDB::register_class<VelocityTracker3D>();
|
||||
|
||||
#endif
|
||||
|
||||
ClassDB::register_class<PhysicsMaterial>();
|
||||
ClassDB::register_class<World>();
|
||||
ClassDB::register_class<World3D>();
|
||||
ClassDB::register_class<Environment>();
|
||||
ClassDB::register_class<CameraEffects>();
|
||||
ClassDB::register_class<World2D>();
|
||||
@ -729,6 +730,7 @@ void register_scene_types() {
|
||||
ClassDB::register_class<Path2D>();
|
||||
ClassDB::register_class<PathFollow2D>();
|
||||
|
||||
ClassDB::register_class<NavigationMesh>();
|
||||
ClassDB::register_class<Navigation2D>();
|
||||
ClassDB::register_class<NavigationPolygon>();
|
||||
ClassDB::register_class<NavigationRegion2D>();
|
||||
@ -744,90 +746,79 @@ void register_scene_types() {
|
||||
ClassDB::register_virtual_class<SceneTreeTimer>(); //sorry, you can't create it
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
|
||||
ClassDB::add_compatibility_class("AnimatedSprite", "AnimatedSprite2D");
|
||||
ClassDB::add_compatibility_class("Sprite", "Sprite2D");
|
||||
|
||||
ClassDB::add_compatibility_class("SpatialMaterial", "StandardMaterial3D");
|
||||
ClassDB::add_compatibility_class("Mesh", "ArrayMesh");
|
||||
// Dropped in 4.0, near approximation.
|
||||
ClassDB::add_compatibility_class("AnimationTreePlayer", "AnimationTree");
|
||||
ClassDB::add_compatibility_class("VisualShaderNodeScalarConstant", "VisualShaderNodeFloatConstant");
|
||||
ClassDB::add_compatibility_class("VisualShaderNodeScalarUniform", "VisualShaderNodeFloatUniform");
|
||||
ClassDB::add_compatibility_class("VisualShaderNodeScalarOp", "VisualShaderNodeFloatOp");
|
||||
ClassDB::add_compatibility_class("VisualShaderNodeScalarFunc", "VisualShaderNodeFloatFunc");
|
||||
ClassDB::add_compatibility_class("NavigationMeshInstance", "NavigationRegion3D");
|
||||
ClassDB::add_compatibility_class("NavigationPolygonInstance", "NavigationRegion2D");
|
||||
ClassDB::add_compatibility_class("PlaneShape", "WorldMarginShape3D");
|
||||
ClassDB::add_compatibility_class("WorldMarginShape", "WorldMarginShape3D");
|
||||
|
||||
ClassDB::add_compatibility_class("Spatial", "Node3D");
|
||||
// Renamed in 4.0.
|
||||
ClassDB::add_compatibility_class("AnimatedSprite", "AnimatedSprite2D");
|
||||
ClassDB::add_compatibility_class("Area", "Area3D");
|
||||
ClassDB::add_compatibility_class("BoneAttachment", "BoneAttachment3D");
|
||||
ClassDB::add_compatibility_class("BoxShape", "BoxShape3D");
|
||||
ClassDB::add_compatibility_class("Camera", "Camera3D");
|
||||
|
||||
ClassDB::add_compatibility_class("Particles", "GPUParticles3D");
|
||||
ClassDB::add_compatibility_class("CapsuleShape", "CapsuleShape3D");
|
||||
ClassDB::add_compatibility_class("ClippedCamera", "ClippedCamera3D");
|
||||
ClassDB::add_compatibility_class("CollisionObject", "CollisionObject3D");
|
||||
ClassDB::add_compatibility_class("CollisionPolygon", "CollisionPolygon3D");
|
||||
ClassDB::add_compatibility_class("CollisionShape", "CollisionShape3D");
|
||||
ClassDB::add_compatibility_class("ConcavePolygonShape", "ConcavePolygonShape3D");
|
||||
ClassDB::add_compatibility_class("ConeTwistJoint", "ConeTwistJoint3D");
|
||||
ClassDB::add_compatibility_class("ConvexPolygonShape", "ConvexPolygonShape3D");
|
||||
ClassDB::add_compatibility_class("CPUParticles", "CPUParticles3D");
|
||||
|
||||
ClassDB::add_compatibility_class("Particles2D", "GPUParticles2D");
|
||||
|
||||
ClassDB::add_compatibility_class("Light", "Light3D");
|
||||
ClassDB::add_compatibility_class("CylinderShape", "CylinderShape3D");
|
||||
ClassDB::add_compatibility_class("DirectionalLight", "DirectionalLight3D");
|
||||
ClassDB::add_compatibility_class("SpotLight", "SpotLight3D");
|
||||
ClassDB::add_compatibility_class("OmniLight", "OmniLight3D");
|
||||
|
||||
ClassDB::add_compatibility_class("Generic6DOFJoint", "Generic6DOFJoint3D");
|
||||
ClassDB::add_compatibility_class("HeightMapShape", "HeightMapShape3D");
|
||||
ClassDB::add_compatibility_class("HingeJoint", "HingeJoint3D");
|
||||
ClassDB::add_compatibility_class("ImmediateGeometry", "ImmediateGeometry3D");
|
||||
ClassDB::add_compatibility_class("Joint", "Joint3D");
|
||||
ClassDB::add_compatibility_class("KinematicBody", "KinematicBody3D");
|
||||
ClassDB::add_compatibility_class("KinematicCollision", "KinematicCollision3D");
|
||||
ClassDB::add_compatibility_class("Light", "Light3D");
|
||||
ClassDB::add_compatibility_class("Listener", "Listener3D");
|
||||
|
||||
ClassDB::add_compatibility_class("MeshInstance", "MeshInstance3D");
|
||||
ClassDB::add_compatibility_class("MultiMeshInstance", "MultiMeshInstance3D");
|
||||
ClassDB::add_compatibility_class("ImmediateGeometry", "ImmediateGeometry3D");
|
||||
|
||||
ClassDB::add_compatibility_class("Navigation", "Navigation3D");
|
||||
ClassDB::add_compatibility_class("NavigationAgent", "NavigationAgent3D");
|
||||
ClassDB::add_compatibility_class("NavigationMeshInstance", "NavigationRegion3D");
|
||||
ClassDB::add_compatibility_class("NavigationObstacle", "NavigationObstacle3D");
|
||||
ClassDB::add_compatibility_class("NavigationPolygonInstance", "NavigationRegion2D");
|
||||
ClassDB::add_compatibility_class("NavigationRegion", "NavigationRegion3D");
|
||||
|
||||
ClassDB::add_compatibility_class("OmniLight", "OmniLight3D");
|
||||
ClassDB::add_compatibility_class("Particles", "GPUParticles3D");
|
||||
ClassDB::add_compatibility_class("Particles2D", "GPUParticles2D");
|
||||
ClassDB::add_compatibility_class("Path", "Path3D");
|
||||
ClassDB::add_compatibility_class("PathFollow", "PathFollow3D");
|
||||
|
||||
ClassDB::add_compatibility_class("PhysicalBone", "PhysicalBone3D");
|
||||
ClassDB::add_compatibility_class("PhysicsBody", "PhysicsBody3D");
|
||||
ClassDB::add_compatibility_class("PinJoint", "PinJoint3D");
|
||||
ClassDB::add_compatibility_class("PlaneShape", "WorldMarginShape3D");
|
||||
ClassDB::add_compatibility_class("ProximityGroup", "ProximityGroup3D");
|
||||
|
||||
ClassDB::add_compatibility_class("RayCast", "RayCast3D");
|
||||
ClassDB::add_compatibility_class("RayShape", "RayShape3D");
|
||||
ClassDB::add_compatibility_class("RemoteTransform", "RemoteTransform3D");
|
||||
|
||||
ClassDB::add_compatibility_class("RigidBody", "RigidBody3D");
|
||||
ClassDB::add_compatibility_class("Shape", "Shape3D");
|
||||
ClassDB::add_compatibility_class("Skeleton", "Skeleton3D");
|
||||
ClassDB::add_compatibility_class("SkeletonIK", "SkeletonIK3D");
|
||||
|
||||
ClassDB::add_compatibility_class("VisibilityNotifier", "VisibilityNotifier3D");
|
||||
ClassDB::add_compatibility_class("VisibilityEnabler", "VisibilityEnabler3D");
|
||||
|
||||
ClassDB::add_compatibility_class("CollisionObject", "CollisionObject3D");
|
||||
ClassDB::add_compatibility_class("CollisionShape", "CollisionShape3D");
|
||||
ClassDB::add_compatibility_class("CollisionPolygon", "CollisionPolygon3D");
|
||||
|
||||
ClassDB::add_compatibility_class("PhysicsBody", "PhysicsBody3D");
|
||||
ClassDB::add_compatibility_class("RigidBody", "RigidBody3D");
|
||||
ClassDB::add_compatibility_class("StaticBody", "StaticBody3D");
|
||||
ClassDB::add_compatibility_class("KinematicBody", "KinematicBody3D");
|
||||
ClassDB::add_compatibility_class("SoftBody", "SoftBody3D");
|
||||
ClassDB::add_compatibility_class("PhysicalBone", "PhysicalBone3D");
|
||||
ClassDB::add_compatibility_class("KinematicCollision", "KinematicCollision3D");
|
||||
ClassDB::add_compatibility_class("SpringArm", "SpringArm3D");
|
||||
|
||||
ClassDB::add_compatibility_class("Shape", "Shape3D");
|
||||
ClassDB::add_compatibility_class("RayShape", "RayShape3D");
|
||||
ClassDB::add_compatibility_class("SphereShape", "SphereShape3D");
|
||||
ClassDB::add_compatibility_class("BoxShape", "BoxShape3D");
|
||||
ClassDB::add_compatibility_class("CylinderShape", "CylinderShape3D");
|
||||
ClassDB::add_compatibility_class("CapsuleShape", "CapsuleShape3D");
|
||||
ClassDB::add_compatibility_class("ConvexPolygonShape", "ConvexPolygonShape3D");
|
||||
ClassDB::add_compatibility_class("ConcavePolygonShape", "ConcavePolygonShape3D");
|
||||
|
||||
ClassDB::add_compatibility_class("Joint", "Joint3D");
|
||||
ClassDB::add_compatibility_class("PinJoint", "PinJoint3D");
|
||||
ClassDB::add_compatibility_class("SliderJoint", "SliderJoint3D");
|
||||
ClassDB::add_compatibility_class("HingeJoint", "HingeJoint3D");
|
||||
ClassDB::add_compatibility_class("ConeTwistJoint", "ConeTwistJoint3D");
|
||||
ClassDB::add_compatibility_class("Generic6DOFJoint", "Generic6DOFJoint3D");
|
||||
|
||||
ClassDB::add_compatibility_class("SoftBody", "SoftBody3D");
|
||||
ClassDB::add_compatibility_class("Spatial", "Node3D");
|
||||
ClassDB::add_compatibility_class("SpatialMaterial", "StandardMaterial3D");
|
||||
ClassDB::add_compatibility_class("SpatialVelocityTracker", "VelocityTracker3D");
|
||||
ClassDB::add_compatibility_class("SphereShape", "SphereShape3D");
|
||||
ClassDB::add_compatibility_class("SpotLight", "SpotLight3D");
|
||||
ClassDB::add_compatibility_class("SpringArm", "SpringArm3D");
|
||||
ClassDB::add_compatibility_class("Sprite", "Sprite2D");
|
||||
ClassDB::add_compatibility_class("StaticBody", "StaticBody3D");
|
||||
ClassDB::add_compatibility_class("VehicleBody", "VehicleBody3D");
|
||||
ClassDB::add_compatibility_class("VehicleWheel", "VehicleWheel3D");
|
||||
ClassDB::add_compatibility_class("VisibilityEnabler", "VisibilityEnabler3D");
|
||||
ClassDB::add_compatibility_class("VisibilityNotifier", "VisibilityNotifier3D");
|
||||
ClassDB::add_compatibility_class("VisualShaderNodeScalarConstant", "VisualShaderNodeFloatConstant");
|
||||
ClassDB::add_compatibility_class("VisualShaderNodeScalarFunc", "VisualShaderNodeFloatFunc");
|
||||
ClassDB::add_compatibility_class("VisualShaderNodeScalarOp", "VisualShaderNodeFloatOp");
|
||||
ClassDB::add_compatibility_class("VisualShaderNodeScalarUniform", "VisualShaderNodeFloatUniform");
|
||||
ClassDB::add_compatibility_class("World", "World3D");
|
||||
#endif
|
||||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* height_map_shape.cpp */
|
||||
/* height_map_shape_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -28,10 +28,10 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "height_map_shape.h"
|
||||
#include "height_map_shape_3d.h"
|
||||
#include "servers/physics_server.h"
|
||||
|
||||
Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
|
||||
Vector<Vector3> HeightMapShape3D::get_debug_mesh_lines() {
|
||||
Vector<Vector3> points;
|
||||
|
||||
if ((map_width != 0) && (map_depth != 0)) {
|
||||
@ -76,11 +76,11 @@ Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
|
||||
return points;
|
||||
}
|
||||
|
||||
real_t HeightMapShape::get_enclosing_radius() const {
|
||||
real_t HeightMapShape3D::get_enclosing_radius() const {
|
||||
return Vector3(real_t(map_width), max_height - min_height, real_t(map_depth)).length();
|
||||
}
|
||||
|
||||
void HeightMapShape::_update_shape() {
|
||||
void HeightMapShape3D::_update_shape() {
|
||||
|
||||
Dictionary d;
|
||||
d["width"] = map_width;
|
||||
@ -92,7 +92,7 @@ void HeightMapShape::_update_shape() {
|
||||
Shape3D::_update_shape();
|
||||
}
|
||||
|
||||
void HeightMapShape::set_map_width(int p_new) {
|
||||
void HeightMapShape3D::set_map_width(int p_new) {
|
||||
if (p_new < 1) {
|
||||
// ignore
|
||||
} else if (map_width != p_new) {
|
||||
@ -114,11 +114,11 @@ void HeightMapShape::set_map_width(int p_new) {
|
||||
}
|
||||
}
|
||||
|
||||
int HeightMapShape::get_map_width() const {
|
||||
int HeightMapShape3D::get_map_width() const {
|
||||
return map_width;
|
||||
}
|
||||
|
||||
void HeightMapShape::set_map_depth(int p_new) {
|
||||
void HeightMapShape3D::set_map_depth(int p_new) {
|
||||
if (p_new < 1) {
|
||||
// ignore
|
||||
} else if (map_depth != p_new) {
|
||||
@ -140,11 +140,11 @@ void HeightMapShape::set_map_depth(int p_new) {
|
||||
}
|
||||
}
|
||||
|
||||
int HeightMapShape::get_map_depth() const {
|
||||
int HeightMapShape3D::get_map_depth() const {
|
||||
return map_depth;
|
||||
}
|
||||
|
||||
void HeightMapShape::set_map_data(PackedFloat32Array p_new) {
|
||||
void HeightMapShape3D::set_map_data(PackedFloat32Array p_new) {
|
||||
int size = (map_width * map_depth);
|
||||
if (p_new.size() != size) {
|
||||
// fail
|
||||
@ -174,24 +174,24 @@ void HeightMapShape::set_map_data(PackedFloat32Array p_new) {
|
||||
_change_notify("map_data");
|
||||
}
|
||||
|
||||
PackedFloat32Array HeightMapShape::get_map_data() const {
|
||||
PackedFloat32Array HeightMapShape3D::get_map_data() const {
|
||||
return map_data;
|
||||
}
|
||||
|
||||
void HeightMapShape::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_map_width", "width"), &HeightMapShape::set_map_width);
|
||||
ClassDB::bind_method(D_METHOD("get_map_width"), &HeightMapShape::get_map_width);
|
||||
ClassDB::bind_method(D_METHOD("set_map_depth", "height"), &HeightMapShape::set_map_depth);
|
||||
ClassDB::bind_method(D_METHOD("get_map_depth"), &HeightMapShape::get_map_depth);
|
||||
ClassDB::bind_method(D_METHOD("set_map_data", "data"), &HeightMapShape::set_map_data);
|
||||
ClassDB::bind_method(D_METHOD("get_map_data"), &HeightMapShape::get_map_data);
|
||||
void HeightMapShape3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_map_width", "width"), &HeightMapShape3D::set_map_width);
|
||||
ClassDB::bind_method(D_METHOD("get_map_width"), &HeightMapShape3D::get_map_width);
|
||||
ClassDB::bind_method(D_METHOD("set_map_depth", "height"), &HeightMapShape3D::set_map_depth);
|
||||
ClassDB::bind_method(D_METHOD("get_map_depth"), &HeightMapShape3D::get_map_depth);
|
||||
ClassDB::bind_method(D_METHOD("set_map_data", "data"), &HeightMapShape3D::set_map_data);
|
||||
ClassDB::bind_method(D_METHOD("get_map_data"), &HeightMapShape3D::get_map_data);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_width", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_width", "get_map_width");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "map_depth", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_depth", "get_map_depth");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "map_data"), "set_map_data", "get_map_data");
|
||||
}
|
||||
|
||||
HeightMapShape::HeightMapShape() :
|
||||
HeightMapShape3D::HeightMapShape3D() :
|
||||
Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_HEIGHTMAP)) {
|
||||
|
||||
map_width = 2;
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* height_map_shape.h */
|
||||
/* height_map_shape_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -33,8 +33,8 @@
|
||||
|
||||
#include "scene/resources/shape_3d.h"
|
||||
|
||||
class HeightMapShape : public Shape3D {
|
||||
GDCLASS(HeightMapShape, Shape3D);
|
||||
class HeightMapShape3D : public Shape3D {
|
||||
GDCLASS(HeightMapShape3D, Shape3D);
|
||||
|
||||
int map_width;
|
||||
int map_depth;
|
||||
@ -57,7 +57,7 @@ public:
|
||||
virtual Vector<Vector3> get_debug_mesh_lines();
|
||||
virtual real_t get_enclosing_radius() const;
|
||||
|
||||
HeightMapShape();
|
||||
HeightMapShape3D();
|
||||
};
|
||||
|
||||
#endif /* !HEIGHT_MAP_SHAPE_H */
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* ray_shape.cpp */
|
||||
/* ray_shape_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -28,7 +28,7 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "ray_shape.h"
|
||||
#include "ray_shape_3d.h"
|
||||
|
||||
#include "servers/physics_server.h"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* ray_shape.h */
|
||||
/* ray_shape_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -29,7 +29,8 @@
|
||||
/*************************************************************************/
|
||||
|
||||
#include "style_box.h"
|
||||
#include "scene/2d/canvas_item.h"
|
||||
|
||||
#include "scene/main/canvas_item.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#include "core/array.h"
|
||||
#include "core/resource.h"
|
||||
#include "scene/2d/light_occluder_2d.h"
|
||||
#include "scene/2d/navigation_polygon.h"
|
||||
#include "scene/2d/navigation_region_2d.h"
|
||||
#include "scene/resources/convex_polygon_shape_2d.h"
|
||||
#include "scene/resources/shape_2d.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* world.cpp */
|
||||
/* world_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -28,7 +28,7 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "world.h"
|
||||
#include "world_3d.h"
|
||||
|
||||
#include "core/math/camera_matrix.h"
|
||||
#include "core/math/octree.h"
|
||||
@ -210,65 +210,65 @@ struct SpatialIndexer {
|
||||
}
|
||||
};
|
||||
|
||||
void World::_register_camera(Camera3D *p_camera) {
|
||||
void World3D::_register_camera(Camera3D *p_camera) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_add_camera(p_camera);
|
||||
#endif
|
||||
}
|
||||
|
||||
void World::_update_camera(Camera3D *p_camera) {
|
||||
void World3D::_update_camera(Camera3D *p_camera) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_update_camera(p_camera);
|
||||
#endif
|
||||
}
|
||||
void World::_remove_camera(Camera3D *p_camera) {
|
||||
void World3D::_remove_camera(Camera3D *p_camera) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_remove_camera(p_camera);
|
||||
#endif
|
||||
}
|
||||
|
||||
void World::_register_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) {
|
||||
void World3D::_register_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_notifier_add(p_notifier, p_rect);
|
||||
#endif
|
||||
}
|
||||
|
||||
void World::_update_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) {
|
||||
void World3D::_update_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_notifier_update(p_notifier, p_rect);
|
||||
#endif
|
||||
}
|
||||
|
||||
void World::_remove_notifier(VisibilityNotifier3D *p_notifier) {
|
||||
void World3D::_remove_notifier(VisibilityNotifier3D *p_notifier) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_notifier_remove(p_notifier);
|
||||
#endif
|
||||
}
|
||||
|
||||
void World::_update(uint64_t p_frame) {
|
||||
void World3D::_update(uint64_t p_frame) {
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
indexer->_update(p_frame);
|
||||
#endif
|
||||
}
|
||||
|
||||
RID World::get_space() const {
|
||||
RID World3D::get_space() const {
|
||||
|
||||
return space;
|
||||
}
|
||||
|
||||
RID World::get_scenario() const {
|
||||
RID World3D::get_scenario() const {
|
||||
|
||||
return scenario;
|
||||
}
|
||||
|
||||
void World::set_environment(const Ref<Environment> &p_environment) {
|
||||
void World3D::set_environment(const Ref<Environment> &p_environment) {
|
||||
if (environment == p_environment) {
|
||||
return;
|
||||
}
|
||||
@ -282,12 +282,12 @@ void World::set_environment(const Ref<Environment> &p_environment) {
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Ref<Environment> World::get_environment() const {
|
||||
Ref<Environment> World3D::get_environment() const {
|
||||
|
||||
return environment;
|
||||
}
|
||||
|
||||
void World::set_fallback_environment(const Ref<Environment> &p_environment) {
|
||||
void World3D::set_fallback_environment(const Ref<Environment> &p_environment) {
|
||||
if (fallback_environment == p_environment) {
|
||||
return;
|
||||
}
|
||||
@ -301,12 +301,12 @@ void World::set_fallback_environment(const Ref<Environment> &p_environment) {
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Ref<Environment> World::get_fallback_environment() const {
|
||||
Ref<Environment> World3D::get_fallback_environment() const {
|
||||
|
||||
return fallback_environment;
|
||||
}
|
||||
|
||||
void World::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) {
|
||||
void World3D::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) {
|
||||
|
||||
camera_effects = p_camera_effects;
|
||||
if (camera_effects.is_valid())
|
||||
@ -315,34 +315,34 @@ void World::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) {
|
||||
VS::get_singleton()->scenario_set_camera_effects(scenario, RID());
|
||||
}
|
||||
|
||||
Ref<CameraEffects> World::get_camera_effects() const {
|
||||
Ref<CameraEffects> World3D::get_camera_effects() const {
|
||||
|
||||
return camera_effects;
|
||||
}
|
||||
|
||||
PhysicsDirectSpaceState *World::get_direct_space_state() {
|
||||
PhysicsDirectSpaceState *World3D::get_direct_space_state() {
|
||||
|
||||
return PhysicsServer::get_singleton()->space_get_direct_state(space);
|
||||
}
|
||||
|
||||
void World::get_camera_list(List<Camera3D *> *r_cameras) {
|
||||
void World3D::get_camera_list(List<Camera3D *> *r_cameras) {
|
||||
|
||||
for (Map<Camera3D *, SpatialIndexer::CameraData>::Element *E = indexer->cameras.front(); E; E = E->next()) {
|
||||
r_cameras->push_back(E->key());
|
||||
}
|
||||
}
|
||||
|
||||
void World::_bind_methods() {
|
||||
void World3D::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_space"), &World::get_space);
|
||||
ClassDB::bind_method(D_METHOD("get_scenario"), &World::get_scenario);
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "env"), &World::set_environment);
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &World::get_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World::set_fallback_environment);
|
||||
ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World::get_fallback_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_camera_effects", "env"), &World::set_camera_effects);
|
||||
ClassDB::bind_method(D_METHOD("get_camera_effects"), &World::get_camera_effects);
|
||||
ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state);
|
||||
ClassDB::bind_method(D_METHOD("get_space"), &World3D::get_space);
|
||||
ClassDB::bind_method(D_METHOD("get_scenario"), &World3D::get_scenario);
|
||||
ClassDB::bind_method(D_METHOD("set_environment", "env"), &World3D::set_environment);
|
||||
ClassDB::bind_method(D_METHOD("get_environment"), &World3D::get_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World3D::set_fallback_environment);
|
||||
ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World3D::get_fallback_environment);
|
||||
ClassDB::bind_method(D_METHOD("set_camera_effects", "env"), &World3D::set_camera_effects);
|
||||
ClassDB::bind_method(D_METHOD("get_camera_effects"), &World3D::get_camera_effects);
|
||||
ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World3D::get_direct_space_state);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_effects", PROPERTY_HINT_RESOURCE_TYPE, "CameraEffects"), "set_camera_effects", "get_camera_effects");
|
||||
@ -351,7 +351,7 @@ void World::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state");
|
||||
}
|
||||
|
||||
World::World() {
|
||||
World3D::World3D() {
|
||||
|
||||
space = PhysicsServer::get_singleton()->space_create();
|
||||
scenario = VisualServer::get_singleton()->scenario_create();
|
||||
@ -371,7 +371,7 @@ World::World() {
|
||||
#endif
|
||||
}
|
||||
|
||||
World::~World() {
|
||||
World3D::~World3D() {
|
||||
|
||||
PhysicsServer::get_singleton()->free(space);
|
||||
VisualServer::get_singleton()->free(scenario);
|
||||
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* world.h */
|
||||
/* world_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -28,8 +28,8 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef WORLD_H
|
||||
#define WORLD_H
|
||||
#ifndef WORLD_3D_H
|
||||
#define WORLD_3D_H
|
||||
|
||||
#include "core/resource.h"
|
||||
#include "scene/resources/environment.h"
|
||||
@ -40,9 +40,8 @@ class Camera3D;
|
||||
class VisibilityNotifier3D;
|
||||
struct SpatialIndexer;
|
||||
|
||||
class World : public Resource {
|
||||
GDCLASS(World, Resource);
|
||||
RES_BASE_EXTENSION("world");
|
||||
class World3D : public Resource {
|
||||
GDCLASS(World3D, Resource);
|
||||
|
||||
private:
|
||||
RID space;
|
||||
@ -85,8 +84,8 @@ public:
|
||||
|
||||
PhysicsDirectSpaceState *get_direct_space_state();
|
||||
|
||||
World();
|
||||
~World();
|
||||
World3D();
|
||||
~World3D();
|
||||
};
|
||||
|
||||
#endif // WORLD_H
|
||||
#endif // WORLD_3D_H
|
||||
Reference in New Issue
Block a user