path.h
1 /*************************************************************************/
2 /* path.h */
3 /*************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* http://www.godotengine.org */
7 /*************************************************************************/
8 /* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
9 /* */
10 /* Permission is hereby granted, free of charge, to any person obtaining */
11 /* a copy of this software and associated documentation files (the */
12 /* "Software"), to deal in the Software without restriction, including */
13 /* without limitation the rights to use, copy, modify, merge, publish, */
14 /* distribute, sublicense, and/or sell copies of the Software, and to */
15 /* permit persons to whom the Software is furnished to do so, subject to */
16 /* the following conditions: */
17 /* */
18 /* The above copyright notice and this permission notice shall be */
19 /* included in all copies or substantial portions of the Software. */
20 /* */
21 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
22 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
23 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
24 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
25 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
26 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
27 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
28 /*************************************************************************/
29 #ifndef PATH_H
30 #define PATH_H
31 
32 #include "scene/resources/curve.h"
33 #include "scene/3d/spatial.h"
34 
35 class Path : public Spatial {
36 
37  OBJ_TYPE( Path, Spatial );
38 
39  Ref<Curve3D> curve;
40 
41  void _curve_changed();
42 
43 
44 protected:
45 
46  void _notification(int p_what);
47  static void _bind_methods();
48 public:
49 
50  void set_curve(const Ref<Curve3D>& p_curve);
51  Ref<Curve3D> get_curve() const;
52 
53 
54  Path();
55 };
56 
57 class PathFollow : public Spatial {
58 
59  OBJ_TYPE(PathFollow,Spatial);
60 public:
61 
62  enum RotationMode {
63 
64  ROTATION_NONE,
65  ROTATION_Y,
66  ROTATION_XY,
67  ROTATION_XYZ
68  };
69 
70 private:
71  Path *path;
72  real_t offset;
73  real_t h_offset;
74  real_t v_offset;
75  real_t lookahead;
76  bool cubic;
77  bool loop;
78  RotationMode rotation_mode;
79 
80  void _update_transform();
81 
82 
83 protected:
84 
85  bool _set(const StringName& p_name, const Variant& p_value);
86  bool _get(const StringName& p_name,Variant &r_ret) const;
87  void _get_property_list( List<PropertyInfo> *p_list) const;
88 
89  void _notification(int p_what);
90  static void _bind_methods();
91 public:
92 
93  void set_offset(float p_offset);
94  float get_offset() const;
95 
96  void set_h_offset(float p_h_offset);
97  float get_h_offset() const;
98 
99  void set_v_offset(float p_v_offset);
100  float get_v_offset() const;
101 
102  void set_unit_offset(float p_unit_offset);
103  float get_unit_offset() const;
104 
105  void set_lookahead(float p_lookahead);
106  float get_lookahead() const;
107 
108  void set_loop(bool p_loop);
109  bool has_loop() const;
110 
111  void set_rotation_mode(RotationMode p_rotation_mode);
112  RotationMode get_rotation_mode() const;
113 
114  void set_cubic_interpolation(bool p_enable);
115  bool get_cubic_interpolation() const;
116 
117  PathFollow();
118 };
119 
120 VARIANT_ENUM_CAST(PathFollow::RotationMode);
121 
122 #endif // PATH_H
Definition: path.h:57
Definition: variant.h:74
Definition: path.h:35
Definition: string_db.h:48
Definition: tween_interpolaters.cpp:257
Definition: spatial.h:56