From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- Doc/doxygen/html/_skin_8cpp_source.html | 292 ++++++++++++++++++++++++++++++++ 1 file changed, 292 insertions(+) create mode 100644 Doc/doxygen/html/_skin_8cpp_source.html (limited to 'Doc/doxygen/html/_skin_8cpp_source.html') diff --git a/Doc/doxygen/html/_skin_8cpp_source.html b/Doc/doxygen/html/_skin_8cpp_source.html new file mode 100644 index 0000000..57e2f13 --- /dev/null +++ b/Doc/doxygen/html/_skin_8cpp_source.html @@ -0,0 +1,292 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/nGenEx/Skin.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
Skin.cpp
+
+
+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.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Classes for rendering solid meshes of polygons
+
13 */
+
14 
+
15 #include "MemDebug.h"
+
16 #include "Skin.h"
+
17 #include "Solid.h"
+
18 
+
19 void Print(const char* fmt, ...);
+
20 
+
21 // +--------------------------------------------------------------------+
+
22 
+
23 Skin::Skin(const char* n)
+
24 {
+
25  if (n && *n) {
+
26  strncpy_s(name, n, NAMELEN);
+
27  name[NAMELEN-1] = 0;
+
28  }
+
29 
+
30  else {
+
31  ZeroMemory(name, NAMELEN);
+
32  }
+
33 
+
34  ZeroMemory(path, 256);
+
35 }
+
36 
+
37 // +--------------------------------------------------------------------+
+
38 
+ +
40 {
+
41  cells.destroy();
+
42 }
+
43 
+
44 // +--------------------------------------------------------------------+
+
45 
+
46 void
+
47 Skin::SetName(const char* n)
+
48 {
+
49  if (n && *n) {
+
50  strncpy_s(name, n, NAMELEN);
+
51  name[NAMELEN-1] = 0;
+
52  }
+
53 }
+
54 
+
55 void
+
56 Skin::SetPath(const char* n)
+
57 {
+
58  if (n && *n) {
+
59  strncpy_s(path, n, 256);
+
60  path[255] = 0;
+
61  }
+
62 
+
63  else {
+
64  ZeroMemory(path, 256);
+
65  }
+
66 }
+
67 
+
68 // +--------------------------------------------------------------------+
+
69 
+
70 void
+ +
72 {
+
73  if (!mtl) return;
+
74 
+
75  bool found = false;
+
76 
+ +
78  while (++iter && !found) {
+
79  SkinCell* s = iter.value();
+
80 
+
81  if (s->skin && !strcmp(s->skin->name, mtl->name)) {
+
82  s->skin = mtl;
+
83  found = true;
+
84  }
+
85  }
+
86 
+
87  if (!found) {
+
88  SkinCell* s = new(__FILE__,__LINE__) SkinCell(mtl);
+
89  cells.append(s);
+
90  }
+
91 }
+
92 
+
93 // +--------------------------------------------------------------------+
+
94 
+
95 void
+
96 Skin::ApplyTo(Model* model) const
+
97 {
+
98  if (model) {
+
99  for (int i = 0; i < cells.size(); i++) {
+
100  SkinCell* s = cells[i];
+
101 
+
102  if (s->skin) {
+
103  s->orig = model->ReplaceMaterial(s->skin);
+
104  }
+
105  }
+
106  }
+
107 }
+
108 
+
109 void
+
110 Skin::Restore(Model* model) const
+
111 {
+
112  if (model) {
+
113  for (int i = 0; i < cells.size(); i++) {
+
114  SkinCell* s = cells[i];
+
115 
+
116  if (s->orig) {
+
117  model->ReplaceMaterial(s->orig);
+
118  s->orig = 0;
+
119  }
+
120  }
+
121  }
+
122 }
+
123 
+
124 // +--------------------------------------------------------------------+
+
125 // +--------------------------------------------------------------------+
+
126 // +--------------------------------------------------------------------+
+
127 
+ +
129 : skin(mtl), orig(0)
+
130 {
+
131 }
+
132 
+ +
134 {
+
135  delete skin;
+
136 }
+
137 
+
138 // +--------------------------------------------------------------------+
+
139 
+
140 int
+
141 SkinCell::operator == (const SkinCell& other) const
+
142 {
+
143  if (skin == other.skin)
+
144  return true;
+
145 
+
146  if (skin && other.skin)
+
147  return !strcmp(skin->name, other.skin->name);
+
148 
+
149  return false;
+
150 }
+
151 
+
152 // +--------------------------------------------------------------------+
+
153 
+
154 const char*
+ +
156 {
+
157  if (skin)
+
158  return skin->name;
+
159 
+
160  return "Invalid Skin Cell";
+
161 }
+
162 
+
163 // +--------------------------------------------------------------------+
+
164 
+
165 void
+ +
167 {
+
168  skin = mtl;
+
169 }
+
170 
+
171 void
+ +
173 {
+
174  orig = mtl;
+
175 }
+
+
+ + + + -- cgit v1.1