diff options
Diffstat (limited to 'scene/resources')
104 files changed, 210 insertions, 1721 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 8878e59e71..1a2c8333ef 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "animation.h" + #include "geometry.h" bool Animation::_set(const StringName &p_name, const Variant &p_value) { @@ -83,44 +84,6 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { TransformTrack *tt = static_cast<TransformTrack *>(tracks[track]); PoolVector<float> values = p_value; int vcount = values.size(); - -#if 0 // old compatibility hack - if ((vcount%11) == 0) { - - - PoolVector<float>::Read r = values.read(); - - tt->transforms.resize(vcount/11); - - - for(int i=0;i<(vcount/11);i++) { - - - TKey<TransformKey> &tk=tt->transforms[i]; - const float *ofs=&r[i*11]; - tk.time=ofs[0]; - - tk.value.loc.x=ofs[1]; - tk.value.loc.y=ofs[2]; - tk.value.loc.z=ofs[3]; - - tk.value.rot.x=ofs[4]; - tk.value.rot.y=ofs[5]; - tk.value.rot.z=ofs[6]; - tk.value.rot.w=ofs[7]; - - tk.value.scale.x=ofs[8]; - tk.value.scale.y=ofs[9]; - tk.value.scale.z=ofs[10]; - - - } - return true; - - - - } -#endif ERR_FAIL_COND_V(vcount % 12, false); // shuld be multiple of 11 PoolVector<float>::Read r = values.read(); diff --git a/scene/resources/animation.h b/scene/resources/animation.h index 27c58aba8c..e653f6b124 100644 --- a/scene/resources/animation.h +++ b/scene/resources/animation.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/audio_stream_resampled.cpp b/scene/resources/audio_stream_resampled.cpp deleted file mode 100644 index 1b1d6f8587..0000000000 --- a/scene/resources/audio_stream_resampled.cpp +++ /dev/null @@ -1,388 +0,0 @@ -/*************************************************************************/ -/* audio_stream_resampled.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 "audio_stream_resampled.h" -#include "project_settings.h" - -#if 0 -int AudioStreamResampled::get_channel_count() const { - - if (!rb) - return 0; - - return channels; -} - - -template<int C> -uint32_t AudioStreamResampled::_resample(int32_t *p_dest,int p_todo,int32_t p_increment) { - - uint32_t read=offset&MIX_FRAC_MASK; - - for (int i=0;i<p_todo;i++) { - - offset = (offset + p_increment)&(((1<<(rb_bits+MIX_FRAC_BITS))-1)); - read+=p_increment; - uint32_t pos = offset >> MIX_FRAC_BITS; - uint32_t frac = offset & MIX_FRAC_MASK; -#ifndef FAST_AUDIO - ERR_FAIL_COND_V(pos>=rb_len,0); -#endif - uint32_t pos_next = (pos+1)&rb_mask; - //printf("rb pos %i\n",pos); - - // since this is a template with a known compile time value (C), conditionals go away when compiling. - if (C==1) { - - int32_t v0 = rb[pos]; - int32_t v0n=rb[pos_next]; -#ifndef FAST_AUDIO - v0+=(v0n-v0)*(int32_t)frac >> MIX_FRAC_BITS; -#endif - v0<<=16; - p_dest[i]=v0; - - } - if (C==2) { - - int32_t v0 = rb[(pos<<1)+0]; - int32_t v1 = rb[(pos<<1)+1]; - int32_t v0n=rb[(pos_next<<1)+0]; - int32_t v1n=rb[(pos_next<<1)+1]; - -#ifndef FAST_AUDIO - v0+=(v0n-v0)*(int32_t)frac >> MIX_FRAC_BITS; - v1+=(v1n-v1)*(int32_t)frac >> MIX_FRAC_BITS; -#endif - v0<<=16; - v1<<=16; - p_dest[(i<<1)+0]=v0; - p_dest[(i<<1)+1]=v1; - - } - - if (C==4) { - - int32_t v0 = rb[(pos<<2)+0]; - int32_t v1 = rb[(pos<<2)+1]; - int32_t v2 = rb[(pos<<2)+2]; - int32_t v3 = rb[(pos<<2)+3]; - int32_t v0n = rb[(pos_next<<2)+0]; - int32_t v1n=rb[(pos_next<<2)+1]; - int32_t v2n=rb[(pos_next<<2)+2]; - int32_t v3n=rb[(pos_next<<2)+3]; - -#ifndef FAST_AUDIO - v0+=(v0n-v0)*(int32_t)frac >> MIX_FRAC_BITS; - v1+=(v1n-v1)*(int32_t)frac >> MIX_FRAC_BITS; - v2+=(v2n-v2)*(int32_t)frac >> MIX_FRAC_BITS; - v3+=(v3n-v3)*(int32_t)frac >> MIX_FRAC_BITS; -#endif - v0<<=16; - v1<<=16; - v2<<=16; - v3<<=16; - p_dest[(i<<2)+0]=v0; - p_dest[(i<<2)+1]=v1; - p_dest[(i<<2)+2]=v2; - p_dest[(i<<2)+3]=v3; - - } - - if (C==6) { - - int32_t v0 = rb[(pos*6)+0]; - int32_t v1 = rb[(pos*6)+1]; - int32_t v2 = rb[(pos*6)+2]; - int32_t v3 = rb[(pos*6)+3]; - int32_t v4 = rb[(pos*6)+4]; - int32_t v5 = rb[(pos*6)+5]; - int32_t v0n = rb[(pos_next*6)+0]; - int32_t v1n=rb[(pos_next*6)+1]; - int32_t v2n=rb[(pos_next*6)+2]; - int32_t v3n=rb[(pos_next*6)+3]; - int32_t v4n=rb[(pos_next*6)+4]; - int32_t v5n=rb[(pos_next*6)+5]; - -#ifndef FAST_AUDIO - v0+=(v0n-v0)*(int32_t)frac >> MIX_FRAC_BITS; - v1+=(v1n-v1)*(int32_t)frac >> MIX_FRAC_BITS; - v2+=(v2n-v2)*(int32_t)frac >> MIX_FRAC_BITS; - v3+=(v3n-v3)*(int32_t)frac >> MIX_FRAC_BITS; - v4+=(v4n-v4)*(int32_t)frac >> MIX_FRAC_BITS; - v5+=(v5n-v5)*(int32_t)frac >> MIX_FRAC_BITS; -#endif - v0<<=16; - v1<<=16; - v2<<=16; - v3<<=16; - v4<<=16; - v5<<=16; - p_dest[(i*6)+0]=v0; - p_dest[(i*6)+1]=v1; - p_dest[(i*6)+2]=v2; - p_dest[(i*6)+3]=v3; - p_dest[(i*6)+4]=v4; - p_dest[(i*6)+5]=v5; - - } - - - } - - - return read>>MIX_FRAC_BITS;//rb_read_pos=offset>>MIX_FRAC_BITS; - -} - - -bool AudioStreamResampled::mix(int32_t *p_dest, int p_frames) { - - - if (!rb || !_can_mix()) - return false; - - int write_pos_cache=rb_write_pos; - - int32_t increment=(mix_rate*MIX_FRAC_LEN)/get_mix_rate(); - - int rb_todo; - - if (write_pos_cache==rb_read_pos) { - return false; //out of buffer - - } else if (rb_read_pos<write_pos_cache) { - - rb_todo=write_pos_cache-rb_read_pos; //-1? - } else { - - rb_todo=(rb_len-rb_read_pos)+write_pos_cache; //-1? - } - - int todo = MIN( ((int64_t(rb_todo)<<MIX_FRAC_BITS)/increment)+1, p_frames ); -#if 0 - if (int(mix_rate)==get_mix_rate()) { - - - if (channels==6) { - - for(int i=0;i<p_frames;i++) { - - int from = ((rb_read_pos+i)&rb_mask)*6; - int to = i*6; - - p_dest[from+0]=int32_t(rb[to+0])<<16; - p_dest[from+1]=int32_t(rb[to+1])<<16; - p_dest[from+2]=int32_t(rb[to+2])<<16; - p_dest[from+3]=int32_t(rb[to+3])<<16; - p_dest[from+4]=int32_t(rb[to+4])<<16; - p_dest[from+5]=int32_t(rb[to+5])<<16; - } - - } else { - int len=p_frames*channels; - int from=rb_read_pos*channels; - int mask=0; - switch(channels) { - case 1: mask=rb_len-1; break; - case 2: mask=(rb_len*2)-1; break; - case 4: mask=(rb_len*4)-1; break; - } - - for(int i=0;i<len;i++) { - - p_dest[i]=int32_t(rb[(from+i)&mask])<<16; - } - } - - rb_read_pos = (rb_read_pos+p_frames)&rb_mask; - } else -#endif - { - - uint32_t read=0; - switch(channels) { - case 1: read=_resample<1>(p_dest,todo,increment); break; - case 2: read=_resample<2>(p_dest,todo,increment); break; - case 4: read=_resample<4>(p_dest,todo,increment); break; - case 6: read=_resample<6>(p_dest,todo,increment); break; - } -#if 1 - //end of stream, fadeout - int remaining = p_frames-todo; - if (remaining && todo>0) { - - //print_line("fadeout"); - for(int c=0;c<channels;c++) { - - for(int i=0;i<todo;i++) { - - int32_t samp = p_dest[i*channels+c]>>8; - uint32_t mul = (todo-i) * 256 /todo; - //print_line("mul: "+itos(i)+" "+itos(mul)); - p_dest[i*channels+c]=samp*mul; - } - - } - - } - -#else - int remaining = p_frames-todo; - if (remaining && todo>0) { - - - for(int c=0;c<channels;c++) { - - int32_t from = p_dest[(todo-1)*channels+c]>>8; - - for(int i=0;i<remaining;i++) { - - uint32_t mul = (remaining-i) * 256 /remaining; - p_dest[(todo+i)*channels+c]=from*mul; - } - - } - - } -#endif - - //zero out what remains there to avoid glitches - for(int i=todo*channels;i<int(p_frames)*channels;i++) { - - p_dest[i]=0; - } - - if (read>rb_todo) - read=rb_todo; - - rb_read_pos = (rb_read_pos+read)&rb_mask; - - - - - } - - return true; -} - - -Error AudioStreamResampled::_setup(int p_channels,int p_mix_rate,int p_minbuff_needed) { - - ERR_FAIL_COND_V(p_channels!=1 && p_channels!=2 && p_channels!=4 && p_channels!=6,ERR_INVALID_PARAMETER); - - - float buffering_sec = int(GLOBAL_DEF("audio/stream_buffering_ms",500))/1000.0; - int desired_rb_bits =nearest_shift(MAX(buffering_sec*p_mix_rate,p_minbuff_needed)); - - bool recreate=!rb; - - if (rb && (uint32_t(desired_rb_bits)!=rb_bits || channels!=uint32_t(p_channels))) { - //recreate - - memdelete_arr(rb); - memdelete_arr(read_buf); - recreate=true; - - } - - if (recreate) { - - channels=p_channels; - rb_bits=desired_rb_bits; - rb_len=(1<<rb_bits); - rb_mask=rb_len-1; - rb = memnew_arr( int16_t, rb_len * p_channels ); - read_buf = memnew_arr( int16_t, rb_len * p_channels ); - - } - - mix_rate=p_mix_rate; - offset=0; - rb_read_pos=0; - rb_write_pos=0; - - //avoid maybe strange noises upon load - for (int i=0;i<(rb_len*channels);i++) { - - rb[i]=0; - read_buf[i]=0; - } - - return OK; - -} - -void AudioStreamResampled::_clear() { - - if (!rb) - return; - - AudioServer::get_singleton()->lock(); - //should be stopped at this point but just in case - if (rb) { - memdelete_arr(rb); - memdelete_arr(read_buf); - } - rb=NULL; - offset=0; - rb_read_pos=0; - rb_write_pos=0; - read_buf=NULL; - AudioServer::get_singleton()->unlock(); - -} - -AudioStreamResampled::AudioStreamResampled() { - - rb=NULL; - offset=0; - read_buf=NULL; - rb_read_pos=0; - rb_write_pos=0; - - rb_bits=0; - rb_len=0; - rb_mask=0; - read_buff_len=0; - channels=0; - mix_rate=0; - -} - -AudioStreamResampled::~AudioStreamResampled() { - - if (rb) { - memdelete_arr(rb); - memdelete_arr(read_buf); - } - -} - -#endif diff --git a/scene/resources/audio_stream_resampled.h b/scene/resources/audio_stream_resampled.h deleted file mode 100644 index 53fa3bd0b9..0000000000 --- a/scene/resources/audio_stream_resampled.h +++ /dev/null @@ -1,166 +0,0 @@ -/*************************************************************************/ -/* audio_stream_resampled.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 AUDIO_STREAM_RESAMPLED_H -#define AUDIO_STREAM_RESAMPLED_H - -//#include "scene/resources/audio_stream.h" - -#if 0 - -class AudioStreamResampled : public AudioStream { - GDCLASS(AudioStreamResampled,AudioStream); - - uint32_t rb_bits; - uint32_t rb_len; - uint32_t rb_mask; - uint32_t read_buff_len; - uint32_t channels; - uint32_t mix_rate; - - volatile int rb_read_pos; - volatile int rb_write_pos; - - int32_t offset; //contains the fractional remainder of the resampler - enum { - MIX_FRAC_BITS=13, - MIX_FRAC_LEN=(1<<MIX_FRAC_BITS), - MIX_FRAC_MASK=MIX_FRAC_LEN-1, - }; - - int16_t *read_buf; - int16_t *rb; - - - template<int C> - uint32_t _resample(int32_t *p_dest,int p_todo,int32_t p_increment); - - -protected: - - _FORCE_INLINE_ int get_total() const { - - return rb_len; - } - - _FORCE_INLINE_ int get_todo() const { //return amount of frames to mix - - int todo; - int read_pos_cache=rb_read_pos; - - if (read_pos_cache==rb_write_pos) { - todo=rb_len-1; - } else if (read_pos_cache>rb_write_pos) { - - todo=read_pos_cache-rb_write_pos-1; - } else { - - todo=(rb_len-rb_write_pos)+read_pos_cache-1; - } - - return todo; - } - - //Stream virtual funcs - virtual int get_channel_count() const; - virtual bool mix(int32_t *p_dest, int p_frames); - - _FORCE_INLINE_ void _flush() { - rb_read_pos=0; - rb_write_pos=0; - } - - _FORCE_INLINE_ int16_t *get_write_buffer() { return read_buf; } - _FORCE_INLINE_ void write(uint32_t p_frames) { - - ERR_FAIL_COND(p_frames >= rb_len); - - switch(channels) { - case 1: { - - for(uint32_t i=0;i<p_frames;i++) { - - rb[ rb_write_pos ] = read_buf[i]; - rb_write_pos=(rb_write_pos+1)&rb_mask; - } - } break; - case 2: { - - for(uint32_t i=0;i<p_frames;i++) { - - rb[ (rb_write_pos<<1)+0 ] = read_buf[(i<<1)+0]; - rb[ (rb_write_pos<<1)+1 ] = read_buf[(i<<1)+1]; - rb_write_pos=(rb_write_pos+1)&rb_mask; - } - } break; - case 4: { - - for(uint32_t i=0;i<p_frames;i++) { - - rb[ (rb_write_pos<<2)+0 ] = read_buf[(i<<2)+0]; - rb[ (rb_write_pos<<2)+1 ] = read_buf[(i<<2)+1]; - rb[ (rb_write_pos<<2)+2 ] = read_buf[(i<<2)+2]; - rb[ (rb_write_pos<<2)+3 ] = read_buf[(i<<2)+3]; - rb_write_pos=(rb_write_pos+1)&rb_mask; - } - } break; - case 6: { - - for(uint32_t i=0;i<p_frames;i++) { - - rb[ (rb_write_pos*6)+0 ] = read_buf[(i*6)+0]; - rb[ (rb_write_pos*6)+1 ] = read_buf[(i*6)+1]; - rb[ (rb_write_pos*6)+2 ] = read_buf[(i*6)+2]; - rb[ (rb_write_pos*6)+3 ] = read_buf[(i*6)+3]; - rb[ (rb_write_pos*6)+4 ] = read_buf[(i*6)+4]; - rb[ (rb_write_pos*6)+5 ] = read_buf[(i*6)+5]; - rb_write_pos=(rb_write_pos+1)&rb_mask; - } - } break; - - - } - - } - - virtual bool _can_mix() const =0; - - _FORCE_INLINE_ bool _is_ready() const{ - return rb!=NULL; - } - - Error _setup(int p_channels,int p_mix_rate,int p_minbuff_needed=-1); - void _clear(); - -public: - AudioStreamResampled(); - ~AudioStreamResampled(); -}; -#endif -#endif // AUDIO_STREAM_RESAMPLED_H diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index c8f6007e60..659322897a 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h index 680f037f15..6cb255fedf 100644 --- a/scene/resources/audio_stream_sample.h +++ b/scene/resources/audio_stream_sample.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index a473067937..be994e3b33 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/bit_mask.h b/scene/resources/bit_mask.h index 5ab7a3134d..72090f2ebe 100644 --- a/scene/resources/bit_mask.h +++ b/scene/resources/bit_mask.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/bounds.cpp b/scene/resources/bounds.cpp index b088426013..ee1e750c82 100644 --- a/scene/resources/bounds.cpp +++ b/scene/resources/bounds.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/bounds.h b/scene/resources/bounds.h index 8c0d1dcf6e..3378101836 100644 --- a/scene/resources/bounds.h +++ b/scene/resources/bounds.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/box_shape.cpp b/scene/resources/box_shape.cpp index d5c25b718e..bbc85ce0f6 100644 --- a/scene/resources/box_shape.cpp +++ b/scene/resources/box_shape.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/box_shape.h b/scene/resources/box_shape.h index fdf1e98020..8884c9b75a 100644 --- a/scene/resources/box_shape.h +++ b/scene/resources/box_shape.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/canvas.cpp b/scene/resources/canvas.cpp index b6a909f3fa..f5bf0ad78e 100644 --- a/scene/resources/canvas.cpp +++ b/scene/resources/canvas.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/canvas.h b/scene/resources/canvas.h index 331a997914..b9977e11b9 100644 --- a/scene/resources/canvas.h +++ b/scene/resources/canvas.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/capsule_shape.cpp b/scene/resources/capsule_shape.cpp index 1fcc9da5b6..e11b98f82e 100644 --- a/scene/resources/capsule_shape.cpp +++ b/scene/resources/capsule_shape.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/capsule_shape.h b/scene/resources/capsule_shape.h index 2864e7e23f..9b43823c83 100644 --- a/scene/resources/capsule_shape.h +++ b/scene/resources/capsule_shape.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp index 20177692a1..56a09bc3bf 100644 --- a/scene/resources/capsule_shape_2d.cpp +++ b/scene/resources/capsule_shape_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/capsule_shape_2d.h b/scene/resources/capsule_shape_2d.h index 93e7d846a4..610f9a4cf9 100644 --- a/scene/resources/capsule_shape_2d.h +++ b/scene/resources/capsule_shape_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/circle_shape_2d.cpp b/scene/resources/circle_shape_2d.cpp index 1b7e09ddfb..ecfc98ea60 100644 --- a/scene/resources/circle_shape_2d.cpp +++ b/scene/resources/circle_shape_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/circle_shape_2d.h b/scene/resources/circle_shape_2d.h index a4a4601e66..3ba5ec949c 100644 --- a/scene/resources/circle_shape_2d.h +++ b/scene/resources/circle_shape_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/color_ramp.cpp b/scene/resources/color_ramp.cpp index 68f707220f..9f6150ae63 100644 --- a/scene/resources/color_ramp.cpp +++ b/scene/resources/color_ramp.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/color_ramp.h b/scene/resources/color_ramp.h index d9f14205bb..816152d51f 100644 --- a/scene/resources/color_ramp.h +++ b/scene/resources/color_ramp.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp index 47cc49c631..6ae4fde85e 100644 --- a/scene/resources/concave_polygon_shape.cpp +++ b/scene/resources/concave_polygon_shape.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/concave_polygon_shape.h b/scene/resources/concave_polygon_shape.h index a8f9d50674..82e052fee7 100644 --- a/scene/resources/concave_polygon_shape.h +++ b/scene/resources/concave_polygon_shape.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp index b8c931421e..7f4abf7ae0 100644 --- a/scene/resources/concave_polygon_shape_2d.cpp +++ b/scene/resources/concave_polygon_shape_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/concave_polygon_shape_2d.h b/scene/resources/concave_polygon_shape_2d.h index d4c102e0d6..e766e88a4b 100644 --- a/scene/resources/concave_polygon_shape_2d.h +++ b/scene/resources/concave_polygon_shape_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape.cpp index 10e92b43ae..bba52bd5ff 100644 --- a/scene/resources/convex_polygon_shape.cpp +++ b/scene/resources/convex_polygon_shape.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/convex_polygon_shape.h b/scene/resources/convex_polygon_shape.h index 4340b0ef7c..e103f2d90c 100644 --- a/scene/resources/convex_polygon_shape.h +++ b/scene/resources/convex_polygon_shape.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index e13f7faf70..7588909d90 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/convex_polygon_shape_2d.h b/scene/resources/convex_polygon_shape_2d.h index ba4a5ae8aa..3354199e05 100644 --- a/scene/resources/convex_polygon_shape_2d.h +++ b/scene/resources/convex_polygon_shape_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index fe0759fcba..7fbaa1f73c 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "curve.h" + #include "core_string_names.h" template <class T> @@ -42,344 +43,6 @@ static _FORCE_INLINE_ T _bezier_interp(real_t t, T start, T control_1, T control return start * omt3 + control_1 * omt2 * t * 3.0 + control_2 * omt * t2 * 3.0 + end * t3; } -#if 0 - -int Curve2D::get_point_count() const { - - return points.size(); -} -void Curve2D::add_point(const Vector2& p_pos, const Vector2& p_in, const Vector2& p_out) { - - Point n; - n.pos=p_pos; - n.in=p_in; - n.out=p_out; - points.push_back(n); - emit_signal(CoreStringNames::get_singleton()->changed); -} -void Curve2D::set_point_pos(int p_index, const Vector2& p_pos) { - - ERR_FAIL_INDEX(p_index,points.size()); - - points[p_index].pos=p_pos; - emit_signal(CoreStringNames::get_singleton()->changed); - -} -Vector2 Curve2D::get_point_pos(int p_index) const { - - ERR_FAIL_INDEX_V(p_index,points.size(),Vector2()); - return points[p_index].pos; - -} - - -void Curve2D::set_point_in(int p_index, const Vector2& p_in) { - - ERR_FAIL_INDEX(p_index,points.size()); - - points[p_index].in=p_in; - emit_signal(CoreStringNames::get_singleton()->changed); - -} -Vector2 Curve2D::get_point_in(int p_index) const { - - ERR_FAIL_INDEX_V(p_index,points.size(),Vector2()); - return points[p_index].in; - -} - -void Curve2D::set_point_out(int p_index, const Vector2& p_out) { - - ERR_FAIL_INDEX(p_index,points.size()); - - points[p_index].out=p_out; - emit_signal(CoreStringNames::get_singleton()->changed); -} - -Vector2 Curve2D::get_point_out(int p_index) const { - - ERR_FAIL_INDEX_V(p_index,points.size(),Vector2()); - return points[p_index].out; - -} - - -void Curve2D::remove_point(int p_index) { - - ERR_FAIL_INDEX(p_index,points.size()); - points.remove(p_index); - emit_signal(CoreStringNames::get_singleton()->changed); -} - -Vector2 Curve2D::interpolate(int p_index, float p_offset) const { - - int pc = points.size(); - ERR_FAIL_COND_V(pc==0,Vector2()); - - if (p_index >= pc-1) - return points[pc-1].pos; - else if (p_index<0) - return points[0].pos; - - Vector2 p0 = points[p_index].pos; - Vector2 p1 = p0+points[p_index].out; - Vector2 p3 = points[p_index+1].pos; - Vector2 p2 = p3+points[p_index+1].in; - - return _bezier_interp(p_offset,p0,p1,p2,p3); -} - -Vector2 Curve2D::interpolatef(real_t p_findex) const { - - - if (p_findex<0) - p_findex=0; - else if (p_findex>=points.size()) - p_findex=points.size(); - - return interpolate((int)p_findex,Math::fmod(p_findex,1.0)); - -} - -PoolVector<Point2> Curve2D::bake(int p_subdivs) const { - - int pc = points.size(); - - PoolVector<Point2> ret; - if (pc<2) - return ret; - - ret.resize((pc-1)*p_subdivs+1); - - PoolVector<Point2>::Write w = ret.write(); - const Point *r = points.ptr(); - - for(int i=0;i<pc;i++) { - - int ofs = pc*p_subdivs; - - int limit=(i==pc-1)?p_subdivs+1:p_subdivs; - - for(int j=0;j<limit;j++) { - - Vector2 p0 = r[i].pos; - Vector2 p1 = p0+r[i].out; - Vector2 p3 = r[i].pos; - Vector2 p2 = p3+r[i].in; - real_t t = j/(real_t)p_subdivs; - - w[ofs+j]=_bezier_interp(t,p0,p1,p2,p3); - - } - } - - w = PoolVector<Point2>::Write(); - - return ret; -} - -void Curve2D::advance(real_t p_distance,int &r_index, real_t &r_pos) const { - - int pc = points.size(); - ERR_FAIL_COND(pc<2); - if (r_index<0 || r_index>=(pc-1)) - return; - - Vector2 pos = interpolate(r_index,r_pos); - - float sign=p_distance<0 ? -1 : 1; - p_distance=Math::abs(p_distance); - - real_t base = r_index+r_pos; - real_t top = 0.1; //a tenth is in theory representative - int iterations=32; - - - - for(int i=0;i<iterations;i++) { - - - real_t o=base+top*sign; - if (sign>0 && o >=pc) { - top=pc-base; - break; - } else if (sign<0 && o <0) { - top=-base; - break; - } - - Vector2 new_d = interpolatef(o); - - if (new_d.distance_to(pos) > p_distance) - break; - top*=2.0; - } - - - real_t bottom = 0.0; - iterations=8; - real_t final_offset; - - - for(int i=0;i<iterations;i++) { - - real_t middle = (bottom+top)*0.5; - real_t o=base+middle*sign; - Vector2 new_d = interpolatef(o); - - if (new_d.distance_to(pos) > p_distance) { - bottom=middle; - } else { - top=middle; - } - final_offset=o; - } - - r_index=(int)final_offset; - r_pos=Math::fmod(final_offset,1.0); - -} - -void Curve2D::get_approx_position_from_offset(real_t p_offset,int &r_index, real_t &r_pos,int p_subdivs) const { - - ERR_FAIL_COND(points.size()<2); - - real_t accum=0; - - - - for(int i=0;i<points.size();i++) { - - Vector2 prev_p=interpolate(i,0); - - - for(int j=1;j<=p_subdivs;j++) { - - real_t frac = j/(real_t)p_subdivs; - Vector2 p = interpolate(i,frac); - real_t d = p.distance_to(prev_p); - - accum+=d; - if (accum>p_offset) { - - - r_index=j-1; - if (d>0) { - real_t mf = (p_offset-(accum-d)) / d; - r_pos=frac-(1.0-mf); - } else { - r_pos=frac; - } - - return; - } - - prev_p=p; - } - } - - r_index=points.size()-1; - r_pos=1.0; - - -} - -void Curve2D::set_points_in(const Vector2Array& p_points) { - - points.resize(p_points.size()); - for (int i=0; i<p_points.size(); i++) { - - Point p = points[i]; - p.in = p_points[i]; - points[i] = p; - }; -}; - -void Curve2D::set_points_out(const Vector2Array& p_points) { - - points.resize(p_points.size()); - for (int i=0; i<p_points.size(); i++) { - - Point p = points[i]; - p.out = p_points[i]; - points[i] = p; - }; -}; - -void Curve2D::set_points_pos(const Vector2Array& p_points) { - - points.resize(p_points.size()); - for (int i=0; i<p_points.size(); i++) { - - Point p = points[i]; - p.pos = p_points[i]; - points[i] = p; - }; -}; - -Vector2Array Curve2D::get_points_in() const { - Vector2Array ret; - ret.resize(points.size()); - for (int i=0; i<points.size(); i++) { - ret.set(i, points[i].in); - }; - return ret; -}; - -Vector2Array Curve2D::get_points_out() const { - Vector2Array ret; - ret.resize(points.size()); - for (int i=0; i<points.size(); i++) { - ret.set(i, points[i].out); - }; - return ret; -}; - -Vector2Array Curve2D::get_points_pos() const { - Vector2Array ret; - ret.resize(points.size()); - for (int i=0; i<points.size(); i++) { - ret.set(i, points[i].pos); - }; - return ret; -}; - - -void Curve2D::_bind_methods() { - - ClassDB::bind_method(D_METHOD("get_point_count"),&Curve2D::get_point_count); - ClassDB::bind_method(D_METHOD("add_point","pos","in","out"),&Curve2D::add_point,DEFVAL(Vector2()),DEFVAL(Vector2())); - ClassDB::bind_method(D_METHOD("set_point_pos","idx","pos"),&Curve2D::set_point_pos); - ClassDB::bind_method(D_METHOD("get_point_pos","idx"),&Curve2D::get_point_pos); - ClassDB::bind_method(D_METHOD("set_point_in","idx","pos"),&Curve2D::set_point_in); - ClassDB::bind_method(D_METHOD("get_point_in","idx"),&Curve2D::get_point_in); - ClassDB::bind_method(D_METHOD("set_point_out","idx","pos"),&Curve2D::set_point_out); - ClassDB::bind_method(D_METHOD("get_point_out","idx"),&Curve2D::get_point_out); - ClassDB::bind_method(D_METHOD("remove_point","idx"),&Curve2D::remove_point); - ClassDB::bind_method(D_METHOD("interpolate","idx","t"),&Curve2D::interpolate); - ClassDB::bind_method(D_METHOD("bake","subdivs"),&Curve2D::bake,DEFVAL(10)); - - - ClassDB::bind_method(D_METHOD("set_points_in"),&Curve2D::set_points_in); - ClassDB::bind_method(D_METHOD("set_points_out"),&Curve2D::set_points_out); - ClassDB::bind_method(D_METHOD("set_points_pos"),&Curve2D::set_points_pos); - - ClassDB::bind_method(D_METHOD("get_points_in"),&Curve2D::get_points_in); - ClassDB::bind_method(D_METHOD("get_points_out"),&Curve2D::get_points_out); - ClassDB::bind_method(D_METHOD("get_points_pos"),&Curve2D::get_points_pos); - - ADD_PROPERTY( PropertyInfo( Variant::VECTOR2_ARRAY, "points_in"), "set_points_in","get_points_in"); - ADD_PROPERTY( PropertyInfo( Variant::VECTOR2_ARRAY, "points_out"), "set_points_out","get_points_out"); - ADD_PROPERTY( PropertyInfo( Variant::VECTOR2_ARRAY, "points_pos"), "set_points_pos","get_points_pos"); -} - - -Curve2D::Curve2D() -{ -} - -#endif - const char *Curve::SIGNAL_RANGE_CHANGED = "range_changed"; Curve::Curve() { diff --git a/scene/resources/curve.h b/scene/resources/curve.h index e302f1e0af..3071aee5de 100644 --- a/scene/resources/curve.h +++ b/scene/resources/curve.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -31,56 +31,6 @@ #define CURVE_H #include "resource.h" -#if 0 -class Curve2D : public Resource { - - GDCLASS(Curve2D,Resource); - - struct Point { - - Vector2 in; - Vector2 out; - Vector2 pos; - }; - - - Vector<Point> points; - -protected: - - static void _bind_methods(); - - void set_points_in(const Vector2Array& p_points_in); - void set_points_out(const Vector2Array& p_points_out); - void set_points_pos(const Vector2Array& p_points_pos); - - Vector2Array get_points_in() const; - Vector2Array get_points_out() const; - Vector2Array get_points_pos() const; - -public: - - - int get_point_count() const; - void add_point(const Vector2& p_pos, const Vector2& p_in=Vector2(), const Vector2& p_out=Vector2()); - void set_point_pos(int p_index, const Vector2& p_pos); - Vector2 get_point_pos(int p_index) const; - void set_point_in(int p_index, const Vector2& p_in); - Vector2 get_point_in(int p_index) const; - void set_point_out(int p_index, const Vector2& p_out); - Vector2 get_point_out(int p_index) const; - void remove_point(int p_index); - - Vector2 interpolate(int p_index, float p_offset) const; - Vector2 interpolatef(real_t p_findex) const; - PoolVector<Point2> bake(int p_subdivs=10) const; - void advance(real_t p_distance,int &r_index, real_t &r_pos) const; - void get_approx_position_from_offset(real_t p_offset,int &r_index, real_t &r_pos,int p_subdivs=16) const; - - Curve2D(); -}; - -#endif // y(x) curve class Curve : public Resource { diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 03288e45bf..08de33175a 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/default_theme/default_theme.h b/scene/resources/default_theme/default_theme.h index 6fd57b6f22..9032b71775 100644 --- a/scene/resources/default_theme/default_theme.h +++ b/scene/resources/default_theme/default_theme.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 57b860583e..82739b58a0 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index b8ff2845e7..52c3f30590 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp index fa8cf4723b..91263fb125 100644 --- a/scene/resources/dynamic_font_stb.cpp +++ b/scene/resources/dynamic_font_stb.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/dynamic_font_stb.h b/scene/resources/dynamic_font_stb.h index a2c081a925..24d764e716 100644 --- a/scene/resources/dynamic_font_stb.h +++ b/scene/resources/dynamic_font_stb.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 60a700aad8..14225d945d 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -994,10 +994,10 @@ void Environment::_bind_methods() { ADD_GROUP("SSAO", "ssao_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ssao_enabled"), "set_ssao_enabled", "is_ssao_enabled"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_radius", PROPERTY_HINT_RANGE, "0.1,16,0.1"), "set_ssao_radius", "get_ssao_radius"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_intensity", PROPERTY_HINT_RANGE, "0.0,9,0.1"), "set_ssao_intensity", "get_ssao_intensity"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_radius2", PROPERTY_HINT_RANGE, "0.0,16,0.1"), "set_ssao_radius2", "get_ssao_radius2"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_intensity2", PROPERTY_HINT_RANGE, "0.0,9,0.1"), "set_ssao_intensity2", "get_ssao_intensity2"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_radius", PROPERTY_HINT_RANGE, "0.1,128,0.1"), "set_ssao_radius", "get_ssao_radius"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_intensity", PROPERTY_HINT_RANGE, "0.0,128,0.1"), "set_ssao_intensity", "get_ssao_intensity"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_radius2", PROPERTY_HINT_RANGE, "0.0,128,0.1"), "set_ssao_radius2", "get_ssao_radius2"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_intensity2", PROPERTY_HINT_RANGE, "0.0,128,0.1"), "set_ssao_intensity2", "get_ssao_intensity2"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_bias", PROPERTY_HINT_RANGE, "0.001,8,0.001"), "set_ssao_bias", "get_ssao_bias"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "ssao_light_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_direct_light_affect", "get_ssao_direct_light_affect"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ssao_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ssao_color", "get_ssao_color"); diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 3a6906aa27..6337981b95 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 035e514eac..d9ccd31f88 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/font.h b/scene/resources/font.h index a04ffbdd4b..3bb7aeac85 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ 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 d473db738e..5236461ad3 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -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) { diff --git a/scene/resources/material.h b/scene/resources/material.h index 222ef32370..6a0eead708 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index ebba0ba67f..aa7827a61a 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -1035,6 +1035,7 @@ void ArrayMesh::_bind_methods() { BIND_ENUM_CONSTANT(ARRAY_BONES); BIND_ENUM_CONSTANT(ARRAY_WEIGHTS); BIND_ENUM_CONSTANT(ARRAY_INDEX); + BIND_ENUM_CONSTANT(ARRAY_MAX); BIND_ENUM_CONSTANT(ARRAY_FORMAT_VERTEX); BIND_ENUM_CONSTANT(ARRAY_FORMAT_NORMAL); diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index bccb39e8cd..53c6eb2d89 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index f1092a90cb..116ddc4ac6 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/mesh_data_tool.h b/scene/resources/mesh_data_tool.h index ad771edbd1..119b49161b 100644 --- a/scene/resources/mesh_data_tool.h +++ b/scene/resources/mesh_data_tool.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp index 7d51a2617e..4e1ffd2ab3 100644 --- a/scene/resources/mesh_library.cpp +++ b/scene/resources/mesh_library.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -43,9 +43,15 @@ bool MeshLibrary::_set(const StringName &p_name, const Variant &p_value) { set_item_name(idx, p_value); else if (what == "mesh") set_item_mesh(idx, p_value); - else if (what == "shape") - set_item_shape(idx, p_value); - else if (what == "preview") + else if (what == "shape") { + Vector<ShapeData> shapes; + ShapeData sd; + sd.shape = p_value; + shapes.push_back(sd); + set_item_shapes(idx, shapes); + } else if (what == "shapes") { + _set_item_shapes(idx, p_value); + } else if (what == "preview") set_item_preview(idx, p_value); else if (what == "navmesh") set_item_navmesh(idx, p_value); @@ -69,8 +75,8 @@ bool MeshLibrary::_get(const StringName &p_name, Variant &r_ret) const { r_ret = get_item_name(idx); else if (what == "mesh") r_ret = get_item_mesh(idx); - else if (what == "shape") - r_ret = get_item_shape(idx); + else if (what == "shapes") + r_ret = _get_item_shapes(idx); else if (what == "navmesh") r_ret = get_item_navmesh(idx); else if (what == "preview") @@ -88,7 +94,7 @@ void MeshLibrary::_get_property_list(List<PropertyInfo> *p_list) const { String name = "item/" + itos(E->key()) + "/"; p_list->push_back(PropertyInfo(Variant::STRING, name + "name")); p_list->push_back(PropertyInfo(Variant::OBJECT, name + "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh")); - p_list->push_back(PropertyInfo(Variant::OBJECT, name + "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape")); + p_list->push_back(PropertyInfo(Variant::ARRAY, name + "shapes")); p_list->push_back(PropertyInfo(Variant::OBJECT, name + "navmesh", PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh")); p_list->push_back(PropertyInfo(Variant::OBJECT, name + "preview", PROPERTY_HINT_RESOURCE_TYPE, "Texture", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_HELPER)); } @@ -118,10 +124,10 @@ void MeshLibrary::set_item_mesh(int p_item, const Ref<Mesh> &p_mesh) { _change_notify(); } -void MeshLibrary::set_item_shape(int p_item, const Ref<Shape> &p_shape) { +void MeshLibrary::set_item_shapes(int p_item, const Vector<ShapeData> &p_shapes) { ERR_FAIL_COND(!item_map.has(p_item)); - item_map[p_item].shape = p_shape; + item_map[p_item].shapes = p_shapes; _change_notify(); notify_change_to_owners(); emit_changed(); @@ -156,10 +162,10 @@ Ref<Mesh> MeshLibrary::get_item_mesh(int p_item) const { return item_map[p_item].mesh; } -Ref<Shape> MeshLibrary::get_item_shape(int p_item) const { +Vector<MeshLibrary::ShapeData> MeshLibrary::get_item_shapes(int p_item) const { - ERR_FAIL_COND_V(!item_map.has(p_item), Ref<Shape>()); - return item_map[p_item].shape; + ERR_FAIL_COND_V(!item_map.has(p_item), Vector<ShapeData>()); + return item_map[p_item].shapes; } Ref<NavigationMesh> MeshLibrary::get_item_navmesh(int p_item) const { @@ -226,17 +232,48 @@ int MeshLibrary::get_last_unused_item_id() const { return item_map.back()->key() + 1; } +void MeshLibrary::_set_item_shapes(int p_item, const Array &p_shapes) { + + ERR_FAIL_COND(p_shapes.size() & 1); + Vector<ShapeData> shapes; + for (int i = 0; i < p_shapes.size(); i += 2) { + ShapeData sd; + sd.shape = p_shapes[i + 0]; + sd.local_transform = p_shapes[i + 1]; + + if (sd.shape.is_valid()) { + shapes.push_back(sd); + } + } + + set_item_shapes(p_item, shapes); +} + +Array MeshLibrary::_get_item_shapes(int p_item) const { + + Vector<ShapeData> shapes = get_item_shapes(p_item); + Array ret; + for (int i = 0; i < shapes.size(); i++) { + ret.push_back(shapes[i].shape); + ret.push_back(shapes[i].local_transform); + } + + return ret; +} + void MeshLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("create_item", "id"), &MeshLibrary::create_item); ClassDB::bind_method(D_METHOD("set_item_name", "id", "name"), &MeshLibrary::set_item_name); ClassDB::bind_method(D_METHOD("set_item_mesh", "id", "mesh"), &MeshLibrary::set_item_mesh); ClassDB::bind_method(D_METHOD("set_item_navmesh", "id", "navmesh"), &MeshLibrary::set_item_navmesh); - ClassDB::bind_method(D_METHOD("set_item_shape", "id", "shape"), &MeshLibrary::set_item_shape); + ClassDB::bind_method(D_METHOD("set_item_shapes", "id", "shapes"), &MeshLibrary::_set_item_shapes); + ClassDB::bind_method(D_METHOD("set_item_preview", "id", "texture"), &MeshLibrary::set_item_preview); ClassDB::bind_method(D_METHOD("get_item_name", "id"), &MeshLibrary::get_item_name); ClassDB::bind_method(D_METHOD("get_item_mesh", "id"), &MeshLibrary::get_item_mesh); ClassDB::bind_method(D_METHOD("get_item_navmesh", "id"), &MeshLibrary::get_item_navmesh); - ClassDB::bind_method(D_METHOD("get_item_shape", "id"), &MeshLibrary::get_item_shape); + ClassDB::bind_method(D_METHOD("get_item_shapes", "id"), &MeshLibrary::_get_item_shapes); + ClassDB::bind_method(D_METHOD("get_item_preview", "id"), &MeshLibrary::get_item_preview); ClassDB::bind_method(D_METHOD("remove_item", "id"), &MeshLibrary::remove_item); ClassDB::bind_method(D_METHOD("clear"), &MeshLibrary::clear); ClassDB::bind_method(D_METHOD("get_item_list"), &MeshLibrary::get_item_list); diff --git a/scene/resources/mesh_library.h b/scene/resources/mesh_library.h index cc39110a99..99b6b48d61 100644 --- a/scene/resources/mesh_library.h +++ b/scene/resources/mesh_library.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -41,16 +41,24 @@ class MeshLibrary : public Resource { GDCLASS(MeshLibrary, Resource); RES_BASE_EXTENSION("meshlib"); +public: + struct ShapeData { + Ref<Shape> shape; + Transform local_transform; + }; struct Item { String name; Ref<Mesh> mesh; - Ref<Shape> shape; + Vector<ShapeData> shapes; Ref<Texture> preview; Ref<NavigationMesh> navmesh; }; Map<int, Item> item_map; + void _set_item_shapes(int p_item, const Array &p_shapes); + Array _get_item_shapes(int p_item) const; + protected: bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; @@ -63,12 +71,12 @@ public: void set_item_name(int p_item, const String &p_name); void set_item_mesh(int p_item, const Ref<Mesh> &p_mesh); void set_item_navmesh(int p_item, const Ref<NavigationMesh> &p_navmesh); - void set_item_shape(int p_item, const Ref<Shape> &p_shape); + void set_item_shapes(int p_item, const Vector<ShapeData> &p_shapes); void set_item_preview(int p_item, const Ref<Texture> &p_preview); String get_item_name(int p_item) const; Ref<Mesh> get_item_mesh(int p_item) const; Ref<NavigationMesh> get_item_navmesh(int p_item) const; - Ref<Shape> get_item_shape(int p_item) const; + Vector<ShapeData> get_item_shapes(int p_item) const; Ref<Texture> get_item_preview(int p_item) const; void remove_item(int p_item); diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index b65800ebbd..15f1e15542 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h index 7d6a0ce44f..7ca66b0b46 100644 --- a/scene/resources/multimesh.h +++ b/scene/resources/multimesh.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index d7ea675a47..19fab5d587 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "packed_scene.h" + #include "core/core_string_names.h" #include "io/resource_loader.h" #include "project_settings.h" @@ -35,6 +36,7 @@ #include "scene/3d/spatial.h" #include "scene/gui/control.h" #include "scene/main/instance_placeholder.h" + #define PACK_VERSION 2 bool SceneState::can_instance() const { @@ -151,18 +153,18 @@ Node *SceneState::instance(GenEditState p_edit_state) const { //print_line("created"); //node belongs to this scene and must be created Object *obj = ClassDB::instance(snames[n.type]); - if (!obj || !obj->cast_to<Node>()) { + if (!Object::cast_to<Node>(obj)) { if (obj) { memdelete(obj); obj = NULL; } WARN_PRINT(String("Warning node of type " + snames[n.type].operator String() + " does not exist.").ascii().get_data()); if (n.parent >= 0 && n.parent < nc && ret_nodes[n.parent]) { - if (ret_nodes[n.parent]->cast_to<Spatial>()) { + if (Object::cast_to<Spatial>(ret_nodes[n.parent])) { obj = memnew(Spatial); - } else if (ret_nodes[n.parent]->cast_to<Control>()) { + } else if (Object::cast_to<Control>(ret_nodes[n.parent])) { obj = memnew(Control); - } else if (ret_nodes[n.parent]->cast_to<Node2D>()) { + } else if (Object::cast_to<Node2D>(ret_nodes[n.parent])) { obj = memnew(Node2D); } } @@ -172,7 +174,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const { } } - node = obj->cast_to<Node>(); + node = Object::cast_to<Node>(obj); } else { print_line("wtf class is disabled for: " + itos(n.type)); @@ -451,60 +453,6 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map } } -#if 0 - - Ref<SceneState> base_scene = p_node->get_scene_inherited_state(); //for inheritance - Ref<SceneState> instance_state; - int instance_state_node=-1; - - if (base_scene.is_valid() && (p_node==p_owner || p_node->get_owner()==p_owner)) { - //scene inheritance in use, see if this node is actually inherited - NodePath path = p_owner->get_path_to(p_node); - instance_state_node = base_scene->find_node_by_path(path); - if (instance_state_node>=0) { - instance_state=base_scene; - } - } - - // check that this is a directly instanced scene from the scene being packed, if so - // this information must be saved. Of course, if using scene instancing and this node - // does belong to base scene, ignore. - - if (instance_state.is_null() && p_node!=p_owner && p_node->get_owner()==p_owner && p_node->get_filename()!="") { - - //instanced, only direct sub-scnes are supported of course - Ref<PackedScene> instance = ResourceLoader::load(p_node->get_filename()); - if (!instance.is_valid()) { - return ERR_CANT_OPEN; - } - - nd.instance=_vm_get_variant(instance,variant_map); - - } else { - - nd.instance=-1; - } - - // finally, if this does not belong to scene inheritance, check - // if it belongs to scene instancing - - if (instance_state.is_null() && p_node!=p_owner) { - //if not affected by scene inheritance, this may be - if (p_node->get_owner()==p_owner && p_node->get_filename()!=String()) { - instance_state=p_node->get_scene_instance_state(); - if (instance_state.is_valid()) { - instance_state_node=instance_state->find_node_by_path(p_node->get_path_to(p_node)); - } - - } else if (p_node->get_owner()!=p_owner && p_owner->is_editable_instance(p_node->get_owner())) { - instance_state=p_node->get_owner()->get_scene_instance_state(); - if (instance_state.is_valid()) { - instance_state_node=instance_state->find_node_by_path(p_node->get_owner()->get_path_to(p_node)); - } - } - } -#endif - // all setup, we then proceed to check all properties for the node // and save the ones that are worth saving @@ -641,27 +589,6 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map } else { nd.owner = -1; -#if 0 - // this is pointless, if this was instanced by something else, - // the owner will already be set. - - if (node_map.has(p_node->get_owner())) { - //maybe an existing saved node - nd.owner=node_map[p_node->get_owner()]; - } else { - //not saved, use nodepath map - int sidx; - if (nodepath_map.has(p_node->get_owner())) { - sidx=nodepath_map[p_node->get_owner()]; - } else { - sidx=nodepath_map.size(); - nodepath_map[p_node->get_owner()]=sidx; - } - - nd.owner=FLAG_ID_IS_PATH|sidx; - - } -#endif } // Save the right type. If this node was created by an instance @@ -754,7 +681,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName // only connections that originate or end into main saved scene are saved // everything else is discarded - Node *target = c.target->cast_to<Node>(); + Node *target = Object::cast_to<Node>(c.target); if (!target) { continue; diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index 2f18f5c263..20bfb19b1f 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/plane_shape.cpp b/scene/resources/plane_shape.cpp index d3ad454afc..2b1e890a5d 100644 --- a/scene/resources/plane_shape.cpp +++ b/scene/resources/plane_shape.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/plane_shape.h b/scene/resources/plane_shape.h index 2ed297a97e..1384b7521b 100644 --- a/scene/resources/plane_shape.h +++ b/scene/resources/plane_shape.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp index 80b413630a..053369e8d8 100644 --- a/scene/resources/polygon_path_finder.cpp +++ b/scene/resources/polygon_path_finder.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/polygon_path_finder.h b/scene/resources/polygon_path_finder.h index 2d2fb1678e..9b760caa2e 100644 --- a/scene/resources/polygon_path_finder.h +++ b/scene/resources/polygon_path_finder.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 2b8c0ddedd..cfc1468533 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/primitive_meshes.h b/scene/resources/primitive_meshes.h index bcd5d30dd3..34fb75a196 100644 --- a/scene/resources/primitive_meshes.h +++ b/scene/resources/primitive_meshes.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/ray_shape.cpp b/scene/resources/ray_shape.cpp index 3abb2a4fa1..ccce7660c6 100644 --- a/scene/resources/ray_shape.cpp +++ b/scene/resources/ray_shape.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/ray_shape.h b/scene/resources/ray_shape.h index 5a17e9414e..06b68adbae 100644 --- a/scene/resources/ray_shape.h +++ b/scene/resources/ray_shape.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/rectangle_shape_2d.cpp b/scene/resources/rectangle_shape_2d.cpp index bd9ec8cbc4..507dbce861 100644 --- a/scene/resources/rectangle_shape_2d.cpp +++ b/scene/resources/rectangle_shape_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/rectangle_shape_2d.h b/scene/resources/rectangle_shape_2d.h index 23db58ba07..81d9cb1f4a 100644 --- a/scene/resources/rectangle_shape_2d.h +++ b/scene/resources/rectangle_shape_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/room.cpp b/scene/resources/room.cpp index c89b7c72c7..487975dd4e 100644 --- a/scene/resources/room.cpp +++ b/scene/resources/room.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -31,6 +31,8 @@ #include "servers/visual_server.h" +// FIXME: Left for reference for reimplementation using Area +#if 0 RID RoomBounds::get_rid() const { return area; @@ -64,3 +66,4 @@ RoomBounds::~RoomBounds() { VisualServer::get_singleton()->free(area); } +#endif diff --git a/scene/resources/room.h b/scene/resources/room.h index ba5c0eee1c..aadee858c2 100644 --- a/scene/resources/room.h +++ b/scene/resources/room.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -36,6 +36,9 @@ @author Juan Linietsky <reduzio@gmail.com> */ +//left for reference but will be removed when portals are reimplemented using Area +#if 0 + class RoomBounds : public Resource { GDCLASS(RoomBounds, Resource); @@ -57,4 +60,5 @@ public: ~RoomBounds(); }; +#endif #endif // ROOM_H diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index 49cd030a9a..fea5c11dec 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -239,7 +239,7 @@ Error ResourceInteractiveLoaderText::poll() { return error; } - Resource *r = obj->cast_to<Resource>(); + Resource *r = Object::cast_to<Resource>(obj); if (!r) { error_text += "Can't create sub resource of type, because not a resource: " + type; @@ -305,7 +305,7 @@ Error ResourceInteractiveLoaderText::poll() { return error; } - Resource *r = obj->cast_to<Resource>(); + Resource *r = Object::cast_to<Resource>(obj); if (!r) { error_text += "Can't create sub resource of type, because not a resource: " + res_type; diff --git a/scene/resources/scene_format_text.h b/scene/resources/scene_format_text.h index 1ea6465c21..193bcf7112 100644 --- a/scene/resources/scene_format_text.h +++ b/scene/resources/scene_format_text.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/segment_shape_2d.cpp b/scene/resources/segment_shape_2d.cpp index 99062d693b..1171db5c02 100644 --- a/scene/resources/segment_shape_2d.cpp +++ b/scene/resources/segment_shape_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/segment_shape_2d.h b/scene/resources/segment_shape_2d.h index 22fc1ab6e3..eb9c228c83 100644 --- a/scene/resources/segment_shape_2d.h +++ b/scene/resources/segment_shape_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index acd04a9321..ec41630258 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/shader.h b/scene/resources/shader.h index 0e8e48d82e..5cc70629c7 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index ed63e84d4c..2ca9a14562 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -28,8 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "shader_graph.h" + #include "scene/scene_string_names.h" +// FIXME: Needs to be ported to the new 3.0 shader API #if 0 Array ShaderGraph::_get_node_list(ShaderType p_type) const { @@ -397,79 +399,6 @@ void ShaderGraph::_bind_methods() { BIND_ENUM_CONSTANT( VEC_MAX_FUNC ); ADD_SIGNAL(MethodInfo("updated")); - -#if 0 - ClassDB::bind_method(D_METHOD("node_add"),&ShaderGraph::node_add ); - ClassDB::bind_method(D_METHOD("node_remove"),&ShaderGraph::node_remove ); - ClassDB::bind_method(D_METHOD("node_set_param"),&ShaderGraph::node_set_param ); - ClassDB::bind_method(D_METHOD("node_set_pos"),&ShaderGraph::node_set_pos ); - - ClassDB::bind_method(D_METHOD("node_get_pos"),&ShaderGraph::node_get_pos ); - ClassDB::bind_method(D_METHOD("node_get_param"),&ShaderGraph::node_get_param); - ClassDB::bind_method(D_METHOD("node_get_type"),&ShaderGraph::node_get_type); - - ClassDB::bind_method(D_METHOD("connect"),&ShaderGraph::connect ); - ClassDB::bind_method(D_METHOD("disconnect"),&ShaderGraph::disconnect ); - - ClassDB::bind_method(D_METHOD("get_connections"),&ShaderGraph::_get_connections_helper ); - - ClassDB::bind_method(D_METHOD("clear"),&ShaderGraph::clear ); - - BIND_ENUM_CONSTANT( NODE_IN ); ///< param 0: name - BIND_ENUM_CONSTANT( NODE_OUT ); ///< param 0: name - BIND_ENUM_CONSTANT( NODE_CONSTANT ); ///< param 0: value - BIND_ENUM_CONSTANT( NODE_PARAMETER ); ///< param 0: name - BIND_ENUM_CONSTANT( NODE_ADD ); - BIND_ENUM_CONSTANT( NODE_SUB ); - BIND_ENUM_CONSTANT( NODE_MUL ); - BIND_ENUM_CONSTANT( NODE_DIV ); - BIND_ENUM_CONSTANT( NODE_MOD ); - BIND_ENUM_CONSTANT( NODE_SIN ); - BIND_ENUM_CONSTANT( NODE_COS ); - BIND_ENUM_CONSTANT( NODE_TAN ); - BIND_ENUM_CONSTANT( NODE_ARCSIN ); - BIND_ENUM_CONSTANT( NODE_ARCCOS ); - BIND_ENUM_CONSTANT( NODE_ARCTAN ); - BIND_ENUM_CONSTANT( NODE_POW ); - BIND_ENUM_CONSTANT( NODE_LOG ); - BIND_ENUM_CONSTANT( NODE_MAX ); - BIND_ENUM_CONSTANT( NODE_MIN ); - BIND_ENUM_CONSTANT( NODE_COMPARE ); - BIND_ENUM_CONSTANT( NODE_TEXTURE ); ///< param 0: texture - BIND_ENUM_CONSTANT( NODE_TIME ); ///< param 0: interval length - BIND_ENUM_CONSTANT( NODE_NOISE ); - BIND_ENUM_CONSTANT( NODE_PASS ); - BIND_ENUM_CONSTANT( NODE_VEC_IN ); ///< param 0: name - BIND_ENUM_CONSTANT( NODE_VEC_OUT ); ///< param 0: name - BIND_ENUM_CONSTANT( NODE_VEC_CONSTANT ); ///< param 0: value - BIND_ENUM_CONSTANT( NODE_VEC_PARAMETER ); ///< param 0: name - BIND_ENUM_CONSTANT( NODE_VEC_ADD ); - BIND_ENUM_CONSTANT( NODE_VEC_SUB ); - BIND_ENUM_CONSTANT( NODE_VEC_MUL ); - BIND_ENUM_CONSTANT( NODE_VEC_DIV ); - BIND_ENUM_CONSTANT( NODE_VEC_MOD ); - BIND_ENUM_CONSTANT( NODE_VEC_CROSS ); - BIND_ENUM_CONSTANT( NODE_VEC_DOT ); - BIND_ENUM_CONSTANT( NODE_VEC_POW ); - BIND_ENUM_CONSTANT( NODE_VEC_NORMALIZE ); - BIND_ENUM_CONSTANT( NODE_VEC_TRANSFORM3 ); - BIND_ENUM_CONSTANT( NODE_VEC_TRANSFORM4 ); - BIND_ENUM_CONSTANT( NODE_VEC_COMPARE ); - BIND_ENUM_CONSTANT( NODE_VEC_TEXTURE_2D ); - BIND_ENUM_CONSTANT( NODE_VEC_TEXTURE_CUBE ); - BIND_ENUM_CONSTANT( NODE_VEC_NOISE ); - BIND_ENUM_CONSTANT( NODE_VEC_0 ); - BIND_ENUM_CONSTANT( NODE_VEC_1 ); - BIND_ENUM_CONSTANT( NODE_VEC_2 ); - BIND_ENUM_CONSTANT( NODE_VEC_BUILD ); - BIND_ENUM_CONSTANT( NODE_VEC_PASS ); - BIND_ENUM_CONSTANT( NODE_COLOR_CONSTANT ); - BIND_ENUM_CONSTANT( NODE_COLOR_PARAMETER ); - BIND_ENUM_CONSTANT( NODE_TEXTURE_PARAMETER ); - BIND_ENUM_CONSTANT( NODE_TEXTURE_2D_PARAMETER ); - BIND_ENUM_CONSTANT( NODE_TEXTURE_CUBE_PARAMETER ); - BIND_ENUM_CONSTANT( NODE_TYPE_MAX ); -#endif } diff --git a/scene/resources/shader_graph.h b/scene/resources/shader_graph.h index 36578ce1f7..9a74b6c53a 100644 --- a/scene/resources/shader_graph.h +++ b/scene/resources/shader_graph.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,6 +30,7 @@ #ifndef SHADER_GRAPH_H #define SHADER_GRAPH_H +// FIXME: Needs to be ported to the new 3.0 shader API #if 0 #include "map.h" #include "scene/resources/shader.h" diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp index 6be88374e5..0046ff58a8 100644 --- a/scene/resources/shape.cpp +++ b/scene/resources/shape.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -74,7 +74,7 @@ Ref<ArrayMesh> Shape::get_debug_mesh() { arr.resize(Mesh::ARRAY_MAX); arr[Mesh::ARRAY_VERTEX] = array; - SceneTree *st = OS::get_singleton()->get_main_loop()->cast_to<SceneTree>(); + SceneTree *st = Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop()); debug_mesh_cache->add_surface_from_arrays(Mesh::PRIMITIVE_LINES, arr); diff --git a/scene/resources/shape.h b/scene/resources/shape.h index c15638aeed..bc75e723e9 100644 --- a/scene/resources/shape.h +++ b/scene/resources/shape.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/shape_2d.cpp b/scene/resources/shape_2d.cpp index 818c749e8c..4423c78bbe 100644 --- a/scene/resources/shape_2d.cpp +++ b/scene/resources/shape_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/shape_2d.h b/scene/resources/shape_2d.h index c020fb9141..fffc7011f1 100644 --- a/scene/resources/shape_2d.h +++ b/scene/resources/shape_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/shape_line_2d.cpp b/scene/resources/shape_line_2d.cpp index c38ae04eff..4dcc5ac981 100644 --- a/scene/resources/shape_line_2d.cpp +++ b/scene/resources/shape_line_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/shape_line_2d.h b/scene/resources/shape_line_2d.h index 3e59bbc687..68298b63be 100644 --- a/scene/resources/shape_line_2d.h +++ b/scene/resources/shape_line_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/sky_box.cpp b/scene/resources/sky_box.cpp index b7f2feb58d..9af8c42110 100644 --- a/scene/resources/sky_box.cpp +++ b/scene/resources/sky_box.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/sky_box.h b/scene/resources/sky_box.h index 9bd60cddaf..8934463b6f 100644 --- a/scene/resources/sky_box.h +++ b/scene/resources/sky_box.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/space_2d.cpp b/scene/resources/space_2d.cpp index 2a618bb868..4177364de7 100644 --- a/scene/resources/space_2d.cpp +++ b/scene/resources/space_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/space_2d.h b/scene/resources/space_2d.h index 3e08612d99..8ba392f85d 100644 --- a/scene/resources/space_2d.h +++ b/scene/resources/space_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/sphere_shape.cpp b/scene/resources/sphere_shape.cpp index 960554562f..00203c2b4b 100644 --- a/scene/resources/sphere_shape.cpp +++ b/scene/resources/sphere_shape.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/sphere_shape.h b/scene/resources/sphere_shape.h index a3b5d2424b..43d7956246 100644 --- a/scene/resources/sphere_shape.h +++ b/scene/resources/sphere_shape.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 7b2a9ffbc2..f646e3667d 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h index 30eb9543e8..db41333b7e 100644 --- a/scene/resources/style_box.h +++ b/scene/resources/style_box.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 9320676016..bf89e704bc 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -691,6 +691,17 @@ void SurfaceTool::mikktGetTexCoord(const SMikkTSpaceContext *pContext, float fvT fvTexcOut[1] = v.y; //fvTexcOut[1]=1.0-v.y; } + +void SurfaceTool::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fvBiTangent[], const float fMagS, const float fMagT, + const tbool bIsOrientationPreserving, const int iFace, const int iVert) { + + Vector<List<Vertex>::Element *> &varr = *((Vector<List<Vertex>::Element *> *)pContext->m_pUserData); + Vertex *vtx = &varr[iFace * 3 + iVert]->get(); + + vtx->tangent = Vector3(fvTangent[0], fvTangent[1], fvTangent[2]); + vtx->binormal = Vector3(fvBiTangent[0], fvBiTangent[1], fvBiTangent[2]); +} + void SurfaceTool::mikktSetTSpaceBasic(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert) { Vector<List<Vertex>::Element *> &varr = *((Vector<List<Vertex>::Element *> *)pContext->m_pUserData); @@ -715,8 +726,8 @@ void SurfaceTool::generate_tangents() { mkif.m_getNumVerticesOfFace = mikktGetNumVerticesOfFace; mkif.m_getPosition = mikktGetPosition; mkif.m_getTexCoord = mikktGetTexCoord; - mkif.m_setTSpaceBasic = mikktSetTSpaceBasic; - mkif.m_setTSpace = NULL; + mkif.m_setTSpace = mikktSetTSpaceDefault; + mkif.m_setTSpaceBasic = NULL; SMikkTSpaceContext msc; msc.m_pInterface = &mkif; diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h index fcc94753ca..cdaac643de 100644 --- a/scene/resources/surface_tool.h +++ b/scene/resources/surface_tool.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -90,6 +90,8 @@ private: static void mikktGetNormal(const SMikkTSpaceContext *pContext, float fvNormOut[], const int iFace, const int iVert); static void mikktGetTexCoord(const SMikkTSpaceContext *pContext, float fvTexcOut[], const int iFace, const int iVert); static void mikktSetTSpaceBasic(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert); + static void mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fvBiTangent[], const float fMagS, const float fMagT, + const tbool bIsOrientationPreserving, const int iFace, const int iVert); protected: static void _bind_methods(); diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index f542d2a8de..9751d6e711 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 6c20c71af0..207436e4a7 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index ac1bb105ac..e2e29b037b 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -1030,14 +1030,13 @@ RES ResourceFormatLoaderTheme::load(const String &p_path, const String &p_origin ERR_FAIL_V(RES()); } - if (res->cast_to<StyleBox>()) { - + if (Object::cast_to<StyleBox>(*res)) { theme->set_stylebox(item, control, res); - } else if (res->cast_to<Font>()) { + } else if (Object::cast_to<Font>(*res)) { theme->set_font(item, control, res); - } else if (res->cast_to<Font>()) { + } else if (Object::cast_to<Font>(*res)) { theme->set_font(item, control, res); - } else if (res->cast_to<Texture>()) { + } else if (Object::cast_to<Texture>(*res)) { theme->set_icon(item, control, res); } else { memdelete(f); diff --git a/scene/resources/theme.h b/scene/resources/theme.h index 5744c142d4..5b375d5585 100644 --- a/scene/resources/theme.h +++ b/scene/resources/theme.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 44fe676ddc..50e8c28c22 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 7d7855811f..fe782ff987 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/video_stream.cpp b/scene/resources/video_stream.cpp index 1b0e34b8db..2298e2ca9f 100644 --- a/scene/resources/video_stream.cpp +++ b/scene/resources/video_stream.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/video_stream.h b/scene/resources/video_stream.h index 544973f581..e08be02a07 100644 --- a/scene/resources/video_stream.h +++ b/scene/resources/video_stream.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,7 +30,6 @@ #ifndef VIDEO_STREAM_H #define VIDEO_STREAM_H -#include "audio_stream_resampled.h" #include "scene/resources/texture.h" class VideoStreamPlayback : public Resource { diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index b0d14125a0..af159975ca 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "world.h" + #include "camera_matrix.h" #include "octree.h" #include "scene/3d/camera.h" -#include "scene/3d/spatial_indexer.h" #include "scene/3d/visibility_notifier.h" #include "scene/scene_string_names.h" diff --git a/scene/resources/world.h b/scene/resources/world.h index 158086974c..767d1b5b6e 100644 --- a/scene/resources/world.h +++ b/scene/resources/world.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 2f43f903ba..a644793bd8 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h index f968b08a15..63d32473e0 100644 --- a/scene/resources/world_2d.h +++ b/scene/resources/world_2d.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ |