This commit is contained in:
Juan Linietsky 2014-12-16 22:33:35 -03:00
commit d55f95e0d2
24 changed files with 350 additions and 53 deletions

View file

@ -10,11 +10,6 @@ The editor, language and APIs are feature rich, yet simple to learn, allowing yo
Godot has been developed by Juan Linietsky and Ariel Manzur for several years, and was born as an in-house engine, used to publish several work-for-hire titles.
Development is sponsored by OKAM Studio (http://www.okamstudio.com).
### Godot is BETA. Collaborate!!
Having been developed as in-house means that the user experience may still not be ideal for everyone. The features needed to make a great game are there, but we really need your help to fix all the rough edges and improve usability (via feedback and/or code contributions).
We know we are close to having an awesome, open source, game engine with nothing to envy from the best commercial offerings, but we can't do this alone. This is why Godot is now open source, so everyone can help us reach this goal.
### Documentation
Documentation has been moved to the [GitHub Wiki](https://github.com/okamstudio/godot/wiki).

View file

@ -29,6 +29,8 @@
#include "http_client.h"
#include "io/stream_peer_ssl.h"
VARIANT_ENUM_CAST(HTTPClient::Status);
Error HTTPClient::connect_url(const String& p_url) {
return OK;

View file

@ -31,7 +31,7 @@
#include "os/semaphore.h"
#include "hash_map.h"
VARIANT_ENUM_CAST(IP::ResolverStatus);
/************* RESOLVER ******************/

View file

@ -30,6 +30,8 @@
#include "print_string.h"
//#define DEBUG_XML
VARIANT_ENUM_CAST(XMLParser::NodeType);
static bool _equalsn(const CharType* str1, const CharType* str2, int len) {
int i;
for(i=0; str1[i] && str2[i] && i < len; ++i)

View file

@ -136,7 +136,10 @@ public:
static int b;
#if defined(_MSC_VER) && _MSC_VER < 1800
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0603 // windows 8?
b = (int)((a>0.0f) ? (a + 0.5f):(a -0.5f));
#elif defined(_MSC_VER) && _MSC_VER < 1800
__asm fld a
__asm fistp b
/*#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
@ -147,6 +150,7 @@ public:
"fistpl %0 \n\t"
: "=m" (b)
: "m" (a));*/
#else
b=lrintf(a); //assuming everything but msvc 2012 or earlier has lrint
#endif

View file

@ -167,13 +167,17 @@ public:
static String get_type_name(Variant::Type p_type);
static bool can_convert(Type p_type_from,Type p_type_to);
#pragma runtime_checks( "", off )
template<class T>
static Type get_type_for() {
GetSimpleType<T> t;
Variant v(t.type);
return v.get_type();
Type r = v.get_type();
return r;
}
#pragma runtime_checks( "", restore )
bool is_ref() const;
_FORCE_INLINE_ bool is_num() const { return type==INT || type==REAL; };

View file

@ -9,7 +9,7 @@ var gray_mat = FixedMaterial.new()
var selected=false
func _input_event(event,pos,normal,shape):
func _input_event(camera,event,pos,normal,shape):
if (event.type==InputEvent.MOUSE_BUTTON and event.pressed):
if (not selected):
get_node("mesh").set_material_override(gray_mat)

View file

@ -1230,7 +1230,7 @@ LIGHT_SHADER_CODE
vec3 ambient = const_light_mult*ambient_light*diffuse.rgb;
# if defined(LIGHT_TYPE_OMNI) || defined (LIGHT_TYPE_SPOT)
ambient*=diffuse_interp.a; //attenuation affects ambient too
// ambient*=diffuse_interp.a; //attenuation affects ambient too
# endif

View file

@ -275,7 +275,7 @@ void AudioStreamMPC::stop() {
}
bool AudioStreamMPC::is_playing() const {
return active;
return active || (get_total() - get_todo() -1 > 0);
}
void AudioStreamMPC::set_paused(bool p_paused) {

View file

@ -78,6 +78,9 @@ else:
if env["platform"] == "android":
env_theora.Append(CPPFLAGS=["-D_ANDROID"])
if env["platform"] == "winrt":
env_theora.Append(CPPFLAGS=["-D_WINRT"])
env_theora.Append(CPPPATH=["#drivers/theoraplayer/include/theoraplayer", "#drivers/theoraplayer/src/YUV", "#drivers/theoraplayer/src/YUV/libyuv/include", "#drivers/theoraplayer/src/Theora", "#drivers/theoraplayer/src/AVFoundation"])
objs = []

View file

@ -28,7 +28,7 @@
/*************************************************************************/
#include "ip_unix.h"
#if defined(UNIX_ENABLED) || defined(WINDOWS_ENABLED)
#if defined(UNIX_ENABLED) || defined(WINDOWS_ENABLED) && !defined(WINRT_ENABLED)
#ifdef WINDOWS_ENABLED

View file

@ -106,6 +106,7 @@ String DirAccessWindows::get_next() {
return name;
} else {
#ifndef WINRT_ENABLED
_cisdir=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
String name=p->f.cFileName;
@ -117,7 +118,8 @@ String DirAccessWindows::get_next() {
}
return name;
#endif
return "";
}
}
@ -358,6 +360,7 @@ bool DirAccessWindows::dir_exists(String p_dir) {
return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
} else {
#ifndef WINRT_ENABLED
DWORD fileAttr;
fileAttr = GetFileAttributesExA(p_dir.ascii().get_data(), GetFileExInfoStandard, &fileInfo);
@ -366,8 +369,8 @@ bool DirAccessWindows::dir_exists(String p_dir) {
return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
#endif
}
return false;
}

View file

@ -54,7 +54,6 @@ void FileAccessWindows::check_errors() const {
Error FileAccessWindows::_open(const String& p_filename, int p_mode_flags) {
String filename=fix_path(p_filename);
if (f)
close();

View file

@ -438,8 +438,26 @@ public class GodotIO {
try {
Log.v("MyApp", "TRYING TO OPEN URI: " + p_uri);
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(p_uri));
activity.startActivity(myIntent);
String path = p_uri;
String type="";
if (path.startsWith("/")) {
//absolute path to filesystem, prepend file://
path="file://"+path;
if (p_uri.endsWith(".png") || p_uri.endsWith(".jpg") || p_uri.endsWith(".gif") || p_uri.endsWith(".webp")) {
type="image/*";
}
}
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
if (!type.equals("")) {
intent.setDataAndType(Uri.parse(path), type);
} else {
intent.setData(Uri.parse(path));
}
activity.startActivity(intent);
return 0;
} catch (ActivityNotFoundException e) {

View file

@ -8,4 +8,4 @@ files = [
'os_winrt.cpp',
]
env.Program('#bin/godot_rt', files)
env.Program('#bin/godot', files)

View file

@ -5,6 +5,8 @@
#include "app.h"
#include "main/main.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
using namespace Windows::ApplicationModel::Core;
using namespace Windows::ApplicationModel::Activation;
@ -70,8 +72,9 @@ void App::Initialize(CoreApplicationView^ applicationView)
}
// Called when the CoreWindow object is created (or re-created).
void App::SetWindow(CoreWindow^ window)
void App::SetWindow(CoreWindow^ p_window)
{
window = p_window;
window->VisibilityChanged +=
ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &App::OnVisibilityChanged);
@ -89,23 +92,230 @@ void App::SetWindow(CoreWindow^ window)
pointerVisualizationSettings->IsBarrelButtonFeedbackEnabled = false;
#endif
// The CoreWindow has been created, so EGL can be initialized.
window->PointerPressed +=
ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerPressed);
window->PointerMoved +=
ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerMoved);
window->PointerReleased +=
ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerReleased);
//window->PointerWheelChanged +=
// ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerWheelChanged);
char* args[] = {"-path", "game", NULL};
Main::setup("winrt", 2, args, false);
// The CoreWindow has been created, so EGL can be initialized.
ContextEGL* context = memnew(ContextEGL(window));
os->set_gl_context(context);
UpdateWindowSize(Size(window->Bounds.Width, window->Bounds.Height));
UpdateWindowSize(Size(window->Bounds.Width, window->Bounds.Height));
Main::setup2();
}
static int _get_button(Windows::UI::Input::PointerPoint ^pt) {
using namespace Windows::UI::Input;
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
return BUTTON_LEFT;
#else
switch (pt->Properties->PointerUpdateKind)
{
case PointerUpdateKind::LeftButtonPressed:
case PointerUpdateKind::LeftButtonReleased:
return BUTTON_LEFT;
case PointerUpdateKind::RightButtonPressed:
case PointerUpdateKind::RightButtonReleased:
return BUTTON_RIGHT;
case PointerUpdateKind::MiddleButtonPressed:
case PointerUpdateKind::MiddleButtonReleased:
return BUTTON_MIDDLE;
case PointerUpdateKind::XButton1Pressed:
case PointerUpdateKind::XButton1Released:
return BUTTON_WHEEL_UP;
case PointerUpdateKind::XButton2Pressed:
case PointerUpdateKind::XButton2Released:
return BUTTON_WHEEL_DOWN;
default:
break;
}
#endif
return 0;
};
static bool _is_touch(Windows::UI::Input::PointerPoint ^pointerPoint) {
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
return true;
#else
using namespace Windows::Devices::Input;
switch (pointerPoint->PointerDevice->PointerDeviceType) {
case PointerDeviceType::Touch:
case PointerDeviceType::Pen:
return true;
default:
return false;
}
#endif
}
static Windows::Foundation::Point _get_pixel_position(CoreWindow^ window, Windows::Foundation::Point rawPosition, OS* os) {
Windows::Foundation::Point outputPosition;
// Compute coordinates normalized from 0..1.
// If the coordinates need to be sized to the SDL window,
// we'll do that after.
#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
outputPosition.X = rawPosition.X / window->Bounds.Width;
outputPosition.Y = rawPosition.Y / window->Bounds.Height;
#else
switch (DisplayProperties::CurrentOrientation)
{
case DisplayOrientations::Portrait:
outputPosition.X = rawPosition.X / window->Bounds.Width;
outputPosition.Y = rawPosition.Y / window->Bounds.Height;
break;
case DisplayOrientations::PortraitFlipped:
outputPosition.X = 1.0f - (rawPosition.X / window->Bounds.Width);
outputPosition.Y = 1.0f - (rawPosition.Y / window->Bounds.Height);
break;
case DisplayOrientations::Landscape:
outputPosition.X = rawPosition.Y / window->Bounds.Height;
outputPosition.Y = 1.0f - (rawPosition.X / window->Bounds.Width);
break;
case DisplayOrientations::LandscapeFlipped:
outputPosition.X = 1.0f - (rawPosition.Y / window->Bounds.Height);
outputPosition.Y = rawPosition.X / window->Bounds.Width;
break;
default:
break;
}
#endif
OS::VideoMode vm = os->get_video_mode();
outputPosition.X *= vm.width;
outputPosition.Y *= vm.height;
return outputPosition;
};
static int _get_finger(uint32_t p_touch_id) {
return p_touch_id % 31; // for now
};
void App::pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args, bool p_pressed) {
Windows::UI::Input::PointerPoint ^point = args->CurrentPoint;
Windows::Foundation::Point pos = _get_pixel_position(window, point->Position, os);
int but = _get_button(point);
if (_is_touch(point)) {
InputEvent event;
event.type = InputEvent::SCREEN_TOUCH;
event.device = 0;
event.screen_touch.pressed = p_pressed;
event.screen_touch.x = pos.X;
event.screen_touch.y = pos.Y;
event.screen_touch.index = _get_finger(point->PointerId);
last_touch_x[event.screen_touch.index] = pos.X;
last_touch_y[event.screen_touch.index] = pos.Y;
os->input_event(event);
if (event.screen_touch.index != 0)
return;
}; // fallthrought of sorts
InputEvent event;
event.type = InputEvent::MOUSE_BUTTON;
event.device = 0;
event.mouse_button.pressed = p_pressed;
event.mouse_button.button_index = but;
event.mouse_button.x = pos.X;
event.mouse_button.y = pos.Y;
event.mouse_button.global_x = pos.X;
event.mouse_button.global_y = pos.Y;
last_touch_x[31] = pos.X;
last_touch_y[31] = pos.Y;
os->input_event(event);
};
void App::OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) {
pointer_event(sender, args, true);
};
void App::OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) {
pointer_event(sender, args, false);
};
void App::OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) {
Windows::UI::Input::PointerPoint ^point = args->CurrentPoint;
Windows::Foundation::Point pos = _get_pixel_position(window, point->Position, os);
if (_is_touch(point)) {
InputEvent event;
event.type = InputEvent::SCREEN_DRAG;
event.device = 0;
event.screen_drag.x = pos.X;
event.screen_drag.y = pos.Y;
event.screen_drag.index = _get_finger(point->PointerId);
event.screen_drag.relative_x = event.screen_drag.x - last_touch_x[event.screen_drag.index];
event.screen_drag.relative_y = event.screen_drag.y - last_touch_y[event.screen_drag.index];
os->input_event(event);
if (event.screen_drag.index != 0)
return;
}; // fallthrought of sorts
InputEvent event;
event.type = InputEvent::MOUSE_MOTION;
event.device = 0;
event.mouse_motion.x = pos.X;
event.mouse_motion.y = pos.Y;
event.mouse_motion.global_x = pos.X;
event.mouse_motion.global_y = pos.Y;
event.mouse_motion.relative_x = pos.X - last_touch_x[31];
event.mouse_motion.relative_y = pos.Y - last_touch_y[31];
os->input_event(event);
};
// Initializes scene resources
void App::Load(Platform::String^ entryPoint)
{
char** args = {NULL};
Main::setup("winrt", 0, args);
//char* args[] = {"-test", "render", NULL};
//Main::setup("winrt", 2, args);
}
// This method is called after the window becomes active.
void App::Run()
{
if (Main::start())
os->run();
}

