Skip to content

Commit

Permalink
Refactor|Renderer|SkyDrawable: SkyDrawable stores LayerData (animatio…
Browse files Browse the repository at this point in the history
…n state)
  • Loading branch information
danij-deng committed Sep 7, 2014
1 parent 108b5c6 commit 4d7d9c8
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 66 deletions.
42 changes: 30 additions & 12 deletions doomsday/client/include/render/skydrawable.h
Expand Up @@ -31,8 +31,6 @@

class Sky;

#define MAX_SKY_MODELS ( 32 )

/**
* Sky drawable.
*
Expand All @@ -43,9 +41,21 @@ class Sky;
class SkyDrawable
{
public:
/// Required layer is missing. @ingroup errors
DENG2_ERROR(MissingLayerError);

/// Required model is missing. @ingroup errors
DENG2_ERROR(MissingModelError);

struct LayerData
{
bool active;
bool masked;
float offset;
Material *material;
float fadeOutLimit;
};

struct ModelData
{
de::Record const *def; // Sky model def
Expand Down Expand Up @@ -100,30 +110,38 @@ class SkyDrawable
*/
void draw(Sky const *sky = 0) const;

/**
* Determines whether the specified sky layer @a index is valid.
* @see layer()
*/
bool hasLayer(int index) const;

/**
* Lookup a sky layer by it's unique @a index.
* @see hasLayer()
*/
LayerData &layer(int index);

/// @copydoc layer()
LayerData const &layer(int index) const;

int firstActiveLayer() const;

/**
* Determines whether the specified sky model @a index is valid.
*
* @see model(), modelPtr()
* @see model()
*/
bool hasModel(int index) const;

/**
* Lookup a sky model by it's unique @a index.
*
* @see hasModel()
*/
ModelData &model(int index);

/// @copydoc model()
ModelData const &model(int index) const;

/**
* Returns a pointer to the referenced sky model; otherwise @c 0.
*
* @see hasModel(), model()
*/
inline ModelData *modelPtr(int index) { return hasModel(index)? &model(index) : 0; }

public:
static de::MaterialVariantSpec const &layerMaterialSpec(bool masked);

Expand Down

0 comments on commit 4d7d9c8

Please sign in to comment.