Commit 9d245415 by Rémi Verschelde

Remove unused classes and stray headers

Found by reviewing headers with 1 or less matching includes: ``` find -name thirdparty -prune -o -name "*.h" -exec basename {} \; | sort -u > headers for header in $(cat headers); do echo "$header: "; rg -l "#include \"(.*/)?$header\"" | wc -l; done > list-includes ```
parent c450d4d3
/*************************************************************************/
/* doc_dump.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 DOC_DUMP_H
#define DOC_DUMP_H
#include "core/class_db.h"
class DocDump {
public:
static void dump(const String &p_file);
};
#endif // DOC_DUMP_H
/*************************************************************************/
/* file_type_cache.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 "file_type_cache.h"
#include "core/os/file_access.h"
#include "core/project_settings.h"
FileTypeCache *FileTypeCache::singleton = NULL;
bool FileTypeCache::has_file(const String &p_path) const {
GLOBAL_LOCK_FUNCTION
return file_type_map.has(p_path);
}
String FileTypeCache::get_file_type(const String &p_path) const {
GLOBAL_LOCK_FUNCTION
ERR_FAIL_COND_V(!file_type_map.has(p_path), "");
return file_type_map[p_path];
}
void FileTypeCache::set_file_type(const String &p_path, const String &p_type) {
GLOBAL_LOCK_FUNCTION
file_type_map[p_path] = p_type;
}
void FileTypeCache::load() {
GLOBAL_LOCK_FUNCTION
String project = ProjectSettings::get_singleton()->get_resource_path();
FileAccess *f = FileAccess::open(project + "/file_type_cache.cch", FileAccess::READ);
if (!f) {
WARN_PRINT("Can't open file_type_cache.cch.");
return;
}
file_type_map.clear();
while (!f->eof_reached()) {
String path = f->get_line();
if (f->eof_reached())
break;
String type = f->get_line();
set_file_type(path, type);
}
memdelete(f);
}
void FileTypeCache::save() {
GLOBAL_LOCK_FUNCTION
String project = ProjectSettings::get_singleton()->get_resource_path();
FileAccess *f = FileAccess::open(project + "/file_type_cache.cch", FileAccess::WRITE);
ERR_FAIL_COND_MSG(!f, "Can't open file_type_cache.cch for writing, not saving file type cache!");
const String *K = NULL;
while ((K = file_type_map.next(K))) {
f->store_line(*K);
f->store_line(file_type_map[*K]);
}
memdelete(f);
}
FileTypeCache::FileTypeCache() {
ERR_FAIL_COND_MSG(singleton, "FileTypeCache singleton already exist.");
singleton = this;
}
/*************************************************************************/
/* file_type_cache.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 FILE_TYPE_CACHE_H
#define FILE_TYPE_CACHE_H
#include "core/object.h"
class FileTypeCache : Object {
GDCLASS(FileTypeCache, Object);
HashMap<String, String> file_type_map;
static FileTypeCache *singleton;
public:
static FileTypeCache *get_singleton() { return singleton; }
bool has_file(const String &p_path) const;
String get_file_type(const String &p_path) const;
void set_file_type(const String &p_path, const String &p_type);
void load();
void save();
FileTypeCache();
};
#endif // FILE_TYPE_CACHE_H
......@@ -28,8 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "test_main.h"
#include "core/list.h"
#include "core/os/main_loop.h"
#ifdef DEBUG_ENABLED
......
......@@ -32,9 +32,10 @@
#define TEST_MAIN_H
#include "core/list.h"
#include "core/os/main_loop.h"
#include "core/ustring.h"
const char **tests_get_names();
MainLoop *test_main(String p_test, const List<String> &p_args);
#endif
#endif // TEST_MAIN_H
......@@ -30,9 +30,8 @@
#include "test_oa_hash_map.h"
#include "core/os/os.h"
#include "core/oa_hash_map.h"
#include "core/os/os.h"
namespace TestOAHashMap {
......
......@@ -37,4 +37,5 @@ namespace TestOAHashMap {
MainLoop *test();
}
#endif // TEST_OA_HASH_MAP_H
......@@ -28,6 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "test_ordered_hash_map.h"
#include "core/ordered_hash_map.h"
#include "core/os/os.h"
#include "core/pair.h"
......
......@@ -31,9 +31,11 @@
#ifndef TEST_ORDERED_HASH_MAP_H
#define TEST_ORDERED_HASH_MAP_H
#include "core/os/main_loop.h"
namespace TestOrderedHashMap {
MainLoop *test();
}
#endif
#endif // TEST_ORDERED_HASH_MAP_H
/*************************************************************************/
/* platform_refcount.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 "core/safe_refcount.h"
#ifdef IPHONE_ENABLED
#define REFCOUNT_T int
#define REFCOUNT_GET_T int const volatile &
#include <libkern/OSAtomic.h>
inline int atomic_conditional_increment(volatile int *v) {
return (*v == 0) ? 0 : OSAtomicIncrement32(v);
}
inline int atomic_decrement(volatile int *v) {
return OSAtomicDecrement32(v);
}
#endif
......@@ -31,6 +31,8 @@
#ifdef X11_ENABLED
#if defined(OPENGL_ENABLED)
#include "detect_prime.h"
#include "core/print_string.h"
#include "core/ustring.h"
......
/*************************************************************************/
/* path_texture.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 "path_texture.h"
void PathTexture::set_begin_texture(const Ref<Texture2D> &p_texture) {
begin = p_texture;
update();
}
Ref<Texture2D> PathTexture::get_begin_texture() const {
return begin;
}
void PathTexture::set_repeat_texture(const Ref<Texture2D> &p_texture) {
repeat = p_texture;
update();
}
Ref<Texture2D> PathTexture::get_repeat_texture() const {
return repeat;
}
void PathTexture::set_end_texture(const Ref<Texture2D> &p_texture) {
end = p_texture;
update();
}
Ref<Texture2D> PathTexture::get_end_texture() const {
return end;
}
void PathTexture::set_subdivisions(int p_amount) {
ERR_FAIL_INDEX(p_amount, 32);
subdivs = p_amount;
update();
}
int PathTexture::get_subdivisions() const {
return subdivs;
}
void PathTexture::set_overlap(int p_amount) {
overlap = p_amount;
update();
}
int PathTexture::get_overlap() const {
return overlap;
}
PathTexture::PathTexture() {
overlap = 0;
subdivs = 1;
}
/*************************************************************************/
/* path_texture.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 PATH_TEXTURE_H
#define PATH_TEXTURE_H
#include "scene/2d/node_2d.h"
class PathTexture : public Node2D {
GDCLASS(PathTexture, Node2D);
Ref<Texture2D> begin;
Ref<Texture2D> repeat;
Ref<Texture2D> end;
int subdivs;
bool overlap;
public:
void set_begin_texture(const Ref<Texture2D> &p_texture);
Ref<Texture2D> get_begin_texture() const;
void set_repeat_texture(const Ref<Texture2D> &p_texture);
Ref<Texture2D> get_repeat_texture() const;
void set_end_texture(const Ref<Texture2D> &p_texture);
Ref<Texture2D> get_end_texture() const;
void set_subdivisions(int p_amount);
int get_subdivisions() const;
void set_overlap(int p_amount);
int get_overlap() const;
PathTexture();
};
#endif // PATH_TEXTURE_H
/*************************************************************************/
/* canvas.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 "canvas.h"
#include "servers/visual_server.h"
RID Canvas::get_rid() const {
return canvas;
}
Canvas::Canvas() {
canvas = VisualServer::get_singleton()->canvas_create();
}
Canvas::~Canvas() {
VisualServer::get_singleton()->free(canvas);
}
/*************************************************************************/
/* canvas.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 CANVAS_H
#define CANVAS_H
#include "core/resource.h"
class Canvas : public Resource {
GDCLASS(Canvas, Resource);
RID canvas;
public:
virtual RID get_rid() const;
Canvas();
~Canvas();
};
#endif // CANVAS_H
/*************************************************************************/
/* reverb_sw.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 REVERB_SW_H
#define REVERB_SW_H
#include "core/os/memory.h"
#include "core/typedefs.h"
struct ReverbParamsSW;
class ReverbSW {
public:
enum ReverbMode {
REVERB_MODE_ROOM,
REVERB_MODE_STUDIO_SMALL,
REVERB_MODE_STUDIO_MEDIUM,
REVERB_MODE_STUDIO_LARGE,
REVERB_MODE_HALL,
REVERB_MODE_SPACE_ECHO,
REVERB_MODE_ECHO,
REVERB_MODE_DELAY,
REVERB_MODE_HALF_ECHO
};
private:
struct State {
int lwl;
int lwr;
int rwl;
int rwr;
unsigned int Offset;
void reset() {
lwl = 0;
lwr = 0;
rwl = 0;
rwr = 0;
Offset = 0;
}
State() { reset(); }
} state;
ReverbParamsSW *current_params;
int *reverb_buffer;
unsigned int reverb_buffer_size;
ReverbMode mode;
int mix_rate;
void adjust_current_params();
public:
void set_mode(ReverbMode p_mode);
bool process(int *p_input, int *p_output, int p_frames, int p_stereo_stride = 1); // return tru if audio was created
void set_mix_rate(int p_mix_rate);
ReverbSW();
~ReverbSW();
};
#endif
/*************************************************************************/
/* voice_rb_sw.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 VOICE_RB_SW_H
#define VOICE_RB_SW_H
#include "core/os/os.h"
#include "servers/audio_server.h"
class VoiceRBSW {
public:
enum {
VOICE_RB_SIZE = 1024
};
struct Command {
enum Type {
CMD_NONE,
CMD_PLAY,
CMD_STOP,
CMD_SET_VOLUME,
CMD_SET_PAN,
CMD_SET_FILTER,
CMD_SET_CHORUS,
CMD_SET_REVERB,
CMD_SET_MIX_RATE,
CMD_SET_POSITIONAL,
CMD_CHANGE_ALL_FX_VOLUMES
};
Type type;
RID voice;
struct {
RID sample;
} play;
union {
struct {
float volume;
} volume;
struct {
float pan, depth, height;
} pan;
struct {
AS::FilterType type;
float cutoff;
float resonance;
float gain;
} filter;
struct {
float send;
} chorus;
struct {
float send;
AS::ReverbRoomType room;
} reverb;
struct {
int mix_rate;
} mix_rate;
struct {
bool positional;
} positional;
};
Command() { type = CMD_NONE; }
};
private:
Command voice_cmd_rb[VOICE_RB_SIZE];
volatile int read_pos;
volatile int write_pos;
public:
_FORCE_INLINE_ bool commands_left() const { return read_pos != write_pos; }
_FORCE_INLINE_ Command pop_command() {
ERR_FAIL_COND_V(read_pos == write_pos, Command());
Command cmd = voice_cmd_rb[read_pos];
read_pos = (read_pos + 1) % VOICE_RB_SIZE;
return cmd;
}
_FORCE_INLINE_ void push_command(const Command &p_command) {
bool full = ((write_pos + 1) % VOICE_RB_SIZE) == read_pos;
if (full) {
#ifdef DEBUG_ENABLED
if (OS::get_singleton()->is_stdout_verbose()) {
ERR_FAIL_COND_MSG(((write_pos + 1) % VOICE_RB_SIZE) == read_pos, "Audio ring buffer full (too many commands).");
}
#endif
return;
}
voice_cmd_rb[write_pos] = p_command;
write_pos = (write_pos + 1) % VOICE_RB_SIZE;
}
VoiceRBSW() { read_pos = write_pos = 0; }
};
#endif // VOICE_RB_SW_H
......@@ -29,6 +29,7 @@
/*************************************************************************/
#include "shader_rd.h"
#include "core/string_builder.h"
#include "rasterizer_rd.h"
#include "servers/visual/rendering_device.h"
......
/*************************************************************************/
/* visual_server_light_baker.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 "visual_server_light_baker.h"
VisualServerLightBaker::VisualServerLightBaker() {
}
/*************************************************************************/
/* visual_server_light_baker.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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 */
/* "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 VISUALSERVERLIGHTBAKER_H
#define VISUALSERVERLIGHTBAKER_H
#include "servers/visual_server.h"
class VisualServerLightBaker {
public:
struct BakeCell {
uint32_t cells[8];
uint32_t neighbours[7]; //one unused
uint32_t albedo; //albedo in RGBE
uint32_t emission; //emissive light in RGBE
uint32_t light[4]; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast)
float alpha; //used for upsampling
uint32_t directional_pass; //used for baking directional
};
VisualServerLightBaker();
};
#endif // VISUALSERVERLIGHTBAKER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment