From bbfec2a7cc51909d1b95f90df028bc6195196fca Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Tue, 13 Feb 2018 02:36:03 +0100 Subject: [PATCH] Add dummy audio driver, fix dummy rasterizer (cherry picked from commit 4e1923a931a3d849563bbe5d6fe4a52277daf090) --- drivers/dummy/SCsub | 2 +- drivers/dummy/audio_driver_dummy.h | 58 ++++++++++++++++++++++++++++++ drivers/dummy/rasterizer_dummy.h | 26 +++++++++++--- platform/server/os_server.cpp | 5 +-- 4 files changed, 84 insertions(+), 7 deletions(-) create mode 100644 drivers/dummy/audio_driver_dummy.h diff --git a/drivers/dummy/SCsub b/drivers/dummy/SCsub index e170b8e3875..28b315ae668 100644 --- a/drivers/dummy/SCsub +++ b/drivers/dummy/SCsub @@ -2,4 +2,4 @@ Import('env') -env.add_source_files(env.drivers_sources,"*.cpp") +env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/dummy/audio_driver_dummy.h b/drivers/dummy/audio_driver_dummy.h new file mode 100644 index 00000000000..c3d8e107673 --- /dev/null +++ b/drivers/dummy/audio_driver_dummy.h @@ -0,0 +1,58 @@ +/*************************************************************************/ +/* audio_driver_dummy.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2018 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_DRIVER_DUMMY_H +#define AUDIO_DRIVER_DUMMY_H + +#include "core/os/mutex.h" +#include "core/os/thread.h" +#include "servers/audio_server.h" + +class AudioDriverDummy : public AudioDriver { +public: + const char *get_name() const { + return "Dummy"; + }; + + virtual Error init() { return OK; } + virtual void start(){}; + virtual int get_mix_rate() const {}; + virtual SpeakerMode get_speaker_mode() const {}; + virtual void lock(){}; + virtual void unlock(){}; + virtual void finish(){}; + + virtual float get_latency(){}; + + AudioDriverDummy(){}; + ~AudioDriverDummy(){}; +}; + +#endif // AUDIO_DRIVER_DUMMY_H diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index 6d4d87b2f32..1e9c7971598 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -1,12 +1,12 @@ /*************************************************************************/ -/* rasterizer.h */ +/* rasterizer_dummy.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2018 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 */ @@ -31,6 +31,7 @@ #define RASTERIZER_DUMMY_H #include "camera_matrix.h" +#include "scene/resources/mesh.h" #include "servers/visual/rasterizer.h" #include "servers/visual_server.h" @@ -244,8 +245,12 @@ public: RID mesh_create() { return RID(); } + void mesh_add_surface_from_arrays(RID p_mesh, VS::PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), uint32_t p_compress_format = Mesh::ARRAY_COMPRESS_DEFAULT) {} void mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector &p_array, int p_vertex_count, const PoolVector &p_index_array, int p_index_count, const AABB &p_aabb, const Vector > &p_blend_shapes = Vector >(), const Vector &p_bone_aabbs = Vector()) {} + void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data) {} + void mesh_add_surface_from_planes(RID p_mesh, const PoolVector &p_planes) {} + void mesh_set_blend_shape_count(RID p_mesh, int p_amount) {} int mesh_get_blend_shape_count(RID p_mesh) const { return 0; } @@ -446,6 +451,16 @@ public: void gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) {} /* LIGHTMAP CAPTURE */ + struct LightmapCaptureOctree { + + enum { + CHILD_EMPTY = 0xFFFFFFFF + }; + + uint16_t light[6][3]; //anisotropic light + float alpha; + uint32_t children[8]; + }; RID lightmap_capture_create() { return RID(); } void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {} @@ -461,7 +476,10 @@ public: int lightmap_capture_get_octree_cell_subdiv(RID p_capture) const { return 0; } void lightmap_capture_set_energy(RID p_capture, float p_energy) {} float lightmap_capture_get_energy(RID p_capture) const { return 0.0; } - const PoolVector *lightmap_capture_get_octree_ptr(RID p_capture) const {} + const PoolVector *lightmap_capture_get_octree_ptr(RID p_capture) const { + PoolVector p; + return &p; + } /* PARTICLES */ diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index 1340303fee4..a8be4fbc35b 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "os_server.h" +#include "drivers/dummy/audio_driver_dummy.h" #include "drivers/dummy/rasterizer_dummy.h" #include "print_string.h" #include "servers/visual/visual_server_raster.h" @@ -48,12 +49,12 @@ const char *OS_Server::get_video_driver_name(int p_driver) const { } int OS_Server::get_audio_driver_count() const { - return 0; + return 1; } const char *OS_Server::get_audio_driver_name(int p_driver) const { - return ""; + return "Dummy"; } void OS_Server::initialize_core() {