Working on meshes
This commit is contained in:
parent
c479ccb9e2
commit
7b472fe18d
652 changed files with 81120 additions and 852 deletions
55
src/CanvasComponents/MeshCanvasComponent.hpp
Normal file
55
src/CanvasComponents/MeshCanvasComponent.hpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* InfiniPaint
|
||||
* Copyright (C) 2025-2026 Yousef Khadadeh
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "BrushComponentCode.hpp"
|
||||
#include "CanvasComponent.hpp"
|
||||
#include "Helpers/SCollision.hpp"
|
||||
#include <Helpers/Serializers.hpp>
|
||||
#include <include/core/SkPath.h>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
|
||||
class MeshCanvasComponent : public CanvasComponent {
|
||||
public:
|
||||
virtual CanvasComponentType get_type() const override;
|
||||
virtual void save(cereal::PortableBinaryOutputArchive& a) const override;
|
||||
virtual void load(cereal::PortableBinaryInputArchive& a) override;
|
||||
virtual void save_file(cereal::PortableBinaryOutputArchive& a) const override;
|
||||
virtual void load_file(cereal::PortableBinaryInputArchive& a, VersionNumber version) override;
|
||||
virtual std::unique_ptr<CanvasComponent> get_data_copy() const override;
|
||||
virtual void change_stroke_color(const Vector4f& newStrokeColor) override;
|
||||
virtual std::optional<Vector4f> get_stroke_color() const override;
|
||||
virtual void set_data_from(const CanvasComponent& other) override;
|
||||
|
||||
struct Data {
|
||||
MeshShapeData points;
|
||||
Vector4f color;
|
||||
} d;
|
||||
private:
|
||||
virtual void draw(SkCanvas* canvas, const DrawData& drawData, const std::shared_ptr<void>& predrawData) const override;
|
||||
virtual bool accurate_draw(SkCanvas* canvas, const DrawData& drawData, const CoordSpaceHelper& coords, const std::shared_ptr<void>& predrawData) const override;
|
||||
virtual std::shared_ptr<void> get_predraw_data_accurate(const DrawData& drawData, const CoordSpaceHelper& coords) const override;
|
||||
virtual void initialize_draw_data(DrawingProgram& drawP) override;
|
||||
virtual bool collides_within_coords(const SCollision::ColliderCollection<float>& checkAgainst) const override;
|
||||
virtual bool collides_within_coords_skpath(const SkPath& checkAgainst) const override;
|
||||
bool should_draw_extra(const DrawData& drawData, const CoordSpaceHelper& coords) const override;
|
||||
virtual SCollision::AABB<float> get_obj_coord_bounds() const override;
|
||||
SkPath meshPath;
|
||||
SCollision::BVHContainer<float> collisionTree;
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue