diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/register_scene_types.cpp | 226 | ||||
-rw-r--r-- | scene/resources/gibberish_stream.cpp | 337 | ||||
-rw-r--r-- | scene/resources/gibberish_stream.h | 118 | ||||
-rw-r--r-- | scene/resources/material.cpp | 1 |
4 files changed, 80 insertions, 602 deletions
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 7d9e262b3f..283514dd53 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -28,21 +28,44 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "register_scene_types.h" -#include "os/os.h" -#include "project_settings.h" -#include "scene/io/resource_format_image.h" -#include "scene/io/resource_format_wav.h" -//#include "scene/io/scene_format_script.h" -#include "class_db.h" -#include "resources/default_theme/default_theme.h" +#include "core/class_db.h" +#include "core/os/os.h" +#include "core/project_settings.h" +#include "scene/2d/animated_sprite.h" +#include "scene/2d/area_2d.h" +#include "scene/2d/audio_stream_player_2d.h" +#include "scene/2d/back_buffer_copy.h" +#include "scene/2d/camera_2d.h" +#include "scene/2d/canvas_item.h" +#include "scene/2d/canvas_modulate.h" +#include "scene/2d/collision_polygon_2d.h" +#include "scene/2d/collision_shape_2d.h" +#include "scene/2d/joints_2d.h" #include "scene/2d/light_2d.h" #include "scene/2d/light_occluder_2d.h" +#include "scene/2d/line_2d.h" +#include "scene/2d/navigation2d.h" +#include "scene/2d/parallax_background.h" +#include "scene/2d/parallax_layer.h" #include "scene/2d/particles_2d.h" #include "scene/2d/path_2d.h" +#include "scene/2d/physics_body_2d.h" +#include "scene/2d/polygon_2d.h" +#include "scene/2d/position_2d.h" +#include "scene/2d/ray_cast_2d.h" +#include "scene/2d/remote_transform_2d.h" +#include "scene/2d/screen_button.h" +#include "scene/2d/sprite.h" +#include "scene/2d/tile_map.h" +#include "scene/2d/visibility_notifier_2d.h" +#include "scene/2d/y_sort.h" +#include "scene/animation/animation_player.h" +#include "scene/animation/animation_tree_player.h" +#include "scene/animation/tween.h" +#include "scene/audio/audio_player.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" - #include "scene/gui/button_group.h" #include "scene/gui/center_container.h" #include "scene/gui/check_box.h" @@ -85,157 +108,90 @@ #include "scene/gui/tree.h" #include "scene/gui/video_player.h" #include "scene/gui/viewport_container.h" +#include "scene/io/resource_format_image.h" +#include "scene/io/resource_format_wav.h" #include "scene/main/canvas_layer.h" #include "scene/main/http_request.h" #include "scene/main/instance_placeholder.h" -#include "scene/main/viewport.h" -#include "scene/resources/audio_stream_sample.h" -#include "scene/resources/video_stream.h" - -#include "scene/2d/animated_sprite.h" -#include "scene/2d/back_buffer_copy.h" -#include "scene/2d/canvas_item.h" -#include "scene/2d/polygon_2d.h" -#include "scene/2d/sprite.h" - -#include "scene/2d/visibility_notifier_2d.h" - -#include "scene/2d/area_2d.h" -#include "scene/2d/camera_2d.h" -#include "scene/2d/collision_polygon_2d.h" -#include "scene/2d/collision_shape_2d.h" -#include "scene/2d/joints_2d.h" -#include "scene/2d/parallax_background.h" -#include "scene/2d/parallax_layer.h" -#include "scene/2d/physics_body_2d.h" -#include "scene/2d/ray_cast_2d.h" -//#include "scene/2d/sound_player_2d.h" -//#include "scene/2d/sample_player_2d.h" -#include "scene/2d/audio_stream_player_2d.h" -#include "scene/2d/canvas_modulate.h" -#include "scene/2d/navigation2d.h" -#include "scene/2d/remote_transform_2d.h" -#include "scene/2d/screen_button.h" -#include "scene/2d/y_sort.h" - -#include "scene/2d/position_2d.h" -#include "scene/2d/tile_map.h" -//#include "scene/2d/tile_map.h" -#include "scene/2d/line_2d.h" - -#include "scene/resources/tile_set.h" - -#include "scene/animation/animation_player.h" -#include "scene/animation/animation_tree_player.h" -#include "scene/animation/tween.h" #include "scene/main/resource_preloader.h" #include "scene/main/scene_tree.h" -#include "scene/resources/packed_scene.h" - -#include "scene/resources/mesh_data_tool.h" -#include "scene/resources/surface_tool.h" - -#include "scene/resources/dynamic_font.h" -#include "scene/resources/dynamic_font_stb.h" - #include "scene/main/timer.h" - -#include "scene/audio/audio_player.h" -//#include "scene/audio/event_player.h" -//#include "scene/audio/sound_room_params.h" +#include "scene/main/viewport.h" +#include "scene/resources/audio_stream_sample.h" +#include "scene/resources/bit_mask.h" #include "scene/resources/box_shape.h" #include "scene/resources/capsule_shape.h" -#include "scene/resources/concave_polygon_shape.h" -#include "scene/resources/convex_polygon_shape.h" -#include "scene/resources/plane_shape.h" -#include "scene/resources/ray_shape.h" -#include "scene/resources/sphere_shape.h" - #include "scene/resources/capsule_shape_2d.h" #include "scene/resources/circle_shape_2d.h" +#include "scene/resources/color_ramp.h" +#include "scene/resources/concave_polygon_shape.h" #include "scene/resources/concave_polygon_shape_2d.h" +#include "scene/resources/convex_polygon_shape.h" #include "scene/resources/convex_polygon_shape_2d.h" +#include "scene/resources/default_theme/default_theme.h" +#include "scene/resources/dynamic_font.h" +#include "scene/resources/dynamic_font_stb.h" +#include "scene/resources/material.h" +#include "scene/resources/mesh.h" +#include "scene/resources/mesh_data_tool.h" +#include "scene/resources/mesh_library.h" +#include "scene/resources/packed_scene.h" +#include "scene/resources/plane_shape.h" +#include "scene/resources/polygon_path_finder.h" +#include "scene/resources/primitive_meshes.h" +#include "scene/resources/ray_shape.h" #include "scene/resources/rectangle_shape_2d.h" +#include "scene/resources/scene_format_text.h" #include "scene/resources/segment_shape_2d.h" +#include "scene/resources/shader_graph.h" #include "scene/resources/shape_line_2d.h" - -#include "scene/resources/mesh_library.h" - -#include "scene/resources/polygon_path_finder.h" - -//#include "scene/resources/sample.h" -#include "scene/3d/audio_stream_player_3d.h" -#include "scene/resources/material.h" -#include "scene/resources/mesh.h" - #include "scene/resources/sky_box.h" +#include "scene/resources/sphere_shape.h" +#include "scene/resources/surface_tool.h" #include "scene/resources/texture.h" - -#include "scene/resources/primitive_meshes.h" - -#include "scene/resources/shader_graph.h" - +#include "scene/resources/tile_set.h" +#include "scene/resources/video_stream.h" #include "scene/resources/world.h" #include "scene/resources/world_2d.h" - -//#include "scene/resources/sample_library.h" -//#include "scene/resources/audio_stream.h" -#include "scene/resources/bit_mask.h" -#include "scene/resources/color_ramp.h" -#include "scene/resources/gibberish_stream.h" #include "scene/scene_string_names.h" -#include "scene/3d/bone_attachment.h" -#include "scene/3d/path.h" -#include "scene/3d/remote_transform.h" -#include "scene/3d/room_instance.h" -#include "scene/3d/scenario_fx.h" -#include "scene/3d/skeleton.h" -#include "scene/3d/spatial.h" - -#include "scene/3d/visibility_notifier.h" - #ifndef _3D_DISABLED -#include "scene/3d/camera.h" -#include "scene/3d/listener.h" - +#include "scene/3d/area.h" #include "scene/3d/arvr_nodes.h" - +#include "scene/3d/audio_stream_player_3d.h" +#include "scene/3d/bone_attachment.h" +#include "scene/3d/camera.h" +#include "scene/3d/collision_polygon.h" +#include "scene/3d/collision_shape.h" #include "scene/3d/gi_probe.h" +#include "scene/3d/immediate_geometry.h" #include "scene/3d/interpolated_camera.h" #include "scene/3d/light.h" +#include "scene/3d/listener.h" #include "scene/3d/mesh_instance.h" +#include "scene/3d/multimesh_instance.h" +#include "scene/3d/navigation.h" +#include "scene/3d/navigation_mesh.h" #include "scene/3d/particles.h" +#include "scene/3d/path.h" #include "scene/3d/physics_body.h" +#include "scene/3d/physics_joint.h" #include "scene/3d/portal.h" #include "scene/3d/position_3d.h" -#include "scene/3d/reflection_probe.h" -#include "scene/resources/environment.h" - -#include "scene/3d/area.h" - -#include "scene/3d/collision_shape.h" -#include "scene/3d/immediate_geometry.h" -#include "scene/3d/multimesh_instance.h" -#include "scene/3d/physics_joint.h" +#include "scene/3d/proximity_group.h" #include "scene/3d/ray_cast.h" +#include "scene/3d/reflection_probe.h" +#include "scene/3d/remote_transform.h" +#include "scene/3d/room_instance.h" +#include "scene/3d/scenario_fx.h" +#include "scene/3d/skeleton.h" +#include "scene/3d/spatial.h" #include "scene/3d/sprite_3d.h" #include "scene/3d/vehicle_body.h" -//#include "scene/3d/spatial_sample_player.h" -//#include "scene/3d/spatial_stream_player.h" -#include "scene/3d/collision_polygon.h" -#include "scene/3d/navigation.h" -#include "scene/3d/navigation_mesh.h" -#include "scene/3d/proximity_group.h" +#include "scene/3d/visibility_notifier.h" +#include "scene/resources/environment.h" #endif -#include "scene/resources/scene_format_text.h" - -//static ResourceFormatLoaderWAV *resource_loader_wav=NULL; - -#ifdef TOOLS_ENABLED - -#endif static ResourceFormatLoaderTheme *resource_loader_theme = NULL; static ResourceFormatSaverText *resource_saver_text = NULL; @@ -245,8 +201,6 @@ static ResourceFormatLoaderDynamicFont *resource_loader_dynamic_font = NULL; static ResourceFormatLoaderStreamTexture *resource_loader_stream_texture = NULL; -//static SceneStringNames *string_names; - void register_scene_types() { SceneStringNames::create(); @@ -255,20 +209,12 @@ void register_scene_types() { Node::init_node_hrcr(); - //resource_loader_wav = memnew( ResourceFormatLoaderWAV ); - //ResourceLoader::add_resource_format_loader( resource_loader_wav ); resource_loader_dynamic_font = memnew(ResourceFormatLoaderDynamicFont); ResourceLoader::add_resource_format_loader(resource_loader_dynamic_font); resource_loader_stream_texture = memnew(ResourceFormatLoaderStreamTexture); ResourceLoader::add_resource_format_loader(resource_loader_stream_texture); -#ifdef TOOLS_ENABLED - -//scene first! - -#endif - resource_loader_theme = memnew(ResourceFormatLoaderTheme); ResourceLoader::add_resource_format_loader(resource_loader_theme); @@ -316,7 +262,6 @@ void register_scene_types() { ClassDB::register_class<ShortCut>(); ClassDB::register_class<Control>(); - //ClassDB::register_type<EmptyControl>(); ClassDB::register_class<Button>(); ClassDB::register_class<Label>(); ClassDB::register_class<HScrollBar>(); @@ -424,7 +369,6 @@ void register_scene_types() { ClassDB::register_class<GIProbe>(); ClassDB::register_class<GIProbeData>(); ClassDB::register_class<AnimationTreePlayer>(); - //ClassDB::register_class<Portal>(); ClassDB::register_class<Particles>(); ClassDB::register_class<Position3D>(); ClassDB::register_class<NavigationMeshInstance>(); @@ -452,8 +396,6 @@ void register_scene_types() { ClassDB::register_class<PathFollow>(); ClassDB::register_class<VisibilityNotifier>(); ClassDB::register_class<VisibilityEnabler>(); - // ClassDB::register_class<BakedLight>(); - //ClassDB::register_type<BakedLightSampler>(); ClassDB::register_class<WorldEnvironment>(); ClassDB::register_class<RemoteTransform>(); @@ -464,8 +406,6 @@ void register_scene_types() { ClassDB::register_class<ConeTwistJoint>(); ClassDB::register_class<Generic6DOFJoint>(); - //scenariofx - OS::get_singleton()->yield(); //may take time to init #endif @@ -545,7 +485,6 @@ void register_scene_types() { SceneTree::add_idle_callback(ParticlesMaterial::flush_changes); ParticlesMaterial::init_shaders(); - //ClassDB::register_type<ShaderMaterial>(); ClassDB::register_class<MultiMesh>(); ClassDB::register_class<MeshLibrary>(); @@ -561,7 +500,6 @@ void register_scene_types() { ClassDB::register_class<SurfaceTool>(); ClassDB::register_class<MeshDataTool>(); - //ClassDB::register_type<BakedLight>(); OS::get_singleton()->yield(); //may take time to init @@ -660,14 +598,8 @@ void unregister_scene_types() { clear_default_theme(); - // memdelete( resource_loader_wav ); memdelete(resource_loader_dynamic_font); memdelete(resource_loader_stream_texture); - -#ifdef TOOLS_ENABLED - -#endif - memdelete(resource_loader_theme); if (resource_saver_text) { diff --git a/scene/resources/gibberish_stream.cpp b/scene/resources/gibberish_stream.cpp deleted file mode 100644 index e2994f1419..0000000000 --- a/scene/resources/gibberish_stream.cpp +++ /dev/null @@ -1,337 +0,0 @@ -/*************************************************************************/ -/* gibberish_stream.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "gibberish_stream.h" -#include "servers/audio_server.h" - -//TODO: This class needs to be adapted to the new AudioStream API, -// or dropped if nobody cares about fixing it :) (GH-3307) - -#if 0 - -int AudioStreamGibberish::get_channel_count() const { - - return 1; -} - - -static float _get_vol_at_pos(int p_pos, int p_len, int p_x_fade) { - - if (p_pos < p_x_fade) - return float(p_pos)/p_x_fade; - else if (p_pos>(p_len-p_x_fade)) - return float(p_len-p_pos)/p_x_fade; - else - return 1.0; - -} - int AudioStreamGibberish::randomize() { - - if (rand_idx==_rand_pool.size()) { - - for(int i=0;i<_rand_pool.size();i++) { - - SWAP(_rand_pool[i],_rand_pool[Math::rand()%_rand_pool.size()]); - } - rand_idx=0; - } - - return _rand_pool[rand_idx++]; -} - -bool AudioStreamGibberish::mix(int32_t *p_buffer, int p_frames) { - - if (!active) - return false; - - zeromem(p_buffer,p_frames*sizeof(int32_t)); - - if (!paused && active_voices==0) { - - active_voices=1; - playback[0].idx=randomize(); - playback[0].fp_pos=0; - playback[0].scale=Math::random(1,1+pitch_random_scale); - } - - for(int i=0;i<active_voices;i++) { - - RID s = _samples[playback[i].idx]->get_rid(); - - uint64_t fp_pos=playback[i].fp_pos; - const void *data = AudioServer::get_singleton()->sample_get_data_ptr(s); - bool is16 = AudioServer::get_singleton()->sample_get_format(s)==AudioServer::SAMPLE_FORMAT_PCM16; - int skip = AudioServer::get_singleton()->sample_is_stereo(s) ? 1: 0; - uint64_t max = AudioServer::get_singleton()->sample_get_length(s) * uint64_t(FP_LEN); - int mrate = AudioServer::get_singleton()->sample_get_mix_rate(s) * pitch_scale * playback[i].scale; - uint64_t increment = uint64_t(mrate) * uint64_t(FP_LEN) / get_mix_rate(); - - - float vol_begin = _get_vol_at_pos(fp_pos>>FP_BITS,max>>FP_BITS,xfade_time*mrate); - float vol_end = _get_vol_at_pos((fp_pos+p_frames*increment)>>FP_BITS,max>>FP_BITS,xfade_time*mrate); - - int32_t vol = CLAMP(int32_t(vol_begin * 65535),0,65535); - int32_t vol_to = CLAMP(int32_t(vol_end * 65535),0,65535); - int32_t vol_inc = (vol_to-vol)/p_frames; - - bool done=false; - - if (is16) { - - const int16_t *smp = (int16_t*)data; - for(int i=0;i<p_frames;i++) { - - if (fp_pos >= max) { - done=true; - break; - } - - int idx = (fp_pos>>FP_BITS)<<skip; - p_buffer[i]+=int32_t(smp[idx])*vol; - vol+=vol_inc; - - fp_pos+=increment; - } - } else { - - const int8_t *smp = (int8_t*)data; - for(int i=0;i<p_frames;i++) { - - if (fp_pos >= max) { - done=true; - break; - } - - int idx = (fp_pos>>FP_BITS)<<skip; - p_buffer[i]+=(int32_t(smp[idx])<<8)*vol; - vol+=vol_inc; - fp_pos+=increment; - } - - } - - playback[i].fp_pos=fp_pos; - if (!paused && active_voices==1 && (vol_end < vol_begin || done)) { - //xfade to something else i gues - active_voices=2; - playback[1].idx=randomize(); - playback[1].fp_pos=0; - playback[1].scale=Math::random(1,1+pitch_random_scale); - } - - if (done) { - - if (i==0 && active_voices==2) { - playback[0]=playback[1]; - i--; - } - active_voices--; - - } - } - - return true; -} - - -void AudioStreamGibberish::play() { - if (active) - stop(); - - - if (!phonemes.is_valid()) - return; - - - List<StringName> slist; - phonemes->get_sample_list(&slist); - if (slist.size()==0) - return; - - _samples.resize(slist.size()); - _rand_pool.resize(slist.size()); - - int i=0; - for(List<StringName>::Element *E=slist.front();E;E=E->next()) { - - _rand_pool[i]=i; - _samples[i++]=phonemes->get_sample(E->get()); - } - - rand_idx=0; - active_voices=0; - active=true; -} - -void AudioStreamGibberish::stop(){ - - active=false; - - -} - -bool AudioStreamGibberish::is_playing() const { - - return active; -} - - -void AudioStreamGibberish::set_paused(bool p_paused){ - - paused=p_paused; -} - -bool AudioStreamGibberish::is_paused(bool p_paused) const{ - - return paused; -} - -void AudioStreamGibberish::set_loop(bool p_enable){ - - -} - -bool AudioStreamGibberish::has_loop() const{ - - return false; -} - - -float AudioStreamGibberish::get_length() const{ - - return 0; -} - - -String AudioStreamGibberish::get_stream_name() const{ - - return "Gibberish"; -} - - -int AudioStreamGibberish::get_loop_count() const{ - - return 0; -} - - -float AudioStreamGibberish::get_pos() const{ - - return 0; -} - -void AudioStreamGibberish::seek_pos(float p_time){ - - -} - - -AudioStream::UpdateMode AudioStreamGibberish::get_update_mode() const{ - - return AudioStream::UPDATE_NONE; -} - -void AudioStreamGibberish::update(){ - - -} - - -void AudioStreamGibberish::set_phonemes(const Ref<SampleLibrary>& p_phonemes) { - - phonemes=p_phonemes; - -} - -Ref<SampleLibrary> AudioStreamGibberish::get_phonemes() const { - - return phonemes; -} - -void AudioStreamGibberish::set_xfade_time(float p_xfade) { - - xfade_time=p_xfade; -} - -float AudioStreamGibberish::get_xfade_time() const { - - return xfade_time; -} - -void AudioStreamGibberish::set_pitch_scale(float p_scale) { - - pitch_scale=p_scale; -} - -float AudioStreamGibberish::get_pitch_scale() const { - - return pitch_scale; -} - -void AudioStreamGibberish::set_pitch_random_scale(float p_random_scale) { - - pitch_random_scale=p_random_scale; -} - -float AudioStreamGibberish::get_pitch_random_scale() const { - - return pitch_random_scale; -} - -void AudioStreamGibberish::_bind_methods() { - - ClassDB::bind_method(D_METHOD("set_phonemes","phonemes"),&AudioStreamGibberish::set_phonemes); - ClassDB::bind_method(D_METHOD("get_phonemes"),&AudioStreamGibberish::get_phonemes); - - ClassDB::bind_method(D_METHOD("set_pitch_scale","pitch_scale"),&AudioStreamGibberish::set_pitch_scale); - ClassDB::bind_method(D_METHOD("get_pitch_scale"),&AudioStreamGibberish::get_pitch_scale); - - ClassDB::bind_method(D_METHOD("set_pitch_random_scale","pitch_random_scale"),&AudioStreamGibberish::set_pitch_random_scale); - ClassDB::bind_method(D_METHOD("get_pitch_random_scale"),&AudioStreamGibberish::get_pitch_random_scale); - - ClassDB::bind_method(D_METHOD("set_xfade_time","sec"),&AudioStreamGibberish::set_xfade_time); - ClassDB::bind_method(D_METHOD("get_xfade_time"),&AudioStreamGibberish::get_xfade_time); - - ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"phonemes",PROPERTY_HINT_RESOURCE_TYPE,"SampleLibrary"),"set_phonemes","get_phonemes"); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"pitch_scale",PROPERTY_HINT_RANGE,"0.01,64,0.01"),"set_pitch_scale","get_pitch_scale"); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"pitch_random_scale",PROPERTY_HINT_RANGE,"0,64,0.01"),"set_pitch_random_scale","get_pitch_random_scale"); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"xfade_sec",PROPERTY_HINT_RANGE,"0.001,0.5,0.001"),"set_xfade_time","get_xfade_time"); - -} - -AudioStreamGibberish::AudioStreamGibberish() { - - xfade_time=0.1; - pitch_scale=1; - pitch_random_scale=0; - active=false; - paused=false; - active_voices=0; -} -#endif diff --git a/scene/resources/gibberish_stream.h b/scene/resources/gibberish_stream.h deleted file mode 100644 index ebe61382eb..0000000000 --- a/scene/resources/gibberish_stream.h +++ /dev/null @@ -1,118 +0,0 @@ -/*************************************************************************/ -/* gibberish_stream.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GIBBERISH_STREAM_H -#define GIBBERISH_STREAM_H - -//TODO: This class needs to be adapted to the new AudioStream API, -// or dropped if nobody cares about fixing it :) (GH-3307) - -#if 0 -#include "scene/resources/audio_stream.h" -#include "scene/resources/sample_library.h" -class AudioStreamGibberish : public AudioStream { - - GDCLASS( AudioStreamGibberish, AudioStream ); - - enum { - - FP_BITS = 12, - FP_LEN = (1<<12), - }; - bool active; - bool paused; - - float xfade_time; - float pitch_scale; - float pitch_random_scale; - Vector<Ref<Sample> > _samples; - Vector<int> _rand_pool; - int rand_idx; - _FORCE_INLINE_ int randomize(); - - struct Playback { - - int idx; - uint64_t fp_pos; - float scale; - }; - - Playback playback[2]; - int active_voices; - - Ref<SampleLibrary> phonemes; -protected: - - virtual int get_channel_count() const; - virtual bool mix(int32_t *p_buffer, int p_frames); - - static void _bind_methods(); - -public: - - void set_phonemes(const Ref<SampleLibrary>& p_phonemes); - Ref<SampleLibrary> get_phonemes() const; - - virtual void play(); - virtual void stop(); - virtual bool is_playing() const; - - virtual void set_paused(bool p_paused); - virtual bool is_paused(bool p_paused) const; - - virtual void set_loop(bool p_enable); - virtual bool has_loop() const; - - virtual float get_length() const; - - virtual String get_stream_name() const; - - virtual int get_loop_count() const; - - virtual float get_pos() const; - virtual void seek_pos(float p_time); - - virtual UpdateMode get_update_mode() const; - virtual void update(); - - void set_xfade_time(float p_xfade); - float get_xfade_time() const; - - void set_pitch_scale(float p_scale); - float get_pitch_scale() const; - - void set_pitch_random_scale(float p_random_scale); - float get_pitch_random_scale() const; - - AudioStreamGibberish(); -}; - -#endif - -#endif // GIBBERISH_STREAM_H diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 555c94a512..f01d9f841b 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "material.h" + #include "scene/scene_string_names.h" void Material::set_next_pass(const Ref<Material> &p_pass) { |