Merge pull request #35413 from akien-mga/if-0-means-couperet

Remove unused #if 0'ed code
This commit is contained in:
Rémi Verschelde 2020-01-21 22:27:50 +01:00 committed by GitHub
commit 5127afa812
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 38 additions and 1416 deletions

View file

@ -557,15 +557,16 @@ bool RasterizerSceneGLES2::reflection_probe_instance_begin_render(RID p_instance
glGenTextures(1, &rpi->cubemap);
glBindTexture(GL_TEXTURE_CUBE_MAP, rpi->cubemap);
#if 1
//Mobile hardware (PowerVR specially) prefers this approach, the other one kills the game
// Mobile hardware (PowerVR specially) prefers this approach,
// the previous approach with manual lod levels kills the game.
for (int i = 0; i < 6; i++) {
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internal_format, size, size, 0, format, type, NULL);
}
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
//Generate framebuffers for rendering
// Generate framebuffers for rendering
for (int i = 0; i < 6; i++) {
glBindFramebuffer(GL_FRAMEBUFFER, rpi->fbo[i]);
glBindTexture(GL_TEXTURE_2D, rpi->color[i]);
@ -576,34 +577,6 @@ bool RasterizerSceneGLES2::reflection_probe_instance_begin_render(RID p_instance
ERR_CONTINUE(status != GL_FRAMEBUFFER_COMPLETE);
}
#else
int lod = 0;
//the approach below is fatal for powervr
// Set the initial (empty) mipmaps, all need to be set for this to work in GLES2, even if they won't be used later.
while (size >= 1) {
for (int i = 0; i < 6; i++) {
glTexImage2D(_cube_side_enum[i], lod, internal_format, size, size, 0, format, type, NULL);
if (size == rpi->current_resolution) {
//adjust framebuffer
glBindFramebuffer(GL_FRAMEBUFFER, rpi->fbo[i]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _cube_side_enum[i], rpi->cubemap, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rpi->depth);
#ifdef DEBUG_ENABLED
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
ERR_CONTINUE(status != GL_FRAMEBUFFER_COMPLETE);
#endif
}
}
lod++;
size >>= 1;
}
#endif
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

View file

@ -1206,32 +1206,21 @@ void RasterizerStorageGLES2::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
GLenum type = GL_UNSIGNED_BYTE;
// Set the initial (empty) mipmaps
#if 1
//Mobile hardware (PowerVR specially) prefers this approach, the other one kills the game
// Mobile hardware (PowerVR specially) prefers this approach,
// the previous approach with manual lod levels kills the game.
for (int i = 0; i < 6; i++) {
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internal_format, size, size, 0, format, type, NULL);
}
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
//no filters for now
// No filters for now
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
#else
while (size >= 1) {
for (int i = 0; i < 6; i++) {
glTexImage2D(_cube_side_enum[i], lod, internal_format, size, size, 0, format, type, NULL);
}
lod++;
size >>= 1;
}
#endif
//framebuffer
// Framebuffer
glBindFramebuffer(GL_FRAMEBUFFER, resources.mipmap_blur_fbo);

View file

@ -339,8 +339,6 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target, const Re
RasterizerStorageGLES3::RenderTarget *rt = storage->render_target_owner.getornull(p_render_target);
ERR_FAIL_COND(!rt);
#if 1
Size2 win_size = OS::get_singleton()->get_window_size();
if (rt->external.fbo != 0) {
glBindFramebuffer(GL_READ_FRAMEBUFFER, rt->external.fbo);
@ -350,21 +348,6 @@ void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target, const Re
glReadBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
glBlitFramebuffer(0, 0, rt->width, rt->height, p_screen_rect.position.x, win_size.height - p_screen_rect.position.y - p_screen_rect.size.height, p_screen_rect.position.x + p_screen_rect.size.width, win_size.height - p_screen_rect.position.y, GL_COLOR_BUFFER_BIT, GL_NEAREST);
#else
canvas->canvas_begin();
glDisable(GL_BLEND);
glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, rt->color);
//glBindTexture(GL_TEXTURE_2D, rt->effects.mip_maps[0].color);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, storage->resources.normal_tex);
canvas->draw_generic_textured_rect(p_screen_rect, Rect2(0, 0, 1, -1));
glBindTexture(GL_TEXTURE_2D, 0);
canvas->canvas_end();
#endif
}
void RasterizerGLES3::output_lens_distorted_to_screen(RID p_render_target, const Rect2 &p_screen_rect, float p_k1, float p_k2, const Vector2 &p_eye_center, float p_oversample) {

View file

@ -1146,47 +1146,6 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_m
state.current_depth_draw = p_material->shader->spatial.depth_draw_mode;
}
#if 0
//blend mode
if (state.current_blend_mode!=p_material->shader->spatial.blend_mode) {
switch(p_material->shader->spatial.blend_mode) {
case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX: {
glBlendEquation(GL_FUNC_ADD);
if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
} else {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
} break;
case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_ADD: {
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(p_alpha_pass?GL_SRC_ALPHA:GL_ONE,GL_ONE);
} break;
case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_SUB: {
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
} break;
case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MUL: {
glBlendEquation(GL_FUNC_ADD);
if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
} else {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
} break;
}
state.current_blend_mode=p_material->shader->spatial.blend_mode;
}
#endif
//material parameters
state.scene_shader.set_custom_shader(p_material->shader->custom_code_id);
@ -3007,16 +2966,6 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c
li->light_index = state.spot_light_count;
copymem(&state.spot_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size);
state.spot_light_count++;
#if 0
if (li->light_ptr->shadow_enabled) {
CameraMatrix bias;
bias.set_light_bias();
Transform modelview=Transform(camera_transform_inverse * li->transform).inverse();
li->shadow_projection[0] = bias * li->projection * modelview;
lights_use_shadow=true;
}
#endif
} break;
}

View file

@ -400,7 +400,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
for (int i = 0; i < max_uniforms; i++) {
r_gen_code.uniforms += uniform_defines[i];
}
#if 1
// add up
int offset = 0;
for (int i = 0; i < uniform_sizes.size(); i++) {
@ -420,45 +420,6 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
if (r_gen_code.uniform_total_size % 16 != 0) { //UBO sizes must be multiples of 16
r_gen_code.uniform_total_size += r_gen_code.uniform_total_size % 16;
}
#else
// add up
for (int i = 0; i < uniform_sizes.size(); i++) {
if (i > 0) {
int align = uniform_sizes[i - 1] % uniform_alignments[i];
if (align != 0) {
uniform_sizes[i - 1] += uniform_alignments[i] - align;
}
uniform_sizes[i] = uniform_sizes[i] + uniform_sizes[i - 1];
}
}
//offset
r_gen_code.uniform_offsets.resize(uniform_sizes.size());
for (int i = 0; i < uniform_sizes.size(); i++) {
if (i > 0)
r_gen_code.uniform_offsets[i] = uniform_sizes[i - 1];
else
r_gen_code.uniform_offsets[i] = 0;
}
/*
for(Map<StringName,SL::ShaderNode::Uniform>::Element *E=pnode->uniforms.front();E;E=E->next()) {
if (SL::is_sampler_type(E->get().type)) {
continue;
}
}
*/
if (uniform_sizes.size()) {
r_gen_code.uniform_total_size = uniform_sizes[uniform_sizes.size() - 1];
} else {
r_gen_code.uniform_total_size = 0;
}
#endif
for (Map<StringName, SL::ShaderNode::Varying>::Element *E = pnode->varyings.front(); E; E = E->next()) {

View file

@ -1224,35 +1224,6 @@ in highp float dp_clip;
#endif
#if 0
// need to save texture depth for this
vec3 light_transmittance(float translucency,vec3 light_vec, vec3 normal, vec3 pos, float distance) {
float scale = 8.25 * (1.0 - translucency) / subsurface_scatter_width;
float d = scale * distance;
/**
* Armed with the thickness, we can now calculate the color by means of the
* precalculated transmittance profile.
* (It can be precomputed into a texture, for maximum performance):
*/
float dd = -d * d;
vec3 profile =
vec3(0.233, 0.455, 0.649) * exp(dd / 0.0064) +
vec3(0.1, 0.336, 0.344) * exp(dd / 0.0484) +
vec3(0.118, 0.198, 0.0) * exp(dd / 0.187) +
vec3(0.113, 0.007, 0.007) * exp(dd / 0.567) +
vec3(0.358, 0.004, 0.0) * exp(dd / 1.99) +
vec3(0.078, 0.0, 0.0) * exp(dd / 7.41);
/**
* Using the profile, we finally approximate the transmitted lighting from
* the back of the object:
*/
return profile * clamp(0.3 + dot(light_vec, normal),0.0,1.0);
}
#endif
void light_process_omni(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float specular, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light, inout float alpha) {
vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz - vertex;

View file

@ -491,26 +491,6 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
}
draw_rect(Rect2(bs_from, bs_to - bs_from), bs);
}
#if 0
// KEYFAMES //
{
float scale = timeline->get_zoom_scale();
int limit_end = get_size().width - timeline->get_buttons_width();
for (int i = 0; i < animation->track_get_key_count(track); i++) {
float offset = animation->track_get_key_time(track, i) - timeline->get_value();
if (editor->is_key_selected(track, i) && editor->is_moving_selection()) {
offset += editor->get_moving_selection_offset();
}
offset = offset * scale + limit;
draw_key(i, scale, int(offset), editor->is_key_selected(track, i), limit, limit_end);
}
}
#endif
}
}

View file

@ -4838,25 +4838,6 @@ struct _AnimMoveRestore {
void AnimationTrackEditor::_clear_key_edit() {
if (key_edit) {
#if 0
// going back seems like the most comfortable thing to do, but it results
// in weird behaviors and crashes, because going back to animation editor
// triggers the editor setting up again itself
bool go_back = false;
if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == key_edit) {
EditorNode::get_singleton()->push_item(NULL);
go_back = true;
}
memdelete(key_edit);
key_edit = NULL;
if (go_back) {
EditorNode::get_singleton()->get_inspector_dock()->go_back();
}
#else
//if key edit is the object being inspected, remove it first
if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == key_edit ||
EditorNode::get_singleton()->get_inspector()->get_edited_object() == multi_key_edit) {
@ -4871,7 +4852,6 @@ void AnimationTrackEditor::_clear_key_edit() {
memdelete(multi_key_edit);
multi_key_edit = NULL;
}
#endif
}
}

View file

@ -32,18 +32,15 @@
#include "core/io/resource_saver.h"
#include "editor/editor_node.h"
#include "scene/resources/packed_scene.h"
#include "scene/3d/collision_shape.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/navigation.h"
#include "scene/3d/physics_body.h"
#include "scene/3d/portal.h"
#include "scene/3d/room_instance.h"
#include "scene/3d/vehicle_body.h"
#include "scene/animation/animation_player.h"
#include "scene/resources/animation.h"
#include "scene/resources/box_shape.h"
#include "scene/resources/packed_scene.h"
#include "scene/resources/plane_shape.h"
#include "scene/resources/ray_shape.h"
#include "scene/resources/resource_format_text.h"

