Skip to content

Commit

Permalink
Refactor|World|Blockmap: Blockmap now encapsulates Gridmap
Browse files Browse the repository at this point in the history
The level at which Gridmap was abstracted from Blockmap is not useful.
There are however two meaningful abstractions; 1) Quadtree extraction
with floating-point space region/point lookup, and 2) external storage
allocator and accessor to the data within the Blockmap.
  • Loading branch information
danij-deng committed Oct 8, 2013
1 parent 3166143 commit 1d4129a
Show file tree
Hide file tree
Showing 7 changed files with 381 additions and 703 deletions.
2 changes: 0 additions & 2 deletions doomsday/client/client.pro
Expand Up @@ -259,7 +259,6 @@ DENG_HEADERS += \
include/gl/svg.h \
include/gl/sys_opengl.h \
include/gl/texturecontent.h \
include/gridmap.h \
include/hedge.h \
include/ihplane.h \
include/library.h \
Expand Down Expand Up @@ -612,7 +611,6 @@ SOURCES += \
src/gl/gl_texmanager.cpp \
src/gl/svg.cpp \
src/gl/sys_opengl.cpp \
src/gridmap.cpp \
src/hedge.cpp \
src/library.cpp \
src/m_decomp64.cpp \
Expand Down
1 change: 0 additions & 1 deletion doomsday/client/include/de_misc.h
Expand Up @@ -27,7 +27,6 @@
#include "m_misc.h"
#include "m_nodepile.h"
#include "m_profiler.h"
#include "gridmap.h"
#include "m_decomp64.h"
#include <de/stack.h>
#include <de/mathutil.h>
Expand Down
174 changes: 0 additions & 174 deletions doomsday/client/include/gridmap.h

This file was deleted.

37 changes: 31 additions & 6 deletions doomsday/client/include/world/blockmap.h
Expand Up @@ -25,7 +25,13 @@

#include <de/Vector>

#include "gridmap.h"
#ifdef min
# undef min
#endif

#ifdef max
# undef max
#endif

namespace de {

Expand All @@ -35,8 +41,19 @@ namespace de {
class Blockmap
{
public:
typedef GridmapCell Cell;
typedef GridmapCellBlock CellBlock;
typedef Vector2ui Cell;

/**
* POD structure representing a rectangular range of cells.
*/
struct CellBlock
{
Cell min;
Cell max;

CellBlock(Cell const &min = Cell(), Cell const &max = Cell()) : min(min), max(max) {}
CellBlock(CellBlock const &other) : min(other.min), max(other.max) {}
};

public:
/**
Expand Down Expand Up @@ -136,10 +153,18 @@ class Blockmap
int iterate(CellBlock const &cellBlock, int (*callback) (void *elem, void *context), void *context = 0) const;

/**
* Retrieve an immutable pointer to the underlying Gridmap instance
* (primarily intended for debug purposes).
* Render a visual for this gridmap to assist in debugging (etc...).
*
* This visualizer assumes that the caller has already configured the GL
* render state (projection matrices, scale, etc...) as desired prior to
* calling. This function guarantees to restore the previous GL state if
* any changes are made to it.
*
* @note Internally this visual uses fixed unit dimensions [1x1] for cells,
* therefore the caller should scale the appropriate matrix to scale this
* visual as desired.
*/
Gridmap const &gridmap() const;
void drawDebugVisual() const;

private:
DENG2_PRIVATE(d)
Expand Down

0 comments on commit 1d4129a

Please sign in to comment.