Ported CPU particles to 2D

This commit is contained in:
Juan Linietsky 2018-08-29 16:48:32 -03:00
parent 7b7f4b20cb
commit cf834a22dc
12 changed files with 1833 additions and 1 deletions

View File

@ -832,6 +832,120 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
} }
} }
} break; } break;
case Item::Command::TYPE_MULTIMESH: {
Item::CommandMultiMesh *mmesh = static_cast<Item::CommandMultiMesh *>(c);
RasterizerStorageGLES3::MultiMesh *multi_mesh = storage->multimesh_owner.getornull(mmesh->multimesh);
if (!multi_mesh)
break;
RasterizerStorageGLES3::Mesh *mesh_data = storage->mesh_owner.getornull(multi_mesh->mesh);
if (!mesh_data)
break;
RasterizerStorageGLES3::Texture *texture = _bind_canvas_texture(mmesh->texture, mmesh->normal_map);
state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_INSTANCE_CUSTOM, multi_mesh->custom_data_format != VS::MULTIMESH_CUSTOM_DATA_NONE);
state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_INSTANCING, true);
//reset shader and force rebind
state.using_texture_rect = true;
_set_texture_rect_mode(false);
if (texture) {
Size2 texpixel_size(1.0 / texture->width, 1.0 / texture->height);
state.canvas_shader.set_uniform(CanvasShaderGLES3::COLOR_TEXPIXEL_SIZE, texpixel_size);
}
int amount = MAX(multi_mesh->size, multi_mesh->visible_instances);
for (int j = 0; j < mesh_data->surfaces.size(); j++) {
RasterizerStorageGLES3::Surface *s = mesh_data->surfaces[j];
// materials are ignored in 2D meshes, could be added but many things (ie, lighting mode, reading from screen, etc) would break as they are not meant be set up at this point of drawing
glBindVertexArray(s->instancing_array_id);
glBindBuffer(GL_ARRAY_BUFFER, multi_mesh->buffer); //modify the buffer
int stride = (multi_mesh->xform_floats + multi_mesh->color_floats + multi_mesh->custom_data_floats) * 4;
glEnableVertexAttribArray(8);
glVertexAttribPointer(8, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + 0);
glVertexAttribDivisor(8, 1);
glEnableVertexAttribArray(9);
glVertexAttribPointer(9, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + 4 * 4);
glVertexAttribDivisor(9, 1);
int color_ofs;
if (multi_mesh->transform_format == VS::MULTIMESH_TRANSFORM_3D) {
glEnableVertexAttribArray(10);
glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + 8 * 4);
glVertexAttribDivisor(10, 1);
color_ofs = 12 * 4;
} else {
glDisableVertexAttribArray(10);
glVertexAttrib4f(10, 0, 0, 1, 0);
color_ofs = 8 * 4;
}
int custom_data_ofs = color_ofs;
switch (multi_mesh->color_format) {
case VS::MULTIMESH_COLOR_NONE: {
glDisableVertexAttribArray(11);
glVertexAttrib4f(11, 1, 1, 1, 1);
} break;
case VS::MULTIMESH_COLOR_8BIT: {
glEnableVertexAttribArray(11);
glVertexAttribPointer(11, 4, GL_UNSIGNED_BYTE, GL_TRUE, stride, ((uint8_t *)NULL) + color_ofs);
glVertexAttribDivisor(11, 1);
custom_data_ofs += 4;
} break;
case VS::MULTIMESH_COLOR_FLOAT: {
glEnableVertexAttribArray(11);
glVertexAttribPointer(11, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + color_ofs);
glVertexAttribDivisor(11, 1);
custom_data_ofs += 4 * 4;
} break;
}
switch (multi_mesh->custom_data_format) {
case VS::MULTIMESH_CUSTOM_DATA_NONE: {
glDisableVertexAttribArray(12);
glVertexAttrib4f(12, 1, 1, 1, 1);
} break;
case VS::MULTIMESH_CUSTOM_DATA_8BIT: {
glEnableVertexAttribArray(12);
glVertexAttribPointer(12, 4, GL_UNSIGNED_BYTE, GL_TRUE, stride, ((uint8_t *)NULL) + custom_data_ofs);
glVertexAttribDivisor(12, 1);
} break;
case VS::MULTIMESH_CUSTOM_DATA_FLOAT: {
glEnableVertexAttribArray(12);
glVertexAttribPointer(12, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + custom_data_ofs);
glVertexAttribDivisor(12, 1);
} break;
}
if (s->index_array_len) {
glDrawElementsInstanced(gl_primitive[s->primitive], s->index_array_len, (s->array_len >= (1 << 16)) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0, amount);
} else {
glDrawArraysInstanced(gl_primitive[s->primitive], 0, s->array_len, amount);
}
glBindVertexArray(0);
}
state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_INSTANCE_CUSTOM, false);
state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_INSTANCING, false);
state.using_texture_rect = true;
_set_texture_rect_mode(false);
} break;
case Item::Command::TYPE_PARTICLES: { case Item::Command::TYPE_PARTICLES: {
Item::CommandParticles *particles_cmd = static_cast<Item::CommandParticles *>(c); Item::CommandParticles *particles_cmd = static_cast<Item::CommandParticles *>(c);

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
version="1.1"
viewBox="0 0 16 16"
id="svg6"
sodipodi:docname="icon_c_p_u_particles_2_d.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1741"
inkscape:window-height="753"
id="namedview8"
showgrid="false"
inkscape:zoom="14.75"
inkscape:cx="-5.6949153"
inkscape:cy="7.7288136"
inkscape:window-x="67"
inkscape:window-y="27"
inkscape:window-maximized="0"
inkscape:current-layer="svg6" />
<path
style="fill:#a3b6f3;fill-opacity:0.99215686"
d="m 4.5587261,0.60940813 c -0.4226244,0 -0.7617187,0.3410473 -0.7617187,0.76367177 v 0.5078126 c 0,0.1028478 0.020058,0.199689 0.056641,0.2890624 H 2.6602887 c -0.4226245,0 -0.7617188,0.3390944 -0.7617188,0.7617188 v 0.921875 C 1.8581419,3.8469787 1.821771,3.8301112 1.7794293,3.8301112 H 1.2716168 c -0.42262448,0 -0.76367188,0.3410475 -0.76367188,0.7636719 v 0.3730468 c 0,0.4226245 0.3410474,0.7617188 0.76367188,0.7617188 h 0.5078125 c 0.042396,0 0.078663,-0.016851 0.1191406,-0.023437 v 4.4531248 c -0.040428,-0.0066 -0.076799,-0.02344 -0.1191406,-0.02344 H 1.2716168 c -0.42262448,0 -0.76367188,0.341047 -0.76367188,0.763672 v 0.373047 c 0,0.422625 0.3410474,0.761718 0.76367188,0.761718 h 0.5078125 c 0.042396,0 0.078663,-0.01685 0.1191406,-0.02344 v 1.125 c 0,0.422624 0.3390944,0.763672 0.7617188,0.763672 h 1.1367187 v 0.457031 c 0,0.422624 0.3390943,0.763672 0.7617187,0.763672 H 4.931773 c 0.4226244,0 0.7636719,-0.341048 0.7636719,-0.763672 v -0.457031 h 4.4062501 v 0.457031 c 0,0.422624 0.339094,0.763672 0.761719,0.763672 h 0.373047 c 0.422624,0 0.763671,-0.341048 0.763671,-0.763672 v -0.457031 h 1.269532 c 0.422625,0 0.763672,-0.341048 0.763672,-0.763672 v -1.111328 c 0.01774,0.0012 0.03272,0.0098 0.05078,0.0098 h 0.507812 c 0.422624,0 0.763672,-0.339093 0.763672,-0.761718 v -0.373047 c 0,-0.422624 -0.341048,-0.763672 -0.763672,-0.763672 h -0.507812 c -0.01803,0 -0.03307,0.0085 -0.05078,0.0098 V 5.7187831 c 0.01774,0.00122 0.03272,0.00977 0.05078,0.00977 h 0.507812 c 0.422624,0 0.763672,-0.3390943 0.763672,-0.7617188 V 4.5937831 c 0,-0.4226244 -0.341048,-0.7636719 -0.763672,-0.7636719 h -0.507812 c -0.01803,0 -0.03307,0.00855 -0.05078,0.00977 V 2.9316737 c 0,-0.4226244 -0.341047,-0.7617187 -0.763672,-0.7617188 h -1.328125 c 0.03658,-0.089375 0.05859,-0.1862118 0.05859,-0.2890624 V 1.3730799 c 0,-0.42262437 -0.341047,-0.76367177 -0.763671,-0.76367177 h -0.373047 c -0.422625,0 -0.761719,0.3410474 -0.761719,0.76367177 v 0.5078126 c 0,0.1028478 0.02006,0.1996891 0.05664,0.2890624 H 5.6368511 C 5.6734361,2.08058 5.6954449,1.9837431 5.6954449,1.8808925 V 1.3730799 c 0,-0.42262437 -0.3410475,-0.76367177 -0.7636719,-0.76367177 z M 7.7970074,2.9668299 A 3.279661,3.6440678 0 0 1 11.009898,5.9062831 2.1864407,2.1864407 0 0 1 12.89857,8.0683925 2.1864407,2.1864407 0 0 1 10.71107,10.25394 H 4.8809918 A 2.1864407,2.1864407 0 0 1 2.6954449,8.0683925 2.1864407,2.1864407 0 0 1 4.5802105,5.9043299 3.279661,3.6440678 0 0 1 7.7970074,2.9668299 Z M 4.8809918,10.982455 A 0.72881355,0.72881355 0 0 1 5.6095074,11.710971 0.72881355,0.72881355 0 0 1 4.8809918,12.44144 0.72881355,0.72881355 0 0 1 4.1524761,11.710971 0.72881355,0.72881355 0 0 1 4.8809918,10.982455 Z m 5.8300782,0 A 0.72881355,0.72881355 0 0 1 11.441539,11.710971 0.72881355,0.72881355 0 0 1 10.71107,12.44144 0.72881355,0.72881355 0 0 1 9.9825543,11.710971 0.72881355,0.72881355 0 0 1 10.71107,10.982455 Z M 7.7970074,11.710971 A 0.72881355,0.72881355 0 0 1 8.525523,12.44144 0.72881355,0.72881355 0 0 1 7.7970074,13.169955 0.72881355,0.72881355 0 0 1 7.0684918,12.44144 0.72881355,0.72881355 0 0 1 7.7970074,11.710971 Z"
id="rect822"
inkscape:connector-curvature="0" />
<g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="Layer 1" />
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

File diff suppressed because it is too large Load Diff

259
scene/2d/cpu_particles_2d.h Normal file
View File

@ -0,0 +1,259 @@
#ifndef CPU_PARTICLES_2D_H
#define CPU_PARTICLES_2D_H
#include "rid.h"
#include "scene/2d/node_2d.h"
#include "scene/main/timer.h"
#include "scene/resources/material.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
class CPUParticles2D : public Node2D {
private:
GDCLASS(CPUParticles2D, Node2D);
public:
enum DrawOrder {
DRAW_ORDER_INDEX,
DRAW_ORDER_LIFETIME,
};
enum Parameter {
PARAM_INITIAL_LINEAR_VELOCITY,
PARAM_ANGULAR_VELOCITY,
PARAM_ORBIT_VELOCITY,
PARAM_LINEAR_ACCEL,
PARAM_RADIAL_ACCEL,
PARAM_TANGENTIAL_ACCEL,
PARAM_DAMPING,
PARAM_ANGLE,
PARAM_SCALE,
PARAM_HUE_VARIATION,
PARAM_ANIM_SPEED,
PARAM_ANIM_OFFSET,
PARAM_MAX
};
enum Flags {
FLAG_ALIGN_Y_TO_VELOCITY,
FLAG_ANIM_LOOP,
FLAG_MAX
};
enum EmissionShape {
EMISSION_SHAPE_POINT,
EMISSION_SHAPE_CIRCLE,
EMISSION_SHAPE_RECTANGLE,
EMISSION_SHAPE_POINTS,
EMISSION_SHAPE_DIRECTED_POINTS,
};
private:
bool emitting;
struct Particle {
Transform2D transform;
Color color;
float custom[4];
Vector2 velocity;
bool active;
float angle_rand;
float scale_rand;
float hue_rot_rand;
float anim_offset_rand;
float time;
Color base_color;
uint32_t seed;
};
float time;
float inactive_time;
float frame_remainder;
int cycle;
RID mesh;
RID multimesh;
PoolVector<Particle> particles;
PoolVector<float> particle_data;
PoolVector<int> particle_order;
struct SortLifetime {
const Particle *particles;
bool operator()(int p_a, int p_b) const {
return particles[p_a].time < particles[p_b].time;
}
};
struct SortAxis {
const Particle *particles;
Vector2 axis;
bool operator()(int p_a, int p_b) const {
return axis.dot(particles[p_a].transform[2]) < axis.dot(particles[p_b].transform[2]);
}
};
//
bool one_shot;
float lifetime;
float pre_process_time;
float explosiveness_ratio;
float randomness_ratio;
float speed_scale;
bool local_coords;
int fixed_fps;
bool fractional_delta;
DrawOrder draw_order;
Ref<Texture> texture;
Ref<Texture> normalmap;
////////
float spread;
float flatness;
float parameters[PARAM_MAX];
float randomness[PARAM_MAX];
Ref<Curve> curve_parameters[PARAM_MAX];
Color color;
Ref<Gradient> color_ramp;
bool flags[FLAG_MAX];
EmissionShape emission_shape;
float emission_sphere_radius;
Vector2 emission_rect_extents;
PoolVector<Vector2> emission_points;
PoolVector<Vector2> emission_normals;
PoolVector<Color> emission_colors;
int emission_point_count;
bool anim_loop;
Vector2 gravity;
void _particles_process(float p_delta);
void _update_particle_data_buffer();
Mutex *update_mutex;
void _update_render_thread();
void _update_mesh_texture();
protected:
static void _bind_methods();
void _notification(int p_what);
virtual void _validate_property(PropertyInfo &property) const;
public:
void set_emitting(bool p_emitting);
void set_amount(int p_amount);
void set_lifetime(float p_lifetime);
void set_one_shot(bool p_one_shot);
void set_pre_process_time(float p_time);
void set_explosiveness_ratio(float p_ratio);
void set_randomness_ratio(float p_ratio);
void set_visibility_aabb(const Rect2 &p_aabb);
void set_use_local_coordinates(bool p_enable);
void set_speed_scale(float p_scale);
bool is_emitting() const;
int get_amount() const;
float get_lifetime() const;
bool get_one_shot() const;
float get_pre_process_time() const;
float get_explosiveness_ratio() const;
float get_randomness_ratio() const;
Rect2 get_visibility_aabb() const;
bool get_use_local_coordinates() const;
float get_speed_scale() const;
void set_fixed_fps(int p_count);
int get_fixed_fps() const;
void set_fractional_delta(bool p_enable);
bool get_fractional_delta() const;
void set_draw_order(DrawOrder p_order);
DrawOrder get_draw_order() const;
void set_draw_passes(int p_count);
int get_draw_passes() const;
void set_texture(const Ref<Texture> &p_texture);
Ref<Texture> get_texture() const;
void set_normalmap(const Ref<Texture> &p_normalmap);
Ref<Texture> get_normalmap() const;
///////////////////
void set_spread(float p_spread);
float get_spread() const;
void set_flatness(float p_flatness);
float get_flatness() const;
void set_param(Parameter p_param, float p_value);
float get_param(Parameter p_param) const;
void set_param_randomness(Parameter p_param, float p_value);
float get_param_randomness(Parameter p_param) const;
void set_param_curve(Parameter p_param, const Ref<Curve> &p_curve);
Ref<Curve> get_param_curve(Parameter p_param) const;
void set_color(const Color &p_color);
Color get_color() const;
void set_color_ramp(const Ref<Gradient> &p_texture);
Ref<Gradient> get_color_ramp() const;
void set_particle_flag(Flags p_flag, bool p_enable);
bool get_particle_flag(Flags p_flag) const;
void set_emission_shape(EmissionShape p_shape);
void set_emission_sphere_radius(float p_radius);
void set_emission_rect_extents(Vector2 p_extents);
void set_emission_points(const PoolVector<Vector2> &p_points);
void set_emission_normals(const PoolVector<Vector2> &p_normals);
void set_emission_colors(const PoolVector<Color> &p_colors);
void set_emission_point_count(int p_count);
EmissionShape get_emission_shape() const;
float get_emission_sphere_radius() const;
Vector2 get_emission_rect_extents() const;
PoolVector<Vector2> get_emission_points() const;
PoolVector<Vector2> get_emission_normals() const;
PoolVector<Color> get_emission_colors() const;
int get_emission_point_count() const;
void set_gravity(const Vector2 &p_gravity);
Vector2 get_gravity() const;
virtual String get_configuration_warning() const;
void restart();
void convert_from_particles(Node *p_particles);
CPUParticles2D();
~CPUParticles2D();
};
VARIANT_ENUM_CAST(CPUParticles2D::DrawOrder)
VARIANT_ENUM_CAST(CPUParticles2D::Parameter)
VARIANT_ENUM_CAST(CPUParticles2D::Flags)
VARIANT_ENUM_CAST(CPUParticles2D::EmissionShape)
#endif // CPU_PARTICLES_2D_H

View File

@ -442,7 +442,7 @@ static float rand_from_seed(uint32_t &seed) {
return float(seed % uint32_t(65536)) / 65535.0; return float(seed % uint32_t(65536)) / 65535.0;
} }
float rand_from_seed_m1_p1(uint32_t &seed) { static float rand_from_seed_m1_p1(uint32_t &seed) {
return rand_from_seed(seed) * 2.0 - 1.0; return rand_from_seed(seed) * 2.0 - 1.0;
} }

View File

@ -42,6 +42,7 @@
#include "scene/2d/canvas_modulate.h" #include "scene/2d/canvas_modulate.h"
#include "scene/2d/collision_polygon_2d.h" #include "scene/2d/collision_polygon_2d.h"
#include "scene/2d/collision_shape_2d.h" #include "scene/2d/collision_shape_2d.h"
#include "scene/2d/cpu_particles_2d.h"
#include "scene/2d/joints_2d.h" #include "scene/2d/joints_2d.h"
#include "scene/2d/light_2d.h" #include "scene/2d/light_2d.h"
#include "scene/2d/light_occluder_2d.h" #include "scene/2d/light_occluder_2d.h"
@ -514,6 +515,7 @@ void register_scene_types() {
SceneTree::add_idle_callback(CanvasItemMaterial::flush_changes); SceneTree::add_idle_callback(CanvasItemMaterial::flush_changes);
CanvasItemMaterial::init_shaders(); CanvasItemMaterial::init_shaders();
ClassDB::register_class<Node2D>(); ClassDB::register_class<Node2D>();
ClassDB::register_class<CPUParticles2D>();
ClassDB::register_class<Particles2D>(); ClassDB::register_class<Particles2D>();
//ClassDB::register_class<ParticleAttractor2D>(); //ClassDB::register_class<ParticleAttractor2D>();
ClassDB::register_class<Sprite>(); ClassDB::register_class<Sprite>();

View File

@ -836,6 +836,7 @@ public:
bool clip; bool clip;
bool visible; bool visible;
bool behind; bool behind;
bool update_when_visible;
//VS::MaterialBlendMode blend_mode; //VS::MaterialBlendMode blend_mode;
int light_mask; int light_mask;
Vector<Command *> commands; Vector<Command *> commands;
@ -1037,6 +1038,7 @@ public:
copy_back_buffer = NULL; copy_back_buffer = NULL;
distance_field = false; distance_field = false;
light_masked = false; light_masked = false;
update_when_visible = false;
} }
virtual ~Item() { virtual ~Item() {
clear(); clear();

View File

@ -30,6 +30,7 @@
#include "visual_server_canvas.h" #include "visual_server_canvas.h"
#include "visual_server_global.h" #include "visual_server_global.h"
#include "visual_server_raster.h"
#include "visual_server_viewport.h" #include "visual_server_viewport.h"
void VisualServerCanvas::_render_canvas_item_tree(Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights) { void VisualServerCanvas::_render_canvas_item_tree(Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights) {
@ -119,6 +120,10 @@ void VisualServerCanvas::_render_canvas_item(Item *p_canvas_item, const Transfor
ci->copy_back_buffer->screen_rect = xform.xform(ci->copy_back_buffer->rect).clip(p_clip_rect); ci->copy_back_buffer->screen_rect = xform.xform(ci->copy_back_buffer->rect).clip(p_clip_rect);
} }
if (ci->update_when_visible) {
VisualServerRaster::redraw_request();
}
if ((!ci->commands.empty() && p_clip_rect.intersects(global_rect)) || ci->vp_render || ci->copy_back_buffer) { if ((!ci->commands.empty() && p_clip_rect.intersects(global_rect)) || ci->vp_render || ci->copy_back_buffer) {
//something to draw? //something to draw?
ci->final_transform = xform; ci->final_transform = xform;
@ -390,6 +395,14 @@ void VisualServerCanvas::canvas_item_set_draw_behind_parent(RID p_item, bool p_e
canvas_item->behind = p_enable; canvas_item->behind = p_enable;
} }
void VisualServerCanvas::canvas_item_set_update_when_visible(RID p_item, bool p_update) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->update_when_visible = p_update;
}
void VisualServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width, bool p_antialiased) { void VisualServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width, bool p_antialiased) {
Item *canvas_item = canvas_item_owner.getornull(p_item); Item *canvas_item = canvas_item_owner.getornull(p_item);

View File

@ -171,6 +171,8 @@ public:
void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable); void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable);
void canvas_item_set_update_when_visible(RID p_item, bool p_update);
void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = 1.0, bool p_antialiased = false); void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = 1.0, bool p_antialiased = false);
void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false); void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false);
void canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false); void canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false);

