diff options
Diffstat (limited to 'servers')
| -rw-r--r-- | servers/arvr_server.cpp | 1 | ||||
| -rw-r--r-- | servers/audio/effects/audio_effect_distortion.cpp | 6 | ||||
| -rw-r--r-- | servers/audio/effects/audio_effect_filter.cpp | 5 | ||||
| -rw-r--r-- | servers/audio/effects/audio_effect_limiter.cpp | 5 | ||||
| -rw-r--r-- | servers/audio_server.cpp | 92 | ||||
| -rw-r--r-- | servers/audio_server.h | 29 | ||||
| -rw-r--r-- | servers/physics/broad_phase_basic.h | 2 | ||||
| -rw-r--r-- | servers/physics/shape_sw.cpp | 5 | ||||
| -rw-r--r-- | servers/physics/step_sw.cpp | 2 | ||||
| -rw-r--r-- | servers/physics_2d/space_2d_sw.cpp | 12 | ||||
| -rw-r--r-- | servers/physics_2d/space_2d_sw.h | 6 | ||||
| -rw-r--r-- | servers/physics_server.cpp | 14 | ||||
| -rw-r--r-- | servers/visual/shader_language.cpp | 25 | ||||
| -rw-r--r-- | servers/visual/shader_language.h | 2 | ||||
| -rw-r--r-- | servers/visual/visual_server_scene.cpp | 21 |
15 files changed, 157 insertions, 70 deletions
diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp index 3308e1cc07..5d8cf20c92 100644 --- a/servers/arvr_server.cpp +++ b/servers/arvr_server.cpp @@ -130,7 +130,6 @@ void ARVRServer::request_reference_frame(bool p_ignore_tilt, bool p_keep_height) void ARVRServer::add_interface(const Ref<ARVRInterface> &p_interface) { ERR_FAIL_COND(p_interface.is_null()); - int idx = -1; for (int i = 0; i < interfaces.size(); i++) { if (interfaces[i] == p_interface) { diff --git a/servers/audio/effects/audio_effect_distortion.cpp b/servers/audio/effects/audio_effect_distortion.cpp index f2bcabc3cb..3e6280f033 100644 --- a/servers/audio/effects/audio_effect_distortion.cpp +++ b/servers/audio/effects/audio_effect_distortion.cpp @@ -175,6 +175,12 @@ void AudioEffectDistortion::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "keep_hf_hz", PROPERTY_HINT_RANGE, "1,20000,1"), "set_keep_hf_hz", "get_keep_hf_hz"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "drive", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_drive", "get_drive"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "post_gain", PROPERTY_HINT_RANGE, "-80,24,0.01"), "set_post_gain", "get_post_gain"); + + BIND_ENUM_CONSTANT(MODE_CLIP); + BIND_ENUM_CONSTANT(MODE_ATAN); + BIND_ENUM_CONSTANT(MODE_LOFI); + BIND_ENUM_CONSTANT(MODE_OVERDRIVE); + BIND_ENUM_CONSTANT(MODE_WAVESHAPE); } AudioEffectDistortion::AudioEffectDistortion() { diff --git a/servers/audio/effects/audio_effect_filter.cpp b/servers/audio/effects/audio_effect_filter.cpp index 64a9db51a5..019494c74a 100644 --- a/servers/audio/effects/audio_effect_filter.cpp +++ b/servers/audio/effects/audio_effect_filter.cpp @@ -159,6 +159,11 @@ void AudioEffectFilter::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "resonance", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_resonance", "get_resonance"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "gain", PROPERTY_HINT_RANGE, "0,4,0.01"), "set_gain", "get_gain"); ADD_PROPERTY(PropertyInfo(Variant::INT, "dB", PROPERTY_HINT_ENUM, "6db,12db,18db,24db"), "set_db", "get_db"); + + BIND_ENUM_CONSTANT(FILTER_6DB); + BIND_ENUM_CONSTANT(FILTER_12DB); + BIND_ENUM_CONSTANT(FILTER_18DB); + BIND_ENUM_CONSTANT(FILTER_24DB); } AudioEffectFilter::AudioEffectFilter(AudioFilterSW::Mode p_mode) { diff --git a/servers/audio/effects/audio_effect_limiter.cpp b/servers/audio/effects/audio_effect_limiter.cpp index 391e5db639..9787ba8109 100644 --- a/servers/audio/effects/audio_effect_limiter.cpp +++ b/servers/audio/effects/audio_effect_limiter.cpp @@ -31,18 +31,13 @@ void AudioEffectLimiterInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - float thresh = Math::db2linear(base->threshold); float threshdb = base->threshold; float ceiling = Math::db2linear(base->ceiling); float ceildb = base->ceiling; float makeup = Math::db2linear(ceildb - threshdb); - float makeupdb = ceildb - threshdb; float sc = -base->soft_clip; float scv = Math::db2linear(sc); - float sccomp = Math::db2linear(-sc); float peakdb = ceildb + 25; - float peaklvl = Math::db2linear(peakdb); - float scratio = base->soft_clip_ratio; float scmult = Math::abs((ceildb - sc) / (peakdb - sc)); for (int i = 0; i < p_frame_count; i++) { diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 29014a7ced..78efe85e16 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -32,6 +32,7 @@ #include "os/file_access.h" #include "os/os.h" #include "project_settings.h" +#include "servers/audio/audio_driver_dummy.h" #include "servers/audio/effects/audio_effect_compressor.h" #ifdef TOOLS_ENABLED @@ -77,6 +78,28 @@ double AudioDriver::get_mix_time() const { return total; } +AudioDriver::SpeakerMode AudioDriver::get_speaker_mode_by_total_channels(int p_channels) const { + switch (p_channels) { + case 4: return SPEAKER_SURROUND_31; + case 6: return SPEAKER_SURROUND_51; + case 8: return SPEAKER_SURROUND_71; + } + + // Default to STEREO + return SPEAKER_MODE_STEREO; +} + +int AudioDriver::get_total_channels_by_speaker_mode(AudioDriver::SpeakerMode p_mode) const { + switch (p_mode) { + case SPEAKER_MODE_STEREO: return 2; + case SPEAKER_SURROUND_31: return 4; + case SPEAKER_SURROUND_51: return 6; + case SPEAKER_SURROUND_71: return 8; + } + + ERR_FAIL_V(2); +} + AudioDriver::AudioDriver() { _last_mix_time = 0; @@ -85,6 +108,7 @@ AudioDriver::AudioDriver() { AudioDriver *AudioDriverManager::drivers[MAX_DRIVERS]; int AudioDriverManager::driver_count = 0; +AudioDriverDummy AudioDriverManager::dummy_driver; void AudioDriverManager::add_driver(AudioDriver *p_driver) { @@ -96,6 +120,43 @@ int AudioDriverManager::get_driver_count() { return driver_count; } + +void AudioDriverManager::initialize(int p_driver) { + AudioDriver *driver; + int failed_driver = -1; + + // Check if there is a selected driver + if (p_driver >= 0 && p_driver < driver_count) { + if (drivers[p_driver]->init() == OK) { + drivers[p_driver]->set_singleton(); + return; + } else { + failed_driver = p_driver; + } + } + + // No selected driver, try them all in order + for (int i = 0; i < driver_count; i++) { + // Don't re-init the driver if it failed above + if (i == failed_driver) { + continue; + } + + if (drivers[i]->init() == OK) { + drivers[i]->set_singleton(); + return; + } + } + + // Fallback to our dummy driver + if (dummy_driver.init() == OK) { + ERR_PRINT("AudioDriverManager: all drivers failed, falling back to dummy driver"); + dummy_driver.set_singleton(); + } else { + ERR_PRINT("AudioDriverManager: dummy driver faild to init()"); + } +} + AudioDriver *AudioDriverManager::get_driver(int p_driver) { ERR_FAIL_INDEX_V(p_driver, driver_count, NULL); @@ -424,8 +485,8 @@ void AudioServer::set_bus_count(int p_count) { } buses[i] = memnew(Bus); - buses[i]->channels.resize(_get_channel_count()); - for (int j = 0; j < _get_channel_count(); j++) { + buses[i]->channels.resize(get_channel_count()); + for (int j = 0; j < get_channel_count(); j++) { buses[i]->channels[j].buffer.resize(buffer_size); } buses[i]->name = attempt; @@ -494,8 +555,8 @@ void AudioServer::add_bus(int p_at_pos) { } Bus *bus = memnew(Bus); - bus->channels.resize(_get_channel_count()); - for (int j = 0; j < _get_channel_count(); j++) { + bus->channels.resize(get_channel_count()); + for (int j = 0; j < get_channel_count(); j++) { bus->channels[j].buffer.resize(buffer_size); } bus->name = attempt; @@ -798,17 +859,8 @@ void AudioServer::init() { channel_disable_threshold_db = GLOBAL_DEF("audio/channel_disable_threshold_db", -60.0); channel_disable_frames = float(GLOBAL_DEF("audio/channel_disable_time", 2.0)) * get_mix_rate(); buffer_size = 1024; //harcoded for now - switch (get_speaker_mode()) { - case SPEAKER_MODE_STEREO: { - temp_buffer.resize(1); - } break; - case SPEAKER_SURROUND_51: { - temp_buffer.resize(3); - } break; - case SPEAKER_SURROUND_71: { - temp_buffer.resize(4); - } break; - } + + temp_buffer.resize(get_channel_count()); for (int i = 0; i < temp_buffer.size(); i++) { temp_buffer[i].resize(buffer_size); @@ -816,11 +868,11 @@ void AudioServer::init() { mix_count = 0; set_bus_count(1); - ; set_bus_name(0, "Master"); if (AudioDriver::get_singleton()) AudioDriver::get_singleton()->start(); + #ifdef TOOLS_ENABLED set_edited(false); //avoid editors from thinking this was edited #endif @@ -992,8 +1044,8 @@ void AudioServer::set_bus_layout(const Ref<AudioBusLayout> &p_bus_layout) { bus_map[bus->name] = bus; buses[i] = bus; - buses[i]->channels.resize(_get_channel_count()); - for (int j = 0; j < _get_channel_count(); j++) { + buses[i]->channels.resize(get_channel_count()); + for (int j = 0; j < get_channel_count(); j++) { buses[i]->channels[j].buffer.resize(buffer_size); } _update_bus_effects(i); @@ -1081,6 +1133,10 @@ void AudioServer::_bind_methods() { ClassDB::bind_method(D_METHOD("generate_bus_layout"), &AudioServer::generate_bus_layout); ADD_SIGNAL(MethodInfo("bus_layout_changed")); + + BIND_ENUM_CONSTANT(SPEAKER_MODE_STEREO); + BIND_ENUM_CONSTANT(SPEAKER_SURROUND_51); + BIND_ENUM_CONSTANT(SPEAKER_SURROUND_71); } AudioServer::AudioServer() { diff --git a/servers/audio_server.h b/servers/audio_server.h index 13a74856c8..55e9367308 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -35,6 +35,8 @@ #include "servers/audio/audio_effect.h" #include "variant.h" +class AudioDriverDummy; + class AudioDriver { static AudioDriver *singleton; @@ -50,6 +52,7 @@ public: enum SpeakerMode { SPEAKER_MODE_STEREO, + SPEAKER_SURROUND_31, SPEAKER_SURROUND_51, SPEAKER_SURROUND_71, }; @@ -72,6 +75,9 @@ public: virtual float get_latency() { return 0; } + SpeakerMode get_speaker_mode_by_total_channels(int p_channels) const; + int get_total_channels_by_speaker_mode(SpeakerMode) const; + AudioDriver(); virtual ~AudioDriver() {} }; @@ -86,8 +92,11 @@ class AudioDriverManager { static AudioDriver *drivers[MAX_DRIVERS]; static int driver_count; + static AudioDriverDummy dummy_driver; + public: static void add_driver(AudioDriver *p_driver); + static void initialize(int p_driver); static int get_driver_count(); static AudioDriver *get_driver(int p_driver); }; @@ -101,6 +110,7 @@ public: //re-expose this her, as AudioDriver is not exposed to script enum SpeakerMode { SPEAKER_MODE_STEREO, + SPEAKER_SURROUND_31, SPEAKER_SURROUND_51, SPEAKER_SURROUND_71, }; @@ -163,15 +173,6 @@ private: Vector<Bus *> buses; Map<StringName, Bus *> bus_map; - _FORCE_INLINE_ int _get_channel_count() const { - switch (AudioDriver::get_singleton()->get_speaker_mode()) { - case AudioDriver::SPEAKER_MODE_STEREO: return 1; - case AudioDriver::SPEAKER_SURROUND_51: return 3; - case AudioDriver::SPEAKER_SURROUND_71: return 4; - } - ERR_FAIL_V(1); - } - void _update_bus_effects(int p_bus); static AudioServer *singleton; @@ -205,6 +206,16 @@ protected: static void _bind_methods(); public: + _FORCE_INLINE_ int get_channel_count() const { + switch (get_speaker_mode()) { + case SPEAKER_MODE_STEREO: return 1; + case SPEAKER_SURROUND_31: return 2; + case SPEAKER_SURROUND_51: return 3; + case SPEAKER_SURROUND_71: return 4; + } + ERR_FAIL_V(1); + } + //do not use from outside audio thread AudioFrame *thread_get_channel_mix_buffer(int p_bus, int p_buffer); int thread_get_mix_buffer_size() const; diff --git a/servers/physics/broad_phase_basic.h b/servers/physics/broad_phase_basic.h index 51a24f4678..5c124c1792 100644 --- a/servers/physics/broad_phase_basic.h +++ b/servers/physics/broad_phase_basic.h @@ -82,7 +82,7 @@ class BroadPhaseBasic : public BroadPhaseSW { public: // 0 is an invalid ID - virtual ID create(CollisionObjectSW *p_object_, int p_subindex = 0); + virtual ID create(CollisionObjectSW *p_object, int p_subindex = 0); virtual void move(ID p_id, const Rect3 &p_aabb); virtual void set_static(ID p_id, bool p_static); virtual void remove(ID p_id); diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index 1845188089..6dafaac115 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -954,6 +954,9 @@ Vector3 ConvexPolygonShapeSW::get_moment_of_inertia(real_t p_mass) const { void ConvexPolygonShapeSW::_setup(const Vector<Vector3> &p_vertices) { Error err = QuickHull::build(p_vertices, mesh); + if (err != OK) + ERR_PRINT("Failed to build QuickHull"); + Rect3 _aabb; for (int i = 0; i < mesh.vertices.size(); i++) { @@ -1208,8 +1211,6 @@ void ConcavePolygonShapeSW::_cull_segment(int p_idx, _SegmentCullParams *p_param p_params->min_d = d; p_params->result = res; p_params->normal = Plane(vertices[0], vertices[1], vertices[2]).normal; - if (p_params->normal.dot(p_params->dir) > 0) - p_params->normal = -p_params->normal; p_params->collisions++; } } diff --git a/servers/physics/step_sw.cpp b/servers/physics/step_sw.cpp index 79a55e0af1..76b097dda6 100644 --- a/servers/physics/step_sw.cpp +++ b/servers/physics/step_sw.cpp @@ -62,7 +62,7 @@ void StepSW::_setup_island(ConstraintSW *p_island, real_t p_delta) { ConstraintSW *ci = p_island; while (ci) { - bool process = ci->setup(p_delta); + ci->setup(p_delta); //todo remove from island if process fails ci = ci->get_island_next(); } diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 779f0d54ac..8f22d1cd44 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -518,7 +518,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co body_aabb = body_aabb.grow(p_margin); static const int max_excluded_shape_pairs = 32; - Pair<Shape2DSW *, Shape2DSW *> excluded_shape_pairs[max_excluded_shape_pairs]; + ExcludedShapeSW excluded_shape_pairs[max_excluded_shape_pairs]; int excluded_shape_pair_count = 0; Transform2D body_transform = p_from; @@ -577,7 +577,11 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co if (!collided && cbk.invalid_by_dir > 0) { //this shape must be excluded if (excluded_shape_pair_count < max_excluded_shape_pairs) { - excluded_shape_pairs[excluded_shape_pair_count++] = Pair<Shape2DSW *, Shape2DSW *>(body_shape, against_shape); + ExcludedShapeSW esp; + esp.local_shape = body_shape; + esp.against_object = col_obj; + esp.against_shape_index = shape_idx; + excluded_shape_pairs[excluded_shape_pair_count++] = esp; } } } @@ -645,7 +649,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co for (int k = 0; k < excluded_shape_pair_count; k++) { - if (excluded_shape_pairs[k].first == body_shape && excluded_shape_pairs[k].second == against_shape) { + if (excluded_shape_pairs[k].local_shape == body_shape && excluded_shape_pairs[k].against_object == col_obj && excluded_shape_pairs[k].against_shape_index == shape_idx) { excluded = true; break; } @@ -776,7 +780,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co bool excluded = false; for (int k = 0; k < excluded_shape_pair_count; k++) { - if (excluded_shape_pairs[k].first == body_shape && excluded_shape_pairs[k].second == against_shape) { + if (excluded_shape_pairs[k].local_shape == body_shape && excluded_shape_pairs[k].against_object == col_obj && excluded_shape_pairs[k].against_shape_index == shape_idx) { excluded = true; break; } diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h index ed6136e372..c7e7497397 100644 --- a/servers/physics_2d/space_2d_sw.h +++ b/servers/physics_2d/space_2d_sw.h @@ -71,6 +71,12 @@ public: }; private: + struct ExcludedShapeSW { + Shape2DSW *local_shape; + const CollisionObject2DSW *against_object; + int against_shape_index; + }; + uint64_t elapsed_time[ELAPSED_TIME_MAX]; Physics2DDirectSpaceStateSW *direct_access; diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index d4e37be882..28ab31b8f6 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -704,6 +704,20 @@ void PhysicsServer::_bind_methods() { BIND_ENUM_CONSTANT(INFO_ACTIVE_OBJECTS); BIND_ENUM_CONSTANT(INFO_COLLISION_PAIRS); BIND_ENUM_CONSTANT(INFO_ISLAND_COUNT); + + BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_RECYCLE_RADIUS); + BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_MAX_SEPARATION); + BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION); + BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD); + BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD); + BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_TIME_TO_SLEEP); + BIND_ENUM_CONSTANT(SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO); + BIND_ENUM_CONSTANT(SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS); + + BIND_ENUM_CONSTANT(BODY_AXIS_LOCK_DISABLED); + BIND_ENUM_CONSTANT(BODY_AXIS_LOCK_X); + BIND_ENUM_CONSTANT(BODY_AXIS_LOCK_Y); + BIND_ENUM_CONSTANT(BODY_AXIS_LOCK_Z); } PhysicsServer::PhysicsServer() { diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index c7b02c92f7..6ad433268f 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -3000,8 +3000,6 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha if (op->op == OP_CONSTRUCT) { ERR_FAIL_COND_V(op->arguments[0]->type != Node::TYPE_VARIABLE, p_node); - VariableNode *vn = static_cast<VariableNode *>(op->arguments[0]); - //StringName name=vn->name; DataType base = get_scalar_type(op->get_datatype()); @@ -3121,8 +3119,8 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat tk = _get_token(); VariableDeclarationNode *vardecl = alloc_node<VariableDeclarationNode>(); - vardecl->datatype=type; - vardecl->precision=precision; + vardecl->datatype = type; + vardecl->precision = precision; p_block->statements.push_back(vardecl); @@ -3148,8 +3146,8 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat VariableDeclarationNode::Declaration decl; - decl.name=name; - decl.initializer=NULL; + decl.name = name; + decl.initializer = NULL; tk = _get_token(); @@ -3161,13 +3159,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat decl.initializer = n; - if (var.type!=n->get_datatype()) { + if (var.type != n->get_datatype()) { _set_error("Invalid assignment of '" + get_datatype_name(n->get_datatype()) + "' to '" + get_datatype_name(var.type) + "'"); return ERR_PARSE_ERROR; - } tk = _get_token(); - } vardecl->declarations.push_back(decl); @@ -3272,9 +3268,9 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat BlockNode *init_block = alloc_node<BlockNode>(); init_block->parent_block = p_block; - init_block->single_statement=true; + init_block->single_statement = true; cf->blocks.push_back(init_block); - if (_parse_block(init_block,p_builtin_types,true,false,false)!=OK) { + if (_parse_block(init_block, p_builtin_types, true, false, false) != OK) { return ERR_PARSE_ERROR; } @@ -3282,10 +3278,9 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat if (!n) return ERR_PARSE_ERROR; - if (n->get_datatype()!=TYPE_BOOL) { + if (n->get_datatype() != TYPE_BOOL) { _set_error("Middle expression is expected to be boolean."); return ERR_PARSE_ERROR; - } tk = _get_token(); @@ -3392,7 +3387,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat p_block->statements.push_back(flow); } else if (tk.type == TK_CF_BREAK) { - if (!p_can_break) { //all is good _set_error("Breaking is not allowed here"); @@ -3411,7 +3405,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat p_block->statements.push_back(flow); } else if (tk.type == TK_CF_CONTINUE) { - if (!p_can_break) { //all is good _set_error("Contiuning is not allowed here"); @@ -3980,6 +3973,8 @@ Error ShaderLanguage::complete(const String &p_code, const Map<StringName, Funct shader = alloc_node<ShaderNode>(); Error err = _parse_shader(p_functions, p_render_modes, p_shader_types); + if (err != OK) + ERR_PRINT("Failed to parse shader"); switch (completion_type) { diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h index 50f5cebeaa..7a7f6dd71c 100644 --- a/servers/visual/shader_language.h +++ b/servers/visual/shader_language.h @@ -371,7 +371,7 @@ public: type = TYPE_BLOCK; parent_block = NULL; parent_function = NULL; - single_statement=false; + single_statement = false; } }; diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 48ce9e7288..9fb4dc524d 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -151,8 +151,6 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance } else if (B->base_type == VS::INSTANCE_GI_PROBE && A->base_type == VS::INSTANCE_LIGHT) { InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(B->base_data); - InstanceLightData *light = static_cast<InstanceLightData *>(A->base_data); - return gi_probe->lights.insert(A); } @@ -211,8 +209,6 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance } else if (B->base_type == VS::INSTANCE_GI_PROBE && A->base_type == VS::INSTANCE_LIGHT) { InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(B->base_data); - InstanceLightData *light = static_cast<InstanceLightData *>(A->base_data); - Set<Instance *>::Element *E = reinterpret_cast<Set<Instance *>::Element *>(udata); gi_probe->lights.erase(E); @@ -2130,7 +2126,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co int success_count = 0; - uint64_t us = OS::get_singleton()->get_ticks_usec(); + // uint64_t us = OS::get_singleton()->get_ticks_usec(); for (int i = 0; i < p_leaf_count; i++) { @@ -2183,14 +2179,15 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co success_count++; } } - //print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); - //print_line("valid cells: " + itos(success_count)); + + // print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); + // print_line("valid cells: " + itos(success_count)); } break; case VS::LIGHT_OMNI: case VS::LIGHT_SPOT: { - uint64_t us = OS::get_singleton()->get_ticks_usec(); + // uint64_t us = OS::get_singleton()->get_ticks_usec(); Vector3 light_pos = light_cache.transform.origin; Vector3 spot_axis = -light_cache.transform.basis.get_axis(2).normalized(); @@ -2289,8 +2286,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co light->energy[2] += int32_t(light_b * att * ((cell->albedo) & 0xFF) / 255.0); } } - //print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); - + // print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); } break; } } @@ -2702,18 +2698,17 @@ void VisualServerScene::render_probes() { } break; case GI_UPDATE_STAGE_UPLOADING: { - uint64_t us = OS::get_singleton()->get_ticks_usec(); + // uint64_t us = OS::get_singleton()->get_ticks_usec(); for (int i = 0; i < (int)probe->dynamic.mipmaps_3d.size(); i++) { - int mmsize = probe->dynamic.mipmaps_3d[i].size(); PoolVector<uint8_t>::Read r = probe->dynamic.mipmaps_3d[i].read(); VSG::storage->gi_probe_dynamic_data_update(probe->dynamic.probe_data, 0, probe->dynamic.grid_size[2] >> i, i, r.ptr()); } probe->dynamic.updating_stage = GI_UPDATE_STAGE_CHECK; - //print_line("UPLOAD TIME: "+rtos((OS::get_singleton()->get_ticks_usec()-us)/1000000.0)); + // print_line("UPLOAD TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0)); } break; } } |