Fix unused variable warnings

The forth in my quest to make Godot 3.x compile with -Werror on GCC7
This commit is contained in:
Hein-Pieter van Braam 2017-09-02 22:32:31 +02:00
parent d1cb73b47a
commit b2a38854fd
38 changed files with 100 additions and 249 deletions

View file

@ -87,6 +87,8 @@ void FileAccessNetworkClient::_thread_func() {
DEBUG_PRINT("SEM WAIT - " + itos(sem->get()));
Error err = sem->wait();
if (err != OK)
ERR_PRINT("sem->wait() failed");
DEBUG_TIME("sem_unlock");
//DEBUG_PRINT("semwait returned "+itos(werr));
DEBUG_PRINT("MUTEX LOCK " + itos(lockcount));

View file

@ -37,7 +37,7 @@
#include "core/version.h"
//#define print_bl(m_what) print_line(m_what)
#define print_bl(m_what)
#define print_bl(m_what) (void)(m_what)
enum {
@ -854,12 +854,6 @@ void ResourceInteractiveLoaderBinary::open(FileAccess *p_f) {
}
bool big_endian = f->get_32();
#ifdef BIG_ENDIAN_ENABLED
endian_swap = !big_endian;
#else
bool endian_swap = big_endian;
#endif
bool use_real64 = f->get_32();
f->set_endian_swap(big_endian != 0); //read big endian if saved as big endian
@ -869,7 +863,11 @@ void ResourceInteractiveLoaderBinary::open(FileAccess *p_f) {
uint32_t ver_format = f->get_32();
print_bl("big endian: " + itos(big_endian));
print_bl("endian swap: " + itos(endian_swap));
#ifdef BIG_ENDIAN_ENABLED
print_bl("endian swap: " + itos(!big_endian));
#else
print_bl("endian swap: " + itos(big_endian));
#endif
print_bl("real64: " + itos(use_real64));
print_bl("major: " + itos(ver_major));
print_bl("minor: " + itos(ver_minor));
@ -964,18 +962,12 @@ String ResourceInteractiveLoaderBinary::recognize(FileAccess *p_f) {
}
bool big_endian = f->get_32();
#ifdef BIG_ENDIAN_ENABLED
endian_swap = !big_endian;
#else
bool endian_swap = big_endian;
#endif
bool use_real64 = f->get_32();
f->get_32(); // use_real64
f->set_endian_swap(big_endian != 0); //read big endian if saved as big endian
uint32_t ver_major = f->get_32();
uint32_t ver_minor = f->get_32();
f->get_32(); // ver_minor
uint32_t ver_format = f->get_32();
if (ver_format > FORMAT_VERSION || ver_major > VERSION_MAJOR) {
@ -993,8 +985,6 @@ ResourceInteractiveLoaderBinary::ResourceInteractiveLoaderBinary() {
f = NULL;
stage = 0;
endian_swap = false;
use_real64 = false;
error = OK;
translation_remapped = false;
}
@ -1123,16 +1113,14 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
}
bool big_endian = f->get_32();
#ifdef BIG_ENDIAN_ENABLED
endian_swap = !big_endian;
#else
bool endian_swap = big_endian;
#endif
bool use_real64 = f->get_32();
f->set_endian_swap(big_endian != 0); //read big endian if saved as big endian
fw->store_32(endian_swap);
#ifdef BIG_ENDIAN_ENABLED
fw->store_32(!big_endian);
#else
fw->store_32(big_endian);
#endif
fw->set_endian_swap(big_endian != 0);
fw->store_32(use_real64); //use real64
@ -1793,8 +1781,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
}
save_unicode_string(p_resource->get_class());
uint64_t md_at = f->get_pos();
f->store_64(0); //offset to impoty metadata
f->store_64(0); //offset to import metadata
for (int i = 0; i < 14; i++)
f->store_32(0); // reserved

View file

@ -44,8 +44,6 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
FileAccess *f;
bool endian_swap;
bool use_real64;
uint64_t importmd_ofs;
Vector<char> str_buf;

View file

@ -131,7 +131,6 @@ void CameraMatrix::set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_
void CameraMatrix::set_for_hmd(int p_eye, real_t p_aspect, real_t p_intraocular_dist, real_t p_display_width, real_t p_display_to_lens, real_t p_oversample, real_t p_z_near, real_t p_z_far) {
// we first calculate our base frustum on our values without taking our lens magnification into account.
real_t display_to_eye = 2.0 * p_display_to_lens;
real_t f1 = (p_intraocular_dist * 0.5) / p_display_to_lens;
real_t f2 = ((p_display_width - p_intraocular_dist) * 0.5) / p_display_to_lens;
real_t f3 = (p_display_width / 4.0) / p_display_to_lens;
@ -266,27 +265,26 @@ void CameraMatrix::get_viewport_size(real_t &r_width, real_t &r_height) const {
bool CameraMatrix::get_endpoints(const Transform &p_transform, Vector3 *p_8points) const {
Vector<Plane> planes = get_projection_planes(Transform());
const Planes intersections[8][3]={
{PLANE_FAR,PLANE_LEFT,PLANE_TOP},
{PLANE_FAR,PLANE_LEFT,PLANE_BOTTOM},
{PLANE_FAR,PLANE_RIGHT,PLANE_TOP},
{PLANE_FAR,PLANE_RIGHT,PLANE_BOTTOM},
{PLANE_NEAR,PLANE_LEFT,PLANE_TOP},
{PLANE_NEAR,PLANE_LEFT,PLANE_BOTTOM},
{PLANE_NEAR,PLANE_RIGHT,PLANE_TOP},
{PLANE_NEAR,PLANE_RIGHT,PLANE_BOTTOM},
const Planes intersections[8][3] = {
{ PLANE_FAR, PLANE_LEFT, PLANE_TOP },
{ PLANE_FAR, PLANE_LEFT, PLANE_BOTTOM },
{ PLANE_FAR, PLANE_RIGHT, PLANE_TOP },
{ PLANE_FAR, PLANE_RIGHT, PLANE_BOTTOM },
{ PLANE_NEAR, PLANE_LEFT, PLANE_TOP },
{ PLANE_NEAR, PLANE_LEFT, PLANE_BOTTOM },
{ PLANE_NEAR, PLANE_RIGHT, PLANE_TOP },
{ PLANE_NEAR, PLANE_RIGHT, PLANE_BOTTOM },
};
for(int i=0;i<8;i++) {
for (int i = 0; i < 8; i++) {
Vector3 point;
bool res = planes[intersections[i][0]].intersect_3(planes[intersections[i][1]],planes[intersections[i][2]], &point);
bool res = planes[intersections[i][0]].intersect_3(planes[intersections[i][1]], planes[intersections[i][2]], &point);
ERR_FAIL_COND_V(!res, false);
p_8points[i]=p_transform.xform(point);
p_8points[i] = p_transform.xform(point);
}
return true;
}
Vector<Plane> CameraMatrix::get_projection_planes(const Transform &p_transform) const {
@ -564,10 +562,9 @@ int CameraMatrix::get_pixels_per_meter(int p_for_pixel_width) const {
bool CameraMatrix::is_orthogonal() const {
return matrix[3][3]==1.0;
return matrix[3][3] == 1.0;
}
real_t CameraMatrix::get_fov() const {
const real_t *matrix = (const real_t *)this->matrix;

View file

@ -158,7 +158,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) {
max_depth = 0;
int max_alloc = fc;
int max = _create_bvh(bw.ptr(), bwp.ptr(), 0, fc, 1, max_depth, max_alloc);
_create_bvh(bw.ptr(), bwp.ptr(), 0, fc, 1, max_depth, max_alloc);
bw = PoolVector<BVH>::Write(); //clearup
bvh.resize(max_alloc); //resize back

View file

@ -125,6 +125,9 @@ void ScriptDebuggerRemote::_put_variable(const String &p_name, const Variant &p_
packet_peer_stream->put_var(p_name);
int len = 0;
Error err = encode_variant(p_variable, NULL, len);
if (err != OK)
ERR_PRINT("Failed to encode variant");
if (len > packet_peer_stream->get_output_buffer_max_size()) { //limit to max size
packet_peer_stream->put_var(Variant());
} else {

View file

@ -184,7 +184,6 @@ void ScriptInstance::call_multilevel(const StringName &p_method, VARIANT_ARG_DEC
argc++;
}
Variant::CallError error;
call_multilevel(p_method, argptr, argc);
}

View file

@ -595,7 +595,6 @@ RID RasterizerStorageGLES3::texture_create() {
void RasterizerStorageGLES3::texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags) {
int components;
GLenum format;
GLenum internal_format;
GLenum type;
@ -777,8 +776,6 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p
int tsize = 0;
int block = Image::get_format_block_size(img->get_format());
for (int i = 0; i < mipmaps; i++) {
int size, ofs;
@ -789,10 +786,6 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p
if (texture->compressed) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
//this is not needed, as compressed takes the regular size, even if blocks extend it
//int bw = (w % block != 0) ? w + (block - w % block) : w;
//int bh = (h % block != 0) ? h + (block - h % block) : h;
int bw = w;
int bh = h;
@ -4631,7 +4624,7 @@ void RasterizerStorageGLES3::light_directional_set_shadow_depth_range_mode(RID p
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
light->directional_range_mode=p_range_mode;
light->directional_range_mode = p_range_mode;
}
VS::LightDirectionalShadowDepthRangeMode RasterizerStorageGLES3::light_directional_get_shadow_depth_range_mode(RID p_light) const {

View file

@ -64,7 +64,6 @@ static size_t _set_sockaddr(struct sockaddr_storage *p_addr, const IP_Address &p
// IPv4 socket with IPv6 address
ERR_FAIL_COND_V(!p_ip.is_ipv4(), 0);
uint32_t ipv4 = *((uint32_t *)p_ip.get_ipv4());
struct sockaddr_in *addr4 = (struct sockaddr_in *)p_addr;
addr4->sin_family = AF_INET;
addr4->sin_port = htons(p_port); // short, network byte order

View file

@ -697,6 +697,8 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co
zd.zip = zip;
Error err = export_project_files(p_preset, _save_zip_file, &zd);
if (err != OK)
ERR_PRINT("Failed to export project files");
zipClose(zip, NULL);

View file

@ -412,7 +412,6 @@ void EditorNode::_fs_changed() {
}
if (changed.size()) {
int idx = 0;
for (List<Ref<Resource> >::Element *E = changed.front(); E; E = E->next()) {
E->get()->reload_from_file();
}
@ -1997,6 +1996,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
int cur_idx = editor_data.get_edited_scene();
_remove_edited_scene();
Error err = load_scene(filename);
if (err != OK)
ERR_PRINT("Failed to load scene");
editor_data.move_edited_scene_to_index(cur_idx);
get_undo_redo()->clear_history();
scene_tabs->set_current_tab(cur_idx);
@ -3607,13 +3608,6 @@ void EditorNode::_update_dock_slots_visibility() {
right_r_vsplit,
};
HSplitContainer *h_splits[4] = {
left_l_hsplit,
left_r_hsplit,
main_hsplit,
right_hsplit,
};
if (!docks_visible) {
for (int i = 0; i < DOCK_SLOT_MAX; i++) {

View file

@ -55,8 +55,8 @@ Error EditorSceneImporterGLTF::_parse_glb(const String &p_path, GLTFState &state
uint32_t magic = f->get_32();
ERR_FAIL_COND_V(magic != 0x46546C67, ERR_FILE_UNRECOGNIZED); //glTF
uint32_t version = f->get_32();
uint32_t length = f->get_32();
f->get_32(); // version
f->get_32(); // length
uint32_t chunk_length = f->get_32();
uint32_t chunk_type = f->get_32();
@ -1945,7 +1945,7 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
bool last = false;
while (true) {
float value = _interpolate_track<float>(track.weight_tracks[i].times, track.weight_tracks[i].values, time, track.weight_tracks[i].interpolation);
_interpolate_track<float>(track.weight_tracks[i].times, track.weight_tracks[i].values, time, track.weight_tracks[i].interpolation);
if (last) {
break;
}

View file

@ -103,7 +103,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
/* GET FILESIZE */
uint32_t filesize = file->get_32();
file->get_32(); // filesize
/* CHECK WAVE */

View file

@ -624,7 +624,7 @@ void ScriptTextEditor::_code_complete_script(const String &p_code, List<String>
}
String hint;
Error err = script->get_language()->complete_code(p_code, script->get_path().get_base_dir(), base, r_options, r_force, hint);
if (hint != "") {
if (err == OK && hint != "") {
code_editor->get_text_edit()->set_code_hint(hint);
}
}

View file

@ -164,6 +164,8 @@ void ShaderTextEditor::_code_complete_script(const String &p_code, List<String>
String calltip;
Error err = sl.complete(p_code, ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())), ShaderTypes::get_singleton()->get_types(), r_options, calltip);
if (err != OK)
ERR_PRINT("Shaderlang complete failed");
if (calltip != "") {
get_text_edit()->set_code_hint(calltip);
@ -403,13 +405,7 @@ void ShaderEditorPlugin::edit(Object *p_object) {
bool ShaderEditorPlugin::handles(Object *p_object) const {
bool handles = true;
Shader *shader = Object::cast_to<Shader>(p_object);
/*
if (Object::cast_to<ShaderGraph>(shader)) // Don't handle ShaderGraph's
handles = false;
*/
return shader != NULL;
}

View file

@ -2528,7 +2528,6 @@ Vector3 SpatialEditorViewport::_get_instance_position(const Point2 &p_pos) const
found_gizmos.insert(seg);
int handle = -1;
Vector3 hit_point;
Vector3 hit_normal;
bool inters = seg->intersect_ray(camera, p_pos, hit_point, hit_normal, NULL, false);
@ -3423,13 +3422,6 @@ void SpatialEditor::set_state(const Dictionary &p_state) {
settings_znear->set_value(float(d["znear"]));
if (d.has("fov"))
settings_fov->set_value(float(d["fov"]));
if (d.has("default_srgb")) {
bool use = d["default_srgb"];
//viewport_environment->set_enable_fx(Environment::FX_SRGB,use);
//view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_DEFAULT_SRGB), use );
}
if (d.has("show_grid")) {
bool use = d["show_grid"];

View file

@ -550,7 +550,6 @@ void TileMapEditor::_draw_fill_preview(int p_cell, const Point2i &p_point, bool
PoolVector<Vector2> points = _bucket_fill(p_point, false, true);
PoolVector<Vector2>::Read pr = points.read();
int len = points.size();
int time_after = OS::get_singleton()->get_ticks_msec();
for (int i = 0; i < len; ++i) {
_draw_cell(p_cell, pr[i], p_flip_h, p_flip_v, p_transpose, p_xform);

View file

@ -732,6 +732,8 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
ERR_FAIL_COND(platform.is_null());
Error err = platform->export_project(current, export_debug->is_pressed(), p_path, 0);
if (err != OK)
ERR_PRINT("Failed to export project");
}
void ProjectExportDialog::_bind_methods() {

View file

@ -2275,19 +2275,6 @@ void PropertyEditor::_check_reload_status(const String &p_name, TreeItem *item)
}
}
if (_might_be_in_instance()) {
Variant vorig;
Dictionary d = item->get_metadata(0);
int usage = d.has("usage") ? int(int(d["usage"]) & (PROPERTY_USAGE_STORE_IF_NONONE | PROPERTY_USAGE_STORE_IF_NONZERO)) : 0;
if (_get_instanced_node_original_property(p_name, vorig) || usage) {
Variant v = obj->get(p_name);
bool has_reload = _is_property_different(v, vorig, usage);
}
}
if (obj->call("property_can_revert", p_name).operator bool()) {
has_reload = true;

View file

@ -1325,7 +1325,6 @@ bool Main::start() {
int shadow_atlas_q2_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_2_subdiv");
int shadow_atlas_q3_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_3_subdiv");
sml->get_root()->set_shadow_atlas_size(shadow_atlas_size);
sml->get_root()->set_shadow_atlas_quadrant_subdiv(0, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q0_subdiv));
sml->get_root()->set_shadow_atlas_quadrant_subdiv(1, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q1_subdiv));
@ -1347,7 +1346,6 @@ bool Main::start() {
sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true));
sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true));
GLOBAL_DEF("gui/common/snap_controls_to_pixels", true);
}
String local_game_path;
@ -1389,6 +1387,8 @@ bool Main::start() {
if (editor) {
Error serr = editor_node->load_scene(local_game_path);
if (serr != OK)
ERR_PRINT("Failed to load scene");
OS::get_singleton()->set_context(OS::CONTEXT_EDITOR);
}
#endif

View file

@ -1026,9 +1026,6 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs):
fd.write("\t\t\t{" + x["set_mask"] + "," + x["clear_mask"] + "},\n")
fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const Enum *_enums=NULL;\n")
fd.write("\t\tstatic const EnumValue *_enum_values=NULL;\n")
conditionals_found = []
if (len(header_data.conditionals)):

View file

@ -74,15 +74,11 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path,
uint32_t mipmaps = f->get_32();
uint32_t flags = f->get_32();
uint32_t surfsize = f->get_32();
uint32_t bpp = f->get_32();
uint32_t rmask = f->get_32();
uint32_t gmask = f->get_32();
uint32_t bmask = f->get_32();
uint32_t amask = f->get_32();
f->seek(f->get_pos() + 20); // bpp, rmask, gmask, bmask, amask
uint8_t pvrid[5] = { 0, 0, 0, 0, 0 };
f->get_buffer(pvrid, 4);
ERR_FAIL_COND_V(String((char *)pvrid) != "PVR!", RES());
uint32_t surfcount = f->get_32();
f->get_32(); // surfcount
/*
print_line("height: "+itos(height));

View file

@ -831,7 +831,6 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
case TK_BUILTIN_FUNC: {
//builtin function
Variant::Type bt = Variant::Type(int(tk.value));
_get_token(tk);
if (tk.type != TK_PARENTHESIS_OPEN) {
_set_error("Expected '('");

View file

@ -520,25 +520,21 @@ class EditorExportAndroid : public EditorExportPlatform {
void _fix_manifest(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_manifest, bool p_give_internet) {
const int CHUNK_AXML_FILE = 0x00080003;
const int CHUNK_RESOURCEIDS = 0x00080180;
// Leaving the unused types commented because looking these constants up
// again later would be annoying
// const int CHUNK_AXML_FILE = 0x00080003;
// const int CHUNK_RESOURCEIDS = 0x00080180;
const int CHUNK_STRINGS = 0x001C0001;
const int CHUNK_XML_END_NAMESPACE = 0x00100101;
const int CHUNK_XML_END_TAG = 0x00100103;
const int CHUNK_XML_START_NAMESPACE = 0x00100100;
// const int CHUNK_XML_END_NAMESPACE = 0x00100101;
// const int CHUNK_XML_END_TAG = 0x00100103;
// const int CHUNK_XML_START_NAMESPACE = 0x00100100;
const int CHUNK_XML_START_TAG = 0x00100102;
const int CHUNK_XML_TEXT = 0x00100104;
// const int CHUNK_XML_TEXT = 0x00100104;
const int UTF8_FLAG = 0x00000100;
Vector<String> string_table;
uint32_t ofs = 0;
uint32_t header = decode_uint32(&p_manifest[ofs]);
uint32_t filesize = decode_uint32(&p_manifest[ofs + 4]);
ofs += 8;
//print_line("FILESIZE: "+itos(filesize)+" ACTUAL: "+itos(p_manifest.size()));
uint32_t ofs = 8;
uint32_t string_count = 0;
uint32_t styles_count = 0;
@ -646,24 +642,16 @@ class EditorExportAndroid : public EditorExportPlatform {
case CHUNK_XML_START_TAG: {
int iofs = ofs + 8;
uint32_t line = decode_uint32(&p_manifest[iofs]);
uint32_t nspace = decode_uint32(&p_manifest[iofs + 8]);
uint32_t name = decode_uint32(&p_manifest[iofs + 12]);
uint32_t check = decode_uint32(&p_manifest[iofs + 16]);
String tname = string_table[name];
//printf("NSPACE: %i\n",nspace);
//printf("NAME: %i (%s)\n",name,tname.utf8().get_data());
//printf("CHECK: %x\n",check);
uint32_t attrcount = decode_uint32(&p_manifest[iofs + 20]);
iofs += 28;
//printf("ATTRCOUNT: %x\n",attrcount);
for (uint32_t i = 0; i < attrcount; i++) {
uint32_t attr_nspace = decode_uint32(&p_manifest[iofs]);
uint32_t attr_name = decode_uint32(&p_manifest[iofs + 4]);
uint32_t attr_value = decode_uint32(&p_manifest[iofs + 8]);
uint32_t attr_flags = decode_uint32(&p_manifest[iofs + 12]);
uint32_t attr_resid = decode_uint32(&p_manifest[iofs + 16]);
String value;
@ -678,12 +666,6 @@ class EditorExportAndroid : public EditorExportPlatform {
else
nspace = "";
//printf("ATTR %i NSPACE: %i\n",i,attr_nspace);
//printf("ATTR %i NAME: %i (%s)\n",i,attr_name,attrname.utf8().get_data());
//printf("ATTR %i VALUE: %i (%s)\n",i,attr_value,value.utf8().get_data());
//printf("ATTR %i FLAGS: %x\n",i,attr_flags);
//printf("ATTR %i RESID: %x\n",i,attr_resid);
//replace project information
if (tname == "manifest" && attrname == "package") {
@ -691,9 +673,6 @@ class EditorExportAndroid : public EditorExportPlatform {
string_table[attr_value] = get_package_name(package_name);
}
//print_line("tname: "+tname);
//print_line("nspace: "+nspace);
//print_line("attrname: "+attrname);
if (tname == "manifest" && /*nspace=="android" &&*/ attrname == "versionCode") {
print_line("FOUND versionCode");
@ -712,13 +691,6 @@ class EditorExportAndroid : public EditorExportPlatform {
if (tname == "activity" && /*nspace=="android" &&*/ attrname == "screenOrientation") {
encode_uint32(orientation == 0 ? 0 : 1, &p_manifest[iofs + 16]);
/*
print_line("FOUND screen orientation");
if (attr_value==0xFFFFFFFF) {
WARN_PRINT("Version name in a resource, should be plaintext")
} else {
string_table[attr_value]=(orientation==0?"landscape":"portrait");
}*/
}
if (tname == "uses-feature" && /*nspace=="android" &&*/ attrname == "glEsVersion") {
@ -771,13 +743,10 @@ class EditorExportAndroid : public EditorExportPlatform {
} break;
}
//printf("chunk %x: size: %d\n",chunk,size);
ofs += size;
}
//printf("end\n");
//create new andriodmanifest binary
Vector<uint8_t> ret;
@ -876,8 +845,6 @@ class EditorExportAndroid : public EditorExportPlatform {
const int UTF8_FLAG = 0x00000100;
print_line("*******************GORRRGLE***********************");
uint32_t header = decode_uint32(&p_manifest[0]);
uint32_t filesize = decode_uint32(&p_manifest[4]);
uint32_t string_block_len = decode_uint32(&p_manifest[16]);
uint32_t string_count = decode_uint32(&p_manifest[20]);
uint32_t string_flags = decode_uint32(&p_manifest[28]);
@ -887,10 +854,6 @@ class EditorExportAndroid : public EditorExportPlatform {
String package_name = p_preset->get("package/name");
//printf("stirng block len: %i\n",string_block_len);
//printf("stirng count: %i\n",string_count);
//printf("flags: %x\n",string_flags);
for (uint32_t i = 0; i < string_count; i++) {
uint32_t offset = decode_uint32(&p_manifest[string_table_begins + i * 4]);

View file

@ -466,8 +466,6 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
EditorNode::progress_task_step(progress_task, "File: " + p_file_name, (p_file_no * 100) / p_total_files);
}
bool do_hash = p_file_name != "AppxSignature.p7x";
FileMeta meta;
meta.name = p_file_name;
meta.uncompressed_size = p_len;

View file

@ -338,7 +338,6 @@ void CanvasItem::_update_callback() {
notification(NOTIFICATION_DRAW);
emit_signal(SceneStringNames::get_singleton()->draw);
if (get_script_instance()) {
Variant::CallError err;
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_draw, NULL, 0);
}
drawing = false;

View file

@ -696,22 +696,6 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons
p_baker->bake_cells[p_idx].normal[2] += normal_accum.z;
p_baker->bake_cells[p_idx].alpha += alpha;
static const Vector3 side_normals[6] = {
Vector3(-1, 0, 0),
Vector3(1, 0, 0),
Vector3(0, -1, 0),
Vector3(0, 1, 0),
Vector3(0, 0, -1),
Vector3(0, 0, 1),
};
/*
for(int i=0;i<6;i++) {
if (normal.dot(side_normals[i])>CMP_EPSILON) {
p_baker->bake_cells[p_idx].used_sides|=(1<<i);
}
}*/
} else {
//go down

View file

@ -175,7 +175,6 @@ void Spatial::_notification(int p_what) {
if (get_script_instance()) {
Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0);
}
#ifdef TOOLS_ENABLED
@ -207,7 +206,6 @@ void Spatial::_notification(int p_what) {
if (get_script_instance()) {
Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_world, NULL, 0);
}

View file

@ -2478,7 +2478,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
pressing_for_editor = false;
blocked++;
bool handled = propagate_mouse_event(pos + cache.offset, 0, 0, b->is_doubleclick(), root, b->get_button_index(), b);
propagate_mouse_event(pos + cache.offset, 0, 0, b->is_doubleclick(), root, b->get_button_index(), b);
blocked--;
if (pressing_for_editor) {

View file

@ -50,7 +50,6 @@ void Node::_notification(int p_notification) {
Variant time = get_process_delta_time();
const Variant *ptr[1] = { &time };
Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_process, ptr, 1);
}
} break;
@ -60,7 +59,6 @@ void Node::_notification(int p_notification) {
Variant time = get_fixed_process_delta_time();
const Variant *ptr[1] = { &time };
Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_fixed_process, ptr, 1);
}
@ -134,7 +132,6 @@ void Node::_notification(int p_notification) {
set_fixed_process(true);
}
Variant::CallError err;
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0);
}
//emit_signal(SceneStringNames::get_singleton()->enter_tree);
@ -209,7 +206,6 @@ void Node::_propagate_enter_tree() {
if (get_script_instance()) {
Variant::CallError err;
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_tree, NULL, 0);
}
@ -273,7 +269,6 @@ void Node::_propagate_exit_tree() {
if (get_script_instance()) {
Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_tree, NULL, 0);
}
emit_signal(SceneStringNames::get_singleton()->tree_exited);

View file

@ -870,7 +870,6 @@ void SceneTree::_call_input_pause(const StringName &p_group, const StringName &p
if (!n->can_process())
continue;
Variant::CallError ce;
n->call_multilevel(p_method, (const Variant **)v, 1);
//ERR_FAIL_COND(node_count != g.nodes.size());
}

View file

@ -84,15 +84,6 @@ int Curve::add_point(Vector2 p_pos, real_t left_tangent, real_t right_tangent, T
int i = get_index(p_pos.x);
int nearest_index = i;
if (i + 1 < _points.size()) {
real_t diff0 = p_pos.x - _points[i].pos.x;
real_t diff1 = _points[i + 1].pos.x - p_pos.x;
if (diff1 < diff0)
nearest_index = i + 1;
}
if (i == 0 && p_pos.x < _points[0].pos.x) {
// Insert before anything else
_points.insert(0, Point(p_pos, left_tangent, right_tangent, left_mode, right_mode));

View file

@ -130,7 +130,6 @@ void ARVRServer::request_reference_frame(bool p_ignore_tilt, bool p_keep_height)
void ARVRServer::add_interface(const Ref<ARVRInterface> &p_interface) {
ERR_FAIL_COND(p_interface.is_null());
int idx = -1;
for (int i = 0; i < interfaces.size(); i++) {
if (interfaces[i] == p_interface) {

View file

@ -31,18 +31,13 @@
void AudioEffectLimiterInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
float thresh = Math::db2linear(base->threshold);
float threshdb = base->threshold;
float ceiling = Math::db2linear(base->ceiling);
float ceildb = base->ceiling;
float makeup = Math::db2linear(ceildb - threshdb);
float makeupdb = ceildb - threshdb;
float sc = -base->soft_clip;
float scv = Math::db2linear(sc);
float sccomp = Math::db2linear(-sc);
float peakdb = ceildb + 25;
float peaklvl = Math::db2linear(peakdb);
float scratio = base->soft_clip_ratio;
float scmult = Math::abs((ceildb - sc) / (peakdb - sc));
for (int i = 0; i < p_frame_count; i++) {

View file

@ -954,6 +954,9 @@ Vector3 ConvexPolygonShapeSW::get_moment_of_inertia(real_t p_mass) const {
void ConvexPolygonShapeSW::_setup(const Vector<Vector3> &p_vertices) {
Error err = QuickHull::build(p_vertices, mesh);
if (err != OK)
ERR_PRINT("Failed to build QuickHull");
Rect3 _aabb;
for (int i = 0; i < mesh.vertices.size(); i++) {

View file

@ -62,7 +62,7 @@ void StepSW::_setup_island(ConstraintSW *p_island, real_t p_delta) {
ConstraintSW *ci = p_island;
while (ci) {
bool process = ci->setup(p_delta);
ci->setup(p_delta);
//todo remove from island if process fails
ci = ci->get_island_next();
}

View file

@ -3000,8 +3000,6 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
if (op->op == OP_CONSTRUCT) {
ERR_FAIL_COND_V(op->arguments[0]->type != Node::TYPE_VARIABLE, p_node);
VariableNode *vn = static_cast<VariableNode *>(op->arguments[0]);
//StringName name=vn->name;
DataType base = get_scalar_type(op->get_datatype());
@ -3121,8 +3119,8 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
tk = _get_token();
VariableDeclarationNode *vardecl = alloc_node<VariableDeclarationNode>();
vardecl->datatype=type;
vardecl->precision=precision;
vardecl->datatype = type;
vardecl->precision = precision;
p_block->statements.push_back(vardecl);
@ -3148,8 +3146,8 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
VariableDeclarationNode::Declaration decl;
decl.name=name;
decl.initializer=NULL;
decl.name = name;
decl.initializer = NULL;
tk = _get_token();
@ -3161,13 +3159,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
decl.initializer = n;
if (var.type!=n->get_datatype()) {
if (var.type != n->get_datatype()) {
_set_error("Invalid assignment of '" + get_datatype_name(n->get_datatype()) + "' to '" + get_datatype_name(var.type) + "'");
return ERR_PARSE_ERROR;
}
tk = _get_token();
}
vardecl->declarations.push_back(decl);
@ -3272,9 +3268,9 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
BlockNode *init_block = alloc_node<BlockNode>();
init_block->parent_block = p_block;
init_block->single_statement=true;
init_block->single_statement = true;
cf->blocks.push_back(init_block);
if (_parse_block(init_block,p_builtin_types,true,false,false)!=OK) {
if (_parse_block(init_block, p_builtin_types, true, false, false) != OK) {
return ERR_PARSE_ERROR;
}
@ -3282,10 +3278,9 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
if (!n)
return ERR_PARSE_ERROR;
if (n->get_datatype()!=TYPE_BOOL) {
if (n->get_datatype() != TYPE_BOOL) {
_set_error("Middle expression is expected to be boolean.");
return ERR_PARSE_ERROR;
}
tk = _get_token();
@ -3392,7 +3387,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
p_block->statements.push_back(flow);
} else if (tk.type == TK_CF_BREAK) {
if (!p_can_break) {
//all is good
_set_error("Breaking is not allowed here");
@ -3411,7 +3405,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
p_block->statements.push_back(flow);
} else if (tk.type == TK_CF_CONTINUE) {
if (!p_can_break) {
//all is good
_set_error("Contiuning is not allowed here");
@ -3980,6 +3973,8 @@ Error ShaderLanguage::complete(const String &p_code, const Map<StringName, Funct
shader = alloc_node<ShaderNode>();
Error err = _parse_shader(p_functions, p_render_modes, p_shader_types);
if (err != OK)
ERR_PRINT("Failed to parse shader");
switch (completion_type) {

View file

@ -151,8 +151,6 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance
} else if (B->base_type == VS::INSTANCE_GI_PROBE && A->base_type == VS::INSTANCE_LIGHT) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(B->base_data);
InstanceLightData *light = static_cast<InstanceLightData *>(A->base_data);
return gi_probe->lights.insert(A);
}
@ -211,8 +209,6 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance
} else if (B->base_type == VS::INSTANCE_GI_PROBE && A->base_type == VS::INSTANCE_LIGHT) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(B->base_data);
InstanceLightData *light = static_cast<InstanceLightData *>(A->base_data);
Set<Instance *>::Element *E = reinterpret_cast<Set<Instance *>::Element *>(udata);
gi_probe->lights.erase(E);
@ -890,50 +886,48 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
max_distance = MIN(shadow_max, max_distance);
}
max_distance = MAX(max_distance, p_cam_projection.get_z_near() + 0.001);
float min_distance = MIN(p_cam_projection.get_z_near(),max_distance);
float min_distance = MIN(p_cam_projection.get_z_near(), max_distance);
VS::LightDirectionalShadowDepthRangeMode depth_range_mode = VSG::storage->light_directional_get_shadow_depth_range_mode(p_instance->base);
if (depth_range_mode==VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED) {
if (depth_range_mode == VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED) {
//optimize min/max
Vector<Plane> planes = p_cam_projection.get_projection_planes(p_cam_transform);
int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
Plane base(p_cam_transform.origin,-p_cam_transform.basis.get_axis(2));
Plane base(p_cam_transform.origin, -p_cam_transform.basis.get_axis(2));
//check distance max and min
bool found_items=false;
float z_max=-1e20;
float z_min=1e20;
bool found_items = false;
float z_max = -1e20;
float z_min = 1e20;
for(int i=0;i<cull_count;i++) {
for (int i = 0; i < cull_count; i++) {
Instance *instance = instance_shadow_cull_result[i];
if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
continue;
}
float max,min;
float max, min;
instance->transformed_aabb.project_range_in_plane(base, min, max);
if (max>z_max) {
z_max=max;
if (max > z_max) {
z_max = max;
}
if (min<z_min) {
z_min=min;
if (min < z_min) {
z_min = min;
}
found_items=true;
found_items = true;
}
if (found_items) {
min_distance=MAX(min_distance,z_min);
max_distance=MIN(max_distance,z_max);
min_distance = MAX(min_distance, z_min);
max_distance = MIN(max_distance, z_max);
}
}
float range = max_distance - min_distance;
int splits = 0;
@ -1062,7 +1056,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
z_max_cam = z_vec.dot(center) + radius;
z_min_cam = z_vec.dot(center) - radius;
if (depth_range_mode==VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE) {
if (depth_range_mode == VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE) {
//this trick here is what stabilizes the shadow (make potential jaggies to not move)
//at the cost of some wasted resolution. Still the quality increase is very well worth it
@ -1073,8 +1067,6 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
y_max_cam = Math::stepify(y_max_cam, unit);
y_min_cam = Math::stepify(y_min_cam, unit);
}
}
//now that we now all ranges, we can proceed to make the light frustum planes, for culling octree
@ -1118,7 +1110,6 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
{
CameraMatrix ortho_camera;
real_t half_x = (x_max_cam - x_min_cam) * 0.5;
real_t half_y = (y_max_cam - y_min_cam) * 0.5;
@ -2135,7 +2126,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co
int success_count = 0;
uint64_t us = OS::get_singleton()->get_ticks_usec();
// uint64_t us = OS::get_singleton()->get_ticks_usec();
for (int i = 0; i < p_leaf_count; i++) {
@ -2188,14 +2179,15 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co
success_count++;
}
}
//print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
//print_line("valid cells: " + itos(success_count));
// print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
// print_line("valid cells: " + itos(success_count));
} break;
case VS::LIGHT_OMNI:
case VS::LIGHT_SPOT: {
uint64_t us = OS::get_singleton()->get_ticks_usec();
// uint64_t us = OS::get_singleton()->get_ticks_usec();
Vector3 light_pos = light_cache.transform.origin;
Vector3 spot_axis = -light_cache.transform.basis.get_axis(2).normalized();
@ -2294,8 +2286,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co
light->energy[2] += int32_t(light_b * att * ((cell->albedo) & 0xFF) / 255.0);
}
}
//print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
// print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
} break;
}
}
@ -2707,18 +2698,17 @@ void VisualServerScene::render_probes() {
} break;
case GI_UPDATE_STAGE_UPLOADING: {
uint64_t us = OS::get_singleton()->get_ticks_usec();
// uint64_t us = OS::get_singleton()->get_ticks_usec();
for (int i = 0; i < (int)probe->dynamic.mipmaps_3d.size(); i++) {
int mmsize = probe->dynamic.mipmaps_3d[i].size();
PoolVector<uint8_t>::Read r = probe->dynamic.mipmaps_3d[i].read();
VSG::storage->gi_probe_dynamic_data_update(probe->dynamic.probe_data, 0, probe->dynamic.grid_size[2] >> i, i, r.ptr());
}
probe->dynamic.updating_stage = GI_UPDATE_STAGE_CHECK;
//print_line("UPLOAD TIME: "+rtos((OS::get_singleton()->get_ticks_usec()-us)/1000000.0));
// print_line("UPLOAD TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
} break;
}
}