Skip to content

Commit

Permalink
Resources: Cleanup/typos
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Dec 1, 2013
1 parent 31eb868 commit 7951b90
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 59 deletions.
6 changes: 3 additions & 3 deletions doomsday/client/include/gl/gl_model.h
Expand Up @@ -28,7 +28,7 @@
#include <QList>
#include <QVector>

/// Unique identifier associated with each model in the collection.
/// Unique identifier associated with each model.
typedef uint modelid_t;

/// Special value used to signify an invalid model id.
Expand Down Expand Up @@ -105,15 +105,15 @@ class Model
int index; ///< Index into the model's vertex mesh.
};
typedef QVector<Element> Elements;
bool triFan; ///< @c true= triangle fan; otherwise triangle strip.
Elements elements;
bool triFan; ///< @c true= triangle fan; otherwise triangle strip.
};
typedef QList<Primitive> Primitives;
Primitives primitives;
};
typedef DetailLevel DetailLevels[MAX_LODS];

public:
public: /// @todo make private:
int _numVertices; ///< Total number of vertices in the model.
int _numLODs; ///< Number of detail levels in use.
DetailLevels _lods; ///< Level of detail information.
Expand Down
35 changes: 13 additions & 22 deletions doomsday/client/include/resource/material.h
@@ -1,4 +1,4 @@
/** @file material.h Logical material resource.
/** @file material.h Logical material resource.
*
* @authors Copyright © 2009-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2009-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
Expand Down Expand Up @@ -56,13 +56,6 @@ struct MaterialVariantSpec;
*/
class Material : public de::MapElement
{
/// Internal typedefs for brevity/cleanliness.
typedef de::MaterialManifest Manifest;
#ifdef __CLIENT__
typedef de::MaterialSnapshot Snapshot;
typedef de::MaterialVariantSpec VariantSpec;
#endif

public:
/// Maximum number of layers a material supports.
static int const max_layers = 1;
Expand Down Expand Up @@ -416,11 +409,8 @@ class Material : public de::MapElement
/**
* Construct a new default decoration.
*/
Decoration();

Decoration(de::Vector2i const &_patternSkip,
de::Vector2i const &_patternOffset);

Decoration(de::Vector2i const &_patternSkip = de::Vector2i(),
de::Vector2i const &_patternOffset = de::Vector2i());
~Decoration();

/**
Expand Down Expand Up @@ -504,7 +494,7 @@ class Material : public de::MapElement
* Notified when a decoration stage change occurs.
*/
DENG2_DEFINE_AUDIENCE(DecorationStageChange,
void materialAnimationDecorationStageChanged(Animation &anim, Material::Decoration &decor))
void materialAnimationDecorationStageChanged(Animation &anim, Decoration &decor))

/// Current state of a layer animation.
struct LayerState
Expand Down Expand Up @@ -611,7 +601,7 @@ class Material : public de::MapElement
* @param generalCase Material from which the variant is to be derived.
* @param spec Specification used to derive the variant.
*/
Variant(Material &generalCase, VariantSpec const &spec);
Variant(Material &generalCase, de::MaterialVariantSpec const &spec);

public:
/**
Expand All @@ -628,7 +618,7 @@ class Material : public de::MapElement
Material &generalCase() const;

/// @return Material variant specification for the variant.
VariantSpec const &spec() const;
de::MaterialVariantSpec const &spec() const;

/**
* Returns the usage context for this variant (from the spec).
Expand All @@ -652,7 +642,7 @@ class Material : public de::MapElement
*
* @see Material::chooseVariant(), Material::prepare()
*/
Snapshot const &prepare(bool forceSnapshotUpdate = false);
de::MaterialSnapshot const &prepare(bool forceSnapshotUpdate = false);

friend class Material;

Expand All @@ -669,13 +659,13 @@ class Material : public de::MapElement
/**
* @param manifest Manifest derived to yield the material.
*/
Material(Manifest &manifest);
Material(de::MaterialManifest &manifest);
~Material();

/**
* Returns the MaterialManifest derived to yield the material.
*/
Manifest &manifest() const;
de::MaterialManifest &manifest() const;

/**
* Returns a brief textual description/overview of the material.
Expand Down Expand Up @@ -959,7 +949,7 @@ class Material : public de::MapElement
*
* @return The chosen variant; otherwise @c 0 (if none suitable, when not creating).
*/
Variant *chooseVariant(VariantSpec const &spec, bool canCreate = false);
Variant *chooseVariant(de::MaterialVariantSpec const &spec, bool canCreate = false);

