Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/mapfile.cc')
-rw-r--r--src/model/mapfile.cc66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index 54f6d78..cc96051 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -131,8 +131,8 @@ void face_texture_verts(Face &face, const math::Vector2f &tex_shift, const float
const math::Vector2f map_texture_coords(Face *face, const math::Vector3f &v)
{
return math::Vector2f (
- (face->tex_shift().x + math::dotproduct(face->tex_vec(0), v)) / face->material()->size().width(),
- (face->tex_shift().y + math::dotproduct(face->tex_vec(1), v)) / face->material()->size().height()
+ (face->tex_shift().x() + math::dotproduct(face->tex_vec(0), v)) / face->material()->size().width(),
+ (face->tex_shift().y() + math::dotproduct(face->tex_vec(1), v)) / face->material()->size().height()
);
}
@@ -446,9 +446,9 @@ void MapFile::make_brushface(Face *face)
// calculate initial vertices on the bounding box
// check if the face is x-axis oriented
- if ((fabsf(face->normal().x) >= fabsf(face->normal().y)) && (fabsf(face->normal().x) >= fabsf(face->normal().z))) {
+ if ((fabsf(face->normal().x()) >= fabsf(face->normal().y())) && (fabsf(face->normal().x()) >= fabsf(face->normal().z()))) {
- if (face->normal().x > MIN_DELTA) {
+ if (face->normal().x() > MIN_DELTA) {
vl.push_back(new math::Vector3f(0, -MAX_BOUNDS, -MAX_BOUNDS));
vl.push_back(new math::Vector3f(0, -MAX_BOUNDS, MAX_BOUNDS));
vl.push_back(new math::Vector3f(0, MAX_BOUNDS, MAX_BOUNDS));
@@ -461,17 +461,17 @@ void MapFile::make_brushface(Face *face)
}
// calculate the x coordinate of each face vertex
for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
- (*it)->x = (-face->d() -
- face->normal().z * (*it)->z -
- face->normal().y * (*it)->y) /
- face->normal().x;
+ (*it)->get_x() = (-face->d() -
+ face->normal().z() * (*it)->z() -
+ face->normal().y() * (*it)->y()) /
+ face->normal().x();
}
}
// check if the face is y-axis oriented
- else if ((fabsf(face->normal().y) >= fabsf(face->normal().x)) && (fabsf(face->normal().y) >= fabsf(face->normal().z))) {
+ else if ((fabsf(face->normal().y()) >= fabsf(face->normal().x())) && (fabsf(face->normal().y()) >= fabsf(face->normal().z()))) {
- if (face->normal().y > MIN_DELTA) {
+ if (face->normal().y() > MIN_DELTA) {
vl.push_back(new Vector3f(MAX_BOUNDS, 0, -MAX_BOUNDS));
vl.push_back(new Vector3f(MAX_BOUNDS, 0, MAX_BOUNDS));
vl.push_back(new Vector3f(-MAX_BOUNDS, 0, MAX_BOUNDS));
@@ -485,17 +485,17 @@ void MapFile::make_brushface(Face *face)
// calculate the x coordinate of each face vertex
for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
- (*it)->y = (-face->d() -
- face->normal().z * (*it)->z -
- face->normal().x * (*it)->x) /
- face->normal().y;
+ (*it)->get_y() = (-face->d() -
+ face->normal().z() * (*it)->z() -
+ face->normal().x() * (*it)->x()) /
+ face->normal().y();
}
}
// face must be z-axis oriented
else {
- if (face->normal().z > MIN_DELTA) {
+ if (face->normal().z() > MIN_DELTA) {
vl.push_back(new Vector3f(-MAX_BOUNDS, -MAX_BOUNDS, 0));
vl.push_back(new Vector3f(-MAX_BOUNDS, MAX_BOUNDS, 0));
vl.push_back(new Vector3f(MAX_BOUNDS, MAX_BOUNDS, 0));
@@ -509,10 +509,10 @@ void MapFile::make_brushface(Face *face)
// calculate the x coordinate of each face vertex
for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
- (*it)->z = (-face->d() -
- face->normal().x * (*it)->x -
- face->normal().y * (*it)->y) /
- face->normal().z;
+ (*it)->get_z() = (-face->d() -
+ face->normal().x() * (*it)->x() -
+ face->normal().y() * (*it)->y()) /
+ face->normal().z();
}
}
@@ -529,7 +529,7 @@ void MapFile::make_brushface(Face *face)
Vector3f pn = crossproduct(plane->point(1)-plane->point(0), plane->point(2)-plane->point(0));
Vector3f t = crossproduct(fn, pn);
- if ((t.x == 0) && (t.y == 0) && (t.z == 0)) {
+ if ((t.x() == 0) && (t.y() == 0) && (t.z() == 0)) {
continue;
}
@@ -552,7 +552,7 @@ void MapFile::make_brushface(Face *face)
prev = *vl.back();
}
- if ((v.x*plane->normal().x + v.y*plane->normal().y + v.z*plane->normal().z +plane->d()) < MIN_DELTA) {
+ if ((v.x() * plane->normal().x() + v.y() * plane->normal().y() + v.z() * plane->normal().z() + plane->d()) < MIN_DELTA) {
// find current
std::vector<Vector3f *>::iterator vit = vl.begin();
@@ -561,14 +561,14 @@ void MapFile::make_brushface(Face *face)
}
// check if prev - v intersects with plane
- if ((prev.x*plane->normal().x + prev.y*plane->normal().y + prev.z*plane->normal().z + plane->d()) > MIN_DELTA) {
+ if ((prev.x() * plane->normal().x() + prev.y() * plane->normal().y() + prev.z() * plane->normal().z() + plane->d()) > MIN_DELTA) {
// calculate intersection
- float t1 = -plane->normal().x * prev.x - plane->normal().y * prev.y - plane->normal().z * prev.z -plane->d();
- float t2 = (plane->normal().x * v.x - plane->normal().x * prev.x +
- plane->normal().y * v.y - plane->normal().y * prev.y +
- plane->normal().z * v.z - plane->normal().z * prev.z);
-
+ float t1 = -plane->normal().x() * prev.x() - plane->normal().y() * prev.y() - plane->normal().z() * prev.z() -plane->d();
+ float t2 = (plane->normal().x() * v.x() - plane->normal().x() * prev.x() +
+ plane->normal().y() * v.y() - plane->normal().y() * prev.y() +
+ plane->normal().z() * v.z() - plane->normal().z() * prev.z());
+
Vector3f *s = new Vector3f;
if (t2 == 0) {
@@ -584,14 +584,14 @@ void MapFile::make_brushface(Face *face)
}
// check if next - v intersects with plane
- if ((next.x*plane->normal().x + next.y*plane->normal().y + next.z*plane->normal().z + plane->d()) > MIN_DELTA) {
+ if ((next.x() * plane->normal().x() + next.y() * plane->normal().y() + next.z() * plane->normal().z() + plane->d()) > MIN_DELTA) {
// calculate intersection
- float t1 = -plane->normal().x * v.x - plane->normal().y * v.y - plane->normal().z * v.z -plane->d();
- float t2 = (plane->normal().x * next.x - plane->normal().x * v.x +
- plane->normal().y * next.y - plane->normal().y * v.y +
- plane->normal().z * next.z - plane->normal().z * v.z);
- //cout << "next t2 " << t2 << std::endl;
+ float t1 = -plane->normal().x() * v.x() - plane->normal().y() * v.y() - plane->normal().z() * v.z() -plane->d();
+ float t2 = (plane->normal().x() * next.x() - plane->normal().x() * v.x() +
+ plane->normal().y() * next.y() - plane->normal().y() * v.y() +
+ plane->normal().z() * next.z() - plane->normal().z() * v.z());
+
Vector3f *s = new Vector3f;
if (t2 == 0) {