本文整理汇总了C++中VisualServer::canvas_item_set_light_mask方法的典型用法代码示例。如果您正苦于以下问题:C++ VisualServer::canvas_item_set_light_mask方法的具体用法?C++ VisualServer::canvas_item_set_light_mask怎么用?C++ VisualServer::canvas_item_set_light_mask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisualServer
的用法示例。
在下文中一共展示了VisualServer::canvas_item_set_light_mask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _update_dirty_quadrants
void TileMap::_update_dirty_quadrants() {
if (!pending_update)
return;
if (!is_inside_tree())
return;
if (!tile_set.is_valid())
return;
VisualServer *vs = VisualServer::get_singleton();
Physics2DServer *ps = Physics2DServer::get_singleton();
Vector2 tofs = get_cell_draw_offset();
Vector2 tcenter = cell_size/2;
Matrix32 nav_rel;
if (navigation)
nav_rel = get_relative_transform_to_parent(navigation);
Vector2 qofs;
SceneTree *st=SceneTree::get_singleton();
Color debug_collision_color;
bool debug_shapes = st && st->is_debugging_collisions_hint();
if (debug_shapes) {
debug_collision_color=st->get_debug_collisions_color();
}
while (dirty_quadrant_list.first()) {
Quadrant &q = *dirty_quadrant_list.first()->self();
for (List<RID>::Element *E=q.canvas_items.front();E;E=E->next()) {
vs->free(E->get());
}
q.canvas_items.clear();
ps->body_clear_shapes(q.body);
int shape_idx=0;
if (navigation) {
for(Map<PosKey,Quadrant::NavPoly>::Element *E=q.navpoly_ids.front();E;E=E->next()) {
navigation->navpoly_remove(E->get().id);
}
q.navpoly_ids.clear();
}
for(Map<PosKey,Quadrant::Occluder>::Element *E=q.occluder_instances.front();E;E=E->next()) {
VS::get_singleton()->free(E->get().id);
}
q.occluder_instances.clear();
Ref<CanvasItemMaterial> prev_material;
RID prev_canvas_item;
RID prev_debug_canvas_item;
for(int i=0;i<q.cells.size();i++) {
Map<PosKey,Cell>::Element *E=tile_map.find( q.cells[i] );
Cell &c=E->get();
//moment of truth
if (!tile_set->has_tile(c.id))
continue;
Ref<Texture> tex = tile_set->tile_get_texture(c.id);
Vector2 tile_ofs = tile_set->tile_get_texture_offset(c.id);
Vector2 wofs = _map_to_world(E->key().x, E->key().y);
Vector2 offset = wofs - q.pos + tofs;
if (!tex.is_valid())
continue;
Ref<CanvasItemMaterial> mat = tile_set->tile_get_material(c.id);
RID canvas_item;
RID debug_canvas_item;
if (prev_canvas_item==RID() || prev_material!=mat) {
canvas_item=vs->canvas_item_create();
if (mat.is_valid())
vs->canvas_item_set_material(canvas_item,mat->get_rid());
vs->canvas_item_set_parent( canvas_item, get_canvas_item() );
Matrix32 xform;
xform.set_origin( q.pos );
vs->canvas_item_set_transform( canvas_item, xform );
vs->canvas_item_set_light_mask(canvas_item,get_light_mask());
vs->canvas_item_set_blend_mode(canvas_item,VS::MaterialBlendMode(get_blend_mode()));
q.canvas_items.push_back(canvas_item);
if (debug_shapes) {
debug_canvas_item=vs->canvas_item_create();
vs->canvas_item_set_parent( debug_canvas_item, canvas_item );
vs->canvas_item_set_z_as_relative_to_parent(debug_canvas_item,false);
vs->canvas_item_set_z(debug_canvas_item,VS::CANVAS_ITEM_Z_MAX-1);
q.canvas_items.push_back(debug_canvas_item);
prev_debug_canvas_item=debug_canvas_item;
//.........这里部分代码省略.........