/**
* Shorthand alternative to @c chooseVariant(@a spec, true).
Expand All @@ -969,7 +959,7 @@ class Material : public de::MapElement
*
* @see chooseVariant()
*/
inline Variant &createVariant(VariantSpec const &spec)
inline Variant &createVariant(de::MaterialVariantSpec const &spec)
{
return *chooseVariant(spec, true/*create*/);
}
Expand All @@ -993,7 +983,8 @@ class Material : public de::MapElement
*
* @see ResourceSystem::materialSpec(), chooseVariant(), Variant::prepare()
*/
inline Snapshot const &prepare(VariantSpec const &spec, bool forceSnapshotUpdate = false)
inline de::MaterialSnapshot const &prepare(de::MaterialVariantSpec const &spec,
bool forceSnapshotUpdate = false)
{
return createVariant(spec).prepare(forceSnapshotUpdate);
}
Expand Down
12 changes: 6 additions & 6 deletions doomsday/client/include/resource/materialsnapshot.h
Expand Up @@ -66,12 +66,12 @@ class MaterialSnapshot
/// Interpolated (light) decoration properties.
struct Decoration
{
de::Vector2f pos; // Coordinates in material space.
float elevation; // Distance from the surface.
de::Vector3f color; // Light color.
float radius; // Dynamic light radius (-1 = no light).
float flareSize; // Halo radius (zero = no halo).
float lightLevels[2]; // Fade by sector lightlevel.
de::Vector2f pos; // Coordinates in material space.
float elevation; // Distance from the surface.
de::Vector3f color; // Light color.
float radius; // Dynamic light radius (-1 = no light).
float flareSize; // Halo radius (zero = no halo).
float lightLevels[2]; // Fade by sector lightlevel.

Texture *tex, *ceilTex, *floorTex;
DGLuint flareTex;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/render/decoration.cpp
@@ -1,4 +1,4 @@
/** @file decoration.cpp World surface decoration.
/** @file decoration.cpp World surface decoration.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
Expand Down
18 changes: 9 additions & 9 deletions doomsday/client/src/render/rend_model.cpp
Expand Up @@ -481,12 +481,12 @@ static void Mod_RenderPrimitives(rendcmd_t mode, Model::DetailLevel::Primitives
break;
}

foreach(ModelDetailLevel::Primitive const &cmd, primitives)
foreach(ModelDetailLevel::Primitive const &prim, primitives)
{
// The type of primitive depends on the sign.
glBegin(cmd.triFan? GL_TRIANGLE_FAN : GL_TRIANGLE_STRIP);
glBegin(prim.triFan? GL_TRIANGLE_FAN : GL_TRIANGLE_STRIP);

foreach(ModelDetailLevel::Primitive::Element const &elem, cmd.elements)
foreach(ModelDetailLevel::Primitive::Element const &elem, prim.elements)
{
if(mode != RC_OTHER_COORDS)
{
Expand Down Expand Up @@ -1105,8 +1105,8 @@ static void Mod_RenderSubModel(uint number, rendmodelparams_t const *parm)
GL_BindTexture(renderTextures? skinTexture : 0);

Mod_RenderPrimitives(RC_COMMAND_COORDS,
mdl->_lods[activeLod].primitives, /*numVerts,*/
modelPosCoords, modelColorCoords);
mdl->_lods[activeLod].primitives,
modelPosCoords, modelColorCoords);
}

if(shininess > 0)
Expand Down Expand Up @@ -1137,7 +1137,7 @@ static void Mod_RenderSubModel(uint number, rendmodelparams_t const *parm)
GL_BindTexture(renderTextures? skinTexture : 0);

Mod_RenderPrimitives(RC_BOTH_COORDS, mdl->_lods[activeLod].primitives,
modelPosCoords, modelColorCoords, modelTexCoords);
modelPosCoords, modelColorCoords, modelTexCoords);

Mod_SelectTexUnits(1);
GL_ModulateTexture(1);
Expand All @@ -1149,7 +1149,7 @@ static void Mod_RenderSubModel(uint number, rendmodelparams_t const *parm)
GL_BindTexture(renderTextures? shinyTexture : 0);

Mod_RenderPrimitives(RC_OTHER_COORDS, mdl->_lods[activeLod].primitives,
modelPosCoords, modelColorCoords, modelTexCoords);
modelPosCoords, modelColorCoords, modelTexCoords);
}
}
}
Expand All @@ -1167,14 +1167,14 @@ static void Mod_RenderSubModel(uint number, rendmodelparams_t const *parm)
GL_BindTexture(renderTextures? shinyTexture : 0);

