bool VisualServerViewport::free(RID p_rid) { if (viewport_owner.owns(p_rid)) { Viewport *viewport = viewport_owner.getornull(p_rid); VSG::storage->free(viewport->render_target); VSG::scene_render->free(viewport->shadow_atlas); while (viewport->canvas_map.front()) { viewport_remove_canvas(p_rid, viewport->canvas_map.front()->key()); } viewport_set_scenario(p_rid, RID()); active_viewports.erase(viewport); viewport_owner.free(p_rid); memdelete(viewport); return true; } return false; }
void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light, const Transform2D &p_base_transform) { Item *current_clip = NULL; RasterizerStorageGLES2::Shader *shader_cache = NULL; bool rebind_shader = true; state.current_tex = RID(); state.current_tex_ptr = NULL; state.current_normal = RID(); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex); int last_blend_mode = -1; RID canvas_last_material = RID(); while (p_item_list) { Item *ci = p_item_list; if (current_clip != ci->final_clip_owner) { current_clip = ci->final_clip_owner; if (current_clip) { glEnable(GL_SCISSOR_TEST); int y = storage->frame.current_rt->height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.y); if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) y = current_clip->final_clip_rect.position.y; glScissor(current_clip->final_clip_rect.position.x, y, current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height); } else { glDisable(GL_SCISSOR_TEST); } } // TODO: copy back buffer if (ci->copy_back_buffer) { if (ci->copy_back_buffer->full) { _copy_texscreen(Rect2()); } else { _copy_texscreen(ci->copy_back_buffer->rect); } } Item *material_owner = ci->material_owner ? ci->material_owner : ci; RID material = material_owner->material; RasterizerStorageGLES2::Material *material_ptr = storage->material_owner.getornull(material); if (material != canvas_last_material || rebind_shader) { RasterizerStorageGLES2::Shader *shader_ptr = NULL; if (material_ptr) { shader_ptr = material_ptr->shader; if (shader_ptr && shader_ptr->mode != VS::SHADER_CANVAS_ITEM) { shader_ptr = NULL; // not a canvas item shader, don't use. } } if (shader_ptr) { if (shader_ptr->canvas_item.uses_screen_texture) { _copy_texscreen(Rect2()); } if (shader_ptr != shader_cache) { if (shader_ptr->canvas_item.uses_time) { VisualServerRaster::redraw_request(); } state.canvas_shader.set_custom_shader(shader_ptr->custom_code_id); state.canvas_shader.bind(); } int tc = material_ptr->textures.size(); Pair<StringName, RID> *textures = material_ptr->textures.ptrw(); ShaderLanguage::ShaderNode::Uniform::Hint *texture_hints = shader_ptr->texture_hints.ptrw(); for (int i = 0; i < tc; i++) { glActiveTexture(GL_TEXTURE0 + i); RasterizerStorageGLES2::Texture *t = storage->texture_owner.getornull(textures[i].second); if (!t) { switch (texture_hints[i]) { case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK_ALBEDO: case ShaderLanguage::ShaderNode::Uniform::HINT_BLACK: { glBindTexture(GL_TEXTURE_2D, storage->resources.black_tex); } break; case ShaderLanguage::ShaderNode::Uniform::HINT_ANISO: { glBindTexture(GL_TEXTURE_2D, storage->resources.aniso_tex); } break; case ShaderLanguage::ShaderNode::Uniform::HINT_NORMAL: { glBindTexture(GL_TEXTURE_2D, storage->resources.normal_tex); } break; default: { glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex); } break; } continue; } t = t->get_ptr(); if (t->redraw_if_visible) { VisualServerRaster::redraw_request(); } glBindTexture(t->target, t->tex_id); } } else { state.canvas_shader.set_custom_shader(0); state.canvas_shader.bind(); } state.canvas_shader.use_material((void *)material_ptr); shader_cache = shader_ptr; canvas_last_material = material; rebind_shader = false; } int blend_mode = shader_cache ? shader_cache->canvas_item.blend_mode : RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MIX; bool unshaded = (shader_cache && blend_mode != RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MIX); bool reclip = false; if (last_blend_mode != blend_mode) { switch (blend_mode) { case RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MIX: { glBlendEquation(GL_FUNC_ADD); if (storage->frame.current_rt && 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 RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_ADD: { glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_SRC_ALPHA, GL_ONE); } break; case RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_SUB: { glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); glBlendFunc(GL_SRC_ALPHA, GL_ONE); } break; case RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_MUL: { glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_DST_COLOR, GL_ZERO); } break; case RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_PMALPHA: { glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } break; } } state.uniforms.final_modulate = unshaded ? ci->final_modulate : Color(ci->final_modulate.r * p_modulate.r, ci->final_modulate.g * p_modulate.g, ci->final_modulate.b * p_modulate.b, ci->final_modulate.a * p_modulate.a); state.uniforms.modelview_matrix = ci->final_transform; state.uniforms.extra_matrix = Transform2D(); _set_uniforms(); _canvas_item_render_commands(p_item_list, NULL, reclip, material_ptr); rebind_shader = true; // hacked in for now. if (reclip) { glEnable(GL_SCISSOR_TEST); int y = storage->frame.current_rt->height - (current_clip->final_clip_rect.position.y + current_clip->final_clip_rect.size.y); if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP]) y = current_clip->final_clip_rect.position.y; glScissor(current_clip->final_clip_rect.position.x, y, current_clip->final_clip_rect.size.width, current_clip->final_clip_rect.size.height); } p_item_list = p_item_list->next; } if (current_clip) { glDisable(GL_SCISSOR_TEST); } }
RID RenderTargetTexture::get_rid() const{ ERR_FAIL_COND_V(!vp,RID()); return vp->render_target_texture_rid; }
static std::string dateTimezoneIniGet() { return RID().getTimeZone(); }
bool VisualServerCanvas::free(RID p_rid) { if (canvas_owner.owns(p_rid)) { Canvas *canvas = canvas_owner.get(p_rid); ERR_FAIL_COND_V(!canvas, false); while (canvas->viewports.size()) { VisualServerViewport::Viewport *vp = VSG::viewport->viewport_owner.get(canvas->viewports.front()->get()); ERR_FAIL_COND_V(!vp, true); Map<RID, VisualServerViewport::Viewport::CanvasData>::Element *E = vp->canvas_map.find(p_rid); ERR_FAIL_COND_V(!E, true); vp->canvas_map.erase(p_rid); canvas->viewports.erase(canvas->viewports.front()); } for (int i = 0; i < canvas->child_items.size(); i++) { canvas->child_items[i].item->parent = RID(); } for (Set<RasterizerCanvas::Light *>::Element *E = canvas->lights.front(); E; E = E->next()) { E->get()->canvas = RID(); } for (Set<RasterizerCanvas::LightOccluderInstance *>::Element *E = canvas->occluders.front(); E; E = E->next()) { E->get()->canvas = RID(); } canvas_owner.free(p_rid); memdelete(canvas); } else if (canvas_item_owner.owns(p_rid)) { Item *canvas_item = canvas_item_owner.get(p_rid); ERR_FAIL_COND_V(!canvas_item, true); if (canvas_item->parent.is_valid()) { if (canvas_owner.owns(canvas_item->parent)) { Canvas *canvas = canvas_owner.get(canvas_item->parent); canvas->erase_item(canvas_item); } else if (canvas_item_owner.owns(canvas_item->parent)) { Item *item_owner = canvas_item_owner.get(canvas_item->parent); item_owner->child_items.erase(canvas_item); } } for (int i = 0; i < canvas_item->child_items.size(); i++) { canvas_item->child_items[i]->parent = RID(); } /* if (canvas_item->material) { canvas_item->material->owners.erase(canvas_item); } */ canvas_item_owner.free(p_rid); memdelete(canvas_item); } else if (canvas_light_owner.owns(p_rid)) { RasterizerCanvas::Light *canvas_light = canvas_light_owner.get(p_rid); ERR_FAIL_COND_V(!canvas_light, true); if (canvas_light->canvas.is_valid()) { Canvas *canvas = canvas_owner.get(canvas_light->canvas); if (canvas) canvas->lights.erase(canvas_light); } if (canvas_light->shadow_buffer.is_valid()) VSG::storage->free(canvas_light->shadow_buffer); VSG::canvas_render->light_internal_free(canvas_light->light_internal); canvas_light_owner.free(p_rid); memdelete(canvas_light); } else if (canvas_light_occluder_owner.owns(p_rid)) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.get(p_rid); ERR_FAIL_COND_V(!occluder, true); if (occluder->polygon.is_valid()) { LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get(occluder->polygon); if (occluder_poly) { occluder_poly->owners.erase(occluder); } } if (occluder->canvas.is_valid() && canvas_owner.owns(occluder->canvas)) { Canvas *canvas = canvas_owner.get(occluder->canvas); canvas->occluders.erase(occluder); } canvas_light_occluder_owner.free(p_rid); memdelete(occluder); } else if (canvas_light_occluder_polygon_owner.owns(p_rid)) { LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get(p_rid); ERR_FAIL_COND_V(!occluder_poly, true); VSG::storage->free(occluder_poly->occluder); while (occluder_poly->owners.size()) { occluder_poly->owners.front()->get()->polygon = RID(); occluder_poly->owners.erase(occluder_poly->owners.front()); } canvas_light_occluder_polygon_owner.free(p_rid); memdelete(occluder_poly); } else { return false; } return true; }
RID LargeTexture::get_rid() const { return RID(); }
void FixedMaterial::set_texture(Parameter p_parameter, Ref<Texture> p_texture) { ERR_FAIL_INDEX(p_parameter,PARAM_MAX); texture_param[p_parameter]=p_texture; VisualServer::get_singleton()->fixed_material_set_texture(material,(VS::FixedMaterialParam)p_parameter,p_texture.is_null()?RID():p_texture->get_rid()); _change_notify(); }
void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { #define SET_FROM_STRUCT_AND_BREAK(m_type) \ { \ const m_type &val = p_value.operator m_type(); \ MARSHALLED_OUT(m_type, val, raw); \ mono_field_set_value(p_object, mono_field, raw); \ break; \ } #define SET_FROM_PRIMITIVE(m_type) \ { \ m_type val = p_value.operator m_type(); \ mono_field_set_value(p_object, mono_field, &val); \ break; \ } #define SET_FROM_ARRAY_AND_BREAK(m_type) \ { \ MonoArray *managed = GDMonoMarshal::m_type##_to_mono_array(p_value.operator m_type()); \ mono_field_set_value(p_object, mono_field, &managed); \ break; \ } switch (type.type_encoding) { case MONO_TYPE_BOOLEAN: { SET_FROM_PRIMITIVE(bool); } break; case MONO_TYPE_I1: { SET_FROM_PRIMITIVE(signed char); } break; case MONO_TYPE_I2: { SET_FROM_PRIMITIVE(signed short); } break; case MONO_TYPE_I4: { SET_FROM_PRIMITIVE(signed int); } break; case MONO_TYPE_I8: { SET_FROM_PRIMITIVE(int64_t); } break; case MONO_TYPE_U1: { SET_FROM_PRIMITIVE(unsigned char); } break; case MONO_TYPE_U2: { SET_FROM_PRIMITIVE(unsigned short); } break; case MONO_TYPE_U4: { SET_FROM_PRIMITIVE(unsigned int); } break; case MONO_TYPE_U8: { SET_FROM_PRIMITIVE(uint64_t); } break; case MONO_TYPE_R4: { SET_FROM_PRIMITIVE(float); } break; case MONO_TYPE_R8: { SET_FROM_PRIMITIVE(double); } break; case MONO_TYPE_STRING: { MonoString *mono_string = GDMonoMarshal::mono_string_from_godot(p_value); mono_field_set_value(p_object, mono_field, mono_string); } break; case MONO_TYPE_VALUETYPE: { GDMonoClass *tclass = type.type_class; if (tclass == CACHED_CLASS(Vector2)) SET_FROM_STRUCT_AND_BREAK(Vector2); if (tclass == CACHED_CLASS(Rect2)) SET_FROM_STRUCT_AND_BREAK(Rect2); if (tclass == CACHED_CLASS(Transform2D)) SET_FROM_STRUCT_AND_BREAK(Transform2D); if (tclass == CACHED_CLASS(Vector3)) SET_FROM_STRUCT_AND_BREAK(Vector3); if (tclass == CACHED_CLASS(Basis)) SET_FROM_STRUCT_AND_BREAK(Basis); if (tclass == CACHED_CLASS(Quat)) SET_FROM_STRUCT_AND_BREAK(Quat); if (tclass == CACHED_CLASS(Transform)) SET_FROM_STRUCT_AND_BREAK(Transform); if (tclass == CACHED_CLASS(AABB)) SET_FROM_STRUCT_AND_BREAK(AABB); if (tclass == CACHED_CLASS(Color)) SET_FROM_STRUCT_AND_BREAK(Color); if (tclass == CACHED_CLASS(Plane)) SET_FROM_STRUCT_AND_BREAK(Plane); if (mono_class_is_enum(tclass->get_raw())) SET_FROM_PRIMITIVE(signed int); ERR_EXPLAIN(String() + "Attempted to set the value of a field of unmarshallable type: " + tclass->get_name()); ERR_FAIL(); } break; case MONO_TYPE_ARRAY: case MONO_TYPE_SZARRAY: { MonoArrayType *array_type = mono_type_get_array_type(GDMonoClass::get_raw_type(type.type_class)); if (array_type->eklass == CACHED_CLASS_RAW(MonoObject)) SET_FROM_ARRAY_AND_BREAK(Array); if (array_type->eklass == CACHED_CLASS_RAW(uint8_t)) SET_FROM_ARRAY_AND_BREAK(PoolByteArray); if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) SET_FROM_ARRAY_AND_BREAK(PoolIntArray); if (array_type->eklass == REAL_T_MONOCLASS) SET_FROM_ARRAY_AND_BREAK(PoolRealArray); if (array_type->eklass == CACHED_CLASS_RAW(String)) SET_FROM_ARRAY_AND_BREAK(PoolStringArray); if (array_type->eklass == CACHED_CLASS_RAW(Vector2)) SET_FROM_ARRAY_AND_BREAK(PoolVector2Array); if (array_type->eklass == CACHED_CLASS_RAW(Vector3)) SET_FROM_ARRAY_AND_BREAK(PoolVector3Array); if (array_type->eklass == CACHED_CLASS_RAW(Color)) SET_FROM_ARRAY_AND_BREAK(PoolColorArray); ERR_EXPLAIN(String() + "Attempted to convert Variant to a managed array of unmarshallable element type."); ERR_FAIL(); } break; case MONO_TYPE_CLASS: { GDMonoClass *type_class = type.type_class; // GodotObject if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) { MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *()); mono_field_set_value(p_object, mono_field, managed); break; } if (CACHED_CLASS(NodePath) == type_class) { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath()); mono_field_set_value(p_object, mono_field, managed); break; } if (CACHED_CLASS(RID) == type_class) { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID()); mono_field_set_value(p_object, mono_field, managed); break; } ERR_EXPLAIN(String() + "Attempted to set the value of a field of unmarshallable type: " + type_class->get_name()); ERR_FAIL(); } break; case MONO_TYPE_OBJECT: { // Variant switch (p_value.get_type()) { case Variant::BOOL: { SET_FROM_PRIMITIVE(bool); } break; case Variant::INT: { SET_FROM_PRIMITIVE(int); } break; case Variant::REAL: { #ifdef REAL_T_IS_DOUBLE SET_FROM_PRIMITIVE(double); #else SET_FROM_PRIMITIVE(float); #endif } break; case Variant::STRING: { MonoString *mono_string = GDMonoMarshal::mono_string_from_godot(p_value); mono_field_set_value(p_object, mono_field, mono_string); } break; case Variant::VECTOR2: SET_FROM_STRUCT_AND_BREAK(Vector2); case Variant::RECT2: SET_FROM_STRUCT_AND_BREAK(Rect2); case Variant::VECTOR3: SET_FROM_STRUCT_AND_BREAK(Vector3); case Variant::TRANSFORM2D: SET_FROM_STRUCT_AND_BREAK(Transform2D); case Variant::PLANE: SET_FROM_STRUCT_AND_BREAK(Plane); case Variant::QUAT: SET_FROM_STRUCT_AND_BREAK(Quat); case Variant::AABB: SET_FROM_STRUCT_AND_BREAK(AABB); case Variant::BASIS: SET_FROM_STRUCT_AND_BREAK(Basis); case Variant::TRANSFORM: SET_FROM_STRUCT_AND_BREAK(Transform); case Variant::COLOR: SET_FROM_STRUCT_AND_BREAK(Color); case Variant::NODE_PATH: { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath()); mono_field_set_value(p_object, mono_field, managed); } break; case Variant::_RID: { MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID()); mono_field_set_value(p_object, mono_field, managed); } break; case Variant::OBJECT: { MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *()); mono_field_set_value(p_object, mono_field, managed); break; } case Variant::DICTIONARY: { MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary()); mono_field_set_value(p_object, mono_field, managed); } break; case Variant::ARRAY: SET_FROM_ARRAY_AND_BREAK(Array); case Variant::POOL_BYTE_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolByteArray); case Variant::POOL_INT_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolIntArray); case Variant::POOL_REAL_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolRealArray); case Variant::POOL_STRING_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolStringArray); case Variant::POOL_VECTOR2_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolVector2Array); case Variant::POOL_VECTOR3_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolVector3Array); case Variant::POOL_COLOR_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolColorArray); #undef SET_FROM_ARRAY_AND_BREAK default: break; } } break; case MONO_TYPE_GENERICINST: { if (CACHED_RAW_MONO_CLASS(Dictionary) == type.type_class->get_raw()) { MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary()); mono_field_set_value(p_object, mono_field, managed); break; } } break; default: { ERR_PRINTS(String() + "Attempted to set the value of a field of unexpected type encoding: " + itos(type.type_encoding)); } break; } #undef SET_FROM_STRUCT_AND_BREAK #undef SET_FROM_PRIMITIVE }
void VisualServerViewport::draw_viewports() { // get our arvr interface in case we need it Ref<ARVRInterface> arvr_interface = ARVRServer::get_singleton()->get_primary_interface(); if (arvr_interface.is_valid()) { // update our positioning information as late as possible... arvr_interface->process(); } clear_color = GLOBAL_GET("rendering/environment/default_clear_color"); //sort viewports active_viewports.sort_custom<ViewportSort>(); //draw viewports for (int i = 0; i < active_viewports.size(); i++) { Viewport *vp = active_viewports[i]; if (vp->update_mode == VS::VIEWPORT_UPDATE_DISABLED) continue; ERR_CONTINUE(!vp->render_target.is_valid()); bool visible = vp->viewport_to_screen_rect != Rect2() || vp->update_mode == VS::VIEWPORT_UPDATE_ALWAYS || vp->update_mode == VS::VIEWPORT_UPDATE_ONCE || (vp->update_mode == VS::VIEWPORT_UPDATE_WHEN_VISIBLE && VSG::storage->render_target_was_used(vp->render_target)); visible = visible && vp->size.x > 0 && vp->size.y > 0; if (!visible) continue; VSG::storage->render_target_clear_used(vp->render_target); if (vp->use_arvr && arvr_interface.is_valid()) { // override our size, make sure it matches our required size Size2 size = arvr_interface->get_recommended_render_targetsize(); VSG::storage->render_target_set_size(vp->render_target, size.x, size.y); // render mono or left eye first ARVRInterface::Eyes leftOrMono = arvr_interface->is_stereo() ? ARVRInterface::EYE_LEFT : ARVRInterface::EYE_MONO; VSG::rasterizer->set_current_render_target(vp->render_target); _draw_viewport(vp, leftOrMono); arvr_interface->commit_for_eye(leftOrMono, vp->render_target, vp->viewport_to_screen_rect); // render right eye if (leftOrMono == ARVRInterface::EYE_LEFT) { // commit for eye may have changed the render target VSG::rasterizer->set_current_render_target(vp->render_target); _draw_viewport(vp, ARVRInterface::EYE_RIGHT); arvr_interface->commit_for_eye(ARVRInterface::EYE_RIGHT, vp->render_target, vp->viewport_to_screen_rect); } } else { VSG::rasterizer->set_current_render_target(vp->render_target); VSG::scene_render->set_debug_draw_mode(vp->debug_draw); VSG::storage->render_info_begin_capture(); // render standard mono camera _draw_viewport(vp); VSG::storage->render_info_end_capture(); vp->render_info[VS::VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_OBJECTS_IN_FRAME); vp->render_info[VS::VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_VERTICES_IN_FRAME); vp->render_info[VS::VIEWPORT_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_MATERIAL_CHANGES_IN_FRAME); vp->render_info[VS::VIEWPORT_RENDER_INFO_SHADER_CHANGES_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_SHADER_CHANGES_IN_FRAME); vp->render_info[VS::VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_SURFACE_CHANGES_IN_FRAME); vp->render_info[VS::VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_DRAW_CALLS_IN_FRAME); if (vp->viewport_to_screen_rect != Rect2()) { //copy to screen if set as such VSG::rasterizer->set_current_render_target(RID()); VSG::rasterizer->blit_render_target_to_screen(vp->render_target, vp->viewport_to_screen_rect, vp->viewport_to_screen); } } if (vp->update_mode == VS::VIEWPORT_UPDATE_ONCE) { vp->update_mode = VS::VIEWPORT_UPDATE_DISABLED; } VSG::scene_render->set_debug_draw_mode(VS::VIEWPORT_DEBUG_DRAW_DISABLED); } }
void SoftBody::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_WORLD: { if (Engine::get_singleton()->is_editor_hint()) { add_change_receptor(this); } RID space = get_world()->get_space(); PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, space); update_physics_server(); } break; case NOTIFICATION_READY: { if (!parent_collision_ignore.is_empty()) add_collision_exception_with(get_node(parent_collision_ignore)); } break; case NOTIFICATION_TRANSFORM_CHANGED: { if (Engine::get_singleton()->is_editor_hint()) { _reset_points_offsets(); return; } PhysicsServer::get_singleton()->soft_body_set_transform(physics_rid, get_global_transform()); set_notify_transform(false); // Required to be top level with Transform at center of world in order to modify VisualServer only to support custom Transform set_as_toplevel(true); set_transform(Transform()); set_notify_transform(true); } break; case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { if (!simulation_started) return; _update_cache_pin_points_datas(); // Submit bone attachment const int pinned_points_indices_size = pinned_points.size(); PoolVector<PinnedPoint>::Read r = pinned_points.read(); for (int i = 0; i < pinned_points_indices_size; ++i) { if (r[i].spatial_attachment) { PhysicsServer::get_singleton()->soft_body_move_point(physics_rid, r[i].point_index, r[i].spatial_attachment->get_global_transform().xform(r[i].offset)); } } } break; case NOTIFICATION_VISIBILITY_CHANGED: { _update_pickable(); } break; case NOTIFICATION_EXIT_WORLD: { PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, RID()); } break; } #ifdef TOOLS_ENABLED if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { if (Engine::get_singleton()->is_editor_hint()) { update_configuration_warning(); } } #endif }
SuppressHackArrCompatNotices::~SuppressHackArrCompatNotices() { RID().setSuppressHackArrayCompatNotices(old); }
SuppressHackArrCompatNotices::SuppressHackArrCompatNotices() : old{RID().getSuppressHackArrayCompatNotices()} { RID().setSuppressHackArrayCompatNotices(true); }
void raise_hackarr_compat_notice(const std::string& msg) { if (UNLIKELY(RID().getSuppressHackArrayCompatNotices())) return; raise_notice("Hack Array Compat: %s", msg.c_str()); }
void raise_intish_index_cast() { if (UNLIKELY(RID().getSuppressHackArrayCompatNotices())) return; raise_notice("Hack Array Compat: Intish index cast"); }
void GeometryInstance::set_material_override(const Ref<Material>& p_material) { material_override=p_material; VS::get_singleton()->instance_geometry_set_material_override(get_instance(),p_material.is_valid() ? p_material->get_rid() : RID()); }
void GridMap::_update_areas() { //clear the portals for (Map<int, Area *>::Element *E = area_map.front(); E; E = E->next()) { //this should somehow be faster... Area &a = *E->get(); a.portals.clear(); if (a.instance.is_valid()) { VisualServer::get_singleton()->free(a.instance); a.instance = RID(); } } //test all areas against all areas and create portals - this sucks (slow :( ) for (Map<int, Area *>::Element *E = area_map.front(); E; E = E->next()) { Area &a = *E->get(); if (a.exterior_portal) //that's pretty much all it does... yes it is continue; Vector3 from_a(a.from.x, a.from.y, a.from.z); Vector3 to_a(a.to.x, a.to.y, a.to.z); for (Map<int, Area *>::Element *F = area_map.front(); F; F = F->next()) { Area &b = *F->get(); Vector3 from_b(b.from.x, b.from.y, b.from.z); Vector3 to_b(b.to.x, b.to.y, b.to.z); // initially test intersection and discards int axis = -1; float sign = 0; bool valid = true; Vector3 axmin, axmax; for (int i = 0; i < 3; i++) { if (from_a[i] == to_b[i]) { if (axis != -1) { valid = false; break; } axis = i; sign = -1; } else if (from_b[i] == to_a[i]) { if (axis != -1) { valid = false; break; } axis = i; sign = +1; } if (from_a[i] > to_b[i] || to_a[i] < from_b[i]) { valid = false; break; } else { axmin[i] = (from_a[i] > from_b[i]) ? from_a[i] : from_b[i]; axmax[i] = (to_a[i] < to_b[i]) ? to_a[i] : to_b[i]; } } if (axis == -1 || !valid) continue; Transform xf; for (int i = 0; i < 3; i++) { int ax = (axis + i) % 3; Vector3 axis_vec; float scale = (i == 0) ? sign : ((axmax[ax] - axmin[ax]) * cell_size); axis_vec[ax] = scale; xf.basis.set_axis((2 + i) % 3, axis_vec); xf.origin[i] = axmin[i] * cell_size; } Area::Portal portal; portal.xform = xf; a.portals.push_back(portal); } } _update_area_instances(); }
void GridMap::_update_area_instances() { Transform base_xform; if (_in_tree) base_xform = get_global_transform(); for (Map<int, Area *>::Element *E = area_map.front(); E; E = E->next()) { //this should somehow be faster... Area &a = *E->get(); if (a.instance.is_valid() != _in_tree) { if (!_in_tree) { for (int i = 0; i < a.portals.size(); i++) { Area::Portal &p = a.portals[i]; ERR_CONTINUE(!p.instance.is_valid()); VisualServer::get_singleton()->free(p.instance); p.instance = RID(); } VisualServer::get_singleton()->free(a.instance); a.instance = RID(); } else { //a.instance = VisualServer::get_singleton()->instance_create2(base_room,get_world()->get_scenario()); for (int i = 0; i < a.portals.size(); i++) { Area::Portal &p = a.portals[i]; ERR_CONTINUE(p.instance.is_valid()); p.instance = VisualServer::get_singleton()->instance_create2(a.base_portal, get_world()->get_scenario()); VisualServer::get_singleton()->instance_set_room(p.instance, a.instance); } } } if (a.instance.is_valid()) { Transform xform; Vector3 from_a(a.from.x, a.from.y, a.from.z); Vector3 to_a(a.to.x, a.to.y, a.to.z); for (int i = 0; i < 3; i++) { xform.origin[i] = from_a[i] * cell_size; Vector3 s; s[i] = (to_a[i] - from_a[i]) * cell_size; xform.basis.set_axis(i, s); } VisualServer::get_singleton()->instance_set_transform(a.instance, base_xform * xform); for (int i = 0; i < a.portals.size(); i++) { Area::Portal &p = a.portals[i]; ERR_CONTINUE(!p.instance.is_valid()); VisualServer::get_singleton()->instance_set_transform(p.instance, base_xform * xform); } } } }
void VisualServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("texture_create"),&VisualServer::texture_create); ObjectTypeDB::bind_method(_MD("texture_create_from_image"),&VisualServer::texture_create_from_image,DEFVAL( TEXTURE_FLAGS_DEFAULT ) ); //ObjectTypeDB::bind_method(_MD("texture_allocate"),&VisualServer::texture_allocate,DEFVAL( TEXTURE_FLAGS_DEFAULT ) ); //ObjectTypeDB::bind_method(_MD("texture_set_data"),&VisualServer::texture_blit_rect,DEFVAL( CUBEMAP_LEFT ) ); //ObjectTypeDB::bind_method(_MD("texture_get_rect"),&VisualServer::texture_get_rect ); ObjectTypeDB::bind_method(_MD("texture_set_flags"),&VisualServer::texture_set_flags ); ObjectTypeDB::bind_method(_MD("texture_get_flags"),&VisualServer::texture_get_flags ); ObjectTypeDB::bind_method(_MD("texture_get_width"),&VisualServer::texture_get_width ); ObjectTypeDB::bind_method(_MD("texture_get_height"),&VisualServer::texture_get_height ); #ifndef _3D_DISABLED ObjectTypeDB::bind_method(_MD("shader_create","mode"),&VisualServer::shader_create,DEFVAL(SHADER_MATERIAL)); ObjectTypeDB::bind_method(_MD("shader_set_mode","shader","mode"),&VisualServer::shader_set_mode); ObjectTypeDB::bind_method(_MD("material_create"),&VisualServer::material_create); ObjectTypeDB::bind_method(_MD("material_set_shader","shader"),&VisualServer::material_set_shader); ObjectTypeDB::bind_method(_MD("material_get_shader"),&VisualServer::material_get_shader); ObjectTypeDB::bind_method(_MD("material_set_param"),&VisualServer::material_set_param); ObjectTypeDB::bind_method(_MD("material_get_param"),&VisualServer::material_get_param); ObjectTypeDB::bind_method(_MD("material_set_flag"),&VisualServer::material_set_flag); ObjectTypeDB::bind_method(_MD("material_get_flag"),&VisualServer::material_get_flag); ObjectTypeDB::bind_method(_MD("material_set_blend_mode"),&VisualServer::material_set_blend_mode); ObjectTypeDB::bind_method(_MD("material_get_blend_mode"),&VisualServer::material_get_blend_mode); ObjectTypeDB::bind_method(_MD("material_set_line_width"),&VisualServer::material_set_line_width); ObjectTypeDB::bind_method(_MD("material_get_line_width"),&VisualServer::material_get_line_width); ObjectTypeDB::bind_method(_MD("mesh_create"),&VisualServer::mesh_create); ObjectTypeDB::bind_method(_MD("mesh_add_surface"),&VisualServer::mesh_add_surface, DEFVAL(NO_INDEX_ARRAY)); ObjectTypeDB::bind_method(_MD("mesh_surface_set_material"),&VisualServer::mesh_surface_set_material,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("mesh_surface_get_material"),&VisualServer::mesh_surface_get_material); ObjectTypeDB::bind_method(_MD("mesh_surface_get_array_len"),&VisualServer::mesh_surface_get_array_len); ObjectTypeDB::bind_method(_MD("mesh_surface_get_array_index_len"),&VisualServer::mesh_surface_get_array_index_len); ObjectTypeDB::bind_method(_MD("mesh_surface_get_format"),&VisualServer::mesh_surface_get_format); ObjectTypeDB::bind_method(_MD("mesh_surface_get_primitive_type"),&VisualServer::mesh_surface_get_primitive_type); ObjectTypeDB::bind_method(_MD("mesh_remove_surface"),&VisualServer::mesh_remove_surface); ObjectTypeDB::bind_method(_MD("mesh_get_surface_count"),&VisualServer::mesh_get_surface_count); ObjectTypeDB::bind_method(_MD("multimesh_create"),&VisualServer::multimesh_create); ObjectTypeDB::bind_method(_MD("multimesh_set_mesh"),&VisualServer::multimesh_set_mesh); ObjectTypeDB::bind_method(_MD("multimesh_set_aabb"),&VisualServer::multimesh_set_aabb); ObjectTypeDB::bind_method(_MD("multimesh_instance_set_transform"),&VisualServer::multimesh_instance_set_transform); ObjectTypeDB::bind_method(_MD("multimesh_instance_set_color"),&VisualServer::multimesh_instance_set_color); ObjectTypeDB::bind_method(_MD("multimesh_get_mesh"),&VisualServer::multimesh_get_mesh); ObjectTypeDB::bind_method(_MD("multimesh_get_aabb"),&VisualServer::multimesh_get_aabb); ObjectTypeDB::bind_method(_MD("multimesh_instance_get_transform"),&VisualServer::multimesh_instance_get_transform); ObjectTypeDB::bind_method(_MD("multimesh_instance_get_color"),&VisualServer::multimesh_instance_get_color); ObjectTypeDB::bind_method(_MD("particles_create"),&VisualServer::particles_create); ObjectTypeDB::bind_method(_MD("particles_set_amount"),&VisualServer::particles_set_amount); ObjectTypeDB::bind_method(_MD("particles_get_amount"),&VisualServer::particles_get_amount); ObjectTypeDB::bind_method(_MD("particles_set_emitting"),&VisualServer::particles_set_emitting); ObjectTypeDB::bind_method(_MD("particles_is_emitting"),&VisualServer::particles_is_emitting); ObjectTypeDB::bind_method(_MD("particles_set_visibility_aabb"),&VisualServer::particles_set_visibility_aabb); ObjectTypeDB::bind_method(_MD("particles_get_visibility_aabb"),&VisualServer::particles_get_visibility_aabb); ObjectTypeDB::bind_method(_MD("particles_set_variable"),&VisualServer::particles_set_variable); ObjectTypeDB::bind_method(_MD("particles_get_variable"),&VisualServer::particles_get_variable); ObjectTypeDB::bind_method(_MD("particles_set_randomness"),&VisualServer::particles_set_randomness); ObjectTypeDB::bind_method(_MD("particles_get_randomness"),&VisualServer::particles_get_randomness); ObjectTypeDB::bind_method(_MD("particles_set_color_phases"),&VisualServer::particles_set_color_phases); ObjectTypeDB::bind_method(_MD("particles_get_color_phases"),&VisualServer::particles_get_color_phases); ObjectTypeDB::bind_method(_MD("particles_set_color_phase_pos"),&VisualServer::particles_set_color_phase_pos); ObjectTypeDB::bind_method(_MD("particles_get_color_phase_pos"),&VisualServer::particles_get_color_phase_pos); ObjectTypeDB::bind_method(_MD("particles_set_color_phase_color"),&VisualServer::particles_set_color_phase_color); ObjectTypeDB::bind_method(_MD("particles_get_color_phase_color"),&VisualServer::particles_get_color_phase_color); ObjectTypeDB::bind_method(_MD("particles_set_attractors"),&VisualServer::particles_set_attractors); ObjectTypeDB::bind_method(_MD("particles_get_attractors"),&VisualServer::particles_get_attractors); ObjectTypeDB::bind_method(_MD("particles_set_attractor_pos"),&VisualServer::particles_set_attractor_pos); ObjectTypeDB::bind_method(_MD("particles_get_attractor_pos"),&VisualServer::particles_get_attractor_pos); ObjectTypeDB::bind_method(_MD("particles_set_attractor_strength"),&VisualServer::particles_set_attractor_strength); ObjectTypeDB::bind_method(_MD("particles_get_attractor_strength"),&VisualServer::particles_get_attractor_strength); ObjectTypeDB::bind_method(_MD("particles_set_material"),&VisualServer::particles_set_material,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("particles_set_height_from_velocity"),&VisualServer::particles_set_height_from_velocity); ObjectTypeDB::bind_method(_MD("particles_has_height_from_velocity"),&VisualServer::particles_has_height_from_velocity); ObjectTypeDB::bind_method(_MD("light_create"),&VisualServer::light_create); ObjectTypeDB::bind_method(_MD("light_get_type"),&VisualServer::light_get_type); ObjectTypeDB::bind_method(_MD("light_set_color"),&VisualServer::light_set_color); ObjectTypeDB::bind_method(_MD("light_get_color"),&VisualServer::light_get_color); ObjectTypeDB::bind_method(_MD("light_set_shadow"),&VisualServer::light_set_shadow); ObjectTypeDB::bind_method(_MD("light_has_shadow"),&VisualServer::light_has_shadow); ObjectTypeDB::bind_method(_MD("light_set_volumetric"),&VisualServer::light_set_volumetric); ObjectTypeDB::bind_method(_MD("light_is_volumetric"),&VisualServer::light_is_volumetric); ObjectTypeDB::bind_method(_MD("light_set_projector"),&VisualServer::light_set_projector); ObjectTypeDB::bind_method(_MD("light_get_projector"),&VisualServer::light_get_projector); ObjectTypeDB::bind_method(_MD("light_set_var"),&VisualServer::light_set_param); ObjectTypeDB::bind_method(_MD("light_get_var"),&VisualServer::light_get_param); ObjectTypeDB::bind_method(_MD("skeleton_create"),&VisualServer::skeleton_create); ObjectTypeDB::bind_method(_MD("skeleton_resize"),&VisualServer::skeleton_resize); ObjectTypeDB::bind_method(_MD("skeleton_get_bone_count"),&VisualServer::skeleton_get_bone_count); ObjectTypeDB::bind_method(_MD("skeleton_bone_set_transform"),&VisualServer::skeleton_bone_set_transform); ObjectTypeDB::bind_method(_MD("skeleton_bone_get_transform"),&VisualServer::skeleton_bone_get_transform); ObjectTypeDB::bind_method(_MD("room_create"),&VisualServer::room_create); ObjectTypeDB::bind_method(_MD("room_set_bounds"),&VisualServer::room_set_bounds); ObjectTypeDB::bind_method(_MD("room_get_bounds"),&VisualServer::room_get_bounds); ObjectTypeDB::bind_method(_MD("portal_create"),&VisualServer::portal_create); ObjectTypeDB::bind_method(_MD("portal_set_shape"),&VisualServer::portal_set_shape); ObjectTypeDB::bind_method(_MD("portal_get_shape"),&VisualServer::portal_get_shape); ObjectTypeDB::bind_method(_MD("portal_set_enabled"),&VisualServer::portal_set_enabled); ObjectTypeDB::bind_method(_MD("portal_is_enabled"),&VisualServer::portal_is_enabled); ObjectTypeDB::bind_method(_MD("portal_set_disable_distance"),&VisualServer::portal_set_disable_distance); ObjectTypeDB::bind_method(_MD("portal_get_disable_distance"),&VisualServer::portal_get_disable_distance); ObjectTypeDB::bind_method(_MD("portal_set_disabled_color"),&VisualServer::portal_set_disabled_color); ObjectTypeDB::bind_method(_MD("portal_get_disabled_color"),&VisualServer::portal_get_disabled_color); ObjectTypeDB::bind_method(_MD("camera_create"),&VisualServer::camera_create); ObjectTypeDB::bind_method(_MD("camera_set_perspective"),&VisualServer::camera_set_perspective); ObjectTypeDB::bind_method(_MD("camera_set_orthogonal"),&VisualServer::_camera_set_orthogonal); ObjectTypeDB::bind_method(_MD("camera_set_transform"),&VisualServer::camera_set_transform); ObjectTypeDB::bind_method(_MD("viewport_create"),&VisualServer::viewport_create); ObjectTypeDB::bind_method(_MD("viewport_set_rect"),&VisualServer::_viewport_set_rect); ObjectTypeDB::bind_method(_MD("viewport_get_rect"),&VisualServer::_viewport_get_rect); ObjectTypeDB::bind_method(_MD("viewport_attach_camera"),&VisualServer::viewport_attach_camera,DEFVAL(RID())); ObjectTypeDB::bind_method(_MD("viewport_get_attached_camera"),&VisualServer::viewport_get_attached_camera); ObjectTypeDB::bind_method(_MD("viewport_get_scenario"),&VisualServer::viewport_get_scenario); ObjectTypeDB::bind_method(_MD("viewport_attach_canvas"),&VisualServer::viewport_attach_canvas); ObjectTypeDB::bind_method(_MD("viewport_remove_canvas"),&VisualServer::viewport_remove_canvas); ObjectTypeDB::bind_method(_MD("viewport_set_global_canvas_transform"),&VisualServer::viewport_set_global_canvas_transform); ObjectTypeDB::bind_method(_MD("scenario_create"),&VisualServer::scenario_create); ObjectTypeDB::bind_method(_MD("scenario_set_debug"),&VisualServer::scenario_set_debug); ObjectTypeDB::bind_method(_MD("instance_create"),&VisualServer::instance_create,DEFVAL(RID())); ObjectTypeDB::bind_method(_MD("instance_get_base"),&VisualServer::instance_get_base); ObjectTypeDB::bind_method(_MD("instance_get_base_aabb"),&VisualServer::instance_get_base); ObjectTypeDB::bind_method(_MD("instance_set_transform"),&VisualServer::instance_set_transform); ObjectTypeDB::bind_method(_MD("instance_get_transform"),&VisualServer::instance_get_transform); ObjectTypeDB::bind_method(_MD("instance_attach_object_instance_ID"),&VisualServer::instance_attach_object_instance_ID); ObjectTypeDB::bind_method(_MD("instance_get_object_instance_ID"),&VisualServer::instance_get_object_instance_ID); ObjectTypeDB::bind_method(_MD("instance_attach_skeleton"),&VisualServer::instance_attach_skeleton); ObjectTypeDB::bind_method(_MD("instance_get_skeleton"),&VisualServer::instance_get_skeleton); ObjectTypeDB::bind_method(_MD("instance_set_room"),&VisualServer::instance_set_room); ObjectTypeDB::bind_method(_MD("instance_get_room"),&VisualServer::instance_get_room); ObjectTypeDB::bind_method(_MD("instance_set_exterior"),&VisualServer::instance_set_exterior); ObjectTypeDB::bind_method(_MD("instance_is_exterior"),&VisualServer::instance_is_exterior); ObjectTypeDB::bind_method(_MD("instances_cull_aabb"),&VisualServer::instances_cull_aabb); ObjectTypeDB::bind_method(_MD("instances_cull_ray"),&VisualServer::instances_cull_ray); ObjectTypeDB::bind_method(_MD("instances_cull_convex"),&VisualServer::instances_cull_ray); ObjectTypeDB::bind_method(_MD("instance_geometry_override_material_param"),&VisualServer::instance_get_room); ObjectTypeDB::bind_method(_MD("instance_geometry_get_material_param"),&VisualServer::instance_get_room); ObjectTypeDB::bind_method(_MD("get_test_cube"),&VisualServer::get_test_cube); #endif ObjectTypeDB::bind_method(_MD("canvas_create"),&VisualServer::canvas_create); ObjectTypeDB::bind_method(_MD("canvas_item_create"),&VisualServer::canvas_item_create); ObjectTypeDB::bind_method(_MD("canvas_item_set_parent"),&VisualServer::canvas_item_set_parent); ObjectTypeDB::bind_method(_MD("canvas_item_get_parent"),&VisualServer::canvas_item_get_parent); ObjectTypeDB::bind_method(_MD("canvas_item_set_transform"),&VisualServer::canvas_item_set_transform); ObjectTypeDB::bind_method(_MD("canvas_item_set_custom_rect"),&VisualServer::canvas_item_set_custom_rect); ObjectTypeDB::bind_method(_MD("canvas_item_set_clip"),&VisualServer::canvas_item_set_clip); ObjectTypeDB::bind_method(_MD("canvas_item_set_opacity"),&VisualServer::canvas_item_set_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_get_opacity"),&VisualServer::canvas_item_get_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_set_self_opacity"),&VisualServer::canvas_item_set_self_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_get_self_opacity"),&VisualServer::canvas_item_get_self_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_add_line"),&VisualServer::canvas_item_add_line, DEFVAL(1.0)); ObjectTypeDB::bind_method(_MD("canvas_item_add_rect"),&VisualServer::canvas_item_add_rect); ObjectTypeDB::bind_method(_MD("canvas_item_add_texture_rect"),&VisualServer::canvas_item_add_texture_rect, DEFVAL(Color(1,1,1))); ObjectTypeDB::bind_method(_MD("canvas_item_add_texture_rect_region"),&VisualServer::canvas_item_add_texture_rect_region, DEFVAL(Color(1,1,1))); ObjectTypeDB::bind_method(_MD("canvas_item_add_style_box"),&VisualServer::_canvas_item_add_style_box, DEFVAL(Color(1,1,1))); // ObjectTypeDB::bind_method(_MD("canvas_item_add_primitive"),&VisualServer::canvas_item_add_primitive,DEFVAL(Vector<Vector2>()),DEFVAL(RID())); ObjectTypeDB::bind_method(_MD("canvas_item_add_circle"),&VisualServer::canvas_item_add_circle); ObjectTypeDB::bind_method(_MD("viewport_set_canvas_transform"),&VisualServer::viewport_set_canvas_transform); ObjectTypeDB::bind_method(_MD("canvas_item_clear"),&VisualServer::canvas_item_clear); ObjectTypeDB::bind_method(_MD("canvas_item_raise"),&VisualServer::canvas_item_raise); ObjectTypeDB::bind_method(_MD("cursor_set_rotation"),&VisualServer::cursor_set_rotation); ObjectTypeDB::bind_method(_MD("cursor_set_texture"),&VisualServer::cursor_set_texture); ObjectTypeDB::bind_method(_MD("cursor_set_visible"),&VisualServer::cursor_set_visible); ObjectTypeDB::bind_method(_MD("cursor_set_pos"),&VisualServer::cursor_set_pos); ObjectTypeDB::bind_method(_MD("black_bars_set_margins","left","top","right","bottom"),&VisualServer::black_bars_set_margins); ObjectTypeDB::bind_method(_MD("make_sphere_mesh"),&VisualServer::make_sphere_mesh); ObjectTypeDB::bind_method(_MD("mesh_add_surface_from_planes"),&VisualServer::mesh_add_surface_from_planes); ObjectTypeDB::bind_method(_MD("draw"),&VisualServer::draw); ObjectTypeDB::bind_method(_MD("free"),&VisualServer::free); ObjectTypeDB::bind_method(_MD("set_default_clear_color"),&VisualServer::set_default_clear_color); ObjectTypeDB::bind_method(_MD("get_render_info"),&VisualServer::get_render_info); BIND_CONSTANT( NO_INDEX_ARRAY ); BIND_CONSTANT( CUSTOM_ARRAY_SIZE ); BIND_CONSTANT( ARRAY_WEIGHTS_SIZE ); BIND_CONSTANT( MAX_PARTICLE_COLOR_PHASES ); BIND_CONSTANT( MAX_PARTICLE_ATTRACTORS ); BIND_CONSTANT( MAX_CURSORS ); BIND_CONSTANT( TEXTURE_FLAG_MIPMAPS ); BIND_CONSTANT( TEXTURE_FLAG_REPEAT ); BIND_CONSTANT( TEXTURE_FLAG_FILTER ); BIND_CONSTANT( TEXTURE_FLAG_CUBEMAP ); BIND_CONSTANT( TEXTURE_FLAGS_DEFAULT ); BIND_CONSTANT( CUBEMAP_LEFT ); BIND_CONSTANT( CUBEMAP_RIGHT ); BIND_CONSTANT( CUBEMAP_BOTTOM ); BIND_CONSTANT( CUBEMAP_TOP ); BIND_CONSTANT( CUBEMAP_FRONT ); BIND_CONSTANT( CUBEMAP_BACK ); BIND_CONSTANT( SHADER_MATERIAL ); ///< param 0: name BIND_CONSTANT( SHADER_POST_PROCESS ); ///< param 0: name BIND_CONSTANT( MATERIAL_FLAG_VISIBLE ); BIND_CONSTANT( MATERIAL_FLAG_DOUBLE_SIDED ); BIND_CONSTANT( MATERIAL_FLAG_INVERT_FACES ); BIND_CONSTANT( MATERIAL_FLAG_UNSHADED ); BIND_CONSTANT( MATERIAL_FLAG_ONTOP ); BIND_CONSTANT( MATERIAL_FLAG_WIREFRAME ); BIND_CONSTANT( MATERIAL_FLAG_BILLBOARD ); BIND_CONSTANT( MATERIAL_FLAG_MAX ); BIND_CONSTANT( MATERIAL_BLEND_MODE_MIX ); BIND_CONSTANT( MATERIAL_BLEND_MODE_ADD ); BIND_CONSTANT( MATERIAL_BLEND_MODE_SUB ); BIND_CONSTANT( MATERIAL_BLEND_MODE_MUL ); BIND_CONSTANT( FIXED_MATERIAL_PARAM_DIFFUSE ); BIND_CONSTANT( FIXED_MATERIAL_PARAM_DETAIL ); BIND_CONSTANT( FIXED_MATERIAL_PARAM_SPECULAR ); BIND_CONSTANT( FIXED_MATERIAL_PARAM_EMISSION ); BIND_CONSTANT( FIXED_MATERIAL_PARAM_SPECULAR_EXP ); BIND_CONSTANT( FIXED_MATERIAL_PARAM_GLOW ); BIND_CONSTANT( FIXED_MATERIAL_PARAM_NORMAL ); BIND_CONSTANT( FIXED_MATERIAL_PARAM_SHADE_PARAM ); BIND_CONSTANT( FIXED_MATERIAL_PARAM_MAX ); BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_SPHERE ); BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_UV ); BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_UV_TRANSFORM ); BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_UV2 ); BIND_CONSTANT( ARRAY_VERTEX ); BIND_CONSTANT( ARRAY_NORMAL ); BIND_CONSTANT( ARRAY_TANGENT ); BIND_CONSTANT( ARRAY_COLOR ); BIND_CONSTANT( ARRAY_TEX_UV ); BIND_CONSTANT( ARRAY_BONES ); BIND_CONSTANT( ARRAY_WEIGHTS ); BIND_CONSTANT( ARRAY_INDEX ); BIND_CONSTANT( ARRAY_MAX ); BIND_CONSTANT( ARRAY_FORMAT_VERTEX ); BIND_CONSTANT( ARRAY_FORMAT_NORMAL ); BIND_CONSTANT( ARRAY_FORMAT_TANGENT ); BIND_CONSTANT( ARRAY_FORMAT_COLOR ); BIND_CONSTANT( ARRAY_FORMAT_TEX_UV ); BIND_CONSTANT( ARRAY_FORMAT_BONES ); BIND_CONSTANT( ARRAY_FORMAT_WEIGHTS ); BIND_CONSTANT( ARRAY_FORMAT_INDEX ); BIND_CONSTANT( PRIMITIVE_POINTS ); BIND_CONSTANT( PRIMITIVE_LINES ); BIND_CONSTANT( PRIMITIVE_LINE_STRIP ); BIND_CONSTANT( PRIMITIVE_LINE_LOOP ); BIND_CONSTANT( PRIMITIVE_TRIANGLES ); BIND_CONSTANT( PRIMITIVE_TRIANGLE_STRIP ); BIND_CONSTANT( PRIMITIVE_TRIANGLE_FAN ); BIND_CONSTANT( PRIMITIVE_MAX ); BIND_CONSTANT( PARTICLE_LIFETIME ); BIND_CONSTANT( PARTICLE_SPREAD ); BIND_CONSTANT( PARTICLE_GRAVITY ); BIND_CONSTANT( PARTICLE_LINEAR_VELOCITY ); BIND_CONSTANT( PARTICLE_ANGULAR_VELOCITY ); BIND_CONSTANT( PARTICLE_LINEAR_ACCELERATION ); BIND_CONSTANT( PARTICLE_RADIAL_ACCELERATION ); BIND_CONSTANT( PARTICLE_TANGENTIAL_ACCELERATION ); BIND_CONSTANT( PARTICLE_INITIAL_SIZE ); BIND_CONSTANT( PARTICLE_FINAL_SIZE ); BIND_CONSTANT( PARTICLE_INITIAL_ANGLE ); BIND_CONSTANT( PARTICLE_HEIGHT ); BIND_CONSTANT( PARTICLE_HEIGHT_SPEED_SCALE ); BIND_CONSTANT( PARTICLE_VAR_MAX ); BIND_CONSTANT( LIGHT_DIRECTIONAL ); BIND_CONSTANT( LIGHT_OMNI ); BIND_CONSTANT( LIGHT_SPOT ); BIND_CONSTANT( LIGHT_COLOR_AMBIENT ); BIND_CONSTANT( LIGHT_COLOR_DIFFUSE ); BIND_CONSTANT( LIGHT_COLOR_SPECULAR ); BIND_CONSTANT( LIGHT_PARAM_SPOT_ATTENUATION ); BIND_CONSTANT( LIGHT_PARAM_SPOT_ANGLE ); BIND_CONSTANT( LIGHT_PARAM_RADIUS ); BIND_CONSTANT( LIGHT_PARAM_ENERGY ); BIND_CONSTANT( LIGHT_PARAM_ATTENUATION ); BIND_CONSTANT( LIGHT_PARAM_MAX ); BIND_CONSTANT( SCENARIO_DEBUG_DISABLED ); BIND_CONSTANT( SCENARIO_DEBUG_WIREFRAME ); BIND_CONSTANT( SCENARIO_DEBUG_OVERDRAW ); BIND_CONSTANT( INSTANCE_MESH ); BIND_CONSTANT( INSTANCE_MULTIMESH ); BIND_CONSTANT( INSTANCE_PARTICLES ); BIND_CONSTANT( INSTANCE_LIGHT ); BIND_CONSTANT( INSTANCE_ROOM ); BIND_CONSTANT( INSTANCE_PORTAL ); BIND_CONSTANT( INSTANCE_GEOMETRY_MASK ); BIND_CONSTANT( INFO_OBJECTS_IN_FRAME ); BIND_CONSTANT( INFO_VERTICES_IN_FRAME ); BIND_CONSTANT( INFO_MATERIAL_CHANGES_IN_FRAME ); BIND_CONSTANT( INFO_SHADER_CHANGES_IN_FRAME ); BIND_CONSTANT( INFO_SURFACE_CHANGES_IN_FRAME ); BIND_CONSTANT( INFO_DRAW_CALLS_IN_FRAME ); BIND_CONSTANT( INFO_USAGE_VIDEO_MEM_TOTAL ); BIND_CONSTANT( INFO_VIDEO_MEM_USED ); BIND_CONSTANT( INFO_TEXTURE_MEM_USED ); BIND_CONSTANT( INFO_VERTEX_MEM_USED ); }
void GridMapEditor::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { theme_pallete->connect("item_selected", this,"_item_selected_cbk"); edit_mode->connect("item_selected", this,"_edit_mode_changed"); area_list->connect("item_edited", this,"_area_renamed"); area_list->connect("item_selected", this,"_area_selected"); for(int i=0;i<3;i++) { grid[i]=VS::get_singleton()->mesh_create(); grid_instance[i]=VS::get_singleton()->instance_create2(grid[i],get_tree()->get_root()->get_world()->get_scenario()); } selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh,get_tree()->get_root()->get_world()->get_scenario()); duplicate_instance = VisualServer::get_singleton()->instance_create2(duplicate_mesh,get_tree()->get_root()->get_world()->get_scenario()); _update_selection_transform(); _update_duplicate_indicator(); } else if (p_what==NOTIFICATION_EXIT_TREE) { for(int i=0;i<3;i++) { VS::get_singleton()->free(grid_instance[i]); VS::get_singleton()->free(grid[i]); grid_instance[i]=RID(); grid[i]=RID(); } VisualServer::get_singleton()->free(selection_instance); VisualServer::get_singleton()->free(duplicate_instance); selection_instance=RID(); duplicate_instance=RID(); } else if (p_what==NOTIFICATION_PROCESS) { Transform xf = node->get_global_transform(); if (xf!=grid_xform) { for(int i=0;i<3;i++) { VS::get_singleton()->instance_set_transform(grid_instance[i],xf * edit_grid_xform); } grid_xform=xf; } Ref<MeshLibrary> cgmt = node->get_theme(); if (cgmt.operator->()!=last_theme) update_pallete(); if (lock_view) { EditorNode*editor = get_tree()->get_root()->get_child(0)->cast_to<EditorNode>(); Plane p; p.normal[edit_axis]=1.0; p.d=edit_floor[edit_axis]*node->get_cell_size(); p = node->get_transform().xform(p); // plane to snap SpatialEditorPlugin *sep = editor->get_editor_plugin_screen()->cast_to<SpatialEditorPlugin>(); if (sep) sep->snap_cursor_to_plane(p); //editor->get_editor_plugin_screen()->call("snap_cursor_to_plane",p); } } }
RID RasterizerSceneGLES2::environment_create() { return RID(); }
void Physics2DServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("shape_create","type"),&Physics2DServer::shape_create); ObjectTypeDB::bind_method(_MD("shape_set_data","shape","data"),&Physics2DServer::shape_set_data); ObjectTypeDB::bind_method(_MD("shape_get_type","shape"),&Physics2DServer::shape_get_type); ObjectTypeDB::bind_method(_MD("shape_get_data","shape"),&Physics2DServer::shape_get_data); ObjectTypeDB::bind_method(_MD("space_create"),&Physics2DServer::space_create); ObjectTypeDB::bind_method(_MD("space_set_active","space","active"),&Physics2DServer::space_set_active); ObjectTypeDB::bind_method(_MD("space_is_active","space"),&Physics2DServer::space_is_active); ObjectTypeDB::bind_method(_MD("space_set_param","space","param","value"),&Physics2DServer::space_set_param); ObjectTypeDB::bind_method(_MD("space_get_param","space","param"),&Physics2DServer::space_get_param); ObjectTypeDB::bind_method(_MD("space_get_direct_state:Physics2DDirectSpaceState","space"),&Physics2DServer::space_get_direct_state); ObjectTypeDB::bind_method(_MD("area_create"),&Physics2DServer::area_create); ObjectTypeDB::bind_method(_MD("area_set_space","area","space"),&Physics2DServer::area_set_space); ObjectTypeDB::bind_method(_MD("area_get_space","area"),&Physics2DServer::area_get_space); ObjectTypeDB::bind_method(_MD("area_set_space_override_mode","area","mode"),&Physics2DServer::area_set_space_override_mode); ObjectTypeDB::bind_method(_MD("area_get_space_override_mode","area"),&Physics2DServer::area_get_space_override_mode); ObjectTypeDB::bind_method(_MD("area_add_shape","area","shape","transform"),&Physics2DServer::area_add_shape,DEFVAL(Matrix32())); ObjectTypeDB::bind_method(_MD("area_set_shape","area","shape_idx","shape"),&Physics2DServer::area_set_shape); ObjectTypeDB::bind_method(_MD("area_set_shape_transform","area","shape_idx","transform"),&Physics2DServer::area_set_shape_transform); ObjectTypeDB::bind_method(_MD("area_get_shape_count","area"),&Physics2DServer::area_get_shape_count); ObjectTypeDB::bind_method(_MD("area_get_shape","area","shape_idx"),&Physics2DServer::area_get_shape); ObjectTypeDB::bind_method(_MD("area_get_shape_transform","area","shape_idx"),&Physics2DServer::area_get_shape_transform); ObjectTypeDB::bind_method(_MD("area_remove_shape","area","shape_idx"),&Physics2DServer::area_remove_shape); ObjectTypeDB::bind_method(_MD("area_clear_shapes","area"),&Physics2DServer::area_clear_shapes); ObjectTypeDB::bind_method(_MD("area_set_param","area","param","value"),&Physics2DServer::area_set_param); ObjectTypeDB::bind_method(_MD("area_set_transform","area","transform"),&Physics2DServer::area_set_transform); ObjectTypeDB::bind_method(_MD("area_get_param","area","param"),&Physics2DServer::area_get_param); ObjectTypeDB::bind_method(_MD("area_get_transform","area"),&Physics2DServer::area_get_transform); ObjectTypeDB::bind_method(_MD("area_attach_object_instance_ID","area","id"),&Physics2DServer::area_attach_object_instance_ID); ObjectTypeDB::bind_method(_MD("area_get_object_instance_ID","area"),&Physics2DServer::area_get_object_instance_ID); ObjectTypeDB::bind_method(_MD("area_set_monitor_callback","receiver","method"),&Physics2DServer::area_set_monitor_callback); ObjectTypeDB::bind_method(_MD("body_create","mode","init_sleeping"),&Physics2DServer::body_create,DEFVAL(BODY_MODE_RIGID),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("body_set_space","body","space"),&Physics2DServer::body_set_space); ObjectTypeDB::bind_method(_MD("body_get_space","body"),&Physics2DServer::body_get_space); ObjectTypeDB::bind_method(_MD("body_set_mode","body","mode"),&Physics2DServer::body_set_mode); ObjectTypeDB::bind_method(_MD("body_get_mode","body"),&Physics2DServer::body_get_mode); ObjectTypeDB::bind_method(_MD("body_add_shape","body","shape","transform"),&Physics2DServer::body_add_shape,DEFVAL(Matrix32())); ObjectTypeDB::bind_method(_MD("body_set_shape","body","shape_idx","shape"),&Physics2DServer::body_set_shape); ObjectTypeDB::bind_method(_MD("body_set_shape_transform","body","shape_idx","transform"),&Physics2DServer::body_set_shape_transform); ObjectTypeDB::bind_method(_MD("body_set_shape_metadata","body","shape_idx","metadata"),&Physics2DServer::body_set_shape_metadata); ObjectTypeDB::bind_method(_MD("body_get_shape_count","body"),&Physics2DServer::body_get_shape_count); ObjectTypeDB::bind_method(_MD("body_get_shape","body","shape_idx"),&Physics2DServer::body_get_shape); ObjectTypeDB::bind_method(_MD("body_get_shape_transform","body","shape_idx"),&Physics2DServer::body_get_shape_transform); ObjectTypeDB::bind_method(_MD("body_get_shape_metadata","body","shape_idx"),&Physics2DServer::body_get_shape_metadata); ObjectTypeDB::bind_method(_MD("body_remove_shape","body","shape_idx"),&Physics2DServer::body_remove_shape); ObjectTypeDB::bind_method(_MD("body_clear_shapes","body"),&Physics2DServer::body_clear_shapes); ObjectTypeDB::bind_method(_MD("body_set_shape_as_trigger","body","shape_idx","enable"),&Physics2DServer::body_set_shape_as_trigger); ObjectTypeDB::bind_method(_MD("body_is_shape_set_as_trigger","body","shape_idx"),&Physics2DServer::body_is_shape_set_as_trigger); ObjectTypeDB::bind_method(_MD("body_attach_object_instance_ID","body","id"),&Physics2DServer::body_attach_object_instance_ID); ObjectTypeDB::bind_method(_MD("body_get_object_instance_ID","body"),&Physics2DServer::body_get_object_instance_ID); ObjectTypeDB::bind_method(_MD("body_set_continuous_collision_detection_mode","body","mode"),&Physics2DServer::body_set_continuous_collision_detection_mode); ObjectTypeDB::bind_method(_MD("body_get_continuous_collision_detection_mode","body"),&Physics2DServer::body_get_continuous_collision_detection_mode); ObjectTypeDB::bind_method(_MD("body_set_layer_mask","body","mask"),&Physics2DServer::body_set_layer_mask); ObjectTypeDB::bind_method(_MD("body_get_layer_mask","body"),&Physics2DServer::body_get_layer_mask); ObjectTypeDB::bind_method(_MD("body_set_user_mask","body","mask"),&Physics2DServer::body_set_user_mask); ObjectTypeDB::bind_method(_MD("body_get_user_mask","body"),&Physics2DServer::body_get_user_mask); ObjectTypeDB::bind_method(_MD("body_set_param","body","param","value"),&Physics2DServer::body_set_param); ObjectTypeDB::bind_method(_MD("body_get_param","body","param"),&Physics2DServer::body_get_param); ObjectTypeDB::bind_method(_MD("body_set_state","body","state","value"),&Physics2DServer::body_set_state); ObjectTypeDB::bind_method(_MD("body_get_state","body","state"),&Physics2DServer::body_get_state); ObjectTypeDB::bind_method(_MD("body_apply_impulse","body","pos","impulse"),&Physics2DServer::body_apply_impulse); ObjectTypeDB::bind_method(_MD("body_set_axis_velocity","body","axis_velocity"),&Physics2DServer::body_set_axis_velocity); ObjectTypeDB::bind_method(_MD("body_add_collision_exception","body","excepted_body"),&Physics2DServer::body_add_collision_exception); ObjectTypeDB::bind_method(_MD("body_remove_collision_exception","body","excepted_body"),&Physics2DServer::body_remove_collision_exception); // virtual void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions)=0; ObjectTypeDB::bind_method(_MD("body_set_max_contacts_reported","body","amount"),&Physics2DServer::body_set_max_contacts_reported); ObjectTypeDB::bind_method(_MD("body_get_max_contacts_reported","body"),&Physics2DServer::body_get_max_contacts_reported); ObjectTypeDB::bind_method(_MD("body_set_one_way_collision_direction","normal"),&Physics2DServer::body_set_one_way_collision_direction); ObjectTypeDB::bind_method(_MD("body_get_one_way_collision_direction"),&Physics2DServer::body_get_one_way_collision_direction); ObjectTypeDB::bind_method(_MD("body_set_one_way_collision_max_depth","normal"),&Physics2DServer::body_set_one_way_collision_max_depth); ObjectTypeDB::bind_method(_MD("body_get_one_way_collision_max_depth"),&Physics2DServer::body_get_one_way_collision_max_depth); ObjectTypeDB::bind_method(_MD("body_set_omit_force_integration","body","enable"),&Physics2DServer::body_set_omit_force_integration); ObjectTypeDB::bind_method(_MD("body_is_omitting_force_integration","body"),&Physics2DServer::body_is_omitting_force_integration); ObjectTypeDB::bind_method(_MD("body_set_force_integration_callback","body","receiver","method"),&Physics2DServer::body_set_force_integration_callback); /* JOINT API */ ObjectTypeDB::bind_method(_MD("joint_set_param","joint","param","value"),&Physics2DServer::joint_set_param); ObjectTypeDB::bind_method(_MD("joint_get_param","joint","param"),&Physics2DServer::joint_get_param); ObjectTypeDB::bind_method(_MD("pin_joint_create","anchor","body_a","body_b"),&Physics2DServer::pin_joint_create,DEFVAL(RID())); ObjectTypeDB::bind_method(_MD("groove_joint_create","groove1_a","groove2_a","anchor_b","body_a","body_b"),&Physics2DServer::groove_joint_create,DEFVAL(RID()),DEFVAL(RID())); ObjectTypeDB::bind_method(_MD("damped_spring_joint_create","anchor_a","anchor_b","body_a","body_b"),&Physics2DServer::damped_spring_joint_create,DEFVAL(RID())); ObjectTypeDB::bind_method(_MD("damped_string_joint_set_param","joint","param","value"),&Physics2DServer::damped_string_joint_set_param,DEFVAL(RID())); ObjectTypeDB::bind_method(_MD("damped_string_joint_get_param","joint","param"),&Physics2DServer::damped_string_joint_get_param); ObjectTypeDB::bind_method(_MD("joint_get_type","joint"),&Physics2DServer::joint_get_type); ObjectTypeDB::bind_method(_MD("free_rid","rid"),&Physics2DServer::free); ObjectTypeDB::bind_method(_MD("set_active","active"),&Physics2DServer::set_active); ObjectTypeDB::bind_method(_MD("get_process_info"),&Physics2DServer::get_process_info); // ObjectTypeDB::bind_method(_MD("init"),&Physics2DServer::init); // ObjectTypeDB::bind_method(_MD("step"),&Physics2DServer::step); // ObjectTypeDB::bind_method(_MD("sync"),&Physics2DServer::sync); //ObjectTypeDB::bind_method(_MD("flush_queries"),&Physics2DServer::flush_queries); BIND_CONSTANT( SHAPE_LINE ); BIND_CONSTANT( SHAPE_SEGMENT ); BIND_CONSTANT( SHAPE_CIRCLE ); BIND_CONSTANT( SHAPE_RECTANGLE ); BIND_CONSTANT( SHAPE_CAPSULE ); BIND_CONSTANT( SHAPE_CONVEX_POLYGON ); BIND_CONSTANT( SHAPE_CONCAVE_POLYGON ); BIND_CONSTANT( SHAPE_CUSTOM ); BIND_CONSTANT( AREA_PARAM_GRAVITY ); BIND_CONSTANT( AREA_PARAM_GRAVITY_VECTOR ); BIND_CONSTANT( AREA_PARAM_GRAVITY_IS_POINT ); BIND_CONSTANT( AREA_PARAM_GRAVITY_POINT_ATTENUATION ); BIND_CONSTANT( AREA_PARAM_LINEAR_DAMP); BIND_CONSTANT( AREA_PARAM_ANGULAR_DAMP); BIND_CONSTANT( AREA_PARAM_PRIORITY ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_DISABLED ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE ); BIND_CONSTANT( BODY_MODE_STATIC ); BIND_CONSTANT( BODY_MODE_KINEMATIC ); BIND_CONSTANT( BODY_MODE_RIGID ); BIND_CONSTANT( BODY_MODE_CHARACTER ); BIND_CONSTANT( BODY_PARAM_BOUNCE ); BIND_CONSTANT( BODY_PARAM_FRICTION ); BIND_CONSTANT( BODY_PARAM_MASS ); BIND_CONSTANT( BODY_PARAM_GRAVITY_SCALE ); BIND_CONSTANT( BODY_PARAM_LINEAR_DAMP); BIND_CONSTANT( BODY_PARAM_ANGULAR_DAMP); BIND_CONSTANT( BODY_PARAM_MAX ); BIND_CONSTANT( BODY_STATE_TRANSFORM ); BIND_CONSTANT( BODY_STATE_LINEAR_VELOCITY ); BIND_CONSTANT( BODY_STATE_ANGULAR_VELOCITY ); BIND_CONSTANT( BODY_STATE_SLEEPING ); BIND_CONSTANT( BODY_STATE_CAN_SLEEP ); BIND_CONSTANT( JOINT_PIN ); BIND_CONSTANT( JOINT_GROOVE ); BIND_CONSTANT( JOINT_DAMPED_SPRING ); BIND_CONSTANT( DAMPED_STRING_REST_LENGTH ); BIND_CONSTANT( DAMPED_STRING_STIFFNESS ); BIND_CONSTANT( DAMPED_STRING_DAMPING ); BIND_CONSTANT( CCD_MODE_DISABLED ); BIND_CONSTANT( CCD_MODE_CAST_RAY ); BIND_CONSTANT( CCD_MODE_CAST_SHAPE ); // BIND_CONSTANT( TYPE_BODY ); // BIND_CONSTANT( TYPE_AREA ); BIND_CONSTANT( AREA_BODY_ADDED ); BIND_CONSTANT( AREA_BODY_REMOVED ); BIND_CONSTANT( INFO_ACTIVE_OBJECTS ); BIND_CONSTANT( INFO_COLLISION_PAIRS ); BIND_CONSTANT( INFO_ISLAND_COUNT ); }
RID RasterizerSceneGLES2::light_instance_create(RID p_light) { return RID(); }
RID Resource::get_rid() const { return RID(); }
RID RasterizerSceneGLES2::gi_probe_instance_create() { return RID(); }
void ImmediateGeometry::begin(Mesh::PrimitiveType p_primitive,const Ref<Texture>& p_texture) { VS::get_singleton()->immediate_begin(im,(VS::PrimitiveType)p_primitive,p_texture.is_valid()?p_texture->get_rid():RID()); if (p_texture.is_valid()) cached_textures.push_back(p_texture); }
RID RasterizerSceneGLES2::shadow_atlas_create() { return RID(); }
void Viewport::_notification(int p_what) { switch( p_what ) { case NOTIFICATION_ENTER_SCENE: { if (!render_target) _vp_enter_scene(); this->parent=NULL; Node *parent=get_parent(); if (parent) { while(parent && !(this->parent=parent->cast_to<Viewport>())) { parent=parent->get_parent(); } } current_canvas=find_world_2d()->get_canvas(); VisualServer::get_singleton()->viewport_set_scenario(viewport,find_world()->get_scenario()); VisualServer::get_singleton()->viewport_attach_canvas(viewport,current_canvas); _update_listener(); _update_listener_2d(); _update_rect(); if (world_2d.is_valid()) { find_world_2d()->_register_viewport(this,Rect2()); //best to defer this and not do it here, as it can annoy a lot of setup logic if user //adds a node and then moves it, will get enter/exit screen/viewport notifications //unnecesarily // update_worlds(); } add_to_group("_viewports"); } break; case NOTIFICATION_READY: { #ifndef _3D_DISABLED if (cameras.size() && !camera) { //there are cameras but no current camera, pick first in tree and make it current Camera *first=NULL; for(Set<Camera*>::Element *E=cameras.front();E;E=E->next()) { if (first==NULL || first->is_greater_than(E->get())) { first=E->get(); } } if (first) first->make_current(); } #endif } break; case NOTIFICATION_EXIT_SCENE: { if (world_2d.is_valid()) world_2d->_remove_viewport(this); if (!render_target) _vp_exit_scene(); VisualServer::get_singleton()->viewport_set_scenario(viewport,RID()); SpatialSoundServer::get_singleton()->listener_set_space(listener,RID()); VisualServer::get_singleton()->viewport_remove_canvas(viewport,current_canvas); remove_from_group("_viewports"); } break; } }
RID RasterizerSceneGLES2::reflection_atlas_create() { return RID(); }
RES ResourceFormatLoaderShader::load(const String &p_path, const String& p_original_path, Error *r_error) { if (r_error) *r_error=ERR_FILE_CANT_OPEN; String fragment_code; String vertex_code; String light_code; int mode=-1; Error err; FileAccess *f = FileAccess::open(p_path,FileAccess::READ,&err); ERR_EXPLAIN("Unable to open shader file: "+p_path); ERR_FAIL_COND_V(err,RES()); String base_path = p_path.get_base_dir(); if (r_error) *r_error=ERR_FILE_CORRUPT; Ref<Shader> shader;//( memnew( Shader ) ); int line=0; while(!f->eof_reached()) { String l = f->get_line(); line++; if (mode<=0) { l = l.strip_edges(); int comment = l.find(";"); if (comment!=-1) l=l.substr(0,comment); } if (mode<1) vertex_code+="\n"; if (mode<2) fragment_code+="\n"; if (mode < 1 && l=="") continue; if (l.begins_with("[")) { l=l.strip_edges(); if (l=="[params]") { if (mode>=0) { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Misplaced [params] section."); ERR_FAIL_V(RES()); } mode=0; } else if (l=="[vertex]") { if (mode>=1) { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Misplaced [vertex] section."); ERR_FAIL_V(RES()); } mode=1; } else if (l=="[fragment]") { if (mode>=2) { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Misplaced [fragment] section."); ERR_FAIL_V(RES()); } mode=1; } else { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Unknown section type: '"+l+"'."); ERR_FAIL_V(RES()); } continue; } if (mode==0) { int eqpos = l.find("="); if (eqpos==-1) { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Expected '='."); ERR_FAIL_V(RES()); } String right=l.substr(eqpos+1,l.length()).strip_edges(); if (right=="") { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Expected value after '='."); ERR_FAIL_V(RES()); } Variant value; if (right=="true") { value = true; } else if (right=="false") { value = false; } else if (right.is_valid_float()) { //is number value = right.to_double(); } else if (right.is_valid_html_color()) { //is html color value = Color::html(right); } else { //attempt to parse a constructor int popenpos = right.find("("); if (popenpos==-1) { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Invalid constructor syntax: "+right); ERR_FAIL_V(RES()); } int pclosepos = right.find_last(")"); if (pclosepos==-1) { ERR_EXPLAIN(p_path+":"+itos(line)+": Invalid constructor parameter syntax: "+right); ERR_FAIL_V(RES()); } String type = right.substr(0,popenpos); String param = right.substr(popenpos+1,pclosepos-popenpos-1).strip_edges(); if (type=="tex") { if (param=="") { value=RID(); } else { String path; if (param.is_abs_path()) path=param; else path=base_path+"/"+param; Ref<Texture> texture = ResourceLoader::load(path); if (!texture.is_valid()) { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Couldn't find icon at path: "+path); ERR_FAIL_V(RES()); } value=texture; } } else if (type=="vec3") { if (param=="") { value=Vector3(); } else { Vector<String> params = param.split(","); if (params.size()!=3) { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Invalid param count for vec3(): '"+right+"'."); ERR_FAIL_V(RES()); } Vector3 v; for(int i=0;i<3;i++) v[i]=params[i].to_double(); value=v; } } else if (type=="xform") { if (param=="") { value=Transform(); } else { Vector<String> params = param.split(","); if (params.size()!=12) { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Invalid param count for xform(): '"+right+"'."); ERR_FAIL_V(RES()); } Transform t; for(int i=0;i<9;i++) t.basis[i%3][i/3]=params[i].to_double(); for(int i=0;i<3;i++) t.origin[i]=params[i-9].to_double(); value=t; } } else { memdelete(f); ERR_EXPLAIN(p_path+":"+itos(line)+": Invalid constructor type: '"+type+"'."); ERR_FAIL_V(RES()); } } String left= l.substr(0,eqpos); // shader->set_param(left,value); } else if (mode==1) { vertex_code+=l; } else if (mode==2) { fragment_code+=l; } } shader->set_code(vertex_code,fragment_code,light_code); f->close(); memdelete(f); if (r_error) *r_error=OK; return shader; }
RID RasterizerSceneGLES2::reflection_probe_instance_create(RID p_probe) { return RID(); }