Cleanup some #if 0'd code

This commit is contained in:
Rémi Verschelde 2017-12-17 15:29:39 +01:00
parent ad3393743c
commit 8f25a2dc11
17 changed files with 10 additions and 1324 deletions

View file

@ -354,47 +354,10 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target, const Re
void RasterizerGLES3::end_frame(bool p_swap_buffers) {
#if 0
canvas->canvas_begin();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D,storage->resources.white_tex);
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
float vtx[8]={0,0,
0,1,
1,1,
1,0
};
glBindBuffer(GL_ARRAY_BUFFER,0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, 0, vtx );
//glBindBuffer(GL_ARRAY_BUFFER,canvas->data.canvas_quad_vertices);
//glEnableVertexAttribArray(VS::ARRAY_VERTEX);
//glVertexAttribPointer( VS::ARRAY_VERTEX, 2 ,GL_FLOAT, false, 0, 0 );
glBindVertexArray(canvas->data.canvas_quad_array);
canvas->draw_generic_textured_rect(Rect2(0,0,15,15),Rect2(0,0,1,1));
#endif
if (p_swap_buffers)
OS::get_singleton()->swap_buffers();
else
glFinish();
/* print_line("objects: "+itos(storage->info.render_object_count));
print_line("material chages: "+itos(storage->info.render_material_switch_count));
print_line("surface changes: "+itos(storage->info.render_surface_switch_count));
print_line("shader changes: "+itos(storage->info.render_shader_rebind_count));
print_line("vertices: "+itos(storage->info.render_vertices_count));
*/
}
void RasterizerGLES3::finalize() {

View file

@ -2786,12 +2786,6 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c
copymem(&state.omni_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size);
state.omni_light_count++;
#if 0
if (li->light_ptr->shadow_enabled) {
li->shadow_projection[0] = Transform(camera_transform_inverse * li->transform).inverse();
lights_use_shadow=true;
}
#endif
} break;
case VS::LIGHT_SPOT: {

View file

@ -279,21 +279,6 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() {
strings.push_back("precision highp sampler2DArray;\n");
#endif
#if 0
if (cc) {
String _code_string = "#define VERTEX_SHADER_CODE "+cc->vertex+"\n";
String _code_globals = "#define VERTEX_SHADER_GLOBALS "+cc->vertex_globals+"\n";
code_string=_code_string.ascii();
code_globals=_code_globals.ascii();
DEBUG_PRINT( code_globals.get_data() );
DEBUG_PRINT( code_string.get_data() );
strings.push_back(code_globals);
strings.push_back(code_string);
}
#endif
strings.push_back(vertex_code0.get_data());
if (cc) {
@ -382,21 +367,6 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() {
strings.push_back("precision highp sampler2DArray;\n");
#endif
#if 0
if (cc) {
String _code_string = "#define FRAGMENT_SHADER_CODE "+cc->fragment+"\n";
String _code_globals = "#define FRAGMENT_SHADER_GLOBALS "+cc->fragment_globals+"\n";
code_string=_code_string.ascii();
code_globals=_code_globals.ascii();
DEBUG_PRINT( code_globals.get_data() );
DEBUG_PRINT( code_string.get_data() );
strings.push_back(code_globals);
strings.push_back(code_string);
}
#endif
strings.push_back(fragment_code0.get_data());
if (cc) {
material_string = cc->uniforms.ascii();

View file

@ -444,15 +444,7 @@ void EditorNode::_fs_changed() {
continue;
if (E->get()->get_import_path() != String()) {
//this is an imported resource, will be reloaded if reimported via the _resources_reimported() callback
//imported resource
#if 0
uint64_t mt = FileAccess::get_modified_time(E->get()->get_import_path());
if (mt != E->get()->get_import_last_modified_time()) {
changed.push_back(E->get());
}
#endif
//this is an imported resource, will be reloaded if reimported via the _resources_reimported() callback
continue;
}

View file

@ -515,127 +515,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
s->set_transform(Transform());
p_node = bv;
#if 0
} else if (_teststr(name, "room") && Object::cast_to<MeshInstance>(p_node)) {
if (isroot)
return p_node;
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
PoolVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID);
BSP_Tree bsptree(faces);
Ref<RoomBounds> area = memnew(RoomBounds);
//area->set_bounds(faces);
//area->set_geometry_hint(faces);
Room *room = memnew(Room);
room->set_name(_fixstr(name, "room"));
room->set_transform(mi->get_transform());
room->set_room(area);
p_node->replace_by(room);
memdelete(p_node);
p_node = room;
} else if (_teststr(name, "room")) {
if (isroot)
return p_node;
Spatial *dummy = Object::cast_to<Spatial>(p_node);
ERR_FAIL_COND_V(!dummy, NULL);
Room *room = memnew(Room);
room->set_name(_fixstr(name, "room"));
room->set_transform(dummy->get_transform());
p_node->replace_by(room);
memdelete(p_node);
p_node = room;
//room->compute_room_from_subtree();
} else if (_teststr(name, "portal") && Object::cast_to<MeshInstance>(p_node)) {
if (isroot)
return p_node;
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
PoolVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID);
ERR_FAIL_COND_V(faces.size() == 0, NULL);
//step 1 compute the plane
Set<Vector3> points;
Plane plane;
Vector3 center;
for (int i = 0; i < faces.size(); i++) {
Face3 f = faces.get(i);
Plane p = f.get_plane();
plane.normal += p.normal;
plane.d += p.d;
for (int i = 0; i < 3; i++) {
Vector3 v = f.vertex[i].snapped(Vector3(0.01, 0.01, 0.01));
if (!points.has(v)) {
points.insert(v);
center += v;
}
}
}
plane.normal.normalize();
plane.d /= faces.size();
center /= points.size();
//step 2, create points
Transform t;
t.basis.from_z(plane.normal);
t.basis.transpose();
t.origin = center;
Vector<Point2> portal_points;
for (Set<Vector3>::Element *E = points.front(); E; E = E->next()) {
Vector3 local = t.xform_inv(E->get());
portal_points.push_back(Point2(local.x, local.y));
}
// step 3 bubbly sort points
int swaps = 0;
do {
swaps = 0;
for (int i = 0; i < portal_points.size() - 1; i++) {
float a = portal_points[i].angle();
float b = portal_points[i + 1].angle();
if (a > b) {
SWAP(portal_points[i], portal_points[i + 1]);
swaps++;
}
}
} while (swaps);
Portal *portal = memnew(Portal);
portal->set_shape(portal_points);
portal->set_transform(mi->get_transform() * t);
p_node->replace_by(portal);
memdelete(p_node);
p_node = portal;
#endif
} else if (Object::cast_to<MeshInstance>(p_node)) {
//last attempt, maybe collision inside the mesh data

View file

@ -1529,6 +1529,8 @@ SkeletonSpatialGizmo::SkeletonSpatialGizmo(Skeleton *p_skel) {
skel = p_skel;
set_spatial_node(p_skel);
}
// FIXME: Kept as reference for reimplementation in 3.1+
#if 0
void RoomSpatialGizmo::redraw() {

View file

@ -1257,6 +1257,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
exit_ok = true;
OPCODE_BREAK;
}
// Enable for debugging
#if 0
default: {

View file

@ -731,921 +731,6 @@ void VisualScriptSwitch::_bind_methods() {
VisualScriptSwitch::VisualScriptSwitch() {
}
//////////////////////////////////////////
////////////////EVENT ACTION FILTER///////////
//////////////////////////////////////////
#if 0
int VisualScriptInputFilter::get_output_sequence_port_count() const {
return filters.size();
}
bool VisualScriptInputFilter::has_input_sequence_port() const {
return true;
}
int VisualScriptInputFilter::get_input_value_port_count() const {
return 1;
}
int VisualScriptInputFilter::get_output_value_port_count() const {
return 1;
}
String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const {
String text;
switch (filters[p_port].type) {
case Ref<InputEvent>::NONE: {
text = "None";
} break;
case Ref<InputEvent>::KEY: {
InputEventKey k = filters[p_port].key;
if (k->get_scancode() == 0 && k.unicode == 0) {
text = "No Key";
} else {
if (k->get_scancode() != 0) {
text = "KeyCode: " + keycode_get_string(k->get_scancode());
} else if (k.unicode != 0) {
text = "Uniode: " + String::chr(k.unicode);
}
if (k->is_pressed())
text += ", Pressed";
else
text += ", Released";
if (k.echo)
text += ", Echo";
if (k->get_alt())
text = "Alt+" + text;
if (k->get_shift())
text = "Shift+" + text;
if (k->get_control())
text = "Ctrl+" + text;
if (k->get_metakey())
text = "Meta+" + text;
}
} break;
case Ref<InputEvent>::MOUSE_MOTION: {
InputEventMouseMotion mm = filters[p_port].mouse_motion;
text = "Mouse Motion";
String b = "Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight";
for (int i = 0; i < 7; i++) {
if (mm->get_button_mask() & (1 << i)) {
text = b.get_slice(",", i) + "+" + text;
}
}
if (mm->get_alt())
text = "Alt+" + text;
if (mm->get_shift())
text = "Shift+" + text;
if (mm->get_control())
text = "Ctrl+" + text;
if (mm->get_metakey())
text = "Meta+" + text;
} break;
case Ref<InputEvent>::MOUSE_BUTTON: {
InputEventMouseButton mb = filters[p_port].mouse_button;
String b = "Any,Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight";
text = b.get_slice(",", mb->get_button_index()) + " Mouse Button";
if (mb->is_pressed())
text += ", Pressed";
else
text += ", Released";
if (mb.doubleclick)
text += ", DblClick";
if (mb->get_alt())
text = "Alt+" + text;
if (mb->get_shift())
text = "Shift+" + text;
if (mb->get_control())
text = "Ctrl+" + text;
if (mb->get_metakey())
text = "Meta+" + text;
} break;
case Ref<InputEvent>::JOYPAD_MOTION: {
InputEventJoypadMotion jm = filters[p_port].joy_motion;
text = "JoyMotion Axis " + itos(jm.axis >> 1);
if (jm.axis & 1)
text += " > " + rtos(jm.axis_value);
else
text += " < " + rtos(-jm.axis_value);
} break;
case Ref<InputEvent>::JOYPAD_BUTTON: {
InputEventJoypadButton jb = filters[p_port].joy_button;
text = "JoyButton " + itos(jb->get_button_index());
if (jb->is_pressed())
text += ", Pressed";
else
text += ", Released";
} break;
case Ref<InputEvent>::SCREEN_TOUCH: {
InputEventScreenTouch sd = filters[p_port].screen_touch;
text = "Touch Finger " + itos(sd.index);
if (sd->is_pressed())
text += ", Pressed";
else
text += ", Released";
} break;
case Ref<InputEvent>::SCREEN_DRAG: {
InputEventScreenDrag sd = filters[p_port].screen_drag;
text = "Drag Finger " + itos(sd.index);
} break;
case Ref<InputEvent>::ACTION: {
List<PropertyInfo> pinfo;
ProjectSettings::get_singleton()->get_property_list(&pinfo);
int index = 1;
text = "No Action";
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
const PropertyInfo &pi = E->get();
if (!pi.name.begins_with("input/"))
continue;
if (filters[p_port].action.action == index) {
text = "Action " + pi.name.substr(pi.name.find("/") + 1, pi.name.length());
break;
}
index++;
}
if (filters[p_port].action->is_pressed())
text += ", Pressed";
else
text += ", Released";
} break;
}
return text + " - " + itos(p_port);
}
PropertyInfo VisualScriptInputFilter::get_input_value_port_info(int p_idx) const {
return PropertyInfo(Variant::INPUT_EVENT, "event");
}
PropertyInfo VisualScriptInputFilter::get_output_value_port_info(int p_idx) const {
return PropertyInfo(Variant::INPUT_EVENT, "");
}
String VisualScriptInputFilter::get_caption() const {
return "InputFilter";
}
String VisualScriptInputFilter::get_text() const {
return "";
}
bool VisualScriptInputFilter::_set(const StringName &p_name, const Variant &p_value) {
if (p_name == "filter_count") {
filters.resize(p_value);
_change_notify();
ports_changed_notify();
return true;
}
if (String(p_name).begins_with("filter_")) {
int idx = String(p_name).replace_first("filters_", "").get_slice("/", 0).to_int();
ERR_FAIL_INDEX_V(idx, filters.size(), false);
String what = String(p_name).get_slice("/", 1);
if (what == "type") {
filters[idx] = Ref<InputEvent>();
filters[idx].type = Ref<InputEvent>::Type(int(p_value));
if (filters[idx].type == Ref<InputEvent>::JOYPAD_MOTION) {
filters[idx].joy_motion.axis_value = 0.5; //for threshold
} else if (filters[idx].type == Ref<InputEvent>::KEY) {
filters[idx]->is_pressed() = true; //put these as true to make it more user friendly
} else if (filters[idx].type == Ref<InputEvent>::MOUSE_BUTTON) {
filters[idx]->is_pressed() = true;
} else if (filters[idx].type == Ref<InputEvent>::JOYPAD_BUTTON) {
filters[idx].joy_button->is_pressed() = true;
} else if (filters[idx].type == Ref<InputEvent>::SCREEN_TOUCH) {
filters[idx].screen_touch->is_pressed() = true;
} else if (filters[idx].type == Ref<InputEvent>::ACTION) {
filters[idx].action->is_pressed() = true;
}
_change_notify();
ports_changed_notify();
return true;
}
if (what == "device") {
filters[idx].device = p_value;
ports_changed_notify();
return true;
}
switch (filters[idx].type) {
case Ref<InputEvent>::KEY: {
if (what == "scancode") {
String sc = p_value;
if (sc == String()) {
filters[idx]->get_scancode() = 0;
} else {
filters[idx]->get_scancode() = find_keycode(p_value);
}
} else if (what == "unicode") {
String uc = p_value;
if (uc == String()) {
filters[idx].key.unicode = 0;
} else {
filters[idx].key.unicode = uc[0];
}
} else if (what == "pressed") {
filters[idx]->is_pressed() = p_value;
} else if (what == "echo") {
filters[idx]->is_echo() = p_value;
} else if (what == "mod_alt") {
filters[idx]->get_alt() = p_value;
} else if (what == "mod_shift") {
filters[idx]->get_shift() = p_value;
} else if (what == "mod_ctrl") {
filters[idx]->get_control() = p_value;
} else if (what == "mod_meta") {
filters[idx]->get_metakey() = p_value;
} else {
return false;
}
ports_changed_notify();
return true;
} break;
case Ref<InputEvent>::MOUSE_MOTION: {
if (what == "button_mask") {
filters[idx]->get_button_mask() = p_value;
} else if (what == "mod_alt") {
filters[idx].mouse_motion->get_alt() = p_value;
} else if (what == "mod_shift") {
filters[idx].mouse_motion->get_shift() = p_value;
} else if (what == "mod_ctrl") {
filters[idx].mouse_motion->get_control() = p_value;
} else if (what == "mod_meta") {
filters[idx].mouse_motion->get_metakey() = p_value;
} else {
return false;
}
ports_changed_notify();
return true;
} break;
case Ref<InputEvent>::MOUSE_BUTTON: {
if (what == "button_index") {
filters[idx]->get_button_index() = p_value;
} else if (what == "pressed") {
filters[idx]->is_pressed() = p_value;
} else if (what == "doubleclicked") {
filters[idx].mouse_button.doubleclick = p_value;
} else if (what == "mod_alt") {
filters[idx].mouse_button->get_alt() = p_value;
} else if (what == "mod_shift") {
filters[idx].mouse_button->get_shift() = p_value;
} else if (what == "mod_ctrl") {
filters[idx].mouse_button->get_control() = p_value;
} else if (what == "mod_meta") {
filters[idx].mouse_button->get_metakey() = p_value;
} else {
return false;
}
ports_changed_notify();
return true;
} break;
case Ref<InputEvent>::JOYPAD_MOTION: {
if (what == "axis") {
filters[idx].joy_motion.axis = int(p_value) << 1 | filters[idx].joy_motion.axis;
} else if (what == "mode") {
filters[idx].joy_motion.axis |= int(p_value);
} else if (what == "threshold") {
filters[idx].joy_motion.axis_value = p_value;
} else {
return false;
}
ports_changed_notify();
return true;
} break;
case Ref<InputEvent>::JOYPAD_BUTTON: {
if (what == "button_index") {
filters[idx].joy_button->get_button_index() = p_value;
} else if (what == "pressed") {
filters[idx].joy_button->is_pressed() = p_value;
} else {
return false;
}
ports_changed_notify();
return true;
} break;
case Ref<InputEvent>::SCREEN_TOUCH: {
if (what == "finger_index") {
filters[idx].screen_touch.index = p_value;
} else if (what == "pressed") {
filters[idx].screen_touch->is_pressed() = p_value;
} else {
return false;
}
ports_changed_notify();
return true;
} break;
case Ref<InputEvent>::SCREEN_DRAG: {
if (what == "finger_index") {
filters[idx].screen_drag.index = p_value;
} else {
return false;
}
ports_changed_notify();
return true;
} break;
case Ref<InputEvent>::ACTION: {
if (what == "action_name") {
List<PropertyInfo> pinfo;
ProjectSettings::get_singleton()->get_property_list(&pinfo);
int index = 1;
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
const PropertyInfo &pi = E->get();
if (!pi.name.begins_with("input/"))
continue;
String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
if (name == String(p_value)) {
filters[idx].action.action = index;
ports_changed_notify();
return true;
}
index++;
}
filters[idx].action.action = 0;
ports_changed_notify();
return false;
} else if (what == "pressed") {
filters[idx].action->is_pressed() = p_value;
ports_changed_notify();
return true;
}
} break;
}
}
return false;
}
bool VisualScriptInputFilter::_get(const StringName &p_name, Variant &r_ret) const {
if (p_name == "filter_count") {
r_ret = filters.size();
return true;
}
if (String(p_name).begins_with("filter_")) {
int idx = String(p_name).replace_first("filters_", "").get_slice("/", 0).to_int();
ERR_FAIL_INDEX_V(idx, filters.size(), false);
String what = String(p_name).get_slice("/", 1);
if (what == "type") {
r_ret = filters[idx].type;
return true;
}
if (what == "device") {
r_ret = filters[idx].device;
return true;
}
switch (filters[idx].type) {
case Ref<InputEvent>::KEY: {
if (what == "scancode") {
if (filters[idx]->get_scancode() == 0)
r_ret = String();
else {
r_ret = keycode_get_string(filters[idx]->get_scancode());
}
} else if (what == "unicode") {
if (filters[idx].key.unicode == 0) {
r_ret = String();
} else {
CharType str[2] = { (CharType)filters[idx].key.unicode, 0 };
r_ret = String(str);
}
} else if (what == "pressed") {
r_ret = filters[idx]->is_pressed();
} else if (what == "echo") {
r_ret = filters[idx]->is_echo();
} else if (what == "mod_alt") {
r_ret = filters[idx]->get_alt();
} else if (what == "mod_shift") {
r_ret = filters[idx]->get_shift();
} else if (what == "mod_ctrl") {
r_ret = filters[idx]->get_control();
} else if (what == "mod_meta") {
r_ret = filters[idx]->get_metakey();
} else {
return false;
}
return true;
} break;
case Ref<InputEvent>::MOUSE_MOTION: {
if (what == "button_mask") {
r_ret = filters[idx]->get_button_mask();
} else if (what == "mod_alt") {
r_ret = filters[idx].mouse_motion->get_alt();
} else if (what == "mod_shift") {
r_ret = filters[idx].mouse_motion->get_shift();
} else if (what == "mod_ctrl") {
r_ret = filters[idx].mouse_motion->get_control();
} else if (what == "mod_meta") {
r_ret = filters[idx].mouse_motion->get_metakey();
} else {
return false;
}
return true;
} break;
case Ref<InputEvent>::MOUSE_BUTTON: {
if (what == "button_index") {
r_ret = filters[idx]->get_button_index();
} else if (what == "pressed") {
r_ret = filters[idx]->is_pressed();
} else if (what == "doubleclicked") {
r_ret = filters[idx].mouse_button.doubleclick;
} else if (what == "mod_alt") {
r_ret = filters[idx].mouse_button->get_alt();
} else if (what == "mod_shift") {
r_ret = filters[idx].mouse_button->get_shift();
} else if (what == "mod_ctrl") {
r_ret = filters[idx].mouse_button->get_control();
} else if (what == "mod_meta") {
r_ret = filters[idx].mouse_button->get_metakey();
} else {
return false;
}
return true;
} break;
case Ref<InputEvent>::JOYPAD_MOTION: {
if (what == "axis_index") {
r_ret = filters[idx].joy_motion.axis >> 1;
} else if (what == "mode") {
r_ret = filters[idx].joy_motion.axis & 1;
} else if (what == "threshold") {
r_ret = filters[idx].joy_motion.axis_value;
} else {
return false;
}
return true;
} break;
case Ref<InputEvent>::JOYPAD_BUTTON: {
if (what == "button_index") {
r_ret = filters[idx].joy_button->get_button_index();
} else if (what == "pressed") {
r_ret = filters[idx].joy_button->is_pressed();
} else {
return false;
}
return true;
} break;
case Ref<InputEvent>::SCREEN_TOUCH: {
if (what == "finger_index") {
r_ret = filters[idx].screen_touch.index;
} else if (what == "pressed") {
r_ret = filters[idx].screen_touch->is_pressed();
} else {
return false;
}
return true;
} break;
case Ref<InputEvent>::SCREEN_DRAG: {
if (what == "finger_index") {
r_ret = filters[idx].screen_drag.index;
} else {
return false;
}
return true;
} break;
case Ref<InputEvent>::ACTION: {
if (what == "action_name") {
List<PropertyInfo> pinfo;
ProjectSettings::get_singleton()->get_property_list(&pinfo);
int index = 1;
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
const PropertyInfo &pi = E->get();
if (!pi.name.begins_with("input/"))
continue;
if (filters[idx].action.action == index) {
r_ret = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
return true;
}
index++;
}
r_ret = "None"; //no index
return false;
} else if (what == "pressed") {
r_ret = filters[idx].action->is_pressed();
return true;
}
} break;
}
}
return false;
}
static const char *event_type_names[Ref<InputEvent>::TYPE_MAX] = {
"None",
"Key",
"MouseMotion",
"MouseButton",
"JoypadMotion",
"JoypadButton",
"ScreenTouch",
"ScreenDrag",
"Action"
};
void VisualScriptInputFilter::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::INT, "filter_count", PROPERTY_HINT_RANGE, "0,64"));
String et;
for (int i = 0; i < Ref<InputEvent>::TYPE_MAX; i++) {
if (i > 0)
et += ",";
et += event_type_names[i];
}
String kc;
String actions;
for (int i = 0; i < filters.size(); i++) {
String base = "filter_" + itos(i) + "/";
p_list->push_back(PropertyInfo(Variant::INT, base + "type", PROPERTY_HINT_ENUM, et));
p_list->push_back(PropertyInfo(Variant::INT, base + "device"));
switch (filters[i].type) {
case Ref<InputEvent>::NONE: {
} break;
case Ref<InputEvent>::KEY: {
if (kc == String()) {
int kcc = keycode_get_count();
kc = "None";
for (int i = 0; i < kcc; i++) {
kc += ",";
kc += String(keycode_get_name_by_index(i));
}
}
p_list->push_back(PropertyInfo(Variant::STRING, base + "scancode", PROPERTY_HINT_ENUM, kc));
p_list->push_back(PropertyInfo(Variant::STRING, base + "unicode"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "echo"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_alt"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_shift"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_ctrl"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_meta"));
} break;
case Ref<InputEvent>::MOUSE_MOTION: {
p_list->push_back(PropertyInfo(Variant::INT, base + "button_mask", PROPERTY_HINT_FLAGS, "Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_alt"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_shift"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_ctrl"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_meta"));
} break;
case Ref<InputEvent>::MOUSE_BUTTON: {
p_list->push_back(PropertyInfo(Variant::INT, base + "button_index", PROPERTY_HINT_ENUM, "Any,Left,Right,Middle,WheelUp,WheelDown,WheelLeft,WheelRight"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "doubleclicked"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_alt"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_shift"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_ctrl"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "mod_meta"));
} break;
case Ref<InputEvent>::JOYPAD_MOTION: {
p_list->push_back(PropertyInfo(Variant::INT, base + "axis_index"));
p_list->push_back(PropertyInfo(Variant::INT, base + "mode", PROPERTY_HINT_ENUM, "Min,Max"));
p_list->push_back(PropertyInfo(Variant::REAL, base + "threshold", PROPERTY_HINT_RANGE, "0,1,0.01"));
} break;
case Ref<InputEvent>::JOYPAD_BUTTON: {
p_list->push_back(PropertyInfo(Variant::INT, base + "button_index"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed"));
} break;
case Ref<InputEvent>::SCREEN_TOUCH: {
p_list->push_back(PropertyInfo(Variant::INT, base + "finger_index"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed"));
} break;
case Ref<InputEvent>::SCREEN_DRAG: {
p_list->push_back(PropertyInfo(Variant::INT, base + "finger_index"));
} break;
case Ref<InputEvent>::ACTION: {
if (actions == String()) {
actions = "None";
List<PropertyInfo> pinfo;
ProjectSettings::get_singleton()->get_property_list(&pinfo);
Vector<String> al;
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
const PropertyInfo &pi = E->get();
if (!pi.name.begins_with("input/"))
continue;
String name = pi.name.substr(pi.name.find("/") + 1, pi.name.length());
al.push_back(name);
}
for (int i = 0; i < al.size(); i++) {
actions += ",";
actions += al[i];
}
}
p_list->push_back(PropertyInfo(Variant::STRING, base + "action_name", PROPERTY_HINT_ENUM, actions));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "pressed"));
} break;
}
}
}
class VisualScriptNodeInstanceInputFilter : public VisualScriptNodeInstance {
public:
VisualScriptInstance *instance;
Vector<Ref<InputEvent>> filters;
//virtual int get_working_memory_size() const { return 0; }
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
//virtual bool get_output_port_unsequenced(int p_idx,Variant* r_value,Variant* p_working_mem,String &r_error) const { return false; }
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
if (p_inputs[0]->get_type() != Variant::INPUT_EVENT) {
r_error_str = "Input value not of type event";
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
return 0;
}
Ref<InputEvent> event = *p_inputs[0];
for (int i = 0; i < filters.size(); i++) {
const Ref<InputEvent> &ie = filters[i];
if (ie.type != event.type)
continue;
bool match = false;
switch (ie.type) {
case Ref<InputEvent>::NONE: {
match = true;
} break;
case Ref<InputEvent>::KEY: {
InputEventKey k = ie.key;
InputEventKey k2 = event.key;
if (k->get_scancode() == 0 && k.unicode == 0 && k2->get_scancode() == 0 && k2.unicode == 0) {
match = true;
} else {
if ((k->get_scancode() != 0 && k->get_scancode() == k2->get_scancode()) || (k.unicode != 0 && k.unicode == k2.unicode)) {
//key valid
if (
k->is_pressed() == k2->is_pressed() &&
k.echo == k2.echo &&
k.mod == k2.mod) {
match = true;
}
}
}
} break;
case Ref<InputEvent>::MOUSE_MOTION: {
InputEventMouseMotion mm = ie.mouse_motion;
InputEventMouseMotion mm2 = event.mouse_motion;
if (mm->get_button_mask() == mm2->get_button_mask() &&
mm.mod == mm2.mod) {
match = true;
}
} break;
case Ref<InputEvent>::MOUSE_BUTTON: {
InputEventMouseButton mb = ie.mouse_button;
InputEventMouseButton mb2 = event.mouse_button;
if (mb->get_button_index() == mb2->get_button_index() &&
mb->is_pressed() == mb2->is_pressed() &&
mb.doubleclick == mb2.doubleclick &&
mb.mod == mb2.mod) {
match = true;
}
} break;
case Ref<InputEvent>::JOYPAD_MOTION: {
InputEventJoypadMotion jm = ie.joy_motion;
InputEventJoypadMotion jm2 = event.joy_motion;
int axis = jm.axis >> 1;
if (axis == jm2.axis) {
if (jm.axis & 1) {
//greater
if (jm2.axis_value > jm.axis_value) {
match = true;
}
} else {
//less
if (jm2.axis_value < -jm.axis_value) {
match = true;
}
}
}
} break;
case Ref<InputEvent>::JOYPAD_BUTTON: {
InputEventJoypadButton jb = ie.joy_button;
InputEventJoypadButton jb2 = event.joy_button;
if (jb->get_button_index() == jb2->get_button_index() &&
jb->is_pressed() == jb2->is_pressed()) {
match = true;
}
} break;
case Ref<InputEvent>::SCREEN_TOUCH: {
InputEventScreenTouch st = ie.screen_touch;
InputEventScreenTouch st2 = event.screen_touch;
if (st.index == st2.index &&
st->is_pressed() == st2->is_pressed()) {
match = true;
}
} break;
case Ref<InputEvent>::SCREEN_DRAG: {
InputEventScreenDrag sd = ie.screen_drag;
InputEventScreenDrag sd2 = event.screen_drag;
if (sd.index == sd2.index) {
match = true;
}
} break;
case Ref<InputEvent>::ACTION: {
InputEventAction ia = ie.action;
InputEventAction ia2 = event.action;
if (ia.action == ia2.action &&
ia->is_pressed() == ia2->is_pressed()) {
match = true;
}
} break;
}
*p_outputs[0] = event;
if (match)
return i; //go through match output
}
return STEP_NO_ADVANCE_BIT; //none found, don't advance
}
};
VisualScriptNodeInstance *VisualScriptInputFilter::instance(VisualScriptInstance *p_instance) {
VisualScriptNodeInstanceInputFilter *instance = memnew(VisualScriptNodeInstanceInputFilter);
instance->instance = p_instance;
instance->filters = filters;
return instance;
}
VisualScriptInputFilter::VisualScriptInputFilter() {
}
#endif
//////////////////////////////////////////
////////////////TYPE CAST///////////
//////////////////////////////////////////

View file

@ -228,40 +228,6 @@ public:
VisualScriptSwitch();
};
#if 0
class VisualScriptInputFilter : public VisualScriptNode {
GDCLASS(VisualScriptInputFilter, VisualScriptNode)
Vector<Ref<InputEvent>> filters;
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
public:
virtual int get_output_sequence_port_count() const;
virtual bool has_input_sequence_port() const;
virtual String get_output_sequence_port_text(int p_port) const;
virtual int get_input_value_port_count() const;
virtual int get_output_value_port_count() const;
virtual PropertyInfo get_input_value_port_info(int p_idx) const;
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
virtual String get_text() const;
virtual String get_category() const { return "flow_control"; }
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
VisualScriptInputFilter();
};
#endif
class VisualScriptTypeCast : public VisualScriptNode {
GDCLASS(VisualScriptTypeCast, VisualScriptNode)

View file

@ -936,13 +936,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo
}
__android_log_print(ANDROID_LOG_INFO, "godot", "CMDLINE LEN %i - APK EXPANSION %i\n", cmdlen, int(use_apk_expansion));
#if 0
char *args[]={"-test","render",NULL};
__android_log_print(ANDROID_LOG_INFO,"godot","pre asdasd setup...");
Error err = Main::setup("apk",2,args,false);
#else
Error err = Main::setup("apk", cmdlen, (char **)cmdline, false);
#endif
if (cmdline) {
free(cmdline);
}

View file

@ -39,7 +39,8 @@
If a portal is placed next (very close to) a similar, opposing portal, they automatically connect,
otherwise, a portal connects to the parent room
*/
//this will be redone and replaced by area portals, left for reference since a new class with this name will have to exist and want to reuse the gizmos
// FIXME: This will be redone and replaced by area portals, left for reference
// since a new class with this name will have to exist and want to reuse the gizmos
#if 0
class Portal : public VisualInstance {

View file

@ -44,7 +44,7 @@
*/
//this will be removed, left for reference
// FIXME: this will be removed, left for reference
#if 0
class Room : public VisualInstance {

View file

@ -897,17 +897,7 @@ void VoxelLightBaker::plot_light_omni(const Vector3 &p_pos, const Color &p_color
float dt = CLAMP((d + distance_adv) / local_radius, 0, 1);
att *= powf(1.0 - dt, p_attenutation);
}
#if 0
if (light_cache.type == VS::LIGHT_SPOT) {
float angle = Math::rad2deg(acos(light_axis.dot(spot_axis)));
if (angle > light_cache.spot_angle)
continue;
float d = CLAMP(angle / light_cache.spot_angle, 1, 0);
att *= powf(1.0 - d, light_cache.spot_attenuation);
}
#endif
clip_planes = 0;
for (int c = 0; c < 3; c++) {
@ -1041,17 +1031,7 @@ void VoxelLightBaker::plot_light_spot(const Vector3 &p_pos, const Vector3 &p_axi
float dt = CLAMP((d + distance_adv) / local_radius, 0, 1);
att *= powf(1.0 - dt, p_attenutation);
}
#if 0
if (light_cache.type == VS::LIGHT_SPOT) {
float angle = Math::rad2deg(acos(light_axis.dot(spot_axis)));
if (angle > light_cache.spot_angle)
continue;
float d = CLAMP(angle / light_cache.spot_angle, 1, 0);
att *= powf(1.0 - d, light_cache.spot_attenuation);
}
#endif
clip_planes = 0;
for (int c = 0; c < 3; c++) {
@ -2016,6 +1996,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
}
}
// Enable for debugging
#if 0
{
PoolVector<uint8_t> img;

View file

@ -36,7 +36,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
//left for reference but will be removed when portals are reimplemented using Area
// FIXME: left for reference but will be removed when portals are reimplemented using Area
#if 0
class RoomBounds : public Resource {

View file

@ -1897,62 +1897,6 @@ bool ShaderLanguage::_validate_function_call(BlockNode *p_block, OperatorNode *p
return false;
}
#if 0
if (found_builtin) {
if (p_func->op==OP_CONSTRUCT && all_const) {
Vector<float> cdata;
for(int i=0;i<argcount;i++) {
Variant v = static_cast<ConstantNode*>(p_func->arguments[i+1])->value;
switch(v.get_type()) {
case Variant::REAL: cdata.push_back(v); break;
case Variant::INT: cdata.push_back(v); break;
case Variant::VECTOR2: { Vector2 v2=v; cdata.push_back(v2.x); cdata.push_back(v2.y); } break;
case Variant::VECTOR3: { Vector3 v3=v; cdata.push_back(v3.x); cdata.push_back(v3.y); cdata.push_back(v3.z);} break;
case Variant::PLANE: { Plane v4=v; cdata.push_back(v4.normal.x); cdata.push_back(v4.normal.y); cdata.push_back(v4.normal.z); cdata.push_back(v4.d); } break;
default: ERR_FAIL_V(NULL);
}
}
ConstantNode *cn = parser.create_node<ConstantNode>(p_func->parent);
Variant data;
switch(p_func->return_cache) {
case TYPE_FLOAT: data = cdata[0]; break;
case TYPE_VEC2:
if (cdata.size()==1)
data = Vector2(cdata[0],cdata[0]);
else
data = Vector2(cdata[0],cdata[1]);
break;
case TYPE_VEC3:
if (cdata.size()==1)
data = Vector3(cdata[0],cdata[0],cdata[0]);
else
data = Vector3(cdata[0],cdata[1],cdata[2]);
break;
case TYPE_VEC4:
if (cdata.size()==1)
data = Plane(cdata[0],cdata[0],cdata[0],cdata[0]);
else
data = Plane(cdata[0],cdata[1],cdata[2],cdata[3]);
break;
}
cn->datatype=p_func->return_cache;
cn->value=data;
return cn;
}
return p_func;
}
#endif
// try existing functions..
StringName exclude_function;

View file

@ -499,7 +499,6 @@ void VisualServerCanvas::canvas_item_add_multiline(RID p_item, const Vector<Poin
pline->antialiased = false; //todo
pline->multiline = true;
// if (p_width <= 1) {
pline->lines = p_points;
pline->line_colors = p_colors;
if (pline->line_colors.size() == 0) {
@ -507,66 +506,7 @@ void VisualServerCanvas::canvas_item_add_multiline(RID p_item, const Vector<Poin
} else if (pline->line_colors.size() > 1 && pline->line_colors.size() != pline->lines.size()) {
pline->line_colors.resize(1);
}
#if 0
//width not yet
} else {
//make a trianglestrip for drawing the line...
Vector2 prev_t;
pline->triangles.resize(p_points.size() * 2);
if (p_antialiased) {
pline->lines.resize(p_points.size() * 2);
}
if (p_colors.size() == 0) {
pline->triangle_colors.push_back(Color(1, 1, 1, 1));
if (p_antialiased) {
pline->line_colors.push_back(Color(1, 1, 1, 1));
}
}
if (p_colors.size() == 1) {
pline->triangle_colors = p_colors;
pline->line_colors = p_colors;
} else {
pline->triangle_colors.resize(pline->triangles.size());
pline->line_colors.resize(pline->lines.size());
}
for (int i = 0; i < p_points.size(); i++) {
Vector2 t;
if (i == p_points.size() - 1) {
t = prev_t;
} else {
t = (p_points[i + 1] - p_points[i]).normalized().tangent();
if (i == 0) {
prev_t = t;
}
}
Vector2 tangent = ((t + prev_t).normalized()) * p_width * 0.5;
if (p_antialiased) {
pline->lines[i] = p_points[i] + tangent;
pline->lines[p_points.size() * 2 - i - 1] = p_points[i] - tangent;
if (pline->line_colors.size() > 1) {
pline->line_colors[i] = p_colors[i];
pline->line_colors[p_points.size() * 2 - i - 1] = p_colors[i];
}
}
pline->triangles[i * 2 + 0] = p_points[i] + tangent;
pline->triangles[i * 2 + 1] = p_points[i] - tangent;
if (pline->triangle_colors.size() > 1) {
pline->triangle_colors[i * 2 + 0] = p_colors[i];
pline->triangle_colors[i * 2 + 1] = p_colors[i];
}
prev_t = t;
}
}
#endif
canvas_item->rect_dirty = true;
canvas_item->commands.push_back(pline);
}

View file

@ -69,34 +69,6 @@ public:
Portal() { enabled=true; disable_distance=50; disable_color=Color(); connect_range=0.8; }
};
struct BakedLight {
Rasterizer::BakedLightData data;
PoolVector<int> sampler;
AABB octree_aabb;
Size2i octree_tex_size;
Size2i light_tex_size;
};
struct BakedLightSampler {
float params[BAKED_LIGHT_SAMPLER_MAX];
int resolution;
Vector<Vector3> dp_cache;
BakedLightSampler() {
params[BAKED_LIGHT_SAMPLER_STRENGTH]=1.0;
params[BAKED_LIGHT_SAMPLER_ATTENUATION]=1.0;
params[BAKED_LIGHT_SAMPLER_RADIUS]=1.0;
params[BAKED_LIGHT_SAMPLER_DETAIL_RATIO]=0.1;
resolution=16;
}
};
void _update_baked_light_sampler_dp_cache(BakedLightSampler * blsamp);
#endif
/* CAMERA API */