View file

@ -474,69 +474,6 @@ void SpriteEditor::_add_as_sibling_or_child(Node *p_own_node, Node *p_new_node)
p_new_node->set_owner(this->get_tree()->get_edited_scene_root());
}
#if 0
void SpriteEditor::_create_uv_lines() {
Ref<Mesh> sprite = node->get_sprite();
ERR_FAIL_COND(!sprite.is_valid());
Set<SpriteEditorEdgeSort> edges;
uv_lines.clear();
for (int i = 0; i < sprite->get_surface_count(); i++) {
if (sprite->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES)
continue;
Array a = sprite->surface_get_arrays(i);
PoolVector<Vector2> uv = a[p_layer == 0 ? Mesh::ARRAY_TEX_UV : Mesh::ARRAY_TEX_UV2];
if (uv.size() == 0) {
err_dialog->set_text(TTR("Model has no UV in this layer"));
err_dialog->popup_centered_minsize();
return;
}
PoolVector<Vector2>::Read r = uv.read();
PoolVector<int> indices = a[Mesh::ARRAY_INDEX];
PoolVector<int>::Read ri;
int ic;
bool use_indices;
if (indices.size()) {
ic = indices.size();
ri = indices.read();
use_indices = true;
} else {
ic = uv.size();
use_indices = false;
}
for (int j = 0; j < ic; j += 3) {
for (int k = 0; k < 3; k++) {
SpriteEditorEdgeSort edge;
if (use_indices) {
edge.a = r[ri[j + k]];
edge.b = r[ri[j + ((k + 1) % 3)]];
} else {
edge.a = r[j + k];
edge.b = r[j + ((k + 1) % 3)];
}
if (edges.has(edge))
continue;
uv_lines.push_back(edge.a);
uv_lines.push_back(edge.b);
edges.insert(edge);
}
}
}
debug_uv_dialog->popup_centered_minsize();
}
#endif
void SpriteEditor::_debug_uv_draw() {
Ref<Texture> tex = node->get_texture();

View file

@ -44,11 +44,9 @@
#include "scene/3d/navigation_mesh.h"
#include "scene/3d/particles.h"
#include "scene/3d/physics_joint.h"
#include "scene/3d/portal.h"
#include "scene/3d/position_3d.h"
#include "scene/3d/ray_cast.h"
#include "scene/3d/reflection_probe.h"
#include "scene/3d/room_instance.h"
#include "scene/3d/soft_body.h"
#include "scene/3d/spring_arm.h"
#include "scene/3d/sprite_3d.h"
@ -1951,112 +1949,6 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_lines(points, material);
}
// FIXME: Kept as reference for reimplementation in 3.1+
#if 0
void RoomSpatialGizmo::redraw() {
clear();
Ref<RoomBounds> roomie = room->get_room();
if (roomie.is_null())
return;
PoolVector<Face3> faces = roomie->get_geometry_hint();
Vector<Vector3> lines;
int fc = faces.size();
PoolVector<Face3>::Read r = faces.read();
Map<_EdgeKey, Vector3> edge_map;
for (int i = 0; i < fc; i++) {
Vector3 fn = r[i].get_plane().normal;
for (int j = 0; j < 3; j++) {
_EdgeKey ek;
ek.from = r[i].vertex[j].snapped(Vector3(CMP_EPSILON, CMP_EPSILON, CMP_EPSILON));
ek.to = r[i].vertex[(j + 1) % 3].snapped(Vector3(CMP_EPSILON, CMP_EPSILON, CMP_EPSILON));
if (ek.from < ek.to)
SWAP(ek.from, ek.to);
Map<_EdgeKey, Vector3>::Element *E = edge_map.find(ek);
if (E) {
if (E->get().dot(fn) > 0.9) {
E->get() = Vector3();
}
} else {
edge_map[ek] = fn;
}
}
}
for (Map<_EdgeKey, Vector3>::Element *E = edge_map.front(); E; E = E->next()) {
if (E->get() != Vector3()) {
lines.push_back(E->key().from);
lines.push_back(E->key().to);
}
}
add_lines(lines, EditorSpatialGizmos::singleton->room_material);
add_collision_segments(lines);
}
RoomSpatialGizmo::RoomSpatialGizmo(Room *p_room) {
set_spatial_node(p_room);
room = p_room;
}
/////
void PortalSpatialGizmo::redraw() {
clear();
Vector<Point2> points = portal->get_shape();
if (points.size() == 0) {
return;
}
Vector<Vector3> lines;
Vector3 center;
for (int i = 0; i < points.size(); i++) {
Vector3 f;
f.x = points[i].x;
f.y = points[i].y;
Vector3 fn;
fn.x = points[(i + 1) % points.size()].x;
fn.y = points[(i + 1) % points.size()].y;
center += f;
lines.push_back(f);
lines.push_back(fn);
}
center /= points.size();
lines.push_back(center);
lines.push_back(center + Vector3(0, 0, 1));
add_lines(lines, EditorSpatialGizmos::singleton->portal_material);
add_collision_segments(lines);
}
PortalSpatialGizmo::PortalSpatialGizmo(Portal *p_portal) {
set_spatial_node(p_portal);
portal = p_portal;
}
#endif
/////
RayCastSpatialGizmoPlugin::RayCastSpatialGizmoPlugin() {

View file

@ -160,19 +160,6 @@ public:
PhysicalBoneSpatialGizmoPlugin();
};
#if 0
class PortalSpatialGizmo : public EditorSpatialGizmo {
GDCLASS(PortalSpatialGizmo, EditorSpatialGizmo);
Portal *portal;
public:
void redraw();
PortalSpatialGizmo(Portal *p_portal = NULL);
};
#endif
class RayCastSpatialGizmoPlugin : public EditorSpatialGizmoPlugin {
GDCLASS(RayCastSpatialGizmoPlugin, EditorSpatialGizmoPlugin);

View file

@ -28,11 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "pluginscript_instance.h"
// Godot imports
#include "core/os/os.h"
#include "core/variant.h"
// PluginScript imports
#include "pluginscript_instance.h"
#include "pluginscript_language.h"
#include "pluginscript_script.h"
@ -89,51 +91,6 @@ Variant PluginScriptInstance::call(const StringName &p_method, const Variant **p
return var_ret;
}
#if 0 // TODO: Don't rely on default implementations provided by ScriptInstance ?
void PluginScriptInstance::call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount) {
#if 0
PluginScript *sptr=script.ptr();
Variant::CallError ce;
while(sptr) {
Map<StringName,GDFunction*>::Element *E = sptr->member_functions.find(p_method);
if (E) {
E->get()->call(this,p_args,p_argcount,ce);
}
sptr = sptr->_base;
}
#endif
}
#if 0
void PluginScriptInstance::_ml_call_reversed(PluginScript *sptr,const StringName& p_method,const Variant** p_args,int p_argcount) {
if (sptr->_base)
_ml_call_reversed(sptr->_base,p_method,p_args,p_argcount);
Variant::CallError ce;
Map<StringName,GDFunction*>::Element *E = sptr->member_functions.find(p_method);
if (E) {
E->get()->call(this,p_args,p_argcount,ce);
}
}
#endif
void PluginScriptInstance::call_multilevel_reversed(const StringName& p_method,const Variant** p_args,int p_argcount) {
#if 0
if (script.ptr()) {
_ml_call_reversed(script.ptr(),p_method,p_args,p_argcount);
}
#endif
}
#endif // Multilevel stuff
void PluginScriptInstance::notification(int p_notification) {
_desc->notification(_data, p_notification);
}