View file

@ -32,6 +32,12 @@ namespace $ext_safeprojectname$
void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
void pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args, bool p_pressed);
void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
void UpdateWindowSize(Windows::Foundation::Size size);
void InitializeEGL(Windows::UI::Core::CoreWindow^ window);
void CleanupEGL();
@ -44,8 +50,12 @@ namespace $ext_safeprojectname$
EGLDisplay mEglDisplay;
EGLContext mEglContext;
EGLSurface mEglSurface;
CoreWindow^ window;
OSWinrt* os;
};
int last_touch_x[32]; // 20 fingers, index 31 reserved for the mouse
int last_touch_y[32];
};
}

View file

@ -3,6 +3,7 @@
import os
import sys
import string
def is_active():
@ -30,11 +31,11 @@ def configure(env):
env.Append(CPPPATH=['#platform/winrt', '#platform/winrt/include'])
env['OBJSUFFIX'] = ".rt" + env['OBJSUFFIX']
env['LIBSUFFIX'] = ".rt" + env['LIBSUFFIX']
env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', "kernel32.lib", '/MACHINE:X64', '/WINMD', '/APPCONTAINER', '/MANIFESTUAC:NO', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1'])
env.Append(LIBPATH=['#platform/winrt/x64/lib'])
if (env["target"]=="release"):
env.Append(CCFLAGS=['/O2'])
@ -48,19 +49,24 @@ def configure(env):
elif (env["target"]=="debug"):
env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DD3D_DEBUG_INFO','/O1'])
env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DD3D_DEBUG_INFO'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
env.Append(LINKFLAGS=['/DEBUG'])
env.Append(LINKFLAGS=['/DEBUG', '/D_DEBUG'])
elif (env["target"]=="profile"):
env.Append(CCFLAGS=['-g','-pg'])
env.Append(LINKFLAGS=['-pg'])
env.Append(CCFLAGS=['/Gd','/GR','/nologo', '/EHsc'])
env.Append(CXXFLAGS=['/TP', '/ZW'])
env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
#env.Append(CCFLAGS=['/I'+os.getenv("WindowsSdkDir")+"/Include"])
env.Append(CCFLAGS=string.split('/MP /GS /wd"4453" /wd"28204" /Zc:wchar_t /Gm- /Od /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /MDd /EHsc /nologo'))
env.Append(CXXFLAGS=string.split('/ZW'))
env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR']+'\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR']+'\\References\\CommonConfiguration\\Neutral'])
#env.Append(CCFLAGS=['/Gd','/GR','/nologo', '/EHsc'])
#env.Append(CXXFLAGS=['/TP', '/ZW'])
#env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
##env.Append(CCFLAGS=['/I'+os.getenv("WindowsSdkDir")+"/Include"])
env.Append(CCFLAGS=['/DWINRT_ENABLED'])
env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
env.Append(CCFLAGS=['/DWINAPI_FAMILY=WINAPI_FAMILY_APP', '/D_WIN32_WINNT=0x0603', '/DNTDDI_VERSION=0x06030000'])
@ -70,8 +76,16 @@ def configure(env):
env.Append(CCFLAGS=['/DGLES2_ENABLED'])
#env.Append(CCFLAGS=['/DGLES1_ENABLED'])
env.Append(LIBS=['winmm','opengl32','dsound','kernel32','ole32','user32','gdi32', 'IPHLPAPI', 'wsock32', 'shell32','advapi32'])
LIBS=[
#'winmm',
'libEGL',
'libGLESv2',
'libANGLE',
#'kernel32','ole32','user32', 'advapi32'
]
env.Append(LINKFLAGS=[p+".lib" for p in LIBS])
import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
@ -80,4 +94,3 @@ def configure(env):
env['ENV'] = os.environ;

