Add dummy audio driver, fix dummy rasterizer

This commit is contained in:
K. S. Ernest (iFire) Lee 2018-02-13 02:36:03 +01:00
parent 2de10aa467
commit 4e1923a931
4 changed files with 84 additions and 7 deletions

View File

@ -2,4 +2,4 @@
Import('env')
env.add_source_files(env.drivers_sources,"*.cpp")
env.add_source_files(env.drivers_sources, "*.cpp")

View File

@ -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

View File

@ -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<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) {}
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<Plane> &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<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const {}
const PoolVector<RasterizerStorage::LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const {
PoolVector<RasterizerStorage::LightmapCaptureOctree> p;
return &p;
}
/* PARTICLES */

View File

@ -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() {