Skip to content

Commit

Permalink
Refactor|Resources: ResourceSystem has direct ownership of texture re…
Browse files Browse the repository at this point in the history
…source schemes

TODO: Cleanup
  • Loading branch information
danij-deng committed Nov 26, 2013
1 parent 25cc46e commit 5eaed47
Show file tree
Hide file tree
Showing 35 changed files with 1,077 additions and 1,253 deletions.
3 changes: 0 additions & 3 deletions doomsday/client/client.pro
Expand Up @@ -175,7 +175,6 @@ DENG_CONVENIENCE_HEADERS += \
include/TextDrawable \
include/Texture \
include/TextureManifest \
include/Textures \
include/TextureScheme \
include/TextureVariantSpec \
include/TriangleStripBuilder \
Expand Down Expand Up @@ -361,7 +360,6 @@ DENG_HEADERS += \
include/resource/sprite.h \
include/resource/texture.h \
include/resource/texturemanifest.h \
include/resource/textures.h \
include/resource/texturescheme.h \
include/resource/texturevariantspec.h \
include/resource/tga.h \
Expand Down Expand Up @@ -726,7 +724,6 @@ SOURCES += \
src/resource/sprite.cpp \
src/resource/texture.cpp \
src/resource/texturemanifest.cpp \
src/resource/textures.cpp \
src/resource/texturescheme.cpp \
src/resource/texturevariant.cpp \
src/resource/tga.cpp \
Expand Down
1 change: 0 additions & 1 deletion doomsday/client/include/Textures

This file was deleted.

3 changes: 0 additions & 3 deletions doomsday/client/include/dd_main.h
Expand Up @@ -176,9 +176,6 @@ de::ResourceClass &App_ResourceClass(resourceclassid_t classId);
/// @return The application's global Material collection.
de::Materials &App_Materials();

/// @return The application's global Texture collection.
de::Textures &App_Textures();

#ifdef __CLIENT__
/// @return The application's global Font collection.
de::Fonts &App_Fonts();
Expand Down
1 change: 0 additions & 1 deletion doomsday/client/include/de_resource.h
Expand Up @@ -30,7 +30,6 @@
#include "resource/compositetexture.h"
#include "resource/rawtexture.h"
#include "resource/sprite.h"
#include "Textures"

