Added brush LODs for SkPath brush stroke implementation

This commit is contained in:
Yousef Khadadeh 2025-08-26 17:41:08 +03:00
parent c302353bd9
commit a9af3a9b17
2 changed files with 28 additions and 5 deletions

View file

@ -49,10 +49,13 @@ class DrawBrushStroke : public DrawComponent {
std::shared_ptr<SkPath> brushPath;
SCollision::AABB<float> bounds;
std::array<std::shared_ptr<SkPath>, 2> brushPathLOD;
private:
std::vector<DrawBrushStrokePoint> every_nth_point_include_front_and_back(const std::vector<DrawBrushStrokePoint>& pts, size_t n);
void add_precheck_aabb_level(size_t level, const std::vector<SCollision::BVHContainer<float>>& levelArray);
std::vector<SCollision::AABB<float>> precheckAABBLevels;
void create_triangles(const std::function<bool(Vector2f, Vector2f, Vector2f)>& passTriangleFunc, const std::vector<DrawBrushStrokePoint>& points, unsigned skipVertexCount, std::shared_ptr<SkPath> bPath);
void create_triangles(const std::function<bool(Vector2f, Vector2f, Vector2f)>& passTriangleFunc, const std::vector<DrawBrushStrokePoint>& smoothedPoints, size_t skipVertexCount, std::shared_ptr<SkPath> bPath);
std::vector<size_t> get_wedge_indices(const std::vector<DrawBrushStrokePoint>& points);
std::vector<DrawBrushStrokePoint> smooth_points(size_t beginIndex, size_t endIndex, unsigned numOfDivisions);
std::vector<DrawBrushStrokePoint> smooth_points_avg(size_t beginIndex, size_t endIndex, unsigned numOfDivisions);