summaryrefslogtreecommitdiffhomepage
path: root/nGenEx/Graphic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'nGenEx/Graphic.cpp')
-rw-r--r--nGenEx/Graphic.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/nGenEx/Graphic.cpp b/nGenEx/Graphic.cpp
index 5cdf14e..892610c 100644
--- a/nGenEx/Graphic.cpp
+++ b/nGenEx/Graphic.cpp
@@ -1,15 +1,15 @@
/* Project nGenEx
- Destroyer Studios LLC
- Copyright © 1997-2004. All Rights Reserved.
+ Destroyer Studios LLC
+ Copyright © 1997-2004. All Rights Reserved.
- SUBSYSTEM: nGenEx.lib
- FILE: Graphic.cpp
- AUTHOR: John DiCamillo
+ SUBSYSTEM: nGenEx.lib
+ FILE: Graphic.cpp
+ AUTHOR: John DiCamillo
- OVERVIEW
- ========
- Abstract 3D Graphic Object
+ OVERVIEW
+ ========
+ Abstract 3D Graphic Object
*/
#include "MemDebug.h"
@@ -24,17 +24,17 @@ int Graphic::id_key = 1;
// +--------------------------------------------------------------------+
Graphic::Graphic()
- : id(id_key++), visible(true), loc(0.0f, 0.0f, 0.0f),
- radius(0.0f), infinite(0), foreground(0), hidden(0), life(-1),
- trans(false), shadow(false), luminous(false), depth(0.0f), scene(0)
+: id(id_key++), visible(true), loc(0.0f, 0.0f, 0.0f),
+radius(0.0f), infinite(0), foreground(0), hidden(0), life(-1),
+trans(false), shadow(false), luminous(false), depth(0.0f), scene(0)
{
- screen_rect.x = 0;
- screen_rect.y = 0;
- screen_rect.w = 0;
- screen_rect.h = 0;
+ screen_rect.x = 0;
+ screen_rect.y = 0;
+ screen_rect.w = 0;
+ screen_rect.h = 0;
- ZeroMemory(name, sizeof(name));
- strcpy_s(name, "Graphic");
+ ZeroMemory(name, sizeof(name));
+ strcpy_s(name, "Graphic");
}
// +--------------------------------------------------------------------+
@@ -45,31 +45,31 @@ Graphic::~Graphic()
int
Graphic::operator < (const Graphic& g) const
{
- if (!infinite && g.infinite)
- return 1;
+ if (!infinite && g.infinite)
+ return 1;
- else if (infinite && !g.infinite)
- return 0;
+ else if (infinite && !g.infinite)
+ return 0;
- double za = fabs(Depth());
- double zb = fabs(g.Depth());
+ double za = fabs(Depth());
+ double zb = fabs(g.Depth());
- return (za < zb);
+ return (za < zb);
}
int
Graphic::operator <= (const Graphic& g) const
{
- if (!infinite && g.infinite)
- return 1;
+ if (!infinite && g.infinite)
+ return 1;
- else if (infinite && !g.infinite)
- return 0;
+ else if (infinite && !g.infinite)
+ return 0;
- double za = fabs(Depth());
- double zb = fabs(g.Depth());
+ double za = fabs(Depth());
+ double zb = fabs(g.Depth());
- return (za <= zb);
+ return (za <= zb);
}
// +--------------------------------------------------------------------+
@@ -77,10 +77,10 @@ Graphic::operator <= (const Graphic& g) const
void
Graphic::SetInfinite(bool b)
{
- infinite = (BYTE) b;
+ infinite = (BYTE) b;
- if (infinite)
- depth = 1.0e9f;
+ if (infinite)
+ depth = 1.0e9f;
}
// +--------------------------------------------------------------------+
@@ -88,9 +88,9 @@ Graphic::SetInfinite(bool b)
int
Graphic::Nearer(Graphic* a, Graphic* b)
{
- if (a->depth < b->depth) return -1;
- else if (a->depth == b->depth) return 0;
- else return 1;
+ if (a->depth < b->depth) return -1;
+ else if (a->depth == b->depth) return 0;
+ else return 1;
}
// +--------------------------------------------------------------------+
@@ -98,9 +98,9 @@ Graphic::Nearer(Graphic* a, Graphic* b)
int
Graphic::Farther(Graphic* a, Graphic* b)
{
- if (a->depth > b->depth) return -1;
- else if (a->depth == b->depth) return 0;
- else return 1;
+ if (a->depth > b->depth) return -1;
+ else if (a->depth == b->depth) return 0;
+ else return 1;
}
// +--------------------------------------------------------------------+
@@ -108,10 +108,10 @@ Graphic::Farther(Graphic* a, Graphic* b)
void
Graphic::Destroy()
{
- if (scene)
- scene->DelGraphic(this);
+ if (scene)
+ scene->DelGraphic(this);
- delete this;
+ delete this;
}
// +--------------------------------------------------------------------+
@@ -119,22 +119,22 @@ Graphic::Destroy()
int
Graphic::CollidesWith(Graphic& o)
{
- Point delta_loc = loc - o.loc;
+ Point delta_loc = loc - o.loc;
- // bounding spheres test:
- if (delta_loc.length() > radius + o.radius)
- return 0;
+ // bounding spheres test:
+ if (delta_loc.length() > radius + o.radius)
+ return 0;
- return 1;
+ return 1;
}
// +--------------------------------------------------------------------+
int
Graphic::CheckRayIntersection(Point Q, Point w, double len, Point& ipt,
- bool treat_translucent_polys_as_solid)
+bool treat_translucent_polys_as_solid)
{
- return 0;
+ return 0;
}
// +--------------------------------------------------------------------+
@@ -142,10 +142,10 @@ Graphic::CheckRayIntersection(Point Q, Point w, double len, Point& ipt,
void
Graphic::ProjectScreenRect(Projector* p)
{
- screen_rect.x = 2000;
- screen_rect.y = 2000;
- screen_rect.w = 0;
- screen_rect.h = 0;
+ screen_rect.x = 2000;
+ screen_rect.y = 2000;
+ screen_rect.w = 0;
+ screen_rect.h = 0;
}
// +--------------------------------------------------------------------+
@@ -153,18 +153,18 @@ Graphic::ProjectScreenRect(Projector* p)
bool
Graphic::CheckVisibility(Projector& projector)
{
- if (projector.IsVisible( Location(), Radius()) &&
- projector.ApparentRadius(Location(), Radius()) > 1) {
-
- visible = true;
- }
- else {
- visible = false;
- screen_rect.x = 2000;
- screen_rect.y = 2000;
- screen_rect.w = 0;
- screen_rect.h = 0;
- }
-
- return visible;
+ if (projector.IsVisible( Location(), Radius()) &&
+ projector.ApparentRadius(Location(), Radius()) > 1) {
+
+ visible = true;
+ }
+ else {
+ visible = false;
+ screen_rect.x = 2000;
+ screen_rect.y = 2000;
+ screen_rect.w = 0;
+ screen_rect.h = 0;
+ }
+
+ return visible;
}