Skip to content

Commit

Permalink
Refactor|World|ContactBlockmap|Client: Reworked ContactBlockmap into …
Browse files Browse the repository at this point in the history
…a C++ class
  • Loading branch information
danij-deng committed Oct 6, 2013
1 parent 5c2f3f6 commit 10db338
Show file tree
Hide file tree
Showing 2 changed files with 351 additions and 326 deletions.
40 changes: 40 additions & 0 deletions doomsday/client/include/world/contactblockmap.h
Expand Up @@ -21,11 +21,51 @@
#ifndef DENG_CLIENT_WORLD_CONTACTBLOCKMAP_H
#define DENG_CLIENT_WORLD_CONTACTBLOCKMAP_H

#include <de/aabox.h>
#include "world/map.h"

class BspLeaf;
struct Contact;
class Lumobj;

class ContactBlockmap
{
public:
/**
* Construct a new contact blockmap.
*
* @param bounds Bounding box of the blockmap.
* @param blockSize Size of each block.
*/
ContactBlockmap(AABoxd const &bounds, uint blockSize = 128);

/**
* Returns the origin of the blockmap in map space.
*/
de::Vector2d const &origin() const;

/**
* @param contact Contact to be linked. Note that if object's origin lies
* outside the blockmap it will not be linked!
*/
void link(Contact *contact);

/**
* Clear all the contact list heads and spread flags.
*/
void unlinkAll();

/**
* Spread contacts in the blockmap to any touched neighbors.
*
* @param box Map space region in which to perform spreading.
*/
void spreadAllContacts(AABoxd const &box);

private:
DENG2_PRIVATE(d)
};

/**
* To be called during game change/on shutdown to destroy all contact blockmaps.
* This is necessary because the blockmaps are allocated from the Zone using a
Expand Down

0 comments on commit 10db338

Please sign in to comment.