Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tests|Gloom: Working on a simple editor
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent 764ad78 commit 99e634e
Show file tree
Hide file tree
Showing 7 changed files with 732 additions and 19 deletions.
2 changes: 2 additions & 0 deletions doomsday/tests/test_gloom/CMakeLists.txt
Expand Up @@ -52,6 +52,8 @@ set (SOURCES
src/globalshortcuts.h
src/gloomapp.cpp
src/gloomapp.h
src/editor.cpp
src/editor.h
src/main.cpp
src/mainwindow.cpp
src/mainwindow.h
Expand Down
57 changes: 42 additions & 15 deletions doomsday/tests/test_gloom/gloom/world/map.cpp
Expand Up @@ -53,27 +53,54 @@ Map::Map() : d(new Impl(this))
}
}
*/
#if 0
ID vols[2];
{
ID floor = append(planes(), Plane{{0, 0, 0}, {0, 1, 0}});
ID ceil = append(planes(), Plane{{0, 3, 0}, {0, -1, 0}});
vols[0] = append(volumes(), Volume{{floor, ceil}});
}
{
ID floor = append(planes(), Plane{{0, .25, 0}, {0, 1, 0}});
ID ceil = append(planes(), Plane{{0, 2.5, 0}, {0, -1, 0}});
vols[1] = append(volumes(), Volume{{floor, ceil}});
}

ID rooms[2] = {
append(sectors(), Sector{IDList(), IDList({vols[0]})}),
append(sectors(), Sector{IDList(), IDList({vols[1]})})
};

ID doorwayID[2];
IDList corners{{ append(points(), Point{-4, -4}),
append(points(), Point{ 4, -4}),
append(points(), Point{ 4, 4}),
append(points(), Point{ 0, 4}),
append(points(), Point{ 0, 8}),
append(points(), Point{-4, 8}) }};

IDList sides{{ append(lines(), Line{{corners[0], corners[1]}}),
append(lines(), Line{{corners[1], corners[2]}}),
append(lines(), Line{{corners[2], corners[3]}}),
append(lines(), Line{{corners[3], corners[4]}}),
append(lines(), Line{{corners[4], corners[5]}}),
append(lines(), Line{{corners[5], corners[0]}}) }};

ID floor = append(planes(), Plane{{0, 0, 0}, {0, 1, 0}});
ID ceil = append(planes(), Plane{{0, 3, 0}, {0, -1, 0}});

ID vol = append(volumes(), Volume{{floor, ceil}});

/*ID room =*/ append(sectors(), Sector{sides, IDList({vol})});
append(points(), Point{-4, 8}),
doorwayID[0] = append(points(), Point(-4, 5)),
doorwayID[1] = append(points(), Point(-4, 3)),
append(points(), Point{ 8, 3}),
append(points(), Point{ 8, 5}),
}};

ID openLine;
sectors()[rooms[0]].lines =
IDList{{append(lines(), Line{{corners[0], corners[1]}, {rooms[0], 0}}),
append(lines(), Line{{corners[1], corners[2]}, {rooms[0], 0}}),
append(lines(), Line{{corners[2], corners[3]}, {rooms[0], 0}}),
append(lines(), Line{{corners[3], corners[4]}, {rooms[0], 0}}),
append(lines(), Line{{corners[4], corners[5]}, {rooms[0], 0}}),
append(lines(), Line{{corners[5], corners[6]}, {rooms[0], 0}}),
openLine = append(lines(), Line{{corners[6], corners[7]}, {rooms[0], rooms[1]}}),
append(lines(), Line{{corners[7], corners[0]}, {rooms[0], 0}})}};

sectors()[rooms[1]].lines =
IDList{{openLine,
append(lines(), Line{{doorwayID[1], corners[8]}, {rooms[1], 0}}),
append(lines(), Line{{corners[8], corners[9]}, {rooms[1], 0}}),
append(lines(), Line{{corners[9], doorwayID[0]}, {rooms[1], 0}})}};
#endif
}

gloom::ID Map::newID()
Expand Down
3 changes: 2 additions & 1 deletion doomsday/tests/test_gloom/gloom/world/map.h
Expand Up @@ -31,6 +31,7 @@ typedef de::Vector2d Point;
struct Line
{
ID points[2];
ID sectors[2]; // front and back
};
struct Plane
{
Expand All @@ -44,7 +45,7 @@ struct Volume
struct Sector
{
IDList lines; // must have clockwise winding
IDList volumes;
IDList volumes; // must be ascending and share planes
};

typedef QHash<ID, Point> Points;
Expand Down

0 comments on commit 99e634e

Please sign in to comment.