light_occluder_2d.h
1 #ifndef LIGHTOCCLUDER2D_H
2 #define LIGHTOCCLUDER2D_H
3 
4 #include "scene/2d/node_2d.h"
5 
6 class OccluderPolygon2D : public Resource {
7 
8  OBJ_TYPE(OccluderPolygon2D,Resource);
9 public:
10 
11  enum CullMode {
12  CULL_DISABLED,
13  CULL_CLOCKWISE,
14  CULL_COUNTER_CLOCKWISE
15  };
16 private:
17 
18 
19  RID occ_polygon;
20  DVector<Vector2> polygon;
21  bool closed;
22  CullMode cull;
23 
24 protected:
25 
26  static void _bind_methods();
27 public:
28 
29  void set_polygon(const DVector<Vector2>& p_polygon);
30  DVector<Vector2> get_polygon() const;
31 
32  void set_closed(bool p_closed);
33  bool is_closed() const;
34 
35  void set_cull_mode(CullMode p_mode);
36  CullMode get_cull_mode() const;
37 
38  virtual RID get_rid() const;
41 
42 };
43 
44 VARIANT_ENUM_CAST(OccluderPolygon2D::CullMode);
45 
46 class LightOccluder2D : public Node2D {
47  OBJ_TYPE(LightOccluder2D,Node2D);
48 
49  RID occluder;
50  bool enabled;
51  int mask;
52  Ref<OccluderPolygon2D> occluder_polygon;
53 
54 #ifdef DEBUG_ENABLED
55  void _poly_changed();
56 #endif
57 
58 protected:
59  void _notification(int p_what);
60  static void _bind_methods();
61 public:
62 
63  void set_occluder_polygon(const Ref<OccluderPolygon2D>& p_polygon);
64  Ref<OccluderPolygon2D> get_occluder_polygon() const;
65 
66  void set_occluder_light_mask(int p_mask);
67  int get_occluder_light_mask() const;
68 
70  ~LightOccluder2D();
71 };
72 
73 #endif // LIGHTOCCLUDER2D_H
Definition: light_occluder_2d.h:6
Definition: resource.h:89
Definition: rid.h:47
Definition: node_2d.h:34
Definition: light_occluder_2d.h:46