Renaming of servers for coherency.
VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.
This commit is contained in:
parent
307b1b3a58
commit
a6f3bc7c69
390 changed files with 10701 additions and 10702 deletions
|
@ -317,7 +317,7 @@ bool DebuggerMarshalls::VisualProfilerFrame::deserialize(const Array &p_arr) {
|
|||
CHECK_SIZE(p_arr, size, "VisualProfilerFrame");
|
||||
int idx = 2;
|
||||
areas.resize(size / 3);
|
||||
VS::FrameProfileArea *w = areas.ptrw();
|
||||
RS::FrameProfileArea *w = areas.ptrw();
|
||||
for (int i = 0; i < size / 3; i++) {
|
||||
w[i].name = p_arr[idx];
|
||||
w[i].cpu_msec = p_arr[idx + 1];
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#define DEBUGGER_MARSHARLLS_H
|
||||
|
||||
#include "core/script_language.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
struct DebuggerMarshalls {
|
||||
|
||||
|
@ -165,7 +165,7 @@ struct DebuggerMarshalls {
|
|||
// Visual Profiler
|
||||
struct VisualProfilerFrame {
|
||||
uint64_t frame_number;
|
||||
Vector<VS::FrameProfileArea> areas;
|
||||
Vector<RS::FrameProfileArea> areas;
|
||||
|
||||
Array serialize();
|
||||
bool deserialize(const Array &p_arr);
|
||||
|
|
|
@ -354,18 +354,18 @@ struct RemoteDebugger::VisualProfiler {
|
|||
Map<StringName, ServerInfo> server_data;
|
||||
|
||||
void toggle(bool p_enable, const Array &p_opts) {
|
||||
VS::get_singleton()->set_frame_profiling_enabled(p_enable);
|
||||
RS::get_singleton()->set_frame_profiling_enabled(p_enable);
|
||||
}
|
||||
|
||||
void add(const Array &p_data) {}
|
||||
|
||||
void tick(float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time) {
|
||||
Vector<VS::FrameProfileArea> profile_areas = VS::get_singleton()->get_frame_profile();
|
||||
Vector<RS::FrameProfileArea> profile_areas = RS::get_singleton()->get_frame_profile();
|
||||
DebuggerMarshalls::VisualProfilerFrame frame;
|
||||
if (!profile_areas.size())
|
||||
return;
|
||||
|
||||
frame.frame_number = VS::get_singleton()->get_frame_profile_frame();
|
||||
frame.frame_number = RS::get_singleton()->get_frame_profile_frame();
|
||||
frame.areas.append_array(profile_areas);
|
||||
EngineDebugger::get_singleton()->send_message("visual:profile_frame", frame.serialize());
|
||||
}
|
||||
|
@ -404,10 +404,10 @@ void RemoteDebugger::_send_resource_usage() {
|
|||
|
||||
DebuggerMarshalls::ResourceUsage usage;
|
||||
|
||||
List<VS::TextureInfo> tinfo;
|
||||
VS::get_singleton()->texture_debug_usage(&tinfo);
|
||||
List<RS::TextureInfo> tinfo;
|
||||
RS::get_singleton()->texture_debug_usage(&tinfo);
|
||||
|
||||
for (List<VS::TextureInfo>::Element *E = tinfo.front(); E; E = E->next()) {
|
||||
for (List<RS::TextureInfo>::Element *E = tinfo.front(); E; E = E->next()) {
|
||||
|
||||
DebuggerMarshalls::ResourceInfo info;
|
||||
info.path = E->get().path;
|
||||
|
@ -771,9 +771,9 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
|
|||
|
||||
// This is for the camera override to stay live even when the game is paused from the editor
|
||||
loop_time_sec = (OS::get_singleton()->get_ticks_usec() - loop_begin_usec) / 1000000.0f;
|
||||
VisualServer::get_singleton()->sync();
|
||||
if (VisualServer::get_singleton()->has_changed()) {
|
||||
VisualServer::get_singleton()->draw(true, loop_time_sec * Engine::get_singleton()->get_time_scale());
|
||||
RenderingServer::get_singleton()->sync();
|
||||
if (RenderingServer::get_singleton()->has_changed()) {
|
||||
RenderingServer::get_singleton()->draw(true, loop_time_sec * Engine::get_singleton()->get_time_scale());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#include "core/rid_owner.h"
|
||||
#include "core/self_list.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering/rasterizer.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
class RasterizerSceneDummy : public RasterizerScene {
|
||||
public:
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
|
||||
RID sky_create() { return RID(); }
|
||||
void sky_set_radiance_size(RID p_sky, int p_radiance_size) {}
|
||||
void sky_set_mode(RID p_sky, VS::SkyMode p_samples) {}
|
||||
void sky_set_mode(RID p_sky, RS::SkyMode p_samples) {}
|
||||
void sky_set_texture(RID p_sky, RID p_panorama) {}
|
||||
void sky_set_texture(RID p_sky, RID p_cube_map, int p_radiance_size) {}
|
||||
void sky_set_material(RID p_sky, RID p_material) {}
|
||||
|
@ -64,28 +64,28 @@ public:
|
|||
|
||||
RID environment_create() { return RID(); }
|
||||
|
||||
void environment_set_background(RID p_env, VS::EnvironmentBG p_bg) {}
|
||||
void environment_set_background(RID p_env, RS::EnvironmentBG p_bg) {}
|
||||
void environment_set_sky(RID p_env, RID p_sky) {}
|
||||
void environment_set_sky_custom_fov(RID p_env, float p_scale) {}
|
||||
void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {}
|
||||
void environment_set_bg_color(RID p_env, const Color &p_color) {}
|
||||
void environment_set_bg_energy(RID p_env, float p_energy) {}
|
||||
void environment_set_canvas_max_layer(RID p_env, int p_max_layer) {}
|
||||
void environment_set_ambient_light(RID p_env, const Color &p_color, VS::EnvironmentAmbientSource p_ambient = VS::ENV_AMBIENT_SOURCE_BG, float p_energy = 1.0, float p_sky_contribution = 0.0, VS::EnvironmentReflectionSource p_reflection_source = VS::ENV_REFLECTION_SOURCE_BG, const Color &p_ao_color = Color()) {}
|
||||
void environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient = RS::ENV_AMBIENT_SOURCE_BG, float p_energy = 1.0, float p_sky_contribution = 0.0, RS::EnvironmentReflectionSource p_reflection_source = RS::ENV_REFLECTION_SOURCE_BG, const Color &p_ao_color = Color()) {}
|
||||
// FIXME: Disabled during Vulkan refactoring, should be ported.
|
||||
#if 0
|
||||
void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id) {}
|
||||
#endif
|
||||
|
||||
void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {}
|
||||
void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {}
|
||||
|
||||
void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {}
|
||||
|
||||
void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) {}
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {}
|
||||
virtual void environment_set_ssao_quality(VS::EnvironmentSSAOQuality p_quality, bool p_half_size) {}
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {}
|
||||
virtual void environment_set_ssao_quality(RS::EnvironmentSSAOQuality p_quality, bool p_half_size) {}
|
||||
|
||||
void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {}
|
||||
void environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {}
|
||||
|
||||
void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) {}
|
||||
|
||||
|
@ -94,13 +94,13 @@ public:
|
|||
void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) {}
|
||||
|
||||
bool is_environment(RID p_env) const { return false; }
|
||||
VS::EnvironmentBG environment_get_background(RID p_env) const { return VS::ENV_BG_KEEP; }
|
||||
RS::EnvironmentBG environment_get_background(RID p_env) const { return RS::ENV_BG_KEEP; }
|
||||
int environment_get_canvas_max_layer(RID p_env) const { return 0; }
|
||||
|
||||
virtual RID camera_effects_create() { return RID(); }
|
||||
|
||||
virtual void camera_effects_set_dof_blur_quality(VS::DOFBlurQuality p_quality, bool p_use_jitter) {}
|
||||
virtual void camera_effects_set_dof_blur_bokeh_shape(VS::DOFBokehShape p_shape) {}
|
||||
virtual void camera_effects_set_dof_blur_quality(RS::DOFBlurQuality p_quality, bool p_use_jitter) {}
|
||||
virtual void camera_effects_set_dof_blur_bokeh_shape(RS::DOFBokehShape p_shape) {}
|
||||
|
||||
virtual void camera_effects_set_dof_blur(RID p_camera_effects, bool p_far_enable, float p_far_distance, float p_far_transition, bool p_near_enable, float p_near_distance, float p_near_transition, float p_amount) {}
|
||||
virtual void camera_effects_set_custom_exposure(RID p_camera_effects, bool p_enable, float p_exposure) {}
|
||||
|
@ -133,10 +133,10 @@ public:
|
|||
|
||||
void set_scene_pass(uint64_t p_pass) {}
|
||||
virtual void set_time(double p_time, double p_step) {}
|
||||
void set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw) {}
|
||||
void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) {}
|
||||
|
||||
virtual RID render_buffers_create() { return RID(); }
|
||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, VS::ViewportMSAA p_msaa) {}
|
||||
virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa) {}
|
||||
|
||||
virtual void screen_space_roughness_limiter_set_active(bool p_enable, float p_curve) {}
|
||||
virtual bool screen_space_roughness_limiter_is_active() const { return false; }
|
||||
|
@ -162,7 +162,7 @@ public:
|
|||
|
||||
struct DummySurface {
|
||||
uint32_t format;
|
||||
VS::PrimitiveType primitive;
|
||||
RS::PrimitiveType primitive;
|
||||
Vector<uint8_t> array;
|
||||
int vertex_count;
|
||||
Vector<uint8_t> index_array;
|
||||
|
@ -175,14 +175,14 @@ public:
|
|||
struct DummyMesh {
|
||||
Vector<DummySurface> surfaces;
|
||||
int blend_shape_count;
|
||||
VS::BlendShapeMode blend_shape_mode;
|
||||
RS::BlendShapeMode blend_shape_mode;
|
||||
};
|
||||
|
||||
mutable RID_PtrOwner<DummyTexture> texture_owner;
|
||||
mutable RID_PtrOwner<DummyMesh> mesh_owner;
|
||||
|
||||
virtual RID texture_2d_create(const Ref<Image> &p_image) { return RID(); }
|
||||
virtual RID texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, VS::TextureLayeredType p_layered_type) { return RID(); }
|
||||
virtual RID texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, RS::TextureLayeredType p_layered_type) { return RID(); }
|
||||
virtual RID texture_3d_create(const Vector<Ref<Image>> &p_slices) { return RID(); }
|
||||
virtual RID texture_proxy_create(RID p_base) { return RID(); }
|
||||
|
||||
|
@ -209,11 +209,11 @@ public:
|
|||
virtual void texture_set_path(RID p_texture, const String &p_path) {}
|
||||
virtual String texture_get_path(RID p_texture) const { return String(); }
|
||||
|
||||
virtual void texture_set_detect_3d_callback(RID p_texture, VS::TextureDetectCallback p_callback, void *p_userdata) {}
|
||||
virtual void texture_set_detect_normal_callback(RID p_texture, VS::TextureDetectCallback p_callback, void *p_userdata) {}
|
||||
virtual void texture_set_detect_roughness_callback(RID p_texture, VS::TextureDetectRoughnessCallback p_callback, void *p_userdata) {}
|
||||
virtual void texture_set_detect_3d_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) {}
|
||||
virtual void texture_set_detect_normal_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) {}
|
||||
virtual void texture_set_detect_roughness_callback(RID p_texture, RS::TextureDetectRoughnessCallback p_callback, void *p_userdata) {}
|
||||
|
||||
virtual void texture_debug_usage(List<VS::TextureInfo> *r_info) {}
|
||||
virtual void texture_debug_usage(List<RS::TextureInfo> *r_info) {}
|
||||
virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) {}
|
||||
virtual Size2 texture_size_with_proxy(RID p_proxy) { return Size2(); }
|
||||
|
||||
|
@ -225,7 +225,7 @@ public:
|
|||
return texture_owner.make_rid(texture);
|
||||
}
|
||||
|
||||
void texture_allocate(RID p_texture, int p_width, int p_height, int p_depth_3d, Image::Format p_format, VisualServer::TextureType p_type = VS::TEXTURE_TYPE_2D, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT) {
|
||||
void texture_allocate(RID p_texture, int p_width, int p_height, int p_depth_3d, Image::Format p_format, RenderingServer::TextureType p_type = RS::TEXTURE_TYPE_2D, uint32_t p_flags = RS::TEXTURE_FLAGS_DEFAULT) {
|
||||
DummyTexture *t = texture_owner.getornull(p_texture);
|
||||
ERR_FAIL_COND(!t);
|
||||
t->width = p_width;
|
||||
|
@ -278,7 +278,7 @@ public:
|
|||
return t->format;
|
||||
}
|
||||
|
||||
VisualServer::TextureType texture_get_type(RID p_texture) const { return VS::TEXTURE_TYPE_2D; }
|
||||
RenderingServer::TextureType texture_get_type(RID p_texture) const { return RS::TEXTURE_TYPE_2D; }
|
||||
uint32_t texture_get_texid(RID p_texture) const { return 0; }
|
||||
uint32_t texture_get_width(RID p_texture) const { return 0; }
|
||||
uint32_t texture_get_height(RID p_texture) const { return 0; }
|
||||
|
@ -299,13 +299,13 @@ public:
|
|||
|
||||
void texture_set_shrink_all_x2_on_set_data(bool p_enable) {}
|
||||
|
||||
void texture_debug_usage(List<VS::TextureInfo> *r_info) {}
|
||||
void texture_debug_usage(List<RS::TextureInfo> *r_info) {}
|
||||
|
||||
RID texture_create_radiance_cubemap(RID p_source, int p_resolution = -1) const { return RID(); }
|
||||
|
||||
void texture_set_detect_3d_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {}
|
||||
void texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {}
|
||||
void texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) {}
|
||||
void texture_set_detect_3d_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata) {}
|
||||
void texture_set_detect_srgb_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata) {}
|
||||
void texture_set_detect_normal_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata) {}
|
||||
|
||||
void textures_keep_original(bool p_enable) {}
|
||||
|
||||
|
@ -353,14 +353,14 @@ public:
|
|||
DummyMesh *mesh = memnew(DummyMesh);
|
||||
ERR_FAIL_COND_V(!mesh, RID());
|
||||
mesh->blend_shape_count = 0;
|
||||
mesh->blend_shape_mode = VS::BLEND_SHAPE_MODE_NORMALIZED;
|
||||
mesh->blend_shape_mode = RS::BLEND_SHAPE_MODE_NORMALIZED;
|
||||
return mesh_owner.make_rid(mesh);
|
||||
}
|
||||
|
||||
void mesh_add_surface(RID p_mesh, const VS::SurfaceData &p_surface) {}
|
||||
void mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface) {}
|
||||
|
||||
#if 0
|
||||
void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t> > &p_blend_shapes = Vector<Vector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) {
|
||||
void mesh_add_surface(RID p_mesh, uint32_t p_format, RS::PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t> > &p_blend_shapes = Vector<Vector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) {
|
||||
DummyMesh *m = mesh_owner.getornull(p_mesh);
|
||||
ERR_FAIL_COND(!m);
|
||||
|
||||
|
@ -390,14 +390,14 @@ public:
|
|||
return m->blend_shape_count;
|
||||
}
|
||||
|
||||
void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) {
|
||||
void mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMode p_mode) {
|
||||
DummyMesh *m = mesh_owner.getornull(p_mesh);
|
||||
ERR_FAIL_COND(!m);
|
||||
m->blend_shape_mode = p_mode;
|
||||
}
|
||||
VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const {
|
||||
RS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const {
|
||||
DummyMesh *m = mesh_owner.getornull(p_mesh);
|
||||
ERR_FAIL_COND_V(!m, VS::BLEND_SHAPE_MODE_NORMALIZED);
|
||||
ERR_FAIL_COND_V(!m, RS::BLEND_SHAPE_MODE_NORMALIZED);
|
||||
return m->blend_shape_mode;
|
||||
}
|
||||
|
||||
|
@ -439,9 +439,9 @@ public:
|
|||
|
||||
return m->surfaces[p_surface].format;
|
||||
}
|
||||
VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const {
|
||||
RS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const {
|
||||
DummyMesh *m = mesh_owner.getornull(p_mesh);
|
||||
ERR_FAIL_COND_V(!m, VS::PRIMITIVE_POINTS);
|
||||
ERR_FAIL_COND_V(!m, RS::PRIMITIVE_POINTS);
|
||||
|
||||
return m->surfaces[p_surface].primitive;
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
VS::SurfaceData mesh_get_surface(RID p_mesh, int p_surface) const { return VS::SurfaceData(); }
|
||||
RS::SurfaceData mesh_get_surface(RID p_mesh, int p_surface) const { return RS::SurfaceData(); }
|
||||
int mesh_get_surface_count(RID p_mesh) const {
|
||||
DummyMesh *m = mesh_owner.getornull(p_mesh);
|
||||
ERR_FAIL_COND_V(!m, 0);
|
||||
|
@ -491,7 +491,7 @@ public:
|
|||
|
||||
virtual RID multimesh_create() { return RID(); }
|
||||
|
||||
virtual void multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, bool p_use_colors = false, bool p_use_custom_data = false) {}
|
||||
virtual void multimesh_allocate(RID p_multimesh, int p_instances, RS::MultimeshTransformFormat p_transform_format, bool p_use_colors = false, bool p_use_custom_data = false) {}
|
||||
int multimesh_get_instance_count(RID p_multimesh) const { return 0; }
|
||||
|
||||
void multimesh_set_mesh(RID p_multimesh, RID p_mesh) {}
|
||||
|
@ -516,7 +516,7 @@ public:
|
|||
/* IMMEDIATE API */
|
||||
|
||||
RID immediate_create() { return RID(); }
|
||||
void immediate_begin(RID p_immediate, VS::PrimitiveType p_rimitive, RID p_texture = RID()) {}
|
||||
void immediate_begin(RID p_immediate, RS::PrimitiveType p_rimitive, RID p_texture = RID()) {}
|
||||
void immediate_vertex(RID p_immediate, const Vector3 &p_vertex) {}
|
||||
void immediate_normal(RID p_immediate, const Vector3 &p_normal) {}
|
||||
void immediate_tangent(RID p_immediate, const Plane &p_tangent) {}
|
||||
|
@ -543,14 +543,14 @@ public:
|
|||
|
||||
/* Light API */
|
||||
|
||||
RID light_create(VS::LightType p_type) { return RID(); }
|
||||
RID light_create(RS::LightType p_type) { return RID(); }
|
||||
|
||||
RID directional_light_create() { return light_create(VS::LIGHT_DIRECTIONAL); }
|
||||
RID omni_light_create() { return light_create(VS::LIGHT_OMNI); }
|
||||
RID spot_light_create() { return light_create(VS::LIGHT_SPOT); }
|
||||
RID directional_light_create() { return light_create(RS::LIGHT_DIRECTIONAL); }
|
||||
RID omni_light_create() { return light_create(RS::LIGHT_OMNI); }
|
||||
RID spot_light_create() { return light_create(RS::LIGHT_SPOT); }
|
||||
|
||||
void light_set_color(RID p_light, const Color &p_color) {}
|
||||
void light_set_param(RID p_light, VS::LightParam p_param, float p_value) {}
|
||||
void light_set_param(RID p_light, RS::LightParam p_param, float p_value) {}
|
||||
void light_set_shadow(RID p_light, bool p_enabled) {}
|
||||
void light_set_shadow_color(RID p_light, const Color &p_color) {}
|
||||
void light_set_projector(RID p_light, RID p_texture) {}
|
||||
|
@ -559,22 +559,22 @@ public:
|
|||
void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {}
|
||||
void light_set_use_gi(RID p_light, bool p_enabled) {}
|
||||
|
||||
void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {}
|
||||
void light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode) {}
|
||||
|
||||
void light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode) {}
|
||||
void light_directional_set_shadow_mode(RID p_light, RS::LightDirectionalShadowMode p_mode) {}
|
||||
void light_directional_set_blend_splits(RID p_light, bool p_enable) {}
|
||||
bool light_directional_get_blend_splits(RID p_light) const { return false; }
|
||||
void light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode) {}
|
||||
VS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const { return VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE; }
|
||||
void light_directional_set_shadow_depth_range_mode(RID p_light, RS::LightDirectionalShadowDepthRangeMode p_range_mode) {}
|
||||
RS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const { return RS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE; }
|
||||
|
||||
VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) { return VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL; }
|
||||
VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) { return VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID; }
|
||||
RS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) { return RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL; }
|
||||
RS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) { return RS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID; }
|
||||
|
||||
bool light_has_shadow(RID p_light) const { return false; }
|
||||
|
||||
VS::LightType light_get_type(RID p_light) const { return VS::LIGHT_OMNI; }
|
||||
RS::LightType light_get_type(RID p_light) const { return RS::LIGHT_OMNI; }
|
||||
AABB light_get_aabb(RID p_light) const { return AABB(); }
|
||||
float light_get_param(RID p_light, VS::LightParam p_param) { return 0.0; }
|
||||
float light_get_param(RID p_light, RS::LightParam p_param) { return 0.0; }
|
||||
Color light_get_color(RID p_light) { return Color(); }
|
||||
bool light_get_use_gi(RID p_light) { return false; }
|
||||
uint64_t light_get_version(RID p_light) const { return 0; }
|
||||
|
@ -583,7 +583,7 @@ public:
|
|||
|
||||
RID reflection_probe_create() { return RID(); }
|
||||
|
||||
void reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode) {}
|
||||
void reflection_probe_set_update_mode(RID p_probe, RS::ReflectionProbeUpdateMode p_mode) {}
|
||||
void reflection_probe_set_intensity(RID p_probe, float p_intensity) {}
|
||||
void reflection_probe_set_interior_ambient(RID p_probe, const Color &p_ambient) {}
|
||||
void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy) {}
|
||||
|
@ -598,7 +598,7 @@ public:
|
|||
void reflection_probe_set_resolution(RID p_probe, int p_resolution) {}
|
||||
|
||||
AABB reflection_probe_get_aabb(RID p_probe) const { return AABB(); }
|
||||
VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const { return VisualServer::REFLECTION_PROBE_UPDATE_ONCE; }
|
||||
RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const { return RenderingServer::REFLECTION_PROBE_UPDATE_ONCE; }
|
||||
uint32_t reflection_probe_get_cull_mask(RID p_probe) const { return 0; }
|
||||
Vector3 reflection_probe_get_extents(RID p_probe) const { return Vector3(); }
|
||||
Vector3 reflection_probe_get_origin_offset(RID p_probe) const { return Vector3(); }
|
||||
|
@ -742,7 +742,7 @@ public:
|
|||
void particles_set_fractional_delta(RID p_particles, bool p_enable) {}
|
||||
void particles_restart(RID p_particles) {}
|
||||
|
||||
void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order) {}
|
||||
void particles_set_draw_order(RID p_particles, RS::ParticlesDrawOrder p_order) {}
|
||||
|
||||
void particles_set_draw_passes(RID p_particles, int p_count) {}
|
||||
void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) {}
|
||||
|
@ -776,12 +776,12 @@ public:
|
|||
virtual void render_target_disable_clear_request(RID p_render_target) {}
|
||||
virtual void render_target_do_clear_request(RID p_render_target) {}
|
||||
|
||||
VS::InstanceType get_base_type(RID p_rid) const {
|
||||
RS::InstanceType get_base_type(RID p_rid) const {
|
||||
if (mesh_owner.owns(p_rid)) {
|
||||
return VS::INSTANCE_MESH;
|
||||
return RS::INSTANCE_MESH;
|
||||
}
|
||||
|
||||
return VS::INSTANCE_NONE;
|
||||
return RS::INSTANCE_NONE;
|
||||
}
|
||||
|
||||
bool free(RID p_rid) {
|
||||
|
@ -803,9 +803,9 @@ public:
|
|||
|
||||
void render_info_begin_capture() {}
|
||||
void render_info_end_capture() {}
|
||||
int get_captured_render_info(VS::RenderInfo p_info) { return 0; }
|
||||
int get_captured_render_info(RS::RenderInfo p_info) { return 0; }
|
||||
|
||||
int get_render_info(VS::RenderInfo p_info) { return 0; }
|
||||
int get_render_info(RS::RenderInfo p_info) { return 0; }
|
||||
String get_video_adapter_name() const { return String(); }
|
||||
String get_video_adapter_vendor() const { return String(); }
|
||||
|
||||
|
@ -825,7 +825,7 @@ public:
|
|||
|
||||
class RasterizerCanvasDummy : public RasterizerCanvas {
|
||||
public:
|
||||
virtual TextureBindingID request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, VS::CanvasItemTextureFilter p_filter, VS::CanvasItemTextureRepeat p_repeat, RID p_multimesh) { return 0; }
|
||||
virtual TextureBindingID request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat, RID p_multimesh) { return 0; }
|
||||
virtual void free_texture_binding(TextureBindingID p_binding) {}
|
||||
|
||||
virtual PolygonID request_polygon(const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>()) { return 0; }
|
||||
|
@ -841,7 +841,7 @@ public:
|
|||
|
||||
virtual RID occluder_polygon_create() { return RID(); }
|
||||
virtual void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines) {}
|
||||
virtual void occluder_polygon_set_cull_mode(RID p_occluder, VS::CanvasOccluderPolygonCullMode p_mode) {}
|
||||
virtual void occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode) {}
|
||||
|
||||
void draw_window_margins(int *p_margins, RID *p_margin_textures) {}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "core/os/os.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "rasterizer_scene_gles2.h"
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/rendering/rendering_server_raster.h"
|
||||
|
||||
#ifndef GLES_OVER_GL
|
||||
#define glClearDepth glClearDepthf
|
||||
|
@ -85,7 +85,7 @@ void RasterizerCanvasGLES2::_set_uniforms() {
|
|||
state.canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_COLOR, light->color * light->energy);
|
||||
state.canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_POS, light->light_shader_pos);
|
||||
state.canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_HEIGHT, light->height);
|
||||
state.canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_OUTSIDE_ALPHA, light->mode == VS::CANVAS_LIGHT_MODE_MASK ? 1.0 : 0.0);
|
||||
state.canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_OUTSIDE_ALPHA, light->mode == RS::CANVAS_LIGHT_MODE_MASK ? 1.0 : 0.0);
|
||||
|
||||
if (state.using_shadow) {
|
||||
RasterizerStorageGLES2::CanvasLightShadow *cls = storage->canvas_light_shadow_owner.getornull(light->shadow_buffer);
|
||||
|
@ -152,8 +152,8 @@ void RasterizerCanvasGLES2::canvas_begin() {
|
|||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
|
||||
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
|
||||
// set up default uniforms
|
||||
|
||||
|
@ -188,7 +188,7 @@ void RasterizerCanvasGLES2::canvas_end() {
|
|||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
for (int i = 0; i < VS::ARRAY_MAX; i++) {
|
||||
for (int i = 0; i < RS::ARRAY_MAX; i++) {
|
||||
glDisableVertexAttribArray(i);
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(con
|
|||
} else {
|
||||
|
||||
if (texture->redraw_if_visible) {
|
||||
VisualServerRaster::redraw_request();
|
||||
RenderingServerRaster::redraw_request();
|
||||
}
|
||||
|
||||
texture = texture->get_ptr();
|
||||
|
@ -266,7 +266,7 @@ RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(con
|
|||
} else {
|
||||
|
||||
if (normal_map->redraw_if_visible) { //check before proxy, because this is usually used with proxies
|
||||
VisualServerRaster::redraw_request();
|
||||
RenderingServerRaster::redraw_request();
|
||||
}
|
||||
|
||||
normal_map = normal_map->get_ptr();
|
||||
|
@ -299,47 +299,47 @@ void RasterizerCanvasGLES2::_draw_polygon(const int *p_indices, int p_index_coun
|
|||
uint32_t buffer_ofs = 0;
|
||||
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
|
||||
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
|
||||
buffer_ofs += sizeof(Vector2) * p_vertex_count;
|
||||
|
||||
if (p_singlecolor) {
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
Color m = *p_colors;
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
|
||||
} else if (!p_colors) {
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
} else {
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Color) * p_vertex_count, p_colors);
|
||||
glEnableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
glEnableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
buffer_ofs += sizeof(Color) * p_vertex_count;
|
||||
}
|
||||
|
||||
if (p_uvs) {
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_uvs);
|
||||
glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
buffer_ofs += sizeof(Vector2) * p_vertex_count;
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
}
|
||||
|
||||
if (p_weights && p_bones) {
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(float) * 4 * p_vertex_count, p_weights);
|
||||
glEnableVertexAttribArray(VS::ARRAY_WEIGHTS);
|
||||
glVertexAttribPointer(VS::ARRAY_WEIGHTS, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4, CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
glEnableVertexAttribArray(RS::ARRAY_WEIGHTS);
|
||||
glVertexAttribPointer(RS::ARRAY_WEIGHTS, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4, CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
buffer_ofs += sizeof(float) * 4 * p_vertex_count;
|
||||
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(int) * 4 * p_vertex_count, p_bones);
|
||||
glEnableVertexAttribArray(VS::ARRAY_BONES);
|
||||
glVertexAttribPointer(VS::ARRAY_BONES, 4, GL_UNSIGNED_INT, GL_FALSE, sizeof(int) * 4, CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
glEnableVertexAttribArray(RS::ARRAY_BONES);
|
||||
glVertexAttribPointer(RS::ARRAY_BONES, 4, GL_UNSIGNED_INT, GL_FALSE, sizeof(int) * 4, CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
buffer_ofs += sizeof(int) * 4 * p_vertex_count;
|
||||
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_WEIGHTS);
|
||||
glDisableVertexAttribArray(VS::ARRAY_BONES);
|
||||
glDisableVertexAttribArray(RS::ARRAY_WEIGHTS);
|
||||
glDisableVertexAttribArray(RS::ARRAY_BONES);
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
|
||||
|
@ -375,30 +375,30 @@ void RasterizerCanvasGLES2::_draw_generic(GLuint p_primitive, int p_vertex_count
|
|||
uint32_t buffer_ofs = 0;
|
||||
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
|
||||
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
|
||||
buffer_ofs += sizeof(Vector2) * p_vertex_count;
|
||||
|
||||
if (p_singlecolor) {
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
Color m = *p_colors;
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
|
||||
} else if (!p_colors) {
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
} else {
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Color) * p_vertex_count, p_colors);
|
||||
glEnableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
glEnableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
buffer_ofs += sizeof(Color) * p_vertex_count;
|
||||
}
|
||||
|
||||
if (p_uvs) {
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_uvs);
|
||||
glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
}
|
||||
|
||||
glDrawArrays(p_primitive, 0, p_vertex_count);
|
||||
|
@ -417,31 +417,31 @@ void RasterizerCanvasGLES2::_draw_generic_indices(GLuint p_primitive, const int
|
|||
uint32_t buffer_ofs = 0;
|
||||
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
|
||||
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
|
||||
buffer_ofs += sizeof(Vector2) * p_vertex_count;
|
||||
|
||||
if (p_singlecolor) {
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
Color m = *p_colors;
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, m.r, m.g, m.b, m.a);
|
||||
} else if (!p_colors) {
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
} else {
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Color) * p_vertex_count, p_colors);
|
||||
glEnableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
glEnableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
buffer_ofs += sizeof(Color) * p_vertex_count;
|
||||
}
|
||||
|
||||
if (p_uvs) {
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_uvs);
|
||||
glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
|
||||
buffer_ofs += sizeof(Vector2) * p_vertex_count;
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
|
||||
|
@ -514,16 +514,16 @@ void RasterizerCanvasGLES2::_draw_gui_primitive(int p_points, const Vector2 *p_v
|
|||
#endif
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, p_points * stride * 4 * sizeof(float), buffer_data);
|
||||
|
||||
glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), NULL);
|
||||
glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), NULL);
|
||||
|
||||
if (p_colors) {
|
||||
glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, stride * sizeof(float), CAST_INT_TO_UCHAR_PTR(color_offset * sizeof(float)));
|
||||
glEnableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, stride * sizeof(float), CAST_INT_TO_UCHAR_PTR(color_offset * sizeof(float)));
|
||||
glEnableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
}
|
||||
|
||||
if (p_uvs) {
|
||||
glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), CAST_INT_TO_UCHAR_PTR(uv_offset * sizeof(float)));
|
||||
glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), CAST_INT_TO_UCHAR_PTR(uv_offset * sizeof(float)));
|
||||
glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
}
|
||||
|
||||
glDrawArrays(prim[p_points], 0, p_points);
|
||||
|
@ -564,8 +564,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
|
||||
_bind_canvas_texture(RID(), RID());
|
||||
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttrib4fv(VS::ARRAY_COLOR, line->color.components);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glVertexAttrib4fv(RS::ARRAY_COLOR, line->color.components);
|
||||
|
||||
state.canvas_shader.set_uniform(CanvasShaderGLES2::MODELVIEW_MATRIX, state.uniforms.modelview_matrix);
|
||||
|
||||
|
@ -616,8 +616,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
|
||||
Item::CommandRect *r = static_cast<Item::CommandRect *>(command);
|
||||
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttrib4fv(VS::ARRAY_COLOR, r->modulate.components);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glVertexAttrib4fv(RS::ARRAY_COLOR, r->modulate.components);
|
||||
|
||||
bool can_tile = true;
|
||||
if (r->texture.is_valid() && r->flags & CANVAS_RECT_TILE && !storage->config.support_npot_repeat_mipmap) {
|
||||
|
@ -696,7 +696,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
|
||||
bool untile = false;
|
||||
|
||||
if (can_tile && r->flags & CANVAS_RECT_TILE && !(texture->flags & VS::TEXTURE_FLAG_REPEAT)) {
|
||||
if (can_tile && r->flags & CANVAS_RECT_TILE && !(texture->flags & RS::TEXTURE_FLAG_REPEAT)) {
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
untile = true;
|
||||
|
@ -753,7 +753,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
|
||||
bool untile = false;
|
||||
|
||||
if (can_tile && r->flags & CANVAS_RECT_TILE && !(tex->flags & VS::TEXTURE_FLAG_REPEAT)) {
|
||||
if (can_tile && r->flags & CANVAS_RECT_TILE && !(tex->flags & RS::TEXTURE_FLAG_REPEAT)) {
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
untile = true;
|
||||
|
@ -816,8 +816,8 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
state.canvas_shader.use_material((void *)p_material);
|
||||
}
|
||||
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glVertexAttrib4fv(VS::ARRAY_COLOR, np->color.components);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glVertexAttrib4fv(RS::ARRAY_COLOR, np->color.components);
|
||||
|
||||
RasterizerStorageGLES2::Texture *tex = _bind_canvas_texture(np->texture, np->normal_map);
|
||||
|
||||
|
@ -968,11 +968,11 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.ninepatch_elements);
|
||||
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
|
||||
glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), NULL);
|
||||
glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), CAST_INT_TO_UCHAR_PTR((sizeof(float) * 2)));
|
||||
glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), NULL);
|
||||
glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), CAST_INT_TO_UCHAR_PTR((sizeof(float) * 2)));
|
||||
|
||||
glDrawElements(GL_TRIANGLES, 18 * 3 - (np->draw_center ? 0 : 6), GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
|
@ -1072,18 +1072,18 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
|
||||
}
|
||||
|
||||
for (int k = 0; k < VS::ARRAY_MAX - 1; k++) {
|
||||
for (int k = 0; k < RS::ARRAY_MAX - 1; k++) {
|
||||
if (s->attribs[k].enabled) {
|
||||
glEnableVertexAttribArray(k);
|
||||
glVertexAttribPointer(s->attribs[k].index, s->attribs[k].size, s->attribs[k].type, s->attribs[k].normalized, s->attribs[k].stride, CAST_INT_TO_UCHAR_PTR(s->attribs[k].offset));
|
||||
} else {
|
||||
glDisableVertexAttribArray(k);
|
||||
switch (k) {
|
||||
case VS::ARRAY_NORMAL: {
|
||||
glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
|
||||
case RS::ARRAY_NORMAL: {
|
||||
glVertexAttrib4f(RS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
|
||||
} break;
|
||||
case VS::ARRAY_COLOR: {
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
case RS::ARRAY_COLOR: {
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
|
||||
} break;
|
||||
default: {
|
||||
|
@ -1099,7 +1099,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
}
|
||||
}
|
||||
|
||||
for (int j = 1; j < VS::ARRAY_MAX - 1; j++) {
|
||||
for (int j = 1; j < RS::ARRAY_MAX - 1; j++) {
|
||||
glDisableVertexAttribArray(j);
|
||||
}
|
||||
}
|
||||
|
@ -1118,7 +1118,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
if (!mesh_data)
|
||||
break;
|
||||
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_INSTANCE_CUSTOM, multi_mesh->custom_data_format != VS::MULTIMESH_CUSTOM_DATA_NONE);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_INSTANCE_CUSTOM, multi_mesh->custom_data_format != RS::MULTIMESH_CUSTOM_DATA_NONE);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_INSTANCING, true);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_TEXTURE_RECT, false);
|
||||
|
||||
|
@ -1162,18 +1162,18 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
|
||||
}
|
||||
|
||||
for (int k = 0; k < VS::ARRAY_MAX - 1; k++) {
|
||||
for (int k = 0; k < RS::ARRAY_MAX - 1; k++) {
|
||||
if (s->attribs[k].enabled) {
|
||||
glEnableVertexAttribArray(k);
|
||||
glVertexAttribPointer(s->attribs[k].index, s->attribs[k].size, s->attribs[k].type, s->attribs[k].normalized, s->attribs[k].stride, CAST_INT_TO_UCHAR_PTR(s->attribs[k].offset));
|
||||
} else {
|
||||
glDisableVertexAttribArray(k);
|
||||
switch (k) {
|
||||
case VS::ARRAY_NORMAL: {
|
||||
glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
|
||||
case RS::ARRAY_NORMAL: {
|
||||
glVertexAttrib4f(RS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
|
||||
} break;
|
||||
case VS::ARRAY_COLOR: {
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
case RS::ARRAY_COLOR: {
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
|
||||
} break;
|
||||
default: {
|
||||
|
@ -1189,7 +1189,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
|
||||
glVertexAttrib4fv(INSTANCE_ATTRIB_BASE + 0, &buffer[0]);
|
||||
glVertexAttrib4fv(INSTANCE_ATTRIB_BASE + 1, &buffer[4]);
|
||||
if (multi_mesh->transform_format == VS::MULTIMESH_TRANSFORM_3D) {
|
||||
if (multi_mesh->transform_format == RS::MULTIMESH_TRANSFORM_3D) {
|
||||
glVertexAttrib4fv(INSTANCE_ATTRIB_BASE + 2, &buffer[8]);
|
||||
} else {
|
||||
glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 2, 0.0, 0.0, 1.0, 0.0);
|
||||
|
@ -1197,7 +1197,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
}
|
||||
|
||||
if (multi_mesh->color_floats) {
|
||||
if (multi_mesh->color_format == VS::MULTIMESH_COLOR_8BIT) {
|
||||
if (multi_mesh->color_format == RS::MULTIMESH_COLOR_8BIT) {
|
||||
uint8_t *color_data = (uint8_t *)(buffer + color_ofs);
|
||||
glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 3, color_data[0] / 255.0, color_data[1] / 255.0, color_data[2] / 255.0, color_data[3] / 255.0);
|
||||
} else {
|
||||
|
@ -1208,7 +1208,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
}
|
||||
|
||||
if (multi_mesh->custom_data_floats) {
|
||||
if (multi_mesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_8BIT) {
|
||||
if (multi_mesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_8BIT) {
|
||||
uint8_t *custom_data = (uint8_t *)(buffer + custom_data_ofs);
|
||||
glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 4, custom_data[0] / 255.0, custom_data[1] / 255.0, custom_data[2] / 255.0, custom_data[3] / 255.0);
|
||||
} else {
|
||||
|
@ -1301,9 +1301,9 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
|
|||
|
||||
if (primitive->colors.size() == 1 && primitive->points.size() > 1) {
|
||||
Color c = primitive->colors[0];
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, c.r, c.g, c.b, c.a);
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, c.r, c.g, c.b, c.a);
|
||||
} else if (primitive->colors.empty()) {
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
}
|
||||
|
||||
_draw_gui_primitive(primitive->points.size(), primitive->points.ptr(), primitive->colors.ptr(), primitive->uvs.ptr());
|
||||
|
@ -1518,7 +1518,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
|
|||
if (material_ptr) {
|
||||
shader_ptr = material_ptr->shader;
|
||||
|
||||
if (shader_ptr && shader_ptr->mode != VS::SHADER_CANVAS_ITEM) {
|
||||
if (shader_ptr && shader_ptr->mode != RS::SHADER_CANVAS_ITEM) {
|
||||
shader_ptr = NULL; // not a canvas item shader, don't use.
|
||||
}
|
||||
}
|
||||
|
@ -1542,7 +1542,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
|
|||
if (shader_ptr != shader_cache) {
|
||||
|
||||
if (shader_ptr->canvas_item.uses_time) {
|
||||
VisualServerRaster::redraw_request();
|
||||
RenderingServerRaster::redraw_request();
|
||||
}
|
||||
|
||||
state.canvas_shader.set_custom_shader(shader_ptr->custom_code_id);
|
||||
|
@ -1582,7 +1582,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
|
|||
}
|
||||
|
||||
if (t->redraw_if_visible) {
|
||||
VisualServerRaster::redraw_request();
|
||||
RenderingServerRaster::redraw_request();
|
||||
}
|
||||
|
||||
t = t->get_ptr();
|
||||
|
@ -1682,7 +1682,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
|
|||
|
||||
Light *light = p_light;
|
||||
bool light_used = false;
|
||||
VS::CanvasLightMode mode = VS::CANVAS_LIGHT_MODE_ADD;
|
||||
RS::CanvasLightMode mode = RS::CANVAS_LIGHT_MODE_ADD;
|
||||
state.uniforms.final_modulate = ci->final_modulate; // remove the canvas modulate
|
||||
|
||||
while (light) {
|
||||
|
@ -1697,17 +1697,17 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
|
|||
|
||||
switch (mode) {
|
||||
|
||||
case VS::CANVAS_LIGHT_MODE_ADD: {
|
||||
case RS::CANVAS_LIGHT_MODE_ADD: {
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
} break;
|
||||
case VS::CANVAS_LIGHT_MODE_SUB: {
|
||||
case RS::CANVAS_LIGHT_MODE_SUB: {
|
||||
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
} break;
|
||||
case VS::CANVAS_LIGHT_MODE_MIX:
|
||||
case VS::CANVAS_LIGHT_MODE_MASK: {
|
||||
case RS::CANVAS_LIGHT_MODE_MIX:
|
||||
case RS::CANVAS_LIGHT_MODE_MASK: {
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
@ -1726,12 +1726,12 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
|
|||
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_SHADOWS, has_shadow);
|
||||
if (has_shadow) {
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_USE_GRADIENT, light->shadow_gradient_length > 0);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_NEAREST, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_NONE);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF3, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_PCF3);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF5, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_PCF5);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF7, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_PCF7);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF9, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_PCF9);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF13, light->shadow_filter == VS::CANVAS_LIGHT_FILTER_PCF13);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_NEAREST, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_NONE);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF3, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_PCF3);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF5, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_PCF5);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF7, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_PCF7);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF9, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_PCF9);
|
||||
state.canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_FILTER_PCF13, light->shadow_filter == RS::CANVAS_LIGHT_FILTER_PCF13);
|
||||
}
|
||||
|
||||
state.canvas_shader.bind();
|
||||
|
@ -1846,7 +1846,7 @@ void RasterizerCanvasGLES2::canvas_light_shadow_buffer_update(RID p_buffer, cons
|
|||
glClearColor(1, 1, 1, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
VS::CanvasOccluderPolygonCullMode cull = VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
|
||||
RS::CanvasOccluderPolygonCullMode cull = RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
||||
|
@ -1903,31 +1903,31 @@ void RasterizerCanvasGLES2::canvas_light_shadow_buffer_update(RID p_buffer, cons
|
|||
|
||||
state.canvas_shadow_shader.set_uniform(CanvasShadowShaderGLES2::WORLD_MATRIX, instance->xform_cache);
|
||||
|
||||
VS::CanvasOccluderPolygonCullMode transformed_cull_cache = instance->cull_cache;
|
||||
RS::CanvasOccluderPolygonCullMode transformed_cull_cache = instance->cull_cache;
|
||||
|
||||
if (transformed_cull_cache != VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED &&
|
||||
if (transformed_cull_cache != RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED &&
|
||||
(p_light_xform.basis_determinant() * instance->xform_cache.basis_determinant()) < 0) {
|
||||
transformed_cull_cache =
|
||||
transformed_cull_cache == VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE ?
|
||||
VS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE :
|
||||
VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE;
|
||||
transformed_cull_cache == RS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE ?
|
||||
RS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE :
|
||||
RS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE;
|
||||
}
|
||||
|
||||
if (cull != transformed_cull_cache) {
|
||||
|
||||
cull = transformed_cull_cache;
|
||||
switch (cull) {
|
||||
case VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED: {
|
||||
case RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED: {
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
} break;
|
||||
case VS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE: {
|
||||
case RS::CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE: {
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_FRONT);
|
||||
} break;
|
||||
case VS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE: {
|
||||
case RS::CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE: {
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
|
@ -1937,8 +1937,8 @@ void RasterizerCanvasGLES2::canvas_light_shadow_buffer_update(RID p_buffer, cons
|
|||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, cc->vertex_id);
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, false, 0, 0);
|
||||
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer(RS::ARRAY_VERTEX, 3, GL_FLOAT, false, 0, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cc->index_id);
|
||||
|
||||
glDrawElements(GL_TRIANGLES, cc->len * 3, GL_UNSIGNED_SHORT, 0);
|
||||
|
@ -1979,8 +1979,8 @@ void RasterizerCanvasGLES2::reset_canvas() {
|
|||
|
||||
void RasterizerCanvasGLES2::_bind_quad_buffer() {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, data.canvas_quad_vertices);
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
}
|
||||
void RasterizerCanvasGLES2::draw_generic_textured_rect(const Rect2 &p_rect, const Rect2 &p_src) {
|
||||
|
||||
|
@ -2022,7 +2022,7 @@ void RasterizerCanvasGLES2::draw_lens_distortion_rect(const Rect2 &p_rect, float
|
|||
// and cleanup
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
for (int i = 0; i < VS::ARRAY_MAX; i++) {
|
||||
for (int i = 0; i < RS::ARRAY_MAX; i++) {
|
||||
glDisableVertexAttribArray(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#define RASTERIZERCANVASGLES2_H
|
||||
|
||||
#include "rasterizer_storage_gles2.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "servers/rendering/rasterizer.h"
|
||||
|
||||
#include "shaders/canvas.glsl.gen.h"
|
||||
#include "shaders/lens_distorted.glsl.gen.h"
|
||||
|
|
|
@ -263,7 +263,7 @@ void RasterizerGLES2::initialize() {
|
|||
#endif // GLES_OVER_GL
|
||||
#endif // CAN_DEBUG
|
||||
|
||||
print_line("OpenGL ES 2.0 Renderer: " + VisualServer::get_singleton()->get_video_adapter_name());
|
||||
print_line("OpenGL ES 2.0 Renderer: " + RenderingServer::get_singleton()->get_video_adapter_name());
|
||||
storage->initialize();
|
||||
canvas->initialize();
|
||||
scene->initialize();
|
||||
|
@ -359,7 +359,7 @@ void RasterizerGLES2::set_boot_image(const Ref<Image> &p_image, const Color &p_c
|
|||
canvas->canvas_begin();
|
||||
|
||||
RID texture = storage->texture_create();
|
||||
storage->texture_allocate(texture, p_image->get_width(), p_image->get_height(), 0, p_image->get_format(), VS::TEXTURE_TYPE_2D, p_use_filter ? VS::TEXTURE_FLAG_FILTER : 0);
|
||||
storage->texture_allocate(texture, p_image->get_width(), p_image->get_height(), 0, p_image->get_format(), RS::TEXTURE_TYPE_2D, p_use_filter ? RS::TEXTURE_FLAG_FILTER : 0);
|
||||
storage->texture_set_data(texture, p_image);
|
||||
|
||||
Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height());
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "rasterizer_canvas_gles2.h"
|
||||
#include "rasterizer_scene_gles2.h"
|
||||
#include "rasterizer_storage_gles2.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "servers/rendering/rasterizer.h"
|
||||
|
||||
class RasterizerGLES2 : public Rasterizer {
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "core/vmap.h"
|
||||
#include "rasterizer_canvas_gles2.h"
|
||||
#include "servers/camera/camera_feed.h"
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/rendering/rendering_server_raster.h"
|
||||
|
||||
#ifndef GLES_OVER_GL
|
||||
#define glClearDepth glClearDepthf
|
||||
|
@ -456,10 +456,10 @@ int RasterizerSceneGLES2::get_directional_light_shadow_size(RID p_light_intance)
|
|||
ERR_FAIL_COND_V(!light_instance, 0);
|
||||
|
||||
switch (light_instance->light_ptr->directional_shadow_mode) {
|
||||
case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL:
|
||||
case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL:
|
||||
break; //none
|
||||
case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS:
|
||||
case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS:
|
||||
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS:
|
||||
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS:
|
||||
shadow_size /= 2;
|
||||
break;
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ bool RasterizerSceneGLES2::reflection_probe_instance_needs_redraw(RID p_instance
|
|||
const ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance);
|
||||
ERR_FAIL_COND_V(!rpi, false);
|
||||
|
||||
bool need_redraw = rpi->probe_ptr->resolution != rpi->current_resolution || rpi->dirty || rpi->probe_ptr->update_mode == VS::REFLECTION_PROBE_UPDATE_ALWAYS;
|
||||
bool need_redraw = rpi->probe_ptr->resolution != rpi->current_resolution || rpi->dirty || rpi->probe_ptr->update_mode == RS::REFLECTION_PROBE_UPDATE_ALWAYS;
|
||||
rpi->dirty = false;
|
||||
return need_redraw;
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ bool RasterizerSceneGLES2::reflection_probe_instance_postprocess_step(RID p_inst
|
|||
glDisable(GL_BLEND);
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
|
||||
for (int i = 0; i < RS::ARRAY_MAX - 1; i++) {
|
||||
glDisableVertexAttribArray(i);
|
||||
}
|
||||
}
|
||||
|
@ -690,7 +690,7 @@ RID RasterizerSceneGLES2::environment_create() {
|
|||
return environment_owner.make_rid(env);
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_background(RID p_env, VS::EnvironmentBG p_bg) {
|
||||
void RasterizerSceneGLES2::environment_set_background(RID p_env, RS::EnvironmentBG p_bg) {
|
||||
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
@ -755,7 +755,7 @@ void RasterizerSceneGLES2::environment_set_camera_feed_id(RID p_env, int p_camer
|
|||
env->camera_feed_id = p_camera_feed_id;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality) {
|
||||
void RasterizerSceneGLES2::environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::EnvironmentDOFBlurQuality p_quality) {
|
||||
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
@ -767,7 +767,7 @@ void RasterizerSceneGLES2::environment_set_dof_blur_far(RID p_env, bool p_enable
|
|||
env->dof_blur_far_quality = p_quality;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality) {
|
||||
void RasterizerSceneGLES2::environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::EnvironmentDOFBlurQuality p_quality) {
|
||||
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
@ -779,7 +779,7 @@ void RasterizerSceneGLES2::environment_set_dof_blur_near(RID p_env, bool p_enabl
|
|||
env->dof_blur_near_quality = p_quality;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {
|
||||
void RasterizerSceneGLES2::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {
|
||||
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
|
@ -806,12 +806,12 @@ void RasterizerSceneGLES2::environment_set_ssr(RID p_env, bool p_enable, int p_m
|
|||
ERR_FAIL_COND(!env);
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VisualServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
|
||||
void RasterizerSceneGLES2::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, RS::EnvironmentSSAOQuality p_quality, RenderingServer::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {
|
||||
void RasterizerSceneGLES2::environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {
|
||||
Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND(!env);
|
||||
}
|
||||
|
@ -866,9 +866,9 @@ bool RasterizerSceneGLES2::is_environment(RID p_env) {
|
|||
return environment_owner.owns(p_env);
|
||||
}
|
||||
|
||||
VS::EnvironmentBG RasterizerSceneGLES2::environment_get_background(RID p_env) {
|
||||
RS::EnvironmentBG RasterizerSceneGLES2::environment_get_background(RID p_env) {
|
||||
const Environment *env = environment_owner.getornull(p_env);
|
||||
ERR_FAIL_COND_V(!env, VS::ENV_BG_MAX);
|
||||
ERR_FAIL_COND_V(!env, RS::ENV_BG_MAX);
|
||||
|
||||
return env->bg_mode;
|
||||
}
|
||||
|
@ -914,7 +914,7 @@ void RasterizerSceneGLES2::light_instance_set_shadow_transform(RID p_light_insta
|
|||
LightInstance *light_instance = light_instance_owner.getornull(p_light_instance);
|
||||
ERR_FAIL_COND(!light_instance);
|
||||
|
||||
if (light_instance->light_ptr->type != VS::LIGHT_DIRECTIONAL) {
|
||||
if (light_instance->light_ptr->type != RS::LIGHT_DIRECTIONAL) {
|
||||
p_pass = 0;
|
||||
}
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
|
|||
|
||||
if (!p_material->shader->spatial.uses_alpha_scissor && !p_material->shader->spatial.writes_modelview_or_projection && !p_material->shader->spatial.uses_vertex && !p_material->shader->spatial.uses_discard && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
|
||||
//shader does not use discard and does not write a vertex position, use generic material
|
||||
if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) {
|
||||
if (p_instance->cast_shadows == RS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) {
|
||||
p_material = storage->material_owner.getornull(!p_shadow_pass && p_material->shader->spatial.uses_world_coordinates ? default_worldcoord_material_twosided : default_material_twosided);
|
||||
mirror = false;
|
||||
} else {
|
||||
|
@ -1048,7 +1048,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
|
|||
e->use_accum = false;
|
||||
e->light_index = RenderList::MAX_LIGHTS;
|
||||
e->use_accum_ptr = &e->use_accum;
|
||||
e->instancing = (e->instance->base_type == VS::INSTANCE_MULTIMESH) ? 1 : 0;
|
||||
e->instancing = (e->instance->base_type == RS::INSTANCE_MULTIMESH) ? 1 : 0;
|
||||
e->front_facing = false;
|
||||
|
||||
if (e->geometry->last_pass != render_pass) {
|
||||
|
@ -1162,7 +1162,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
|
|||
|
||||
//directional sort key
|
||||
e->light_type1 = 1;
|
||||
e->light_type2 = li->light_ptr->type == VisualServer::LIGHT_OMNI ? 0 : 1;
|
||||
e->light_type2 = li->light_ptr->type == RenderingServer::LIGHT_OMNI ? 0 : 1;
|
||||
e->light_index = li->light_index;
|
||||
|
||||
copy = true;
|
||||
|
@ -1181,7 +1181,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G
|
|||
// do not add anything here, as lights are duplicated elements..
|
||||
|
||||
if (p_material->shader->spatial.uses_time) {
|
||||
VisualServerRaster::redraw_request();
|
||||
RenderingServerRaster::redraw_request();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1224,7 +1224,7 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
|
|||
|
||||
switch (instance->base_type) {
|
||||
|
||||
case VS::INSTANCE_MESH: {
|
||||
case RS::INSTANCE_MESH: {
|
||||
|
||||
RasterizerStorageGLES2::Mesh *mesh = storage->mesh_owner.getornull(instance->base);
|
||||
ERR_CONTINUE(!mesh);
|
||||
|
@ -1241,7 +1241,7 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
|
|||
|
||||
} break;
|
||||
|
||||
case VS::INSTANCE_MULTIMESH: {
|
||||
case RS::INSTANCE_MULTIMESH: {
|
||||
RasterizerStorageGLES2::MultiMesh *multi_mesh = storage->multimesh_owner.getornull(instance->base);
|
||||
ERR_CONTINUE(!multi_mesh);
|
||||
|
||||
|
@ -1260,7 +1260,7 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
|
|||
}
|
||||
} break;
|
||||
|
||||
case VS::INSTANCE_IMMEDIATE: {
|
||||
case RS::INSTANCE_IMMEDIATE: {
|
||||
RasterizerStorageGLES2::Immediate *im = storage->immediate_owner.getornull(instance->base);
|
||||
ERR_CONTINUE(!im);
|
||||
|
||||
|
@ -1426,7 +1426,7 @@ bool RasterizerSceneGLES2::_setup_material(RasterizerStorageGLES2::Material *p_m
|
|||
}
|
||||
|
||||
if (t->redraw_if_visible) { //must check before proxy because this is often used with proxies
|
||||
VisualServerRaster::redraw_request();
|
||||
RenderingServerRaster::redraw_request();
|
||||
}
|
||||
|
||||
t = t->get_ptr();
|
||||
|
@ -1459,7 +1459,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
|
|||
|
||||
switch (p_element->instance->base_type) {
|
||||
|
||||
case VS::INSTANCE_MESH: {
|
||||
case RS::INSTANCE_MESH: {
|
||||
RasterizerStorageGLES2::Surface *s = static_cast<RasterizerStorageGLES2::Surface *>(p_element->geometry);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s->vertex_id);
|
||||
|
@ -1468,18 +1468,18 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
|
|||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
|
||||
}
|
||||
|
||||
for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
|
||||
for (int i = 0; i < RS::ARRAY_MAX - 1; i++) {
|
||||
if (s->attribs[i].enabled) {
|
||||
glEnableVertexAttribArray(i);
|
||||
glVertexAttribPointer(s->attribs[i].index, s->attribs[i].size, s->attribs[i].type, s->attribs[i].normalized, s->attribs[i].stride, CAST_INT_TO_UCHAR_PTR(s->attribs[i].offset));
|
||||
} else {
|
||||
glDisableVertexAttribArray(i);
|
||||
switch (i) {
|
||||
case VS::ARRAY_NORMAL: {
|
||||
glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
|
||||
case RS::ARRAY_NORMAL: {
|
||||
glVertexAttrib4f(RS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
|
||||
} break;
|
||||
case VS::ARRAY_COLOR: {
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
case RS::ARRAY_COLOR: {
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
|
||||
} break;
|
||||
default: {
|
||||
|
@ -1502,7 +1502,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
|
|||
|
||||
Vector<float> &transform_buffer = storage->resources.skeleton_transform_cpu_buffer;
|
||||
|
||||
if (!s->attribs[VS::ARRAY_BONES].enabled || !s->attribs[VS::ARRAY_WEIGHTS].enabled) {
|
||||
if (!s->attribs[RS::ARRAY_BONES].enabled || !s->attribs[RS::ARRAY_WEIGHTS].enabled) {
|
||||
break; // the whole instance has a skeleton, but this surface is not affected by it.
|
||||
}
|
||||
|
||||
|
@ -1511,10 +1511,10 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
|
|||
transform_buffer.resize(s->array_len * 12);
|
||||
}
|
||||
|
||||
const size_t bones_offset = s->attribs[VS::ARRAY_BONES].offset;
|
||||
const size_t bones_stride = s->attribs[VS::ARRAY_BONES].stride;
|
||||
const size_t bone_weight_offset = s->attribs[VS::ARRAY_WEIGHTS].offset;
|
||||
const size_t bone_weight_stride = s->attribs[VS::ARRAY_WEIGHTS].stride;
|
||||
const size_t bones_offset = s->attribs[RS::ARRAY_BONES].offset;
|
||||
const size_t bones_stride = s->attribs[RS::ARRAY_BONES].stride;
|
||||
const size_t bone_weight_offset = s->attribs[RS::ARRAY_WEIGHTS].offset;
|
||||
const size_t bone_weight_stride = s->attribs[RS::ARRAY_WEIGHTS].stride;
|
||||
|
||||
{
|
||||
float *write = transform_buffer.ptrw();
|
||||
|
@ -1530,7 +1530,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
|
|||
size_t bones[4];
|
||||
float bone_weight[4];
|
||||
|
||||
if (s->attribs[VS::ARRAY_BONES].type == GL_UNSIGNED_BYTE) {
|
||||
if (s->attribs[RS::ARRAY_BONES].type == GL_UNSIGNED_BYTE) {
|
||||
// read as byte
|
||||
const uint8_t *bones_ptr = vertex_data + bones_offset + (i * bones_stride);
|
||||
bones[0] = bones_ptr[0];
|
||||
|
@ -1546,7 +1546,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
|
|||
bones[3] = bones_ptr[3];
|
||||
}
|
||||
|
||||
if (s->attribs[VS::ARRAY_WEIGHTS].type == GL_FLOAT) {
|
||||
if (s->attribs[RS::ARRAY_WEIGHTS].type == GL_FLOAT) {
|
||||
// read as float
|
||||
const float *weight_ptr = (const float *)(vertex_data + bone_weight_offset + (i * bone_weight_stride));
|
||||
bone_weight[0] = weight_ptr[0];
|
||||
|
@ -1621,7 +1621,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
|
|||
|
||||
} break;
|
||||
|
||||
case VS::INSTANCE_MULTIMESH: {
|
||||
case RS::INSTANCE_MULTIMESH: {
|
||||
RasterizerStorageGLES2::Surface *s = static_cast<RasterizerStorageGLES2::Surface *>(p_element->geometry);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s->vertex_id);
|
||||
|
@ -1630,18 +1630,18 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
|
|||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_id);
|
||||
}
|
||||
|
||||
for (int i = 0; i < VS::ARRAY_MAX - 1; i++) {
|
||||
for (int i = 0; i < RS::ARRAY_MAX - 1; i++) {
|
||||
if (s->attribs[i].enabled) {
|
||||
glEnableVertexAttribArray(i);
|
||||
glVertexAttribPointer(s->attribs[i].index, s->attribs[i].size, s->attribs[i].type, s->attribs[i].normalized, s->attribs[i].stride, CAST_INT_TO_UCHAR_PTR(s->attribs[i].offset));
|
||||
} else {
|
||||
glDisableVertexAttribArray(i);
|
||||
switch (i) {
|
||||
case VS::ARRAY_NORMAL: {
|
||||
glVertexAttrib4f(VS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
|
||||
case RS::ARRAY_NORMAL: {
|
||||
glVertexAttrib4f(RS::ARRAY_NORMAL, 0.0, 0.0, 1, 1);
|
||||
} break;
|
||||
case VS::ARRAY_COLOR: {
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
case RS::ARRAY_COLOR: {
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
|
||||
} break;
|
||||
default: {
|
||||
|
@ -1662,7 +1662,7 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
|
|||
|
||||
} break;
|
||||
|
||||
case VS::INSTANCE_IMMEDIATE: {
|
||||
case RS::INSTANCE_IMMEDIATE: {
|
||||
} break;
|
||||
|
||||
default: {
|
||||
|
@ -1674,7 +1674,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
|
|||
|
||||
switch (p_element->instance->base_type) {
|
||||
|
||||
case VS::INSTANCE_MESH: {
|
||||
case RS::INSTANCE_MESH: {
|
||||
|
||||
RasterizerStorageGLES2::Surface *s = static_cast<RasterizerStorageGLES2::Surface *>(p_element->geometry);
|
||||
|
||||
|
@ -1688,22 +1688,22 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
|
|||
storage->info.render.vertices_count += s->array_len;
|
||||
}
|
||||
/*
|
||||
if (p_element->instance->skeleton.is_valid() && s->attribs[VS::ARRAY_BONES].enabled && s->attribs[VS::ARRAY_WEIGHTS].enabled) {
|
||||
if (p_element->instance->skeleton.is_valid() && s->attribs[RS::ARRAY_BONES].enabled && s->attribs[RS::ARRAY_WEIGHTS].enabled) {
|
||||
//clean up after skeleton
|
||||
glBindBuffer(GL_ARRAY_BUFFER, storage->resources.skeleton_transform_buffer);
|
||||
|
||||
glDisableVertexAttribArray(VS::ARRAY_MAX + 0);
|
||||
glDisableVertexAttribArray(VS::ARRAY_MAX + 1);
|
||||
glDisableVertexAttribArray(VS::ARRAY_MAX + 2);
|
||||
glDisableVertexAttribArray(RS::ARRAY_MAX + 0);
|
||||
glDisableVertexAttribArray(RS::ARRAY_MAX + 1);
|
||||
glDisableVertexAttribArray(RS::ARRAY_MAX + 2);
|
||||
|
||||
glVertexAttrib4f(VS::ARRAY_MAX + 0, 1, 0, 0, 0);
|
||||
glVertexAttrib4f(VS::ARRAY_MAX + 1, 0, 1, 0, 0);
|
||||
glVertexAttrib4f(VS::ARRAY_MAX + 2, 0, 0, 1, 0);
|
||||
glVertexAttrib4f(RS::ARRAY_MAX + 0, 1, 0, 0, 0);
|
||||
glVertexAttrib4f(RS::ARRAY_MAX + 1, 0, 1, 0, 0);
|
||||
glVertexAttrib4f(RS::ARRAY_MAX + 2, 0, 0, 1, 0);
|
||||
}
|
||||
*/
|
||||
} break;
|
||||
|
||||
case VS::INSTANCE_MULTIMESH: {
|
||||
case RS::INSTANCE_MULTIMESH: {
|
||||
|
||||
RasterizerStorageGLES2::MultiMesh *multi_mesh = static_cast<RasterizerStorageGLES2::MultiMesh *>(p_element->owner);
|
||||
RasterizerStorageGLES2::Surface *s = static_cast<RasterizerStorageGLES2::Surface *>(p_element->geometry);
|
||||
|
@ -1734,7 +1734,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
|
|||
}
|
||||
|
||||
if (multi_mesh->color_floats) {
|
||||
if (multi_mesh->color_format == VS::MULTIMESH_COLOR_8BIT) {
|
||||
if (multi_mesh->color_format == RS::MULTIMESH_COLOR_8BIT) {
|
||||
uint8_t *color_data = (uint8_t *)(buffer + color_ofs);
|
||||
glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 3, color_data[0] / 255.0, color_data[1] / 255.0, color_data[2] / 255.0, color_data[3] / 255.0);
|
||||
} else {
|
||||
|
@ -1745,7 +1745,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
|
|||
}
|
||||
|
||||
if (multi_mesh->custom_data_floats) {
|
||||
if (multi_mesh->custom_data_format == VS::MULTIMESH_CUSTOM_DATA_8BIT) {
|
||||
if (multi_mesh->custom_data_format == RS::MULTIMESH_CUSTOM_DATA_8BIT) {
|
||||
uint8_t *custom_data = (uint8_t *)(buffer + custom_data_ofs);
|
||||
glVertexAttrib4f(INSTANCE_ATTRIB_BASE + 4, custom_data[0] / 255.0, custom_data[1] / 255.0, custom_data[2] / 255.0, custom_data[3] / 255.0);
|
||||
} else {
|
||||
|
@ -1764,7 +1764,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
|
|||
|
||||
} break;
|
||||
|
||||
case VS::INSTANCE_IMMEDIATE: {
|
||||
case RS::INSTANCE_IMMEDIATE: {
|
||||
const RasterizerStorageGLES2::Immediate *im = static_cast<const RasterizerStorageGLES2::Immediate *>(p_element->geometry);
|
||||
|
||||
if (im->building) {
|
||||
|
@ -1792,7 +1792,7 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
|
|||
RasterizerStorageGLES2::Texture *t = storage->texture_owner.getornull(c.texture);
|
||||
|
||||
if (t->redraw_if_visible) {
|
||||
VisualServerRaster::redraw_request();
|
||||
RenderingServerRaster::redraw_request();
|
||||
}
|
||||
t = t->get_ptr();
|
||||
|
||||
|
@ -1816,53 +1816,53 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
|
|||
}
|
||||
|
||||
if (!c.normals.empty()) {
|
||||
glEnableVertexAttribArray(VS::ARRAY_NORMAL);
|
||||
glEnableVertexAttribArray(RS::ARRAY_NORMAL);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.normals.ptr());
|
||||
glVertexAttribPointer(VS::ARRAY_NORMAL, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
glVertexAttribPointer(RS::ARRAY_NORMAL, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
buf_ofs += sizeof(Vector3) * vertices;
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_NORMAL);
|
||||
glDisableVertexAttribArray(RS::ARRAY_NORMAL);
|
||||
}
|
||||
|
||||
if (!c.tangents.empty()) {
|
||||
glEnableVertexAttribArray(VS::ARRAY_TANGENT);
|
||||
glEnableVertexAttribArray(RS::ARRAY_TANGENT);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Plane) * vertices, c.tangents.ptr());
|
||||
glVertexAttribPointer(VS::ARRAY_TANGENT, 4, GL_FLOAT, GL_FALSE, sizeof(Plane), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
glVertexAttribPointer(RS::ARRAY_TANGENT, 4, GL_FLOAT, GL_FALSE, sizeof(Plane), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
buf_ofs += sizeof(Plane) * vertices;
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_TANGENT);
|
||||
glDisableVertexAttribArray(RS::ARRAY_TANGENT);
|
||||
}
|
||||
|
||||
if (!c.colors.empty()) {
|
||||
glEnableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glEnableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Color) * vertices, c.colors.ptr());
|
||||
glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
buf_ofs += sizeof(Color) * vertices;
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_COLOR);
|
||||
glDisableVertexAttribArray(RS::ARRAY_COLOR);
|
||||
}
|
||||
|
||||
if (!c.uvs.empty()) {
|
||||
glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector2) * vertices, c.uvs.ptr());
|
||||
glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
buf_ofs += sizeof(Vector2) * vertices;
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
}
|
||||
|
||||
if (!c.uv2s.empty()) {
|
||||
glEnableVertexAttribArray(VS::ARRAY_TEX_UV2);
|
||||
glEnableVertexAttribArray(RS::ARRAY_TEX_UV2);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector2) * vertices, c.uv2s.ptr());
|
||||
glVertexAttribPointer(VS::ARRAY_TEX_UV2, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
glVertexAttribPointer(RS::ARRAY_TEX_UV2, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
buf_ofs += sizeof(Vector2) * vertices;
|
||||
} else {
|
||||
glDisableVertexAttribArray(VS::ARRAY_TEX_UV2);
|
||||
glDisableVertexAttribArray(RS::ARRAY_TEX_UV2);
|
||||
}
|
||||
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.vertices.ptr());
|
||||
glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
glVertexAttribPointer(RS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), CAST_INT_TO_UCHAR_PTR(buf_ofs));
|
||||
|
||||
glDrawArrays(gl_primitive[c.primitive], 0, c.vertices.size());
|
||||
}
|
||||
|
@ -1901,18 +1901,18 @@ void RasterizerSceneGLES2::_setup_light_type(LightInstance *p_light, ShadowAtlas
|
|||
state.scene_shader.set_conditional(SceneShaderGLES2::USE_LIGHTING, true);
|
||||
|
||||
switch (p_light->light_ptr->type) {
|
||||
case VS::LIGHT_DIRECTIONAL: {
|
||||
case RS::LIGHT_DIRECTIONAL: {
|
||||
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::LIGHT_MODE_DIRECTIONAL, true);
|
||||
switch (p_light->light_ptr->directional_shadow_mode) {
|
||||
case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: {
|
||||
case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: {
|
||||
//no need
|
||||
} break;
|
||||
case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: {
|
||||
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: {
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::LIGHT_USE_PSSM2, true);
|
||||
|
||||
} break;
|
||||
case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: {
|
||||
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: {
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::LIGHT_USE_PSSM4, true);
|
||||
} break;
|
||||
}
|
||||
|
@ -1931,7 +1931,7 @@ void RasterizerSceneGLES2::_setup_light_type(LightInstance *p_light, ShadowAtlas
|
|||
}
|
||||
|
||||
} break;
|
||||
case VS::LIGHT_OMNI: {
|
||||
case RS::LIGHT_OMNI: {
|
||||
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::LIGHT_MODE_OMNI, true);
|
||||
if (!state.render_no_shadows && shadow_atlas && p_light->light_ptr->shadow) {
|
||||
|
@ -1946,7 +1946,7 @@ void RasterizerSceneGLES2::_setup_light_type(LightInstance *p_light, ShadowAtlas
|
|||
state.scene_shader.set_conditional(SceneShaderGLES2::SHADOW_MODE_PCF_13, shadow_filter_mode == SHADOW_FILTER_PCF13);
|
||||
}
|
||||
} break;
|
||||
case VS::LIGHT_SPOT: {
|
||||
case RS::LIGHT_SPOT: {
|
||||
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::LIGHT_MODE_SPOT, true);
|
||||
if (!state.render_no_shadows && shadow_atlas && p_light->light_ptr->shadow) {
|
||||
|
@ -1969,8 +1969,8 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
|||
RasterizerStorageGLES2::Light *light_ptr = light->light_ptr;
|
||||
|
||||
//common parameters
|
||||
float energy = light_ptr->param[VS::LIGHT_PARAM_ENERGY];
|
||||
float specular = light_ptr->param[VS::LIGHT_PARAM_SPECULAR];
|
||||
float energy = light_ptr->param[RS::LIGHT_PARAM_ENERGY];
|
||||
float specular = light_ptr->param[RS::LIGHT_PARAM_SPECULAR];
|
||||
float sign = (light_ptr->negative && !accum_pass) ? -1 : 1; //inverse color for base pass lights only
|
||||
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_SPECULAR, specular);
|
||||
|
@ -1982,7 +1982,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
|||
//specific parameters
|
||||
|
||||
switch (light_ptr->type) {
|
||||
case VS::LIGHT_DIRECTIONAL: {
|
||||
case RS::LIGHT_DIRECTIONAL: {
|
||||
//not using inverse for performance, view should be normalized anyway
|
||||
Vector3 direction = p_view_transform.basis.xform_inv(light->transform.basis.xform(Vector3(0, 0, -1))).normalized();
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_DIRECTION, direction);
|
||||
|
@ -1995,15 +1995,15 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
|||
Color split_offsets;
|
||||
|
||||
switch (light_ptr->directional_shadow_mode) {
|
||||
case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: {
|
||||
case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: {
|
||||
shadow_count = 1;
|
||||
} break;
|
||||
|
||||
case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: {
|
||||
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: {
|
||||
shadow_count = 2;
|
||||
} break;
|
||||
|
||||
case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: {
|
||||
case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: {
|
||||
shadow_count = 4;
|
||||
} break;
|
||||
}
|
||||
|
@ -2015,7 +2015,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
|||
uint32_t width = light->directional_rect.size.x;
|
||||
uint32_t height = light->directional_rect.size.y;
|
||||
|
||||
if (light_ptr->directional_shadow_mode == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
|
||||
if (light_ptr->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
|
||||
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
|
@ -2029,7 +2029,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
|||
y += height;
|
||||
}
|
||||
|
||||
} else if (light_ptr->directional_shadow_mode == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
|
||||
} else if (light_ptr->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
|
||||
|
||||
height /= 2;
|
||||
|
||||
|
@ -2067,16 +2067,16 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
|||
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_SHADOW_MATRIX4, matrices[3]);
|
||||
}
|
||||
} break;
|
||||
case VS::LIGHT_OMNI: {
|
||||
case RS::LIGHT_OMNI: {
|
||||
|
||||
Vector3 position = p_view_transform.xform_inv(light->transform.origin);
|
||||
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_POSITION, position);
|
||||
|
||||
float range = light_ptr->param[VS::LIGHT_PARAM_RANGE];
|
||||
float range = light_ptr->param[RS::LIGHT_PARAM_RANGE];
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_RANGE, range);
|
||||
|
||||
float attenuation = light_ptr->param[VS::LIGHT_PARAM_ATTENUATION];
|
||||
float attenuation = light_ptr->param[RS::LIGHT_PARAM_ATTENUATION];
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_ATTENUATION, attenuation);
|
||||
|
||||
if (!state.render_no_shadows && light_ptr->shadow && shadow_atlas && shadow_atlas->shadow_owners.has(light->self)) {
|
||||
|
@ -2101,7 +2101,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
|||
uint32_t width = shadow_size;
|
||||
uint32_t height = shadow_size;
|
||||
|
||||
if (light->light_ptr->omni_shadow_detail == VS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
|
||||
if (light->light_ptr->omni_shadow_detail == RS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
|
||||
height /= 2;
|
||||
} else {
|
||||
width /= 2;
|
||||
|
@ -2121,7 +2121,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
|||
}
|
||||
} break;
|
||||
|
||||
case VS::LIGHT_SPOT: {
|
||||
case RS::LIGHT_SPOT: {
|
||||
|
||||
Vector3 position = p_view_transform.xform_inv(light->transform.origin);
|
||||
|
||||
|
@ -2129,10 +2129,10 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
|
|||
|
||||
Vector3 direction = p_view_transform.inverse().basis.xform(light->transform.basis.xform(Vector3(0, 0, -1))).normalized();
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_DIRECTION, direction);
|
||||
float attenuation = light_ptr->param[VS::LIGHT_PARAM_ATTENUATION];
|
||||
float range = light_ptr->param[VS::LIGHT_PARAM_RANGE];
|
||||
float spot_attenuation = light_ptr->param[VS::LIGHT_PARAM_SPOT_ATTENUATION];
|
||||
float angle = light_ptr->param[VS::LIGHT_PARAM_SPOT_ANGLE];
|
||||
float attenuation = light_ptr->param[RS::LIGHT_PARAM_ATTENUATION];
|
||||
float range = light_ptr->param[RS::LIGHT_PARAM_RANGE];
|
||||
float spot_attenuation = light_ptr->param[RS::LIGHT_PARAM_SPOT_ATTENUATION];
|
||||
float angle = light_ptr->param[RS::LIGHT_PARAM_SPOT_ANGLE];
|
||||
angle = Math::cos(Math::deg2rad(angle));
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_ATTENUATION, attenuation);
|
||||
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_SPOT_ATTENUATION, spot_attenuation);
|
||||
|
@ -2490,7 +2490,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
|||
rebind = true;
|
||||
}
|
||||
|
||||
bool instancing = e->instance->base_type == VS::INSTANCE_MULTIMESH;
|
||||
bool instancing = e->instance->base_type == RS::INSTANCE_MULTIMESH;
|
||||
|
||||
if (instancing != prev_instancing) {
|
||||
|
||||
|
@ -2726,10 +2726,10 @@ void RasterizerSceneGLES2::_draw_sky(RasterizerStorageGLES2::Sky *p_sky, const C
|
|||
glBufferData(GL_ARRAY_BUFFER, sizeof(Vector3) * 8, vertices, GL_DYNAMIC_DRAW);
|
||||
|
||||
// bind sky vertex array....
|
||||
glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3) * 2, 0);
|
||||
glVertexAttribPointer(VS::ARRAY_TEX_UV, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3) * 2, CAST_INT_TO_UCHAR_PTR(sizeof(Vector3)));
|
||||
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glVertexAttribPointer(RS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3) * 2, 0);
|
||||
glVertexAttribPointer(RS::ARRAY_TEX_UV, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3) * 2, CAST_INT_TO_UCHAR_PTR(sizeof(Vector3)));
|
||||
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
|
||||
storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_ASYM_PANO, asymmetrical);
|
||||
storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_PANORAMA, !asymmetrical);
|
||||
|
@ -2752,8 +2752,8 @@ void RasterizerSceneGLES2::_draw_sky(RasterizerStorageGLES2::Sky *p_sky, const C
|
|||
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
glDisableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glDisableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_ASYM_PANO, false);
|
||||
|
@ -2845,9 +2845,9 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
|
|||
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::USE_ORTHOGONAL_PROJECTION, p_cam_projection.is_orthogonal());
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_FAR_BLUR, true);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, env->dof_blur_far_quality == VS::ENV_DOF_BLUR_QUALITY_LOW);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, env->dof_blur_far_quality == VS::ENV_DOF_BLUR_QUALITY_MEDIUM);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, env->dof_blur_far_quality == VS::ENV_DOF_BLUR_QUALITY_HIGH);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, env->dof_blur_far_quality == RS::ENV_DOF_BLUR_QUALITY_LOW);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, env->dof_blur_far_quality == RS::ENV_DOF_BLUR_QUALITY_MEDIUM);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, env->dof_blur_far_quality == RS::ENV_DOF_BLUR_QUALITY_HIGH);
|
||||
|
||||
state.effect_blur_shader.bind();
|
||||
int qsteps[3] = { 4, 10, 20 };
|
||||
|
@ -2911,9 +2911,9 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
|
|||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_NEAR_BLUR, true);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_NEAR_FIRST_TAP, true);
|
||||
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, env->dof_blur_near_quality == VS::ENV_DOF_BLUR_QUALITY_LOW);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, env->dof_blur_near_quality == VS::ENV_DOF_BLUR_QUALITY_MEDIUM);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, env->dof_blur_near_quality == VS::ENV_DOF_BLUR_QUALITY_HIGH);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_LOW, env->dof_blur_near_quality == RS::ENV_DOF_BLUR_QUALITY_LOW);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_MEDIUM, env->dof_blur_near_quality == RS::ENV_DOF_BLUR_QUALITY_MEDIUM);
|
||||
state.effect_blur_shader.set_conditional(EffectBlurShaderGLES2::DOF_QUALITY_HIGH, env->dof_blur_near_quality == RS::ENV_DOF_BLUR_QUALITY_HIGH);
|
||||
|
||||
state.effect_blur_shader.bind();
|
||||
int qsteps[3] = { 4, 10, 20 };
|
||||
|
@ -3003,7 +3003,7 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
|
|||
|
||||
if (env->glow_enabled) {
|
||||
|
||||
for (int i = 0; i < VS::MAX_GLOW_LEVELS; i++) {
|
||||
for (int i = 0; i < RS::MAX_GLOW_LEVELS; i++) {
|
||||
if (env->glow_levels & (1 << i)) {
|
||||
|
||||
if (i >= storage->frame.current_rt->mip_maps[1].sizes.size()) {
|
||||
|
@ -3156,9 +3156,9 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
|
|||
}
|
||||
}
|
||||
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_SCREEN, env->glow_blend_mode == VS::ENV_GLOW_BLEND_MODE_SCREEN);
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_SOFTLIGHT, env->glow_blend_mode == VS::ENV_GLOW_BLEND_MODE_SOFTLIGHT);
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_REPLACE, env->glow_blend_mode == VS::ENV_GLOW_BLEND_MODE_REPLACE);
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_SCREEN, env->glow_blend_mode == RS::ENV_GLOW_BLEND_MODE_SCREEN);
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_SOFTLIGHT, env->glow_blend_mode == RS::ENV_GLOW_BLEND_MODE_SOFTLIGHT);
|
||||
state.tonemap_shader.set_conditional(TonemapShaderGLES2::USE_GLOW_REPLACE, env->glow_blend_mode == RS::ENV_GLOW_BLEND_MODE_REPLACE);
|
||||
}
|
||||
|
||||
//Adjustments
|
||||
|
@ -3288,7 +3288,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
|
||||
LightInstance *light = light_instance_owner.getornull(light_rid);
|
||||
|
||||
if (light->light_ptr->type == VS::LIGHT_DIRECTIONAL) {
|
||||
if (light->light_ptr->type == RS::LIGHT_DIRECTIONAL) {
|
||||
render_directional_lights++;
|
||||
//as going in reverse, directional lights are always first anyway
|
||||
}
|
||||
|
@ -3322,7 +3322,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
reflection_probe_count = 0;
|
||||
}
|
||||
|
||||
if (env && env->bg_mode == VS::ENV_BG_CANVAS) {
|
||||
if (env && env->bg_mode == RS::ENV_BG_CANVAS) {
|
||||
// If using canvas background, copy 2d to screen copy texture
|
||||
// TODO: When GLES2 renders to current_rt->mip_maps[], this copy will no longer be needed
|
||||
_copy_texture_to_buffer(storage->frame.current_rt->color, storage->frame.current_rt->copy_screen_effect.fbo);
|
||||
|
@ -3358,22 +3358,22 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
if (storage->frame.current_rt && storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
|
||||
clear_color = Color(0, 0, 0, 0);
|
||||
storage->frame.clear_request = false;
|
||||
} else if (!env || env->bg_mode == VS::ENV_BG_CLEAR_COLOR || env->bg_mode == VS::ENV_BG_SKY) {
|
||||
} else if (!env || env->bg_mode == RS::ENV_BG_CLEAR_COLOR || env->bg_mode == RS::ENV_BG_SKY) {
|
||||
if (storage->frame.clear_request) {
|
||||
clear_color = storage->frame.clear_request_color;
|
||||
storage->frame.clear_request = false;
|
||||
}
|
||||
} else if (env->bg_mode == VS::ENV_BG_CANVAS || env->bg_mode == VS::ENV_BG_COLOR || env->bg_mode == VS::ENV_BG_COLOR_SKY) {
|
||||
} else if (env->bg_mode == RS::ENV_BG_CANVAS || env->bg_mode == RS::ENV_BG_COLOR || env->bg_mode == RS::ENV_BG_COLOR_SKY) {
|
||||
clear_color = env->bg_color;
|
||||
storage->frame.clear_request = false;
|
||||
} else if (env->bg_mode == VS::ENV_BG_CAMERA_FEED) {
|
||||
} else if (env->bg_mode == RS::ENV_BG_CAMERA_FEED) {
|
||||
feed = CameraServer::get_singleton()->get_feed_by_id(env->camera_feed_id);
|
||||
storage->frame.clear_request = false;
|
||||
} else {
|
||||
storage->frame.clear_request = false;
|
||||
}
|
||||
|
||||
if (!env || env->bg_mode != VS::ENV_BG_KEEP) {
|
||||
if (!env || env->bg_mode != RS::ENV_BG_KEEP) {
|
||||
glClearColor(clear_color.r, clear_color.g, clear_color.b, clear_color.a);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
@ -3385,7 +3385,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1);
|
||||
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -3396,15 +3396,15 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
if (env) {
|
||||
switch (env->bg_mode) {
|
||||
|
||||
case VS::ENV_BG_COLOR_SKY:
|
||||
case VS::ENV_BG_SKY: {
|
||||
case RS::ENV_BG_COLOR_SKY:
|
||||
case RS::ENV_BG_SKY: {
|
||||
sky = storage->sky_owner.getornull(env->sky);
|
||||
|
||||
if (sky) {
|
||||
env_radiance_tex = sky->radiance;
|
||||
}
|
||||
} break;
|
||||
case VS::ENV_BG_CAMERA_FEED: {
|
||||
case RS::ENV_BG_CAMERA_FEED: {
|
||||
if (feed.is_valid() && (feed->get_base_width() > 0) && (feed->get_base_height() > 0)) {
|
||||
// copy our camera feed to our background
|
||||
|
||||
|
@ -3419,12 +3419,12 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
if (feed->get_datatype() == CameraFeed::FEED_RGB) {
|
||||
RID camera_RGBA = feed->get_texture(CameraServer::FEED_RGBA_IMAGE);
|
||||
|
||||
VS::get_singleton()->texture_bind(camera_RGBA, 0);
|
||||
RS::get_singleton()->texture_bind(camera_RGBA, 0);
|
||||
|
||||
} else if (feed->get_datatype() == CameraFeed::FEED_YCBCR) {
|
||||
RID camera_YCbCr = feed->get_texture(CameraServer::FEED_YCBCR_IMAGE);
|
||||
|
||||
VS::get_singleton()->texture_bind(camera_YCbCr, 0);
|
||||
RS::get_singleton()->texture_bind(camera_YCbCr, 0);
|
||||
|
||||
storage->shaders.copy.set_conditional(CopyShaderGLES2::YCBCR_TO_RGB, true);
|
||||
|
||||
|
@ -3432,8 +3432,8 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
RID camera_Y = feed->get_texture(CameraServer::FEED_Y_IMAGE);
|
||||
RID camera_CbCr = feed->get_texture(CameraServer::FEED_CBCR_IMAGE);
|
||||
|
||||
VS::get_singleton()->texture_bind(camera_Y, 0);
|
||||
VS::get_singleton()->texture_bind(camera_CbCr, 1);
|
||||
RS::get_singleton()->texture_bind(camera_Y, 0);
|
||||
RS::get_singleton()->texture_bind(camera_CbCr, 1);
|
||||
|
||||
storage->shaders.copy.set_conditional(CopyShaderGLES2::SEP_CBCR_TEXTURE, true);
|
||||
storage->shaders.copy.set_conditional(CopyShaderGLES2::YCBCR_TO_RGB, true);
|
||||
|
@ -3444,8 +3444,8 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
|
||||
storage->bind_quad_array();
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
glDisableVertexAttribArray(VS::ARRAY_VERTEX);
|
||||
glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
|
||||
glDisableVertexAttribArray(RS::ARRAY_VERTEX);
|
||||
glDisableVertexAttribArray(RS::ARRAY_TEX_UV);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
// turn off everything used
|
||||
|
@ -3464,7 +3464,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
clear_color = Color(0.0, 1.0, 0.0, 1.0);
|
||||
}
|
||||
} break;
|
||||
case VS::ENV_BG_CANVAS: {
|
||||
case RS::ENV_BG_CANVAS: {
|
||||
// use screen copy as background
|
||||
_copy_texture_to_buffer(storage->frame.current_rt->copy_screen_effect.color, current_fb);
|
||||
} break;
|
||||
|
@ -3484,7 +3484,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
|
|||
_render_render_list(render_list.elements, render_list.element_count, cam_transform, p_cam_projection, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, false, false);
|
||||
|
||||
// then draw the sky after
|
||||
if (env && env->bg_mode == VS::ENV_BG_SKY && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
|
||||
if (env && env->bg_mode == RS::ENV_BG_SKY && (!storage->frame.current_rt || !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT])) {
|
||||
|
||||
if (sky && sky->panorama.is_valid()) {
|
||||
_draw_sky(sky, p_cam_projection, cam_transform, false, env->sky_custom_fov, env->bg_energy, env->sky_orientation);
|
||||
|
@ -3616,7 +3616,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
|||
|
||||
// TODO directional light
|
||||
|
||||
if (light->type == VS::LIGHT_DIRECTIONAL) {
|
||||
if (light->type == RS::LIGHT_DIRECTIONAL) {
|
||||
// set pssm stuff
|
||||
|
||||
// TODO set this only when changed
|
||||
|
@ -3651,7 +3651,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
|||
width = light_instance->directional_rect.size.width;
|
||||
height = light_instance->directional_rect.size.height;
|
||||
|
||||
if (light->directional_shadow_mode == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
|
||||
if (light->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
|
||||
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
|
@ -3665,7 +3665,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
|||
y += height;
|
||||
}
|
||||
|
||||
} else if (light->directional_shadow_mode == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
|
||||
} else if (light->directional_shadow_mode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
|
||||
|
||||
height /= 2;
|
||||
|
||||
|
@ -3676,10 +3676,10 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
|||
}
|
||||
}
|
||||
|
||||
float bias_mult = Math::lerp(1.0f, light_instance->shadow_transform[p_pass].bias_scale, light->param[VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE]);
|
||||
zfar = light->param[VS::LIGHT_PARAM_RANGE];
|
||||
bias = light->param[VS::LIGHT_PARAM_SHADOW_BIAS] * bias_mult;
|
||||
normal_bias = light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS] * bias_mult;
|
||||
float bias_mult = Math::lerp(1.0f, light_instance->shadow_transform[p_pass].bias_scale, light->param[RS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE]);
|
||||
zfar = light->param[RS::LIGHT_PARAM_RANGE];
|
||||
bias = light->param[RS::LIGHT_PARAM_SHADOW_BIAS] * bias_mult;
|
||||
normal_bias = light->param[RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS] * bias_mult;
|
||||
|
||||
fbo = directional_shadow.fbo;
|
||||
} else {
|
||||
|
@ -3708,9 +3708,9 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
|||
width = shadow_size;
|
||||
height = shadow_size;
|
||||
|
||||
if (light->type == VS::LIGHT_OMNI) {
|
||||
if (light->type == RS::LIGHT_OMNI) {
|
||||
// cubemap only
|
||||
if (light->omni_shadow_mode == VS::LIGHT_OMNI_SHADOW_CUBE && storage->config.support_shadow_cubemaps) {
|
||||
if (light->omni_shadow_mode == RS::LIGHT_OMNI_SHADOW_CUBE && storage->config.support_shadow_cubemaps) {
|
||||
int cubemap_index = shadow_cubemaps.size() - 1;
|
||||
|
||||
// find an appropriate cubemap to render to
|
||||
|
@ -3727,7 +3727,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
|||
light_transform = light_instance->shadow_transform[0].transform;
|
||||
|
||||
custom_vp_size = shadow_cubemaps[cubemap_index].size;
|
||||
zfar = light->param[VS::LIGHT_PARAM_RANGE];
|
||||
zfar = light->param[RS::LIGHT_PARAM_RANGE];
|
||||
|
||||
current_cubemap = cubemap_index;
|
||||
} else {
|
||||
|
@ -3736,7 +3736,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
|||
light_projection = light_instance->shadow_transform[0].camera;
|
||||
light_transform = light_instance->shadow_transform[0].transform;
|
||||
|
||||
if (light->omni_shadow_detail == VS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
|
||||
if (light->omni_shadow_detail == RS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
|
||||
|
||||
height /= 2;
|
||||
y += p_pass * height;
|
||||
|
@ -3747,22 +3747,22 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
|||
|
||||
state.dual_parbolloid_direction = p_pass == 0 ? 1.0 : -1.0;
|
||||
flip_facing = (p_pass == 1);
|
||||
zfar = light->param[VS::LIGHT_PARAM_RANGE];
|
||||
bias = light->param[VS::LIGHT_PARAM_SHADOW_BIAS];
|
||||
zfar = light->param[RS::LIGHT_PARAM_RANGE];
|
||||
bias = light->param[RS::LIGHT_PARAM_SHADOW_BIAS];
|
||||
|
||||
state.dual_parbolloid_zfar = zfar;
|
||||
|
||||
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH_DUAL_PARABOLOID, true);
|
||||
}
|
||||
|
||||
} else if (light->type == VS::LIGHT_SPOT) {
|
||||
} else if (light->type == RS::LIGHT_SPOT) {
|
||||
light_projection = light_instance->shadow_transform[0].camera;
|
||||
light_transform = light_instance->shadow_transform[0].transform;
|
||||
|
||||
flip_facing = false;
|
||||
zfar = light->param[VS::LIGHT_PARAM_RANGE];
|
||||
bias = light->param[VS::LIGHT_PARAM_SHADOW_BIAS];
|
||||
normal_bias = light->param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS];
|
||||
zfar = light->param[RS::LIGHT_PARAM_RANGE];
|
||||
bias = light->param[RS::LIGHT_PARAM_SHADOW_BIAS];
|
||||
normal_bias = light->param[RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3812,7 +3812,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
|||
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH_DUAL_PARABOLOID, false);
|
||||
|
||||
// convert cubemap to dual paraboloid if needed
|
||||
if (light->type == VS::LIGHT_OMNI && (light->omni_shadow_mode == VS::LIGHT_OMNI_SHADOW_CUBE && storage->config.support_shadow_cubemaps) && p_pass == 5) {
|
||||
if (light->type == RS::LIGHT_OMNI && (light->omni_shadow_mode == RS::LIGHT_OMNI_SHADOW_CUBE && storage->config.support_shadow_cubemaps) && p_pass == 5) {
|
||||
ShadowAtlas *shadow_atlas = shadow_atlas_owner.getornull(p_shadow_atlas);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, shadow_atlas->fbo);
|
||||
|
@ -3827,14 +3827,14 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
|
|||
state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES2::Z_FLIP, i == 1);
|
||||
state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES2::Z_NEAR, light_projection.get_z_near());
|
||||
state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES2::Z_FAR, light_projection.get_z_far());
|
||||
state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES2::BIAS, light->param[VS::LIGHT_PARAM_SHADOW_BIAS]);
|
||||
state.cube_to_dp_shader.set_uniform(CubeToDpShaderGLES2::BIAS, light->param[RS::LIGHT_PARAM_SHADOW_BIAS]);
|
||||
|
||||
uint32_t local_width = width;
|
||||
uint32_t local_height = height;
|
||||
uint32_t local_x = x;
|
||||
uint32_t local_y = y;
|
||||
|
||||
if (light->omni_shadow_detail == VS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
|
||||
if (light->omni_shadow_detail == RS::LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL) {
|
||||
local_height /= 2;
|
||||
local_y += i * local_height;
|
||||
} else {
|
||||
|
@ -3922,7 +3922,7 @@ bool RasterizerSceneGLES2::free(RID p_rid) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw) {
|
||||
void RasterizerSceneGLES2::set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) {
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES2::initialize() {
|
||||
|
|
|
@ -236,7 +236,7 @@ public:
|
|||
/* ENVIRONMENT API */
|
||||
|
||||
struct Environment {
|
||||
VS::EnvironmentBG bg_mode;
|
||||
RS::EnvironmentBG bg_mode;
|
||||
|
||||
RID sky;
|
||||
float sky_custom_fov;
|
||||
|
@ -259,7 +259,7 @@ public:
|
|||
float glow_intensity;
|
||||
float glow_strength;
|
||||
float glow_bloom;
|
||||
VS::EnvironmentGlowBlendMode glow_blend_mode;
|
||||
RS::EnvironmentGlowBlendMode glow_blend_mode;
|
||||
float glow_hdr_bleed_threshold;
|
||||
float glow_hdr_bleed_scale;
|
||||
float glow_hdr_luminance_cap;
|
||||
|
@ -269,13 +269,13 @@ public:
|
|||
float dof_blur_far_distance;
|
||||
float dof_blur_far_transition;
|
||||
float dof_blur_far_amount;
|
||||
VS::EnvironmentDOFBlurQuality dof_blur_far_quality;
|
||||
RS::EnvironmentDOFBlurQuality dof_blur_far_quality;
|
||||
|
||||
bool dof_blur_near_enabled;
|
||||
float dof_blur_near_distance;
|
||||
float dof_blur_near_transition;
|
||||
float dof_blur_near_amount;
|
||||
VS::EnvironmentDOFBlurQuality dof_blur_near_quality;
|
||||
RS::EnvironmentDOFBlurQuality dof_blur_near_quality;
|
||||
|
||||
bool adjustments_enabled;
|
||||
float adjustments_brightness;
|
||||
|
@ -300,7 +300,7 @@ public:
|
|||
float fog_height_curve;
|
||||
|
||||
Environment() :
|
||||
bg_mode(VS::ENV_BG_CLEAR_COLOR),
|
||||
bg_mode(RS::ENV_BG_CLEAR_COLOR),
|
||||
sky_custom_fov(0.0),
|
||||
bg_energy(1.0),
|
||||
sky_ambient(0),
|
||||
|
@ -313,7 +313,7 @@ public:
|
|||
glow_intensity(0.8),
|
||||
glow_strength(1.0),
|
||||
glow_bloom(0.0),
|
||||
glow_blend_mode(VS::ENV_GLOW_BLEND_MODE_SOFTLIGHT),
|
||||
glow_blend_mode(RS::ENV_GLOW_BLEND_MODE_SOFTLIGHT),
|
||||
glow_hdr_bleed_threshold(1.0),
|
||||
glow_hdr_bleed_scale(2.0),
|
||||
glow_hdr_luminance_cap(12.0),
|
||||
|
@ -322,12 +322,12 @@ public:
|
|||
dof_blur_far_distance(10),
|
||||
dof_blur_far_transition(5),
|
||||
dof_blur_far_amount(0.1),
|
||||
dof_blur_far_quality(VS::ENV_DOF_BLUR_QUALITY_MEDIUM),
|
||||
dof_blur_far_quality(RS::ENV_DOF_BLUR_QUALITY_MEDIUM),
|
||||
dof_blur_near_enabled(false),
|
||||
dof_blur_near_distance(2),
|
||||
dof_blur_near_transition(1),
|
||||
dof_blur_near_amount(0.1),
|
||||
dof_blur_near_quality(VS::ENV_DOF_BLUR_QUALITY_MEDIUM),
|
||||
dof_blur_near_quality(RS::ENV_DOF_BLUR_QUALITY_MEDIUM),
|
||||
adjustments_enabled(false),
|
||||
adjustments_brightness(1.0),
|
||||
adjustments_contrast(1.0),
|
||||
|
@ -353,7 +353,7 @@ public:
|
|||
|
||||
virtual RID environment_create();
|
||||
|
||||
virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg);
|
||||
virtual void environment_set_background(RID p_env, RS::EnvironmentBG p_bg);
|
||||
virtual void environment_set_sky(RID p_env, RID p_sky);
|
||||
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale);
|
||||
virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation);
|
||||
|
@ -363,15 +363,15 @@ public:
|
|||
virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0);
|
||||
virtual void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id);
|
||||
|
||||
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality);
|
||||
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality);
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale);
|
||||
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::EnvironmentDOFBlurQuality p_quality);
|
||||
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, RS::EnvironmentDOFBlurQuality p_quality);
|
||||
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale);
|
||||
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture);
|
||||
|
||||
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness);
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
|
||||
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, float p_ao_channel_affect, const Color &p_color, RS::EnvironmentSSAOQuality p_quality, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
|
||||
|
||||
virtual void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale);
|
||||
virtual void environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale);
|
||||
|
||||
virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp);
|
||||
|
||||
|
@ -381,7 +381,7 @@ public:
|
|||
|
||||
virtual bool is_environment(RID p_env);
|
||||
|
||||
virtual VS::EnvironmentBG environment_get_background(RID p_env);
|
||||
virtual RS::EnvironmentBG environment_get_background(RID p_env);
|
||||
virtual int environment_get_canvas_max_layer(RID p_env);
|
||||
|
||||
/* LIGHT INSTANCE */
|
||||
|
@ -650,7 +650,7 @@ public:
|
|||
virtual bool free(RID p_rid);
|
||||
|
||||
virtual void set_scene_pass(uint64_t p_pass);
|
||||
virtual void set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw);
|
||||
virtual void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw);
|
||||
|
||||
void iteration();
|
||||
void initialize();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -32,8 +32,8 @@
|
|||
#define RASTERIZERSTORAGEGLES2_H
|
||||
|
||||
#include "core/self_list.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "servers/visual/shader_language.h"
|
||||
#include "servers/rendering/rasterizer.h"
|
||||
#include "servers/rendering/shader_language.h"
|
||||
#include "shader_compiler_gles2.h"
|
||||
#include "shader_gles2.h"
|
||||
|
||||
|
@ -249,7 +249,7 @@ public:
|
|||
int width, height, depth;
|
||||
int alloc_width, alloc_height;
|
||||
Image::Format format;
|
||||
VS::TextureType type;
|
||||
RS::TextureType type;
|
||||
|
||||
GLenum target;
|
||||
GLenum gl_format_cache;
|
||||
|
@ -279,13 +279,13 @@ public:
|
|||
|
||||
bool redraw_if_visible;
|
||||
|
||||
VisualServer::TextureDetectCallback detect_3d;
|
||||
RenderingServer::TextureDetectCallback detect_3d;
|
||||
void *detect_3d_ud;
|
||||
|
||||
VisualServer::TextureDetectCallback detect_srgb;
|
||||
RenderingServer::TextureDetectCallback detect_srgb;
|
||||
void *detect_srgb_ud;
|
||||
|
||||
VisualServer::TextureDetectCallback detect_normal;
|
||||
RenderingServer::TextureDetectCallback detect_normal;
|
||||
void *detect_normal_ud;
|
||||
|
||||
Texture() :
|
||||
|
@ -296,7 +296,7 @@ public:
|
|||
alloc_width(0),
|
||||
alloc_height(0),
|
||||
format(Image::FORMAT_L8),
|
||||
type(VS::TEXTURE_TYPE_2D),
|
||||
type(RS::TEXTURE_TYPE_2D),
|
||||
target(0),
|
||||
data_size(0),
|
||||
total_data_size(0),
|
||||
|
@ -345,14 +345,14 @@ public:
|
|||
Ref<Image> _get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, Image::Format &r_real_format, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type, bool &r_compressed, bool p_force_decompress) const;
|
||||
|
||||
virtual RID texture_create();
|
||||
virtual void texture_allocate(RID p_texture, int p_width, int p_height, int p_depth_3d, Image::Format p_format, VS::TextureType p_type, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT);
|
||||
virtual void texture_allocate(RID p_texture, int p_width, int p_height, int p_depth_3d, Image::Format p_format, RS::TextureType p_type, uint32_t p_flags = RS::TEXTURE_FLAGS_DEFAULT);
|
||||
virtual void texture_set_data(RID p_texture, const Ref<Image> &p_image, int p_layer = 0);
|
||||
virtual void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, int p_layer = 0);
|
||||
virtual Ref<Image> texture_get_data(RID p_texture, int p_layer = 0) const;
|
||||
virtual void texture_set_flags(RID p_texture, uint32_t p_flags);
|
||||
virtual uint32_t texture_get_flags(RID p_texture) const;
|
||||
virtual Image::Format texture_get_format(RID p_texture) const;
|
||||
virtual VS::TextureType texture_get_type(RID p_texture) const;
|
||||
virtual RS::TextureType texture_get_type(RID p_texture) const;
|
||||
virtual uint32_t texture_get_texid(RID p_texture) const;
|
||||
virtual uint32_t texture_get_width(RID p_texture) const;
|
||||
virtual uint32_t texture_get_height(RID p_texture) const;
|
||||
|
@ -365,7 +365,7 @@ public:
|
|||
|
||||
virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable);
|
||||
|
||||
virtual void texture_debug_usage(List<VS::TextureInfo> *r_info);
|
||||
virtual void texture_debug_usage(List<RS::TextureInfo> *r_info);
|
||||
|
||||
virtual RID texture_create_radiance_cubemap(RID p_source, int p_resolution = -1) const;
|
||||
|
||||
|
@ -374,9 +374,9 @@ public:
|
|||
virtual void texture_set_proxy(RID p_texture, RID p_proxy);
|
||||
virtual Size2 texture_size_with_proxy(RID p_texture) const;
|
||||
|
||||
virtual void texture_set_detect_3d_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
|
||||
virtual void texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
|
||||
virtual void texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
|
||||
virtual void texture_set_detect_3d_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata);
|
||||
virtual void texture_set_detect_srgb_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata);
|
||||
virtual void texture_set_detect_normal_callback(RID p_texture, RenderingServer::TextureDetectCallback p_callback, void *p_userdata);
|
||||
|
||||
virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable);
|
||||
|
||||
|
@ -402,7 +402,7 @@ public:
|
|||
|
||||
RID self;
|
||||
|
||||
VS::ShaderMode mode;
|
||||
RS::ShaderMode mode;
|
||||
ShaderGLES2 *shader;
|
||||
String code;
|
||||
SelfList<Material>::List materials;
|
||||
|
@ -617,7 +617,7 @@ public:
|
|||
uint32_t offset;
|
||||
};
|
||||
|
||||
Attrib attribs[VS::ARRAY_MAX];
|
||||
Attrib attribs[RS::ARRAY_MAX];
|
||||
|
||||
Mesh *mesh;
|
||||
uint32_t format;
|
||||
|
@ -641,7 +641,7 @@ public:
|
|||
int array_byte_size;
|
||||
int index_array_byte_size;
|
||||
|
||||
VS::PrimitiveType primitive;
|
||||
RS::PrimitiveType primitive;
|
||||
|
||||
Vector<AABB> skeleton_bone_aabb;
|
||||
Vector<bool> skeleton_bone_used;
|
||||
|
@ -660,7 +660,7 @@ public:
|
|||
index_array_len(0),
|
||||
array_byte_size(0),
|
||||
index_array_byte_size(0),
|
||||
primitive(VS::PRIMITIVE_POINTS),
|
||||
primitive(RS::PRIMITIVE_POINTS),
|
||||
active(false),
|
||||
total_data_size(0) {
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ public:
|
|||
Vector<Surface *> surfaces;
|
||||
|
||||
int blend_shape_count;
|
||||
VS::BlendShapeMode blend_shape_mode;
|
||||
RS::BlendShapeMode blend_shape_mode;
|
||||
|
||||
AABB custom_aabb;
|
||||
|
||||
|
@ -694,7 +694,7 @@ public:
|
|||
|
||||
Mesh() :
|
||||
blend_shape_count(0),
|
||||
blend_shape_mode(VS::BLEND_SHAPE_MODE_NORMALIZED) {
|
||||
blend_shape_mode(RS::BLEND_SHAPE_MODE_NORMALIZED) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -702,13 +702,13 @@ public:
|
|||
|
||||
virtual RID mesh_create();
|
||||
|
||||
virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes = Vector<Vector<uint8_t>>(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>());
|
||||
virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, RS::PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes = Vector<Vector<uint8_t>>(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>());
|
||||
|
||||
virtual void mesh_set_blend_shape_count(RID p_mesh, int p_amount);
|
||||
virtual int mesh_get_blend_shape_count(RID p_mesh) const;
|
||||
|
||||
virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode);
|
||||
virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const;
|
||||
virtual void mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMode p_mode);
|
||||
virtual RS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const;
|
||||
|
||||
virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data);
|
||||
|
||||
|
@ -722,7 +722,7 @@ public:
|
|||
virtual Vector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const;
|
||||
|
||||
virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const;
|
||||
virtual VS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const;
|
||||
virtual RS::PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const;
|
||||
|
||||
virtual AABB mesh_surface_get_aabb(RID p_mesh, int p_surface) const;
|
||||
virtual Vector<Vector<uint8_t>> mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const;
|
||||
|
@ -744,9 +744,9 @@ public:
|
|||
RID mesh;
|
||||
int size;
|
||||
|
||||
VS::MultimeshTransformFormat transform_format;
|
||||
VS::MultimeshColorFormat color_format;
|
||||
VS::MultimeshCustomDataFormat custom_data_format;
|
||||
RS::MultimeshTransformFormat transform_format;
|
||||
RS::MultimeshColorFormat color_format;
|
||||
RS::MultimeshCustomDataFormat custom_data_format;
|
||||
|
||||
Vector<float> data;
|
||||
|
||||
|
@ -766,9 +766,9 @@ public:
|
|||
|
||||
MultiMesh() :
|
||||
size(0),
|
||||
transform_format(VS::MULTIMESH_TRANSFORM_2D),
|
||||
color_format(VS::MULTIMESH_COLOR_NONE),
|
||||
custom_data_format(VS::MULTIMESH_CUSTOM_DATA_NONE),
|
||||
transform_format(RS::MULTIMESH_TRANSFORM_2D),
|
||||
color_format(RS::MULTIMESH_COLOR_NONE),
|
||||
custom_data_format(RS::MULTIMESH_CUSTOM_DATA_NONE),
|
||||
update_list(this),
|
||||
mesh_list(this),
|
||||
visible_instances(-1),
|
||||
|
@ -786,7 +786,7 @@ public:
|
|||
|
||||
virtual RID multimesh_create();
|
||||
|
||||
virtual void multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, VS::MultimeshColorFormat p_color_format, VS::MultimeshCustomDataFormat p_data = VS::MULTIMESH_CUSTOM_DATA_NONE);
|
||||
virtual void multimesh_allocate(RID p_multimesh, int p_instances, RS::MultimeshTransformFormat p_transform_format, RS::MultimeshColorFormat p_color_format, RS::MultimeshCustomDataFormat p_data = RS::MULTIMESH_CUSTOM_DATA_NONE);
|
||||
virtual int multimesh_get_instance_count(RID p_multimesh) const;
|
||||
|
||||
virtual void multimesh_set_mesh(RID p_multimesh, RID p_mesh);
|
||||
|
@ -817,7 +817,7 @@ public:
|
|||
|
||||
struct Chunk {
|
||||
RID texture;
|
||||
VS::PrimitiveType primitive;
|
||||
RS::PrimitiveType primitive;
|
||||
Vector<Vector3> vertices;
|
||||
Vector<Vector3> normals;
|
||||
Vector<Plane> tangents;
|
||||
|
@ -846,7 +846,7 @@ public:
|
|||
mutable RID_PtrOwner<Immediate> immediate_owner;
|
||||
|
||||
virtual RID immediate_create();
|
||||
virtual void immediate_begin(RID p_immediate, VS::PrimitiveType p_primitive, RID p_texture = RID());
|
||||
virtual void immediate_begin(RID p_immediate, RS::PrimitiveType p_primitive, RID p_texture = RID());
|
||||
virtual void immediate_vertex(RID p_immediate, const Vector3 &p_vertex);
|
||||
virtual void immediate_normal(RID p_immediate, const Vector3 &p_normal);
|
||||
virtual void immediate_tangent(RID p_immediate, const Plane &p_tangent);
|
||||
|
@ -906,8 +906,8 @@ public:
|
|||
/* Light API */
|
||||
|
||||
struct Light : Instantiable {
|
||||
VS::LightType type;
|
||||
float param[VS::LIGHT_PARAM_MAX];
|
||||
RS::LightType type;
|
||||
float param[RS::LIGHT_PARAM_MAX];
|
||||
|
||||
Color color;
|
||||
Color shadow_color;
|
||||
|
@ -921,11 +921,11 @@ public:
|
|||
|
||||
uint32_t cull_mask;
|
||||
|
||||
VS::LightOmniShadowMode omni_shadow_mode;
|
||||
VS::LightOmniShadowDetail omni_shadow_detail;
|
||||
RS::LightOmniShadowMode omni_shadow_mode;
|
||||
RS::LightOmniShadowDetail omni_shadow_detail;
|
||||
|
||||
VS::LightDirectionalShadowMode directional_shadow_mode;
|
||||
VS::LightDirectionalShadowDepthRangeMode directional_range_mode;
|
||||
RS::LightDirectionalShadowMode directional_shadow_mode;
|
||||
RS::LightDirectionalShadowDepthRangeMode directional_range_mode;
|
||||
|
||||
bool directional_blend_splits;
|
||||
|
||||
|
@ -934,10 +934,10 @@ public:
|
|||
|
||||
mutable RID_PtrOwner<Light> light_owner;
|
||||
|
||||
virtual RID light_create(VS::LightType p_type);
|
||||
virtual RID light_create(RS::LightType p_type);
|
||||
|
||||
virtual void light_set_color(RID p_light, const Color &p_color);
|
||||
virtual void light_set_param(RID p_light, VS::LightParam p_param, float p_value);
|
||||
virtual void light_set_param(RID p_light, RS::LightParam p_param, float p_value);
|
||||
virtual void light_set_shadow(RID p_light, bool p_enabled);
|
||||
virtual void light_set_shadow_color(RID p_light, const Color &p_color);
|
||||
virtual void light_set_projector(RID p_light, RID p_texture);
|
||||
|
@ -946,23 +946,23 @@ public:
|
|||
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
|
||||
virtual void light_set_use_gi(RID p_light, bool p_enabled);
|
||||
|
||||
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
|
||||
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail);
|
||||
virtual void light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode);
|
||||
virtual void light_omni_set_shadow_detail(RID p_light, RS::LightOmniShadowDetail p_detail);
|
||||
|
||||
virtual void light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode);
|
||||
virtual void light_directional_set_shadow_mode(RID p_light, RS::LightDirectionalShadowMode p_mode);
|
||||
virtual void light_directional_set_blend_splits(RID p_light, bool p_enable);
|
||||
virtual bool light_directional_get_blend_splits(RID p_light) const;
|
||||
|
||||
virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light);
|
||||
virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light);
|
||||
virtual RS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light);
|
||||
virtual RS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light);
|
||||
|
||||
virtual void light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode);
|
||||
virtual VS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const;
|
||||
virtual void light_directional_set_shadow_depth_range_mode(RID p_light, RS::LightDirectionalShadowDepthRangeMode p_range_mode);
|
||||
virtual RS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const;
|
||||
|
||||
virtual bool light_has_shadow(RID p_light) const;
|
||||
|
||||
virtual VS::LightType light_get_type(RID p_light) const;
|
||||
virtual float light_get_param(RID p_light, VS::LightParam p_param);
|
||||
virtual RS::LightType light_get_type(RID p_light) const;
|
||||
virtual float light_get_param(RID p_light, RS::LightParam p_param);
|
||||
virtual Color light_get_color(RID p_light);
|
||||
virtual bool light_get_use_gi(RID p_light);
|
||||
|
||||
|
@ -973,7 +973,7 @@ public:
|
|||
|
||||
struct ReflectionProbe : Instantiable {
|
||||
|
||||
VS::ReflectionProbeUpdateMode update_mode;
|
||||
RS::ReflectionProbeUpdateMode update_mode;
|
||||
float intensity;
|
||||
Color interior_ambient;
|
||||
float interior_ambient_energy;
|
||||
|
@ -992,7 +992,7 @@ public:
|
|||
|
||||
virtual RID reflection_probe_create();
|
||||
|
||||
virtual void reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode);
|
||||
virtual void reflection_probe_set_update_mode(RID p_probe, RS::ReflectionProbeUpdateMode p_mode);
|
||||
virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity);
|
||||
virtual void reflection_probe_set_interior_ambient(RID p_probe, const Color &p_ambient);
|
||||
virtual void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy);
|
||||
|
@ -1007,7 +1007,7 @@ public:
|
|||
virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution);
|
||||
|
||||
virtual AABB reflection_probe_get_aabb(RID p_probe) const;
|
||||
virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const;
|
||||
virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const;
|
||||
virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const;
|
||||
|
||||
virtual int reflection_probe_get_resolution(RID p_probe) const;
|
||||
|
@ -1111,7 +1111,7 @@ public:
|
|||
virtual void particles_set_fractional_delta(RID p_particles, bool p_enable);
|
||||
virtual void particles_restart(RID p_particles);
|
||||
|
||||
virtual void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order);
|
||||
virtual void particles_set_draw_order(RID p_particles, RS::ParticlesDrawOrder p_order);
|
||||
|
||||
virtual void particles_set_draw_passes(RID p_particles, int p_passes);
|
||||
virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh);
|
||||
|
@ -1203,7 +1203,7 @@ public:
|
|||
bool flags[RENDER_TARGET_FLAG_MAX];
|
||||
|
||||
bool used_in_frame;
|
||||
VS::ViewportMSAA msaa;
|
||||
RS::ViewportMSAA msaa;
|
||||
|
||||
RID texture;
|
||||
|
||||
|
@ -1223,7 +1223,7 @@ public:
|
|||
width(0),
|
||||
height(0),
|
||||
used_in_frame(false),
|
||||
msaa(VS::VIEWPORT_MSAA_DISABLED),
|
||||
msaa(RS::VIEWPORT_MSAA_DISABLED),
|
||||
used_dof_blur_near(false),
|
||||
mip_maps_allocated(false) {
|
||||
for (int i = 0; i < RENDER_TARGET_FLAG_MAX; ++i) {
|
||||
|
@ -1247,7 +1247,7 @@ public:
|
|||
virtual void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value);
|
||||
virtual bool render_target_was_used(RID p_render_target);
|
||||
virtual void render_target_set_as_unused(RID p_render_target);
|
||||
virtual void render_target_set_msaa(RID p_render_target, VS::ViewportMSAA p_msaa);
|
||||
virtual void render_target_set_msaa(RID p_render_target, RS::ViewportMSAA p_msaa);
|
||||
|
||||
/* CANVAS SHADOW */
|
||||
|
||||
|
@ -1279,7 +1279,7 @@ public:
|
|||
virtual RID canvas_light_occluder_create();
|
||||
virtual void canvas_light_occluder_set_polylines(RID p_occluder, const Vector<Vector2> &p_lines);
|
||||
|
||||
virtual VS::InstanceType get_base_type(RID p_rid) const;
|
||||
virtual RS::InstanceType get_base_type(RID p_rid) const;
|
||||
|
||||
virtual bool free(RID p_rid);
|
||||
|
||||
|
@ -1309,9 +1309,9 @@ public:
|
|||
|
||||
virtual void render_info_begin_capture();
|
||||
virtual void render_info_end_capture();
|
||||
virtual int get_captured_render_info(VS::RenderInfo p_info);
|
||||
virtual int get_captured_render_info(RS::RenderInfo p_info);
|
||||
|
||||
virtual int get_render_info(VS::RenderInfo p_info);
|
||||
virtual int get_render_info(RS::RenderInfo p_info);
|
||||
virtual String get_video_adapter_name() const;
|
||||
virtual String get_video_adapter_vendor() const;
|
||||
|
||||
|
|
|
@ -934,7 +934,7 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
|
|||
return code.as_string();
|
||||
}
|
||||
|
||||
Error ShaderCompilerGLES2::compile(VS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code) {
|
||||
Error ShaderCompilerGLES2::compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code) {
|
||||
|
||||
Error err = parser.compile(p_code, ShaderTypes::get_singleton()->get_functions(p_mode), ShaderTypes::get_singleton()->get_modes(p_mode), ShaderTypes::get_singleton()->get_types());
|
||||
|
||||
|
@ -975,210 +975,210 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
|
|||
|
||||
/** CANVAS ITEM SHADER **/
|
||||
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["UV"] = "uv";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "point_size";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["VERTEX"] = "outvec.xy";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["UV"] = "uv";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["POINT_SIZE"] = "point_size";
|
||||
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] = "extra_matrix_instance";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["TIME"] = "time";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["AT_LIGHT_PASS"] = "at_light_pass";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["INSTANCE_CUSTOM"] = "instance_custom";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["WORLD_MATRIX"] = "modelview_matrix";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] = "extra_matrix_instance";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["TIME"] = "time";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["AT_LIGHT_PASS"] = "at_light_pass";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["INSTANCE_CUSTOM"] = "instance_custom";
|
||||
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL"] = "normal";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["NORMALMAP"] = "normal_map";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["NORMALMAP_DEPTH"] = "normal_depth";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE"] = "color_texture";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["TEXTURE_PIXEL_SIZE"] = "color_texpixel_size";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL_TEXTURE"] = "normal_texture";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_UV"] = "screen_uv";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_TEXTURE"] = "screen_texture";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["SCREEN_PIXEL_SIZE"] = "screen_pixel_size";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["FRAGCOORD"] = "gl_FragCoord";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["POINT_COORD"] = "gl_PointCoord";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["NORMAL"] = "normal";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["NORMALMAP"] = "normal_map";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["NORMALMAP_DEPTH"] = "normal_depth";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["TEXTURE"] = "color_texture";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["TEXTURE_PIXEL_SIZE"] = "color_texpixel_size";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["NORMAL_TEXTURE"] = "normal_texture";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["SCREEN_UV"] = "screen_uv";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["SCREEN_TEXTURE"] = "screen_texture";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["SCREEN_PIXEL_SIZE"] = "screen_pixel_size";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["FRAGCOORD"] = "gl_FragCoord";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["POINT_COORD"] = "gl_PointCoord";
|
||||
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_VEC"] = "light_vec";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_HEIGHT"] = "light_height";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_COLOR"] = "light_color";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT_UV"] = "light_uv";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["LIGHT"] = "light";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["SHADOW_COLOR"] = "shadow_color";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["SHADOW_VEC"] = "shadow_vec";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["LIGHT_VEC"] = "light_vec";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["LIGHT_HEIGHT"] = "light_height";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["LIGHT_COLOR"] = "light_color";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["LIGHT_UV"] = "light_uv";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["LIGHT"] = "light";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["SHADOW_COLOR"] = "shadow_color";
|
||||
actions[RS::SHADER_CANVAS_ITEM].renames["SHADOW_VEC"] = "shadow_vec";
|
||||
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["COLOR"] = "#define COLOR_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_PIXEL_SIZE"] = "@SCREEN_UV";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMAL"] = "#define NORMAL_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["NORMALMAP"] = "#define NORMALMAP_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["SHADOW_VEC"] = "#define SHADOW_VEC_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["COLOR"] = "#define COLOR_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["SCREEN_PIXEL_SIZE"] = "@SCREEN_UV";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["NORMAL"] = "#define NORMAL_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["NORMALMAP"] = "#define NORMALMAP_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["SHADOW_VEC"] = "#define SHADOW_VEC_USED\n";
|
||||
|
||||
// Ported from GLES3
|
||||
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["sinh"] = "#define SINH_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["cosh"] = "#define COSH_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["tanh"] = "#define TANH_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["asinh"] = "#define ASINH_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["acosh"] = "#define ACOSH_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["atanh"] = "#define ATANH_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["determinant"] = "#define DETERMINANT_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["transpose"] = "#define TRANSPOSE_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["outerProduct"] = "#define OUTER_PRODUCT_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["round"] = "#define ROUND_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["roundEven"] = "#define ROUND_EVEN_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["inverse"] = "#define INVERSE_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["isinf"] = "#define IS_INF_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["isnan"] = "#define IS_NAN_USED\n";
|
||||
actions[VS::SHADER_CANVAS_ITEM].usage_defines["trunc"] = "#define TRUNC_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["sinh"] = "#define SINH_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["cosh"] = "#define COSH_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["tanh"] = "#define TANH_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["asinh"] = "#define ASINH_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["acosh"] = "#define ACOSH_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["atanh"] = "#define ATANH_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["determinant"] = "#define DETERMINANT_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["transpose"] = "#define TRANSPOSE_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["outerProduct"] = "#define OUTER_PRODUCT_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["round"] = "#define ROUND_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["roundEven"] = "#define ROUND_EVEN_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["inverse"] = "#define INVERSE_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["isinf"] = "#define IS_INF_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["isnan"] = "#define IS_NAN_USED\n";
|
||||
actions[RS::SHADER_CANVAS_ITEM].usage_defines["trunc"] = "#define TRUNC_USED\n";
|
||||
|
||||
/** SPATIAL SHADER **/
|
||||
|
||||
actions[VS::SHADER_SPATIAL].renames["WORLD_MATRIX"] = "world_transform";
|
||||
actions[VS::SHADER_SPATIAL].renames["INV_CAMERA_MATRIX"] = "camera_inverse_matrix";
|
||||
actions[VS::SHADER_SPATIAL].renames["CAMERA_MATRIX"] = "camera_matrix";
|
||||
actions[VS::SHADER_SPATIAL].renames["PROJECTION_MATRIX"] = "projection_matrix";
|
||||
actions[VS::SHADER_SPATIAL].renames["INV_PROJECTION_MATRIX"] = "projection_inverse_matrix";
|
||||
actions[VS::SHADER_SPATIAL].renames["MODELVIEW_MATRIX"] = "modelview";
|
||||
actions[RS::SHADER_SPATIAL].renames["WORLD_MATRIX"] = "world_transform";
|
||||
actions[RS::SHADER_SPATIAL].renames["INV_CAMERA_MATRIX"] = "camera_inverse_matrix";
|
||||
actions[RS::SHADER_SPATIAL].renames["CAMERA_MATRIX"] = "camera_matrix";
|
||||
actions[RS::SHADER_SPATIAL].renames["PROJECTION_MATRIX"] = "projection_matrix";
|
||||
actions[RS::SHADER_SPATIAL].renames["INV_PROJECTION_MATRIX"] = "projection_inverse_matrix";
|
||||
actions[RS::SHADER_SPATIAL].renames["MODELVIEW_MATRIX"] = "modelview";
|
||||
|
||||
actions[VS::SHADER_SPATIAL].renames["VERTEX"] = "vertex.xyz";
|
||||
actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
|
||||
actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
|
||||
actions[VS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
|
||||
actions[VS::SHADER_SPATIAL].renames["POSITION"] = "position";
|
||||
actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
|
||||
actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
|
||||
actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
|
||||
actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "point_size";
|
||||
actions[RS::SHADER_SPATIAL].renames["VERTEX"] = "vertex.xyz";
|
||||
actions[RS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
|
||||
actions[RS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
|
||||
actions[RS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
|
||||
actions[RS::SHADER_SPATIAL].renames["POSITION"] = "position";
|
||||
actions[RS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
|
||||
actions[RS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
|
||||
actions[RS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
|
||||
actions[RS::SHADER_SPATIAL].renames["POINT_SIZE"] = "point_size";
|
||||
// gl_InstanceID is not available in OpenGL ES 2.0
|
||||
actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "0";
|
||||
actions[RS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "0";
|
||||
|
||||
//builtins
|
||||
|
||||
actions[VS::SHADER_SPATIAL].renames["TIME"] = "time";
|
||||
actions[VS::SHADER_SPATIAL].renames["VIEWPORT_SIZE"] = "viewport_size";
|
||||
actions[RS::SHADER_SPATIAL].renames["TIME"] = "time";
|
||||
actions[RS::SHADER_SPATIAL].renames["VIEWPORT_SIZE"] = "viewport_size";
|
||||
|
||||
actions[VS::SHADER_SPATIAL].renames["FRAGCOORD"] = "gl_FragCoord";
|
||||
actions[VS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrontFacing";
|
||||
actions[VS::SHADER_SPATIAL].renames["NORMALMAP"] = "normalmap";
|
||||
actions[VS::SHADER_SPATIAL].renames["NORMALMAP_DEPTH"] = "normaldepth";
|
||||
actions[VS::SHADER_SPATIAL].renames["ALBEDO"] = "albedo";
|
||||
actions[VS::SHADER_SPATIAL].renames["ALPHA"] = "alpha";
|
||||
actions[VS::SHADER_SPATIAL].renames["METALLIC"] = "metallic";
|
||||
actions[VS::SHADER_SPATIAL].renames["SPECULAR"] = "specular";
|
||||
actions[VS::SHADER_SPATIAL].renames["ROUGHNESS"] = "roughness";
|
||||
actions[VS::SHADER_SPATIAL].renames["RIM"] = "rim";
|
||||
actions[VS::SHADER_SPATIAL].renames["RIM_TINT"] = "rim_tint";
|
||||
actions[VS::SHADER_SPATIAL].renames["CLEARCOAT"] = "clearcoat";
|
||||
actions[VS::SHADER_SPATIAL].renames["CLEARCOAT_GLOSS"] = "clearcoat_gloss";
|
||||
actions[VS::SHADER_SPATIAL].renames["ANISOTROPY"] = "anisotropy";
|
||||
actions[VS::SHADER_SPATIAL].renames["ANISOTROPY_FLOW"] = "anisotropy_flow";
|
||||
actions[VS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
|
||||
actions[VS::SHADER_SPATIAL].renames["TRANSMISSION"] = "transmission";
|
||||
actions[VS::SHADER_SPATIAL].renames["AO"] = "ao";
|
||||
actions[VS::SHADER_SPATIAL].renames["AO_LIGHT_AFFECT"] = "ao_light_affect";
|
||||
actions[VS::SHADER_SPATIAL].renames["EMISSION"] = "emission";
|
||||
actions[VS::SHADER_SPATIAL].renames["POINT_COORD"] = "gl_PointCoord";
|
||||
actions[VS::SHADER_SPATIAL].renames["INSTANCE_CUSTOM"] = "instance_custom";
|
||||
actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"] = "screen_uv";
|
||||
actions[VS::SHADER_SPATIAL].renames["SCREEN_TEXTURE"] = "screen_texture";
|
||||
actions[VS::SHADER_SPATIAL].renames["DEPTH_TEXTURE"] = "depth_texture";
|
||||
actions[RS::SHADER_SPATIAL].renames["FRAGCOORD"] = "gl_FragCoord";
|
||||
actions[RS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrontFacing";
|
||||
actions[RS::SHADER_SPATIAL].renames["NORMALMAP"] = "normalmap";
|
||||
actions[RS::SHADER_SPATIAL].renames["NORMALMAP_DEPTH"] = "normaldepth";
|
||||
actions[RS::SHADER_SPATIAL].renames["ALBEDO"] = "albedo";
|
||||
actions[RS::SHADER_SPATIAL].renames["ALPHA"] = "alpha";
|
||||
actions[RS::SHADER_SPATIAL].renames["METALLIC"] = "metallic";
|
||||
actions[RS::SHADER_SPATIAL].renames["SPECULAR"] = "specular";
|
||||
actions[RS::SHADER_SPATIAL].renames["ROUGHNESS"] = "roughness";
|
||||
actions[RS::SHADER_SPATIAL].renames["RIM"] = "rim";
|
||||
actions[RS::SHADER_SPATIAL].renames["RIM_TINT"] = "rim_tint";
|
||||
actions[RS::SHADER_SPATIAL].renames["CLEARCOAT"] = "clearcoat";
|
||||
actions[RS::SHADER_SPATIAL].renames["CLEARCOAT_GLOSS"] = "clearcoat_gloss";
|
||||
actions[RS::SHADER_SPATIAL].renames["ANISOTROPY"] = "anisotropy";
|
||||
actions[RS::SHADER_SPATIAL].renames["ANISOTROPY_FLOW"] = "anisotropy_flow";
|
||||
actions[RS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
|
||||
actions[RS::SHADER_SPATIAL].renames["TRANSMISSION"] = "transmission";
|
||||
actions[RS::SHADER_SPATIAL].renames["AO"] = "ao";
|
||||
actions[RS::SHADER_SPATIAL].renames["AO_LIGHT_AFFECT"] = "ao_light_affect";
|
||||
actions[RS::SHADER_SPATIAL].renames["EMISSION"] = "emission";
|
||||
actions[RS::SHADER_SPATIAL].renames["POINT_COORD"] = "gl_PointCoord";
|
||||
actions[RS::SHADER_SPATIAL].renames["INSTANCE_CUSTOM"] = "instance_custom";
|
||||
actions[RS::SHADER_SPATIAL].renames["SCREEN_UV"] = "screen_uv";
|
||||
actions[RS::SHADER_SPATIAL].renames["SCREEN_TEXTURE"] = "screen_texture";
|
||||
actions[RS::SHADER_SPATIAL].renames["DEPTH_TEXTURE"] = "depth_texture";
|
||||
// Defined in GLES3, but not available in GLES2
|
||||
//actions[VS::SHADER_SPATIAL].renames["DEPTH"] = "gl_FragDepth";
|
||||
actions[VS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor";
|
||||
actions[VS::SHADER_SPATIAL].renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
|
||||
//actions[RS::SHADER_SPATIAL].renames["DEPTH"] = "gl_FragDepth";
|
||||
actions[RS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor";
|
||||
actions[RS::SHADER_SPATIAL].renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
|
||||
|
||||
//for light
|
||||
actions[VS::SHADER_SPATIAL].renames["VIEW"] = "view";
|
||||
actions[VS::SHADER_SPATIAL].renames["LIGHT_COLOR"] = "light_color";
|
||||
actions[VS::SHADER_SPATIAL].renames["LIGHT"] = "light";
|
||||
actions[VS::SHADER_SPATIAL].renames["ATTENUATION"] = "attenuation";
|
||||
actions[VS::SHADER_SPATIAL].renames["DIFFUSE_LIGHT"] = "diffuse_light";
|
||||
actions[VS::SHADER_SPATIAL].renames["SPECULAR_LIGHT"] = "specular_light";
|
||||
actions[RS::SHADER_SPATIAL].renames["VIEW"] = "view";
|
||||
actions[RS::SHADER_SPATIAL].renames["LIGHT_COLOR"] = "light_color";
|
||||
actions[RS::SHADER_SPATIAL].renames["LIGHT"] = "light";
|
||||
actions[RS::SHADER_SPATIAL].renames["ATTENUATION"] = "attenuation";
|
||||
actions[RS::SHADER_SPATIAL].renames["DIFFUSE_LIGHT"] = "diffuse_light";
|
||||
actions[RS::SHADER_SPATIAL].renames["SPECULAR_LIGHT"] = "specular_light";
|
||||
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["TANGENT"] = "#define ENABLE_TANGENT_INTERP\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["BINORMAL"] = "@TANGENT";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["RIM"] = "#define LIGHT_USE_RIM\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["RIM_TINT"] = "@RIM";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["CLEARCOAT"] = "#define LIGHT_USE_CLEARCOAT\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["CLEARCOAT_GLOSS"] = "@CLEARCOAT";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY"] = "#define LIGHT_USE_ANISOTROPY\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["AO"] = "#define ENABLE_AO\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP"] = "#define ENABLE_NORMALMAP\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP_DEPTH"] = "@NORMALMAP";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["TANGENT"] = "#define ENABLE_TANGENT_INTERP\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["BINORMAL"] = "@TANGENT";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["RIM"] = "#define LIGHT_USE_RIM\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["RIM_TINT"] = "@RIM";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["CLEARCOAT"] = "#define LIGHT_USE_CLEARCOAT\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["CLEARCOAT_GLOSS"] = "@CLEARCOAT";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["ANISOTROPY"] = "#define LIGHT_USE_ANISOTROPY\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["AO"] = "#define ENABLE_AO\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["NORMALMAP"] = "#define ENABLE_NORMALMAP\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["NORMALMAP_DEPTH"] = "@NORMALMAP";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
|
||||
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["DEPTH_TEXTURE"] = "#define DEPTH_TEXTURE_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["DEPTH_TEXTURE"] = "#define DEPTH_TEXTURE_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
|
||||
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
|
||||
|
||||
// Ported from GLES3
|
||||
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["sinh"] = "#define SINH_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["cosh"] = "#define COSH_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["tanh"] = "#define TANH_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["asinh"] = "#define ASINH_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["acosh"] = "#define ACOSH_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["atanh"] = "#define ATANH_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["determinant"] = "#define DETERMINANT_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["transpose"] = "#define TRANSPOSE_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["outerProduct"] = "#define OUTER_PRODUCT_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["round"] = "#define ROUND_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["roundEven"] = "#define ROUND_EVEN_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["inverse"] = "#define INVERSE_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["isinf"] = "#define IS_INF_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["isnan"] = "#define IS_NAN_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].usage_defines["trunc"] = "#define TRUNC_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["sinh"] = "#define SINH_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["cosh"] = "#define COSH_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["tanh"] = "#define TANH_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["asinh"] = "#define ASINH_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["acosh"] = "#define ACOSH_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["atanh"] = "#define ATANH_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["determinant"] = "#define DETERMINANT_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["transpose"] = "#define TRANSPOSE_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["outerProduct"] = "#define OUTER_PRODUCT_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["round"] = "#define ROUND_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["roundEven"] = "#define ROUND_EVEN_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["inverse"] = "#define INVERSE_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["isinf"] = "#define IS_INF_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["isnan"] = "#define IS_NAN_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].usage_defines["trunc"] = "#define TRUNC_USED\n";
|
||||
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
|
||||
|
||||
// Defined in GLES3, could be implemented in GLES2 too if there's a need for it
|
||||
//actions[VS::SHADER_SPATIAL].render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n";
|
||||
//actions[RS::SHADER_SPATIAL].render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n";
|
||||
// Defined in GLES3, might not be possible in GLES2 as gl_FrontFacing is not available
|
||||
//actions[VS::SHADER_SPATIAL].render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n";
|
||||
//actions[VS::SHADER_SPATIAL].render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n";
|
||||
//actions[RS::SHADER_SPATIAL].render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n";
|
||||
//actions[RS::SHADER_SPATIAL].render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n";
|
||||
|
||||
bool force_lambert = GLOBAL_GET("rendering/quality/shading/force_lambert_over_burley");
|
||||
|
||||
if (!force_lambert) {
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n";
|
||||
}
|
||||
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_oren_nayar"] = "#define DIFFUSE_OREN_NAYAR\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_oren_nayar"] = "#define DIFFUSE_OREN_NAYAR\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
|
||||
|
||||
bool force_blinn = GLOBAL_GET("rendering/quality/shading/force_blinn_over_ggx");
|
||||
|
||||
if (!force_blinn) {
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n";
|
||||
} else {
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_BLINN\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_BLINN\n";
|
||||
}
|
||||
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n";
|
||||
actions[VS::SHADER_SPATIAL].render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n";
|
||||
actions[RS::SHADER_SPATIAL].render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n";
|
||||
|
||||
// No defines for particle shaders in GLES2, there are no GPU particles
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
|
||||
#include "core/pair.h"
|
||||
#include "core/string_builder.h"
|
||||
#include "servers/visual/shader_language.h"
|
||||
#include "servers/visual/shader_types.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering/shader_language.h"
|
||||
#include "servers/rendering/shader_types.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
class ShaderCompilerGLES2 {
|
||||
public:
|
||||
|
@ -91,10 +91,10 @@ private:
|
|||
Set<StringName> used_rmode_defines;
|
||||
Set<StringName> internal_functions;
|
||||
|
||||
DefaultIdentifierActions actions[VS::SHADER_MAX];
|
||||
DefaultIdentifierActions actions[RS::SHADER_MAX];
|
||||
|
||||
public:
|
||||
Error compile(VS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code);
|
||||
Error compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code);
|
||||
|
||||
ShaderCompilerGLES2();
|
||||
};
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "core/math/camera_matrix.h"
|
||||
#include "core/pair.h"
|
||||
#include "core/variant.h"
|
||||
#include "servers/visual/shader_language.h"
|
||||
#include "servers/rendering/shader_language.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
[vertex]
|
||||
|
||||
/*
|
||||
from VisualServer:
|
||||
from RenderingServer:
|
||||
|
||||
ARRAY_VERTEX=0,
|
||||
ARRAY_NORMAL=1,
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "drivers/unix/net_socket_posix.h"
|
||||
#include "drivers/unix/rw_lock_posix.h"
|
||||
#include "drivers/unix/thread_posix.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <mach-o/dyld.h>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "core/oa_hash_map.h"
|
||||
#include "core/os/thread_safe.h"
|
||||
#include "core/rid_owner.h"
|
||||
#include "servers/visual/rendering_device.h"
|
||||
#include "servers/rendering/rendering_device.h"
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
#define _DEBUG
|
||||
|
|
|
@ -303,7 +303,7 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x,
|
|||
Vector<Color> color;
|
||||
color.push_back(Color(0.75, 0.75, 0.75));
|
||||
|
||||
VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color);
|
||||
RS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color);
|
||||
|
||||
if (p_selected) {
|
||||
Color accent = get_theme_color("accent_color", "Editor");
|
||||
|
@ -673,7 +673,7 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_
|
|||
}
|
||||
|
||||
if (lines.size() > 2) {
|
||||
VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, colorv);
|
||||
RS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, colorv);
|
||||
}
|
||||
|
||||
int limit = to_x - from_x - 4;
|
||||
|
@ -926,7 +926,7 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int
|
|||
Vector<Color> color;
|
||||
color.push_back(Color(0.75, 0.75, 0.75));
|
||||
|
||||
VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color);
|
||||
RS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, color);
|
||||
|
||||
Color cut_color = get_theme_color("accent_color", "Editor");
|
||||
cut_color.a = 0.7;
|
||||
|
@ -1255,7 +1255,7 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec,
|
|||
}
|
||||
|
||||
if (lines.size() > 2) {
|
||||
VS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, colorv);
|
||||
RS::get_singleton()->canvas_item_add_multiline(get_canvas_item(), lines, colorv);
|
||||
}
|
||||
|
||||
int limit = to_x - from_x - 4;
|
||||
|
|
|
@ -1569,7 +1569,7 @@ void EditorInspector::update_tree() {
|
|||
} else if (!(p.usage & PROPERTY_USAGE_EDITOR) || _is_property_disabled_by_feature_profile(p.name))
|
||||
continue;
|
||||
|
||||
if (p.usage & PROPERTY_USAGE_HIGH_END_GFX && VS::get_singleton()->is_low_end())
|
||||
if (p.usage & PROPERTY_USAGE_HIGH_END_GFX && RS::get_singleton()->is_low_end())
|
||||
continue; //do not show this property in low end gfx
|
||||
|
||||
if (p.name == "script" && (hide_script || bool(object->call("_hide_script_from_inspector")))) {
|
||||
|
|
|
@ -61,9 +61,9 @@
|
|||
#include "scene/gui/texture_progress.h"
|
||||
#include "scene/gui/tool_button.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "servers/navigation_2d_server.h"
|
||||
#include "servers/navigation_server.h"
|
||||
#include "servers/physics_2d_server.h"
|
||||
#include "servers/navigation_server_2d.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
#include "servers/physics_server_2d.h"
|
||||
|
||||
#include "editor/audio_stream_preview.h"
|
||||
#include "editor/debugger/editor_debugger_node.h"
|
||||
|
@ -358,13 +358,13 @@ void EditorNode::_notification(int p_what) {
|
|||
scene_root->set_default_canvas_item_texture_repeat(tr);
|
||||
}
|
||||
|
||||
VS::DOFBokehShape dof_shape = VS::DOFBokehShape(int(GLOBAL_GET("rendering/quality/filters/depth_of_field_bokeh_shape")));
|
||||
VS::get_singleton()->camera_effects_set_dof_blur_bokeh_shape(dof_shape);
|
||||
VS::DOFBlurQuality dof_quality = VS::DOFBlurQuality(int(GLOBAL_GET("rendering/quality/filters/depth_of_field_bokeh_quality")));
|
||||
RS::DOFBokehShape dof_shape = RS::DOFBokehShape(int(GLOBAL_GET("rendering/quality/filters/depth_of_field_bokeh_shape")));
|
||||
RS::get_singleton()->camera_effects_set_dof_blur_bokeh_shape(dof_shape);
|
||||
RS::DOFBlurQuality dof_quality = RS::DOFBlurQuality(int(GLOBAL_GET("rendering/quality/filters/depth_of_field_bokeh_quality")));
|
||||
bool dof_jitter = GLOBAL_GET("rendering/quality/filters/depth_of_field_use_jitter");
|
||||
VS::get_singleton()->camera_effects_set_dof_blur_quality(dof_quality, dof_jitter);
|
||||
VS::get_singleton()->environment_set_ssao_quality(VS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/quality/ssao/quality"))), GLOBAL_GET("rendering/quality/ssao/half_size"));
|
||||
VS::get_singleton()->screen_space_roughness_limiter_set_active(GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter"), GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter_curve"));
|
||||
RS::get_singleton()->camera_effects_set_dof_blur_quality(dof_quality, dof_jitter);
|
||||
RS::get_singleton()->environment_set_ssao_quality(RS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/quality/ssao/quality"))), GLOBAL_GET("rendering/quality/ssao/half_size"));
|
||||
RS::get_singleton()->screen_space_roughness_limiter_set_active(GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter"), GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter_curve"));
|
||||
}
|
||||
|
||||
ResourceImporterTexture::get_singleton()->update_imports();
|
||||
|
@ -404,9 +404,9 @@ void EditorNode::_notification(int p_what) {
|
|||
_initializing_addons = false;
|
||||
}
|
||||
|
||||
VisualServer::get_singleton()->viewport_set_hide_scenario(get_scene_root()->get_viewport_rid(), true);
|
||||
VisualServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport_rid(), true);
|
||||
VisualServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(), true);
|
||||
RenderingServer::get_singleton()->viewport_set_hide_scenario(get_scene_root()->get_viewport_rid(), true);
|
||||
RenderingServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport_rid(), true);
|
||||
RenderingServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(), true);
|
||||
|
||||
feature_profile_manager->notify_changed();
|
||||
|
||||
|
@ -5530,12 +5530,12 @@ EditorNode::EditorNode() {
|
|||
InputFilter::get_singleton()->set_use_accumulated_input(true);
|
||||
Resource::_get_local_scene_func = _resource_get_edited_scene;
|
||||
|
||||
VisualServer::get_singleton()->set_debug_generate_wireframes(true);
|
||||
RenderingServer::get_singleton()->set_debug_generate_wireframes(true);
|
||||
|
||||
NavigationServer::get_singleton()->set_active(false); // no nav by default if editor
|
||||
NavigationServer3D::get_singleton()->set_active(false); // no nav by default if editor
|
||||
|
||||
PhysicsServer::get_singleton()->set_active(false); // no physics by default if editor
|
||||
Physics2DServer::get_singleton()->set_active(false); // no physics by default if editor
|
||||
PhysicsServer3D::get_singleton()->set_active(false); // no physics by default if editor
|
||||
PhysicsServer2D::get_singleton()->set_active(false); // no physics by default if editor
|
||||
ScriptServer::set_scripting_enabled(false); // no scripting by default if editor
|
||||
|
||||
EditorHelp::generate_doc(); //before any editor classes are created
|
||||
|
@ -6011,7 +6011,7 @@ EditorNode::EditorNode() {
|
|||
scene_root = memnew(SubViewport);
|
||||
//scene_root->set_usage(Viewport::USAGE_2D); canvas BG mode prevents usage of this as 2D
|
||||
|
||||
VisualServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport_rid(), true);
|
||||
RenderingServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport_rid(), true);
|
||||
scene_root->set_disable_input(true);
|
||||
scene_root->set_as_audio_listener_2d(true);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "plugins/node_3d_editor_plugin.h"
|
||||
#include "scene/3d/camera_3d.h"
|
||||
#include "scene/gui/popup_menu.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
Array EditorInterface::_make_mesh_previews(const Array &p_meshes, int p_preview_size) {
|
||||
|
||||
|
@ -64,25 +64,25 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh
|
|||
|
||||
int size = p_preview_size;
|
||||
|
||||
RID scenario = VS::get_singleton()->scenario_create();
|
||||
RID scenario = RS::get_singleton()->scenario_create();
|
||||
|
||||
RID viewport = VS::get_singleton()->viewport_create();
|
||||
VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_ALWAYS);
|
||||
VS::get_singleton()->viewport_set_scenario(viewport, scenario);
|
||||
VS::get_singleton()->viewport_set_size(viewport, size, size);
|
||||
VS::get_singleton()->viewport_set_transparent_background(viewport, true);
|
||||
VS::get_singleton()->viewport_set_active(viewport, true);
|
||||
RID viewport_texture = VS::get_singleton()->viewport_get_texture(viewport);
|
||||
RID viewport = RS::get_singleton()->viewport_create();
|
||||
RS::get_singleton()->viewport_set_update_mode(viewport, RS::VIEWPORT_UPDATE_ALWAYS);
|
||||
RS::get_singleton()->viewport_set_scenario(viewport, scenario);
|
||||
RS::get_singleton()->viewport_set_size(viewport, size, size);
|
||||
RS::get_singleton()->viewport_set_transparent_background(viewport, true);
|
||||
RS::get_singleton()->viewport_set_active(viewport, true);
|
||||
RID viewport_texture = RS::get_singleton()->viewport_get_texture(viewport);
|
||||
|
||||
RID camera = VS::get_singleton()->camera_create();
|
||||
VS::get_singleton()->viewport_attach_camera(viewport, camera);
|
||||
RID camera = RS::get_singleton()->camera_create();
|
||||
RS::get_singleton()->viewport_attach_camera(viewport, camera);
|
||||
|
||||
RID light = VS::get_singleton()->directional_light_create();
|
||||
RID light_instance = VS::get_singleton()->instance_create2(light, scenario);
|
||||
RID light = RS::get_singleton()->directional_light_create();
|
||||
RID light_instance = RS::get_singleton()->instance_create2(light, scenario);
|
||||
|
||||
RID light2 = VS::get_singleton()->directional_light_create();
|
||||
VS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
||||
RID light_instance2 = VS::get_singleton()->instance_create2(light2, scenario);
|
||||
RID light2 = RS::get_singleton()->directional_light_create();
|
||||
RS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
||||
RID light_instance2 = RS::get_singleton()->instance_create2(light2, scenario);
|
||||
|
||||
EditorProgress ep("mlib", TTR("Creating Mesh Previews"), p_meshes.size());
|
||||
|
||||
|
@ -101,8 +101,8 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh
|
|||
mesh_xform = (*p_transforms)[i];
|
||||
}
|
||||
|
||||
RID inst = VS::get_singleton()->instance_create2(mesh->get_rid(), scenario);
|
||||
VS::get_singleton()->instance_set_transform(inst, mesh_xform);
|
||||
RID inst = RS::get_singleton()->instance_create2(mesh->get_rid(), scenario);
|
||||
RS::get_singleton()->instance_set_transform(inst, mesh_xform);
|
||||
|
||||
AABB aabb = mesh->get_aabb();
|
||||
Vector3 ofs = aabb.position + aabb.size * 0.5;
|
||||
|
@ -121,32 +121,32 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh
|
|||
xform.invert();
|
||||
xform = mesh_xform * xform;
|
||||
|
||||
VS::get_singleton()->camera_set_transform(camera, xform * Transform(Basis(), Vector3(0, 0, 3)));
|
||||
VS::get_singleton()->camera_set_orthogonal(camera, m * 2, 0.01, 1000.0);
|
||||
RS::get_singleton()->camera_set_transform(camera, xform * Transform(Basis(), Vector3(0, 0, 3)));
|
||||
RS::get_singleton()->camera_set_orthogonal(camera, m * 2, 0.01, 1000.0);
|
||||
|
||||
VS::get_singleton()->instance_set_transform(light_instance, xform * Transform().looking_at(Vector3(-2, -1, -1), Vector3(0, 1, 0)));
|
||||
VS::get_singleton()->instance_set_transform(light_instance2, xform * Transform().looking_at(Vector3(+1, -1, -2), Vector3(0, 1, 0)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance, xform * Transform().looking_at(Vector3(-2, -1, -1), Vector3(0, 1, 0)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance2, xform * Transform().looking_at(Vector3(+1, -1, -2), Vector3(0, 1, 0)));
|
||||
|
||||
ep.step(TTR("Thumbnail..."), i);
|
||||
Main::iteration();
|
||||
Main::iteration();
|
||||
Ref<Image> img = VS::get_singleton()->texture_2d_get(viewport_texture);
|
||||
Ref<Image> img = RS::get_singleton()->texture_2d_get(viewport_texture);
|
||||
ERR_CONTINUE(!img.is_valid() || img->empty());
|
||||
Ref<ImageTexture> it(memnew(ImageTexture));
|
||||
it->create_from_image(img);
|
||||
|
||||
VS::get_singleton()->free(inst);
|
||||
RS::get_singleton()->free(inst);
|
||||
|
||||
textures.push_back(it);
|
||||
}
|
||||
|
||||
VS::get_singleton()->free(viewport);
|
||||
VS::get_singleton()->free(light);
|
||||
VS::get_singleton()->free(light_instance);
|
||||
VS::get_singleton()->free(light2);
|
||||
VS::get_singleton()->free(light_instance2);
|
||||
VS::get_singleton()->free(camera);
|
||||
VS::get_singleton()->free(scenario);
|
||||
RS::get_singleton()->free(viewport);
|
||||
RS::get_singleton()->free(light);
|
||||
RS::get_singleton()->free(light_instance);
|
||||
RS::get_singleton()->free(light2);
|
||||
RS::get_singleton()->free(light_instance2);
|
||||
RS::get_singleton()->free(camera);
|
||||
RS::get_singleton()->free(scenario);
|
||||
|
||||
return textures;
|
||||
}
|
||||
|
|
|
@ -465,7 +465,7 @@ void EditorResourcePreview::stop() {
|
|||
preview_sem.post();
|
||||
while (!exited) {
|
||||
OS::get_singleton()->delay_usec(10000);
|
||||
VisualServer::get_singleton()->sync(); //sync pending stuff, as thread may be blocked on visual server
|
||||
RenderingServer::get_singleton()->sync(); //sync pending stuff, as thread may be blocked on visual server
|
||||
}
|
||||
Thread::wait_to_finish(thread);
|
||||
memdelete(thread);
|
||||
|
|
|
@ -922,10 +922,10 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
|
|||
if (has_weights) {
|
||||
Vector<float> weights;
|
||||
Vector<int> bones;
|
||||
weights.resize(VS::ARRAY_WEIGHTS_SIZE);
|
||||
bones.resize(VS::ARRAY_WEIGHTS_SIZE);
|
||||
weights.resize(RS::ARRAY_WEIGHTS_SIZE);
|
||||
bones.resize(RS::ARRAY_WEIGHTS_SIZE);
|
||||
//float sum=0.0;
|
||||
for (int l = 0; l < VS::ARRAY_WEIGHTS_SIZE; l++) {
|
||||
for (int l = 0; l < RS::ARRAY_WEIGHTS_SIZE; l++) {
|
||||
if (l < vertex_array[k].weights.size()) {
|
||||
weights.write[l] = vertex_array[k].weights[l].weight;
|
||||
bones.write[l] = vertex_array[k].weights[l].bone_idx;
|
||||
|
@ -963,7 +963,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
|
|||
////////////////////////////
|
||||
|
||||
Array d = surftool->commit_to_arrays();
|
||||
d.resize(VS::ARRAY_MAX);
|
||||
d.resize(RS::ARRAY_MAX);
|
||||
|
||||
Array mr;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "editor/editor_file_system.h"
|
||||
#include "editor/editor_node.h"
|
||||
|
||||
void ResourceImporterTexture::_texture_reimport_roughness(const Ref<StreamTexture> &p_tex, const String &p_normal_path, VS::TextureDetectRoughnessChannel p_channel) {
|
||||
void ResourceImporterTexture::_texture_reimport_roughness(const Ref<StreamTexture> &p_tex, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_channel) {
|
||||
|
||||
MutexLock lock(singleton->mutex);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "core/io/resource_importer.h"
|
||||
#include "core/os/file_access.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
class StreamTexture;
|
||||
|
||||
|
@ -63,16 +63,16 @@ protected:
|
|||
|
||||
int flags;
|
||||
String normal_path_for_roughness;
|
||||
VS::TextureDetectRoughnessChannel channel_for_roughness;
|
||||
RS::TextureDetectRoughnessChannel channel_for_roughness;
|
||||
MakeInfo() {
|
||||
flags = 0;
|
||||
channel_for_roughness = VS::TEXTURE_DETECT_ROUGNHESS_R;
|
||||
channel_for_roughness = RS::TEXTURE_DETECT_ROUGNHESS_R;
|
||||
}
|
||||
};
|
||||
|
||||
Map<StringName, MakeInfo> make_flags;
|
||||
|
||||
static void _texture_reimport_roughness(const Ref<StreamTexture> &p_tex, const String &p_normal_path, VisualServer::TextureDetectRoughnessChannel p_channel);
|
||||
static void _texture_reimport_roughness(const Ref<StreamTexture> &p_tex, const String &p_normal_path, RenderingServer::TextureDetectRoughnessChannel p_channel);
|
||||
static void _texture_reimport_3d(const Ref<StreamTexture> &p_tex);
|
||||
static void _texture_reimport_normal(const Ref<StreamTexture> &p_tex);
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ void EditorNode3DGizmo::clear() {
|
|||
for (int i = 0; i < instances.size(); i++) {
|
||||
|
||||
if (instances[i].instance.is_valid())
|
||||
VS::get_singleton()->free(instances[i].instance);
|
||||
RS::get_singleton()->free(instances[i].instance);
|
||||
}
|
||||
|
||||
billboard_handle = false;
|
||||
|
@ -168,16 +168,16 @@ void EditorNode3DGizmo::set_spatial_node(Node3D *p_node) {
|
|||
|
||||
void EditorNode3DGizmo::Instance::create_instance(Node3D *p_base, bool p_hidden) {
|
||||
|
||||
instance = VS::get_singleton()->instance_create2(mesh->get_rid(), p_base->get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_attach_object_instance_id(instance, p_base->get_instance_id());
|
||||
instance = RS::get_singleton()->instance_create2(mesh->get_rid(), p_base->get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_attach_object_instance_id(instance, p_base->get_instance_id());
|
||||
if (skin_reference.is_valid()) {
|
||||
VS::get_singleton()->instance_attach_skeleton(instance, skin_reference->get_skeleton());
|
||||
RS::get_singleton()->instance_attach_skeleton(instance, skin_reference->get_skeleton());
|
||||
}
|
||||
if (extra_margin)
|
||||
VS::get_singleton()->instance_set_extra_visibility_margin(instance, 1);
|
||||
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(instance, VS::SHADOW_CASTING_SETTING_OFF);
|
||||
RS::get_singleton()->instance_set_extra_visibility_margin(instance, 1);
|
||||
RS::get_singleton()->instance_geometry_set_cast_shadows_setting(instance, RS::SHADOW_CASTING_SETTING_OFF);
|
||||
int layer = p_hidden ? 0 : 1 << Node3DEditorViewport::GIZMO_EDIT_LAYER;
|
||||
VS::get_singleton()->instance_set_layer_mask(instance, layer); //gizmos are 26
|
||||
RS::get_singleton()->instance_set_layer_mask(instance, layer); //gizmos are 26
|
||||
}
|
||||
|
||||
void EditorNode3DGizmo::add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard, const Ref<SkinReference> &p_skin_reference, const Ref<Material> &p_material) {
|
||||
|
@ -191,9 +191,9 @@ void EditorNode3DGizmo::add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard,
|
|||
ins.material = p_material;
|
||||
if (valid) {
|
||||
ins.create_instance(spatial_node, hidden);
|
||||
VS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
|
||||
RS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
|
||||
if (ins.material.is_valid()) {
|
||||
VS::get_singleton()->instance_geometry_set_material_override(ins.instance, p_material->get_rid());
|
||||
RS::get_singleton()->instance_geometry_set_material_override(ins.instance, p_material->get_rid());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ void EditorNode3DGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Mate
|
|||
ins.mesh = mesh;
|
||||
if (valid) {
|
||||
ins.create_instance(spatial_node, hidden);
|
||||
VS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
|
||||
RS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
|
||||
}
|
||||
|
||||
instances.push_back(ins);
|
||||
|
@ -310,7 +310,7 @@ void EditorNode3DGizmo::add_unscaled_billboard(const Ref<Material> &p_material,
|
|||
ins.billboard = true;
|
||||
if (valid) {
|
||||
ins.create_instance(spatial_node, hidden);
|
||||
VS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
|
||||
RS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
|
||||
}
|
||||
|
||||
selectable_icon_size = p_scale;
|
||||
|
@ -346,8 +346,8 @@ void EditorNode3DGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref<
|
|||
Ref<ArrayMesh> mesh = memnew(ArrayMesh);
|
||||
|
||||
Array a;
|
||||
a.resize(VS::ARRAY_MAX);
|
||||
a[VS::ARRAY_VERTEX] = p_handles;
|
||||
a.resize(RS::ARRAY_MAX);
|
||||
a[RS::ARRAY_VERTEX] = p_handles;
|
||||
Vector<Color> colors;
|
||||
{
|
||||
colors.resize(p_handles.size());
|
||||
|
@ -364,7 +364,7 @@ void EditorNode3DGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref<
|
|||
w[i] = col;
|
||||
}
|
||||
}
|
||||
a[VS::ARRAY_COLOR] = colors;
|
||||
a[RS::ARRAY_COLOR] = colors;
|
||||
mesh->add_surface_from_arrays(Mesh::PRIMITIVE_POINTS, a);
|
||||
mesh->surface_set_material(0, p_material);
|
||||
|
||||
|
@ -384,7 +384,7 @@ void EditorNode3DGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref<
|
|||
ins.extra_margin = true;
|
||||
if (valid) {
|
||||
ins.create_instance(spatial_node, hidden);
|
||||
VS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
|
||||
RS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
|
||||
}
|
||||
instances.push_back(ins);
|
||||
if (!p_secondary) {
|
||||
|
@ -410,14 +410,14 @@ void EditorNode3DGizmo::add_solid_box(Ref<Material> &p_material, Vector3 p_size,
|
|||
cubem.set_size(p_size);
|
||||
|
||||
Array arrays = cubem.surface_get_arrays(0);
|
||||
PackedVector3Array vertex = arrays[VS::ARRAY_VERTEX];
|
||||
PackedVector3Array vertex = arrays[RS::ARRAY_VERTEX];
|
||||
Vector3 *w = vertex.ptrw();
|
||||
|
||||
for (int i = 0; i < vertex.size(); ++i) {
|
||||
w[i] += p_position;
|
||||
}
|
||||
|
||||
arrays[VS::ARRAY_VERTEX] = vertex;
|
||||
arrays[RS::ARRAY_VERTEX] = vertex;
|
||||
|
||||
Ref<ArrayMesh> m = memnew(ArrayMesh);
|
||||
m->add_surface_from_arrays(cubem.surface_get_primitive_type(0), arrays);
|
||||
|
@ -708,7 +708,7 @@ void EditorNode3DGizmo::transform() {
|
|||
ERR_FAIL_COND(!spatial_node);
|
||||
ERR_FAIL_COND(!valid);
|
||||
for (int i = 0; i < instances.size(); i++) {
|
||||
VS::get_singleton()->instance_set_transform(instances[i].instance, spatial_node->get_global_transform());
|
||||
RS::get_singleton()->instance_set_transform(instances[i].instance, spatial_node->get_global_transform());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -720,7 +720,7 @@ void EditorNode3DGizmo::free() {
|
|||
for (int i = 0; i < instances.size(); i++) {
|
||||
|
||||
if (instances[i].instance.is_valid())
|
||||
VS::get_singleton()->free(instances[i].instance);
|
||||
RS::get_singleton()->free(instances[i].instance);
|
||||
instances.write[i].instance = RID();
|
||||
}
|
||||
|
||||
|
@ -733,7 +733,7 @@ void EditorNode3DGizmo::set_hidden(bool p_hidden) {
|
|||
hidden = p_hidden;
|
||||
int layer = hidden ? 0 : 1 << Node3DEditorViewport::GIZMO_EDIT_LAYER;
|
||||
for (int i = 0; i < instances.size(); ++i) {
|
||||
VS::get_singleton()->instance_set_layer_mask(instances[i].instance, layer);
|
||||
RS::get_singleton()->instance_set_layer_mask(instances[i].instance, layer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1585,7 +1585,7 @@ Position3DNode3DGizmoPlugin::Position3DNode3DGizmoPlugin() {
|
|||
mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
|
||||
|
||||
Array d;
|
||||
d.resize(VS::ARRAY_MAX);
|
||||
d.resize(RS::ARRAY_MAX);
|
||||
d[Mesh::ARRAY_VERTEX] = cursor_points;
|
||||
d[Mesh::ARRAY_COLOR] = cursor_colors;
|
||||
pos3d_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES, d);
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "editor/plugins/canvas_item_editor_plugin.h" // For onion skinning.
|
||||
#include "editor/plugins/node_3d_editor_plugin.h" // For onion skinning.
|
||||
#include "scene/main/window.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
void AnimationPlayerEditor::_node_removed(Node *p_node) {
|
||||
|
||||
|
@ -947,8 +947,8 @@ void AnimationPlayerEditor::forward_canvas_force_draw_over_viewport(Control *p_o
|
|||
alpha += alpha_step;
|
||||
|
||||
if (onion.captures_valid[cidx]) {
|
||||
VS::get_singleton()->canvas_item_add_texture_rect_region(
|
||||
ci, dst_rect, VS::get_singleton()->viewport_get_texture(onion.captures[cidx]), src_rect, Color(1, 1, 1, alpha));
|
||||
RS::get_singleton()->canvas_item_add_texture_rect_region(
|
||||
ci, dst_rect, RS::get_singleton()->viewport_get_texture(onion.captures[cidx]), src_rect, Color(1, 1, 1, alpha));
|
||||
}
|
||||
|
||||
cidx++;
|
||||
|
@ -961,8 +961,8 @@ void AnimationPlayerEditor::forward_canvas_force_draw_over_viewport(Control *p_o
|
|||
alpha -= alpha_step;
|
||||
|
||||
if (onion.captures_valid[cidx]) {
|
||||
VS::get_singleton()->canvas_item_add_texture_rect_region(
|
||||
ci, dst_rect, VS::get_singleton()->viewport_get_texture(onion.captures[cidx]), src_rect, Color(1, 1, 1, alpha));
|
||||
RS::get_singleton()->canvas_item_add_texture_rect_region(
|
||||
ci, dst_rect, RS::get_singleton()->viewport_get_texture(onion.captures[cidx]), src_rect, Color(1, 1, 1, alpha));
|
||||
}
|
||||
|
||||
cidx++;
|
||||
|
@ -1318,17 +1318,17 @@ void AnimationPlayerEditor::_allocate_onion_layers() {
|
|||
bool is_present = onion.differences_only && i == captures - 1;
|
||||
|
||||
// Each capture is a viewport with a canvas item attached that renders a full-size rect with the contents of the main viewport.
|
||||
onion.captures.write[i] = VS::get_singleton()->viewport_create();
|
||||
onion.captures.write[i] = RS::get_singleton()->viewport_create();
|
||||
|
||||
VS::get_singleton()->viewport_set_size(onion.captures[i], capture_size.width, capture_size.height);
|
||||
VS::get_singleton()->viewport_set_update_mode(onion.captures[i], VS::VIEWPORT_UPDATE_ALWAYS);
|
||||
VS::get_singleton()->viewport_set_transparent_background(onion.captures[i], !is_present);
|
||||
VS::get_singleton()->viewport_attach_canvas(onion.captures[i], onion.capture.canvas);
|
||||
RS::get_singleton()->viewport_set_size(onion.captures[i], capture_size.width, capture_size.height);
|
||||
RS::get_singleton()->viewport_set_update_mode(onion.captures[i], RS::VIEWPORT_UPDATE_ALWAYS);
|
||||
RS::get_singleton()->viewport_set_transparent_background(onion.captures[i], !is_present);
|
||||
RS::get_singleton()->viewport_attach_canvas(onion.captures[i], onion.capture.canvas);
|
||||
}
|
||||
|
||||
// Reset the capture canvas item to the current root viewport texture (defensive).
|
||||
VS::get_singleton()->canvas_item_clear(onion.capture.canvas_item);
|
||||
VS::get_singleton()->canvas_item_add_texture_rect(onion.capture.canvas_item, Rect2(Point2(), capture_size), get_tree()->get_root()->get_texture()->get_rid());
|
||||
RS::get_singleton()->canvas_item_clear(onion.capture.canvas_item);
|
||||
RS::get_singleton()->canvas_item_add_texture_rect(onion.capture.canvas_item, Rect2(Point2(), capture_size), get_tree()->get_root()->get_texture()->get_rid());
|
||||
|
||||
onion.capture_size = capture_size;
|
||||
}
|
||||
|
@ -1337,7 +1337,7 @@ void AnimationPlayerEditor::_free_onion_layers() {
|
|||
|
||||
for (int i = 0; i < onion.captures.size(); i++) {
|
||||
if (onion.captures[i].is_valid()) {
|
||||
VS::get_singleton()->free(onion.captures[i]);
|
||||
RS::get_singleton()->free(onion.captures[i]);
|
||||
}
|
||||
}
|
||||
onion.captures.clear();
|
||||
|
@ -1421,18 +1421,18 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
|
|||
// Tweak the root viewport to ensure it's rendered before our target.
|
||||
RID root_vp = get_tree()->get_root()->get_viewport_rid();
|
||||
Rect2 root_vp_screen_rect = Rect2(Vector2(), get_tree()->get_root()->get_size());
|
||||
VS::get_singleton()->viewport_attach_to_screen(root_vp, Rect2());
|
||||
VS::get_singleton()->viewport_set_update_mode(root_vp, VS::VIEWPORT_UPDATE_ALWAYS);
|
||||
RS::get_singleton()->viewport_attach_to_screen(root_vp, Rect2());
|
||||
RS::get_singleton()->viewport_set_update_mode(root_vp, RS::VIEWPORT_UPDATE_ALWAYS);
|
||||
|
||||
RID present_rid;
|
||||
if (onion.differences_only) {
|
||||
// Capture present scene as it is.
|
||||
VS::get_singleton()->canvas_item_set_material(onion.capture.canvas_item, RID());
|
||||
RS::get_singleton()->canvas_item_set_material(onion.capture.canvas_item, RID());
|
||||
present_rid = onion.captures[onion.captures.size() - 1];
|
||||
VS::get_singleton()->viewport_set_active(present_rid, true);
|
||||
VS::get_singleton()->viewport_set_parent_viewport(root_vp, present_rid);
|
||||
VS::get_singleton()->draw(false);
|
||||
VS::get_singleton()->viewport_set_active(present_rid, false);
|
||||
RS::get_singleton()->viewport_set_active(present_rid, true);
|
||||
RS::get_singleton()->viewport_set_parent_viewport(root_vp, present_rid);
|
||||
RS::get_singleton()->draw(false);
|
||||
RS::get_singleton()->viewport_set_active(present_rid, false);
|
||||
}
|
||||
|
||||
// Backup current animation state.
|
||||
|
@ -1441,10 +1441,10 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
|
|||
|
||||
// Render every past/future step with the capture shader.
|
||||
|
||||
VS::get_singleton()->canvas_item_set_material(onion.capture.canvas_item, onion.capture.material->get_rid());
|
||||
RS::get_singleton()->canvas_item_set_material(onion.capture.canvas_item, onion.capture.material->get_rid());
|
||||
onion.capture.material->set_shader_param("bkg_color", GLOBAL_GET("rendering/environment/default_clear_color"));
|
||||
onion.capture.material->set_shader_param("differences_only", onion.differences_only);
|
||||
onion.capture.material->set_shader_param("present", onion.differences_only ? VS::get_singleton()->viewport_get_texture(present_rid) : RID());
|
||||
onion.capture.material->set_shader_param("present", onion.differences_only ? RS::get_singleton()->viewport_get_texture(present_rid) : RID());
|
||||
|
||||
int step_off_a = onion.past ? -onion.steps : 0;
|
||||
int step_off_b = onion.future ? onion.steps : 0;
|
||||
|
@ -1468,19 +1468,19 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
|
|||
get_tree()->flush_transform_notifications(); // Needed for transforms of Node3Ds.
|
||||
values_backup.update_skeletons(); // Needed for Skeletons (2D & 3D).
|
||||
|
||||
VS::get_singleton()->viewport_set_active(onion.captures[cidx], true);
|
||||
VS::get_singleton()->viewport_set_parent_viewport(root_vp, onion.captures[cidx]);
|
||||
VS::get_singleton()->draw(false);
|
||||
VS::get_singleton()->viewport_set_active(onion.captures[cidx], false);
|
||||
RS::get_singleton()->viewport_set_active(onion.captures[cidx], true);
|
||||
RS::get_singleton()->viewport_set_parent_viewport(root_vp, onion.captures[cidx]);
|
||||
RS::get_singleton()->draw(false);
|
||||
RS::get_singleton()->viewport_set_active(onion.captures[cidx], false);
|
||||
}
|
||||
|
||||
cidx++;
|
||||
}
|
||||
|
||||
// Restore root viewport.
|
||||
VS::get_singleton()->viewport_set_parent_viewport(root_vp, RID());
|
||||
VS::get_singleton()->viewport_attach_to_screen(root_vp, root_vp_screen_rect);
|
||||
VS::get_singleton()->viewport_set_update_mode(root_vp, VS::VIEWPORT_UPDATE_WHEN_VISIBLE);
|
||||
RS::get_singleton()->viewport_set_parent_viewport(root_vp, RID());
|
||||
RS::get_singleton()->viewport_attach_to_screen(root_vp, root_vp_screen_rect);
|
||||
RS::get_singleton()->viewport_set_update_mode(root_vp, RS::VIEWPORT_UPDATE_WHEN_VISIBLE);
|
||||
|
||||
// Restore animation state
|
||||
// (Seeking with update=true wouldn't do the trick because the current value of the properties
|
||||
|
@ -1764,9 +1764,9 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
|
|||
onion.last_frame = 0;
|
||||
onion.can_overlay = false;
|
||||
onion.capture_size = Size2();
|
||||
onion.capture.canvas = VS::get_singleton()->canvas_create();
|
||||
onion.capture.canvas_item = VS::get_singleton()->canvas_item_create();
|
||||
VS::get_singleton()->canvas_item_set_parent(onion.capture.canvas_item, onion.capture.canvas);
|
||||
onion.capture.canvas = RS::get_singleton()->canvas_create();
|
||||
onion.capture.canvas_item = RS::get_singleton()->canvas_item_create();
|
||||
RS::get_singleton()->canvas_item_set_parent(onion.capture.canvas_item, onion.capture.canvas);
|
||||
|
||||
onion.capture.material = Ref<ShaderMaterial>(memnew(ShaderMaterial));
|
||||
|
||||
|
@ -1792,14 +1792,14 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
|
|||
COLOR = vec4(capture_samp.rgb * dir_color.rgb, bkg_mask * diff_mask); \
|
||||
} \
|
||||
");
|
||||
VS::get_singleton()->material_set_shader(onion.capture.material->get_rid(), onion.capture.shader->get_rid());
|
||||
RS::get_singleton()->material_set_shader(onion.capture.material->get_rid(), onion.capture.shader->get_rid());
|
||||
}
|
||||
|
||||
AnimationPlayerEditor::~AnimationPlayerEditor() {
|
||||
|
||||
_free_onion_layers();
|
||||
VS::get_singleton()->free(onion.capture.canvas);
|
||||
VS::get_singleton()->free(onion.capture.canvas_item);
|
||||
RS::get_singleton()->free(onion.capture.canvas);
|
||||
RS::get_singleton()->free(onion.capture.canvas_item);
|
||||
}
|
||||
|
||||
void AnimationPlayerEditorPlugin::_notification(int p_what) {
|
||||
|
|
|
@ -89,7 +89,7 @@ void AudioStreamEditor::_draw_preview() {
|
|||
Vector<Color> color;
|
||||
color.push_back(get_theme_color("contrast_color_2", "Editor"));
|
||||
|
||||
VS::get_singleton()->canvas_item_add_multiline(_preview->get_canvas_item(), lines, color);
|
||||
RS::get_singleton()->canvas_item_add_multiline(_preview->get_canvas_item(), lines, color);
|
||||
}
|
||||
|
||||
void AudioStreamEditor::_preview_changed(ObjectID p_which) {
|
||||
|
|
|
@ -3427,7 +3427,7 @@ void CanvasItemEditor::_draw_straight_line(Point2 p_from, Point2 p_to, Color p_c
|
|||
}
|
||||
}
|
||||
if (points.size() >= 2) {
|
||||
VisualServer::get_singleton()->canvas_item_add_line(ci, points[0], points[1], p_color);
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, points[0], points[1], p_color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3455,7 +3455,7 @@ void CanvasItemEditor::_draw_axis() {
|
|||
};
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
VisualServer::get_singleton()->canvas_item_add_line(ci, screen_endpoints[i], screen_endpoints[(i + 1) % 4], area_axis_color);
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, screen_endpoints[i], screen_endpoints[(i + 1) % 4], area_axis_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3512,8 +3512,8 @@ void CanvasItemEditor::_draw_bones() {
|
|||
outline_colors.push_back(bone_outline_color);
|
||||
}
|
||||
|
||||
VisualServer::get_singleton()->canvas_item_add_polygon(ci, bone_shape_outline, outline_colors);
|
||||
VisualServer::get_singleton()->canvas_item_add_primitive(ci, bone_shape, colors, Vector<Vector2>(), RID());
|
||||
RenderingServer::get_singleton()->canvas_item_add_polygon(ci, bone_shape_outline, outline_colors);
|
||||
RenderingServer::get_singleton()->canvas_item_add_primitive(ci, bone_shape, colors, Vector<Vector2>(), RID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3744,7 +3744,7 @@ void CanvasItemEditor::_draw_viewport() {
|
|||
}
|
||||
|
||||
RID ci = viewport->get_canvas_item();
|
||||
VisualServer::get_singleton()->canvas_item_add_set_transform(ci, Transform2D());
|
||||
RenderingServer::get_singleton()->canvas_item_add_set_transform(ci, Transform2D());
|
||||
|
||||
EditorPluginList *over_plugin_list = editor->get_editor_plugins_over();
|
||||
if (!over_plugin_list->empty()) {
|
||||
|
@ -4911,7 +4911,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
|
|||
|
||||
bool preview = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(PREVIEW_CANVAS_SCALE));
|
||||
preview = !preview;
|
||||
VS::get_singleton()->canvas_set_disable_scale(!preview);
|
||||
RS::get_singleton()->canvas_set_disable_scale(!preview);
|
||||
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(PREVIEW_CANVAS_SCALE), preview);
|
||||
|
||||
} break;
|
||||
|
@ -5818,13 +5818,13 @@ void CanvasItemEditorPlugin::make_visible(bool p_visible) {
|
|||
if (p_visible) {
|
||||
canvas_item_editor->show();
|
||||
canvas_item_editor->set_physics_process(true);
|
||||
VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), false);
|
||||
RenderingServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), false);
|
||||
|
||||
} else {
|
||||
|
||||
canvas_item_editor->hide();
|
||||
canvas_item_editor->set_physics_process(false);
|
||||
VisualServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), true);
|
||||
RenderingServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6307,7 +6307,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
|
|||
label_desc->hide();
|
||||
canvas_item_editor->get_controls_container()->add_child(label_desc);
|
||||
|
||||
VS::get_singleton()->canvas_set_disable_scale(true);
|
||||
RS::get_singleton()->canvas_set_disable_scale(true);
|
||||
}
|
||||
|
||||
CanvasItemEditorViewport::~CanvasItemEditorViewport() {
|
||||
|
|
|
@ -328,19 +328,19 @@ Ref<Texture2D> EditorMaterialPreviewPlugin::generate(const RES &p_from, const Si
|
|||
|
||||
if (material->get_shader_mode() == Shader::MODE_SPATIAL) {
|
||||
|
||||
VS::get_singleton()->mesh_surface_set_material(sphere, 0, material->get_rid());
|
||||
RS::get_singleton()->mesh_surface_set_material(sphere, 0, material->get_rid());
|
||||
|
||||
VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_ONCE); //once used for capture
|
||||
RS::get_singleton()->viewport_set_update_mode(viewport, RS::VIEWPORT_UPDATE_ONCE); //once used for capture
|
||||
|
||||
preview_done = false;
|
||||
VS::get_singleton()->request_frame_drawn_callback(const_cast<EditorMaterialPreviewPlugin *>(this), "_preview_done", Variant());
|
||||
RS::get_singleton()->request_frame_drawn_callback(const_cast<EditorMaterialPreviewPlugin *>(this), "_preview_done", Variant());
|
||||
|
||||
while (!preview_done) {
|
||||
OS::get_singleton()->delay_usec(10);
|
||||
}
|
||||
|
||||
Ref<Image> img = VS::get_singleton()->texture_2d_get(viewport_texture);
|
||||
VS::get_singleton()->mesh_surface_set_material(sphere, 0, RID());
|
||||
Ref<Image> img = RS::get_singleton()->texture_2d_get(viewport_texture);
|
||||
RS::get_singleton()->mesh_surface_set_material(sphere, 0, RID());
|
||||
|
||||
ERR_FAIL_COND_V(!img.is_valid(), Ref<ImageTexture>());
|
||||
|
||||
|
@ -358,35 +358,35 @@ Ref<Texture2D> EditorMaterialPreviewPlugin::generate(const RES &p_from, const Si
|
|||
|
||||
EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
|
||||
|
||||
scenario = VS::get_singleton()->scenario_create();
|
||||
scenario = RS::get_singleton()->scenario_create();
|
||||
|
||||
viewport = VS::get_singleton()->viewport_create();
|
||||
VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_DISABLED);
|
||||
VS::get_singleton()->viewport_set_scenario(viewport, scenario);
|
||||
VS::get_singleton()->viewport_set_size(viewport, 128, 128);
|
||||
VS::get_singleton()->viewport_set_transparent_background(viewport, true);
|
||||
VS::get_singleton()->viewport_set_active(viewport, true);
|
||||
viewport_texture = VS::get_singleton()->viewport_get_texture(viewport);
|
||||
viewport = RS::get_singleton()->viewport_create();
|
||||
RS::get_singleton()->viewport_set_update_mode(viewport, RS::VIEWPORT_UPDATE_DISABLED);
|
||||
RS::get_singleton()->viewport_set_scenario(viewport, scenario);
|
||||
RS::get_singleton()->viewport_set_size(viewport, 128, 128);
|
||||
RS::get_singleton()->viewport_set_transparent_background(viewport, true);
|
||||
RS::get_singleton()->viewport_set_active(viewport, true);
|
||||
viewport_texture = RS::get_singleton()->viewport_get_texture(viewport);
|
||||
|
||||
camera = VS::get_singleton()->camera_create();
|
||||
VS::get_singleton()->viewport_attach_camera(viewport, camera);
|
||||
VS::get_singleton()->camera_set_transform(camera, Transform(Basis(), Vector3(0, 0, 3)));
|
||||
VS::get_singleton()->camera_set_perspective(camera, 45, 0.1, 10);
|
||||
camera = RS::get_singleton()->camera_create();
|
||||
RS::get_singleton()->viewport_attach_camera(viewport, camera);
|
||||
RS::get_singleton()->camera_set_transform(camera, Transform(Basis(), Vector3(0, 0, 3)));
|
||||
RS::get_singleton()->camera_set_perspective(camera, 45, 0.1, 10);
|
||||
|
||||
light = VS::get_singleton()->directional_light_create();
|
||||
light_instance = VS::get_singleton()->instance_create2(light, scenario);
|
||||
VS::get_singleton()->instance_set_transform(light_instance, Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
light = RS::get_singleton()->directional_light_create();
|
||||
light_instance = RS::get_singleton()->instance_create2(light, scenario);
|
||||
RS::get_singleton()->instance_set_transform(light_instance, Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
|
||||
light2 = VS::get_singleton()->directional_light_create();
|
||||
VS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
||||
//VS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
||||
light2 = RS::get_singleton()->directional_light_create();
|
||||
RS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
||||
//RS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
||||
|
||||
light_instance2 = VS::get_singleton()->instance_create2(light2, scenario);
|
||||
light_instance2 = RS::get_singleton()->instance_create2(light2, scenario);
|
||||
|
||||
VS::get_singleton()->instance_set_transform(light_instance2, Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance2, Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
|
||||
sphere = VS::get_singleton()->mesh_create();
|
||||
sphere_instance = VS::get_singleton()->instance_create2(sphere, scenario);
|
||||
sphere = RS::get_singleton()->mesh_create();
|
||||
sphere_instance = RS::get_singleton()->instance_create2(sphere, scenario);
|
||||
|
||||
int lats = 32;
|
||||
int lons = 32;
|
||||
|
@ -453,25 +453,25 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
|
|||
}
|
||||
|
||||
Array arr;
|
||||
arr.resize(VS::ARRAY_MAX);
|
||||
arr[VS::ARRAY_VERTEX] = vertices;
|
||||
arr[VS::ARRAY_NORMAL] = normals;
|
||||
arr[VS::ARRAY_TANGENT] = tangents;
|
||||
arr[VS::ARRAY_TEX_UV] = uvs;
|
||||
VS::get_singleton()->mesh_add_surface_from_arrays(sphere, VS::PRIMITIVE_TRIANGLES, arr);
|
||||
arr.resize(RS::ARRAY_MAX);
|
||||
arr[RS::ARRAY_VERTEX] = vertices;
|
||||
arr[RS::ARRAY_NORMAL] = normals;
|
||||
arr[RS::ARRAY_TANGENT] = tangents;
|
||||
arr[RS::ARRAY_TEX_UV] = uvs;
|
||||
RS::get_singleton()->mesh_add_surface_from_arrays(sphere, RS::PRIMITIVE_TRIANGLES, arr);
|
||||
}
|
||||
|
||||
EditorMaterialPreviewPlugin::~EditorMaterialPreviewPlugin() {
|
||||
|
||||
VS::get_singleton()->free(sphere);
|
||||
VS::get_singleton()->free(sphere_instance);
|
||||
VS::get_singleton()->free(viewport);
|
||||
VS::get_singleton()->free(light);
|
||||
VS::get_singleton()->free(light_instance);
|
||||
VS::get_singleton()->free(light2);
|
||||
VS::get_singleton()->free(light_instance2);
|
||||
VS::get_singleton()->free(camera);
|
||||
VS::get_singleton()->free(scenario);
|
||||
RS::get_singleton()->free(sphere);
|
||||
RS::get_singleton()->free(sphere_instance);
|
||||
RS::get_singleton()->free(viewport);
|
||||
RS::get_singleton()->free(light);
|
||||
RS::get_singleton()->free(light_instance);
|
||||
RS::get_singleton()->free(light2);
|
||||
RS::get_singleton()->free(light_instance2);
|
||||
RS::get_singleton()->free(camera);
|
||||
RS::get_singleton()->free(scenario);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -706,7 +706,7 @@ Ref<Texture2D> EditorMeshPreviewPlugin::generate(const RES &p_from, const Size2
|
|||
Ref<Mesh> mesh = p_from;
|
||||
ERR_FAIL_COND_V(mesh.is_null(), Ref<Texture2D>());
|
||||
|
||||
VS::get_singleton()->instance_set_base(mesh_instance, mesh->get_rid());
|
||||
RS::get_singleton()->instance_set_base(mesh_instance, mesh->get_rid());
|
||||
|
||||
AABB aabb = mesh->get_aabb();
|
||||
Vector3 ofs = aabb.position + aabb.size * 0.5;
|
||||
|
@ -723,21 +723,21 @@ Ref<Texture2D> EditorMeshPreviewPlugin::generate(const RES &p_from, const Size2
|
|||
xform.basis.scale(Vector3(m, m, m));
|
||||
xform.origin = -xform.basis.xform(ofs); //-ofs*m;
|
||||
xform.origin.z -= rot_aabb.size.z * 2;
|
||||
VS::get_singleton()->instance_set_transform(mesh_instance, xform);
|
||||
RS::get_singleton()->instance_set_transform(mesh_instance, xform);
|
||||
|
||||
VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_ONCE); //once used for capture
|
||||
RS::get_singleton()->viewport_set_update_mode(viewport, RS::VIEWPORT_UPDATE_ONCE); //once used for capture
|
||||
|
||||
preview_done = false;
|
||||
VS::get_singleton()->request_frame_drawn_callback(const_cast<EditorMeshPreviewPlugin *>(this), "_preview_done", Variant());
|
||||
RS::get_singleton()->request_frame_drawn_callback(const_cast<EditorMeshPreviewPlugin *>(this), "_preview_done", Variant());
|
||||
|
||||
while (!preview_done) {
|
||||
OS::get_singleton()->delay_usec(10);
|
||||
}
|
||||
|
||||
Ref<Image> img = VS::get_singleton()->texture_2d_get(viewport_texture);
|
||||
Ref<Image> img = RS::get_singleton()->texture_2d_get(viewport_texture);
|
||||
ERR_FAIL_COND_V(img.is_null(), Ref<ImageTexture>());
|
||||
|
||||
VS::get_singleton()->instance_set_base(mesh_instance, RID());
|
||||
RS::get_singleton()->instance_set_base(mesh_instance, RID());
|
||||
|
||||
img->convert(Image::FORMAT_RGBA8);
|
||||
|
||||
|
@ -759,49 +759,49 @@ Ref<Texture2D> EditorMeshPreviewPlugin::generate(const RES &p_from, const Size2
|
|||
|
||||
EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() {
|
||||
|
||||
scenario = VS::get_singleton()->scenario_create();
|
||||
scenario = RS::get_singleton()->scenario_create();
|
||||
|
||||
viewport = VS::get_singleton()->viewport_create();
|
||||
VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_DISABLED);
|
||||
VS::get_singleton()->viewport_set_scenario(viewport, scenario);
|
||||
VS::get_singleton()->viewport_set_size(viewport, 128, 128);
|
||||
VS::get_singleton()->viewport_set_transparent_background(viewport, true);
|
||||
VS::get_singleton()->viewport_set_active(viewport, true);
|
||||
viewport_texture = VS::get_singleton()->viewport_get_texture(viewport);
|
||||
viewport = RS::get_singleton()->viewport_create();
|
||||
RS::get_singleton()->viewport_set_update_mode(viewport, RS::VIEWPORT_UPDATE_DISABLED);
|
||||
RS::get_singleton()->viewport_set_scenario(viewport, scenario);
|
||||
RS::get_singleton()->viewport_set_size(viewport, 128, 128);
|
||||
RS::get_singleton()->viewport_set_transparent_background(viewport, true);
|
||||
RS::get_singleton()->viewport_set_active(viewport, true);
|
||||
viewport_texture = RS::get_singleton()->viewport_get_texture(viewport);
|
||||
|
||||
camera = VS::get_singleton()->camera_create();
|
||||
VS::get_singleton()->viewport_attach_camera(viewport, camera);
|
||||
VS::get_singleton()->camera_set_transform(camera, Transform(Basis(), Vector3(0, 0, 3)));
|
||||
//VS::get_singleton()->camera_set_perspective(camera,45,0.1,10);
|
||||
VS::get_singleton()->camera_set_orthogonal(camera, 1.0, 0.01, 1000.0);
|
||||
camera = RS::get_singleton()->camera_create();
|
||||
RS::get_singleton()->viewport_attach_camera(viewport, camera);
|
||||
RS::get_singleton()->camera_set_transform(camera, Transform(Basis(), Vector3(0, 0, 3)));
|
||||
//RS::get_singleton()->camera_set_perspective(camera,45,0.1,10);
|
||||
RS::get_singleton()->camera_set_orthogonal(camera, 1.0, 0.01, 1000.0);
|
||||
|
||||
light = VS::get_singleton()->directional_light_create();
|
||||
light_instance = VS::get_singleton()->instance_create2(light, scenario);
|
||||
VS::get_singleton()->instance_set_transform(light_instance, Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
light = RS::get_singleton()->directional_light_create();
|
||||
light_instance = RS::get_singleton()->instance_create2(light, scenario);
|
||||
RS::get_singleton()->instance_set_transform(light_instance, Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
|
||||
light2 = VS::get_singleton()->directional_light_create();
|
||||
VS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
||||
//VS::get_singleton()->light_set_color(light2, VS::LIGHT_COLOR_SPECULAR, Color(0.0, 0.0, 0.0));
|
||||
light_instance2 = VS::get_singleton()->instance_create2(light2, scenario);
|
||||
light2 = RS::get_singleton()->directional_light_create();
|
||||
RS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
||||
//RS::get_singleton()->light_set_color(light2, RS::LIGHT_COLOR_SPECULAR, Color(0.0, 0.0, 0.0));
|
||||
light_instance2 = RS::get_singleton()->instance_create2(light2, scenario);
|
||||
|
||||
VS::get_singleton()->instance_set_transform(light_instance2, Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance2, Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
|
||||
//sphere = VS::get_singleton()->mesh_create();
|
||||
mesh_instance = VS::get_singleton()->instance_create();
|
||||
VS::get_singleton()->instance_set_scenario(mesh_instance, scenario);
|
||||
//sphere = RS::get_singleton()->mesh_create();
|
||||
mesh_instance = RS::get_singleton()->instance_create();
|
||||
RS::get_singleton()->instance_set_scenario(mesh_instance, scenario);
|
||||
}
|
||||
|
||||
EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() {
|
||||
|
||||
//VS::get_singleton()->free(sphere);
|
||||
VS::get_singleton()->free(mesh_instance);
|
||||
VS::get_singleton()->free(viewport);
|
||||
VS::get_singleton()->free(light);
|
||||
VS::get_singleton()->free(light_instance);
|
||||
VS::get_singleton()->free(light2);
|
||||
VS::get_singleton()->free(light_instance2);
|
||||
VS::get_singleton()->free(camera);
|
||||
VS::get_singleton()->free(scenario);
|
||||
//RS::get_singleton()->free(sphere);
|
||||
RS::get_singleton()->free(mesh_instance);
|
||||
RS::get_singleton()->free(viewport);
|
||||
RS::get_singleton()->free(light);
|
||||
RS::get_singleton()->free(light_instance);
|
||||
RS::get_singleton()->free(light2);
|
||||
RS::get_singleton()->free(light_instance2);
|
||||
RS::get_singleton()->free(camera);
|
||||
RS::get_singleton()->free(scenario);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -849,16 +849,16 @@ Ref<Texture2D> EditorFontPreviewPlugin::generate_from_path(const String &p_path,
|
|||
font->draw(canvas_item, pos, sampled_text);
|
||||
|
||||
preview_done = false;
|
||||
VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_ONCE); //once used for capture
|
||||
VS::get_singleton()->request_frame_drawn_callback(const_cast<EditorFontPreviewPlugin *>(this), "_preview_done", Variant());
|
||||
RS::get_singleton()->viewport_set_update_mode(viewport, RS::VIEWPORT_UPDATE_ONCE); //once used for capture
|
||||
RS::get_singleton()->request_frame_drawn_callback(const_cast<EditorFontPreviewPlugin *>(this), "_preview_done", Variant());
|
||||
|
||||
while (!preview_done) {
|
||||
OS::get_singleton()->delay_usec(10);
|
||||
}
|
||||
|
||||
VS::get_singleton()->canvas_item_clear(canvas_item);
|
||||
RS::get_singleton()->canvas_item_clear(canvas_item);
|
||||
|
||||
Ref<Image> img = VS::get_singleton()->texture_2d_get(viewport_texture);
|
||||
Ref<Image> img = RS::get_singleton()->texture_2d_get(viewport_texture);
|
||||
ERR_FAIL_COND_V(img.is_null(), Ref<ImageTexture>());
|
||||
|
||||
img->convert(Image::FORMAT_RGBA8);
|
||||
|
@ -891,22 +891,22 @@ Ref<Texture2D> EditorFontPreviewPlugin::generate(const RES &p_from, const Size2
|
|||
|
||||
EditorFontPreviewPlugin::EditorFontPreviewPlugin() {
|
||||
|
||||
viewport = VS::get_singleton()->viewport_create();
|
||||
VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_DISABLED);
|
||||
VS::get_singleton()->viewport_set_size(viewport, 128, 128);
|
||||
VS::get_singleton()->viewport_set_active(viewport, true);
|
||||
viewport_texture = VS::get_singleton()->viewport_get_texture(viewport);
|
||||
viewport = RS::get_singleton()->viewport_create();
|
||||
RS::get_singleton()->viewport_set_update_mode(viewport, RS::VIEWPORT_UPDATE_DISABLED);
|
||||
RS::get_singleton()->viewport_set_size(viewport, 128, 128);
|
||||
RS::get_singleton()->viewport_set_active(viewport, true);
|
||||
viewport_texture = RS::get_singleton()->viewport_get_texture(viewport);
|
||||
|
||||
canvas = VS::get_singleton()->canvas_create();
|
||||
canvas_item = VS::get_singleton()->canvas_item_create();
|
||||
canvas = RS::get_singleton()->canvas_create();
|
||||
canvas_item = RS::get_singleton()->canvas_item_create();
|
||||
|
||||
VS::get_singleton()->viewport_attach_canvas(viewport, canvas);
|
||||
VS::get_singleton()->canvas_item_set_parent(canvas_item, canvas);
|
||||
RS::get_singleton()->viewport_attach_canvas(viewport, canvas);
|
||||
RS::get_singleton()->canvas_item_set_parent(canvas_item, canvas);
|
||||
}
|
||||
|
||||
EditorFontPreviewPlugin::~EditorFontPreviewPlugin() {
|
||||
|
||||
VS::get_singleton()->free(canvas_item);
|
||||
VS::get_singleton()->free(canvas);
|
||||
VS::get_singleton()->free(viewport);
|
||||
RS::get_singleton()->free(canvas_item);
|
||||
RS::get_singleton()->free(canvas);
|
||||
RS::get_singleton()->free(viewport);
|
||||
}
|
||||
|
|
|
@ -256,14 +256,14 @@ Ref<Resource> StandardMaterial3DConversionPlugin::convert(const Ref<Resource> &p
|
|||
Ref<Shader> shader;
|
||||
shader.instance();
|
||||
|
||||
String code = VS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
|
||||
shader->set_code(code);
|
||||
|
||||
smat->set_shader(shader);
|
||||
|
||||
List<PropertyInfo> params;
|
||||
VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
|
||||
|
||||
|
@ -273,7 +273,7 @@ Ref<Resource> StandardMaterial3DConversionPlugin::convert(const Ref<Resource> &p
|
|||
if (texture.is_valid()) {
|
||||
smat->set_shader_param(E->get().name, texture);
|
||||
} else {
|
||||
Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
smat->set_shader_param(E->get().name, value);
|
||||
}
|
||||
}
|
||||
|
@ -302,17 +302,17 @@ Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_
|
|||
Ref<Shader> shader;
|
||||
shader.instance();
|
||||
|
||||
String code = VS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
|
||||
shader->set_code(code);
|
||||
|
||||
smat->set_shader(shader);
|
||||
|
||||
List<PropertyInfo> params;
|
||||
VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
|
||||
Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
smat->set_shader_param(E->get().name, value);
|
||||
}
|
||||
|
||||
|
@ -340,17 +340,17 @@ Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p
|
|||
Ref<Shader> shader;
|
||||
shader.instance();
|
||||
|
||||
String code = VS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
|
||||
shader->set_code(code);
|
||||
|
||||
smat->set_shader(shader);
|
||||
|
||||
List<PropertyInfo> params;
|
||||
VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
|
||||
Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
smat->set_shader_param(E->get().name, value);
|
||||
}
|
||||
|
||||
|
@ -378,17 +378,17 @@ Ref<Resource> ProceduralSkyMaterialConversionPlugin::convert(const Ref<Resource>
|
|||
Ref<Shader> shader;
|
||||
shader.instance();
|
||||
|
||||
String code = VS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
|
||||
shader->set_code(code);
|
||||
|
||||
smat->set_shader(shader);
|
||||
|
||||
List<PropertyInfo> params;
|
||||
VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
|
||||
Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
smat->set_shader_param(E->get().name, value);
|
||||
}
|
||||
|
||||
|
@ -416,17 +416,17 @@ Ref<Resource> PanoramaSkyMaterialConversionPlugin::convert(const Ref<Resource> &
|
|||
Ref<Shader> shader;
|
||||
shader.instance();
|
||||
|
||||
String code = VS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
|
||||
shader->set_code(code);
|
||||
|
||||
smat->set_shader(shader);
|
||||
|
||||
List<PropertyInfo> params;
|
||||
VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
|
||||
Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
smat->set_shader_param(E->get().name, value);
|
||||
}
|
||||
|
||||
|
@ -454,17 +454,17 @@ Ref<Resource> PhysicalSkyMaterialConversionPlugin::convert(const Ref<Resource> &
|
|||
Ref<Shader> shader;
|
||||
shader.instance();
|
||||
|
||||
String code = VS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
String code = RS::get_singleton()->shader_get_code(mat->get_shader_rid());
|
||||
|
||||
shader->set_code(code);
|
||||
|
||||
smat->set_shader(shader);
|
||||
|
||||
List<PropertyInfo> params;
|
||||
VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
RS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
|
||||
Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
Variant value = RS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
|
||||
smat->set_shader_param(E->get().name, value);
|
||||
}
|
||||
|
||||
|
|
|
@ -496,7 +496,7 @@ ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, b
|
|||
Vector3 pos = _get_ray_pos(p_pos);
|
||||
Vector2 shrinked_pos = p_pos / viewport_container->get_stretch_shrink();
|
||||
|
||||
Vector<ObjectID> instances = VisualServer::get_singleton()->instances_cull_ray(pos, ray, get_tree()->get_root()->get_world()->get_scenario());
|
||||
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(pos, ray, get_tree()->get_root()->get_world()->get_scenario());
|
||||
Set<Ref<EditorNode3DGizmo>> found_gizmos;
|
||||
|
||||
Node *edited_scene = get_tree()->get_edited_scene_root();
|
||||
|
@ -563,7 +563,7 @@ void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, bool &r_inclu
|
|||
Vector3 ray = _get_ray(p_pos);
|
||||
Vector3 pos = _get_ray_pos(p_pos);
|
||||
|
||||
Vector<ObjectID> instances = VisualServer::get_singleton()->instances_cull_ray(pos, ray, get_tree()->get_root()->get_world()->get_scenario());
|
||||
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(pos, ray, get_tree()->get_root()->get_world()->get_scenario());
|
||||
Set<Ref<EditorNode3DGizmo>> found_gizmos;
|
||||
|
||||
r_includes_current = false;
|
||||
|
@ -686,7 +686,7 @@ void Node3DEditorViewport::_select_region() {
|
|||
frustum.push_back(far);
|
||||
}
|
||||
|
||||
Vector<ObjectID> instances = VisualServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world()->get_scenario());
|
||||
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world()->get_scenario());
|
||||
Vector<Node *> selected;
|
||||
|
||||
Node *edited_scene = get_tree()->get_edited_scene_root();
|
||||
|
@ -2395,7 +2395,7 @@ void Node3DEditorViewport::_notification(int p_what) {
|
|||
}
|
||||
previewing = cam;
|
||||
previewing->connect("tree_exited", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene));
|
||||
VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), cam->get_camera());
|
||||
RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), cam->get_camera());
|
||||
surface->update();
|
||||
}
|
||||
}
|
||||
|
@ -2437,7 +2437,7 @@ void Node3DEditorViewport::_notification(int p_what) {
|
|||
aabb_s.scale(se->aabb.size);
|
||||
t.basis = t.basis * aabb_s;
|
||||
|
||||
VisualServer::get_singleton()->instance_set_transform(se->sbox_instance, t);
|
||||
RenderingServer::get_singleton()->instance_set_transform(se->sbox_instance, t);
|
||||
}
|
||||
|
||||
if (changed || (spatial_editor->is_gizmo_visible() && !exist)) {
|
||||
|
@ -2643,7 +2643,7 @@ void Node3DEditorViewport::_draw() {
|
|||
if (_edit.mode == TRANSFORM_ROTATE) {
|
||||
|
||||
Point2 center = _point_to_screen(_edit.center);
|
||||
VisualServer::get_singleton()->canvas_item_add_line(
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(
|
||||
ci,
|
||||
_edit.mouse_pos,
|
||||
center,
|
||||
|
@ -3082,51 +3082,51 @@ void Node3DEditorViewport::_init_gizmo_instance(int p_idx) {
|
|||
uint32_t layer = 1 << (GIZMO_BASE_LAYER + p_idx);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
move_gizmo_instance[i] = VS::get_singleton()->instance_create();
|
||||
VS::get_singleton()->instance_set_base(move_gizmo_instance[i], spatial_editor->get_move_gizmo(i)->get_rid());
|
||||
VS::get_singleton()->instance_set_scenario(move_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_visible(move_gizmo_instance[i], false);
|
||||
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(move_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
|
||||
VS::get_singleton()->instance_set_layer_mask(move_gizmo_instance[i], layer);
|
||||
move_gizmo_instance[i] = RS::get_singleton()->instance_create();
|
||||
RS::get_singleton()->instance_set_base(move_gizmo_instance[i], spatial_editor->get_move_gizmo(i)->get_rid());
|
||||
RS::get_singleton()->instance_set_scenario(move_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_visible(move_gizmo_instance[i], false);
|
||||
RS::get_singleton()->instance_geometry_set_cast_shadows_setting(move_gizmo_instance[i], RS::SHADOW_CASTING_SETTING_OFF);
|
||||
RS::get_singleton()->instance_set_layer_mask(move_gizmo_instance[i], layer);
|
||||
|
||||
move_plane_gizmo_instance[i] = VS::get_singleton()->instance_create();
|
||||
VS::get_singleton()->instance_set_base(move_plane_gizmo_instance[i], spatial_editor->get_move_plane_gizmo(i)->get_rid());
|
||||
VS::get_singleton()->instance_set_scenario(move_plane_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], false);
|
||||
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(move_plane_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
|
||||
VS::get_singleton()->instance_set_layer_mask(move_plane_gizmo_instance[i], layer);
|
||||
move_plane_gizmo_instance[i] = RS::get_singleton()->instance_create();
|
||||
RS::get_singleton()->instance_set_base(move_plane_gizmo_instance[i], spatial_editor->get_move_plane_gizmo(i)->get_rid());
|
||||
RS::get_singleton()->instance_set_scenario(move_plane_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], false);
|
||||
RS::get_singleton()->instance_geometry_set_cast_shadows_setting(move_plane_gizmo_instance[i], RS::SHADOW_CASTING_SETTING_OFF);
|
||||
RS::get_singleton()->instance_set_layer_mask(move_plane_gizmo_instance[i], layer);
|
||||
|
||||
rotate_gizmo_instance[i] = VS::get_singleton()->instance_create();
|
||||
VS::get_singleton()->instance_set_base(rotate_gizmo_instance[i], spatial_editor->get_rotate_gizmo(i)->get_rid());
|
||||
VS::get_singleton()->instance_set_scenario(rotate_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], false);
|
||||
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(rotate_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
|
||||
VS::get_singleton()->instance_set_layer_mask(rotate_gizmo_instance[i], layer);
|
||||
rotate_gizmo_instance[i] = RS::get_singleton()->instance_create();
|
||||
RS::get_singleton()->instance_set_base(rotate_gizmo_instance[i], spatial_editor->get_rotate_gizmo(i)->get_rid());
|
||||
RS::get_singleton()->instance_set_scenario(rotate_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], false);
|
||||
RS::get_singleton()->instance_geometry_set_cast_shadows_setting(rotate_gizmo_instance[i], RS::SHADOW_CASTING_SETTING_OFF);
|
||||
RS::get_singleton()->instance_set_layer_mask(rotate_gizmo_instance[i], layer);
|
||||
|
||||
scale_gizmo_instance[i] = VS::get_singleton()->instance_create();
|
||||
VS::get_singleton()->instance_set_base(scale_gizmo_instance[i], spatial_editor->get_scale_gizmo(i)->get_rid());
|
||||
VS::get_singleton()->instance_set_scenario(scale_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_visible(scale_gizmo_instance[i], false);
|
||||
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(scale_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
|
||||
VS::get_singleton()->instance_set_layer_mask(scale_gizmo_instance[i], layer);
|
||||
scale_gizmo_instance[i] = RS::get_singleton()->instance_create();
|
||||
RS::get_singleton()->instance_set_base(scale_gizmo_instance[i], spatial_editor->get_scale_gizmo(i)->get_rid());
|
||||
RS::get_singleton()->instance_set_scenario(scale_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_visible(scale_gizmo_instance[i], false);
|
||||
RS::get_singleton()->instance_geometry_set_cast_shadows_setting(scale_gizmo_instance[i], RS::SHADOW_CASTING_SETTING_OFF);
|
||||
RS::get_singleton()->instance_set_layer_mask(scale_gizmo_instance[i], layer);
|
||||
|
||||
scale_plane_gizmo_instance[i] = VS::get_singleton()->instance_create();
|
||||
VS::get_singleton()->instance_set_base(scale_plane_gizmo_instance[i], spatial_editor->get_scale_plane_gizmo(i)->get_rid());
|
||||
VS::get_singleton()->instance_set_scenario(scale_plane_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_visible(scale_plane_gizmo_instance[i], false);
|
||||
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(scale_plane_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
|
||||
VS::get_singleton()->instance_set_layer_mask(scale_plane_gizmo_instance[i], layer);
|
||||
scale_plane_gizmo_instance[i] = RS::get_singleton()->instance_create();
|
||||
RS::get_singleton()->instance_set_base(scale_plane_gizmo_instance[i], spatial_editor->get_scale_plane_gizmo(i)->get_rid());
|
||||
RS::get_singleton()->instance_set_scenario(scale_plane_gizmo_instance[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_visible(scale_plane_gizmo_instance[i], false);
|
||||
RS::get_singleton()->instance_geometry_set_cast_shadows_setting(scale_plane_gizmo_instance[i], RS::SHADOW_CASTING_SETTING_OFF);
|
||||
RS::get_singleton()->instance_set_layer_mask(scale_plane_gizmo_instance[i], layer);
|
||||
}
|
||||
}
|
||||
|
||||
void Node3DEditorViewport::_finish_gizmo_instances() {
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
VS::get_singleton()->free(move_gizmo_instance[i]);
|
||||
VS::get_singleton()->free(move_plane_gizmo_instance[i]);
|
||||
VS::get_singleton()->free(rotate_gizmo_instance[i]);
|
||||
VS::get_singleton()->free(scale_gizmo_instance[i]);
|
||||
VS::get_singleton()->free(scale_plane_gizmo_instance[i]);
|
||||
RS::get_singleton()->free(move_gizmo_instance[i]);
|
||||
RS::get_singleton()->free(move_plane_gizmo_instance[i]);
|
||||
RS::get_singleton()->free(rotate_gizmo_instance[i]);
|
||||
RS::get_singleton()->free(scale_gizmo_instance[i]);
|
||||
RS::get_singleton()->free(scale_plane_gizmo_instance[i]);
|
||||
}
|
||||
}
|
||||
void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) {
|
||||
|
@ -3138,7 +3138,7 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) {
|
|||
|
||||
previewing->disconnect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene));
|
||||
previewing = NULL;
|
||||
VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore
|
||||
RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore
|
||||
if (!preview)
|
||||
preview_camera->hide();
|
||||
view_menu->set_disabled(false);
|
||||
|
@ -3148,7 +3148,7 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) {
|
|||
|
||||
previewing = preview;
|
||||
previewing->connect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene));
|
||||
VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), preview->get_camera()); //replace
|
||||
RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), preview->get_camera()); //replace
|
||||
view_menu->set_disabled(true);
|
||||
surface->update();
|
||||
}
|
||||
|
@ -3161,7 +3161,7 @@ void Node3DEditorViewport::_toggle_cinema_preview(bool p_activate) {
|
|||
previewing->disconnect("tree_exited", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene));
|
||||
|
||||
previewing = NULL;
|
||||
VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore
|
||||
RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore
|
||||
preview_camera->set_pressed(false);
|
||||
if (!preview) {
|
||||
preview_camera->hide();
|
||||
|
@ -3212,11 +3212,11 @@ void Node3DEditorViewport::update_transform_gizmo_view() {
|
|||
|
||||
if (xform.origin.distance_squared_to(camera_xform.origin) < 0.01) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
VisualServer::get_singleton()->instance_set_visible(move_gizmo_instance[i], false);
|
||||
VisualServer::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], false);
|
||||
VisualServer::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], false);
|
||||
VisualServer::get_singleton()->instance_set_visible(scale_gizmo_instance[i], false);
|
||||
VisualServer::get_singleton()->instance_set_visible(scale_plane_gizmo_instance[i], false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(move_gizmo_instance[i], false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(scale_gizmo_instance[i], false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(scale_plane_gizmo_instance[i], false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -3244,16 +3244,16 @@ void Node3DEditorViewport::update_transform_gizmo_view() {
|
|||
xform.basis.scale(scale);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
VisualServer::get_singleton()->instance_set_transform(move_gizmo_instance[i], xform);
|
||||
VisualServer::get_singleton()->instance_set_visible(move_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE));
|
||||
VisualServer::get_singleton()->instance_set_transform(move_plane_gizmo_instance[i], xform);
|
||||
VisualServer::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE));
|
||||
VisualServer::get_singleton()->instance_set_transform(rotate_gizmo_instance[i], xform);
|
||||
VisualServer::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE));
|
||||
VisualServer::get_singleton()->instance_set_transform(scale_gizmo_instance[i], xform);
|
||||
VisualServer::get_singleton()->instance_set_visible(scale_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SCALE));
|
||||
VisualServer::get_singleton()->instance_set_transform(scale_plane_gizmo_instance[i], xform);
|
||||
VisualServer::get_singleton()->instance_set_visible(scale_plane_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SCALE));
|
||||
RenderingServer::get_singleton()->instance_set_transform(move_gizmo_instance[i], xform);
|
||||
RenderingServer::get_singleton()->instance_set_visible(move_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE));
|
||||
RenderingServer::get_singleton()->instance_set_transform(move_plane_gizmo_instance[i], xform);
|
||||
RenderingServer::get_singleton()->instance_set_visible(move_plane_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE));
|
||||
RenderingServer::get_singleton()->instance_set_transform(rotate_gizmo_instance[i], xform);
|
||||
RenderingServer::get_singleton()->instance_set_visible(rotate_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE));
|
||||
RenderingServer::get_singleton()->instance_set_transform(scale_gizmo_instance[i], xform);
|
||||
RenderingServer::get_singleton()->instance_set_visible(scale_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SCALE));
|
||||
RenderingServer::get_singleton()->instance_set_transform(scale_plane_gizmo_instance[i], xform);
|
||||
RenderingServer::get_singleton()->instance_set_visible(scale_plane_gizmo_instance[i], spatial_editor->is_gizmo_visible() && (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SCALE));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3363,7 +3363,7 @@ void Node3DEditorViewport::set_state(const Dictionary &p_state) {
|
|||
if (Object::cast_to<Camera3D>(pv)) {
|
||||
previewing = Object::cast_to<Camera3D>(pv);
|
||||
previewing->connect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene));
|
||||
VS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), previewing->get_camera()); //replace
|
||||
RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), previewing->get_camera()); //replace
|
||||
view_menu->set_disabled(true);
|
||||
surface->update();
|
||||
preview_camera->set_pressed(true);
|
||||
|
@ -3478,7 +3478,7 @@ Vector3 Node3DEditorViewport::_get_instance_position(const Point2 &p_pos) const
|
|||
Vector3 world_ray = _get_ray(p_pos);
|
||||
Vector3 world_pos = _get_ray_pos(p_pos);
|
||||
|
||||
Vector<ObjectID> instances = VisualServer::get_singleton()->instances_cull_ray(world_pos, world_ray, get_tree()->get_root()->get_world()->get_scenario());
|
||||
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(world_pos, world_ray, get_tree()->get_root()->get_world()->get_scenario());
|
||||
Set<Ref<EditorNode3DGizmo>> found_gizmos;
|
||||
|
||||
float closest_dist = MAX_DISTANCE;
|
||||
|
@ -4398,7 +4398,7 @@ Node3DEditor *Node3DEditor::singleton = NULL;
|
|||
Node3DEditorSelectedItem::~Node3DEditorSelectedItem() {
|
||||
|
||||
if (sbox_instance.is_valid())
|
||||
VisualServer::get_singleton()->free(sbox_instance);
|
||||
RenderingServer::get_singleton()->free(sbox_instance);
|
||||
}
|
||||
|
||||
void Node3DEditor::select_gizmo_highlight_axis(int p_axis) {
|
||||
|
@ -4484,8 +4484,8 @@ Object *Node3DEditor::_get_editor_data(Object *p_what) {
|
|||
Node3DEditorSelectedItem *si = memnew(Node3DEditorSelectedItem);
|
||||
|
||||
si->sp = sp;
|
||||
si->sbox_instance = VisualServer::get_singleton()->instance_create2(selection_box->get_rid(), sp->get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(si->sbox_instance, VS::SHADOW_CASTING_SETTING_OFF);
|
||||
si->sbox_instance = RenderingServer::get_singleton()->instance_create2(selection_box->get_rid(), sp->get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_geometry_set_cast_shadows_setting(si->sbox_instance, RS::SHADOW_CASTING_SETTING_OFF);
|
||||
|
||||
return si;
|
||||
}
|
||||
|
@ -4649,7 +4649,7 @@ void Node3DEditor::set_state(const Dictionary &p_state) {
|
|||
|
||||
if (use != view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(MENU_VIEW_ORIGIN))) {
|
||||
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(MENU_VIEW_ORIGIN), use);
|
||||
VisualServer::get_singleton()->instance_set_visible(origin_instance, use);
|
||||
RenderingServer::get_singleton()->instance_set_visible(origin_instance, use);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4954,7 +4954,7 @@ void Node3DEditor::_menu_item_pressed(int p_option) {
|
|||
bool is_checked = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(p_option));
|
||||
|
||||
origin_enabled = !is_checked;
|
||||
VisualServer::get_singleton()->instance_set_visible(origin_instance, origin_enabled);
|
||||
RenderingServer::get_singleton()->instance_set_visible(origin_instance, origin_enabled);
|
||||
// Update the grid since its appearance depends on whether the origin is enabled
|
||||
_finish_grid();
|
||||
_init_grid();
|
||||
|
@ -4969,7 +4969,7 @@ void Node3DEditor::_menu_item_pressed(int p_option) {
|
|||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (grid_enable[i]) {
|
||||
VisualServer::get_singleton()->instance_set_visible(grid_instance[i], grid_enabled);
|
||||
RenderingServer::get_singleton()->instance_set_visible(grid_instance[i], grid_enabled);
|
||||
grid_visible[i] = grid_enabled;
|
||||
}
|
||||
}
|
||||
|
@ -5129,19 +5129,19 @@ void Node3DEditor::_init_indicators() {
|
|||
|
||||
_init_grid();
|
||||
|
||||
origin = VisualServer::get_singleton()->mesh_create();
|
||||
origin = RenderingServer::get_singleton()->mesh_create();
|
||||
Array d;
|
||||
d.resize(VS::ARRAY_MAX);
|
||||
d[VisualServer::ARRAY_VERTEX] = origin_points;
|
||||
d[VisualServer::ARRAY_COLOR] = origin_colors;
|
||||
d.resize(RS::ARRAY_MAX);
|
||||
d[RenderingServer::ARRAY_VERTEX] = origin_points;
|
||||
d[RenderingServer::ARRAY_COLOR] = origin_colors;
|
||||
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(origin, VisualServer::PRIMITIVE_LINES, d);
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(origin, 0, indicator_mat->get_rid());
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(origin, RenderingServer::PRIMITIVE_LINES, d);
|
||||
RenderingServer::get_singleton()->mesh_surface_set_material(origin, 0, indicator_mat->get_rid());
|
||||
|
||||
origin_instance = VisualServer::get_singleton()->instance_create2(origin, get_tree()->get_root()->get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_layer_mask(origin_instance, 1 << Node3DEditorViewport::GIZMO_GRID_LAYER);
|
||||
origin_instance = RenderingServer::get_singleton()->instance_create2(origin, get_tree()->get_root()->get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_layer_mask(origin_instance, 1 << Node3DEditorViewport::GIZMO_GRID_LAYER);
|
||||
|
||||
VisualServer::get_singleton()->instance_geometry_set_cast_shadows_setting(origin_instance, VS::SHADOW_CASTING_SETTING_OFF);
|
||||
RenderingServer::get_singleton()->instance_geometry_set_cast_shadows_setting(origin_instance, RS::SHADOW_CASTING_SETTING_OFF);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -5506,33 +5506,33 @@ void Node3DEditor::_init_grid() {
|
|||
grid_colors[i].push_back(line_color);
|
||||
}
|
||||
|
||||
grid[i] = VisualServer::get_singleton()->mesh_create();
|
||||
grid[i] = RenderingServer::get_singleton()->mesh_create();
|
||||
Array d;
|
||||
d.resize(VS::ARRAY_MAX);
|
||||
d[VisualServer::ARRAY_VERTEX] = grid_points[i];
|
||||
d[VisualServer::ARRAY_COLOR] = grid_colors[i];
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(grid[i], VisualServer::PRIMITIVE_LINES, d);
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(grid[i], 0, indicator_mat->get_rid());
|
||||
grid_instance[i] = VisualServer::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
d.resize(RS::ARRAY_MAX);
|
||||
d[RenderingServer::ARRAY_VERTEX] = grid_points[i];
|
||||
d[RenderingServer::ARRAY_COLOR] = grid_colors[i];
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(grid[i], RenderingServer::PRIMITIVE_LINES, d);
|
||||
RenderingServer::get_singleton()->mesh_surface_set_material(grid[i], 0, indicator_mat->get_rid());
|
||||
grid_instance[i] = RenderingServer::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
|
||||
VisualServer::get_singleton()->instance_set_visible(grid_instance[i], grid_visible[i]);
|
||||
VisualServer::get_singleton()->instance_geometry_set_cast_shadows_setting(grid_instance[i], VS::SHADOW_CASTING_SETTING_OFF);
|
||||
VS::get_singleton()->instance_set_layer_mask(grid_instance[i], 1 << Node3DEditorViewport::GIZMO_GRID_LAYER);
|
||||
RenderingServer::get_singleton()->instance_set_visible(grid_instance[i], grid_visible[i]);
|
||||
RenderingServer::get_singleton()->instance_geometry_set_cast_shadows_setting(grid_instance[i], RS::SHADOW_CASTING_SETTING_OFF);
|
||||
RS::get_singleton()->instance_set_layer_mask(grid_instance[i], 1 << Node3DEditorViewport::GIZMO_GRID_LAYER);
|
||||
}
|
||||
}
|
||||
|
||||
void Node3DEditor::_finish_indicators() {
|
||||
|
||||
VisualServer::get_singleton()->free(origin_instance);
|
||||
VisualServer::get_singleton()->free(origin);
|
||||
RenderingServer::get_singleton()->free(origin_instance);
|
||||
RenderingServer::get_singleton()->free(origin);
|
||||
|
||||
_finish_grid();
|
||||
}
|
||||
|
||||
void Node3DEditor::_finish_grid() {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
VisualServer::get_singleton()->free(grid_instance[i]);
|
||||
VisualServer::get_singleton()->free(grid[i]);
|
||||
RenderingServer::get_singleton()->free(grid_instance[i]);
|
||||
RenderingServer::get_singleton()->free(grid[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5658,8 +5658,8 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
|
|||
}
|
||||
}
|
||||
|
||||
PhysicsDirectSpaceState *ss = get_tree()->get_root()->get_world()->get_direct_space_state();
|
||||
PhysicsDirectSpaceState::RayResult result;
|
||||
PhysicsDirectSpaceState3D *ss = get_tree()->get_root()->get_world()->get_direct_space_state();
|
||||
PhysicsDirectSpaceState3D::RayResult result;
|
||||
|
||||
Array keys = snap_data.keys();
|
||||
|
||||
|
@ -5952,11 +5952,11 @@ void Node3DEditor::clear() {
|
|||
viewports[i]->reset();
|
||||
}
|
||||
|
||||
VisualServer::get_singleton()->instance_set_visible(origin_instance, true);
|
||||
RenderingServer::get_singleton()->instance_set_visible(origin_instance, true);
|
||||
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(MENU_VIEW_ORIGIN), true);
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (grid_enable[i]) {
|
||||
VisualServer::get_singleton()->instance_set_visible(grid_instance[i], true);
|
||||
RenderingServer::get_singleton()->instance_set_visible(grid_instance[i], true);
|
||||
grid_visible[i] = true;
|
||||
}
|
||||
}
|
||||
|
@ -6313,7 +6313,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
|
|||
|
||||
xform_dialog->connect("confirmed", callable_mp(this, &Node3DEditor::_xform_dialog_action));
|
||||
|
||||
scenario_debug = VisualServer::SCENARIO_DEBUG_DISABLED;
|
||||
scenario_debug = RenderingServer::SCENARIO_DEBUG_DISABLED;
|
||||
|
||||
selected = NULL;
|
||||
|
||||
|
|
|
@ -578,7 +578,7 @@ private:
|
|||
ToolMode tool_mode;
|
||||
bool orthogonal;
|
||||
|
||||
VisualServer::ScenarioDebugMode scenario_debug;
|
||||
RenderingServer::ScenarioDebugMode scenario_debug;
|
||||
|
||||
RID origin;
|
||||
RID origin_instance;
|
||||
|
|
|
@ -990,9 +990,9 @@ void Polygon2DEditor::_uv_draw() {
|
|||
mtx.elements[2] = -uv_draw_ofs;
|
||||
mtx.scale_basis(Vector2(uv_draw_zoom, uv_draw_zoom));
|
||||
|
||||
VS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(), mtx);
|
||||
RS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(), mtx);
|
||||
uv_edit_draw->draw_texture(base_tex, Point2());
|
||||
VS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(), Transform2D());
|
||||
RS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(), Transform2D());
|
||||
|
||||
if (snap_show_grid) {
|
||||
Color grid_color = Color(1.0, 1.0, 1.0, 0.15);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "editor/editor_settings.h"
|
||||
#include "editor/property_editor.h"
|
||||
#include "servers/display_server.h"
|
||||
#include "servers/visual/shader_types.h"
|
||||
#include "servers/rendering/shader_types.h"
|
||||
|
||||
/*** SHADER SCRIPT EDITOR ****/
|
||||
|
||||
|
@ -150,16 +150,16 @@ void ShaderTextEditor::_load_theme_settings() {
|
|||
|
||||
if (shader.is_valid()) {
|
||||
|
||||
for (const Map<StringName, ShaderLanguage::FunctionInfo>::Element *E = ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())).front(); E; E = E->next()) {
|
||||
for (const Map<StringName, ShaderLanguage::FunctionInfo>::Element *E = ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(shader->get_mode())).front(); E; E = E->next()) {
|
||||
|
||||
for (const Map<StringName, ShaderLanguage::BuiltInInfo>::Element *F = E->get().built_ins.front(); F; F = F->next()) {
|
||||
keywords.push_back(F->key());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())).size(); i++) {
|
||||
for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader->get_mode())).size(); i++) {
|
||||
|
||||
keywords.push_back(ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode()))[i]);
|
||||
keywords.push_back(ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader->get_mode()))[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ void ShaderTextEditor::_code_complete_script(const String &p_code, List<ScriptCo
|
|||
ShaderLanguage sl;
|
||||
String calltip;
|
||||
|
||||
sl.complete(p_code, ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_types(), r_options, calltip);
|
||||
sl.complete(p_code, ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_types(), r_options, calltip);
|
||||
|
||||
get_text_edit()->set_code_hint(calltip);
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ void ShaderTextEditor::_validate_script() {
|
|||
|
||||
ShaderLanguage sl;
|
||||
|
||||
Error err = sl.compile(code, ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_types());
|
||||
Error err = sl.compile(code, ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_types());
|
||||
|
||||
if (err != OK) {
|
||||
String error_text = "error(" + itos(sl.get_error_line()) + "): " + sl.get_error_text();
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "scene/gui/text_edit.h"
|
||||
#include "scene/main/timer.h"
|
||||
#include "scene/resources/shader.h"
|
||||
#include "servers/visual/shader_language.h"
|
||||
#include "servers/rendering/shader_language.h"
|
||||
|
||||
class ShaderTextEditor : public CodeTextEditor {
|
||||
|
||||
|
|
|
@ -68,9 +68,9 @@ void TextureRegionEditor::_region_draw() {
|
|||
mtx.elements[2] = -draw_ofs * draw_zoom;
|
||||
mtx.scale_basis(Vector2(draw_zoom, draw_zoom));
|
||||
|
||||
VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), mtx);
|
||||
RS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), mtx);
|
||||
edit_draw->draw_texture(base_tex, Point2());
|
||||
VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), Transform2D());
|
||||
RS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), Transform2D());
|
||||
|
||||
if (snap_mode == SNAP_GRID) {
|
||||
Color grid_color = Color(1.0, 1.0, 1.0, 0.15);
|
||||
|
|
|
@ -528,8 +528,8 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) {
|
|||
toolbar->add_child(spin_priority);
|
||||
|
||||
spin_z_index = memnew(SpinBox);
|
||||
spin_z_index->set_min(VS::CANVAS_ITEM_Z_MIN);
|
||||
spin_z_index->set_max(VS::CANVAS_ITEM_Z_MAX);
|
||||
spin_z_index->set_min(RS::CANVAS_ITEM_Z_MIN);
|
||||
spin_z_index->set_max(RS::CANVAS_ITEM_Z_MAX);
|
||||
spin_z_index->set_step(1);
|
||||
spin_z_index->set_custom_minimum_size(Size2(100, 0));
|
||||
spin_z_index->connect("value_changed", callable_mp(this, &TileSetEditor::_on_z_index_changed));
|
||||
|
@ -3485,7 +3485,7 @@ void TilesetEditorContext::_get_property_list(List<PropertyInfo> *p_list) const
|
|||
p_list->push_back(PropertyInfo(Variant::VECTOR2, "tile_navigation_offset"));
|
||||
p_list->push_back(PropertyInfo(Variant::VECTOR2, "tile_shape_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
|
||||
p_list->push_back(PropertyInfo(Variant::VECTOR2, "tile_shape_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "tile_z_index", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1"));
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "tile_z_index", PROPERTY_HINT_RANGE, itos(RS::CANVAS_ITEM_Z_MIN) + "," + itos(RS::CANVAS_ITEM_Z_MAX) + ",1"));
|
||||
}
|
||||
if (tileset_editor->edit_mode == TileSetEditor::EDITMODE_COLLISION && tileset_editor->edited_collision_shape.is_valid()) {
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "selected_collision", PROPERTY_HINT_RESOURCE_TYPE, tileset_editor->edited_collision_shape->get_class()));
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "scene/main/window.h"
|
||||
#include "scene/resources/visual_shader_nodes.h"
|
||||
#include "servers/display_server.h"
|
||||
#include "servers/visual/shader_types.h"
|
||||
#include "servers/rendering/shader_types.h"
|
||||
|
||||
Control *VisualShaderNodePlugin::create_editor(const Ref<Resource> &p_parent_resource, const Ref<VisualShaderNode> &p_node) {
|
||||
|
||||
|
@ -2263,7 +2263,7 @@ void VisualShaderEditor::_update_preview() {
|
|||
|
||||
ShaderLanguage sl;
|
||||
|
||||
Error err = sl.compile(code, ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(visual_shader->get_mode())), ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(visual_shader->get_mode())), ShaderTypes::get_singleton()->get_types());
|
||||
Error err = sl.compile(code, ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(visual_shader->get_mode())), ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(visual_shader->get_mode())), ShaderTypes::get_singleton()->get_types());
|
||||
|
||||
for (int i = 0; i < preview_text->get_line_count(); i++) {
|
||||
preview_text->set_line_as_marked(i, false);
|
||||
|
|
|
@ -1500,7 +1500,7 @@ void CustomPropertyEditor::_draw_easing() {
|
|||
iflp = 1.0 - iflp;
|
||||
}
|
||||
|
||||
VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(iflp * s.width, prev * s.height), Point2(ifl * s.width, h * s.height), color);
|
||||
RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2(iflp * s.width, prev * s.height), Point2(ifl * s.width, h * s.height), color);
|
||||
prev = h;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "scene/main/window.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
#include "servers/display_server.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
void SceneTreeDock::_nodes_drag_begin() {
|
||||
|
||||
|
|
|
@ -602,7 +602,7 @@ def build_rd_header(filename):
|
|||
|
||||
out_file_class = out_file_base.replace(".glsl.gen.h", "").title().replace("_", "").replace(".", "") + "ShaderRD"
|
||||
fd.write("\n")
|
||||
fd.write("#include \"servers/visual/rasterizer_rd/shader_rd.h\"\n\n")
|
||||
fd.write("#include \"servers/rendering/rasterizer_rd/shader_rd.h\"\n\n")
|
||||
fd.write("class " + out_file_class + " : public ShaderRD {\n\n")
|
||||
fd.write("public:\n\n")
|
||||
|
||||
|
|
|
@ -65,13 +65,13 @@
|
|||
#include "servers/audio_server.h"
|
||||
#include "servers/camera_server.h"
|
||||
#include "servers/display_server.h"
|
||||
#include "servers/navigation_2d_server.h"
|
||||
#include "servers/navigation_server.h"
|
||||
#include "servers/physics_2d_server.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/navigation_server_2d.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
#include "servers/physics_server_2d.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
#include "servers/register_server_types.h"
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/visual/visual_server_wrap_mt.h"
|
||||
#include "servers/rendering/rendering_server_raster.h"
|
||||
#include "servers/rendering/rendering_server_wrap_mt.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/doc_data.h"
|
||||
|
@ -103,13 +103,13 @@ static MessageQueue *message_queue = NULL;
|
|||
// Initialized in setup2()
|
||||
static AudioServer *audio_server = NULL;
|
||||
static DisplayServer *display_server = NULL;
|
||||
static VisualServer *visual_server = NULL;
|
||||
static RenderingServer *rendering_server = NULL;
|
||||
static CameraServer *camera_server = NULL;
|
||||
static ARVRServer *arvr_server = NULL;
|
||||
static PhysicsServer *physics_server = NULL;
|
||||
static Physics2DServer *physics_2d_server = NULL;
|
||||
static NavigationServer *navigation_server = NULL;
|
||||
static Navigation2DServer *navigation_2d_server = NULL;
|
||||
static PhysicsServer3D *physics_server = NULL;
|
||||
static PhysicsServer2D *physics_2d_server = NULL;
|
||||
static NavigationServer3D *navigation_server = NULL;
|
||||
static NavigationServer2D *navigation_2d_server = NULL;
|
||||
// We error out if setup2() doesn't turn this true
|
||||
static bool _start_success = false;
|
||||
|
||||
|
@ -180,23 +180,23 @@ static String get_full_version_string() {
|
|||
return String(VERSION_FULL_BUILD) + hash;
|
||||
}
|
||||
|
||||
// FIXME: Could maybe be moved to PhysicsServerManager and Physics2DServerManager directly
|
||||
// FIXME: Could maybe be moved to PhysicsServer3DManager and PhysicsServer2DManager directly
|
||||
// to have less code in main.cpp.
|
||||
void initialize_physics() {
|
||||
/// 3D Physics Server
|
||||
physics_server = PhysicsServerManager::new_server(ProjectSettings::get_singleton()->get(PhysicsServerManager::setting_property_name));
|
||||
physics_server = PhysicsServer3DManager::new_server(ProjectSettings::get_singleton()->get(PhysicsServer3DManager::setting_property_name));
|
||||
if (!physics_server) {
|
||||
// Physics server not found, Use the default physics
|
||||
physics_server = PhysicsServerManager::new_default_server();
|
||||
physics_server = PhysicsServer3DManager::new_default_server();
|
||||
}
|
||||
ERR_FAIL_COND(!physics_server);
|
||||
physics_server->init();
|
||||
|
||||
/// 2D Physics server
|
||||
physics_2d_server = Physics2DServerManager::new_server(ProjectSettings::get_singleton()->get(Physics2DServerManager::setting_property_name));
|
||||
physics_2d_server = PhysicsServer2DManager::new_server(ProjectSettings::get_singleton()->get(PhysicsServer2DManager::setting_property_name));
|
||||
if (!physics_2d_server) {
|
||||
// Physics server not found, Use the default physics
|
||||
physics_2d_server = Physics2DServerManager::new_default_server();
|
||||
physics_2d_server = PhysicsServer2DManager::new_default_server();
|
||||
}
|
||||
ERR_FAIL_COND(!physics_2d_server);
|
||||
physics_2d_server->init();
|
||||
|
@ -213,8 +213,8 @@ void finalize_physics() {
|
|||
|
||||
void finalize_display() {
|
||||
|
||||
visual_server->finish();
|
||||
memdelete(visual_server);
|
||||
rendering_server->finish();
|
||||
memdelete(rendering_server);
|
||||
|
||||
memdelete(display_server);
|
||||
}
|
||||
|
@ -222,8 +222,8 @@ void finalize_display() {
|
|||
void initialize_navigation_server() {
|
||||
ERR_FAIL_COND(navigation_server != NULL);
|
||||
|
||||
navigation_server = NavigationServerManager::new_default_server();
|
||||
navigation_2d_server = memnew(Navigation2DServer);
|
||||
navigation_server = NavigationServer3DManager::new_default_server();
|
||||
navigation_2d_server = memnew(NavigationServer2D);
|
||||
}
|
||||
|
||||
void finalize_navigation_server() {
|
||||
|
@ -1273,12 +1273,12 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
|
|||
|
||||
/* Initialize Visual Server */
|
||||
|
||||
visual_server = memnew(VisualServerRaster);
|
||||
rendering_server = memnew(RenderingServerRaster);
|
||||
if (OS::get_singleton()->get_render_thread_mode() != OS::RENDER_THREAD_UNSAFE) {
|
||||
visual_server = memnew(VisualServerWrapMT(visual_server, OS::get_singleton()->get_render_thread_mode() == OS::RENDER_SEPARATE_THREAD));
|
||||
rendering_server = memnew(RenderingServerWrapMT(rendering_server, OS::get_singleton()->get_render_thread_mode() == OS::RENDER_SEPARATE_THREAD));
|
||||
}
|
||||
|
||||
visual_server->init();
|
||||
rendering_server->init();
|
||||
|
||||
OS::get_singleton()->initialize_joypads();
|
||||
|
||||
|
@ -1333,7 +1333,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
|
|||
MAIN_PRINT("Main: Load Remaps");
|
||||
|
||||
Color clear = GLOBAL_DEF("rendering/environment/default_clear_color", Color(0.3, 0.3, 0.3));
|
||||
VisualServer::get_singleton()->set_default_clear_color(clear);
|
||||
RenderingServer::get_singleton()->set_default_clear_color(clear);
|
||||
|
||||
if (show_logo) { //boot logo!
|
||||
String boot_logo_path = GLOBAL_DEF("application/boot_splash/image", String());
|
||||
|
@ -1355,7 +1355,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
|
|||
Color boot_bg_color = GLOBAL_DEF("application/boot_splash/bg_color", boot_splash_bg_color);
|
||||
if (boot_logo.is_valid()) {
|
||||
OS::get_singleton()->_msec_splash = OS::get_singleton()->get_ticks_msec();
|
||||
VisualServer::get_singleton()->set_boot_image(boot_logo, boot_bg_color, boot_logo_scale, boot_logo_filter);
|
||||
RenderingServer::get_singleton()->set_boot_image(boot_logo, boot_bg_color, boot_logo_scale, boot_logo_filter);
|
||||
|
||||
} else {
|
||||
#ifndef NO_DEFAULT_BOOT_LOGO
|
||||
|
@ -1367,9 +1367,9 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
|
|||
#endif
|
||||
|
||||
MAIN_PRINT("Main: ClearColor");
|
||||
VisualServer::get_singleton()->set_default_clear_color(boot_bg_color);
|
||||
RenderingServer::get_singleton()->set_default_clear_color(boot_bg_color);
|
||||
MAIN_PRINT("Main: Image");
|
||||
VisualServer::get_singleton()->set_boot_image(splash, boot_bg_color, false);
|
||||
RenderingServer::get_singleton()->set_boot_image(splash, boot_bg_color, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1380,7 +1380,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
|
|||
}
|
||||
|
||||
MAIN_PRINT("Main: DCC");
|
||||
VisualServer::get_singleton()->set_default_clear_color(GLOBAL_DEF("rendering/environment/default_clear_color", Color(0.3, 0.3, 0.3)));
|
||||
RenderingServer::get_singleton()->set_default_clear_color(GLOBAL_DEF("rendering/environment/default_clear_color", Color(0.3, 0.3, 0.3)));
|
||||
MAIN_PRINT("Main: END");
|
||||
|
||||
GLOBAL_DEF("application/config/icon", String());
|
||||
|
@ -1826,7 +1826,7 @@ bool Main::start() {
|
|||
{
|
||||
|
||||
int directional_atlas_size = GLOBAL_GET("rendering/quality/directional_shadow/size");
|
||||
VisualServer::get_singleton()->directional_shadow_atlas_set_size(directional_atlas_size);
|
||||
RenderingServer::get_singleton()->directional_shadow_atlas_set_size(directional_atlas_size);
|
||||
}
|
||||
|
||||
if (!editor && !project_manager) {
|
||||
|
@ -2101,25 +2101,25 @@ bool Main::iteration() {
|
|||
|
||||
uint64_t physics_begin = OS::get_singleton()->get_ticks_usec();
|
||||
|
||||
PhysicsServer::get_singleton()->sync();
|
||||
PhysicsServer::get_singleton()->flush_queries();
|
||||
PhysicsServer3D::get_singleton()->sync();
|
||||
PhysicsServer3D::get_singleton()->flush_queries();
|
||||
|
||||
Physics2DServer::get_singleton()->sync();
|
||||
Physics2DServer::get_singleton()->flush_queries();
|
||||
PhysicsServer2D::get_singleton()->sync();
|
||||
PhysicsServer2D::get_singleton()->flush_queries();
|
||||
|
||||
if (OS::get_singleton()->get_main_loop()->iteration(frame_slice * time_scale)) {
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
|
||||
NavigationServer::get_singleton_mut()->process(frame_slice * time_scale);
|
||||
NavigationServer3D::get_singleton_mut()->process(frame_slice * time_scale);
|
||||
|
||||
message_queue->flush();
|
||||
|
||||
PhysicsServer::get_singleton()->step(frame_slice * time_scale);
|
||||
PhysicsServer3D::get_singleton()->step(frame_slice * time_scale);
|
||||
|
||||
Physics2DServer::get_singleton()->end_sync();
|
||||
Physics2DServer::get_singleton()->step(frame_slice * time_scale);
|
||||
PhysicsServer2D::get_singleton()->end_sync();
|
||||
PhysicsServer2D::get_singleton()->step(frame_slice * time_scale);
|
||||
|
||||
message_queue->flush();
|
||||
|
||||
|
@ -2137,17 +2137,17 @@ bool Main::iteration() {
|
|||
}
|
||||
message_queue->flush();
|
||||
|
||||
VisualServer::get_singleton()->sync(); //sync if still drawing from previous frames.
|
||||
RenderingServer::get_singleton()->sync(); //sync if still drawing from previous frames.
|
||||
|
||||
if (DisplayServer::get_singleton()->can_any_window_draw() && !disable_render_loop) {
|
||||
|
||||
if ((!force_redraw_requested) && OS::get_singleton()->is_in_low_processor_usage_mode()) {
|
||||
if (VisualServer::get_singleton()->has_changed()) {
|
||||
VisualServer::get_singleton()->draw(true, scaled_step); // flush visual commands
|
||||
if (RenderingServer::get_singleton()->has_changed()) {
|
||||
RenderingServer::get_singleton()->draw(true, scaled_step); // flush visual commands
|
||||
Engine::get_singleton()->frames_drawn++;
|
||||
}
|
||||
} else {
|
||||
VisualServer::get_singleton()->draw(true, scaled_step); // flush visual commands
|
||||
RenderingServer::get_singleton()->draw(true, scaled_step); // flush visual commands
|
||||
Engine::get_singleton()->frames_drawn++;
|
||||
force_redraw_requested = false;
|
||||
}
|
||||
|
@ -2262,7 +2262,7 @@ void Main::cleanup() {
|
|||
ScriptServer::finish_languages();
|
||||
|
||||
// Sync pending commands that may have been queued from a different thread during ScriptServer finalization
|
||||
VisualServer::get_singleton()->sync();
|
||||
RenderingServer::get_singleton()->sync();
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
EditorNode::unregister_editor_types();
|
||||
|
|
|
@ -35,9 +35,9 @@
|
|||
#include "scene/main/node.h"
|
||||
#include "scene/main/scene_tree.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "servers/physics_2d_server.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/physics_server_2d.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
Performance *Performance::singleton = NULL;
|
||||
|
||||
|
@ -135,22 +135,22 @@ float Performance::get_monitor(Monitor p_monitor) const {
|
|||
case OBJECT_RESOURCE_COUNT: return ResourceCache::get_cached_resource_count();
|
||||
case OBJECT_NODE_COUNT: return _get_node_count();
|
||||
case OBJECT_ORPHAN_NODE_COUNT: return Node::orphan_node_count;
|
||||
case RENDER_OBJECTS_IN_FRAME: return VS::get_singleton()->get_render_info(VS::INFO_OBJECTS_IN_FRAME);
|
||||
case RENDER_VERTICES_IN_FRAME: return VS::get_singleton()->get_render_info(VS::INFO_VERTICES_IN_FRAME);
|
||||
case RENDER_MATERIAL_CHANGES_IN_FRAME: return VS::get_singleton()->get_render_info(VS::INFO_MATERIAL_CHANGES_IN_FRAME);
|
||||
case RENDER_SHADER_CHANGES_IN_FRAME: return VS::get_singleton()->get_render_info(VS::INFO_SHADER_CHANGES_IN_FRAME);
|
||||
case RENDER_SURFACE_CHANGES_IN_FRAME: return VS::get_singleton()->get_render_info(VS::INFO_SURFACE_CHANGES_IN_FRAME);
|
||||
case RENDER_DRAW_CALLS_IN_FRAME: return VS::get_singleton()->get_render_info(VS::INFO_DRAW_CALLS_IN_FRAME);
|
||||
case RENDER_VIDEO_MEM_USED: return VS::get_singleton()->get_render_info(VS::INFO_VIDEO_MEM_USED);
|
||||
case RENDER_TEXTURE_MEM_USED: return VS::get_singleton()->get_render_info(VS::INFO_TEXTURE_MEM_USED);
|
||||
case RENDER_VERTEX_MEM_USED: return VS::get_singleton()->get_render_info(VS::INFO_VERTEX_MEM_USED);
|
||||
case RENDER_USAGE_VIDEO_MEM_TOTAL: return VS::get_singleton()->get_render_info(VS::INFO_USAGE_VIDEO_MEM_TOTAL);
|
||||
case PHYSICS_2D_ACTIVE_OBJECTS: return Physics2DServer::get_singleton()->get_process_info(Physics2DServer::INFO_ACTIVE_OBJECTS);
|
||||
case PHYSICS_2D_COLLISION_PAIRS: return Physics2DServer::get_singleton()->get_process_info(Physics2DServer::INFO_COLLISION_PAIRS);
|
||||
case PHYSICS_2D_ISLAND_COUNT: return Physics2DServer::get_singleton()->get_process_info(Physics2DServer::INFO_ISLAND_COUNT);
|
||||
case PHYSICS_3D_ACTIVE_OBJECTS: return PhysicsServer::get_singleton()->get_process_info(PhysicsServer::INFO_ACTIVE_OBJECTS);
|
||||
case PHYSICS_3D_COLLISION_PAIRS: return PhysicsServer::get_singleton()->get_process_info(PhysicsServer::INFO_COLLISION_PAIRS);
|
||||
case PHYSICS_3D_ISLAND_COUNT: return PhysicsServer::get_singleton()->get_process_info(PhysicsServer::INFO_ISLAND_COUNT);
|
||||
case RENDER_OBJECTS_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_OBJECTS_IN_FRAME);
|
||||
case RENDER_VERTICES_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_VERTICES_IN_FRAME);
|
||||
case RENDER_MATERIAL_CHANGES_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_MATERIAL_CHANGES_IN_FRAME);
|
||||
case RENDER_SHADER_CHANGES_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_SHADER_CHANGES_IN_FRAME);
|
||||
case RENDER_SURFACE_CHANGES_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_SURFACE_CHANGES_IN_FRAME);
|
||||
case RENDER_DRAW_CALLS_IN_FRAME: return RS::get_singleton()->get_render_info(RS::INFO_DRAW_CALLS_IN_FRAME);
|
||||
case RENDER_VIDEO_MEM_USED: return RS::get_singleton()->get_render_info(RS::INFO_VIDEO_MEM_USED);
|
||||
case RENDER_TEXTURE_MEM_USED: return RS::get_singleton()->get_render_info(RS::INFO_TEXTURE_MEM_USED);
|
||||
case RENDER_VERTEX_MEM_USED: return RS::get_singleton()->get_render_info(RS::INFO_VERTEX_MEM_USED);
|
||||
case RENDER_USAGE_VIDEO_MEM_TOTAL: return RS::get_singleton()->get_render_info(RS::INFO_USAGE_VIDEO_MEM_TOTAL);
|
||||
case PHYSICS_2D_ACTIVE_OBJECTS: return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_ACTIVE_OBJECTS);
|
||||
case PHYSICS_2D_COLLISION_PAIRS: return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_COLLISION_PAIRS);
|
||||
case PHYSICS_2D_ISLAND_COUNT: return PhysicsServer2D::get_singleton()->get_process_info(PhysicsServer2D::INFO_ISLAND_COUNT);
|
||||
case PHYSICS_3D_ACTIVE_OBJECTS: return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_ACTIVE_OBJECTS);
|
||||
case PHYSICS_3D_COLLISION_PAIRS: return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_COLLISION_PAIRS);
|
||||
case PHYSICS_3D_ISLAND_COUNT: return PhysicsServer3D::get_singleton()->get_process_info(PhysicsServer3D::INFO_ISLAND_COUNT);
|
||||
case AUDIO_OUTPUT_LATENCY: return AudioServer::get_singleton()->get_output_latency();
|
||||
|
||||
default: {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "core/vmap.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/resources/texture.h"
|
||||
#include "servers/visual/shader_language.h"
|
||||
#include "servers/rendering/shader_language.h"
|
||||
|
||||
#include "core/method_ptrcall.h"
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
#include "core/os/os.h"
|
||||
#include "core/print_string.h"
|
||||
#include "servers/display_server.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
class TestPhysicsMainLoop : public MainLoop {
|
||||
|
||||
|
@ -65,13 +65,13 @@ class TestPhysicsMainLoop : public MainLoop {
|
|||
Point2 joy_direction;
|
||||
|
||||
List<RID> bodies;
|
||||
Map<PhysicsServer::ShapeType, RID> type_shape_map;
|
||||
Map<PhysicsServer::ShapeType, RID> type_mesh_map;
|
||||
Map<PhysicsServer3D::ShapeType, RID> type_shape_map;
|
||||
Map<PhysicsServer3D::ShapeType, RID> type_mesh_map;
|
||||
|
||||
void body_changed_transform(Object *p_state, RID p_visual_instance) {
|
||||
|
||||
PhysicsDirectBodyState *state = (PhysicsDirectBodyState *)p_state;
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
PhysicsDirectBodyState3D *state = (PhysicsDirectBodyState3D *)p_state;
|
||||
RenderingServer *vs = RenderingServer::get_singleton();
|
||||
Transform t = state->get_transform();
|
||||
vs->instance_set_transform(p_visual_instance, t);
|
||||
}
|
||||
|
@ -84,23 +84,23 @@ protected:
|
|||
ClassDB::bind_method("body_changed_transform", &TestPhysicsMainLoop::body_changed_transform);
|
||||
}
|
||||
|
||||
RID create_body(PhysicsServer::ShapeType p_shape, PhysicsServer::BodyMode p_body, const Transform p_location, bool p_active_default = true, const Transform &p_shape_xform = Transform()) {
|
||||
RID create_body(PhysicsServer3D::ShapeType p_shape, PhysicsServer3D::BodyMode p_body, const Transform p_location, bool p_active_default = true, const Transform &p_shape_xform = Transform()) {
|
||||
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
PhysicsServer *ps = PhysicsServer::get_singleton();
|
||||
RenderingServer *vs = RenderingServer::get_singleton();
|
||||
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
|
||||
|
||||
RID mesh_instance = vs->instance_create2(type_mesh_map[p_shape], scenario);
|
||||
RID body = ps->body_create(p_body, !p_active_default);
|
||||
ps->body_set_space(body, space);
|
||||
ps->body_set_param(body, PhysicsServer::BODY_PARAM_BOUNCE, 0.0);
|
||||
ps->body_set_param(body, PhysicsServer3D::BODY_PARAM_BOUNCE, 0.0);
|
||||
//todo set space
|
||||
ps->body_add_shape(body, type_shape_map[p_shape]);
|
||||
ps->body_set_force_integration_callback(body, this, "body_changed_transform", mesh_instance);
|
||||
|
||||
ps->body_set_state(body, PhysicsServer::BODY_STATE_TRANSFORM, p_location);
|
||||
ps->body_set_state(body, PhysicsServer3D::BODY_STATE_TRANSFORM, p_location);
|
||||
bodies.push_back(body);
|
||||
|
||||
if (p_body == PhysicsServer::BODY_MODE_STATIC) {
|
||||
if (p_body == PhysicsServer3D::BODY_MODE_STATIC) {
|
||||
|
||||
vs->instance_set_transform(mesh_instance, p_location);
|
||||
}
|
||||
|
@ -109,12 +109,12 @@ protected:
|
|||
|
||||
RID create_static_plane(const Plane &p_plane) {
|
||||
|
||||
PhysicsServer *ps = PhysicsServer::get_singleton();
|
||||
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
|
||||
|
||||
RID world_margin_shape = ps->shape_create(PhysicsServer::SHAPE_PLANE);
|
||||
RID world_margin_shape = ps->shape_create(PhysicsServer3D::SHAPE_PLANE);
|
||||
ps->shape_set_data(world_margin_shape, p_plane);
|
||||
|
||||
RID b = ps->body_create(PhysicsServer::BODY_MODE_STATIC);
|
||||
RID b = ps->body_create(PhysicsServer3D::BODY_MODE_STATIC);
|
||||
ps->body_set_space(b, space);
|
||||
//todo set space
|
||||
ps->body_add_shape(b, world_margin_shape);
|
||||
|
@ -123,24 +123,24 @@ protected:
|
|||
|
||||
void configure_body(RID p_body, float p_mass, float p_friction, float p_bounce) {
|
||||
|
||||
PhysicsServer *ps = PhysicsServer::get_singleton();
|
||||
ps->body_set_param(p_body, PhysicsServer::BODY_PARAM_MASS, p_mass);
|
||||
ps->body_set_param(p_body, PhysicsServer::BODY_PARAM_FRICTION, p_friction);
|
||||
ps->body_set_param(p_body, PhysicsServer::BODY_PARAM_BOUNCE, p_bounce);
|
||||
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
|
||||
ps->body_set_param(p_body, PhysicsServer3D::BODY_PARAM_MASS, p_mass);
|
||||
ps->body_set_param(p_body, PhysicsServer3D::BODY_PARAM_FRICTION, p_friction);
|
||||
ps->body_set_param(p_body, PhysicsServer3D::BODY_PARAM_BOUNCE, p_bounce);
|
||||
}
|
||||
|
||||
void init_shapes() {
|
||||
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
PhysicsServer *ps = PhysicsServer::get_singleton();
|
||||
RenderingServer *vs = RenderingServer::get_singleton();
|
||||
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
|
||||
|
||||
/* SPHERE SHAPE */
|
||||
RID sphere_mesh = vs->make_sphere_mesh(10, 20, 0.5);
|
||||
type_mesh_map[PhysicsServer::SHAPE_SPHERE] = sphere_mesh;
|
||||
type_mesh_map[PhysicsServer3D::SHAPE_SPHERE] = sphere_mesh;
|
||||
|
||||
RID sphere_shape = ps->shape_create(PhysicsServer::SHAPE_SPHERE);
|
||||
RID sphere_shape = ps->shape_create(PhysicsServer3D::SHAPE_SPHERE);
|
||||
ps->shape_set_data(sphere_shape, 0.5);
|
||||
type_shape_map[PhysicsServer::SHAPE_SPHERE] = sphere_shape;
|
||||
type_shape_map[PhysicsServer3D::SHAPE_SPHERE] = sphere_shape;
|
||||
|
||||
/* BOX SHAPE */
|
||||
|
||||
|
@ -148,11 +148,11 @@ protected:
|
|||
RID box_mesh = vs->mesh_create();
|
||||
Geometry::MeshData box_data = Geometry::build_convex_mesh(box_planes);
|
||||
vs->mesh_add_surface_from_mesh_data(box_mesh, box_data);
|
||||
type_mesh_map[PhysicsServer::SHAPE_BOX] = box_mesh;
|
||||
type_mesh_map[PhysicsServer3D::SHAPE_BOX] = box_mesh;
|
||||
|
||||
RID box_shape = ps->shape_create(PhysicsServer::SHAPE_BOX);
|
||||
RID box_shape = ps->shape_create(PhysicsServer3D::SHAPE_BOX);
|
||||
ps->shape_set_data(box_shape, Vector3(0.5, 0.5, 0.5));
|
||||
type_shape_map[PhysicsServer::SHAPE_BOX] = box_shape;
|
||||
type_shape_map[PhysicsServer3D::SHAPE_BOX] = box_shape;
|
||||
|
||||
/* CAPSULE SHAPE */
|
||||
|
||||
|
@ -162,14 +162,14 @@ protected:
|
|||
Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes);
|
||||
vs->mesh_add_surface_from_mesh_data(capsule_mesh, capsule_data);
|
||||
|
||||
type_mesh_map[PhysicsServer::SHAPE_CAPSULE] = capsule_mesh;
|
||||
type_mesh_map[PhysicsServer3D::SHAPE_CAPSULE] = capsule_mesh;
|
||||
|
||||
RID capsule_shape = ps->shape_create(PhysicsServer::SHAPE_CAPSULE);
|
||||
RID capsule_shape = ps->shape_create(PhysicsServer3D::SHAPE_CAPSULE);
|
||||
Dictionary capsule_params;
|
||||
capsule_params["radius"] = 0.5;
|
||||
capsule_params["height"] = 1.4;
|
||||
ps->shape_set_data(capsule_shape, capsule_params);
|
||||
type_shape_map[PhysicsServer::SHAPE_CAPSULE] = capsule_shape;
|
||||
type_shape_map[PhysicsServer3D::SHAPE_CAPSULE] = capsule_shape;
|
||||
|
||||
/* CONVEX SHAPE */
|
||||
|
||||
|
@ -180,18 +180,18 @@ protected:
|
|||
QuickHull::build(convex_data.vertices, convex_data);
|
||||
vs->mesh_add_surface_from_mesh_data(convex_mesh, convex_data);
|
||||
|
||||
type_mesh_map[PhysicsServer::SHAPE_CONVEX_POLYGON] = convex_mesh;
|
||||
type_mesh_map[PhysicsServer3D::SHAPE_CONVEX_POLYGON] = convex_mesh;
|
||||
|
||||
RID convex_shape = ps->shape_create(PhysicsServer::SHAPE_CONVEX_POLYGON);
|
||||
RID convex_shape = ps->shape_create(PhysicsServer3D::SHAPE_CONVEX_POLYGON);
|
||||
ps->shape_set_data(convex_shape, convex_data.vertices);
|
||||
type_shape_map[PhysicsServer::SHAPE_CONVEX_POLYGON] = convex_shape;
|
||||
type_shape_map[PhysicsServer3D::SHAPE_CONVEX_POLYGON] = convex_shape;
|
||||
}
|
||||
|
||||
void make_trimesh(Vector<Vector3> p_faces, const Transform &p_xform = Transform()) {
|
||||
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
PhysicsServer *ps = PhysicsServer::get_singleton();
|
||||
RID trimesh_shape = ps->shape_create(PhysicsServer::SHAPE_CONCAVE_POLYGON);
|
||||
RenderingServer *vs = RenderingServer::get_singleton();
|
||||
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
|
||||
RID trimesh_shape = ps->shape_create(PhysicsServer3D::SHAPE_CONCAVE_POLYGON);
|
||||
ps->shape_set_data(trimesh_shape, p_faces);
|
||||
p_faces = ps->shape_get_data(trimesh_shape); // optimized one
|
||||
Vector<Vector3> normals; // for drawing
|
||||
|
@ -205,19 +205,19 @@ protected:
|
|||
|
||||
RID trimesh_mesh = vs->mesh_create();
|
||||
Array d;
|
||||
d.resize(VS::ARRAY_MAX);
|
||||
d[VS::ARRAY_VERTEX] = p_faces;
|
||||
d[VS::ARRAY_NORMAL] = normals;
|
||||
vs->mesh_add_surface_from_arrays(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, d);
|
||||
d.resize(RS::ARRAY_MAX);
|
||||
d[RS::ARRAY_VERTEX] = p_faces;
|
||||
d[RS::ARRAY_NORMAL] = normals;
|
||||
vs->mesh_add_surface_from_arrays(trimesh_mesh, RS::PRIMITIVE_TRIANGLES, d);
|
||||
|
||||
RID triins = vs->instance_create2(trimesh_mesh, scenario);
|
||||
|
||||
RID tribody = ps->body_create(PhysicsServer::BODY_MODE_STATIC);
|
||||
RID tribody = ps->body_create(PhysicsServer3D::BODY_MODE_STATIC);
|
||||
ps->body_set_space(tribody, space);
|
||||
//todo set space
|
||||
ps->body_add_shape(tribody, trimesh_shape);
|
||||
Transform tritrans = p_xform;
|
||||
ps->body_set_state(tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans);
|
||||
ps->body_set_state(tribody, PhysicsServer3D::BODY_STATE_TRANSFORM, tritrans);
|
||||
vs->instance_set_transform(triins, tritrans);
|
||||
}
|
||||
|
||||
|
@ -276,11 +276,11 @@ public:
|
|||
|
||||
if (mover.is_valid()) {
|
||||
|
||||
PhysicsServer *ps = PhysicsServer::get_singleton();
|
||||
Transform t = ps->body_get_state(mover, PhysicsServer::BODY_STATE_TRANSFORM);
|
||||
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
|
||||
Transform t = ps->body_get_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM);
|
||||
t.origin += Vector3(x, y, 0);
|
||||
|
||||
ps->body_set_state(mover, PhysicsServer::BODY_STATE_TRANSFORM, t);
|
||||
ps->body_set_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -294,11 +294,11 @@ public:
|
|||
ofs_x = ofs_y = 0;
|
||||
init_shapes();
|
||||
|
||||
PhysicsServer *ps = PhysicsServer::get_singleton();
|
||||
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
|
||||
space = ps->space_create();
|
||||
ps->space_set_active(space, true);
|
||||
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
RenderingServer *vs = RenderingServer::get_singleton();
|
||||
|
||||
/* LIGHT */
|
||||
RID lightaux = vs->directional_light_create();
|
||||
|
@ -335,17 +335,17 @@ public:
|
|||
|
||||
if (mover.is_valid()) {
|
||||
static float joy_speed = 10;
|
||||
PhysicsServer *ps = PhysicsServer::get_singleton();
|
||||
Transform t = ps->body_get_state(mover, PhysicsServer::BODY_STATE_TRANSFORM);
|
||||
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
|
||||
Transform t = ps->body_get_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM);
|
||||
t.origin += Vector3(joy_speed * joy_direction.x * p_time, -joy_speed * joy_direction.y * p_time, 0);
|
||||
ps->body_set_state(mover, PhysicsServer::BODY_STATE_TRANSFORM, t);
|
||||
ps->body_set_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM, t);
|
||||
};
|
||||
|
||||
Transform cameratr;
|
||||
cameratr.rotate(Vector3(0, 1, 0), ofs_x);
|
||||
cameratr.rotate(Vector3(1, 0, 0), -ofs_y);
|
||||
cameratr.translate(Vector3(0, 2, 8));
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
RenderingServer *vs = RenderingServer::get_singleton();
|
||||
vs->camera_set_transform(camera, cameratr);
|
||||
|
||||
return quit;
|
||||
|
@ -361,17 +361,17 @@ public:
|
|||
|
||||
void test_character() {
|
||||
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
PhysicsServer *ps = PhysicsServer::get_singleton();
|
||||
RenderingServer *vs = RenderingServer::get_singleton();
|
||||
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
|
||||
|
||||
Vector<Plane> capsule_planes = Geometry::build_capsule_planes(0.5, 1, 12, 5, Vector3::AXIS_Y);
|
||||
|
||||
RID capsule_mesh = vs->mesh_create();
|
||||
Geometry::MeshData capsule_data = Geometry::build_convex_mesh(capsule_planes);
|
||||
vs->mesh_add_surface_from_mesh_data(capsule_mesh, capsule_data);
|
||||
type_mesh_map[PhysicsServer::SHAPE_CAPSULE] = capsule_mesh;
|
||||
type_mesh_map[PhysicsServer3D::SHAPE_CAPSULE] = capsule_mesh;
|
||||
|
||||
RID capsule_shape = ps->shape_create(PhysicsServer::SHAPE_CAPSULE);
|
||||
RID capsule_shape = ps->shape_create(PhysicsServer3D::SHAPE_CAPSULE);
|
||||
Dictionary capsule_params;
|
||||
capsule_params["radius"] = 0.5;
|
||||
capsule_params["height"] = 1;
|
||||
|
@ -381,14 +381,14 @@ public:
|
|||
ps->shape_set_data(capsule_shape, capsule_params);
|
||||
|
||||
RID mesh_instance = vs->instance_create2(capsule_mesh, scenario);
|
||||
character = ps->body_create(PhysicsServer::BODY_MODE_CHARACTER);
|
||||
character = ps->body_create(PhysicsServer3D::BODY_MODE_CHARACTER);
|
||||
ps->body_set_space(character, space);
|
||||
//todo add space
|
||||
ps->body_add_shape(character, capsule_shape);
|
||||
|
||||
ps->body_set_force_integration_callback(character, this, "body_changed_transform", mesh_instance);
|
||||
|
||||
ps->body_set_state(character, PhysicsServer::BODY_STATE_TRANSFORM, Transform(Basis(), Vector3(-2, 5, -2)));
|
||||
ps->body_set_state(character, PhysicsServer3D::BODY_STATE_TRANSFORM, Transform(Basis(), Vector3(-2, 5, -2)));
|
||||
bodies.push_back(character);
|
||||
}
|
||||
|
||||
|
@ -396,21 +396,21 @@ public:
|
|||
|
||||
for (int i = 0; i < 35; i++) {
|
||||
|
||||
static const PhysicsServer::ShapeType shape_idx[] = {
|
||||
PhysicsServer::SHAPE_CAPSULE,
|
||||
PhysicsServer::SHAPE_BOX,
|
||||
PhysicsServer::SHAPE_SPHERE,
|
||||
PhysicsServer::SHAPE_CONVEX_POLYGON
|
||||
static const PhysicsServer3D::ShapeType shape_idx[] = {
|
||||
PhysicsServer3D::SHAPE_CAPSULE,
|
||||
PhysicsServer3D::SHAPE_BOX,
|
||||
PhysicsServer3D::SHAPE_SPHERE,
|
||||
PhysicsServer3D::SHAPE_CONVEX_POLYGON
|
||||
};
|
||||
|
||||
PhysicsServer::ShapeType type = shape_idx[i % 4];
|
||||
PhysicsServer3D::ShapeType type = shape_idx[i % 4];
|
||||
|
||||
Transform t;
|
||||
|
||||
t.origin = Vector3(0.0 * i, 3.5 + 1.1 * i, 0.7 + 0.0 * i);
|
||||
t.basis.rotate(Vector3(0.2, -1, 0), Math_PI / 2 * 0.6);
|
||||
|
||||
create_body(type, PhysicsServer::BODY_MODE_RIGID, t);
|
||||
create_body(type, PhysicsServer3D::BODY_MODE_RIGID, t);
|
||||
}
|
||||
|
||||
create_static_plane(Plane(Vector3(0, 1, 0), -1));
|
||||
|
@ -418,7 +418,7 @@ public:
|
|||
|
||||
void test_activate() {
|
||||
|
||||
create_body(PhysicsServer::SHAPE_BOX, PhysicsServer::BODY_MODE_RIGID, Transform(Basis(), Vector3(0, 2, 0)), true);
|
||||
create_body(PhysicsServer3D::SHAPE_BOX, PhysicsServer3D::BODY_MODE_RIGID, Transform(Basis(), Vector3(0, 2, 0)), true);
|
||||
create_static_plane(Plane(Vector3(0, 1, 0), -1));
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -37,7 +37,7 @@
|
|||
#include "core/os/os.h"
|
||||
#include "core/print_string.h"
|
||||
#include "servers/display_server.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
#define OBJECT_COUNT 50
|
||||
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
virtual void init() {
|
||||
|
||||
print_line("INITIALIZING TEST RENDER");
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
RenderingServer *vs = RenderingServer::get_singleton();
|
||||
test_cube = vs->get_test_cube();
|
||||
scenario = vs->scenario_create();
|
||||
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
print_line("ERR: " + itos(err));
|
||||
test_cube = vs->mesh_create();
|
||||
vs->mesh_add_surface_from_mesh_data(test_cube, md);
|
||||
//vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME);
|
||||
//vs->scenario_set_debug(scenario,RS::SCENARIO_DEBUG_WIREFRAME);
|
||||
|
||||
/*
|
||||
RID sm = vs->shader_create();
|
||||
|
@ -174,16 +174,16 @@ public:
|
|||
vs->camera_set_perspective(camera, 60, 0.1, 1000);
|
||||
|
||||
/*
|
||||
RID lightaux = vs->light_create( VisualServer::LIGHT_OMNI );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_RADIUS, 80 );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ATTENUATION, 1 );
|
||||
vs->light_set_var( lightaux, VisualServer::LIGHT_VAR_ENERGY, 1.5 );
|
||||
RID lightaux = vs->light_create( RenderingServer::LIGHT_OMNI );
|
||||
vs->light_set_var( lightaux, RenderingServer::LIGHT_VAR_RADIUS, 80 );
|
||||
vs->light_set_var( lightaux, RenderingServer::LIGHT_VAR_ATTENUATION, 1 );
|
||||
vs->light_set_var( lightaux, RenderingServer::LIGHT_VAR_ENERGY, 1.5 );
|
||||
light = vs->instance_create( lightaux );
|
||||
*/
|
||||
RID lightaux;
|
||||
|
||||
lightaux = vs->directional_light_create();
|
||||
//vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) );
|
||||
//vs->light_set_color( lightaux, RenderingServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) );
|
||||
vs->light_set_color(lightaux, Color(1.0, 1.0, 1.0));
|
||||
//vs->light_set_shadow( lightaux, true );
|
||||
light = vs->instance_create2(lightaux, scenario);
|
||||
|
@ -194,10 +194,10 @@ public:
|
|||
vs->instance_set_transform(light, lla);
|
||||
|
||||
lightaux = vs->omni_light_create();
|
||||
//vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,1.0) );
|
||||
//vs->light_set_color( lightaux, RenderingServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,1.0) );
|
||||
vs->light_set_color(lightaux, Color(1.0, 1.0, 0.0));
|
||||
vs->light_set_param(lightaux, VisualServer::LIGHT_PARAM_RANGE, 4);
|
||||
vs->light_set_param(lightaux, VisualServer::LIGHT_PARAM_ENERGY, 8);
|
||||
vs->light_set_param(lightaux, RenderingServer::LIGHT_PARAM_RANGE, 4);
|
||||
vs->light_set_param(lightaux, RenderingServer::LIGHT_PARAM_ENERGY, 8);
|
||||
//vs->light_set_shadow( lightaux, true );
|
||||
//light = vs->instance_create( lightaux );
|
||||
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
}
|
||||
virtual bool iteration(float p_time) {
|
||||
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
RenderingServer *vs = RenderingServer::get_singleton();
|
||||
//Transform t;
|
||||
//t.rotate(Vector3(0, 1, 0), ofs);
|
||||
//t.translate(Vector3(0,0,20 ));
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "core/print_string.h"
|
||||
#include "scene/gui/control.h"
|
||||
#include "scene/gui/text_edit.h"
|
||||
#include "servers/visual/shader_language.h"
|
||||
#include "servers/rendering/shader_language.h"
|
||||
|
||||
typedef ShaderLanguage SL;
|
||||
|
||||
|
|
|
@ -1208,9 +1208,9 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
|
|||
}
|
||||
|
||||
Array array_copy;
|
||||
array_copy.resize(VisualServer::ARRAY_MAX);
|
||||
array_copy.resize(RenderingServer::ARRAY_MAX);
|
||||
|
||||
for (int l = 0; l < VisualServer::ARRAY_MAX; l++) {
|
||||
for (int l = 0; l < RenderingServer::ARRAY_MAX; l++) {
|
||||
array_copy[l] = array_mesh[l].duplicate(true);
|
||||
}
|
||||
|
||||
|
@ -1224,13 +1224,13 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
|
|||
Vector3 position = Vector3(ai_pos.x, ai_pos.y, ai_pos.z);
|
||||
vertices.ptrw()[l] = position;
|
||||
}
|
||||
PackedVector3Array new_vertices = array_copy[VisualServer::ARRAY_VERTEX].duplicate(true);
|
||||
PackedVector3Array new_vertices = array_copy[RenderingServer::ARRAY_VERTEX].duplicate(true);
|
||||
ERR_CONTINUE(vertices.size() != new_vertices.size());
|
||||
for (int32_t l = 0; l < new_vertices.size(); l++) {
|
||||
Vector3 *w = new_vertices.ptrw();
|
||||
w[l] = vertices[l];
|
||||
}
|
||||
array_copy[VisualServer::ARRAY_VERTEX] = new_vertices;
|
||||
array_copy[RenderingServer::ARRAY_VERTEX] = new_vertices;
|
||||
}
|
||||
|
||||
int32_t color_set = 0;
|
||||
|
@ -1242,13 +1242,13 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
|
|||
Color color = Color(ai_color.r, ai_color.g, ai_color.b, ai_color.a);
|
||||
colors.ptrw()[l] = color;
|
||||
}
|
||||
PackedColorArray new_colors = array_copy[VisualServer::ARRAY_COLOR].duplicate(true);
|
||||
PackedColorArray new_colors = array_copy[RenderingServer::ARRAY_COLOR].duplicate(true);
|
||||
ERR_CONTINUE(colors.size() != new_colors.size());
|
||||
for (int32_t l = 0; l < colors.size(); l++) {
|
||||
Color *w = new_colors.ptrw();
|
||||
w[l] = colors[l];
|
||||
}
|
||||
array_copy[VisualServer::ARRAY_COLOR] = new_colors;
|
||||
array_copy[RenderingServer::ARRAY_COLOR] = new_colors;
|
||||
}
|
||||
|
||||
if (ai_mesh->mAnimMeshes[j]->HasNormals()) {
|
||||
|
@ -1259,13 +1259,13 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
|
|||
Vector3 normal = Vector3(ai_normal.x, ai_normal.y, ai_normal.z);
|
||||
normals.ptrw()[l] = normal;
|
||||
}
|
||||
PackedVector3Array new_normals = array_copy[VisualServer::ARRAY_NORMAL].duplicate(true);
|
||||
PackedVector3Array new_normals = array_copy[RenderingServer::ARRAY_NORMAL].duplicate(true);
|
||||
ERR_CONTINUE(normals.size() != new_normals.size());
|
||||
for (int l = 0; l < normals.size(); l++) {
|
||||
Vector3 *w = new_normals.ptrw();
|
||||
w[l] = normals[l];
|
||||
}
|
||||
array_copy[VisualServer::ARRAY_NORMAL] = new_normals;
|
||||
array_copy[RenderingServer::ARRAY_NORMAL] = new_normals;
|
||||
}
|
||||
|
||||
if (ai_mesh->mAnimMeshes[j]->HasTangentsAndBitangents()) {
|
||||
|
@ -1275,7 +1275,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
|
|||
for (size_t l = 0; l < num_vertices; l++) {
|
||||
AssimpUtils::calc_tangent_from_mesh(ai_mesh, j, l, l, w);
|
||||
}
|
||||
PackedFloat32Array new_tangents = array_copy[VisualServer::ARRAY_TANGENT].duplicate(true);
|
||||
PackedFloat32Array new_tangents = array_copy[RenderingServer::ARRAY_TANGENT].duplicate(true);
|
||||
ERR_CONTINUE(new_tangents.size() != tangents.size() * 4);
|
||||
for (int32_t l = 0; l < tangents.size(); l++) {
|
||||
new_tangents.ptrw()[l + 0] = tangents[l].r;
|
||||
|
@ -1283,7 +1283,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
|
|||
new_tangents.ptrw()[l + 2] = tangents[l].b;
|
||||
new_tangents.ptrw()[l + 3] = tangents[l].a;
|
||||
}
|
||||
array_copy[VisualServer::ARRAY_TANGENT] = new_tangents;
|
||||
array_copy[RenderingServer::ARRAY_TANGENT] = new_tangents;
|
||||
}
|
||||
|
||||
morphs[j] = array_copy;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "register_types.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering_server.h"
|
||||
#include "texture_basisu.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
@ -164,10 +164,10 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
|
|||
switch (*(uint32_t *)(ptr)) {
|
||||
case BASIS_DECOMPRESS_RG: {
|
||||
|
||||
if (VS::get_singleton()->has_os_feature("rgtc")) {
|
||||
if (RS::get_singleton()->has_os_feature("rgtc")) {
|
||||
format = basist::transcoder_texture_format::cTFBC5; // get this from renderer
|
||||
imgfmt = Image::FORMAT_RGTC_RG;
|
||||
} else if (VS::get_singleton()->has_os_feature("etc2")) {
|
||||
} else if (RS::get_singleton()->has_os_feature("etc2")) {
|
||||
//unfortunately, basis universal does not support
|
||||
//
|
||||
ERR_FAIL_V(image); //unimplemented here
|
||||
|
@ -179,13 +179,13 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
|
|||
}
|
||||
} break;
|
||||
case BASIS_DECOMPRESS_RGB: {
|
||||
if (VS::get_singleton()->has_os_feature("bptc")) {
|
||||
if (RS::get_singleton()->has_os_feature("bptc")) {
|
||||
format = basist::transcoder_texture_format::cTFBC7_M6_OPAQUE_ONLY; // get this from renderer
|
||||
imgfmt = Image::FORMAT_BPTC_RGBA;
|
||||
} else if (VS::get_singleton()->has_os_feature("s3tc")) {
|
||||
} else if (RS::get_singleton()->has_os_feature("s3tc")) {
|
||||
format = basist::transcoder_texture_format::cTFBC1; // get this from renderer
|
||||
imgfmt = Image::FORMAT_DXT1;
|
||||
} else if (VS::get_singleton()->has_os_feature("etc")) {
|
||||
} else if (RS::get_singleton()->has_os_feature("etc")) {
|
||||
|
||||
format = basist::transcoder_texture_format::cTFETC1; // get this from renderer
|
||||
imgfmt = Image::FORMAT_ETC;
|
||||
|
@ -196,13 +196,13 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
|
|||
|
||||
} break;
|
||||
case BASIS_DECOMPRESS_RGBA: {
|
||||
if (VS::get_singleton()->has_os_feature("bptc")) {
|
||||
if (RS::get_singleton()->has_os_feature("bptc")) {
|
||||
format = basist::transcoder_texture_format::cTFBC7_M5; // get this from renderer
|
||||
imgfmt = Image::FORMAT_BPTC_RGBA;
|
||||
} else if (VS::get_singleton()->has_os_feature("s3tc")) {
|
||||
} else if (RS::get_singleton()->has_os_feature("s3tc")) {
|
||||
format = basist::transcoder_texture_format::cTFBC3; // get this from renderer
|
||||
imgfmt = Image::FORMAT_DXT5;
|
||||
} else if (VS::get_singleton()->has_os_feature("etc2")) {
|
||||
} else if (RS::get_singleton()->has_os_feature("etc2")) {
|
||||
format = basist::transcoder_texture_format::cTFETC2; // get this from renderer
|
||||
imgfmt = Image::FORMAT_ETC2_RGBA8;
|
||||
} else {
|
||||
|
@ -212,10 +212,10 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
|
|||
}
|
||||
} break;
|
||||
case BASIS_DECOMPRESS_RG_AS_RA: {
|
||||
if (VS::get_singleton()->has_os_feature("s3tc")) {
|
||||
if (RS::get_singleton()->has_os_feature("s3tc")) {
|
||||
format = basist::transcoder_texture_format::cTFBC3; // get this from renderer
|
||||
imgfmt = Image::FORMAT_DXT5_RA_AS_RG;
|
||||
} else if (VS::get_singleton()->has_os_feature("etc2")) {
|
||||
} else if (RS::get_singleton()->has_os_feature("etc2")) {
|
||||
format = basist::transcoder_texture_format::cTFETC2; // get this from renderer
|
||||
imgfmt = Image::FORMAT_ETC2_RGBA8;
|
||||
} else {
|
||||
|
|
|
@ -72,7 +72,7 @@ bool TextureBasisU::has_alpha() const {
|
|||
void TextureBasisU::set_flags(uint32_t p_flags) {
|
||||
|
||||
flags = p_flags;
|
||||
VisualServer::get_singleton()->texture_set_flags(texture, p_flags);
|
||||
RenderingServer::get_singleton()->texture_set_flags(texture, p_flags);
|
||||
};
|
||||
|
||||
uint32_t TextureBasisU::get_flags() const {
|
||||
|
@ -144,8 +144,8 @@ void TextureBasisU::set_basisu_data(const Vector<uint8_t>& p_data) {
|
|||
img.instance();
|
||||
img->create(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata);
|
||||
|
||||
VisualServer::get_singleton()->texture_allocate(texture, tex_size.x, tex_size.y, 0, img->get_format(), VS::TEXTURE_TYPE_2D, flags);
|
||||
VisualServer::get_singleton()->texture_set_data(texture, img);
|
||||
RenderingServer::get_singleton()->texture_allocate(texture, tex_size.x, tex_size.y, 0, img->get_format(), RS::TEXTURE_TYPE_2D, flags);
|
||||
RenderingServer::get_singleton()->texture_set_data(texture, img);
|
||||
};
|
||||
|
||||
Error TextureBasisU::import(const Ref<Image>& p_img) {
|
||||
|
@ -221,13 +221,13 @@ Vector<uint8_t> TextureBasisU::get_basisu_data() const {
|
|||
TextureBasisU::TextureBasisU() {
|
||||
|
||||
flags = FLAGS_DEFAULT;
|
||||
texture = VisualServer::get_singleton()->texture_create();
|
||||
texture = RenderingServer::get_singleton()->texture_create();
|
||||
};
|
||||
|
||||
|
||||
TextureBasisU::~TextureBasisU() {
|
||||
|
||||
VisualServer::get_singleton()->free(texture);
|
||||
RenderingServer::get_singleton()->free(texture);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
AreaBullet::AreaBullet() :
|
||||
RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_AREA),
|
||||
monitorable(true),
|
||||
spOv_mode(PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED),
|
||||
spOv_mode(PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED),
|
||||
spOv_gravityPoint(false),
|
||||
spOv_gravityPointDistanceScale(0),
|
||||
spOv_gravityPointAttenuation(1),
|
||||
|
@ -86,11 +86,11 @@ void AreaBullet::dispatch_callbacks() {
|
|||
switch (otherObj.state) {
|
||||
case OVERLAP_STATE_ENTER:
|
||||
otherObj.state = OVERLAP_STATE_INSIDE;
|
||||
call_event(otherObj.object, PhysicsServer::AREA_BODY_ADDED);
|
||||
call_event(otherObj.object, PhysicsServer3D::AREA_BODY_ADDED);
|
||||
otherObj.object->on_enter_area(this);
|
||||
break;
|
||||
case OVERLAP_STATE_EXIT:
|
||||
call_event(otherObj.object, PhysicsServer::AREA_BODY_REMOVED);
|
||||
call_event(otherObj.object, PhysicsServer3D::AREA_BODY_REMOVED);
|
||||
otherObj.object->on_exit_area(this);
|
||||
overlappingObjects.remove(i); // Remove after callback
|
||||
break;
|
||||
|
@ -101,7 +101,7 @@ void AreaBullet::dispatch_callbacks() {
|
|||
}
|
||||
}
|
||||
|
||||
void AreaBullet::call_event(CollisionObjectBullet *p_otherObject, PhysicsServer::AreaBodyStatus p_status) {
|
||||
void AreaBullet::call_event(CollisionObjectBullet *p_otherObject, PhysicsServer3D::AreaBodyStatus p_status) {
|
||||
|
||||
InOutEventCallback &event = eventsCallbacks[static_cast<int>(p_otherObject->getType())];
|
||||
Object *areaGodoObject = ObjectDB::get_instance(event.event_callback_id);
|
||||
|
@ -130,7 +130,7 @@ void AreaBullet::scratch() {
|
|||
void AreaBullet::clear_overlaps(bool p_notify) {
|
||||
for (int i = overlappingObjects.size() - 1; 0 <= i; --i) {
|
||||
if (p_notify)
|
||||
call_event(overlappingObjects[i].object, PhysicsServer::AREA_BODY_REMOVED);
|
||||
call_event(overlappingObjects[i].object, PhysicsServer3D::AREA_BODY_REMOVED);
|
||||
overlappingObjects[i].object->on_exit_area(this);
|
||||
}
|
||||
overlappingObjects.clear();
|
||||
|
@ -140,7 +140,7 @@ void AreaBullet::remove_overlap(CollisionObjectBullet *p_object, bool p_notify)
|
|||
for (int i = overlappingObjects.size() - 1; 0 <= i; --i) {
|
||||
if (overlappingObjects[i].object == p_object) {
|
||||
if (p_notify)
|
||||
call_event(overlappingObjects[i].object, PhysicsServer::AREA_BODY_REMOVED);
|
||||
call_event(overlappingObjects[i].object, PhysicsServer3D::AREA_BODY_REMOVED);
|
||||
overlappingObjects[i].object->on_exit_area(this);
|
||||
overlappingObjects.remove(i);
|
||||
break;
|
||||
|
@ -218,30 +218,30 @@ void AreaBullet::put_overlap_as_inside(int p_index) {
|
|||
}
|
||||
}
|
||||
|
||||
void AreaBullet::set_param(PhysicsServer::AreaParameter p_param, const Variant &p_value) {
|
||||
void AreaBullet::set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY:
|
||||
set_spOv_gravityMag(p_value);
|
||||
break;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_VECTOR:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR:
|
||||
set_spOv_gravityVec(p_value);
|
||||
break;
|
||||
case PhysicsServer::AREA_PARAM_LINEAR_DAMP:
|
||||
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP:
|
||||
set_spOv_linearDump(p_value);
|
||||
break;
|
||||
case PhysicsServer::AREA_PARAM_ANGULAR_DAMP:
|
||||
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP:
|
||||
set_spOv_angularDump(p_value);
|
||||
break;
|
||||
case PhysicsServer::AREA_PARAM_PRIORITY:
|
||||
case PhysicsServer3D::AREA_PARAM_PRIORITY:
|
||||
set_spOv_priority(p_value);
|
||||
break;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT:
|
||||
set_spOv_gravityPoint(p_value);
|
||||
break;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
|
||||
set_spOv_gravityPointDistanceScale(p_value);
|
||||
break;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
|
||||
set_spOv_gravityPointAttenuation(p_value);
|
||||
break;
|
||||
default:
|
||||
|
@ -249,23 +249,23 @@ void AreaBullet::set_param(PhysicsServer::AreaParameter p_param, const Variant &
|
|||
}
|
||||
}
|
||||
|
||||
Variant AreaBullet::get_param(PhysicsServer::AreaParameter p_param) const {
|
||||
Variant AreaBullet::get_param(PhysicsServer3D::AreaParameter p_param) const {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY:
|
||||
return spOv_gravityMag;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_VECTOR:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR:
|
||||
return spOv_gravityVec;
|
||||
case PhysicsServer::AREA_PARAM_LINEAR_DAMP:
|
||||
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP:
|
||||
return spOv_linearDump;
|
||||
case PhysicsServer::AREA_PARAM_ANGULAR_DAMP:
|
||||
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP:
|
||||
return spOv_angularDump;
|
||||
case PhysicsServer::AREA_PARAM_PRIORITY:
|
||||
case PhysicsServer3D::AREA_PARAM_PRIORITY:
|
||||
return spOv_priority;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT:
|
||||
return spOv_gravityPoint;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
|
||||
return spOv_gravityPointDistanceScale;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
|
||||
return spOv_gravityPointAttenuation;
|
||||
default:
|
||||
WARN_PRINT("Area doesn't support this parameter in the Bullet backend: " + itos(p_param));
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "collision_object_bullet.h"
|
||||
#include "core/vector.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
#include "space_bullet.h"
|
||||
|
||||
/**
|
||||
|
@ -88,7 +88,7 @@ private:
|
|||
Vector<OverlappingObjectData> overlappingObjects;
|
||||
bool monitorable;
|
||||
|
||||
PhysicsServer::AreaSpaceOverrideMode spOv_mode;
|
||||
PhysicsServer3D::AreaSpaceOverrideMode spOv_mode;
|
||||
bool spOv_gravityPoint;
|
||||
real_t spOv_gravityPointDistanceScale;
|
||||
real_t spOv_gravityPointAttenuation;
|
||||
|
@ -114,8 +114,8 @@ public:
|
|||
|
||||
bool is_monitoring() const;
|
||||
|
||||
_FORCE_INLINE_ void set_spOv_mode(PhysicsServer::AreaSpaceOverrideMode p_mode) { spOv_mode = p_mode; }
|
||||
_FORCE_INLINE_ PhysicsServer::AreaSpaceOverrideMode get_spOv_mode() { return spOv_mode; }
|
||||
_FORCE_INLINE_ void set_spOv_mode(PhysicsServer3D::AreaSpaceOverrideMode p_mode) { spOv_mode = p_mode; }
|
||||
_FORCE_INLINE_ PhysicsServer3D::AreaSpaceOverrideMode get_spOv_mode() { return spOv_mode; }
|
||||
|
||||
_FORCE_INLINE_ void set_spOv_gravityPoint(bool p_isGP) { spOv_gravityPoint = p_isGP; }
|
||||
_FORCE_INLINE_ bool is_spOv_gravityPoint() { return spOv_gravityPoint; }
|
||||
|
@ -146,7 +146,7 @@ public:
|
|||
virtual void set_space(SpaceBullet *p_space);
|
||||
|
||||
virtual void dispatch_callbacks();
|
||||
void call_event(CollisionObjectBullet *p_otherObject, PhysicsServer::AreaBodyStatus p_status);
|
||||
void call_event(CollisionObjectBullet *p_otherObject, PhysicsServer3D::AreaBodyStatus p_status);
|
||||
void set_on_state_change(ObjectID p_id, const StringName &p_method, const Variant &p_udata = Variant());
|
||||
void scratch();
|
||||
|
||||
|
@ -162,8 +162,8 @@ public:
|
|||
void put_overlap_as_exit(int p_index);
|
||||
void put_overlap_as_inside(int p_index);
|
||||
|
||||
void set_param(PhysicsServer::AreaParameter p_param, const Variant &p_value);
|
||||
Variant get_param(PhysicsServer::AreaParameter p_param) const;
|
||||
void set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value);
|
||||
Variant get_param(PhysicsServer3D::AreaParameter p_param) const;
|
||||
|
||||
void set_event_callback(Type p_callbackObjectType, ObjectID p_id, const StringName &p_method);
|
||||
bool has_event_callback(Type p_callbackObjectType);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -36,7 +36,7 @@
|
|||
#include "core/rid_owner.h"
|
||||
#include "joint_bullet.h"
|
||||
#include "rigid_body_bullet.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
#include "shape_bullet.h"
|
||||
#include "soft_body_bullet.h"
|
||||
#include "space_bullet.h"
|
||||
|
@ -44,8 +44,8 @@
|
|||
@author AndreaCatania
|
||||
*/
|
||||
|
||||
class BulletPhysicsServer : public PhysicsServer {
|
||||
GDCLASS(BulletPhysicsServer, PhysicsServer);
|
||||
class BulletPhysicsServer3D : public PhysicsServer3D {
|
||||
GDCLASS(BulletPhysicsServer3D, PhysicsServer3D);
|
||||
|
||||
friend class BulletPhysicsDirectSpaceState;
|
||||
|
||||
|
@ -64,8 +64,8 @@ protected:
|
|||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
BulletPhysicsServer();
|
||||
~BulletPhysicsServer();
|
||||
BulletPhysicsServer3D();
|
||||
~BulletPhysicsServer3D();
|
||||
|
||||
_FORCE_INLINE_ RID_PtrOwner<SpaceBullet> *get_space_owner() {
|
||||
return &space_owner;
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
/// Not supported
|
||||
virtual real_t space_get_param(RID p_space, SpaceParameter p_param) const;
|
||||
|
||||
virtual PhysicsDirectSpaceState *space_get_direct_state(RID p_space);
|
||||
virtual PhysicsDirectSpaceState3D *space_get_direct_state(RID p_space);
|
||||
|
||||
virtual void space_set_debug_contacts(RID p_space, int p_max_contacts);
|
||||
virtual Vector<Vector3> space_get_contacts(RID p_space) const;
|
||||
|
@ -252,7 +252,7 @@ public:
|
|||
virtual bool body_is_ray_pickable(RID p_body) const;
|
||||
|
||||
// this function only works on physics process, errors and returns null otherwise
|
||||
virtual PhysicsDirectBodyState *body_get_direct_state(RID p_body);
|
||||
virtual PhysicsDirectBodyState3D *body_get_direct_state(RID p_body);
|
||||
|
||||
virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true);
|
||||
virtual int body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin = 0.001);
|
||||
|
@ -261,7 +261,7 @@ public:
|
|||
|
||||
virtual RID soft_body_create(bool p_init_sleeping = false);
|
||||
|
||||
virtual void soft_body_update_visual_server(RID p_body, class SoftBodyVisualServerHandler *p_visual_server_handler);
|
||||
virtual void soft_body_update_rendering_server(RID p_body, class SoftBodyRenderingServerHandler *p_rendering_server_handler);
|
||||
|
||||
virtual void soft_body_set_space(RID p_body, RID p_space);
|
||||
virtual RID soft_body_get_space(RID p_body) const;
|
||||
|
@ -387,7 +387,7 @@ public:
|
|||
}
|
||||
|
||||
static bool singleton_isActive() {
|
||||
return static_cast<BulletPhysicsServer *>(get_singleton())->active;
|
||||
return static_cast<BulletPhysicsServer3D *>(get_singleton())->active;
|
||||
}
|
||||
|
||||
bool isActive() {
|
||||
|
|
|
@ -60,7 +60,7 @@ void CollisionObjectBullet::ShapeWrapper::set_transform(const btTransform &p_tra
|
|||
}
|
||||
|
||||
btTransform CollisionObjectBullet::ShapeWrapper::get_adjusted_transform() const {
|
||||
if (shape->get_type() == PhysicsServer::SHAPE_HEIGHTMAP) {
|
||||
if (shape->get_type() == PhysicsServer3D::SHAPE_HEIGHTMAP) {
|
||||
const HeightMapShapeBullet *hm_shape = (const HeightMapShapeBullet *)shape; // should be safe to cast now
|
||||
btTransform adjusted_transform;
|
||||
|
||||
|
|
|
@ -64,43 +64,43 @@ ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet
|
|||
setup(coneConstraint);
|
||||
}
|
||||
|
||||
void ConeTwistJointBullet::set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value) {
|
||||
void ConeTwistJointBullet::set_param(PhysicsServer3D::ConeTwistJointParam p_param, real_t p_value) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN:
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_SWING_SPAN:
|
||||
coneConstraint->setLimit(5, p_value);
|
||||
coneConstraint->setLimit(4, p_value);
|
||||
break;
|
||||
case PhysicsServer::CONE_TWIST_JOINT_TWIST_SPAN:
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_TWIST_SPAN:
|
||||
coneConstraint->setLimit(3, p_value);
|
||||
break;
|
||||
case PhysicsServer::CONE_TWIST_JOINT_BIAS:
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_BIAS:
|
||||
coneConstraint->setLimit(coneConstraint->getSwingSpan1(), coneConstraint->getSwingSpan2(), coneConstraint->getTwistSpan(), coneConstraint->getLimitSoftness(), p_value, coneConstraint->getRelaxationFactor());
|
||||
break;
|
||||
case PhysicsServer::CONE_TWIST_JOINT_SOFTNESS:
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_SOFTNESS:
|
||||
coneConstraint->setLimit(coneConstraint->getSwingSpan1(), coneConstraint->getSwingSpan2(), coneConstraint->getTwistSpan(), p_value, coneConstraint->getBiasFactor(), coneConstraint->getRelaxationFactor());
|
||||
break;
|
||||
case PhysicsServer::CONE_TWIST_JOINT_RELAXATION:
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_RELAXATION:
|
||||
coneConstraint->setLimit(coneConstraint->getSwingSpan1(), coneConstraint->getSwingSpan2(), coneConstraint->getTwistSpan(), coneConstraint->getLimitSoftness(), coneConstraint->getBiasFactor(), p_value);
|
||||
break;
|
||||
case PhysicsServer::CONE_TWIST_MAX:
|
||||
case PhysicsServer3D::CONE_TWIST_MAX:
|
||||
// Internal size value, nothing to do.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
real_t ConeTwistJointBullet::get_param(PhysicsServer::ConeTwistJointParam p_param) const {
|
||||
real_t ConeTwistJointBullet::get_param(PhysicsServer3D::ConeTwistJointParam p_param) const {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN:
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_SWING_SPAN:
|
||||
return coneConstraint->getSwingSpan1();
|
||||
case PhysicsServer::CONE_TWIST_JOINT_TWIST_SPAN:
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_TWIST_SPAN:
|
||||
return coneConstraint->getTwistSpan();
|
||||
case PhysicsServer::CONE_TWIST_JOINT_BIAS:
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_BIAS:
|
||||
return coneConstraint->getBiasFactor();
|
||||
case PhysicsServer::CONE_TWIST_JOINT_SOFTNESS:
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_SOFTNESS:
|
||||
return coneConstraint->getLimitSoftness();
|
||||
case PhysicsServer::CONE_TWIST_JOINT_RELAXATION:
|
||||
case PhysicsServer3D::CONE_TWIST_JOINT_RELAXATION:
|
||||
return coneConstraint->getRelaxationFactor();
|
||||
case PhysicsServer::CONE_TWIST_MAX:
|
||||
case PhysicsServer3D::CONE_TWIST_MAX:
|
||||
// Internal size value, nothing to do.
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -45,9 +45,9 @@ class ConeTwistJointBullet : public JointBullet {
|
|||
public:
|
||||
ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame);
|
||||
|
||||
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_CONE_TWIST; }
|
||||
virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_CONE_TWIST; }
|
||||
|
||||
void set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer::ConeTwistJointParam p_param) const;
|
||||
void set_param(PhysicsServer3D::ConeTwistJointParam p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer3D::ConeTwistJointParam p_param) const;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -118,62 +118,62 @@ void Generic6DOFJointBullet::set_angular_upper_limit(const Vector3 &angularUpper
|
|||
sixDOFConstraint->setAngularUpperLimit(btVec);
|
||||
}
|
||||
|
||||
void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value) {
|
||||
void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param, real_t p_value) {
|
||||
ERR_FAIL_INDEX(p_axis, 3);
|
||||
switch (p_param) {
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
|
||||
limits_lower[0][p_axis] = p_value;
|
||||
set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter
|
||||
set_flag(p_axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
|
||||
limits_upper[0][p_axis] = p_value;
|
||||
set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter
|
||||
set_flag(p_axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
|
||||
sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis] = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT:
|
||||
sixDOFConstraint->getTranslationalLimitMotor()->m_maxMotorForce.m_floats[p_axis] = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_DAMPING:
|
||||
sixDOFConstraint->getTranslationalLimitMotor()->m_springDamping.m_floats[p_axis] = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS:
|
||||
sixDOFConstraint->getTranslationalLimitMotor()->m_springStiffness.m_floats[p_axis] = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT:
|
||||
sixDOFConstraint->getTranslationalLimitMotor()->m_equilibriumPoint.m_floats[p_axis] = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
|
||||
limits_lower[1][p_axis] = p_value;
|
||||
set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter
|
||||
set_flag(p_axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
|
||||
limits_upper[1][p_axis] = p_value;
|
||||
set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter
|
||||
set_flag(p_axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION:
|
||||
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP:
|
||||
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY:
|
||||
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT:
|
||||
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxMotorForce = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS:
|
||||
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_springStiffness = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_DAMPING:
|
||||
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_springDamping = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT:
|
||||
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_equilibriumPoint = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_MAX:
|
||||
case PhysicsServer3D::G6DOF_JOINT_MAX:
|
||||
// Internal size value, nothing to do.
|
||||
break;
|
||||
default:
|
||||
|
@ -182,42 +182,42 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
|
|||
}
|
||||
}
|
||||
|
||||
real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param) const {
|
||||
real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param) const {
|
||||
ERR_FAIL_INDEX_V(p_axis, 3, 0.);
|
||||
switch (p_param) {
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
|
||||
return limits_lower[0][p_axis];
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
|
||||
return limits_upper[0][p_axis];
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
|
||||
return sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis];
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT:
|
||||
return sixDOFConstraint->getTranslationalLimitMotor()->m_maxMotorForce.m_floats[p_axis];
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_DAMPING:
|
||||
return sixDOFConstraint->getTranslationalLimitMotor()->m_springDamping.m_floats[p_axis];
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS:
|
||||
return sixDOFConstraint->getTranslationalLimitMotor()->m_springStiffness.m_floats[p_axis];
|
||||
case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT:
|
||||
return sixDOFConstraint->getTranslationalLimitMotor()->m_equilibriumPoint.m_floats[p_axis];
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
|
||||
return limits_lower[1][p_axis];
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
|
||||
return limits_upper[1][p_axis];
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION:
|
||||
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP:
|
||||
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY:
|
||||
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT:
|
||||
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxMotorForce;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS:
|
||||
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_springStiffness;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_DAMPING:
|
||||
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_springDamping;
|
||||
case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT:
|
||||
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_equilibriumPoint;
|
||||
case PhysicsServer::G6DOF_JOINT_MAX:
|
||||
case PhysicsServer3D::G6DOF_JOINT_MAX:
|
||||
// Internal size value, nothing to do.
|
||||
return 0;
|
||||
default:
|
||||
|
@ -226,45 +226,45 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
|
|||
}
|
||||
}
|
||||
|
||||
void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value) {
|
||||
void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag, bool p_value) {
|
||||
ERR_FAIL_INDEX(p_axis, 3);
|
||||
|
||||
flags[p_axis][p_flag] = p_value;
|
||||
|
||||
switch (p_flag) {
|
||||
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT:
|
||||
if (flags[p_axis][p_flag]) {
|
||||
sixDOFConstraint->setLimit(p_axis, limits_lower[0][p_axis], limits_upper[0][p_axis]);
|
||||
} else {
|
||||
sixDOFConstraint->setLimit(p_axis, 0, -1); // Free
|
||||
}
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT:
|
||||
case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT:
|
||||
if (flags[p_axis][p_flag]) {
|
||||
sixDOFConstraint->setLimit(p_axis + 3, limits_lower[1][p_axis], limits_upper[1][p_axis]);
|
||||
} else {
|
||||
sixDOFConstraint->setLimit(p_axis + 3, 0, -1); // Free
|
||||
}
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING:
|
||||
case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING:
|
||||
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableSpring = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING:
|
||||
case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING:
|
||||
sixDOFConstraint->getTranslationalLimitMotor()->m_enableSpring[p_axis] = p_value;
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR:
|
||||
case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_MOTOR:
|
||||
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor = flags[p_axis][p_flag];
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR:
|
||||
case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR:
|
||||
sixDOFConstraint->getTranslationalLimitMotor()->m_enableMotor[p_axis] = flags[p_axis][p_flag];
|
||||
break;
|
||||
case PhysicsServer::G6DOF_JOINT_FLAG_MAX:
|
||||
case PhysicsServer3D::G6DOF_JOINT_FLAG_MAX:
|
||||
// Internal size value, nothing to do.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool Generic6DOFJointBullet::get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag) const {
|
||||
bool Generic6DOFJointBullet::get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const {
|
||||
ERR_FAIL_INDEX_V(p_axis, 3, false);
|
||||
return flags[p_axis][p_flag];
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ class Generic6DOFJointBullet : public JointBullet {
|
|||
// First is linear second is angular
|
||||
Vector3 limits_lower[2];
|
||||
Vector3 limits_upper[2];
|
||||
bool flags[3][PhysicsServer::G6DOF_JOINT_FLAG_MAX];
|
||||
bool flags[3][PhysicsServer3D::G6DOF_JOINT_FLAG_MAX];
|
||||
|
||||
public:
|
||||
Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB);
|
||||
|
||||
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_6DOF; }
|
||||
virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_6DOF; }
|
||||
|
||||
Transform getFrameOffsetA() const;
|
||||
Transform getFrameOffsetB() const;
|
||||
|
@ -63,11 +63,11 @@ public:
|
|||
void set_angular_lower_limit(const Vector3 &angularLower);
|
||||
void set_angular_upper_limit(const Vector3 &angularUpper);
|
||||
|
||||
void set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value);
|
||||
real_t get_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param) const;
|
||||
void set_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param, real_t p_value);
|
||||
real_t get_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param) const;
|
||||
|
||||
void set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value);
|
||||
bool get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag) const;
|
||||
void set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag, bool p_value);
|
||||
bool get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const;
|
||||
|
||||
void set_precision(int p_precision);
|
||||
int get_precision() const;
|
||||
|
|
|
@ -107,7 +107,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo
|
|||
|
||||
CollisionObjectBullet *gObj = static_cast<CollisionObjectBullet *>(convexResult.m_hitCollisionObject->getUserPointer());
|
||||
|
||||
PhysicsDirectSpaceState::ShapeResult &result = m_results[count];
|
||||
PhysicsDirectSpaceState3D::ShapeResult &result = m_results[count];
|
||||
|
||||
result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
|
||||
result.rid = gObj->get_self();
|
||||
|
@ -207,7 +207,7 @@ btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, con
|
|||
|
||||
if (cp.getDistance() <= 0) {
|
||||
|
||||
PhysicsDirectSpaceState::ShapeResult &result = m_results[m_count];
|
||||
PhysicsDirectSpaceState3D::ShapeResult &result = m_results[m_count];
|
||||
// Penetrated
|
||||
|
||||
CollisionObjectBullet *colObj;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef GODOT_RESULT_CALLBACKS_H
|
||||
#define GODOT_RESULT_CALLBACKS_H
|
||||
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
|
||||
#include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h>
|
||||
#include <btBulletDynamicsCommon.h>
|
||||
|
@ -85,12 +85,12 @@ public:
|
|||
// store all colliding object
|
||||
struct GodotAllConvexResultCallback : public btCollisionWorld::ConvexResultCallback {
|
||||
public:
|
||||
PhysicsDirectSpaceState::ShapeResult *m_results;
|
||||
PhysicsDirectSpaceState3D::ShapeResult *m_results;
|
||||
int m_resultMax;
|
||||
const Set<RID> *m_exclude;
|
||||
int count;
|
||||
|
||||
GodotAllConvexResultCallback(PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) :
|
||||
GodotAllConvexResultCallback(PhysicsDirectSpaceState3D::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) :
|
||||
m_results(p_results),
|
||||
m_resultMax(p_resultMax),
|
||||
m_exclude(p_exclude),
|
||||
|
@ -137,7 +137,7 @@ public:
|
|||
struct GodotAllContactResultCallback : public btCollisionWorld::ContactResultCallback {
|
||||
public:
|
||||
const btCollisionObject *m_self_object;
|
||||
PhysicsDirectSpaceState::ShapeResult *m_results;
|
||||
PhysicsDirectSpaceState3D::ShapeResult *m_results;
|
||||
int m_resultMax;
|
||||
const Set<RID> *m_exclude;
|
||||
int m_count;
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
bool collide_with_bodies;
|
||||
bool collide_with_areas;
|
||||
|
||||
GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
||||
GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
||||
m_self_object(p_self_object),
|
||||
m_results(p_results),
|
||||
m_resultMax(p_resultMax),
|
||||
|
@ -188,7 +188,7 @@ public:
|
|||
struct GodotRestInfoContactResultCallback : public btCollisionWorld::ContactResultCallback {
|
||||
public:
|
||||
const btCollisionObject *m_self_object;
|
||||
PhysicsDirectSpaceState::ShapeRestInfo *m_result;
|
||||
PhysicsDirectSpaceState3D::ShapeRestInfo *m_result;
|
||||
const Set<RID> *m_exclude;
|
||||
bool m_collided;
|
||||
real_t m_min_distance;
|
||||
|
@ -197,7 +197,7 @@ public:
|
|||
bool collide_with_bodies;
|
||||
bool collide_with_areas;
|
||||
|
||||
GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeRestInfo *p_result, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
||||
GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeRestInfo *p_result, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
|
||||
m_self_object(p_self_object),
|
||||
m_result(p_result),
|
||||
m_exclude(p_exclude),
|
||||
|
|
|
@ -93,58 +93,58 @@ real_t HingeJointBullet::get_hinge_angle() {
|
|||
return hingeConstraint->getHingeAngle();
|
||||
}
|
||||
|
||||
void HingeJointBullet::set_param(PhysicsServer::HingeJointParam p_param, real_t p_value) {
|
||||
void HingeJointBullet::set_param(PhysicsServer3D::HingeJointParam p_param, real_t p_value) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::HINGE_JOINT_BIAS:
|
||||
case PhysicsServer3D::HINGE_JOINT_BIAS:
|
||||
WARN_DEPRECATED_MSG("The HingeJoint parameter \"bias\" is deprecated.");
|
||||
break;
|
||||
case PhysicsServer::HINGE_JOINT_LIMIT_UPPER:
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER:
|
||||
hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), p_value, hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor());
|
||||
break;
|
||||
case PhysicsServer::HINGE_JOINT_LIMIT_LOWER:
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER:
|
||||
hingeConstraint->setLimit(p_value, hingeConstraint->getUpperLimit(), hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor());
|
||||
break;
|
||||
case PhysicsServer::HINGE_JOINT_LIMIT_BIAS:
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS:
|
||||
hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), hingeConstraint->getUpperLimit(), hingeConstraint->getLimitSoftness(), p_value, hingeConstraint->getLimitRelaxationFactor());
|
||||
break;
|
||||
case PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS:
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS:
|
||||
hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), hingeConstraint->getUpperLimit(), p_value, hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor());
|
||||
break;
|
||||
case PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION:
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION:
|
||||
hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), hingeConstraint->getUpperLimit(), hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), p_value);
|
||||
break;
|
||||
case PhysicsServer::HINGE_JOINT_MOTOR_TARGET_VELOCITY:
|
||||
case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY:
|
||||
hingeConstraint->setMotorTargetVelocity(p_value);
|
||||
break;
|
||||
case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE:
|
||||
case PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE:
|
||||
hingeConstraint->setMaxMotorImpulse(p_value);
|
||||
break;
|
||||
case PhysicsServer::HINGE_JOINT_MAX:
|
||||
case PhysicsServer3D::HINGE_JOINT_MAX:
|
||||
// Internal size value, nothing to do.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
real_t HingeJointBullet::get_param(PhysicsServer::HingeJointParam p_param) const {
|
||||
real_t HingeJointBullet::get_param(PhysicsServer3D::HingeJointParam p_param) const {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::HINGE_JOINT_BIAS:
|
||||
case PhysicsServer3D::HINGE_JOINT_BIAS:
|
||||
WARN_DEPRECATED_MSG("The HingeJoint parameter \"bias\" is deprecated.");
|
||||
return 0;
|
||||
case PhysicsServer::HINGE_JOINT_LIMIT_UPPER:
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER:
|
||||
return hingeConstraint->getUpperLimit();
|
||||
case PhysicsServer::HINGE_JOINT_LIMIT_LOWER:
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER:
|
||||
return hingeConstraint->getLowerLimit();
|
||||
case PhysicsServer::HINGE_JOINT_LIMIT_BIAS:
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS:
|
||||
return hingeConstraint->getLimitBiasFactor();
|
||||
case PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS:
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS:
|
||||
return hingeConstraint->getLimitSoftness();
|
||||
case PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION:
|
||||
case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION:
|
||||
return hingeConstraint->getLimitRelaxationFactor();
|
||||
case PhysicsServer::HINGE_JOINT_MOTOR_TARGET_VELOCITY:
|
||||
case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY:
|
||||
return hingeConstraint->getMotorTargetVelocity();
|
||||
case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE:
|
||||
case PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE:
|
||||
return hingeConstraint->getMaxMotorImpulse();
|
||||
case PhysicsServer::HINGE_JOINT_MAX:
|
||||
case PhysicsServer3D::HINGE_JOINT_MAX:
|
||||
// Internal size value, nothing to do.
|
||||
return 0;
|
||||
}
|
||||
|
@ -152,25 +152,25 @@ real_t HingeJointBullet::get_param(PhysicsServer::HingeJointParam p_param) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
void HingeJointBullet::set_flag(PhysicsServer::HingeJointFlag p_flag, bool p_value) {
|
||||
void HingeJointBullet::set_flag(PhysicsServer3D::HingeJointFlag p_flag, bool p_value) {
|
||||
switch (p_flag) {
|
||||
case PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT:
|
||||
case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT:
|
||||
if (!p_value) {
|
||||
hingeConstraint->setLimit(-Math_PI, Math_PI);
|
||||
}
|
||||
break;
|
||||
case PhysicsServer::HINGE_JOINT_FLAG_ENABLE_MOTOR:
|
||||
case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR:
|
||||
hingeConstraint->enableMotor(p_value);
|
||||
break;
|
||||
case PhysicsServer::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
|
||||
case PhysicsServer3D::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
|
||||
}
|
||||
}
|
||||
|
||||
bool HingeJointBullet::get_flag(PhysicsServer::HingeJointFlag p_flag) const {
|
||||
bool HingeJointBullet::get_flag(PhysicsServer3D::HingeJointFlag p_flag) const {
|
||||
switch (p_flag) {
|
||||
case PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT:
|
||||
case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT:
|
||||
return true;
|
||||
case PhysicsServer::HINGE_JOINT_FLAG_ENABLE_MOTOR:
|
||||
case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR:
|
||||
return hingeConstraint->getEnableAngularMotor();
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -44,14 +44,14 @@ public:
|
|||
HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB);
|
||||
HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB);
|
||||
|
||||
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_HINGE; }
|
||||
virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_HINGE; }
|
||||
|
||||
real_t get_hinge_angle();
|
||||
|
||||
void set_param(PhysicsServer::HingeJointParam p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer::HingeJointParam p_param) const;
|
||||
void set_param(PhysicsServer3D::HingeJointParam p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer3D::HingeJointParam p_param) const;
|
||||
|
||||
void set_flag(PhysicsServer::HingeJointFlag p_flag, bool p_value);
|
||||
bool get_flag(PhysicsServer::HingeJointFlag p_flag) const;
|
||||
void set_flag(PhysicsServer3D::HingeJointFlag p_flag, bool p_value);
|
||||
bool get_flag(PhysicsServer3D::HingeJointFlag p_flag) const;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#define JOINT_BULLET_H
|
||||
|
||||
#include "constraint_bullet.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
|
||||
/**
|
||||
@author AndreaCatania
|
||||
|
@ -47,6 +47,6 @@ public:
|
|||
JointBullet();
|
||||
virtual ~JointBullet();
|
||||
|
||||
virtual PhysicsServer::JointType get_type() const = 0;
|
||||
virtual PhysicsServer3D::JointType get_type() const = 0;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -62,27 +62,27 @@ PinJointBullet::PinJointBullet(RigidBodyBullet *p_body_a, const Vector3 &p_pos_a
|
|||
|
||||
PinJointBullet::~PinJointBullet() {}
|
||||
|
||||
void PinJointBullet::set_param(PhysicsServer::PinJointParam p_param, real_t p_value) {
|
||||
void PinJointBullet::set_param(PhysicsServer3D::PinJointParam p_param, real_t p_value) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::PIN_JOINT_BIAS:
|
||||
case PhysicsServer3D::PIN_JOINT_BIAS:
|
||||
p2pConstraint->m_setting.m_tau = p_value;
|
||||
break;
|
||||
case PhysicsServer::PIN_JOINT_DAMPING:
|
||||
case PhysicsServer3D::PIN_JOINT_DAMPING:
|
||||
p2pConstraint->m_setting.m_damping = p_value;
|
||||
break;
|
||||
case PhysicsServer::PIN_JOINT_IMPULSE_CLAMP:
|
||||
case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP:
|
||||
p2pConstraint->m_setting.m_impulseClamp = p_value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
real_t PinJointBullet::get_param(PhysicsServer::PinJointParam p_param) const {
|
||||
real_t PinJointBullet::get_param(PhysicsServer3D::PinJointParam p_param) const {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::PIN_JOINT_BIAS:
|
||||
case PhysicsServer3D::PIN_JOINT_BIAS:
|
||||
return p2pConstraint->m_setting.m_tau;
|
||||
case PhysicsServer::PIN_JOINT_DAMPING:
|
||||
case PhysicsServer3D::PIN_JOINT_DAMPING:
|
||||
return p2pConstraint->m_setting.m_damping;
|
||||
case PhysicsServer::PIN_JOINT_IMPULSE_CLAMP:
|
||||
case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP:
|
||||
return p2pConstraint->m_setting.m_impulseClamp;
|
||||
}
|
||||
// Compiler doesn't seem to notice that all code paths are fulfilled...
|
||||
|
|
|
@ -46,10 +46,10 @@ public:
|
|||
PinJointBullet(RigidBodyBullet *p_body_a, const Vector3 &p_pos_a, RigidBodyBullet *p_body_b, const Vector3 &p_pos_b);
|
||||
~PinJointBullet();
|
||||
|
||||
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_PIN; }
|
||||
virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_PIN; }
|
||||
|
||||
void set_param(PhysicsServer::PinJointParam p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer::PinJointParam p_param) const;
|
||||
void set_param(PhysicsServer3D::PinJointParam p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer3D::PinJointParam p_param) const;
|
||||
|
||||
void setPivotInA(const Vector3 &p_pos);
|
||||
void setPivotInB(const Vector3 &p_pos);
|
||||
|
|
|
@ -39,15 +39,15 @@
|
|||
*/
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
PhysicsServer *_createBulletPhysicsCallback() {
|
||||
return memnew(BulletPhysicsServer);
|
||||
PhysicsServer3D *_createBulletPhysicsCallback() {
|
||||
return memnew(BulletPhysicsServer3D);
|
||||
}
|
||||
#endif
|
||||
|
||||
void register_bullet_types() {
|
||||
#ifndef _3D_DISABLED
|
||||
PhysicsServerManager::register_server("Bullet", &_createBulletPhysicsCallback);
|
||||
PhysicsServerManager::set_default_server("Bullet", 1);
|
||||
PhysicsServer3DManager::register_server("Bullet", &_createBulletPhysicsCallback);
|
||||
PhysicsServer3DManager::set_default_server("Bullet", 1);
|
||||
|
||||
GLOBAL_DEF("physics/3d/active_soft_world", true);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/active_soft_world", PropertyInfo(Variant::BOOL, "physics/3d/active_soft_world"));
|
||||
|
|
|
@ -37,17 +37,17 @@
|
|||
@author AndreaCatania
|
||||
*/
|
||||
|
||||
class BulletPhysicsServer;
|
||||
class BulletPhysicsServer3D;
|
||||
|
||||
class RIDBullet {
|
||||
RID self;
|
||||
BulletPhysicsServer *physicsServer;
|
||||
BulletPhysicsServer3D *physicsServer;
|
||||
|
||||
public:
|
||||
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }
|
||||
_FORCE_INLINE_ RID get_self() const { return self; }
|
||||
|
||||
_FORCE_INLINE_ void _set_physics_server(BulletPhysicsServer *p_physicsServer) { physicsServer = p_physicsServer; }
|
||||
_FORCE_INLINE_ BulletPhysicsServer *get_physics_server() const { return physicsServer; }
|
||||
_FORCE_INLINE_ void _set_physics_server(BulletPhysicsServer3D *p_physicsServer) { physicsServer = p_physicsServer; }
|
||||
_FORCE_INLINE_ BulletPhysicsServer3D *get_physics_server() const { return physicsServer; }
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -194,7 +194,7 @@ Vector3 BulletPhysicsDirectBodyState::get_contact_collider_velocity_at_position(
|
|||
return velocityAtPoint;
|
||||
}
|
||||
|
||||
PhysicsDirectSpaceState *BulletPhysicsDirectBodyState::get_space_state() {
|
||||
PhysicsDirectSpaceState3D *BulletPhysicsDirectBodyState::get_space_state() {
|
||||
return body->get_space()->get_direct_state();
|
||||
}
|
||||
|
||||
|
@ -231,12 +231,12 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() {
|
|||
shapes.write[i].transform = shape_wrapper->transform;
|
||||
shapes.write[i].transform.getOrigin() *= owner_scale;
|
||||
switch (shape_wrapper->shape->get_type()) {
|
||||
case PhysicsServer::SHAPE_SPHERE:
|
||||
case PhysicsServer::SHAPE_BOX:
|
||||
case PhysicsServer::SHAPE_CAPSULE:
|
||||
case PhysicsServer::SHAPE_CYLINDER:
|
||||
case PhysicsServer::SHAPE_CONVEX_POLYGON:
|
||||
case PhysicsServer::SHAPE_RAY: {
|
||||
case PhysicsServer3D::SHAPE_SPHERE:
|
||||
case PhysicsServer3D::SHAPE_BOX:
|
||||
case PhysicsServer3D::SHAPE_CAPSULE:
|
||||
case PhysicsServer3D::SHAPE_CYLINDER:
|
||||
case PhysicsServer3D::SHAPE_CONVEX_POLYGON:
|
||||
case PhysicsServer3D::SHAPE_RAY: {
|
||||
shapes.write[i].shape = static_cast<btConvexShape *>(shape_wrapper->shape->create_bt_shape(owner_scale * shape_wrapper->scale, safe_margin));
|
||||
} break;
|
||||
default:
|
||||
|
@ -286,7 +286,7 @@ RigidBodyBullet::RigidBodyBullet() :
|
|||
reload_shapes();
|
||||
setupBulletCollisionObject(btBody);
|
||||
|
||||
set_mode(PhysicsServer::BODY_MODE_RIGID);
|
||||
set_mode(PhysicsServer3D::BODY_MODE_RIGID);
|
||||
reload_axis_lock();
|
||||
|
||||
areasWhereIam.resize(maxAreasWhereIam);
|
||||
|
@ -487,29 +487,29 @@ void RigidBodyBullet::set_omit_forces_integration(bool p_omit) {
|
|||
omit_forces_integration = p_omit;
|
||||
}
|
||||
|
||||
void RigidBodyBullet::set_param(PhysicsServer::BodyParameter p_param, real_t p_value) {
|
||||
void RigidBodyBullet::set_param(PhysicsServer3D::BodyParameter p_param, real_t p_value) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::BODY_PARAM_BOUNCE:
|
||||
case PhysicsServer3D::BODY_PARAM_BOUNCE:
|
||||
btBody->setRestitution(p_value);
|
||||
break;
|
||||
case PhysicsServer::BODY_PARAM_FRICTION:
|
||||
case PhysicsServer3D::BODY_PARAM_FRICTION:
|
||||
btBody->setFriction(p_value);
|
||||
break;
|
||||
case PhysicsServer::BODY_PARAM_MASS: {
|
||||
case PhysicsServer3D::BODY_PARAM_MASS: {
|
||||
ERR_FAIL_COND(p_value < 0);
|
||||
mass = p_value;
|
||||
_internal_set_mass(p_value);
|
||||
break;
|
||||
}
|
||||
case PhysicsServer::BODY_PARAM_LINEAR_DAMP:
|
||||
case PhysicsServer3D::BODY_PARAM_LINEAR_DAMP:
|
||||
linearDamp = p_value;
|
||||
btBody->setDamping(linearDamp, angularDamp);
|
||||
break;
|
||||
case PhysicsServer::BODY_PARAM_ANGULAR_DAMP:
|
||||
case PhysicsServer3D::BODY_PARAM_ANGULAR_DAMP:
|
||||
angularDamp = p_value;
|
||||
btBody->setDamping(linearDamp, angularDamp);
|
||||
break;
|
||||
case PhysicsServer::BODY_PARAM_GRAVITY_SCALE:
|
||||
case PhysicsServer3D::BODY_PARAM_GRAVITY_SCALE:
|
||||
gravity_scale = p_value;
|
||||
/// The Bullet gravity will be is set by reload_space_override_modificator
|
||||
scratch_space_override_modificator();
|
||||
|
@ -519,21 +519,21 @@ void RigidBodyBullet::set_param(PhysicsServer::BodyParameter p_param, real_t p_v
|
|||
}
|
||||
}
|
||||
|
||||
real_t RigidBodyBullet::get_param(PhysicsServer::BodyParameter p_param) const {
|
||||
real_t RigidBodyBullet::get_param(PhysicsServer3D::BodyParameter p_param) const {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::BODY_PARAM_BOUNCE:
|
||||
case PhysicsServer3D::BODY_PARAM_BOUNCE:
|
||||
return btBody->getRestitution();
|
||||
case PhysicsServer::BODY_PARAM_FRICTION:
|
||||
case PhysicsServer3D::BODY_PARAM_FRICTION:
|
||||
return btBody->getFriction();
|
||||
case PhysicsServer::BODY_PARAM_MASS: {
|
||||
case PhysicsServer3D::BODY_PARAM_MASS: {
|
||||
const btScalar invMass = btBody->getInvMass();
|
||||
return 0 == invMass ? 0 : 1 / invMass;
|
||||
}
|
||||
case PhysicsServer::BODY_PARAM_LINEAR_DAMP:
|
||||
case PhysicsServer3D::BODY_PARAM_LINEAR_DAMP:
|
||||
return linearDamp;
|
||||
case PhysicsServer::BODY_PARAM_ANGULAR_DAMP:
|
||||
case PhysicsServer3D::BODY_PARAM_ANGULAR_DAMP:
|
||||
return angularDamp;
|
||||
case PhysicsServer::BODY_PARAM_GRAVITY_SCALE:
|
||||
case PhysicsServer3D::BODY_PARAM_GRAVITY_SCALE:
|
||||
return gravity_scale;
|
||||
default:
|
||||
WARN_PRINT("Parameter " + itos(p_param) + " not supported by bullet");
|
||||
|
@ -541,31 +541,31 @@ real_t RigidBodyBullet::get_param(PhysicsServer::BodyParameter p_param) const {
|
|||
}
|
||||
}
|
||||
|
||||
void RigidBodyBullet::set_mode(PhysicsServer::BodyMode p_mode) {
|
||||
void RigidBodyBullet::set_mode(PhysicsServer3D::BodyMode p_mode) {
|
||||
// This is necessary to block force_integration untile next move
|
||||
can_integrate_forces = false;
|
||||
destroy_kinematic_utilities();
|
||||
// The mode change is relevant to its mass
|
||||
switch (p_mode) {
|
||||
case PhysicsServer::BODY_MODE_KINEMATIC:
|
||||
mode = PhysicsServer::BODY_MODE_KINEMATIC;
|
||||
case PhysicsServer3D::BODY_MODE_KINEMATIC:
|
||||
mode = PhysicsServer3D::BODY_MODE_KINEMATIC;
|
||||
reload_axis_lock();
|
||||
_internal_set_mass(0);
|
||||
init_kinematic_utilities();
|
||||
break;
|
||||
case PhysicsServer::BODY_MODE_STATIC:
|
||||
mode = PhysicsServer::BODY_MODE_STATIC;
|
||||
case PhysicsServer3D::BODY_MODE_STATIC:
|
||||
mode = PhysicsServer3D::BODY_MODE_STATIC;
|
||||
reload_axis_lock();
|
||||
_internal_set_mass(0);
|
||||
break;
|
||||
case PhysicsServer::BODY_MODE_RIGID:
|
||||
mode = PhysicsServer::BODY_MODE_RIGID;
|
||||
case PhysicsServer3D::BODY_MODE_RIGID:
|
||||
mode = PhysicsServer3D::BODY_MODE_RIGID;
|
||||
reload_axis_lock();
|
||||
_internal_set_mass(0 == mass ? 1 : mass);
|
||||
scratch_space_override_modificator();
|
||||
break;
|
||||
case PhysicsServer::BODY_MODE_CHARACTER:
|
||||
mode = PhysicsServer::BODY_MODE_CHARACTER;
|
||||
case PhysicsServer3D::BODY_MODE_CHARACTER:
|
||||
mode = PhysicsServer3D::BODY_MODE_CHARACTER;
|
||||
reload_axis_lock();
|
||||
_internal_set_mass(0 == mass ? 1 : mass);
|
||||
scratch_space_override_modificator();
|
||||
|
@ -575,26 +575,26 @@ void RigidBodyBullet::set_mode(PhysicsServer::BodyMode p_mode) {
|
|||
btBody->setAngularVelocity(btVector3(0, 0, 0));
|
||||
btBody->setLinearVelocity(btVector3(0, 0, 0));
|
||||
}
|
||||
PhysicsServer::BodyMode RigidBodyBullet::get_mode() const {
|
||||
PhysicsServer3D::BodyMode RigidBodyBullet::get_mode() const {
|
||||
return mode;
|
||||
}
|
||||
|
||||
void RigidBodyBullet::set_state(PhysicsServer::BodyState p_state, const Variant &p_variant) {
|
||||
void RigidBodyBullet::set_state(PhysicsServer3D::BodyState p_state, const Variant &p_variant) {
|
||||
|
||||
switch (p_state) {
|
||||
case PhysicsServer::BODY_STATE_TRANSFORM:
|
||||
case PhysicsServer3D::BODY_STATE_TRANSFORM:
|
||||
set_transform(p_variant);
|
||||
break;
|
||||
case PhysicsServer::BODY_STATE_LINEAR_VELOCITY:
|
||||
case PhysicsServer3D::BODY_STATE_LINEAR_VELOCITY:
|
||||
set_linear_velocity(p_variant);
|
||||
break;
|
||||
case PhysicsServer::BODY_STATE_ANGULAR_VELOCITY:
|
||||
case PhysicsServer3D::BODY_STATE_ANGULAR_VELOCITY:
|
||||
set_angular_velocity(p_variant);
|
||||
break;
|
||||
case PhysicsServer::BODY_STATE_SLEEPING:
|
||||
case PhysicsServer3D::BODY_STATE_SLEEPING:
|
||||
set_activation_state(!bool(p_variant));
|
||||
break;
|
||||
case PhysicsServer::BODY_STATE_CAN_SLEEP:
|
||||
case PhysicsServer3D::BODY_STATE_CAN_SLEEP:
|
||||
can_sleep = bool(p_variant);
|
||||
if (!can_sleep) {
|
||||
// Can't sleep
|
||||
|
@ -606,17 +606,17 @@ void RigidBodyBullet::set_state(PhysicsServer::BodyState p_state, const Variant
|
|||
}
|
||||
}
|
||||
|
||||
Variant RigidBodyBullet::get_state(PhysicsServer::BodyState p_state) const {
|
||||
Variant RigidBodyBullet::get_state(PhysicsServer3D::BodyState p_state) const {
|
||||
switch (p_state) {
|
||||
case PhysicsServer::BODY_STATE_TRANSFORM:
|
||||
case PhysicsServer3D::BODY_STATE_TRANSFORM:
|
||||
return get_transform();
|
||||
case PhysicsServer::BODY_STATE_LINEAR_VELOCITY:
|
||||
case PhysicsServer3D::BODY_STATE_LINEAR_VELOCITY:
|
||||
return get_linear_velocity();
|
||||
case PhysicsServer::BODY_STATE_ANGULAR_VELOCITY:
|
||||
case PhysicsServer3D::BODY_STATE_ANGULAR_VELOCITY:
|
||||
return get_angular_velocity();
|
||||
case PhysicsServer::BODY_STATE_SLEEPING:
|
||||
case PhysicsServer3D::BODY_STATE_SLEEPING:
|
||||
return !is_active();
|
||||
case PhysicsServer::BODY_STATE_CAN_SLEEP:
|
||||
case PhysicsServer3D::BODY_STATE_CAN_SLEEP:
|
||||
return can_sleep;
|
||||
default:
|
||||
WARN_PRINT("This state " + itos(p_state) + " is not supported by Bullet");
|
||||
|
@ -714,7 +714,7 @@ Vector3 RigidBodyBullet::get_applied_torque() const {
|
|||
return gTotTorq;
|
||||
}
|
||||
|
||||
void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock) {
|
||||
void RigidBodyBullet::set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool lock) {
|
||||
if (lock) {
|
||||
locked_axis |= p_axis;
|
||||
} else {
|
||||
|
@ -724,18 +724,18 @@ void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock) {
|
|||
reload_axis_lock();
|
||||
}
|
||||
|
||||
bool RigidBodyBullet::is_axis_locked(PhysicsServer::BodyAxis p_axis) const {
|
||||
bool RigidBodyBullet::is_axis_locked(PhysicsServer3D::BodyAxis p_axis) const {
|
||||
return locked_axis & p_axis;
|
||||
}
|
||||
|
||||
void RigidBodyBullet::reload_axis_lock() {
|
||||
|
||||
btBody->setLinearFactor(btVector3(float(!is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_X)), float(!is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_Y)), float(!is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_Z))));
|
||||
if (PhysicsServer::BODY_MODE_CHARACTER == mode) {
|
||||
btBody->setLinearFactor(btVector3(float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_LINEAR_X)), float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_LINEAR_Y)), float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_LINEAR_Z))));
|
||||
if (PhysicsServer3D::BODY_MODE_CHARACTER == mode) {
|
||||
/// When character angular is always locked
|
||||
btBody->setAngularFactor(btVector3(0., 0., 0.));
|
||||
} else {
|
||||
btBody->setAngularFactor(btVector3(float(!is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_X)), float(!is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_Y)), float(!is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_Z))));
|
||||
btBody->setAngularFactor(btVector3(float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_ANGULAR_X)), float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_ANGULAR_Y)), float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_ANGULAR_Z))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -794,7 +794,7 @@ Vector3 RigidBodyBullet::get_angular_velocity() const {
|
|||
}
|
||||
|
||||
void RigidBodyBullet::set_transform__bullet(const btTransform &p_global_transform) {
|
||||
if (mode == PhysicsServer::BODY_MODE_KINEMATIC) {
|
||||
if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC) {
|
||||
if (space && space->get_delta_time() != 0)
|
||||
btBody->setLinearVelocity((p_global_transform.getOrigin() - btBody->getWorldTransform().getOrigin()) / space->get_delta_time());
|
||||
// The kinematic use MotionState class
|
||||
|
@ -862,7 +862,7 @@ void RigidBodyBullet::on_enter_area(AreaBullet *p_area) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) {
|
||||
if (PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) {
|
||||
scratch_space_override_modificator();
|
||||
}
|
||||
|
||||
|
@ -895,7 +895,7 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) {
|
|||
|
||||
--areaWhereIamCount;
|
||||
areasWhereIam.write[areaWhereIamCount] = NULL; // Even if this is not required, I clear the last element to be safe
|
||||
if (PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) {
|
||||
if (PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) {
|
||||
scratch_space_override_modificator();
|
||||
}
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) {
|
|||
void RigidBodyBullet::reload_space_override_modificator() {
|
||||
|
||||
// Make sure that kinematic bodies have their total gravity calculated
|
||||
if (!is_active() && PhysicsServer::BODY_MODE_KINEMATIC != mode)
|
||||
if (!is_active() && PhysicsServer3D::BODY_MODE_KINEMATIC != mode)
|
||||
return;
|
||||
|
||||
Vector3 newGravity(space->get_gravity_direction() * space->get_gravity_magnitude());
|
||||
|
@ -920,7 +920,7 @@ void RigidBodyBullet::reload_space_override_modificator() {
|
|||
|
||||
currentArea = areasWhereIam[i];
|
||||
|
||||
if (!currentArea || PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED == currentArea->get_spOv_mode()) {
|
||||
if (!currentArea || PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED == currentArea->get_spOv_mode()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -954,11 +954,11 @@ void RigidBodyBullet::reload_space_override_modificator() {
|
|||
}
|
||||
|
||||
switch (currentArea->get_spOv_mode()) {
|
||||
case PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED:
|
||||
case PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED:
|
||||
/// This area does not affect gravity/damp. These are generally areas
|
||||
/// that exist only to detect collisions, and objects entering or exiting them.
|
||||
break;
|
||||
case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE:
|
||||
case PhysicsServer3D::AREA_SPACE_OVERRIDE_COMBINE:
|
||||
/// This area adds its gravity/damp values to whatever has been
|
||||
/// calculated so far. This way, many overlapping areas can combine
|
||||
/// their physics to make interesting
|
||||
|
@ -967,7 +967,7 @@ void RigidBodyBullet::reload_space_override_modificator() {
|
|||
newAngularDamp += currentArea->get_spOv_angularDamp();
|
||||
++countCombined;
|
||||
break;
|
||||
case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE:
|
||||
case PhysicsServer3D::AREA_SPACE_OVERRIDE_COMBINE_REPLACE:
|
||||
/// This area adds its gravity/damp values to whatever has been calculated
|
||||
/// so far. Then stops taking into account the rest of the areas, even the
|
||||
/// default one.
|
||||
|
@ -976,7 +976,7 @@ void RigidBodyBullet::reload_space_override_modificator() {
|
|||
newAngularDamp += currentArea->get_spOv_angularDamp();
|
||||
++countCombined;
|
||||
goto endAreasCycle;
|
||||
case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE:
|
||||
case PhysicsServer3D::AREA_SPACE_OVERRIDE_REPLACE:
|
||||
/// This area replaces any gravity/damp, even the default one, and
|
||||
/// stops taking into account the rest of the areas.
|
||||
newGravity = support_gravity;
|
||||
|
@ -984,7 +984,7 @@ void RigidBodyBullet::reload_space_override_modificator() {
|
|||
newAngularDamp = currentArea->get_spOv_angularDamp();
|
||||
countCombined = 1;
|
||||
goto endAreasCycle;
|
||||
case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE_COMBINE:
|
||||
case PhysicsServer3D::AREA_SPACE_OVERRIDE_REPLACE_COMBINE:
|
||||
/// This area replaces any gravity/damp calculated so far, but keeps
|
||||
/// calculating the rest of the areas, down to the default one.
|
||||
newGravity = support_gravity;
|
||||
|
@ -1032,14 +1032,14 @@ void RigidBodyBullet::_internal_set_mass(real_t p_mass) {
|
|||
const bool isDynamic = p_mass != 0.f;
|
||||
if (isDynamic) {
|
||||
|
||||
if (PhysicsServer::BODY_MODE_RIGID != mode && PhysicsServer::BODY_MODE_CHARACTER != mode)
|
||||
if (PhysicsServer3D::BODY_MODE_RIGID != mode && PhysicsServer3D::BODY_MODE_CHARACTER != mode)
|
||||
return;
|
||||
|
||||
m_isStatic = false;
|
||||
if (mainShape)
|
||||
mainShape->calculateLocalInertia(p_mass, localInertia);
|
||||
|
||||
if (PhysicsServer::BODY_MODE_RIGID == mode) {
|
||||
if (PhysicsServer3D::BODY_MODE_RIGID == mode) {
|
||||
|
||||
btBody->setCollisionFlags(clearedCurrentFlags); // Just set the flags without Kin and Static
|
||||
} else {
|
||||
|
@ -1054,11 +1054,11 @@ void RigidBodyBullet::_internal_set_mass(real_t p_mass) {
|
|||
}
|
||||
} else {
|
||||
|
||||
if (PhysicsServer::BODY_MODE_STATIC != mode && PhysicsServer::BODY_MODE_KINEMATIC != mode)
|
||||
if (PhysicsServer3D::BODY_MODE_STATIC != mode && PhysicsServer3D::BODY_MODE_KINEMATIC != mode)
|
||||
return;
|
||||
|
||||
m_isStatic = true;
|
||||
if (PhysicsServer::BODY_MODE_STATIC == mode) {
|
||||
if (PhysicsServer3D::BODY_MODE_STATIC == mode) {
|
||||
|
||||
btBody->setCollisionFlags(clearedCurrentFlags | btCollisionObject::CF_STATIC_OBJECT);
|
||||
} else {
|
||||
|
|
|
@ -51,10 +51,10 @@ class BulletPhysicsDirectBodyState;
|
|||
/// is set to be only in one single thread.
|
||||
///
|
||||
/// In the system there is only one object at a time that manage all bodies and is
|
||||
/// created by BulletPhysicsServer and is held by the "singleton" variable of this class
|
||||
/// created by BulletPhysicsServer3D and is held by the "singleton" variable of this class
|
||||
/// Each time something require it, the body must be set again.
|
||||
class BulletPhysicsDirectBodyState : public PhysicsDirectBodyState {
|
||||
GDCLASS(BulletPhysicsDirectBodyState, PhysicsDirectBodyState);
|
||||
class BulletPhysicsDirectBodyState : public PhysicsDirectBodyState3D {
|
||||
GDCLASS(BulletPhysicsDirectBodyState, PhysicsDirectBodyState3D);
|
||||
|
||||
static BulletPhysicsDirectBodyState *singleton;
|
||||
|
||||
|
@ -138,7 +138,7 @@ public:
|
|||
// Skip the execution of this function
|
||||
}
|
||||
|
||||
virtual PhysicsDirectSpaceState *get_space_state();
|
||||
virtual PhysicsDirectSpaceState3D *get_space_state();
|
||||
};
|
||||
|
||||
class RigidBodyBullet : public RigidCollisionObjectBullet {
|
||||
|
@ -192,7 +192,7 @@ private:
|
|||
// This is required only for Kinematic movement
|
||||
KinematicUtilities *kinematic_utilities;
|
||||
|
||||
PhysicsServer::BodyMode mode;
|
||||
PhysicsServer3D::BodyMode mode;
|
||||
GodotMotionState *godotMotionState;
|
||||
btRigidBody *btBody;
|
||||
uint16_t locked_axis;
|
||||
|
@ -278,14 +278,14 @@ public:
|
|||
void set_omit_forces_integration(bool p_omit);
|
||||
_FORCE_INLINE_ bool get_omit_forces_integration() const { return omit_forces_integration; }
|
||||
|
||||
void set_param(PhysicsServer::BodyParameter p_param, real_t);
|
||||
real_t get_param(PhysicsServer::BodyParameter p_param) const;
|
||||
void set_param(PhysicsServer3D::BodyParameter p_param, real_t);
|
||||
real_t get_param(PhysicsServer3D::BodyParameter p_param) const;
|
||||
|
||||
void set_mode(PhysicsServer::BodyMode p_mode);
|
||||
PhysicsServer::BodyMode get_mode() const;
|
||||
void set_mode(PhysicsServer3D::BodyMode p_mode);
|
||||
PhysicsServer3D::BodyMode get_mode() const;
|
||||
|
||||
void set_state(PhysicsServer::BodyState p_state, const Variant &p_variant);
|
||||
Variant get_state(PhysicsServer::BodyState p_state) const;
|
||||
void set_state(PhysicsServer3D::BodyState p_state, const Variant &p_variant);
|
||||
Variant get_state(PhysicsServer3D::BodyState p_state) const;
|
||||
|
||||
void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse);
|
||||
void apply_central_impulse(const Vector3 &p_impulse);
|
||||
|
@ -300,8 +300,8 @@ public:
|
|||
void set_applied_torque(const Vector3 &p_torque);
|
||||
Vector3 get_applied_torque() const;
|
||||
|
||||
void set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock);
|
||||
bool is_axis_locked(PhysicsServer::BodyAxis p_axis) const;
|
||||
void set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool lock);
|
||||
bool is_axis_locked(PhysicsServer3D::BodyAxis p_axis) const;
|
||||
void reload_axis_lock();
|
||||
|
||||
/// Doc:
|
||||
|
|
|
@ -150,7 +150,7 @@ btHeightfieldTerrainShape *ShapeBullet::create_shape_height_field(Vector<real_t>
|
|||
|
||||
btHeightfieldTerrainShape *heightfield = bulletnew(btHeightfieldTerrainShape(p_width, p_depth, heightsPtr, ignoredHeightScale, p_min_height, p_max_height, YAxis, PHY_FLOAT, flipQuadEdges));
|
||||
|
||||
// The shape can be created without params when you do PhysicsServer.shape_create(PhysicsServer.SHAPE_HEIGHTMAP)
|
||||
// The shape can be created without params when you do PhysicsServer3D.shape_create(PhysicsServer3D.SHAPE_HEIGHTMAP)
|
||||
if (heightsPtr)
|
||||
heightfield->buildAccelerator(16);
|
||||
|
||||
|
@ -176,8 +176,8 @@ Variant PlaneShapeBullet::get_data() const {
|
|||
return plane;
|
||||
}
|
||||
|
||||
PhysicsServer::ShapeType PlaneShapeBullet::get_type() const {
|
||||
return PhysicsServer::SHAPE_PLANE;
|
||||
PhysicsServer3D::ShapeType PlaneShapeBullet::get_type() const {
|
||||
return PhysicsServer3D::SHAPE_PLANE;
|
||||
}
|
||||
|
||||
void PlaneShapeBullet::setup(const Plane &p_plane) {
|
||||
|
@ -204,8 +204,8 @@ Variant SphereShapeBullet::get_data() const {
|
|||
return radius;
|
||||
}
|
||||
|
||||
PhysicsServer::ShapeType SphereShapeBullet::get_type() const {
|
||||
return PhysicsServer::SHAPE_SPHERE;
|
||||
PhysicsServer3D::ShapeType SphereShapeBullet::get_type() const {
|
||||
return PhysicsServer3D::SHAPE_SPHERE;
|
||||
}
|
||||
|
||||
void SphereShapeBullet::setup(real_t p_radius) {
|
||||
|
@ -231,8 +231,8 @@ Variant BoxShapeBullet::get_data() const {
|
|||
return g_half_extents;
|
||||
}
|
||||
|
||||
PhysicsServer::ShapeType BoxShapeBullet::get_type() const {
|
||||
return PhysicsServer::SHAPE_BOX;
|
||||
PhysicsServer3D::ShapeType BoxShapeBullet::get_type() const {
|
||||
return PhysicsServer3D::SHAPE_BOX;
|
||||
}
|
||||
|
||||
void BoxShapeBullet::setup(const Vector3 &p_half_extents) {
|
||||
|
@ -263,8 +263,8 @@ Variant CapsuleShapeBullet::get_data() const {
|
|||
return d;
|
||||
}
|
||||
|
||||
PhysicsServer::ShapeType CapsuleShapeBullet::get_type() const {
|
||||
return PhysicsServer::SHAPE_CAPSULE;
|
||||
PhysicsServer3D::ShapeType CapsuleShapeBullet::get_type() const {
|
||||
return PhysicsServer3D::SHAPE_CAPSULE;
|
||||
}
|
||||
|
||||
void CapsuleShapeBullet::setup(real_t p_height, real_t p_radius) {
|
||||
|
@ -296,8 +296,8 @@ Variant CylinderShapeBullet::get_data() const {
|
|||
return d;
|
||||
}
|
||||
|
||||
PhysicsServer::ShapeType CylinderShapeBullet::get_type() const {
|
||||
return PhysicsServer::SHAPE_CYLINDER;
|
||||
PhysicsServer3D::ShapeType CylinderShapeBullet::get_type() const {
|
||||
return PhysicsServer3D::SHAPE_CYLINDER;
|
||||
}
|
||||
|
||||
void CylinderShapeBullet::setup(real_t p_height, real_t p_radius) {
|
||||
|
@ -334,8 +334,8 @@ Variant ConvexPolygonShapeBullet::get_data() const {
|
|||
return out_vertices;
|
||||
}
|
||||
|
||||
PhysicsServer::ShapeType ConvexPolygonShapeBullet::get_type() const {
|
||||
return PhysicsServer::SHAPE_CONVEX_POLYGON;
|
||||
PhysicsServer3D::ShapeType ConvexPolygonShapeBullet::get_type() const {
|
||||
return PhysicsServer3D::SHAPE_CONVEX_POLYGON;
|
||||
}
|
||||
|
||||
void ConvexPolygonShapeBullet::setup(const Vector<Vector3> &p_vertices) {
|
||||
|
@ -381,8 +381,8 @@ Variant ConcavePolygonShapeBullet::get_data() const {
|
|||
return faces;
|
||||
}
|
||||
|
||||
PhysicsServer::ShapeType ConcavePolygonShapeBullet::get_type() const {
|
||||
return PhysicsServer::SHAPE_CONCAVE_POLYGON;
|
||||
PhysicsServer3D::ShapeType ConcavePolygonShapeBullet::get_type() const {
|
||||
return PhysicsServer3D::SHAPE_CONCAVE_POLYGON;
|
||||
}
|
||||
|
||||
void ConcavePolygonShapeBullet::setup(Vector<Vector3> p_faces) {
|
||||
|
@ -536,8 +536,8 @@ Variant HeightMapShapeBullet::get_data() const {
|
|||
ERR_FAIL_V(Variant());
|
||||
}
|
||||
|
||||
PhysicsServer::ShapeType HeightMapShapeBullet::get_type() const {
|
||||
return PhysicsServer::SHAPE_HEIGHTMAP;
|
||||
PhysicsServer3D::ShapeType HeightMapShapeBullet::get_type() const {
|
||||
return PhysicsServer3D::SHAPE_HEIGHTMAP;
|
||||
}
|
||||
|
||||
void HeightMapShapeBullet::setup(Vector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height) {
|
||||
|
@ -580,8 +580,8 @@ Variant RayShapeBullet::get_data() const {
|
|||
return d;
|
||||
}
|
||||
|
||||
PhysicsServer::ShapeType RayShapeBullet::get_type() const {
|
||||
return PhysicsServer::SHAPE_RAY;
|
||||
PhysicsServer3D::ShapeType RayShapeBullet::get_type() const {
|
||||
return PhysicsServer3D::SHAPE_RAY;
|
||||
}
|
||||
|
||||
void RayShapeBullet::setup(real_t p_length, bool p_slips_on_slope) {
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "core/math/geometry.h"
|
||||
#include "core/variant.h"
|
||||
#include "rid_bullet.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
|
||||
#include <LinearMath/btAlignedObjectArray.h>
|
||||
#include <LinearMath/btScalar.h>
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
virtual void set_data(const Variant &p_data) = 0;
|
||||
virtual Variant get_data() const = 0;
|
||||
|
||||
virtual PhysicsServer::ShapeType get_type() const = 0;
|
||||
virtual PhysicsServer3D::ShapeType get_type() const = 0;
|
||||
|
||||
public:
|
||||
static class btEmptyShape *create_shape_empty();
|
||||
|
@ -103,7 +103,7 @@ public:
|
|||
|
||||
virtual void set_data(const Variant &p_data);
|
||||
virtual Variant get_data() const;
|
||||
virtual PhysicsServer::ShapeType get_type() const;
|
||||
virtual PhysicsServer3D::ShapeType get_type() const;
|
||||
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0);
|
||||
|
||||
private:
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
_FORCE_INLINE_ real_t get_radius() { return radius; }
|
||||
virtual void set_data(const Variant &p_data);
|
||||
virtual Variant get_data() const;
|
||||
virtual PhysicsServer::ShapeType get_type() const;
|
||||
virtual PhysicsServer3D::ShapeType get_type() const;
|
||||
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0);
|
||||
|
||||
private:
|
||||
|
@ -137,7 +137,7 @@ public:
|
|||
_FORCE_INLINE_ const btVector3 &get_half_extents() { return half_extents; }
|
||||
virtual void set_data(const Variant &p_data);
|
||||
virtual Variant get_data() const;
|
||||
virtual PhysicsServer::ShapeType get_type() const;
|
||||
virtual PhysicsServer3D::ShapeType get_type() const;
|
||||
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0);
|
||||
|
||||
private:
|
||||
|
@ -156,7 +156,7 @@ public:
|
|||
_FORCE_INLINE_ real_t get_radius() { return radius; }
|
||||
virtual void set_data(const Variant &p_data);
|
||||
virtual Variant get_data() const;
|
||||
virtual PhysicsServer::ShapeType get_type() const;
|
||||
virtual PhysicsServer3D::ShapeType get_type() const;
|
||||
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0);
|
||||
|
||||
private:
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
_FORCE_INLINE_ real_t get_radius() { return radius; }
|
||||
virtual void set_data(const Variant &p_data);
|
||||
virtual Variant get_data() const;
|
||||
virtual PhysicsServer::ShapeType get_type() const;
|
||||
virtual PhysicsServer3D::ShapeType get_type() const;
|
||||
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_margin = 0);
|
||||
|
||||
private:
|
||||
|
@ -192,7 +192,7 @@ public:
|
|||
virtual void set_data(const Variant &p_data);
|
||||
void get_vertices(Vector<Vector3> &out_vertices);
|
||||
virtual Variant get_data() const;
|
||||
virtual PhysicsServer::ShapeType get_type() const;
|
||||
virtual PhysicsServer3D::ShapeType get_type() const;
|
||||
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0);
|
||||
|
||||
private:
|
||||
|
@ -210,7 +210,7 @@ public:
|
|||
|
||||
virtual void set_data(const Variant &p_data);
|
||||
virtual Variant get_data() const;
|
||||
virtual PhysicsServer::ShapeType get_type() const;
|
||||
virtual PhysicsServer3D::ShapeType get_type() const;
|
||||
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0);
|
||||
|
||||
private:
|
||||
|
@ -230,7 +230,7 @@ public:
|
|||
|
||||
virtual void set_data(const Variant &p_data);
|
||||
virtual Variant get_data() const;
|
||||
virtual PhysicsServer::ShapeType get_type() const;
|
||||
virtual PhysicsServer3D::ShapeType get_type() const;
|
||||
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0);
|
||||
|
||||
private:
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
|
||||
virtual void set_data(const Variant &p_data);
|
||||
virtual Variant get_data() const;
|
||||
virtual PhysicsServer::ShapeType get_type() const;
|
||||
virtual PhysicsServer3D::ShapeType get_type() const;
|
||||
virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0);
|
||||
|
||||
private:
|
||||
|
|
|
@ -342,58 +342,58 @@ real_t SliderJointBullet::getLinearPos() {
|
|||
;
|
||||
}
|
||||
|
||||
void SliderJointBullet::set_param(PhysicsServer::SliderJointParam p_param, real_t p_value) {
|
||||
void SliderJointBullet::set_param(PhysicsServer3D::SliderJointParam p_param, real_t p_value) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER: setUpperLinLimit(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER: setLowerLinLimit(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: setSoftnessLimLin(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: setRestitutionLimLin(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: setDampingLimLin(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: setSoftnessDirLin(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: setRestitutionDirLin(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_DAMPING: setDampingDirLin(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: setSoftnessOrthoLin(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: setRestitutionOrthoLin(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: setDampingOrthoLin(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: setUpperAngLimit(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: setLowerAngLimit(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: setSoftnessLimAng(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: setRestitutionLimAng(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: setDampingLimAng(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: setSoftnessDirAng(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: setRestitutionDirAng(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: setDampingDirAng(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: setSoftnessOrthoAng(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: setRestitutionOrthoAng(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: setDampingOrthoAng(p_value); break;
|
||||
case PhysicsServer::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER: setUpperLinLimit(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER: setLowerLinLimit(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: setSoftnessLimLin(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: setRestitutionLimLin(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: setDampingLimLin(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: setSoftnessDirLin(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: setRestitutionDirLin(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: setDampingDirLin(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: setSoftnessOrthoLin(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: setRestitutionOrthoLin(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: setDampingOrthoLin(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: setUpperAngLimit(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: setLowerAngLimit(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: setSoftnessLimAng(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: setRestitutionLimAng(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: setDampingLimAng(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: setSoftnessDirAng(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: setRestitutionDirAng(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: setDampingDirAng(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: setSoftnessOrthoAng(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: setRestitutionOrthoAng(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: setDampingOrthoAng(p_value); break;
|
||||
case PhysicsServer3D::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning
|
||||
}
|
||||
}
|
||||
|
||||
real_t SliderJointBullet::get_param(PhysicsServer::SliderJointParam p_param) const {
|
||||
real_t SliderJointBullet::get_param(PhysicsServer3D::SliderJointParam p_param) const {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER: return getUpperLinLimit();
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER: return getLowerLinLimit();
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: return getSoftnessLimLin();
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: return getRestitutionLimLin();
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: return getDampingLimLin();
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: return getSoftnessDirLin();
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: return getRestitutionDirLin();
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_DAMPING: return getDampingDirLin();
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: return getSoftnessOrthoLin();
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: return getRestitutionOrthoLin();
|
||||
case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: return getDampingOrthoLin();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: return getUpperAngLimit();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: return getLowerAngLimit();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: return getSoftnessLimAng();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: return getRestitutionLimAng();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: return getDampingLimAng();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: return getSoftnessDirAng();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: return getRestitutionDirAng();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: return getDampingDirAng();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: return getSoftnessOrthoAng();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: return getRestitutionOrthoAng();
|
||||
case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: return getDampingOrthoAng();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER: return getUpperLinLimit();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER: return getLowerLinLimit();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: return getSoftnessLimLin();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: return getRestitutionLimLin();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: return getDampingLimLin();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: return getSoftnessDirLin();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: return getRestitutionDirLin();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: return getDampingDirLin();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: return getSoftnessOrthoLin();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: return getRestitutionOrthoLin();
|
||||
case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: return getDampingOrthoLin();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: return getUpperAngLimit();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: return getLowerAngLimit();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: return getSoftnessLimAng();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: return getRestitutionLimAng();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: return getDampingLimAng();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: return getSoftnessDirAng();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: return getRestitutionDirAng();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: return getDampingDirAng();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: return getSoftnessOrthoAng();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: return getRestitutionOrthoAng();
|
||||
case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: return getDampingOrthoAng();
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
/// Reference frame is A
|
||||
SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB);
|
||||
|
||||
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_SLIDER; }
|
||||
virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_SLIDER; }
|
||||
|
||||
const RigidBodyBullet *getRigidBodyA() const;
|
||||
const RigidBodyBullet *getRigidBodyB() const;
|
||||
|
@ -115,7 +115,7 @@ public:
|
|||
real_t getMaxAngMotorForce();
|
||||
real_t getLinearPos();
|
||||
|
||||
void set_param(PhysicsServer::SliderJointParam p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer::SliderJointParam p_param) const;
|
||||
void set_param(PhysicsServer3D::SliderJointParam p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer3D::SliderJointParam p_param) const;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -76,7 +76,7 @@ void SoftBodyBullet::on_enter_area(AreaBullet *p_area) {}
|
|||
|
||||
void SoftBodyBullet::on_exit_area(AreaBullet *p_area) {}
|
||||
|
||||
void SoftBodyBullet::update_visual_server(SoftBodyVisualServerHandler *p_visual_server_handler) {
|
||||
void SoftBodyBullet::update_rendering_server(SoftBodyRenderingServerHandler *p_rendering_server_handler) {
|
||||
if (!bt_soft_body)
|
||||
return;
|
||||
|
||||
|
@ -96,8 +96,8 @@ void SoftBodyBullet::update_visual_server(SoftBodyVisualServerHandler *p_visual_
|
|||
|
||||
const int vs_indices_size(vs_indices->size());
|
||||
for (int x = 0; x < vs_indices_size; ++x) {
|
||||
p_visual_server_handler->set_vertex((*vs_indices)[x], vertex_position);
|
||||
p_visual_server_handler->set_normal((*vs_indices)[x], vertex_normal);
|
||||
p_rendering_server_handler->set_vertex((*vs_indices)[x], vertex_position);
|
||||
p_rendering_server_handler->set_normal((*vs_indices)[x], vertex_normal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ void SoftBodyBullet::update_visual_server(SoftBodyVisualServerHandler *p_visual_
|
|||
B_TO_G(aabb_min, aabb.position);
|
||||
B_TO_G(size, aabb.size);
|
||||
|
||||
p_visual_server_handler->set_aabb(aabb);
|
||||
p_rendering_server_handler->set_aabb(aabb);
|
||||
}
|
||||
|
||||
void SoftBodyBullet::set_soft_mesh(const Ref<Mesh> &p_mesh) {
|
||||
|
@ -129,8 +129,8 @@ void SoftBodyBullet::set_soft_mesh(const Ref<Mesh> &p_mesh) {
|
|||
}
|
||||
|
||||
Array arrays = soft_mesh->surface_get_arrays(0);
|
||||
ERR_FAIL_COND(!(soft_mesh->surface_get_format(0) & VS::ARRAY_FORMAT_INDEX));
|
||||
set_trimesh_body_shape(arrays[VS::ARRAY_INDEX], arrays[VS::ARRAY_VERTEX]);
|
||||
ERR_FAIL_COND(!(soft_mesh->surface_get_format(0) & RS::ARRAY_FORMAT_INDEX));
|
||||
set_trimesh_body_shape(arrays[RS::ARRAY_INDEX], arrays[RS::ARRAY_VERTEX]);
|
||||
}
|
||||
|
||||
void SoftBodyBullet::destroy_soft_body() {
|
||||
|
@ -184,7 +184,7 @@ void SoftBodyBullet::get_node_offset(int p_node_index, Vector3 &r_offset) const
|
|||
return;
|
||||
|
||||
Array arrays = soft_mesh->surface_get_arrays(0);
|
||||
Vector<Vector3> vertices(arrays[VS::ARRAY_VERTEX]);
|
||||
Vector<Vector3> vertices(arrays[RS::ARRAY_VERTEX]);
|
||||
|
||||
if (0 <= p_node_index && vertices.size() > p_node_index) {
|
||||
r_offset = vertices[p_node_index];
|
||||
|
@ -230,7 +230,7 @@ void SoftBodyBullet::reset_all_node_positions() {
|
|||
return;
|
||||
|
||||
Array arrays = soft_mesh->surface_get_arrays(0);
|
||||
Vector<Vector3> vs_vertices(arrays[VS::ARRAY_VERTEX]);
|
||||
Vector<Vector3> vs_vertices(arrays[RS::ARRAY_VERTEX]);
|
||||
const Vector3 *vs_vertices_read = vs_vertices.ptr();
|
||||
|
||||
for (int vertex_index = bt_soft_body->m_nodes.size() - 1; 0 <= vertex_index; --vertex_index) {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "BulletSoftBody/btSoftBodyHelpers.h"
|
||||
#include "collision_object_bullet.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
|
||||
#ifdef x11_None
|
||||
/// This is required to re add the macro None defined by x11 compiler
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
|
||||
_FORCE_INLINE_ btSoftBody *get_bt_soft_body() const { return bt_soft_body; }
|
||||
|
||||
void update_visual_server(class SoftBodyVisualServerHandler *p_visual_server_handler);
|
||||
void update_rendering_server(class SoftBodyRenderingServerHandler *p_rendering_server_handler);
|
||||
|
||||
void set_soft_mesh(const Ref<Mesh> &p_mesh);
|
||||
void destroy_soft_body();
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "godot_collision_configuration.h"
|
||||
#include "godot_collision_dispatcher.h"
|
||||
#include "rigid_body_bullet.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
#include "soft_body_bullet.h"
|
||||
|
||||
#include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h>
|
||||
|
@ -59,7 +59,7 @@
|
|||
*/
|
||||
|
||||
BulletPhysicsDirectSpaceState::BulletPhysicsDirectSpaceState(SpaceBullet *p_space) :
|
||||
PhysicsDirectSpaceState(),
|
||||
PhysicsDirectSpaceState3D(),
|
||||
space(p_space) {}
|
||||
|
||||
int BulletPhysicsDirectSpaceState::intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
|
||||
|
@ -366,27 +366,27 @@ void SpaceBullet::step(real_t p_delta_time) {
|
|||
dynamicsWorld->stepSimulation(p_delta_time, 0, 0);
|
||||
}
|
||||
|
||||
void SpaceBullet::set_param(PhysicsServer::AreaParameter p_param, const Variant &p_value) {
|
||||
void SpaceBullet::set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value) {
|
||||
assert(dynamicsWorld);
|
||||
|
||||
switch (p_param) {
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY:
|
||||
gravityMagnitude = p_value;
|
||||
update_gravity();
|
||||
break;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_VECTOR:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR:
|
||||
gravityDirection = p_value;
|
||||
update_gravity();
|
||||
break;
|
||||
case PhysicsServer::AREA_PARAM_LINEAR_DAMP:
|
||||
case PhysicsServer::AREA_PARAM_ANGULAR_DAMP:
|
||||
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP:
|
||||
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP:
|
||||
break; // No damp
|
||||
case PhysicsServer::AREA_PARAM_PRIORITY:
|
||||
case PhysicsServer3D::AREA_PARAM_PRIORITY:
|
||||
// Priority is always 0, the lower
|
||||
break;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT:
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
|
||||
break;
|
||||
default:
|
||||
WARN_PRINT("This set parameter (" + itos(p_param) + ") is ignored, the SpaceBullet doesn't support it.");
|
||||
|
@ -394,22 +394,22 @@ void SpaceBullet::set_param(PhysicsServer::AreaParameter p_param, const Variant
|
|||
}
|
||||
}
|
||||
|
||||
Variant SpaceBullet::get_param(PhysicsServer::AreaParameter p_param) {
|
||||
Variant SpaceBullet::get_param(PhysicsServer3D::AreaParameter p_param) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY:
|
||||
return gravityMagnitude;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_VECTOR:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR:
|
||||
return gravityDirection;
|
||||
case PhysicsServer::AREA_PARAM_LINEAR_DAMP:
|
||||
case PhysicsServer::AREA_PARAM_ANGULAR_DAMP:
|
||||
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP:
|
||||
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP:
|
||||
return 0; // No damp
|
||||
case PhysicsServer::AREA_PARAM_PRIORITY:
|
||||
case PhysicsServer3D::AREA_PARAM_PRIORITY:
|
||||
return 0; // Priority is always 0, the lower
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT:
|
||||
return false;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE:
|
||||
return 0;
|
||||
case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
|
||||
case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION:
|
||||
return 0;
|
||||
default:
|
||||
WARN_PRINT("This get parameter (" + itos(p_param) + ") is ignored, the SpaceBullet doesn't support it.");
|
||||
|
@ -417,32 +417,32 @@ Variant SpaceBullet::get_param(PhysicsServer::AreaParameter p_param) {
|
|||
}
|
||||
}
|
||||
|
||||
void SpaceBullet::set_param(PhysicsServer::SpaceParameter p_param, real_t p_value) {
|
||||
void SpaceBullet::set_param(PhysicsServer3D::SpaceParameter p_param, real_t p_value) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS:
|
||||
case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION:
|
||||
case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION:
|
||||
case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
|
||||
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
|
||||
case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP:
|
||||
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO:
|
||||
case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
|
||||
case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS:
|
||||
case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION:
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION:
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP:
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO:
|
||||
case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
|
||||
default:
|
||||
WARN_PRINT("This set parameter (" + itos(p_param) + ") is ignored, the SpaceBullet doesn't support it.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
real_t SpaceBullet::get_param(PhysicsServer::SpaceParameter p_param) {
|
||||
real_t SpaceBullet::get_param(PhysicsServer3D::SpaceParameter p_param) {
|
||||
switch (p_param) {
|
||||
case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS:
|
||||
case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION:
|
||||
case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION:
|
||||
case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
|
||||
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
|
||||
case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP:
|
||||
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO:
|
||||
case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
|
||||
case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS:
|
||||
case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION:
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION:
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD:
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD:
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP:
|
||||
case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO:
|
||||
case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS:
|
||||
default:
|
||||
WARN_PRINT("The SpaceBullet doesn't support this get parameter (" + itos(p_param) + "), 0 is returned.");
|
||||
return 0.f;
|
||||
|
@ -891,7 +891,7 @@ static Ref<StandardMaterial3D> red_mat;
|
|||
static Ref<StandardMaterial3D> blue_mat;
|
||||
#endif
|
||||
|
||||
bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer::MotionResult *r_result, bool p_exclude_raycast_shapes) {
|
||||
bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer3D::MotionResult *r_result, bool p_exclude_raycast_shapes) {
|
||||
|
||||
#if debug_test_motion
|
||||
/// Yes I know this is not good, but I've used it as fast debugging hack.
|
||||
|
@ -1042,7 +1042,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
|
|||
return has_penetration;
|
||||
}
|
||||
|
||||
int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer::SeparationResult *r_results, int p_result_max, float p_margin) {
|
||||
int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer3D::SeparationResult *r_results, int p_result_max, float p_margin) {
|
||||
|
||||
btTransform body_transform;
|
||||
G_TO_B(p_transform, body_transform);
|
||||
|
@ -1054,7 +1054,7 @@ int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform &p
|
|||
int rays_found_this_round = 0;
|
||||
|
||||
for (int t(RECOVERING_MOVEMENT_CYCLES); 0 < t; --t) {
|
||||
PhysicsServer::SeparationResult *next_results = &r_results[rays_found];
|
||||
PhysicsServer3D::SeparationResult *next_results = &r_results[rays_found];
|
||||
rays_found_this_round = recover_from_penetration_ray(p_body, body_transform, RECOVERING_MOVEMENT_SCALE, p_infinite_inertia, p_result_max - rays_found, recover_motion, next_results);
|
||||
|
||||
rays_found += rays_found_this_round;
|
||||
|
@ -1333,7 +1333,7 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC
|
|||
return false;
|
||||
}
|
||||
|
||||
int SpaceBullet::add_separation_result(PhysicsServer::SeparationResult *r_result, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const {
|
||||
int SpaceBullet::add_separation_result(PhysicsServer3D::SeparationResult *r_result, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const {
|
||||
|
||||
// optimize results (ignore non-colliding)
|
||||
if (p_recover_result.penetration_distance < 0.0) {
|
||||
|
@ -1355,7 +1355,7 @@ int SpaceBullet::add_separation_result(PhysicsServer::SeparationResult *r_result
|
|||
}
|
||||
}
|
||||
|
||||
int SpaceBullet::recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer::SeparationResult *r_results) {
|
||||
int SpaceBullet::recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer3D::SeparationResult *r_results) {
|
||||
|
||||
// Calculate the cumulative AABB of all shapes of the kinematic body
|
||||
btVector3 aabb_min, aabb_max;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "core/vector.h"
|
||||
#include "godot_result_callbacks.h"
|
||||
#include "rid_bullet.h"
|
||||
#include "servers/physics_server.h"
|
||||
#include "servers/physics_server_3d.h"
|
||||
|
||||
#include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h>
|
||||
#include <BulletCollision/BroadphaseCollision/btOverlappingPairCache.h>
|
||||
|
@ -67,8 +67,8 @@ class btGjkEpaPenetrationDepthSolver;
|
|||
|
||||
extern ContactAddedCallback gContactAddedCallback;
|
||||
|
||||
class BulletPhysicsDirectSpaceState : public PhysicsDirectSpaceState {
|
||||
GDCLASS(BulletPhysicsDirectSpaceState, PhysicsDirectSpaceState);
|
||||
class BulletPhysicsDirectSpaceState : public PhysicsDirectSpaceState3D {
|
||||
GDCLASS(BulletPhysicsDirectSpaceState, PhysicsDirectSpaceState3D);
|
||||
|
||||
private:
|
||||
SpaceBullet *space;
|
||||
|
@ -131,15 +131,15 @@ public:
|
|||
/// @param p_param:
|
||||
/// AREA_PARAM_GRAVITY to set the gravity magnitude of entire world
|
||||
/// AREA_PARAM_GRAVITY_VECTOR to set the gravity direction of entire world
|
||||
void set_param(PhysicsServer::AreaParameter p_param, const Variant &p_value);
|
||||
void set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value);
|
||||
/// Used to get some parameters to Bullet world
|
||||
/// @param p_param:
|
||||
/// AREA_PARAM_GRAVITY to get the gravity magnitude of entire world
|
||||
/// AREA_PARAM_GRAVITY_VECTOR to get the gravity direction of entire world
|
||||
Variant get_param(PhysicsServer::AreaParameter p_param);
|
||||
Variant get_param(PhysicsServer3D::AreaParameter p_param);
|
||||
|
||||
void set_param(PhysicsServer::SpaceParameter p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer::SpaceParameter p_param);
|
||||
void set_param(PhysicsServer3D::SpaceParameter p_param, real_t p_value);
|
||||
real_t get_param(PhysicsServer3D::SpaceParameter p_param);
|
||||
|
||||
void add_area(AreaBullet *p_area);
|
||||
void remove_area(AreaBullet *p_area);
|
||||
|
@ -177,8 +177,8 @@ public:
|
|||
|
||||
void update_gravity();
|
||||
|
||||
bool test_body_motion(RigidBodyBullet *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer::MotionResult *r_result, bool p_exclude_raycast_shapes);
|
||||
int test_ray_separation(RigidBodyBullet *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer::SeparationResult *r_results, int p_result_max, float p_margin);
|
||||
bool test_body_motion(RigidBodyBullet *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer3D::MotionResult *r_result, bool p_exclude_raycast_shapes);
|
||||
int test_ray_separation(RigidBodyBullet *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer3D::SeparationResult *r_results, int p_result_max, float p_margin);
|
||||
|
||||
private:
|
||||
void create_empty_world(bool p_create_soft_world);
|
||||
|
@ -213,7 +213,7 @@ private:
|
|||
/// Using this we leave Bullet to select the best algorithm, For example GJK in case we have Convex Convex, or a Bullet accelerated algorithm
|
||||
bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL);
|
||||
|
||||
int add_separation_result(PhysicsServer::SeparationResult *r_results, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const;
|
||||
int recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer::SeparationResult *r_results);
|
||||
int add_separation_result(PhysicsServer3D::SeparationResult *r_results, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const;
|
||||
int recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer3D::SeparationResult *r_results);
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -43,16 +43,16 @@ void CSGShape3D::set_use_collision(bool p_enable) {
|
|||
|
||||
if (use_collision) {
|
||||
root_collision_shape.instance();
|
||||
root_collision_instance = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC);
|
||||
PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
|
||||
PhysicsServer::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space());
|
||||
PhysicsServer::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id());
|
||||
root_collision_instance = PhysicsServer3D::get_singleton()->body_create(PhysicsServer3D::BODY_MODE_STATIC);
|
||||
PhysicsServer3D::get_singleton()->body_set_state(root_collision_instance, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer3D::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
|
||||
PhysicsServer3D::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space());
|
||||
PhysicsServer3D::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id());
|
||||
set_collision_layer(collision_layer);
|
||||
set_collision_mask(collision_mask);
|
||||
_make_dirty(); //force update
|
||||
} else {
|
||||
PhysicsServer::get_singleton()->free(root_collision_instance);
|
||||
PhysicsServer3D::get_singleton()->free(root_collision_instance);
|
||||
root_collision_instance = RID();
|
||||
root_collision_shape.unref();
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ bool CSGShape3D::is_using_collision() const {
|
|||
void CSGShape3D::set_collision_layer(uint32_t p_layer) {
|
||||
collision_layer = p_layer;
|
||||
if (root_collision_instance.is_valid()) {
|
||||
PhysicsServer::get_singleton()->body_set_collision_layer(root_collision_instance, p_layer);
|
||||
PhysicsServer3D::get_singleton()->body_set_collision_layer(root_collision_instance, p_layer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ void CSGShape3D::set_collision_mask(uint32_t p_mask) {
|
|||
|
||||
collision_mask = p_mask;
|
||||
if (root_collision_instance.is_valid()) {
|
||||
PhysicsServer::get_singleton()->body_set_collision_mask(root_collision_instance, p_mask);
|
||||
PhysicsServer3D::get_singleton()->body_set_collision_mask(root_collision_instance, p_mask);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -506,11 +506,11 @@ void CSGShape3D::_notification(int p_what) {
|
|||
|
||||
if (use_collision && is_root_shape()) {
|
||||
root_collision_shape.instance();
|
||||
root_collision_instance = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC);
|
||||
PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
|
||||
PhysicsServer::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space());
|
||||
PhysicsServer::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id());
|
||||
root_collision_instance = PhysicsServer3D::get_singleton()->body_create(PhysicsServer3D::BODY_MODE_STATIC);
|
||||
PhysicsServer3D::get_singleton()->body_set_state(root_collision_instance, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer3D::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid());
|
||||
PhysicsServer3D::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space());
|
||||
PhysicsServer3D::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id());
|
||||
set_collision_layer(collision_layer);
|
||||
set_collision_mask(collision_mask);
|
||||
}
|
||||
|
@ -539,7 +539,7 @@ void CSGShape3D::_notification(int p_what) {
|
|||
parent = NULL;
|
||||
|
||||
if (use_collision && is_root_shape() && root_collision_instance.is_valid()) {
|
||||
PhysicsServer::get_singleton()->free(root_collision_instance);
|
||||
PhysicsServer3D::get_singleton()->free(root_collision_instance);
|
||||
root_collision_instance = RID();
|
||||
root_collision_shape.unref();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "arvr_interface_gdnative.h"
|
||||
#include "core/input/input_filter.h"
|
||||
#include "servers/arvr/arvr_positional_tracker.h"
|
||||
#include "servers/visual/visual_server_globals.h"
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
|
||||
void ARVRInterfaceGDNative::_bind_methods() {
|
||||
ADD_PROPERTY_DEFAULT("interface_is_initialized", false);
|
||||
|
@ -292,7 +292,7 @@ void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_re
|
|||
#warning this needs to be redone
|
||||
#endif
|
||||
#if 0
|
||||
VSG::rasterizer->blit_render_target_to_screen(*render_target, screen_rect, 0);
|
||||
RSG::rasterizer->blit_render_target_to_screen(*render_target, screen_rect, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -302,13 +302,13 @@ godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target) {
|
|||
#if 0
|
||||
RID *render_target = (RID *)p_render_target;
|
||||
|
||||
RID eye_texture = VSG::storage->render_target_get_texture(*render_target);
|
||||
RID eye_texture = RSG::storage->render_target_get_texture(*render_target);
|
||||
#endif
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#warning need to obtain this ID again
|
||||
#endif
|
||||
uint32_t texid = 0; //VS::get_singleton()->texture_get_texid(eye_texture);
|
||||
uint32_t texid = 0; //RS::get_singleton()->texture_get_texid(eye_texture);
|
||||
|
||||
return texid;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
void GdNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3)
|
||||
|
||||
GdNavigationServer::GdNavigationServer() :
|
||||
NavigationServer(),
|
||||
NavigationServer3D(),
|
||||
active(true) {
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "core/rid.h"
|
||||
#include "core/rid_owner.h"
|
||||
#include "servers/navigation_server.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
|
||||
#include "nav_map.h"
|
||||
#include "nav_region.h"
|
||||
|
@ -67,7 +67,7 @@ struct SetCommand {
|
|||
virtual void exec(GdNavigationServer *server) = 0;
|
||||
};
|
||||
|
||||
class GdNavigationServer : public NavigationServer {
|
||||
class GdNavigationServer : public NavigationServer3D {
|
||||
Mutex commands_mutex;
|
||||
/// Mutex used to make any operation threadsafe.
|
||||
Mutex operations_mutex;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "core/engine.h"
|
||||
#include "gd_navigation_server.h"
|
||||
#include "servers/navigation_server.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#include "navigation_mesh_generator.h"
|
||||
|
@ -50,12 +50,12 @@
|
|||
NavigationMeshGenerator *_nav_mesh_generator = NULL;
|
||||
#endif
|
||||
|
||||
NavigationServer *new_server() {
|
||||
NavigationServer3D *new_server() {
|
||||
return memnew(GdNavigationServer);
|
||||
}
|
||||
|
||||
void register_gdnavigation_types() {
|
||||
NavigationServerManager::set_default_server(new_server);
|
||||
NavigationServer3DManager::set_default_server(new_server);
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
_nav_mesh_generator = memnew(NavigationMeshGenerator);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "register_types.h"
|
||||
|
||||
#include "servers/visual/rendering_device.h"
|
||||
#include "servers/rendering/rendering_device.h"
|
||||
|
||||
#include <SPIRV/GlslangToSpv.h>
|
||||
#include <glslang/Include/Types.h>
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
#include "scene/resources/mesh_library.h"
|
||||
#include "scene/resources/surface_tool.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/navigation_server.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
bool GridMap::_set(const StringName &p_name, const Variant &p_value) {
|
||||
|
||||
|
@ -76,12 +76,12 @@ bool GridMap::_set(const StringName &p_name, const Variant &p_value) {
|
|||
BakedMesh bm;
|
||||
bm.mesh = meshes[i];
|
||||
ERR_CONTINUE(!bm.mesh.is_valid());
|
||||
bm.instance = VS::get_singleton()->instance_create();
|
||||
VS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid());
|
||||
VS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id());
|
||||
bm.instance = RS::get_singleton()->instance_create();
|
||||
RS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid());
|
||||
RS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id());
|
||||
if (is_inside_tree()) {
|
||||
VS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_transform(bm.instance, get_global_transform());
|
||||
RS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_transform(bm.instance, get_global_transform());
|
||||
}
|
||||
baked_meshes.push_back(bm);
|
||||
}
|
||||
|
@ -306,17 +306,17 @@ void GridMap::set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot) {
|
|||
//create octant because it does not exist
|
||||
Octant *g = memnew(Octant);
|
||||
g->dirty = true;
|
||||
g->static_body = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC);
|
||||
PhysicsServer::get_singleton()->body_attach_object_instance_id(g->static_body, get_instance_id());
|
||||
PhysicsServer::get_singleton()->body_set_collision_layer(g->static_body, collision_layer);
|
||||
PhysicsServer::get_singleton()->body_set_collision_mask(g->static_body, collision_mask);
|
||||
g->static_body = PhysicsServer3D::get_singleton()->body_create(PhysicsServer3D::BODY_MODE_STATIC);
|
||||
PhysicsServer3D::get_singleton()->body_attach_object_instance_id(g->static_body, get_instance_id());
|
||||
PhysicsServer3D::get_singleton()->body_set_collision_layer(g->static_body, collision_layer);
|
||||
PhysicsServer3D::get_singleton()->body_set_collision_mask(g->static_body, collision_mask);
|
||||
SceneTree *st = SceneTree::get_singleton();
|
||||
|
||||
if (st && st->is_debugging_collisions_hint()) {
|
||||
|
||||
g->collision_debug = VisualServer::get_singleton()->mesh_create();
|
||||
g->collision_debug_instance = VisualServer::get_singleton()->instance_create();
|
||||
VisualServer::get_singleton()->instance_set_base(g->collision_debug_instance, g->collision_debug);
|
||||
g->collision_debug = RenderingServer::get_singleton()->mesh_create();
|
||||
g->collision_debug_instance = RenderingServer::get_singleton()->instance_create();
|
||||
RenderingServer::get_singleton()->instance_set_base(g->collision_debug_instance, g->collision_debug);
|
||||
}
|
||||
|
||||
octant_map[octantkey] = g;
|
||||
|
@ -392,14 +392,14 @@ void GridMap::_octant_transform(const OctantKey &p_key) {
|
|||
|
||||
ERR_FAIL_COND(!octant_map.has(p_key));
|
||||
Octant &g = *octant_map[p_key];
|
||||
PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
|
||||
if (g.collision_debug_instance.is_valid()) {
|
||||
VS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform());
|
||||
RS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform());
|
||||
}
|
||||
|
||||
for (int i = 0; i < g.multimesh_instances.size(); i++) {
|
||||
VS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform());
|
||||
RS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,17 +410,17 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
return false;
|
||||
|
||||
//erase body shapes
|
||||
PhysicsServer::get_singleton()->body_clear_shapes(g.static_body);
|
||||
PhysicsServer3D::get_singleton()->body_clear_shapes(g.static_body);
|
||||
|
||||
//erase body shapes debug
|
||||
if (g.collision_debug.is_valid()) {
|
||||
|
||||
VS::get_singleton()->mesh_clear(g.collision_debug);
|
||||
RS::get_singleton()->mesh_clear(g.collision_debug);
|
||||
}
|
||||
|
||||
//erase navigation
|
||||
for (Map<IndexKey, Octant::NavMesh>::Element *E = g.navmesh_ids.front(); E; E = E->next()) {
|
||||
NavigationServer::get_singleton()->free(E->get().region);
|
||||
NavigationServer3D::get_singleton()->free(E->get().region);
|
||||
}
|
||||
g.navmesh_ids.clear();
|
||||
|
||||
|
@ -428,8 +428,8 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
|
||||
for (int i = 0; i < g.multimesh_instances.size(); i++) {
|
||||
|
||||
VS::get_singleton()->free(g.multimesh_instances[i].instance);
|
||||
VS::get_singleton()->free(g.multimesh_instances[i].multimesh);
|
||||
RS::get_singleton()->free(g.multimesh_instances[i].instance);
|
||||
RS::get_singleton()->free(g.multimesh_instances[i].multimesh);
|
||||
}
|
||||
g.multimesh_instances.clear();
|
||||
|
||||
|
@ -484,7 +484,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
// add the item's shape
|
||||
if (!shapes[i].shape.is_valid())
|
||||
continue;
|
||||
PhysicsServer::get_singleton()->body_add_shape(g.static_body, shapes[i].shape->get_rid(), xform * shapes[i].local_transform);
|
||||
PhysicsServer3D::get_singleton()->body_add_shape(g.static_body, shapes[i].shape->get_rid(), xform * shapes[i].local_transform);
|
||||
if (g.collision_debug.is_valid()) {
|
||||
shapes.write[i].shape->add_vertices_to_array(col_debug, xform * shapes[i].local_transform);
|
||||
}
|
||||
|
@ -497,10 +497,10 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
nm.xform = xform * mesh_library->get_item_navmesh_transform(c.item);
|
||||
|
||||
if (navigation) {
|
||||
RID region = NavigationServer::get_singleton()->region_create();
|
||||
NavigationServer::get_singleton()->region_set_navmesh(region, navmesh);
|
||||
NavigationServer::get_singleton()->region_set_transform(region, navigation->get_global_transform() * nm.xform);
|
||||
NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid());
|
||||
RID region = NavigationServer3D::get_singleton()->region_create();
|
||||
NavigationServer3D::get_singleton()->region_set_navmesh(region, navmesh);
|
||||
NavigationServer3D::get_singleton()->region_set_transform(region, navigation->get_global_transform() * nm.xform);
|
||||
NavigationServer3D::get_singleton()->region_set_map(region, navigation->get_rid());
|
||||
nm.region = region;
|
||||
}
|
||||
g.navmesh_ids[E->get()] = nm;
|
||||
|
@ -513,13 +513,13 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
for (Map<int, List<Pair<Transform, IndexKey>>>::Element *E = multimesh_items.front(); E; E = E->next()) {
|
||||
Octant::MultimeshInstance mmi;
|
||||
|
||||
RID mm = VS::get_singleton()->multimesh_create();
|
||||
VS::get_singleton()->multimesh_allocate(mm, E->get().size(), VS::MULTIMESH_TRANSFORM_3D);
|
||||
VS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid());
|
||||
RID mm = RS::get_singleton()->multimesh_create();
|
||||
RS::get_singleton()->multimesh_allocate(mm, E->get().size(), RS::MULTIMESH_TRANSFORM_3D);
|
||||
RS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid());
|
||||
|
||||
int idx = 0;
|
||||
for (List<Pair<Transform, IndexKey>>::Element *F = E->get().front(); F; F = F->next()) {
|
||||
VS::get_singleton()->multimesh_instance_set_transform(mm, idx, F->get().first);
|
||||
RS::get_singleton()->multimesh_instance_set_transform(mm, idx, F->get().first);
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
Octant::MultimeshInstance::Item it;
|
||||
|
@ -532,12 +532,12 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
idx++;
|
||||
}
|
||||
|
||||
RID instance = VS::get_singleton()->instance_create();
|
||||
VS::get_singleton()->instance_set_base(instance, mm);
|
||||
RID instance = RS::get_singleton()->instance_create();
|
||||
RS::get_singleton()->instance_set_base(instance, mm);
|
||||
|
||||
if (is_inside_tree()) {
|
||||
VS::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_transform(instance, get_global_transform());
|
||||
RS::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_transform(instance, get_global_transform());
|
||||
}
|
||||
|
||||
mmi.multimesh = mm;
|
||||
|
@ -550,13 +550,13 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
if (col_debug.size()) {
|
||||
|
||||
Array arr;
|
||||
arr.resize(VS::ARRAY_MAX);
|
||||
arr[VS::ARRAY_VERTEX] = col_debug;
|
||||
arr.resize(RS::ARRAY_MAX);
|
||||
arr[RS::ARRAY_VERTEX] = col_debug;
|
||||
|
||||
VS::get_singleton()->mesh_add_surface_from_arrays(g.collision_debug, VS::PRIMITIVE_LINES, arr);
|
||||
RS::get_singleton()->mesh_add_surface_from_arrays(g.collision_debug, RS::PRIMITIVE_LINES, arr);
|
||||
SceneTree *st = SceneTree::get_singleton();
|
||||
if (st) {
|
||||
VS::get_singleton()->mesh_surface_set_material(g.collision_debug, 0, st->get_debug_collision_material()->get_rid());
|
||||
RS::get_singleton()->mesh_surface_set_material(g.collision_debug, 0, st->get_debug_collision_material()->get_rid());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,8 +567,8 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
|
|||
|
||||
void GridMap::_reset_physic_bodies_collision_filters() {
|
||||
for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) {
|
||||
PhysicsServer::get_singleton()->body_set_collision_layer(E->get()->static_body, collision_layer);
|
||||
PhysicsServer::get_singleton()->body_set_collision_mask(E->get()->static_body, collision_mask);
|
||||
PhysicsServer3D::get_singleton()->body_set_collision_layer(E->get()->static_body, collision_layer);
|
||||
PhysicsServer3D::get_singleton()->body_set_collision_mask(E->get()->static_body, collision_mask);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,17 +576,17 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
|
|||
|
||||
ERR_FAIL_COND(!octant_map.has(p_key));
|
||||
Octant &g = *octant_map[p_key];
|
||||
PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer::get_singleton()->body_set_space(g.static_body, get_world()->get_space());
|
||||
PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer3D::get_singleton()->body_set_space(g.static_body, get_world()->get_space());
|
||||
|
||||
if (g.collision_debug_instance.is_valid()) {
|
||||
VS::get_singleton()->instance_set_scenario(g.collision_debug_instance, get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform());
|
||||
RS::get_singleton()->instance_set_scenario(g.collision_debug_instance, get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform());
|
||||
}
|
||||
|
||||
for (int i = 0; i < g.multimesh_instances.size(); i++) {
|
||||
VS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform());
|
||||
RS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform());
|
||||
}
|
||||
|
||||
if (navigation && mesh_library.is_valid()) {
|
||||
|
@ -595,10 +595,10 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
|
|||
if (cell_map.has(F->key()) && F->get().region.is_valid() == false) {
|
||||
Ref<NavigationMesh> nm = mesh_library->get_item_navmesh(cell_map[F->key()].item);
|
||||
if (nm.is_valid()) {
|
||||
RID region = NavigationServer::get_singleton()->region_create();
|
||||
NavigationServer::get_singleton()->region_set_navmesh(region, nm);
|
||||
NavigationServer::get_singleton()->region_set_transform(region, navigation->get_global_transform() * F->get().xform);
|
||||
NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid());
|
||||
RID region = NavigationServer3D::get_singleton()->region_create();
|
||||
NavigationServer3D::get_singleton()->region_set_navmesh(region, nm);
|
||||
NavigationServer3D::get_singleton()->region_set_transform(region, navigation->get_global_transform() * F->get().xform);
|
||||
NavigationServer3D::get_singleton()->region_set_map(region, navigation->get_rid());
|
||||
F->get().region = region;
|
||||
}
|
||||
}
|
||||
|
@ -610,23 +610,23 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) {
|
|||
|
||||
ERR_FAIL_COND(!octant_map.has(p_key));
|
||||
Octant &g = *octant_map[p_key];
|
||||
PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer::get_singleton()->body_set_space(g.static_body, RID());
|
||||
PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
|
||||
PhysicsServer3D::get_singleton()->body_set_space(g.static_body, RID());
|
||||
|
||||
if (g.collision_debug_instance.is_valid()) {
|
||||
|
||||
VS::get_singleton()->instance_set_scenario(g.collision_debug_instance, RID());
|
||||
RS::get_singleton()->instance_set_scenario(g.collision_debug_instance, RID());
|
||||
}
|
||||
|
||||
for (int i = 0; i < g.multimesh_instances.size(); i++) {
|
||||
VS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, RID());
|
||||
RS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, RID());
|
||||
}
|
||||
|
||||
if (navigation) {
|
||||
for (Map<IndexKey, Octant::NavMesh>::Element *F = g.navmesh_ids.front(); F; F = F->next()) {
|
||||
|
||||
if (F->get().region.is_valid()) {
|
||||
NavigationServer::get_singleton()->free(F->get().region);
|
||||
NavigationServer3D::get_singleton()->free(F->get().region);
|
||||
F->get().region = RID();
|
||||
}
|
||||
}
|
||||
|
@ -639,15 +639,15 @@ void GridMap::_octant_clean_up(const OctantKey &p_key) {
|
|||
Octant &g = *octant_map[p_key];
|
||||
|
||||
if (g.collision_debug.is_valid())
|
||||
VS::get_singleton()->free(g.collision_debug);
|
||||
RS::get_singleton()->free(g.collision_debug);
|
||||
if (g.collision_debug_instance.is_valid())
|
||||
VS::get_singleton()->free(g.collision_debug_instance);
|
||||
RS::get_singleton()->free(g.collision_debug_instance);
|
||||
|
||||
PhysicsServer::get_singleton()->free(g.static_body);
|
||||
PhysicsServer3D::get_singleton()->free(g.static_body);
|
||||
|
||||
// Erase navigation
|
||||
for (Map<IndexKey, Octant::NavMesh>::Element *E = g.navmesh_ids.front(); E; E = E->next()) {
|
||||
NavigationServer::get_singleton()->free(E->get().region);
|
||||
NavigationServer3D::get_singleton()->free(E->get().region);
|
||||
}
|
||||
g.navmesh_ids.clear();
|
||||
|
||||
|
@ -655,8 +655,8 @@ void GridMap::_octant_clean_up(const OctantKey &p_key) {
|
|||
|
||||
for (int i = 0; i < g.multimesh_instances.size(); i++) {
|
||||
|
||||
VS::get_singleton()->free(g.multimesh_instances[i].instance);
|
||||
VS::get_singleton()->free(g.multimesh_instances[i].multimesh);
|
||||
RS::get_singleton()->free(g.multimesh_instances[i].instance);
|
||||
RS::get_singleton()->free(g.multimesh_instances[i].multimesh);
|
||||
}
|
||||
g.multimesh_instances.clear();
|
||||
}
|
||||
|
@ -684,8 +684,8 @@ void GridMap::_notification(int p_what) {
|
|||
}
|
||||
|
||||
for (int i = 0; i < baked_meshes.size(); i++) {
|
||||
VS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform());
|
||||
RS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform());
|
||||
}
|
||||
|
||||
} break;
|
||||
|
@ -702,7 +702,7 @@ void GridMap::_notification(int p_what) {
|
|||
last_transform = new_xform;
|
||||
|
||||
for (int i = 0; i < baked_meshes.size(); i++) {
|
||||
VS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform());
|
||||
RS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform());
|
||||
}
|
||||
|
||||
} break;
|
||||
|
@ -718,7 +718,7 @@ void GridMap::_notification(int p_what) {
|
|||
//_update_octants_callback();
|
||||
//_update_area_instances();
|
||||
for (int i = 0; i < baked_meshes.size(); i++) {
|
||||
VS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, RID());
|
||||
RS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, RID());
|
||||
}
|
||||
|
||||
} break;
|
||||
|
@ -738,7 +738,7 @@ void GridMap::_update_visibility() {
|
|||
Octant *octant = e->value();
|
||||
for (int i = 0; i < octant->multimesh_instances.size(); i++) {
|
||||
const Octant::MultimeshInstance &mi = octant->multimesh_instances[i];
|
||||
VS::get_singleton()->instance_set_visible(mi.instance, is_visible());
|
||||
RS::get_singleton()->instance_set_visible(mi.instance, is_visible());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -975,7 +975,7 @@ Vector3 GridMap::_get_offset() const {
|
|||
void GridMap::clear_baked_meshes() {
|
||||
|
||||
for (int i = 0; i < baked_meshes.size(); i++) {
|
||||
VS::get_singleton()->free(baked_meshes[i].instance);
|
||||
RS::get_singleton()->free(baked_meshes[i].instance);
|
||||
}
|
||||
baked_meshes.clear();
|
||||
|
||||
|
@ -1050,12 +1050,12 @@ void GridMap::make_baked_meshes(bool p_gen_lightmap_uv, float p_lightmap_uv_texe
|
|||
|
||||
BakedMesh bm;
|
||||
bm.mesh = mesh;
|
||||
bm.instance = VS::get_singleton()->instance_create();
|
||||
VS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid());
|
||||
VS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id());
|
||||
bm.instance = RS::get_singleton()->instance_create();
|
||||
RS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid());
|
||||
RS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id());
|
||||
if (is_inside_tree()) {
|
||||
VS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario());
|
||||
VS::get_singleton()->instance_set_transform(bm.instance, get_global_transform());
|
||||
RS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario());
|
||||
RS::get_singleton()->instance_set_transform(bm.instance, get_global_transform());
|
||||
}
|
||||
|
||||
if (p_gen_lightmap_uv) {
|
||||
|
|
|
@ -166,10 +166,10 @@ class GridMap : public Node3D {
|
|||
|
||||
struct BakeLight {
|
||||
|
||||
VS::LightType type;
|
||||
RS::LightType type;
|
||||
Vector3 pos;
|
||||
Vector3 dir;
|
||||
float param[VS::LIGHT_PARAM_MAX];
|
||||
float param[RS::LIGHT_PARAM_MAX];
|
||||
};
|
||||
|
||||
_FORCE_INLINE_ Vector3 _octant_get_offset(const OctantKey &p_key) const {
|
||||
|
|
|
@ -281,8 +281,8 @@ void GridMapEditor::_update_cursor_transform() {
|
|||
cursor_transform = node->get_global_transform() * cursor_transform;
|
||||
|
||||
if (cursor_instance.is_valid()) {
|
||||
VisualServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform);
|
||||
VisualServer::get_singleton()->instance_set_visible(cursor_instance, cursor_visible);
|
||||
RenderingServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform);
|
||||
RenderingServer::get_singleton()->instance_set_visible(cursor_instance, cursor_visible);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,9 +292,9 @@ void GridMapEditor::_update_selection_transform() {
|
|||
|
||||
if (!selection.active) {
|
||||
|
||||
VisualServer::get_singleton()->instance_set_transform(selection_instance, xf_zero);
|
||||
RenderingServer::get_singleton()->instance_set_transform(selection_instance, xf_zero);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero);
|
||||
RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -303,11 +303,11 @@ void GridMapEditor::_update_selection_transform() {
|
|||
xf.scale((Vector3(1, 1, 1) + (selection.end - selection.begin)) * node->get_cell_size());
|
||||
xf.origin = selection.begin * node->get_cell_size();
|
||||
|
||||
VisualServer::get_singleton()->instance_set_transform(selection_instance, node->get_global_transform() * xf);
|
||||
RenderingServer::get_singleton()->instance_set_transform(selection_instance, node->get_global_transform() * xf);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (i != edit_axis || (edit_floor[edit_axis] < selection.begin[edit_axis]) || (edit_floor[edit_axis] > selection.end[edit_axis] + 1)) {
|
||||
VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero);
|
||||
RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero);
|
||||
} else {
|
||||
|
||||
Vector3 scale = (selection.end - selection.begin + Vector3(1, 1, 1));
|
||||
|
@ -322,7 +322,7 @@ void GridMapEditor::_update_selection_transform() {
|
|||
xf2.basis.scale(scale);
|
||||
xf2.origin = pos;
|
||||
|
||||
VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf2);
|
||||
RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
|
|||
}
|
||||
}
|
||||
|
||||
VS::get_singleton()->instance_set_transform(grid_instance[edit_axis], node->get_global_transform() * edit_grid_xform);
|
||||
RS::get_singleton()->instance_set_transform(grid_instance[edit_axis], node->get_global_transform() * edit_grid_xform);
|
||||
|
||||
if (cursor_instance.is_valid()) {
|
||||
|
||||
|
@ -528,7 +528,7 @@ void GridMapEditor::_clear_clipboard_data() {
|
|||
|
||||
for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
|
||||
|
||||
VisualServer::get_singleton()->free(E->get().instance);
|
||||
RenderingServer::get_singleton()->free(E->get().instance);
|
||||
}
|
||||
|
||||
clipboard_items.clear();
|
||||
|
@ -556,7 +556,7 @@ void GridMapEditor::_set_clipboard_data() {
|
|||
item.cell_item = itm;
|
||||
item.grid_offset = Vector3(i, j, k) - selection.begin;
|
||||
item.orientation = node->get_cell_item_orientation(i, j, k);
|
||||
item.instance = VisualServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario());
|
||||
item.instance = RenderingServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario());
|
||||
|
||||
clipboard_items.push_back(item);
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ void GridMapEditor::_update_paste_indicator() {
|
|||
|
||||
Transform xf;
|
||||
xf.basis.set_zero();
|
||||
VisualServer::get_singleton()->instance_set_transform(paste_instance, xf);
|
||||
RenderingServer::get_singleton()->instance_set_transform(paste_instance, xf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -584,7 +584,7 @@ void GridMapEditor::_update_paste_indicator() {
|
|||
xf.basis = rot * xf.basis;
|
||||
xf.translate((-center * node->get_cell_size()) / scale);
|
||||
|
||||
VisualServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf);
|
||||
RenderingServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf);
|
||||
|
||||
for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) {
|
||||
|
||||
|
@ -599,7 +599,7 @@ void GridMapEditor::_update_paste_indicator() {
|
|||
item_rot.set_orthogonal_index(item.orientation);
|
||||
xf.basis = item_rot * xf.basis * node->get_cell_scale();
|
||||
|
||||
VisualServer::get_singleton()->instance_set_transform(item.instance, node->get_global_transform() * xf);
|
||||
RenderingServer::get_singleton()->instance_set_transform(item.instance, node->get_global_transform() * xf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -969,11 +969,11 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
|
|||
if (!node) {
|
||||
set_process(false);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
VisualServer::get_singleton()->instance_set_visible(grid_instance[i], false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(grid_instance[i], false);
|
||||
}
|
||||
|
||||
if (cursor_instance.is_valid()) {
|
||||
VisualServer::get_singleton()->instance_set_visible(cursor_instance, false);
|
||||
RenderingServer::get_singleton()->instance_set_visible(cursor_instance, false);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1011,7 +1011,7 @@ void GridMapEditor::update_grid() {
|
|||
edit_grid_xform.basis = Basis();
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
VisualServer::get_singleton()->instance_set_visible(grid_instance[i], i == edit_axis);
|
||||
RenderingServer::get_singleton()->instance_set_visible(grid_instance[i], i == edit_axis);
|
||||
}
|
||||
|
||||
updating = true;
|
||||
|
@ -1023,7 +1023,7 @@ void GridMapEditor::_draw_grids(const Vector3 &cell_size) {
|
|||
Vector3 edited_floor = node->has_meta("_editor_floor_") ? node->get_meta("_editor_floor_") : Variant();
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
VS::get_singleton()->mesh_clear(grid[i]);
|
||||
RS::get_singleton()->mesh_clear(grid[i]);
|
||||
edit_floor[i] = edited_floor[i];
|
||||
}
|
||||
|
||||
|
@ -1065,11 +1065,11 @@ void GridMapEditor::_draw_grids(const Vector3 &cell_size) {
|
|||
}
|
||||
|
||||
Array d;
|
||||
d.resize(VS::ARRAY_MAX);
|
||||
d[VS::ARRAY_VERTEX] = grid_points[i];
|
||||
d[VS::ARRAY_COLOR] = grid_colors[i];
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(grid[i], VisualServer::PRIMITIVE_LINES, d);
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(grid[i], 0, indicator_mat->get_rid());
|
||||
d.resize(RS::ARRAY_MAX);
|
||||
d[RS::ARRAY_VERTEX] = grid_points[i];
|
||||
d[RS::ARRAY_COLOR] = grid_colors[i];
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(grid[i], RenderingServer::PRIMITIVE_LINES, d);
|
||||
RenderingServer::get_singleton()->mesh_surface_set_material(grid[i], 0, indicator_mat->get_rid());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1082,13 +1082,13 @@ void GridMapEditor::_notification(int p_what) {
|
|||
mesh_library_palette->connect("item_selected", callable_mp(this, &GridMapEditor::_item_selected_cbk));
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
grid[i] = VS::get_singleton()->mesh_create();
|
||||
grid_instance[i] = VS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
selection_level_instance[i] = VisualServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
grid[i] = RS::get_singleton()->mesh_create();
|
||||
grid_instance[i] = RS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
selection_level_instance[i] = RenderingServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world()->get_scenario());
|
||||
}
|
||||
|
||||
selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario());
|
||||
paste_instance = VisualServer::get_singleton()->instance_create2(paste_mesh, get_tree()->get_root()->get_world()->get_scenario());
|
||||
selection_instance = RenderingServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario());
|
||||
paste_instance = RenderingServer::get_singleton()->instance_create2(paste_mesh, get_tree()->get_root()->get_world()->get_scenario());
|
||||
|
||||
_update_selection_transform();
|
||||
_update_paste_indicator();
|
||||
|
@ -1100,15 +1100,15 @@ void GridMapEditor::_notification(int p_what) {
|
|||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
VS::get_singleton()->free(grid_instance[i]);
|
||||
VS::get_singleton()->free(grid[i]);
|
||||
RS::get_singleton()->free(grid_instance[i]);
|
||||
RS::get_singleton()->free(grid[i]);
|
||||
grid_instance[i] = RID();
|
||||
grid[i] = RID();
|
||||
VisualServer::get_singleton()->free(selection_level_instance[i]);
|
||||
RenderingServer::get_singleton()->free(selection_level_instance[i]);
|
||||
}
|
||||
|
||||
VisualServer::get_singleton()->free(selection_instance);
|
||||
VisualServer::get_singleton()->free(paste_instance);
|
||||
RenderingServer::get_singleton()->free(selection_instance);
|
||||
RenderingServer::get_singleton()->free(paste_instance);
|
||||
selection_instance = RID();
|
||||
paste_instance = RID();
|
||||
} break;
|
||||
|
@ -1123,7 +1123,7 @@ void GridMapEditor::_notification(int p_what) {
|
|||
if (xf != grid_xform) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
VS::get_singleton()->instance_set_transform(grid_instance[i], xf * edit_grid_xform);
|
||||
RS::get_singleton()->instance_set_transform(grid_instance[i], xf * edit_grid_xform);
|
||||
}
|
||||
grid_xform = xf;
|
||||
}
|
||||
|
@ -1159,7 +1159,7 @@ void GridMapEditor::_update_cursor_instance() {
|
|||
}
|
||||
|
||||
if (cursor_instance.is_valid())
|
||||
VisualServer::get_singleton()->free(cursor_instance);
|
||||
RenderingServer::get_singleton()->free(cursor_instance);
|
||||
cursor_instance = RID();
|
||||
|
||||
if (selected_palette >= 0) {
|
||||
|
@ -1168,8 +1168,8 @@ void GridMapEditor::_update_cursor_instance() {
|
|||
Ref<Mesh> mesh = node->get_mesh_library()->get_item_mesh(selected_palette);
|
||||
if (!mesh.is_null() && mesh->get_rid().is_valid()) {
|
||||
|
||||
cursor_instance = VisualServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario());
|
||||
VisualServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform);
|
||||
cursor_instance = RenderingServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario());
|
||||
RenderingServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1353,8 +1353,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
lock_view = false;
|
||||
cursor_rot = 0;
|
||||
|
||||
selection_mesh = VisualServer::get_singleton()->mesh_create();
|
||||
paste_mesh = VisualServer::get_singleton()->mesh_create();
|
||||
selection_mesh = RenderingServer::get_singleton()->mesh_create();
|
||||
paste_mesh = RenderingServer::get_singleton()->mesh_create();
|
||||
|
||||
{
|
||||
// Selection mesh create.
|
||||
|
@ -1431,16 +1431,16 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
}
|
||||
|
||||
Array d;
|
||||
d.resize(VS::ARRAY_MAX);
|
||||
d.resize(RS::ARRAY_MAX);
|
||||
|
||||
inner_mat.instance();
|
||||
inner_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.2));
|
||||
inner_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
inner_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
|
||||
|
||||
d[VS::ARRAY_VERTEX] = triangles;
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_TRIANGLES, d);
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh, 0, inner_mat->get_rid());
|
||||
d[RS::ARRAY_VERTEX] = triangles;
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, RS::PRIMITIVE_TRIANGLES, d);
|
||||
RenderingServer::get_singleton()->mesh_surface_set_material(selection_mesh, 0, inner_mat->get_rid());
|
||||
|
||||
outer_mat.instance();
|
||||
outer_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.8));
|
||||
|
@ -1454,23 +1454,23 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
|
|||
selection_floor_mat->set_on_top_of_alpha();
|
||||
selection_floor_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
|
||||
d[VS::ARRAY_VERTEX] = lines;
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_LINES, d);
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh, 1, outer_mat->get_rid());
|
||||
d[RS::ARRAY_VERTEX] = lines;
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, RS::PRIMITIVE_LINES, d);
|
||||
RenderingServer::get_singleton()->mesh_surface_set_material(selection_mesh, 1, outer_mat->get_rid());
|
||||
|
||||
d[VS::ARRAY_VERTEX] = triangles;
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, VS::PRIMITIVE_TRIANGLES, d);
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(paste_mesh, 0, inner_mat->get_rid());
|
||||
d[RS::ARRAY_VERTEX] = triangles;
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, RS::PRIMITIVE_TRIANGLES, d);
|
||||
RenderingServer::get_singleton()->mesh_surface_set_material(paste_mesh, 0, inner_mat->get_rid());
|
||||
|
||||
d[VS::ARRAY_VERTEX] = lines;
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, VS::PRIMITIVE_LINES, d);
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(paste_mesh, 1, outer_mat->get_rid());
|
||||
d[RS::ARRAY_VERTEX] = lines;
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, RS::PRIMITIVE_LINES, d);
|
||||
RenderingServer::get_singleton()->mesh_surface_set_material(paste_mesh, 1, outer_mat->get_rid());
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
d[VS::ARRAY_VERTEX] = square[i];
|
||||
selection_level_mesh[i] = VS::get_singleton()->mesh_create();
|
||||
VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_level_mesh[i], VS::PRIMITIVE_LINES, d);
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(selection_level_mesh[i], 0, selection_floor_mat->get_rid());
|
||||
d[RS::ARRAY_VERTEX] = square[i];
|
||||
selection_level_mesh[i] = RS::get_singleton()->mesh_create();
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(selection_level_mesh[i], RS::PRIMITIVE_LINES, d);
|
||||
RenderingServer::get_singleton()->mesh_surface_set_material(selection_level_mesh[i], 0, selection_floor_mat->get_rid());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1493,24 +1493,24 @@ GridMapEditor::~GridMapEditor() {
|
|||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
if (grid[i].is_valid())
|
||||
VisualServer::get_singleton()->free(grid[i]);
|
||||
RenderingServer::get_singleton()->free(grid[i]);
|
||||
if (grid_instance[i].is_valid())
|
||||
VisualServer::get_singleton()->free(grid_instance[i]);
|
||||
RenderingServer::get_singleton()->free(grid_instance[i]);
|
||||
if (cursor_instance.is_valid())
|
||||
VisualServer::get_singleton()->free(cursor_instance);
|
||||
RenderingServer::get_singleton()->free(cursor_instance);
|
||||
if (selection_level_instance[i].is_valid())
|
||||
VisualServer::get_singleton()->free(selection_level_instance[i]);
|
||||
RenderingServer::get_singleton()->free(selection_level_instance[i]);
|
||||
if (selection_level_mesh[i].is_valid())
|
||||
VisualServer::get_singleton()->free(selection_level_mesh[i]);
|
||||
RenderingServer::get_singleton()->free(selection_level_mesh[i]);
|
||||
}
|
||||
|
||||
VisualServer::get_singleton()->free(selection_mesh);
|
||||
RenderingServer::get_singleton()->free(selection_mesh);
|
||||
if (selection_instance.is_valid())
|
||||
VisualServer::get_singleton()->free(selection_instance);
|
||||
RenderingServer::get_singleton()->free(selection_instance);
|
||||
|
||||
VisualServer::get_singleton()->free(paste_mesh);
|
||||
RenderingServer::get_singleton()->free(paste_mesh);
|
||||
if (paste_instance.is_valid())
|
||||
VisualServer::get_singleton()->free(paste_instance);
|
||||
RenderingServer::get_singleton()->free(paste_instance);
|
||||
}
|
||||
|
||||
void GridMapEditorPlugin::_notification(int p_what) {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "core/input/input_filter.h"
|
||||
#include "core/os/os.h"
|
||||
#include "servers/display_server.h"
|
||||
#include "servers/visual/visual_server_globals.h"
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
|
||||
StringName MobileVRInterface::get_name() const {
|
||||
return "Native mobile";
|
||||
|
|
|
@ -50,7 +50,7 @@ NoiseTexture::NoiseTexture() {
|
|||
|
||||
NoiseTexture::~NoiseTexture() {
|
||||
if (texture.is_valid()) {
|
||||
VS::get_singleton()->free(texture);
|
||||
RS::get_singleton()->free(texture);
|
||||
}
|
||||
if (noise_thread) {
|
||||
Thread::wait_to_finish(noise_thread);
|
||||
|
@ -100,10 +100,10 @@ void NoiseTexture::_set_texture_data(const Ref<Image> &p_image) {
|
|||
data = p_image;
|
||||
if (data.is_valid()) {
|
||||
if (texture.is_valid()) {
|
||||
RID new_texture = VS::get_singleton()->texture_2d_create(p_image);
|
||||
VS::get_singleton()->texture_replace(texture, new_texture);
|
||||
RID new_texture = RS::get_singleton()->texture_2d_create(p_image);
|
||||
RS::get_singleton()->texture_replace(texture, new_texture);
|
||||
} else {
|
||||
texture = VS::get_singleton()->texture_2d_create(p_image);
|
||||
texture = RS::get_singleton()->texture_2d_create(p_image);
|
||||
}
|
||||
}
|
||||
emit_changed();
|
||||
|
@ -254,7 +254,7 @@ int NoiseTexture::get_height() const {
|
|||
|
||||
RID NoiseTexture::get_rid() const {
|
||||
if (!texture.is_valid()) {
|
||||
texture = VS::get_singleton()->texture_2d_placeholder_create();
|
||||
texture = RS::get_singleton()->texture_2d_placeholder_create();
|
||||
}
|
||||
|
||||
return texture;
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include "drivers/unix/file_access_unix.h"
|
||||
#include "file_access_android.h"
|
||||
#include "main/main.h"
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/visual/visual_server_wrap_mt.h"
|
||||
#include "servers/rendering/rendering_server_raster.h"
|
||||
#include "servers/rendering/rendering_server_wrap_mt.h"
|
||||
|
||||
#include "dir_access_jandroid.h"
|
||||
#include "file_access_jandroid.h"
|
||||
|
@ -146,12 +146,12 @@ Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
|
|||
|
||||
video_driver_index = p_video_driver;
|
||||
|
||||
visual_server = memnew(VisualServerRaster);
|
||||
rendering_server = memnew(RenderingServerRaster);
|
||||
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
|
||||
visual_server = memnew(VisualServerWrapMT(visual_server, false));
|
||||
rendering_server = memnew(RenderingServerWrapMT(rendering_server, false));
|
||||
}
|
||||
|
||||
visual_server->init();
|
||||
rendering_server->init();
|
||||
|
||||
AudioDriverManager::initialize(p_audio_driver);
|
||||
|
||||
|
@ -759,7 +759,7 @@ OS_Android::OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_god
|
|||
//rasterizer = NULL;
|
||||
use_gl2 = false;
|
||||
|
||||
visual_server = NULL;
|
||||
rendering_server = NULL;
|
||||
|
||||
godot_java = p_godot_java;
|
||||
godot_io_java = p_godot_io_java;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "core/os/main_loop.h"
|
||||
#include "drivers/unix/os_unix.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "servers/rendering/rasterizer.h"
|
||||
|
||||
class GodotJavaWrapper;
|
||||
class GodotIOJavaWrapper;
|
||||
|
@ -75,7 +75,7 @@ private:
|
|||
|
||||
bool use_16bits_fbo;
|
||||
|
||||
VisualServer *visual_server;
|
||||
RenderingServer *rendering_server;
|
||||
|
||||
mutable String data_dir_cache;
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
|
||||
#include "drivers/gles2/rasterizer_gles2.h"
|
||||
#include "main/main.h"
|
||||
#include "servers/physics/physics_server_sw.h"
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/visual/visual_server_wrap_mt.h"
|
||||
#include "servers/physics_3d/physics_server_3d_sw.h"
|
||||
#include "servers/rendering/rendering_server_raster.h"
|
||||
#include "servers/rendering/rendering_server_wrap_mt.h"
|
||||
|
||||
#include <Screen.h>
|
||||
|
||||
|
@ -116,13 +116,13 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
|
|||
RasterizerGLES2::make_current();
|
||||
#endif
|
||||
|
||||
visual_server = memnew(VisualServerRaster);
|
||||
rendering_server = memnew(RenderingServerRaster);
|
||||
// FIXME: Reimplement threaded rendering
|
||||
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
|
||||
visual_server = memnew(VisualServerWrapMT(visual_server, false));
|
||||
rendering_server = memnew(RenderingServerWrapMT(rendering_server, false));
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);
|
||||
ERR_FAIL_COND_V(!rendering_server, ERR_UNAVAILABLE);
|
||||
|
||||
video_driver_index = p_video_driver;
|
||||
|
||||
|
@ -130,7 +130,7 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
|
|||
window->SetInput(input);
|
||||
|
||||
window->Show();
|
||||
visual_server->init();
|
||||
rendering_server->init();
|
||||
|
||||
AudioDriverManager::initialize(p_audio_driver);
|
||||
|
||||
|
@ -144,8 +144,8 @@ void OS_Haiku::finalize() {
|
|||
|
||||
main_loop = NULL;
|
||||
|
||||
visual_server->finish();
|
||||
memdelete(visual_server);
|
||||
rendering_server->finish();
|
||||
memdelete(rendering_server);
|
||||
|
||||
memdelete(input);
|
||||
|
||||
|
@ -267,7 +267,7 @@ void OS_Haiku::set_window_position(const Point2 &p_position) {
|
|||
void OS_Haiku::set_window_fullscreen(bool p_enabled) {
|
||||
window->SetFullScreen(p_enabled);
|
||||
current_video_mode.fullscreen = p_enabled;
|
||||
visual_server->init();
|
||||
rendering_server->init();
|
||||
}
|
||||
|
||||
bool OS_Haiku::is_window_fullscreen() const {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "haiku_application.h"
|
||||
#include "haiku_direct_window.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
class OS_Haiku : public OS_Unix {
|
||||
private:
|
||||
|
@ -46,7 +46,7 @@ private:
|
|||
HaikuDirectWindow *window;
|
||||
MainLoop *main_loop;
|
||||
InputDefault *input;
|
||||
VisualServer *visual_server;
|
||||
RenderingServer *rendering_server;
|
||||
VideoMode current_video_mode;
|
||||
int video_driver_index;
|
||||
|
||||
|
|
|
@ -37,13 +37,13 @@
|
|||
#endif
|
||||
|
||||
#if defined(VULKAN_ENABLED)
|
||||
#include "servers/visual/rasterizer_rd/rasterizer_rd.h"
|
||||
#include "servers/rendering/rasterizer_rd/rasterizer_rd.h"
|
||||
// #import <QuartzCore/CAMetalLayer.h>
|
||||
#include <vulkan/vulkan_metal.h>
|
||||
#endif
|
||||
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/visual/visual_server_wrap_mt.h"
|
||||
#include "servers/rendering/rendering_server_raster.h"
|
||||
#include "servers/rendering/rendering_server_wrap_mt.h"
|
||||
|
||||
#include "main/main.h"
|
||||
|
||||
|
@ -134,16 +134,16 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
|
|||
RasterizerRD::make_current();
|
||||
#endif
|
||||
|
||||
visual_server = memnew(VisualServerRaster);
|
||||
rendering_server = memnew(RenderingServerRaster);
|
||||
// FIXME: Reimplement threaded rendering
|
||||
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
|
||||
visual_server = memnew(VisualServerWrapMT(visual_server, false));
|
||||
rendering_server = memnew(RenderingServerWrapMT(rendering_server, false));
|
||||
}
|
||||
visual_server->init();
|
||||
//visual_server->cursor_set_visible(false, 0);
|
||||
rendering_server->init();
|
||||
//rendering_server->cursor_set_visible(false, 0);
|
||||
|
||||
#if defined(OPENGL_ENABLED)
|
||||
// reset this to what it should be, it will have been set to 0 after visual_server->init() is called
|
||||
// reset this to what it should be, it will have been set to 0 after rendering_server->init() is called
|
||||
RasterizerStorageGLES2::system_fbo = gl_view_base_fb;
|
||||
#endif
|
||||
|
||||
|
@ -361,8 +361,8 @@ void OSIPhone::finalize() {
|
|||
memdelete(icloud);
|
||||
#endif
|
||||
|
||||
visual_server->finish();
|
||||
memdelete(visual_server);
|
||||
rendering_server->finish();
|
||||
memdelete(rendering_server);
|
||||
// memdelete(rasterizer);
|
||||
|
||||
// Free unhandled events before close
|
||||
|
@ -636,7 +636,7 @@ OSIPhone::OSIPhone(int width, int height, String p_data_dir) {
|
|||
ios_init_callbacks_capacity = 0;
|
||||
|
||||
main_loop = NULL;
|
||||
visual_server = NULL;
|
||||
rendering_server = NULL;
|
||||
|
||||
VideoMode vm;
|
||||
vm.fullscreen = true;
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
#include "in_app_store.h"
|
||||
#include "ios.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "servers/visual_server.h"
|
||||
#include "servers/rendering/rasterizer.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
#if defined(VULKAN_ENABLED)
|
||||
#include "drivers/vulkan/rendering_device_vulkan.h"
|
||||
|
@ -60,7 +60,7 @@ private:
|
|||
static HashMap<String, void *> dynamic_symbol_lookup_table;
|
||||
friend void register_dynamic_symbol(char *name, void *address);
|
||||
|
||||
VisualServer *visual_server;
|
||||
RenderingServer *rendering_server;
|
||||
|
||||
AudioDriverCoreAudio audio_driver;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "drivers/unix/dir_access_unix.h"
|
||||
#include "drivers/unix/file_access_unix.h"
|
||||
#include "main/main.h"
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/rendering/rendering_server_raster.h"
|
||||
|
||||
#include <emscripten.h>
|
||||
#include <png.h>
|
||||
|
@ -962,7 +962,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
|
|||
setenv("LANG", locale_ptr, true);
|
||||
|
||||
AudioDriverManager::initialize(p_audio_driver);
|
||||
VisualServer *visual_server = memnew(VisualServerRaster());
|
||||
RenderingServer *rendering_server = memnew(RenderingServerRaster());
|
||||
input = memnew(InputDefault);
|
||||
|
||||
EMSCRIPTEN_RESULT result;
|
||||
|
@ -1016,7 +1016,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
|
|||
);
|
||||
/* clang-format on */
|
||||
|
||||
visual_server->init();
|
||||
rendering_server->init();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "core/input/input_filter.h"
|
||||
#include "drivers/unix/os_unix.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "servers/rendering/rasterizer.h"
|
||||
|
||||
#include <emscripten/html5.h>
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue