GlistEngine
Loading...
Searching...
No Matches
gPath.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Nitra Games Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * gPath.h
19 *
20 * Created on: Aug 18, 2026
21 * Authors: Bahar Kucukozer, Mehmet Sefa Ciftci
22 */
23
24#ifndef GRAPHICS_GPATH_H_
25#define GRAPHICS_GPATH_H_
26
27#include <cstddef>
28#include <glm/glm.hpp>
29#include <vector>
30
31class gArc;
32class gBezier;
33class gLine;
34class gBezierQuad;
35
36class gPath {
37public:
38 class gSubPath {
39 public:
47
48 gSubPath(gLine& line, int pointcount);
49 gSubPath(gArc& arc, int pointcount);
50 gSubPath(const gBezier& bezier, int pointcount);
51 gSubPath(const gPath& path, int pointcount);
52 gSubPath(const gBezierQuad& bezierquad, int pointcount);
53
54 Type getType() const;
55 int getPointCount() const;
56 glm::vec3 getPoint(int pointno);
57 const std::vector<glm::vec3>& getPoints() const;
58
59 bool hasNextPoint() const;
60 glm::vec3 getNextPoint();
61 void reset();
62
63 private:
64 static std::vector<glm::vec3> samplePoints(
65 const std::vector<glm::vec3>& sourcepoints,
66 int pointcount);
67
68 Type type;
69 std::vector<glm::vec3> points;
70 std::size_t currentpoint;
71 };
72
74 virtual ~gPath();
75
76 void clear();
77
78 void addSubPath(const gSubPath& subpath);
79 void addSubPath(gLine& line, int pointcount);
80 void addSubPath(gArc& arc, int pointcount);
81 void addSubPath(const gBezier& bezier, int pointcount);
82 void addSubPath(const gPath& path, int pointcount);
83 void addSubPath(const gBezierQuad& bezierquad, int pointcount);
84
85 int getSubPathCount() const;
86 int getPointCount() const;
87 glm::vec3 getPoint(int pointno);
88 glm::vec3 getPoint(int subpathno, int subpathpointno);
89
90 const std::vector<gSubPath>& getSubPaths() const;
91 std::vector<glm::vec3> getPoints() const;
92
93 bool hasNextPoint() const;
94 glm::vec3 getNextPoint();
95 void reset();
96
97private:
98 std::vector<gSubPath> subpaths;
99 std::size_t currentsubpath;
100};
101
102#endif /* GRAPHICS_GPATH_H_ */
Definition gArc.h:13
Definition gBezierQuad.h:16
Evaluates and renders a single quadratic Bezier curve requiring exactly 3 control points (two ends an...
Definition gBezier.h:27
Definition gLine.h:30
Definition gPath.h:38
gSubPath(const gBezier &bezier, int pointcount)
gSubPath(gArc &arc, int pointcount)
int getPointCount() const
gSubPath(const gPath &path, int pointcount)
gSubPath(gLine &line, int pointcount)
Type
Definition gPath.h:40
@ TYPE_PATH
Definition gPath.h:45
@ TYPE_LINE
Definition gPath.h:41
@ TYPE_BEZIER
Definition gPath.h:43
@ TYPE_ARC
Definition gPath.h:42
@ TYPE_BEZIERQUAD
Definition gPath.h:44
const std::vector< glm::vec3 > & getPoints() const
Type getType() const
bool hasNextPoint() const
glm::vec3 getNextPoint()
glm::vec3 getPoint(int pointno)
gSubPath(const gBezierQuad &bezierquad, int pointcount)
void addSubPath(const gBezierQuad &bezierquad, int pointcount)
void addSubPath(const gBezier &bezier, int pointcount)
std::vector< glm::vec3 > getPoints() const
void addSubPath(gLine &line, int pointcount)
int getPointCount() const
void reset()
int getSubPathCount() const
glm::vec3 getPoint(int pointno)
const std::vector< gSubPath > & getSubPaths() const
glm::vec3 getPoint(int subpathno, int subpathpointno)
void addSubPath(const gPath &path, int pointcount)
glm::vec3 getNextPoint()
void clear()
bool hasNextPoint() const
void addSubPath(const gSubPath &subpath)
virtual ~gPath()
void addSubPath(gArc &arc, int pointcount)