summaryrefslogtreecommitdiffhomepage
path: root/Stars45/Skin.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-04-01 21:23:39 +0200
committerAki <please@ignore.pl>2022-04-01 21:23:39 +0200
commit3c487c5cd69c53d6fea948643c0a76df03516605 (patch)
tree72730c7b8b26a5ef8fc9a987ec4c16129efd5aac /Stars45/Skin.cpp
parent8f353abd0bfe18baddd8a8250ab7c4f2d1c83a6e (diff)
downloadstarshatter-3c487c5cd69c53d6fea948643c0a76df03516605.zip
starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.gz
starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.bz2
Moved Stars45 to StarsEx
Diffstat (limited to 'Stars45/Skin.cpp')
-rw-r--r--Stars45/Skin.cpp172
1 files changed, 0 insertions, 172 deletions
diff --git a/Stars45/Skin.cpp b/Stars45/Skin.cpp
deleted file mode 100644
index 62363c5..0000000
--- a/Stars45/Skin.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/* Starshatter: The Open Source Project
- Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
- Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
- Copyright (c) 1997-2006, Destroyer Studios LLC.
-
- AUTHOR: John DiCamillo
-
-
- OVERVIEW
- ========
- Classes for rendering solid meshes of polygons
-*/
-
-#include "Skin.h"
-#include "Solid.h"
-#include "Utils.h"
-
-// +--------------------------------------------------------------------+
-
-Skin::Skin(const char* n)
-{
- if (n && *n) {
- strncpy_s(name, n, NAMELEN);
- name[NAMELEN-1] = 0;
- }
-
- else {
- ZeroMemory(name, NAMELEN);
- }
-
- ZeroMemory(path, 256);
-}
-
-// +--------------------------------------------------------------------+
-
-Skin::~Skin()
-{
- cells.destroy();
-}
-
-// +--------------------------------------------------------------------+
-
-void
-Skin::SetName(const char* n)
-{
- if (n && *n) {
- strncpy_s(name, n, NAMELEN);
- name[NAMELEN-1] = 0;
- }
-}
-
-void
-Skin::SetPath(const char* n)
-{
- if (n && *n) {
- strncpy_s(path, n, 256);
- path[255] = 0;
- }
-
- else {
- ZeroMemory(path, 256);
- }
-}
-
-// +--------------------------------------------------------------------+
-
-void
-Skin::AddMaterial(const Material* mtl)
-{
- if (!mtl) return;
-
- bool found = false;
-
- ListIter<SkinCell> iter = cells;
- while (++iter && !found) {
- SkinCell* s = iter.value();
-
- if (s->skin && !strcmp(s->skin->name, mtl->name)) {
- s->skin = mtl;
- found = true;
- }
- }
-
- if (!found) {
- SkinCell* s = new SkinCell(mtl);
- cells.append(s);
- }
-}
-
-// +--------------------------------------------------------------------+
-
-void
-Skin::ApplyTo(Model* model) const
-{
- if (model) {
- for (int i = 0; i < cells.size(); i++) {
- SkinCell* s = cells[i];
-
- if (s->skin) {
- s->orig = model->ReplaceMaterial(s->skin);
- }
- }
- }
-}
-
-void
-Skin::Restore(Model* model) const
-{
- if (model) {
- for (int i = 0; i < cells.size(); i++) {
- SkinCell* s = cells[i];
-
- if (s->orig) {
- model->ReplaceMaterial(s->orig);
- s->orig = 0;
- }
- }
- }
-}
-
-// +--------------------------------------------------------------------+
-// +--------------------------------------------------------------------+
-// +--------------------------------------------------------------------+
-
-SkinCell::SkinCell(const Material* mtl)
- : skin(mtl), orig(0)
-{
-}
-
-SkinCell::~SkinCell()
-{
- delete skin;
-}
-
-// +--------------------------------------------------------------------+
-
-int
-SkinCell::operator == (const SkinCell& other) const
-{
- if (skin == other.skin)
- return true;
-
- if (skin && other.skin)
- return !strcmp(skin->name, other.skin->name);
-
- return false;
-}
-
-// +--------------------------------------------------------------------+
-
-const char*
-SkinCell::Name() const
-{
- if (skin)
- return skin->name;
-
- return "Invalid Skin Cell";
-}
-
-// +--------------------------------------------------------------------+
-
-void
-SkinCell::SetSkin(const Material* mtl)
-{
- skin = mtl;
-}
-
-void
-SkinCell::SetOrig(const Material* mtl)
-{
- orig = mtl;
-}