diff options
Diffstat (limited to 'drivers/dummy')
-rw-r--r-- | drivers/dummy/audio_driver_dummy.h | 58 | ||||
-rw-r--r-- | drivers/dummy/rasterizer_dummy.h | 71 | ||||
-rw-r--r-- | drivers/dummy/texture_loader_dummy.cpp | 8 | ||||
-rw-r--r-- | drivers/dummy/texture_loader_dummy.h | 4 |
4 files changed, 43 insertions, 98 deletions
diff --git a/drivers/dummy/audio_driver_dummy.h b/drivers/dummy/audio_driver_dummy.h deleted file mode 100644 index 4f4d7f9bc4..0000000000 --- a/drivers/dummy/audio_driver_dummy.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************/ -/* audio_driver_dummy.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 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 { return DEFAULT_MIX_RATE; }; - virtual SpeakerMode get_speaker_mode() const { return SPEAKER_MODE_STEREO; }; - virtual void lock(){}; - virtual void unlock(){}; - virtual void finish(){}; - - virtual float get_latency() { return 0; }; - - AudioDriverDummy(){}; - ~AudioDriverDummy(){}; -}; - -#endif // AUDIO_DRIVER_DUMMY_H diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index 8d5cf2ebea..fb23370863 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 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 */ @@ -32,6 +32,7 @@ #define RASTERIZER_DUMMY_H #include "core/math/camera_matrix.h" +#include "core/rid_owner.h" #include "core/self_list.h" #include "scene/resources/mesh.h" #include "servers/visual/rasterizer.h" @@ -121,7 +122,7 @@ public: class RasterizerStorageDummy : public RasterizerStorage { public: /* TEXTURE API */ - struct DummyTexture : public RID_Data { + struct DummyTexture { int width; int height; uint32_t flags; @@ -133,23 +134,23 @@ public: struct DummySurface { uint32_t format; VS::PrimitiveType primitive; - PoolVector<uint8_t> array; + Vector<uint8_t> array; int vertex_count; - PoolVector<uint8_t> index_array; + Vector<uint8_t> index_array; int index_count; AABB aabb; - Vector<PoolVector<uint8_t> > blend_shapes; + Vector<Vector<uint8_t> > blend_shapes; Vector<AABB> bone_aabbs; }; - struct DummyMesh : public RID_Data { + struct DummyMesh { Vector<DummySurface> surfaces; int blend_shape_count; VS::BlendShapeMode blend_shape_mode; }; - mutable RID_Owner<DummyTexture> texture_owner; - mutable RID_Owner<DummyMesh> mesh_owner; + mutable RID_PtrOwner<DummyTexture> texture_owner; + mutable RID_PtrOwner<DummyMesh> mesh_owner; RID texture_create() { @@ -178,7 +179,7 @@ public: } void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, int p_level) { - DummyTexture *t = texture_owner.get(p_texture); + DummyTexture *t = texture_owner.getornull(p_texture); ERR_FAIL_COND(!t); ERR_FAIL_COND_MSG(p_image.is_null(), "It's not a reference to a valid Image object."); @@ -294,7 +295,7 @@ public: return mesh_owner.make_rid(mesh); } - 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(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t> > &p_blend_shapes = Vector<Vector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()) { DummyMesh *m = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!m); @@ -333,7 +334,7 @@ public: return m->blend_shape_mode; } - void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) {} + void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) {} void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) {} RID mesh_surface_get_material(RID p_mesh, int p_surface) const { return RID(); } @@ -351,15 +352,15 @@ public: return m->surfaces[p_surface].index_count; } - PoolVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const { + Vector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const { DummyMesh *m = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!m, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!m, Vector<uint8_t>()); return m->surfaces[p_surface].array; } - PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const { + Vector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const { DummyMesh *m = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!m, PoolVector<uint8_t>()); + ERR_FAIL_COND_V(!m, Vector<uint8_t>()); return m->surfaces[p_surface].index_array; } @@ -383,9 +384,9 @@ public: return m->surfaces[p_surface].aabb; } - Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const { + Vector<Vector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const { DummyMesh *m = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!m, Vector<PoolVector<uint8_t> >()); + ERR_FAIL_COND_V(!m, Vector<Vector<uint8_t> >()); return m->surfaces[p_surface].blend_shapes; } @@ -435,7 +436,7 @@ public: Color multimesh_instance_get_color(RID p_multimesh, int p_index) const { return Color(); } Color multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const { return Color(); } - void multimesh_set_as_bulk_array(RID p_multimesh, const PoolVector<float> &p_array) {} + void multimesh_set_as_bulk_array(RID p_multimesh, const Vector<float> &p_array) {} void multimesh_set_visible_instances(RID p_multimesh, int p_visible) {} int multimesh_get_visible_instances(RID p_multimesh) const { return 0; } @@ -554,9 +555,9 @@ public: void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) {} Transform gi_probe_get_to_cell_xform(RID p_probe) const { return Transform(); } - void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) {} - PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const { - PoolVector<int> p; + void gi_probe_set_dynamic_data(RID p_probe, const Vector<int> &p_data) {} + Vector<int> gi_probe_get_dynamic_data(RID p_probe) const { + Vector<int> p; return p; } @@ -588,7 +589,7 @@ 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 Instantiable : public RID_Data { + struct Instantiable { SelfList<RasterizerScene::InstanceBase>::List instance_list; @@ -619,7 +620,7 @@ public: struct LightmapCapture : public Instantiable { - PoolVector<LightmapCaptureOctree> octree; + Vector<LightmapCaptureOctree> octree; AABB bounds; Transform cell_xform; int cell_subdiv; @@ -630,18 +631,18 @@ public: } }; - mutable RID_Owner<LightmapCapture> lightmap_capture_data_owner; + mutable RID_PtrOwner<LightmapCapture> lightmap_capture_data_owner; void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {} AABB lightmap_capture_get_bounds(RID p_capture) const { return AABB(); } - void lightmap_capture_set_octree(RID p_capture, const PoolVector<uint8_t> &p_octree) {} + void lightmap_capture_set_octree(RID p_capture, const Vector<uint8_t> &p_octree) {} RID lightmap_capture_create() { LightmapCapture *capture = memnew(LightmapCapture); return lightmap_capture_data_owner.make_rid(capture); } - PoolVector<uint8_t> lightmap_capture_get_octree(RID p_capture) const { + Vector<uint8_t> lightmap_capture_get_octree(RID p_capture) const { const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); - ERR_FAIL_COND_V(!capture, PoolVector<uint8_t>()); - return PoolVector<uint8_t>(); + ERR_FAIL_COND_V(!capture, Vector<uint8_t>()); + return Vector<uint8_t>(); } void lightmap_capture_set_octree_cell_transform(RID p_capture, const Transform &p_xform) {} Transform lightmap_capture_get_octree_cell_transform(RID p_capture) const { return Transform(); } @@ -649,7 +650,7 @@ 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 Vector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const { const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture); ERR_FAIL_COND_V(!capture, NULL); return &capture->octree; @@ -700,7 +701,7 @@ public: void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id) {} void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value) {} bool render_target_was_used(RID p_render_target) { return false; } - void render_target_clear_used(RID p_render_target) {} + void render_target_set_as_unused(RID p_render_target) {} void render_target_set_msaa(RID p_render_target, VS::ViewportMSAA p_msaa) {} /* CANVAS SHADOW */ @@ -710,7 +711,7 @@ public: /* LIGHT SHADOW MAPPING */ RID canvas_light_occluder_create() { return RID(); } - void canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2> &p_lines) {} + void canvas_light_occluder_set_polylines(RID p_occluder, const Vector<Vector2> &p_lines) {} VS::InstanceType get_base_type(RID p_rid) const { if (mesh_owner.owns(p_rid)) { @@ -724,7 +725,7 @@ public: if (texture_owner.owns(p_rid)) { // delete the texture - DummyTexture *texture = texture_owner.get(p_rid); + DummyTexture *texture = texture_owner.getornull(p_rid); texture_owner.free(p_rid); memdelete(texture); } @@ -742,6 +743,8 @@ public: int get_captured_render_info(VS::RenderInfo p_info) { return 0; } int get_render_info(VS::RenderInfo p_info) { return 0; } + String get_video_adapter_name() const { return String(); } + String get_video_adapter_vendor() const { return String(); } static RasterizerStorage *base_singleton; @@ -791,7 +794,7 @@ public: void clear_render_target(const Color &p_color) {} void blit_render_target_to_screen(RID p_render_target, const Rect2 &p_screen_rect, int p_screen = 0) {} void output_lens_distorted_to_screen(RID p_render_target, const Rect2 &p_screen_rect, float p_k1, float p_k2, const Vector2 &p_eye_center, float p_oversample) {} - void end_frame(bool p_swap_buffers) {} + void end_frame(bool p_swap_buffers) { OS::get_singleton()->swap_buffers(); } void finalize() {} static Error is_viable() { diff --git a/drivers/dummy/texture_loader_dummy.cpp b/drivers/dummy/texture_loader_dummy.cpp index 88d11fef2c..aff7bbd1bc 100644 --- a/drivers/dummy/texture_loader_dummy.cpp +++ b/drivers/dummy/texture_loader_dummy.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 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 */ @@ -43,7 +43,7 @@ RES ResourceFormatDummyTexture::load(const String &p_path, const String &p_origi Image::Format fmt = Image::FORMAT_RGB8; int rowsize = 3 * width; - PoolVector<uint8_t> dstbuff; + Vector<uint8_t> dstbuff; dstbuff.resize(rowsize * height); @@ -74,7 +74,7 @@ void ResourceFormatDummyTexture::get_recognized_extensions(List<String> *p_exten } bool ResourceFormatDummyTexture::handles_type(const String &p_type) const { - return ClassDB::is_parent_class(p_type, "Texture"); + return ClassDB::is_parent_class(p_type, "Texture2D"); } String ResourceFormatDummyTexture::get_resource_type(const String &p_path) const { diff --git a/drivers/dummy/texture_loader_dummy.h b/drivers/dummy/texture_loader_dummy.h index 0bc7fa226b..86c9a375a3 100644 --- a/drivers/dummy/texture_loader_dummy.h +++ b/drivers/dummy/texture_loader_dummy.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 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 */ |