View File

@ -574,6 +574,8 @@ public:
BIND2(canvas_item_set_visible, RID, bool) BIND2(canvas_item_set_visible, RID, bool)
BIND2(canvas_item_set_light_mask, RID, int) BIND2(canvas_item_set_light_mask, RID, int)
BIND2(canvas_item_set_update_when_visible, RID, bool)
BIND2(canvas_item_set_transform, RID, const Transform2D &) BIND2(canvas_item_set_transform, RID, const Transform2D &)
BIND2(canvas_item_set_clip, RID, bool) BIND2(canvas_item_set_clip, RID, bool)
BIND2(canvas_item_set_distance_field_mode, RID, bool) BIND2(canvas_item_set_distance_field_mode, RID, bool)

View File

@ -490,6 +490,8 @@ public:
FUNC2(canvas_item_set_visible, RID, bool) FUNC2(canvas_item_set_visible, RID, bool)
FUNC2(canvas_item_set_light_mask, RID, int) FUNC2(canvas_item_set_light_mask, RID, int)
FUNC2(canvas_item_set_update_when_visible, RID, bool)
FUNC2(canvas_item_set_transform, RID, const Transform2D &) FUNC2(canvas_item_set_transform, RID, const Transform2D &)
FUNC2(canvas_item_set_clip, RID, bool) FUNC2(canvas_item_set_clip, RID, bool)
FUNC2(canvas_item_set_distance_field_mode, RID, bool) FUNC2(canvas_item_set_distance_field_mode, RID, bool)

View File

@ -863,6 +863,8 @@ public:
virtual void canvas_item_set_visible(RID p_item, bool p_visible) = 0; virtual void canvas_item_set_visible(RID p_item, bool p_visible) = 0;
virtual void canvas_item_set_light_mask(RID p_item, int p_mask) = 0; virtual void canvas_item_set_light_mask(RID p_item, int p_mask) = 0;
virtual void canvas_item_set_update_when_visible(RID p_item, bool p_update) = 0;
virtual void canvas_item_set_transform(RID p_item, const Transform2D &p_transform) = 0; virtual void canvas_item_set_transform(RID p_item, const Transform2D &p_transform) = 0;
virtual void canvas_item_set_clip(RID p_item, bool p_clip) = 0; virtual void canvas_item_set_clip(RID p_item, bool p_clip) = 0;
virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable) = 0; virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable) = 0;