View file

@ -33,6 +33,7 @@
// Godot imports
#include "core/script_language.h"
// PluginScript imports
#include <pluginscript/godot_pluginscript.h>
@ -60,13 +61,12 @@ public:
virtual bool has_method(const StringName &p_method) const;
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
#if 0
// Rely on default implementations provided by ScriptInstance for the moment.
// Note that multilevel call could be removed in 3.0 release, so stay tuned
// (see https://godotengine.org/qa/9244/can-override-the-_ready-and-_process-functions-child-classes)
virtual void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount);
virtual void call_multilevel_reversed(const StringName& p_method,const Variant** p_args,int p_argcount);
#endif
// Rely on default implementations provided by ScriptInstance for the moment.
// Note that multilevel call could be removed in 3.0 release, so stay tuned
// (see https://godotengine.org/qa/9244/can-override-the-_ready-and-_process-functions-child-classes)
//virtual void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount);
//virtual void call_multilevel_reversed(const StringName& p_method,const Variant** p_args,int p_argcount);
virtual void notification(int p_notification);

View file

@ -1550,10 +1550,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
OPCODE_BREAK;
}
// Enable for debugging
#if 0
#if 0 // Enable for debugging.
default: {
err_text = "Illegal opcode " + itos(_code_ptr[ip]) + " at address " + itos(ip);
OPCODE_BREAK;
}

View file

