summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2008-05-18 15:22:02 +0200
committerneoraider <devnull@localhost>2008-05-18 15:22:02 +0200
commit094c72221ea15615b4bcdc31a4acbb4e5c67817a (patch)
tree028374bdd94d789c23627af20c4eb385cb8186c9 /src
parent36d892d1f0f0a919e70f81abddaeb568f1f7625c (diff)
downloadzoomedit-094c72221ea15615b4bcdc31a4acbb4e5c67817a.tar
zoomedit-094c72221ea15615b4bcdc31a4acbb4e5c67817a.zip
zoomedit:
* Removed unused vector maths * Added missing const to set*-methods in Triangle
Diffstat (limited to 'src')
-rw-r--r--src/Data/Makefile.am2
-rw-r--r--src/Data/Makefile.in6
-rw-r--r--src/Data/Triangle.h7
-rw-r--r--src/Data/Vector.cpp96
-rw-r--r--src/Data/Vector.h25
-rw-r--r--src/Data/Vertex.cpp63
-rw-r--r--src/Data/Vertex.h13
7 files changed, 8 insertions, 204 deletions
diff --git a/src/Data/Makefile.am b/src/Data/Makefile.am
index b4e9beb..88d42fd 100644
--- a/src/Data/Makefile.am
+++ b/src/Data/Makefile.am
@@ -1,3 +1,3 @@
noinst_LTLIBRARIES = libdata.la
-libdata_la_SOURCES = Info.cpp Gate.cpp Level.cpp Room.cpp Texture.cpp Triangle.cpp Vector.cpp Vertex.cpp
+libdata_la_SOURCES = Info.cpp Gate.cpp Level.cpp Room.cpp Texture.cpp Triangle.cpp
diff --git a/src/Data/Makefile.in b/src/Data/Makefile.in
index 6ab63ac..9e19bf5 100644
--- a/src/Data/Makefile.in
+++ b/src/Data/Makefile.in
@@ -44,7 +44,7 @@ CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libdata_la_LIBADD =
am_libdata_la_OBJECTS = Info.lo Gate.lo Level.lo Room.lo Texture.lo \
- Triangle.lo Vector.lo Vertex.lo
+ Triangle.lo
libdata_la_OBJECTS = $(am_libdata_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -180,7 +180,7 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = libdata.la
-libdata_la_SOURCES = Info.cpp Gate.cpp Level.cpp Room.cpp Texture.cpp Triangle.cpp Vector.cpp Vertex.cpp
+libdata_la_SOURCES = Info.cpp Gate.cpp Level.cpp Room.cpp Texture.cpp Triangle.cpp
all: all-am
.SUFFIXES:
@@ -238,8 +238,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Room.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Texture.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Triangle.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vector.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vertex.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/src/Data/Triangle.h b/src/Data/Triangle.h
index 2267f36..979fbfa 100644
--- a/src/Data/Triangle.h
+++ b/src/Data/Triangle.h
@@ -21,6 +21,7 @@
#define ZOOMEDIT_DATA_TRIANGLE_H_
#include "Vertex.h"
+#include "Vector.h"
#include "TexCoords.h"
#include <libxml++/nodes/element.h>
@@ -52,7 +53,7 @@ class Triangle {
const Vertex& getVertex(unsigned int i) const {return vertices[i%3];}
void setVertex(unsigned int i, const Vertex &v);
- void setVertices(Vertex *v) {
+ void setVertices(const Vertex *v) {
for(int i = 0; i < 3; ++i)
setVertex(i, v[i]);
}
@@ -60,7 +61,7 @@ class Triangle {
const Vector& getNormal(unsigned int i) const {return normals[i%3];}
void setNormal(unsigned int i, const Vector &n);
- void setNormals(Vector *n) {
+ void setNormals(const Vector *n) {
for(int i = 0; i < 3; ++i)
setNormal(i, n[i]);
}
@@ -68,7 +69,7 @@ class Triangle {
const TexCoords& getTexCoords(unsigned int i) const {return texCoords[i%3];}
void setTexCoords(unsigned int i, const TexCoords &t);
- void setTexCoords(TexCoords *t) {
+ void setTexCoords(const TexCoords *t) {
for(int i = 0; i < 3; ++i)
setTexCoords(i, t[i]);
}
diff --git a/src/Data/Vector.cpp b/src/Data/Vector.cpp
deleted file mode 100644
index 8677fd1..0000000
--- a/src/Data/Vector.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Vector.cpp
- *
- * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Vector.h"
-#include <cmath>
-
-namespace ZoomEdit {
-namespace Data {
-
-float Vector::lengthSq() const {
- return x*x + y*y + z*z;
-}
-
-float Vector::length() const {
- return std::sqrt(lengthSq());
-}
-
-Vector Vector::operator+(const Vector &v) const {
- return Vector(x + v.x, y + v.y, z + v.z);
-}
-
-Vector Vector::operator-(const Vector &v) const {
- return Vector(x - v.x, y - v.y, z - v.z);
-}
-
-float Vector::operator*(const Vector &v) const {
- return (x*v.x + y*v.y + z*v.z);
-}
-
-Vector Vector::operator*(float f) const {
- return Vector(x*f, y*f, z*f);
-}
-
-Vector Vector::operator/(float f) const {
- return Vector(x/f, y/f, z/f);
-}
-
-Vector Vector::operator%(const Vector &v) const {
- return Vector(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
-}
-
-Vector& Vector::operator+=(const Vector &v) {
- x += v.x;
- y += v.y;
- z += v.z;
-
- return *this;
-}
-
-Vector& Vector::operator-=(const Vector &v) {
- x -= v.x;
- y -= v.y;
- z -= v.z;
-
- return *this;
-}
-
-Vector& Vector::operator*=(float f) {
- x *= f;
- y *= f;
- z *= f;
-
- return *this;
-}
-
-Vector& Vector::operator/=(float f) {
- x /= f;
- y /= f;
- z /= f;
-
- return *this;
-}
-
-Vector& Vector::operator%=(const Vector &v) {
- *this = *this % v;
- return *this;
-}
-
-}
-}
diff --git a/src/Data/Vector.h b/src/Data/Vector.h
index cfac1c0..ded0834 100644
--- a/src/Data/Vector.h
+++ b/src/Data/Vector.h
@@ -39,31 +39,6 @@ class Vector {
float getZ() const {return z;}
void setZ(float z0) {z = z0;}
-
- float lengthSq() const;
- float length() const;
-
- void normalize() {
- if(lengthSq())
- *this /= length();
- }
-
- Vector operator+(const Vector &v) const;
- Vector operator-(const Vector &v) const;
- float operator*(const Vector &v) const;
-
- Vector operator*(float f) const;
- Vector operator/(float f) const;
-
- Vector operator%(const Vector &v) const;
-
- Vector& operator+=(const Vector &v);
- Vector& operator-=(const Vector &v);
-
- Vector& operator*=(float f);
- Vector& operator/=(float f);
-
- Vector& operator%=(const Vector &v);
};
}
diff --git a/src/Data/Vertex.cpp b/src/Data/Vertex.cpp
deleted file mode 100644
index 24e34ba..0000000
--- a/src/Data/Vertex.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Vertex.cpp
- *
- * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Vertex.h"
-#include <cmath>
-
-namespace ZoomEdit {
-namespace Data {
-
-float Vertex::distanceSq(const Vertex &v) const {
- return (x - v.x)*(x - v.x) + (y - v.y)*(y - v.y) + (z - v.z)*(z - v.z);
-}
-
-float Vertex::distance(const Vertex &v) const {
- return std::sqrt(distanceSq(v));
-}
-
-Vector Vertex::operator-(const Vertex &v) const {
- return Vector(x - v.x, y - v.y, z - v.z);
-}
-
-Vertex Vertex::operator+(const Vector &v) const {
- return Vertex(x + v.getX(), y + v.getY(), z + v.getZ());
-}
-
-Vertex Vertex::operator-(const Vector &v) const {
- return Vertex(x - v.getX(), y - v.getY(), z - v.getZ());
-}
-
-Vertex& Vertex::operator+=(const Vector &v) {
- x += v.getX();
- y += v.getY();
- z += v.getZ();
-
- return *this;
-}
-
-Vertex& Vertex::operator-=(const Vector &v) {
- x -= v.getX();
- y -= v.getY();
- z -= v.getZ();
-
- return *this;
-}
-
-}
-}
diff --git a/src/Data/Vertex.h b/src/Data/Vertex.h
index a9660c4..423e0d2 100644
--- a/src/Data/Vertex.h
+++ b/src/Data/Vertex.h
@@ -20,7 +20,7 @@
#ifndef ZOOMEDIT_DATA_VERTEX_H_
#define ZOOMEDIT_DATA_VERTEX_H_
-#include "Vector.h"
+//#include "Vector.h"
namespace ZoomEdit {
namespace Data {
@@ -41,17 +41,6 @@ class Vertex {
float getZ() const {return z;}
void setZ(float z0) {z = z0;}
-
- float distanceSq(const Vertex &v) const;
- float distance(const Vertex &v) const;
-
- Vector operator-(const Vertex &v) const;
-
- Vertex operator+(const Vector &v) const;
- Vertex operator-(const Vector &v) const;
-
- Vertex& operator+=(const Vector &v);
- Vertex& operator-=(const Vector &v);
};
}