ScummVM API documentation
te_bezier_curve.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TETRAEDGE_TE_TE_BEZIER_CURVE_H
23 #define TETRAEDGE_TE_TE_BEZIER_CURVE_H
24 
25 #include "common/array.h"
26 
27 #include "tetraedge/te/te_3d_object2.h"
28 #include "tetraedge/te/te_references_counter.h"
29 
30 namespace Tetraedge {
31 
33 public:
34  TeBezierCurve();
35 
36  int bounds(int val);
37  void clear();
38  void draw() override;
39  float length();
40 
41  void pseudoTangent(float f, TeVector3f32 &v1, TeVector3f32 &v2);
42 
43  float rawLength();
44 
45  TeVector3f32 retrievePoint(float offset);
46  void setControlPoints(const Common::Array<TeVector3f32> &points);
47  void setNbIterations(uint iterations);
48 
49  static TeVector3f32 hermiteInterpolate(float param_2, const TeVector3f32 *points, float param_4, float param_5);
50 
51  static void serialize(Common::WriteStream &stream, const TeBezierCurve &curve);
52  static void deserialize(Common::ReadStream &stream, TeBezierCurve &curve);
53  void loadBin(const Common::Path &path);
54 
55  const Common::Array<TeVector3f32> &controlPoints() { return _controlPoints; }
56  uint numIterations() const { return _numIterations; }
57 
58 private:
59  uint _numIterations;
60  float _length;
61  float _rawLength;
62  bool _lengthNeedsUpdate;
63  bool _rawLengthNeedsUpdate;
64  Common::Array<TeVector3f32> _controlPoints;
65  Common::Array<float> _rawLengths;
66  Common::Array<float> _lengths;
67 };
68 
69 } // end namespace Tetraedge
70 
71 #endif // TETRAEDGE_TE_TE_BEZIER_CURVE_H
Definition: te_bezier_curve.h:32
Definition: detection.h:27
Definition: stream.h:77
Definition: array.h:52
Definition: path.h:52
Definition: te_3d_object2.h:36
Definition: te_vector3f32.h:33
Definition: stream.h:385
Definition: te_references_counter.h:27