#ifdef __CLIENT__
# include "resource/materialsnapshot.h"
Expand Down
12 changes: 3 additions & 9 deletions doomsday/client/include/resource/fontmanifest.h
Expand Up @@ -42,22 +42,20 @@ class FontScheme;
* @see FontScheme, AbstractFont
* @ingroup resource
*/
class FontManifest : public PathTree::Node,
DENG2_OBSERVES(AbstractFont, Deletion)
class FontManifest : public PathTree::Node
{
public:
/// Required Font instance is missing. @ingroup errors
DENG2_ERROR(MissingFontError);

/// Notified when the manifest is about to be deleted.
DENG2_DEFINE_AUDIENCE(Deletion, void manifestBeingDeleted(FontManifest const &manifest))
DENG2_DEFINE_AUDIENCE(Deletion, void fontManifestBeingDeleted(FontManifest const &manifest))

/// Notified whenever the unique identifier changes.
DENG2_DEFINE_AUDIENCE(UniqueIdChange, void manifestUniqueIdChanged(FontManifest &manifest))
DENG2_DEFINE_AUDIENCE(UniqueIdChange, void fontManifestUniqueIdChanged(FontManifest &manifest))

public:
FontManifest(PathTree::NodeArgs const &args);
~FontManifest();

/**
* Returns the owning scheme of the manifest.
Expand Down Expand Up @@ -146,10 +144,6 @@ DENG2_OBSERVES(AbstractFont, Deletion)
/// Returns a reference to the owning collection.
static Fonts &collection();

protected:
// Observes AbstractFont::Deletion.
void fontBeingDeleted(AbstractFont const &resource);

private:
DENG2_PRIVATE(d)
};
Expand Down
13 changes: 2 additions & 11 deletions doomsday/client/include/resource/fontscheme.h
Expand Up @@ -36,9 +36,7 @@ namespace de {
* @see Fonts
* @ingroup resource
*/
class FontScheme :
DENG2_OBSERVES(FontManifest, UniqueIdChange),
DENG2_OBSERVES(FontManifest, Deletion)
class FontScheme
{
typedef class FontManifest Manifest;

Expand All @@ -50,7 +48,7 @@ DENG2_OBSERVES(FontManifest, Deletion)
DENG2_ERROR(InvalidPathError);

/// Notified whenever a new manifest is defined in the scheme.
DENG2_DEFINE_AUDIENCE(ManifestDefined, void schemeManifestDefined(FontScheme &scheme, Manifest &manifest))
DENG2_DEFINE_AUDIENCE(ManifestDefined, void fontSchemeManifestDefined(FontScheme &scheme, Manifest &manifest))

/// Minimum length of a symbolic name.
static int const min_name_length = DENG2_URI_MIN_SCHEME_LENGTH;
Expand Down Expand Up @@ -124,13 +122,6 @@ DENG2_OBSERVES(FontManifest, Deletion)
*/
Index const &index() const;

protected:
// Observes Manifest UniqueIdChange
void manifestUniqueIdChanged(Manifest &manifest);

// Observes Manifest Deletion.
void manifestBeingDeleted(Manifest const &manifest);

private:
DENG2_PRIVATE(d)
};
Expand Down
14 changes: 5 additions & 9 deletions doomsday/client/include/resource/material.h
Expand Up @@ -54,9 +54,7 @@ struct MaterialVariantSpec;
*
* @ingroup resource
*/
class Material : public de::MapElement,
DENG2_OBSERVES(de::Texture, DimensionsChange),
DENG2_OBSERVES(de::Texture, Deletion)
class Material : public de::MapElement
{
/// Internal typedefs for brevity/cleanliness.
typedef de::MaterialManifest Manifest;
Expand Down Expand Up @@ -1003,14 +1001,12 @@ class Material : public de::MapElement,
#endif // __CLIENT__

protected:
// Observes Texture DimensionsChange.
void textureDimensionsChanged(de::Texture const &texture);

// Observes Texture Deletion.
void textureBeingDeleted(de::Texture const &texture);

int property(DmuArgs &args) const;

public:
/// Register the console commands, variables, etc..., of this module.
static void consoleRegister();

private:
DENG2_PRIVATE(d)
};
Expand Down
20 changes: 7 additions & 13 deletions doomsday/client/include/resource/materialmanifest.h
@@ -1,4 +1,4 @@
/** @file materialmanifest.h Description of a logical material resource.
/** @file materialmanifest.h Description of a logical material resource.
*
* @authors Copyright © 2011-2013 Daniel Swanson <danij@dengine.net>
*
Expand All @@ -17,8 +17,8 @@
* 02110-1301 USA</small>
*/

#ifndef LIBDENG_RESOURCE_MATERIALMANIFEST_H
#define LIBDENG_RESOURCE_MATERIALMANIFEST_H
#ifndef DENG_RESOURCE_MATERIALMANIFEST_H
#define DENG_RESOURCE_MATERIALMANIFEST_H

#include "Material"
#include "MaterialScheme"
Expand All @@ -40,15 +40,14 @@ class Materials;
* @see MaterialScheme, Material
* @ingroup resource
*/
class MaterialManifest : public PathTree::Node,
DENG2_OBSERVES(Material, Deletion)
class MaterialManifest : public PathTree::Node
{
public:
/// Required material instance is missing. @ingroup errors
DENG2_ERROR(MissingMaterialError);

DENG2_DEFINE_AUDIENCE(Deletion, void manifestBeingDeleted(MaterialManifest const &manifest))
DENG2_DEFINE_AUDIENCE(MaterialDerived, void manifestMaterialDerived(MaterialManifest &manifest, Material &material))
DENG2_DEFINE_AUDIENCE(Deletion, void materialManifestBeingDeleted(MaterialManifest const &manifest))
DENG2_DEFINE_AUDIENCE(MaterialDerived, void materialManifestMaterialDerived(MaterialManifest &manifest, Material &material))

enum Flag
{
Expand All @@ -62,7 +61,6 @@ class MaterialManifest : public PathTree::Node,

public:
MaterialManifest(PathTree::NodeArgs const &args);
virtual ~MaterialManifest();

/**
* Derive a new logical Material instance by interpreting the manifest.
Expand Down Expand Up @@ -156,10 +154,6 @@ class MaterialManifest : public PathTree::Node,
/// Returns a reference to the application's material collection.
static Materials &materials();

protected:
// Observes Material Deletion.
void materialBeingDeleted(Material const &material);

private:
DENG2_PRIVATE(d)
};
Expand All @@ -168,4 +162,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(MaterialManifest::Flags)

} // namespace de

#endif /* LIBDENG_RESOURCE_MATERIALMANIFEST_H */
#endif // DENG_RESOURCE_MATERIALMANIFEST_H
10 changes: 5 additions & 5 deletions doomsday/client/include/resource/materialscheme.h
@@ -1,4 +1,4 @@
/** @file materialscheme.h Material collection subspace.
/** @file materialscheme.h Material collection subspace.
*
* @authors Copyright © 2010-2013 Daniel Swanson <danij@dengine.net>
*
Expand All @@ -17,8 +17,8 @@
* 02110-1301 USA</small>
*/

#ifndef LIBDENG_RESOURCE_MATERIALSCHEME_H
#define LIBDENG_RESOURCE_MATERIALSCHEME_H
#ifndef DENG_RESOURCE_MATERIALSCHEME_H
#define DENG_RESOURCE_MATERIALSCHEME_H

#include "uri.hh"
#include <de/Observers>
Expand Down Expand Up @@ -46,7 +46,7 @@ class MaterialScheme
/// The specified path was not valid. @ingroup errors
DENG2_ERROR(InvalidPathError);

DENG2_DEFINE_AUDIENCE(ManifestDefined, void schemeManifestDefined(MaterialScheme &scheme, Manifest &manifest))
DENG2_DEFINE_AUDIENCE(ManifestDefined, void materialSchemeManifestDefined(MaterialScheme &scheme, Manifest &manifest))

/// Minimum length of a symbolic name.
static int const min_name_length = DENG2_URI_MIN_SCHEME_LENGTH;
Expand Down Expand Up @@ -114,4 +114,4 @@ class MaterialScheme

} // namespace de

#endif /* LIBDENG_RESOURCE_MATERIALSCHEME_H */
#endif // DENG_RESOURCE_MATERIALSCHEME_H

0 comments on commit 5eaed47

Please sign in to comment.