You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-22 15:06:45 +00:00
2D GPU Particles working..
This commit is contained in:
@@ -612,6 +612,7 @@ public:
|
||||
TYPE_POLYGON,
|
||||
TYPE_MESH,
|
||||
TYPE_MULTIMESH,
|
||||
TYPE_PARTICLES,
|
||||
TYPE_CIRCLE,
|
||||
TYPE_TRANSFORM,
|
||||
TYPE_CLIP_IGNORE,
|
||||
@@ -707,6 +708,16 @@ public:
|
||||
CommandMultiMesh() { type = TYPE_MULTIMESH; }
|
||||
};
|
||||
|
||||
struct CommandParticles : public Command {
|
||||
|
||||
RID particles;
|
||||
RID texture;
|
||||
RID normal_map;
|
||||
int h_frames;
|
||||
int v_frames;
|
||||
CommandParticles() { type = TYPE_PARTICLES; }
|
||||
};
|
||||
|
||||
struct CommandCircle : public Command {
|
||||
|
||||
Point2 pos;
|
||||
@@ -844,6 +855,15 @@ public:
|
||||
|
||||
r = Rect2(aabb.position.x, aabb.position.y, aabb.size.x, aabb.size.y);
|
||||
|
||||
} break;
|
||||
case Item::Command::TYPE_PARTICLES: {
|
||||
|
||||
const Item::CommandParticles *particles_cmd = static_cast<const Item::CommandParticles *>(c);
|
||||
if (particles_cmd->particles.is_valid()) {
|
||||
Rect3 aabb = RasterizerStorage::base_singleton->particles_get_aabb(particles_cmd->particles);
|
||||
r = Rect2(aabb.position.x, aabb.position.y, aabb.size.x, aabb.size.y);
|
||||
}
|
||||
|
||||
} break;
|
||||
case Item::Command::TYPE_CIRCLE: {
|
||||
|
||||
|
||||
@@ -637,6 +637,25 @@ void VisualServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID
|
||||
|
||||
canvas_item->commands.push_back(m);
|
||||
}
|
||||
void VisualServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal, int p_h_frames, int p_v_frames) {
|
||||
|
||||
Item *canvas_item = canvas_item_owner.getornull(p_item);
|
||||
ERR_FAIL_COND(!canvas_item);
|
||||
|
||||
Item::CommandParticles *part = memnew(Item::CommandParticles);
|
||||
ERR_FAIL_COND(!part);
|
||||
part->particles = p_particles;
|
||||
part->texture = p_texture;
|
||||
part->normal_map = p_normal;
|
||||
part->h_frames = p_h_frames;
|
||||
part->v_frames = p_v_frames;
|
||||
|
||||
//take the chance and request processing for them, at least once until they become visible again
|
||||
VSG::storage->particles_request_process(p_particles);
|
||||
|
||||
canvas_item->commands.push_back(part);
|
||||
}
|
||||
|
||||
void VisualServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_skeleton) {
|
||||
|
||||
Item *canvas_item = canvas_item_owner.getornull(p_item);
|
||||
|
||||
@@ -173,6 +173,7 @@ public:
|
||||
void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID());
|
||||
void canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_skeleton = RID());
|
||||
void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_skeleton = RID());
|
||||
void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal, int p_h_frames, int p_v_frames);
|
||||
void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform);
|
||||
void canvas_item_add_clip_ignore(RID p_item, bool p_ignore);
|
||||
void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable);
|
||||
|
||||
@@ -877,7 +877,8 @@ public:
|
||||
BIND2(particles_set_draw_passes, RID, int)
|
||||
BIND3(particles_set_draw_pass_mesh, RID, int, RID)
|
||||
|
||||
BIND1R(Rect3, particles_get_current_aabb, RID);
|
||||
BIND1R(Rect3, particles_get_current_aabb, RID)
|
||||
BIND2(particles_set_emission_transform, RID, const Transform &)
|
||||
|
||||
#undef BINDBASE
|
||||
//from now on, calls forwarded to this singleton
|
||||
@@ -1049,6 +1050,7 @@ public:
|
||||
BIND8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID)
|
||||
BIND3(canvas_item_add_mesh, RID, const RID &, RID)
|
||||
BIND3(canvas_item_add_multimesh, RID, RID, RID)
|
||||
BIND6(canvas_item_add_particles, RID, RID, RID, RID, int, int)
|
||||
BIND2(canvas_item_add_set_transform, RID, const Transform2D &)
|
||||
BIND2(canvas_item_add_clip_ignore, RID, bool)
|
||||
BIND2(canvas_item_set_sort_children_by_y, RID, bool)
|
||||
|
||||
@@ -320,6 +320,7 @@ public:
|
||||
|
||||
FUNC2(particles_set_draw_passes, RID, int)
|
||||
FUNC3(particles_set_draw_pass_mesh, RID, int, RID)
|
||||
FUNC2(particles_set_emission_transform, RID, const Transform &)
|
||||
|
||||
FUNC1R(Rect3, particles_get_current_aabb, RID)
|
||||
|
||||
@@ -476,6 +477,7 @@ public:
|
||||
FUNC8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID)
|
||||
FUNC3(canvas_item_add_mesh, RID, const RID &, RID)
|
||||
FUNC3(canvas_item_add_multimesh, RID, RID, RID)
|
||||
FUNC6(canvas_item_add_particles, RID, RID, RID, RID, int, int)
|
||||
FUNC2(canvas_item_add_set_transform, RID, const Transform2D &)
|
||||
FUNC2(canvas_item_add_clip_ignore, RID, bool)
|
||||
FUNC2(canvas_item_set_sort_children_by_y, RID, bool)
|
||||
|
||||
Reference in New Issue
Block a user