@ -346,195 +346,6 @@ void Polygon2D::_notification(int p_what) {
if (total_indices.size()) {
VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), total_indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID(), -1, RID(), antialiased);
}
#if 0
//use splits
Vector<int> loop;
int sc = splits.size();
PoolVector<int>::Read r = splits.read();
print_line("has splits, amount " + itos(splits.size()));
Vector<Vector<int> > loops;
// find a point that can be used to begin, must not be in a split, and have to the left and right the same one
// like this one -> x---o
// \ / \ .
// o---o
int base_point = -1;
{
int current_point = -1;
int base_point_prev_split = -1;
for (int i = 0; i < points.size(); i++) {
//find if this point is in a split
int split_index = -1;
bool has_prev_split = false;
int min_dist_to_end = 0x7FFFFFFF;
for (int j = 0; j < sc; j += 2) {
int split_pos = -1;
int split_end = -1;
if (r[j + 0] == i) { //found split in first point
split_pos = r[j + 0];
split_end = r[j + 1];
} else if (r[j + 1] == i) { //found split in second point
split_pos = r[j + 1];
split_end = r[j + 0];
}
if (split_pos == split_end) {
continue; //either nothing found or begin == end, this not a split in either case
}
if (j == base_point_prev_split) {
has_prev_split = true;
}
//compute distance from split pos to split end in current traversal direction
int dist_to_end = split_end > split_pos ? split_end - split_pos : (last - split_pos + split_end);
if (dist_to_end < min_dist_to_end) {
//always keep the valid split with the least distance to the loop
min_dist_to_end = dist_to_end;
split_index = j;
}
}
if (split_index == -1) {
current_point = i; //no split here, we are testing this point
} else if (has_prev_split) {
base_point = current_point; // there is a split and it contains the previous visited split, success
break;
} else {
//invalidate current point and keep split
current_point = -1;
base_point_prev_split = split_index;
}
}
}
print_line("found base point: " + itos(base_point));
if (base_point != -1) {
int point = base_point;
int last = base_point;
//go through all the points, find splits
do {
int split;
int last_dist_to_end = -1; //maximum valid distance to end
do {
loop.push_back(point); //push current point
split = -1;
int end = -1;
int max_dist_to_end = 0;
//find if this point is in a split
for (int j = 0; j < sc; j += 2) {
int split_pos = -1;
int split_end = -1;
if (r[j + 0] == point) { //match first split index
split_pos = r[j + 0];
split_end = r[j + 1];
} else if (r[j + 1] == point) { //match second split index
split_pos = r[j + 1];
split_end = r[j + 0];
}
if (split_pos == split_end) {
continue; //either nothing found or begin == end, this not a split in either case
}
//compute distance from split pos to split end
int dist_to_end = split_end > split_pos ? split_end - split_pos : (points.size() - split_pos + split_end);
if (last_dist_to_end != -1 && dist_to_end >= last_dist_to_end) {
//distance must be shorter than in last iteration, means we've tested this before so ignore
continue;
} else if (dist_to_end > max_dist_to_end) {
//always keep the valid point with the most distance (as long as it's valid)
max_dist_to_end = dist_to_end;
split = split_pos;
end = split_end;
}
}
if (split != -1) {
//found a split!
int from = end;
//add points until last is reached
while (true) {
//find if point is in a split
loop.push_back(from);
if (from == last) {
break;
}
from++;
if (from >= points.size()) { //wrap if reached end
from = 0;
}
if (from == loop[0]) {
break; //end because we reached split source
}
}
loops.push_back(loop); //done with this loop
loop.clear();
last_dist_to_end = max_dist_to_end;
last = end; //algorithm can safely finish in this split point
}
} while (split != -1);
} while (point != last);
}
if (loop.size() >=2 ) { //points remained
//points remain
loop.push_back(last); //no splits found, use last
loops.push_back(loop);
}
print_line("total loops: " + itos(loops.size()));
if (loops.size()) { //loops found
Vector<int> indices;
for (int i = 0; i < loops.size(); i++) {
Vector<int> loop = loops[i];
Vector<Vector2> vertices;
vertices.resize(loop.size());
for (int j = 0; j < vertices.size(); j++) {
vertices.write[j] = points[loop[j]];
}
Vector<int> sub_indices = Geometry::triangulate_polygon(vertices);
int from = indices.size();
indices.resize(from + sub_indices.size());
for (int j = 0; j < sub_indices.size(); j++) {
indices.write[from + j] = loop[sub_indices[j]];
}
}
VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID());
}
#endif
}
} break;

View file

