Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Skin.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: Skin.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Classes for managing run-time selectable skins on solid objects
13 */
14 
15 #ifndef Skin_h
16 #define Skin_h
17 
18 #include "Polygon.h"
19 #include "Graphic.h"
20 #include "Video.h"
21 #include "List.h"
22 
23 // +--------------------------------------------------------------------+
24 
25 class Solid;
26 class Model;
27 class Surface;
28 class Segment;
29 
30 class Skin;
31 class SkinCell;
32 
33 // +--------------------------------------------------------------------+
34 
35 class Skin
36 {
37 public:
38  static const char* TYPENAME() { return "Skin"; }
39  enum { NAMELEN=64 };
40 
41  Skin(const char* name = 0);
42  virtual ~Skin();
43 
44  // operations
45  void ApplyTo(Model* model) const;
46  void Restore(Model* model) const;
47 
48  // accessors / mutators
49  const char* Name() const { return name; }
50  const char* Path() const { return path; }
51  int NumCells() const { return cells.size(); }
52 
53  void SetName(const char* n);
54  void SetPath(const char* n);
55  void AddMaterial(const Material* mtl);
56 
57 protected:
58  char name[NAMELEN];
59  char path[256];
61 };
62 
63 // +--------------------------------------------------------------------+
64 
65 class SkinCell
66 {
67  friend class Skin;
68 
69 public:
70  static const char* TYPENAME() { return "SkinCell"; }
71 
72  SkinCell(const Material* mtl=0);
73  ~SkinCell();
74 
75  int operator == (const SkinCell& other) const;
76 
77  const char* Name() const;
78  const Material* Skin() const { return skin; }
79  const Material* Orig() const { return orig; }
80 
81  void SetSkin(const Material* mtl);
82  void SetOrig(const Material* mtl);
83 
84 private:
85  const Material* skin;
86  const Material* orig;
87 };
88 
89 // +--------------------------------------------------------------------+
90 
91 #endif Skin_h
92