View file

@ -71,7 +71,7 @@ const char * OSWinrt::get_video_driver_name(int p_driver) const {
OS::VideoMode OSWinrt::get_default_video_mode() const {
return VideoMode(800,600,false);
return video_mode;
}
int OSWinrt::get_audio_driver_count() const {
@ -148,6 +148,16 @@ void OSWinrt::initialize(const VideoMode& p_desired,int p_video_driver,int p_aud
outside=true;
gl_context->initialize();
VideoMode vm;
vm.width = gl_context->get_window_width();
vm.height = gl_context->get_window_height();
vm.fullscreen = true;
vm.resizable = false;
set_video_mode(vm);
gl_context->make_current();
rasterizer = memnew( RasterizerGLES2 );
visual_server = memnew( VisualServerRaster(rasterizer) );
if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) {
@ -270,6 +280,11 @@ String OSWinrt::get_clipboard() const {
};
void OSWinrt::input_event(InputEvent &p_event) {
p_event.ID = ++last_id;
input->parse_input_event(p_event);
};
void OSWinrt::delete_main_loop() {
if (main_loop)
@ -392,7 +407,7 @@ void OSWinrt::set_window_title(const String& p_title) {
void OSWinrt::set_video_mode(const VideoMode& p_video_mode,int p_screen) {
video_mode = p_video_mode;
}
OS::VideoMode OSWinrt::get_video_mode(int p_screen) const {
@ -512,7 +527,7 @@ Error OSWinrt::kill(const ProcessID& p_pid) {
Error OSWinrt::set_cwd(const String& p_cwd) {
return OK;
return FAILED;
}
String OSWinrt::get_executable_path() const {
@ -634,6 +649,7 @@ OSWinrt::OSWinrt() {
gl_context = NULL;
AudioDriverManagerSW::add_driver(&audio_driver);
}

View file

@ -40,6 +40,7 @@
#include "servers/spatial_sound/spatial_sound_server_sw.h"
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/audio/audio_driver_dummy.h"
#include "gl_context_egl.h"
@ -124,6 +125,7 @@ class OSWinrt : public OS {
MainLoop *main_loop;
AudioDriverDummy audio_driver;
AudioServerSW *audio_server;
SampleManagerMallocSW *sample_manager;
SpatialSoundServerSW *spatial_sound_server;
@ -231,12 +233,16 @@ public:
virtual void make_rendering_thread();
virtual void swap_buffers();
virtual bool has_touchscreen_ui_hint() const { return true; };
virtual Error shell_open(String p_uri);
void run();
virtual bool get_swap_ok_cancel() { return true; }
void input_event(InputEvent &p_event);
OSWinrt();
~OSWinrt();

View file

@ -38,15 +38,18 @@ int AudioStreamResampled::get_channel_count() const {
template<int C>
void AudioStreamResampled::_resample(int32_t *p_dest,int p_todo,int32_t p_increment) {
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(pos>=rb_len);
ERR_FAIL_COND_V(pos>=rb_len,0);
#endif
uint32_t pos_next = (pos+1)&rb_mask;
//printf("rb pos %i\n",pos);
@ -151,7 +154,7 @@ void AudioStreamResampled::_resample(int32_t *p_dest,int p_todo,int32_t p_increm
}
rb_read_pos=offset>>MIX_FRAC_BITS;
return read>>MIX_FRAC_BITS;//rb_read_pos=offset>>MIX_FRAC_BITS;
}
@ -173,10 +176,10 @@ bool AudioStreamResampled::mix(int32_t *p_dest, int p_frames) {
} else if (rb_read_pos<write_pos_cache) {
rb_todo=write_pos_cache-rb_read_pos-1;
rb_todo=write_pos_cache-rb_read_pos; //-1?
} else {
rb_todo=(rb_len-rb_read_pos)+write_pos_cache-1;
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 );
@ -220,13 +223,22 @@ bool AudioStreamResampled::mix(int32_t *p_dest, int p_frames) {
#endif
{
uint32_t read=0;
switch(channels) {
case 1: _resample<1>(p_dest,todo,increment); break;
case 2: _resample<2>(p_dest,todo,increment); break;
case 4: _resample<4>(p_dest,todo,increment); break;
case 6: _resample<6>(p_dest,todo,increment); break;
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 (read>rb_todo)
read=rb_todo;
rb_read_pos = (rb_read_pos+read)&rb_mask;
}
return true;

View file

@ -57,7 +57,7 @@ class AudioStreamResampled : public AudioStream {
template<int C>
void _resample(int32_t *p_dest,int p_todo,int32_t p_increment);
uint32_t _resample(int32_t *p_dest,int p_todo,int32_t p_increment);
protected:
@ -97,7 +97,7 @@ protected:
_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);
ERR_FAIL_COND(p_frames >= rb_len);
switch(channels) {
case 1: {

View file

@ -3422,7 +3422,7 @@ EditorNode::EditorNode() {
p->add_item("New Scene",FILE_NEW_SCENE);
p->add_item("Open Scene..",FILE_OPEN_SCENE,KEY_MASK_CMD+KEY_O);
p->add_item("Save Scene",FILE_SAVE_SCENE,KEY_MASK_CMD+KEY_S);
p->add_item("Save Scene As..",FILE_SAVE_AS_SCENE);
p->add_item("Save Scene As..",FILE_SAVE_AS_SCENE,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_S);
p->add_separator();
p->add_item("Goto Prev. Scene",FILE_OPEN_PREV,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_P);
p->add_submenu_item("Open Recent","RecentScenes",FILE_OPEN_RECENT);

View file

@ -2,6 +2,6 @@ short_name="godot"
name="Godot Engine"
major=1
minor=0
status="rc2"
status="stable"