Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jan 23, 2013
1 parent c5fba9a commit 28425ef
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 26 deletions.
12 changes: 6 additions & 6 deletions doomsday/client/include/resource/material.h
@@ -1,7 +1,7 @@
/** @file material.h Logical material.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright 2005-2013 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand Down Expand Up @@ -458,6 +458,10 @@ class Material : public de::MapElement
/// Returns @c true if the material is marked as "autogenerated".
bool isAutoGenerated() const;

/// Returns @c true if the material has one or more (light) decorations.
/// Equivalent to @code decorationCount() != 0; @endcode, for convenience.
inline bool isDecorated() const { return decorationCount() != 0; }

/// Returns @c true if the material has a detail texturing layer.
bool isDetailed() const;

Expand All @@ -470,10 +474,6 @@ class Material : public de::MapElement
/// Returns @c true if the material is considered @em skymasked.
bool isSkyMasked() const;

/// Returns @c true if the material has one or more (light) decorations.
/// Equivalent to @code decorationCount() != 0; @endcode, for convenience.
inline bool isDecorated() const { return decorationCount() != 0; }

/// Returns @c true if one or more of the material's layers are glowing.
bool hasGlow() const;

Expand Down
31 changes: 14 additions & 17 deletions doomsday/client/src/resource/material.cpp
Expand Up @@ -106,9 +106,6 @@ struct Material::Instance
/// Manifest derived to yield the material.
MaterialManifest &manifest;

/// Definition from which this material was derived (if any).
ded_material_t *def;

/// Set of use-case/context variant instances.
Material::Variants variants;

Expand All @@ -127,19 +124,13 @@ struct Material::Instance
/// Decorations (will be projected into the map relative to a surface).
Material::Decorations decorations;

/// Current prepared state.
byte prepared;
/// Definition from which this material was derived (if any).
/// @todo Refactor away -ds
ded_material_t *def;

Instance(MaterialManifest &_manifest, ded_material_t &_def)
: manifest(_manifest), def(&_def), envClass(AEC_UNKNOWN),
flags(0), prepared(0)
{
for(int i = 0; i < DED_MAX_MATERIAL_LAYERS; ++i)
{
Material::Layer *layer = Material::Layer::fromDef(_def.layers[i]);
layers.push_back(layer);
}
}
Instance(MaterialManifest &_manifest)
: manifest(_manifest), envClass(AEC_UNKNOWN), flags(0), def(0)
{}

~Instance()
{
Expand All @@ -154,7 +145,6 @@ struct Material::Instance
{
delete variants.takeFirst();
}
prepared = 0;
}

void clearLayers()
Expand All @@ -177,9 +167,16 @@ struct Material::Instance
Material::Material(MaterialManifest &_manifest, ded_material_t &def)
: de::MapElement(DMU_MATERIAL)
{
d = new Instance(_manifest, def);
d = new Instance(_manifest);
d->flags = def.flags;
d->dimensions = QSize(MAX_OF(0, def.width), MAX_OF(0, def.height));

d->def = &def;
for(int i = 0; i < DED_MAX_MATERIAL_LAYERS; ++i)
{
Material::Layer *layer = Material::Layer::fromDef(def.layers[i]);
d->layers.push_back(layer);
}
}

Material::~Material()
Expand Down
6 changes: 3 additions & 3 deletions doomsday/client/src/resource/materials.cpp
@@ -1,7 +1,7 @@
/** @file materials.cpp Material Resource Collection.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright 2005-2013 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand Down Expand Up @@ -722,7 +722,7 @@ static void printMaterialInfo(Material &material)
"\nDetailed:%s Glowing:%s Shiny:%s SkyMasked:%s\n",
material.isDrawable() ? "yes" : "no",
material.audioEnvironment() == AEC_UNKNOWN? "N/A" : S_AudioEnvironmentName(material.audioEnvironment()),
material.isDecorated() ? "yes" : "no",
material.isDecorated() ? "yes" : "no",
material.isDetailed() ? "yes" : "no",
material.hasGlow() ? "yes" : "no",
material.isShiny() ? "yes" : "no",
Expand Down

0 comments on commit 28425ef

Please sign in to comment.