Skip to content

Commit

Permalink
TextureVariant: Record the source of the uploaded graphic
Browse files Browse the repository at this point in the history
Presently the source is identified using a set of ids, one for each
logical source type (i.e., original or external). Ultimately these
identifiers should be replaced with references to the actual files
they were loaded from (thereby enabling us to reverse lookup all
textures uploaded from a given addon, for example).
  • Loading branch information
danij-deng committed Jan 10, 2012
1 parent dc5f720 commit 8208d9c
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 128 deletions.
28 changes: 10 additions & 18 deletions doomsday/engine/portable/include/gl_texmanager.h
Expand Up @@ -188,30 +188,22 @@ void GL_UploadTextureContent(const struct texturecontent_s* content);
uint8_t* GL_LoadImage(struct image_s* img, const char* filePath);
uint8_t* GL_LoadImageStr(struct image_s* img, const ddstring_t* filePath);

/**
* Image loading routines:
* @return The outcome:
* 0 = not prepared
* 1 = found and prepared a lump resource.
* 2 = found and prepared an external resource.
*/

byte GL_LoadRawTex(struct image_s* image, const rawtex_t* r);
TexSource GL_LoadRawTex(struct image_s* image, const rawtex_t* r);

byte GL_LoadExtTexture(struct image_s* image, const char* name, gfxmode_t mode);
byte GL_LoadExtTextureEX(struct image_s* image, const char* searchPath, const char* optionalSuffix,
boolean quiet);
TexSource GL_LoadExtTexture(struct image_s* image, const char* name, gfxmode_t mode);
TexSource GL_LoadExtTextureEX(struct image_s* image, const char* searchPath,
const char* optionalSuffix, boolean quiet);

byte GL_LoadFlatLump(struct image_s* image, DFile* file);
TexSource GL_LoadFlatLump(struct image_s* image, DFile* file);

byte GL_LoadPatchLumpAsPatch(struct image_s* image, DFile* file, int tclass, int tmap,
int border, Texture* tex);
TexSource GL_LoadPatchLumpAsPatch(struct image_s* image, DFile* file, int tclass,
int tmap, int border, Texture* tex);

byte GL_LoadDetailTextureLump(struct image_s* image, DFile* file);
TexSource GL_LoadDetailTextureLump(struct image_s* image, DFile* file);

byte GL_LoadPatchComposite(struct image_s* image, Texture* tex);
TexSource GL_LoadPatchComposite(struct image_s* image, Texture* tex);

byte GL_LoadPatchCompositeAsSky(struct image_s* image, Texture* tex, boolean zeroMask);
TexSource GL_LoadPatchCompositeAsSky(struct image_s* image, Texture* tex, boolean zeroMask);

/**
* Compare the given TextureVariantSpecifications and determine whether they can
Expand Down
15 changes: 12 additions & 3 deletions doomsday/engine/portable/include/texturevariant.h
Expand Up @@ -41,17 +41,26 @@ typedef struct texturevariant_s TextureVariant;

/**
* @param generalCase Texture from which this variant is derived.
* @param spec Specification used to derive this variant. Ownership of
* specifcation is NOT given to the resultant TextureVariant
* @param spec Specification used to derive this variant. Ownership
* is NOT given to the resultant TextureVariant
*/
TextureVariant* TextureVariant_New(struct texture_s* generalCase,
texturevariantspecification_t* spec);
TexSource source, texturevariantspecification_t* spec);

void TextureVariant_Delete(TextureVariant* tex);

/// @return Superior Texture of which this is a derivative.
struct texture_s* TextureVariant_GeneralCase(const TextureVariant* tex);

/// @return Source of this variant.
TexSource TextureVariant_Source(const TextureVariant* tex);

/**
* Change the source of this variant.
* @param source New TextureSource.
*/
void TextureVariant_SetSource(TextureVariant* tex, TexSource source);

/// @return TextureVariantSpecification used to derive this variant.
texturevariantspecification_t* TextureVariant_Spec(const TextureVariant* tex);

Expand Down
Expand Up @@ -24,6 +24,15 @@
#ifndef LIBDENG_GL_TEXTUREVARIANTSPECIFICATION_H
#define LIBDENG_GL_TEXTUREVARIANTSPECIFICATION_H

/**
* Texture (content) Source.
*/
typedef enum {
TEXS_NONE, /// Not a valid source.
TEXS_ORIGINAL, /// An "original".
TEXS_EXTERNAL /// An "external" replacement.
} TexSource;

typedef enum {
TC_UNKNOWN = -1,
TEXTUREVARIANTUSAGECONTEXT_FIRST = 0,
Expand Down

0 comments on commit 8208d9c

Please sign in to comment.