本文整理汇总了C++中RID函数的典型用法代码示例。如果您正苦于以下问题:C++ RID函数的具体用法?C++ RID怎么用?C++ RID使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
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;
}
示例2: RID
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);
//.........这里部分代码省略.........
示例3: ERR_FAIL_COND_V
RID RenderTargetTexture::get_rid() const{
ERR_FAIL_COND_V(!vp,RID());
return vp->render_target_texture_rid;
}
示例4: dateTimezoneIniGet
static std::string dateTimezoneIniGet() {
return RID().getTimeZone();
}
示例5: ERR_FAIL_COND_V
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);
//.........这里部分代码省略.........
示例6: RID
RID LargeTexture::get_rid() const {
return RID();
}
示例7: ERR_FAIL_INDEX
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();
}
示例8: SET_FROM_STRUCT_AND_BREAK
//.........这里部分代码省略.........
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);
示例9: GLOBAL_GET
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);
}
}
示例10: switch
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
}
示例11: RID
SuppressHackArrCompatNotices::~SuppressHackArrCompatNotices() {
RID().setSuppressHackArrayCompatNotices(old);
}
示例12: raise_hackarr_compat_notice
void raise_hackarr_compat_notice(const std::string& msg) {
if (UNLIKELY(RID().getSuppressHackArrayCompatNotices())) return;
raise_notice("Hack Array Compat: %s", msg.c_str());
}
示例13: raise_intish_index_cast
void raise_intish_index_cast() {
if (UNLIKELY(RID().getSuppressHackArrayCompatNotices())) return;
raise_notice("Hack Array Compat: Intish index cast");
}
示例14: RID
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());
}
示例15: 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();
}