// Multiply by shininess.
float colorv1[] = { color.x * color.x, color.y * color.y, color.z * color.z, color.w };
float colorv1[] = { color.x * color.w, color.y * color.w, color.z * color.w, color.w };
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, colorv1);

glActiveTexture(GL_TEXTURE0);
GL_BindTexture(renderTextures? skinTexture : 0);

Mod_RenderPrimitives(RC_BOTH_COORDS, mdl->_lods[activeLod].primitives,
modelPosCoords, modelColorCoords, modelTexCoords);
modelPosCoords, modelColorCoords, modelTexCoords);

Mod_SelectTexUnits(1);
GL_ModulateTexture(1);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/render/surfacedecorator.cpp
@@ -1,4 +1,4 @@
/** @file surfacedecorator.cpp World surface decorator.
/** @file surfacedecorator.cpp World surface decorator.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
Expand Down
8 changes: 2 additions & 6 deletions doomsday/client/src/resource/material.cpp
Expand Up @@ -259,10 +259,6 @@ String Material::Decoration::Stage::LightLevels::asText() const
.arg(max, 0, 'g', 2);
}

Material::Decoration::Decoration()
: _material(0), _patternSkip(0, 0), _patternOffset(0, 0)
{}

Material::Decoration::Decoration(Vector2i const &_patternSkip, Vector2i const &_patternOffset)
: _material(0), _patternSkip(_patternSkip), _patternOffset(_patternOffset)
{}
Expand Down Expand Up @@ -752,11 +748,11 @@ Material::Variants const &Material::variants() const
return d->variants;
}

Material::Variant *Material::chooseVariant(Material::VariantSpec const &spec, bool canCreate)
Material::Variant *Material::chooseVariant(MaterialVariantSpec const &spec, bool canCreate)
{
foreach(Variant *variant, variants())
{
VariantSpec const &cand = variant->spec();
MaterialVariantSpec const &cand = variant->spec();
if(cand.compare(spec))
{
// This will do fine.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/resource/materialsnapshot.cpp
@@ -1,4 +1,4 @@
/** @file materialsnapshot.cpp Logical material state snapshot.
/** @file materialsnapshot.cpp Logical material state snapshot.
*
* @authors Copyright © 2011-2013 Daniel Swanson <danij@dengine.net>
*
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/src/resource/materialvariant.cpp
Expand Up @@ -42,7 +42,7 @@ DENG2_PIMPL(Material::Variant)
/// Frame count when the snapshot was last prepared/updated.
int snapshotPrepareFrame;

Instance(Public *i, Material &generalCase, Material::VariantSpec const &_spec)
Instance(Public *i, Material &generalCase, MaterialVariantSpec const &_spec)
: Base(i), material(&generalCase),
spec(_spec),
snapshotPrepareFrame(-1)
Expand All @@ -53,7 +53,7 @@ DENG2_PIMPL(Material::Variant)
* present it will be replaced. Ownership of @a materialSnapshot is given to
* the variant.
*/
void attachSnapshot(Material::Snapshot *newSnapshot)
void attachSnapshot(MaterialSnapshot *newSnapshot)
{
DENG2_ASSERT(newSnapshot);
if(snapshot.get())
Expand Down
20 changes: 12 additions & 8 deletions doomsday/client/src/resource/models.cpp
Expand Up @@ -55,7 +55,8 @@ using namespace de;
#define MD2_MAGIC 0x32504449

#pragma pack(1)
typedef struct {
struct md2_header_t
{
int magic;
int version;
int skinWidth;
Expand All @@ -73,18 +74,19 @@ typedef struct {
int offsetFrames;
int offsetGlCommands;
int offsetEnd;
} md2_header_t;
};
#pragma pack()

//
#define DMD_MAGIC 0x4D444D44 ///< "DMDM" = Doomsday/Detailed MoDel Magic

#pragma pack(1)
typedef struct {
struct dmd_header_t
{
int magic;
int version;
int flags;
} dmd_header_t;
};
#pragma pack()

ModelDefs modefs;
Expand Down Expand Up @@ -240,17 +242,19 @@ static bool recogniseMd2(de::FileHandle &file)
}

#pragma pack(1)
typedef struct {
struct md2_triangleVertex_t
{
byte vertex[3];
byte normalIndex;
} md2_triangleVertex_t;
};

typedef struct {
struct md2_packedFrame_t
{
float scale[3];
float translate[3];
char name[16];
md2_triangleVertex_t vertices[1];
} md2_packedFrame_t;
};

struct md2_commandElement_t {
float s, t;
Expand Down

0 comments on commit 7951b90

Please sign in to comment.