Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Shadow.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: nGenEx.lib
6  FILE: Shadow.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Dynamic Stencil Shadow Volumes
13 */
14 
15 #ifndef Shadow_h
16 #define Shadow_h
17 
18 #include "Geometry.h"
19 #include "Color.h"
20 
21 // +--------------------------------------------------------------------+
22 
23 #define Shadow_DESTROY(x) if (x) { x->Destroy(); x = 0; }
24 
25 // +--------------------------------------------------------------------+
26 
27 class Light;
28 class Scene;
29 class Solid;
30 class Video;
31 
32 // +--------------------------------------------------------------------+
33 
34 class Shadow
35 {
36 public:
37  static const char* TYPENAME() { return "Shadow"; }
38 
39  Shadow(Solid* solid);
40  virtual ~Shadow();
41 
42  int operator == (const Shadow& s) const { return this == &s; }
43 
44  // operations
45  void Render(Video* video);
46  void Update(Light* light);
47  void AddEdge(WORD v1, WORD v2);
48  void Reset();
49 
50  bool IsEnabled() const { return enabled; }
51  void SetEnabled(bool e) { enabled = e; }
52 
53  static void SetVisibleShadowVolumes(bool vis);
54  static bool GetVisibleShadowVolumes();
55 
56 protected:
59  int nverts;
60  int max_verts;
61  bool enabled;
62 
63  WORD* edges;
64  DWORD num_edges;
65 };
66 
67 // +--------------------------------------------------------------------+
68 
69 #endif Shadow_h
70