@ -1,232 +0,0 @@
/*************************************************************************/
/* portal.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 "portal.h"
#include "core/project_settings.h"
#include "scene/resources/surface_tool.h"
#include "servers/visual_server.h"
// FIXME: This will be removed, kept as reference for new implementation
#if 0
bool Portal::_set(const StringName &p_name, const Variant &p_value) {
if (p_name == "shape") {
PoolVector<float> src_coords = p_value;
Vector<Point2> points;
int src_coords_size = src_coords.size();
ERR_FAIL_COND_V(src_coords_size % 2, false);
points.resize(src_coords_size / 2);
for (int i = 0; i < points.size(); i++) {
points[i].x = src_coords[i * 2 + 0];
points[i].y = src_coords[i * 2 + 1];
set_shape(points);
}
} else if (p_name == "enabled") {
set_enabled(p_value);
} else if (p_name == "disable_distance") {
set_disable_distance(p_value);
} else if (p_name == "disabled_color") {
set_disabled_color(p_value);
} else if (p_name == "connect_range") {
set_connect_range(p_value);
} else
return false;
return true;
}
bool Portal::_get(const StringName &p_name, Variant &r_ret) const {
if (p_name == "shape") {
Vector<Point2> points = get_shape();
PoolVector<float> dst_coords;
dst_coords.resize(points.size() * 2);
for (int i = 0; i < points.size(); i++) {
dst_coords.set(i * 2 + 0, points[i].x);
dst_coords.set(i * 2 + 1, points[i].y);
}
r_ret = dst_coords;
} else if (p_name == "enabled") {
r_ret = is_enabled();
} else if (p_name == "disable_distance") {
r_ret = get_disable_distance();
} else if (p_name == "disabled_color") {
r_ret = get_disabled_color();
} else if (p_name == "connect_range") {
r_ret = get_connect_range();
} else
return false;
return true;
}
void Portal::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::POOL_REAL_ARRAY, "shape"));
p_list->push_back(PropertyInfo(Variant::BOOL, "enabled"));
p_list->push_back(PropertyInfo(Variant::REAL, "disable_distance", PROPERTY_HINT_RANGE, "0,4096,0.01"));
p_list->push_back(PropertyInfo(Variant::COLOR, "disabled_color"));
p_list->push_back(PropertyInfo(Variant::REAL, "connect_range", PROPERTY_HINT_RANGE, "0.1,4096,0.01"));
}
AABB Portal::get_aabb() const {
return aabb;
}
PoolVector<Face3> Portal::get_faces(uint32_t p_usage_flags) const {
if (!(p_usage_flags & FACES_ENCLOSING))
return PoolVector<Face3>();
Vector<Point2> shape = get_shape();
if (shape.size() == 0)
return PoolVector<Face3>();
Vector2 center;
for (int i = 0; i < shape.size(); i++) {
center += shape[i];
}
PoolVector<Face3> ret;
center /= shape.size();
for (int i = 0; i < shape.size(); i++) {
int n = (i + 1) % shape.size();
Face3 f;
f.vertex[0] = Vector3(center.x, center.y, 0);
f.vertex[1] = Vector3(shape[i].x, shape[i].y, 0);
f.vertex[2] = Vector3(shape[n].x, shape[n].y, 0);
ret.push_back(f);
}
return ret;
}
void Portal::set_shape(const Vector<Point2> &p_shape) {
VisualServer::get_singleton()->portal_set_shape(portal, p_shape);
shape = p_shape;
update_gizmo();
}
Vector<Point2> Portal::get_shape() const {
return shape;
}
void Portal::set_connect_range(float p_range) {
connect_range = p_range;
//VisualServer::get_singleton()->portal_set_connect_range(portal,p_range);
}
float Portal::get_connect_range() const {
return connect_range;
}
void Portal::set_enabled(bool p_enabled) {
enabled = p_enabled;
VisualServer::get_singleton()->portal_set_enabled(portal, enabled);
}
bool Portal::is_enabled() const {
return enabled;
}
void Portal::set_disable_distance(float p_distance) {
disable_distance = p_distance;
VisualServer::get_singleton()->portal_set_disable_distance(portal, disable_distance);
}
float Portal::get_disable_distance() const {
return disable_distance;
}
void Portal::set_disabled_color(const Color &p_disabled_color) {
disabled_color = p_disabled_color;
VisualServer::get_singleton()->portal_set_disabled_color(portal, disabled_color);
}
Color Portal::get_disabled_color() const {
return disabled_color;
}
void Portal::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_shape", "points"), &Portal::set_shape);
ClassDB::bind_method(D_METHOD("get_shape"), &Portal::get_shape);
ClassDB::bind_method(D_METHOD("set_enabled", "enable"), &Portal::set_enabled);
ClassDB::bind_method(D_METHOD("is_enabled"), &Portal::is_enabled);
ClassDB::bind_method(D_METHOD("set_disable_distance", "distance"), &Portal::set_disable_distance);
ClassDB::bind_method(D_METHOD("get_disable_distance"), &Portal::get_disable_distance);
ClassDB::bind_method(D_METHOD("set_disabled_color", "color"), &Portal::set_disabled_color);
ClassDB::bind_method(D_METHOD("get_disabled_color"), &Portal::get_disabled_color);
ClassDB::bind_method(D_METHOD("set_connect_range", "range"), &Portal::set_connect_range);
ClassDB::bind_method(D_METHOD("get_connect_range"), &Portal::get_connect_range);
}
Portal::Portal() {
portal = VisualServer::get_singleton()->portal_create();
Vector<Point2> points;
points.push_back(Point2(-1, 1));
points.push_back(Point2(1, 1));
points.push_back(Point2(1, -1));
points.push_back(Point2(-1, -1));
set_shape(points); // default shape
set_connect_range(0.8);
set_disable_distance(50);
set_enabled(true);
set_base(portal);
}
Portal::~Portal() {
VisualServer::get_singleton()->free(portal);
}
#endif

View file

@ -1,88 +0,0 @@
/*************************************************************************/
/* portal.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 PORTAL_H
#define PORTAL_H
#include "scene/3d/visual_instance.h"
/* Portal Logic:
If a portal is placed next (very close to) a similar, opposing portal, they automatically connect,
otherwise, a portal connects to the parent room
*/
// 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 {
GDCLASS(Portal, VisualInstance);
RID portal;
Vector<Point2> shape;
bool enabled;
float disable_distance;
Color disabled_color;
float connect_range;
AABB aabb;
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;
static void _bind_methods();
public:
virtual AABB get_aabb() const;
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
void set_enabled(bool p_enabled);
bool is_enabled() const;
void set_disable_distance(float p_distance);
float get_disable_distance() const;
void set_disabled_color(const Color &p_disabled_color);
Color get_disabled_color() const;
void set_shape(const Vector<Point2> &p_shape);
Vector<Point2> get_shape() const;
void set_connect_range(float p_range);
float get_connect_range() const;
Portal();
~Portal();
};
#endif
#endif

View file

