Skip to content

Commit

Permalink
Gloom|Refactor|Cleanup: Reorganized files; added Render base class
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent 525be96 commit 45f2f6a
Show file tree
Hide file tree
Showing 44 changed files with 659 additions and 320 deletions.
15 changes: 11 additions & 4 deletions doomsday/tests/test_gloom/CMakeLists.txt
Expand Up @@ -29,12 +29,16 @@ set (SOURCES
gloom/icamera.h
gloom/ilight.h
gloom/ident.h
gloom/geomath.cpp
gloom/geomath.h
gloom/geo/geomath.cpp
gloom/geo/geomath.h
gloom/geo/polygon.cpp
gloom/geo/polygon.h
gloom/gloomwidget.cpp
gloom/gloomwidget.h
gloom/gloomworld.cpp
gloom/gloomworld.h
gloom/render/context.cpp
gloom/render/context.h
gloom/render/databuffer.h
gloom/render/entityrender.cpp
gloom/render/entityrender.h
Expand All @@ -44,10 +48,12 @@ set (SOURCES
gloom/render/mapbuild.h
gloom/render/maprender.cpp
gloom/render/maprender.h
gloom/render/polygon.cpp
gloom/render/polygon.h
gloom/render/render.cpp
gloom/render/render.h
gloom/render/skybox.cpp
gloom/render/skybox.h
gloom/render/view.cpp
gloom/render/view.h
gloom/world/entity.cpp
gloom/world/entity.h
gloom/world/entitymap.cpp
Expand Down Expand Up @@ -77,6 +83,7 @@ set (SOURCES

deng_add_application (test_gloom ${SOURCES} ${HEADERS})

target_include_directories (test_gloom PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries (test_gloom Deng::libappfw fmodex)

if (APPLE)
Expand Down
Expand Up @@ -16,7 +16,7 @@
* http://www.gnu.org/licenses</small>
*/

#include "geomath.h"
#include "gloom/geo/geomath.h"

using namespace de;

Expand Down
Expand Up @@ -71,10 +71,12 @@ struct Line

T normal() const
{
const auto dirVec = dir();
/*const auto dirVec = dir();
return de::Vector3<typename T::ValueType>(dirVec.x, 0.0, dirVec.y)
.cross(de::Vector3<typename T::ValueType>(0, 1, 0))
.xz();
.xz();*/
const auto vec = dir();
return T(-vec.y, vec.x);
}

void flip()
Expand Down
Expand Up @@ -16,8 +16,8 @@
* http://www.gnu.org/licenses</small>
*/

#include "polygon.h"
#include "../geomath.h"
#include "gloom/geo/polygon.h"
#include "gloom/geo/geomath.h"

using namespace de;

Expand Down
Expand Up @@ -22,7 +22,7 @@
#include <QVector>
#include <de/Vector>
#include <de/Rectangle>
#include "../geomath.h"
#include "gloom/geo/geomath.h"

namespace gloom { namespace geo {

Expand Down
30 changes: 23 additions & 7 deletions doomsday/tests/test_gloom/gloom/gloomwidget.cpp
Expand Up @@ -16,17 +16,17 @@
* http://www.gnu.org/licenses</small>
*/

#include "gloomwidget.h"
#include "audio/audiosystem.h"
#include "world/world.h"
#include "world/user.h"
#include "gloom/gloomwidget.h"
#include "gloom/audio/audiosystem.h"
#include "gloom/gloomworld.h"
#include "gloom/world/user.h"
#include "gloom/world/world.h"

#include <de/Drawable>
#include <de/GLBuffer>
#include <de/BaseGuiApp>
#include <de/KeyEvent>
#include <de/Matrix>
#include <de/VRConfig>
#include <de/KeyEvent>

using namespace de;

Expand All @@ -35,7 +35,7 @@ namespace gloom {
DENG_GUI_PIMPL(GloomWidget)
{
Matrix4f modelView;
World * world = nullptr;
SafePtr<World> world;
Time previousUpdateAt;
User user;
User::InputState inputs;
Expand Down Expand Up @@ -173,6 +173,16 @@ bool GloomWidget::handleEvent(Event const &event)
{
const KeyEvent &key = event.as<KeyEvent>();

// Check for some key commands.
if (key.isKeyDown())
{
if (key.ddKey() == '1' || key.ddKey() == '2')
{
d->world->as<GloomWorld>().setDebugMode(key.ddKey() - '1');
return true;
}
}

User::InputBit bit = User::Inert;
switch (key.ddKey())
{
Expand Down Expand Up @@ -204,6 +214,12 @@ bool GloomWidget::handleEvent(Event const &event)
{
const MouseEvent &mouse = event.as<MouseEvent>();

if (mouse.type() == Event::MouseWheel)
{
d->user.turn(Vector2f(mouse.wheel())/10.f);
return true;
}

if (d->mouseLook)
{
const Vector2i delta = mouse.pos() - d->lastMousePos;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/tests/test_gloom/gloom/gloomwidget.h
Expand Up @@ -20,7 +20,7 @@
#define GLOOMWIDGET_H

#include <de/GuiWidget>
#include "icamera.h"
#include "gloom/icamera.h"

namespace gloom {

Expand Down

0 comments on commit 45f2f6a

Please sign in to comment.