@ -1,164 +0,0 @@
/*************************************************************************/
/* room_instance.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 "room_instance.h"
#include "servers/visual_server.h"
// FIXME: Will be removed, kept as reference for new implementation
#if 0
#include "core/math/geometry.h"
#include "core/project_settings.h"
#include "scene/resources/surface_tool.h"
void Room::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_WORLD: {
// go find parent level
Node *parent_room = get_parent();
level = 0;
while (parent_room) {
Room *r = Object::cast_to<Room>(parent_room);
if (r) {
level = r->level + 1;
break;
}
parent_room = parent_room->get_parent();
}
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
} break;
case NOTIFICATION_EXIT_WORLD: {
} break;
}
}
AABB Room::get_aabb() const {
if (room.is_null())
return AABB();
return AABB();
}
PoolVector<Face3> Room::get_faces(uint32_t p_usage_flags) const {
return PoolVector<Face3>();
}
void Room::set_room(const Ref<RoomBounds> &p_room) {
room = p_room;
update_gizmo();
if (room.is_valid()) {
set_base(room->get_rid());
} else {
set_base(RID());
}
if (!is_inside_tree())
return;
propagate_notification(NOTIFICATION_AREA_CHANGED);
update_gizmo();
}
Ref<RoomBounds> Room::get_room() const {
return room;
}
void Room::_parse_node_faces(PoolVector<Face3> &all_faces, const Node *p_node) const {
const VisualInstance *vi = Object::cast_to<VisualInstance>(p_node);
if (vi) {
PoolVector<Face3> faces = vi->get_faces(FACES_ENCLOSING);
if (faces.size()) {
int old_len = all_faces.size();
all_faces.resize(all_faces.size() + faces.size());
int new_len = all_faces.size();
PoolVector<Face3>::Write all_facesw = all_faces.write();
Face3 *all_facesptr = all_facesw.ptr();
PoolVector<Face3>::Read facesr = faces.read();
const Face3 *facesptr = facesr.ptr();
Transform tr = vi->get_relative_transform(this);
for (int i = old_len; i < new_len; i++) {
Face3 f = facesptr[i - old_len];
for (int j = 0; j < 3; j++)
f.vertex[j] = tr.xform(f.vertex[j]);
all_facesptr[i] = f;
}
}
}
for (int i = 0; i < p_node->get_child_count(); i++) {
_parse_node_faces(all_faces, p_node->get_child(i));
}
}
void Room::_bounds_changed() {
update_gizmo();
}
void Room::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_room", "room"), &Room::set_room);
ClassDB::bind_method(D_METHOD("get_room"), &Room::get_room);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "room/room", PROPERTY_HINT_RESOURCE_TYPE, "Area"), "set_room", "get_room");
}
Room::Room() {
// sound_enabled=false;
level = 0;
}
Room::~Room() {
}
#endif

View file

@ -1,81 +0,0 @@
/*************************************************************************/
/* room_instance.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 ROOM_INSTANCE_H
#define ROOM_INSTANCE_H
#include "scene/3d/visual_instance.h"
#include "scene/resources/room.h"
/* RoomInstance Logic:
a) Instances that belong to the room are drawn only if the room is visible (seen through portal, or player inside)
b) Instances that don't belong to any room are considered to belong to the root room (RID empty)
c) "dynamic" Instances are assigned to the rooms their AABB touch
*/
// FIXME: this will be removed, left for reference
#if 0
class Room : public VisualInstance {
GDCLASS(Room, VisualInstance);
public:
private:
Ref<RoomBounds> room;
int level;
void _parse_node_faces(PoolVector<Face3> &all_faces, const Node *p_node) const;
void _bounds_changed();
protected:
void _notification(int p_what);
static void _bind_methods();
public:
enum {
// used to notify portals that the room in which they are has changed.
NOTIFICATION_AREA_CHANGED = 60
};
virtual AABB get_aabb() const;
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
void set_room(const Ref<RoomBounds> &p_room);
Ref<RoomBounds> get_room() const;
Room();
~Room();
};
#endif
#endif // ROOM_INSTANCE_H

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "voxel_light_baker.h"
#include "core/os/os.h"
#include "core/os/threaded_array_processor.h"
@ -2118,8 +2119,7 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh
}
}
// Enable for debugging
#if 0
#if 0 // Enable for debugging.
{
PoolVector<uint8_t> img;
int ls = lightmap.size();

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "animation_blend_tree.h"
#include "scene/scene_string_names.h"
void AnimationNodeAnimation::set_animation(const StringName &p_name) {
@ -718,21 +719,6 @@ String AnimationNodeTransition::get_input_caption(int p_input) const {
return inputs[p_input].name;
}
#if 0
Ref<AnimationNodeBlendTree> tree = get_parent();
if (tree.is_valid() && current >= 0) {
prev = current;
prev_xfading = xfade;
time = 0;
current = p_current;
switched = true;
_change_notify("current");
} else {
current = p_current;
}
#endif
void AnimationNodeTransition::set_cross_fade_time(float p_fade) {
xfade = p_fade;
}

View file

@ -194,13 +194,11 @@
#include "scene/3d/path.h"
#include "scene/3d/physics_body.h"
#include "scene/3d/physics_joint.h"
#include "scene/3d/portal.h"
#include "scene/3d/position_3d.h"
#include "scene/3d/proximity_group.h"
#include "scene/3d/ray_cast.h"
#include "scene/3d/reflection_probe.h"
#include "scene/3d/remote_transform.h"
#include "scene/3d/room_instance.h"
#include "scene/3d/skeleton.h"
#include "scene/3d/soft_body.h"
#include "scene/3d/spring_arm.h"

View file

@ -1,70 +0,0 @@
/*************************************************************************/
/* room.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 "room.h"
#include "servers/visual_server.h"
// FIXME: Left for reference for reimplementation using Area
#if 0
RID RoomBounds::get_rid() const {
return area;
}
void RoomBounds::set_geometry_hint(const PoolVector<Face3> &p_geometry_hint) {
geometry_hint = p_geometry_hint;
}
PoolVector<Face3> RoomBounds::get_geometry_hint() const {
return geometry_hint;
}
void RoomBounds::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_geometry_hint", "triangles"), &RoomBounds::set_geometry_hint);
ClassDB::bind_method(D_METHOD("get_geometry_hint"), &RoomBounds::get_geometry_hint);
//ADD_PROPERTY( PropertyInfo( Variant::DICTIONARY, "bounds"), "set_bounds","get_bounds") ;
ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "geometry_hint"), "set_geometry_hint", "get_geometry_hint");
}
RoomBounds::RoomBounds() {
area = VisualServer::get_singleton()->room_create();
}
RoomBounds::~RoomBounds() {
VisualServer::get_singleton()->free(area);
}
#endif

View file

@ -1,62 +0,0 @@
/*************************************************************************/
/* room.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 ROOM_BOUNDS_H
#define ROOM_BOUNDS_H
#include "core/math/bsp_tree.h"
#include "core/resource.h"
// FIXME: left for reference but will be removed when portals are reimplemented using Area
#if 0
class RoomBounds : public Resource {
GDCLASS(RoomBounds, Resource);
RES_BASE_EXTENSION("room");
RID area;
PoolVector<Face3> geometry_hint;
protected:
static void _bind_methods();
public:
virtual RID get_rid() const;
void set_geometry_hint(const PoolVector<Face3> &p_geometry_hint);
PoolVector<Face3> get_geometry_hint() const;
RoomBounds();
~RoomBounds();
};
#endif
#endif // ROOM_H

View file

@ -247,18 +247,6 @@ private:
void _mix_step();
#if 0
struct AudioInBlock {
Ref<AudioStreamSample> audio_stream;
int current_position;
bool loops;
};
Map<StringName, AudioInBlock *> audio_in_block_map;
Vector<AudioInBlock *> audio_in_blocks;
#endif
struct CallbackItem {
AudioCallback callback;

View file

@ -531,11 +531,10 @@ public:
BIND2(scenario_set_fallback_environment, RID, RID)
/* INSTANCING API */
// from can be mesh, light, area and portal so far.
BIND0R(RID, instance_create)
BIND2(instance_set_base, RID, RID) // from can be mesh, light, poly, area and portal so far.
BIND2(instance_set_scenario, RID, RID) // from can be mesh, light, poly, area and portal so far.
BIND2(instance_set_base, RID, RID)
BIND2(instance_set_scenario, RID, RID)
BIND2(instance_set_layer_mask, RID, uint32_t)
BIND2(instance_set_transform, RID, const Transform &)
BIND2(instance_attach_object_instance_id, RID, ObjectID)

View file

@ -29,10 +29,13 @@
/*************************************************************************/
#include "visual_server_scene.h"
#include "core/os/os.h"
#include "visual_server_globals.h"
#include "visual_server_raster.h"
#include <new>
/* CAMERA API */
RID VisualServerScene::camera_create() {
@ -314,7 +317,6 @@ void VisualServerScene::_instance_queue_update(Instance *p_instance, bool p_upda
_instance_update_list.add(&p_instance->update_item);
}
// from can be mesh, light, area and portal so far.
RID VisualServerScene::instance_create() {
Instance *instance = memnew(Instance);

View file

@ -55,22 +55,6 @@ public:
static VisualServerScene *singleton;
// FIXME: Kept as reference for future implementation
#if 0
struct Portal {
bool enabled;
float disable_distance;
Color disable_color;
float connect_range;
Vector<Point2> shape;
Rect2 bounds;
Portal() { enabled=true; disable_distance=50; disable_color=Color(); connect_range=0.8; }
};
#endif
/* CAMERA API */
struct Camera : public RID_Data {
@ -450,11 +434,10 @@ public:
RID_Owner<Instance> instance_owner;
// from can be mesh, light, area and portal so far.
virtual RID instance_create(); // from can be mesh, light, poly, area and portal so far.
virtual RID instance_create();
virtual void instance_set_base(RID p_instance, RID p_base); // from can be mesh, light, poly, area and portal so far.
virtual void instance_set_scenario(RID p_instance, RID p_scenario); // from can be mesh, light, poly, area and portal so far.
virtual void instance_set_base(RID p_instance, RID p_base);
virtual void instance_set_scenario(RID p_instance, RID p_scenario);
virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask);
virtual void instance_set_transform(RID p_instance, const Transform &p_transform);
virtual void instance_attach_object_instance_id(RID p_instance, ObjectID p_id);

View file

@ -453,11 +453,10 @@ public:
FUNC2(scenario_set_fallback_environment, RID, RID)
/* INSTANCING API */
// from can be mesh, light, area and portal so far.
FUNCRID(instance)
FUNC2(instance_set_base, RID, RID) // from can be mesh, light, poly, area and portal so far.
FUNC2(instance_set_scenario, RID, RID) // from can be mesh, light, poly, area and portal so far.
FUNC2(instance_set_base, RID, RID)
FUNC2(instance_set_scenario, RID, RID)
FUNC2(instance_set_layer_mask, RID, uint32_t)
FUNC2(instance_set_transform, RID, const Transform &)
FUNC2(instance_attach_object_instance_id, RID, ObjectID)

View file

@ -813,11 +813,10 @@ public:
virtual RID instance_create2(RID p_base, RID p_scenario);
//virtual RID instance_create(RID p_base,RID p_scenario)=0; // from can be mesh, light, area and portal so far.
virtual RID instance_create() = 0; // from can be mesh, light, poly, area and portal so far.
virtual RID instance_create() = 0;
virtual void instance_set_base(RID p_instance, RID p_base) = 0; // from can be mesh, light, poly, area and portal so far.
virtual void instance_set_scenario(RID p_instance, RID p_scenario) = 0; // from can be mesh, light, poly, area and portal so far.
virtual void instance_set_base(RID p_instance, RID p_base) = 0;
virtual void instance_set_scenario(RID p_instance, RID p_scenario) = 0;
virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask) = 0;
virtual void instance_set_transform(RID p_instance, const Transform &p_transform) = 0;
virtual void instance_attach_object_instance_id(RID p_instance, ObjectID p_id) = 0;