Skip to content

Commit

Permalink
Refactor|Materials|Textures: Innumerable material/texture system clea…
Browse files Browse the repository at this point in the history
…nup refactorings
  • Loading branch information
danij-deng committed Feb 6, 2013
1 parent 16efd6c commit cc5d52a
Show file tree
Hide file tree
Showing 85 changed files with 1,429 additions and 1,582 deletions.
12 changes: 12 additions & 0 deletions doomsday/client/client.pro
Expand Up @@ -132,6 +132,18 @@ DENG_HEADERS += \
# Private headers.
DENG_HEADERS += \
include/MapElement \
include/Material \
include/MaterialArchive \
include/MaterialManifest \
include/Materials \
include/MaterialScheme \
include/MaterialSnapshot \
include/MaterialVariantSpec \
include/Texture \
include/TextureManifest \
include/Textures \
include/TextureScheme \
include/TextureVariantSpec \
include/audio/audiodriver.h \
include/audio/audiodriver_music.h \
include/audio/m_mus2midi.h \
Expand Down
1 change: 1 addition & 0 deletions doomsday/client/include/Material
@@ -0,0 +1 @@
#include "resource/material.h"
1 change: 1 addition & 0 deletions doomsday/client/include/MaterialArchive
@@ -0,0 +1 @@
#include "resource/materialarchive.h"
1 change: 1 addition & 0 deletions doomsday/client/include/MaterialManifest
@@ -0,0 +1 @@
#include "resource/materialmanifest.h"
1 change: 1 addition & 0 deletions doomsday/client/include/MaterialScheme
@@ -0,0 +1 @@
#include "resource/materialscheme.h"
1 change: 1 addition & 0 deletions doomsday/client/include/MaterialSnapshot
@@ -0,0 +1 @@
#include "resource/materialsnapshot.h"
1 change: 1 addition & 0 deletions doomsday/client/include/MaterialVariantSpec
@@ -0,0 +1 @@
#include "resource/materialvariantspec.h"
1 change: 1 addition & 0 deletions doomsday/client/include/Materials
@@ -0,0 +1 @@
#include "resource/materials.h"
1 change: 1 addition & 0 deletions doomsday/client/include/Texture
@@ -0,0 +1 @@
#include "resource/texture.h"
1 change: 1 addition & 0 deletions doomsday/client/include/TextureManifest
@@ -0,0 +1 @@
#include "resource/texturemanifest.h"
1 change: 1 addition & 0 deletions doomsday/client/include/TextureScheme
@@ -0,0 +1 @@
#include "resource/texturescheme.h"
1 change: 1 addition & 0 deletions doomsday/client/include/TextureVariantSpec
@@ -0,0 +1 @@
#include "resource/texturevariantspec.h"
1 change: 1 addition & 0 deletions doomsday/client/include/Textures
@@ -0,0 +1 @@
#include "resource/textures.h"
5 changes: 4 additions & 1 deletion doomsday/client/include/dd_main.h
Expand Up @@ -27,7 +27,7 @@
#include "dd_types.h"
#include "api_plugin.h"
#include "api_gameexport.h"
#include "resource/materials.h"
#include "Materials"
#include "resource/textures.h"
#include "filesys/sys_direc.h"
#include <de/c_wrapper.h>
Expand Down Expand Up @@ -195,6 +195,9 @@ de::String DD_MaterialSchemeNameForTextureScheme(de::String textureSchemeName);
/// @return The application's global Material collection.
de::Materials &App_Materials();

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

extern "C" {
#endif // __cplusplus

Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/de_play.h
Expand Up @@ -48,7 +48,7 @@
#include "map/p_mapdata.h"
#include "map/p_maptypes.h"
#include "map/r_world.h"
#include "resource/material.h"
#include "Material"
#include "ui/p_control.h"
#include "r_util.h"

Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/de_resource.h
Expand Up @@ -28,11 +28,11 @@
#include "resource/font.h"
#include "resource/fonts.h"
#include "resource/r_data.h"
#include "resource/materials.h"
#include "Materials"
#include "resource/models.h"
#include "resource/compositetexture.h"
#include "resource/rawtexture.h"
#include "resource/textures.h"
#include "Textures"

#ifdef __CLIENT__
# include "resource/bitmapfont.h"
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/def_main.h
Expand Up @@ -24,7 +24,7 @@
#define LIBDENG_DEFINITIONS_MAIN_H

#include "def_data.h"
#include "resource/material.h"
#include "Material"
#include <de/stringarray.h>

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/edit_map.h
Expand Up @@ -29,7 +29,7 @@

#include <vector>
#include "map/gamemap.h"
#include "resource/materials.h"
#include "Materials"

// Editable map.
/// @todo Obviously this shares functionality/data with GameMap; a common base class needed? -jk
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/gl/gl_texmanager.h
Expand Up @@ -32,8 +32,8 @@
#include "filehandle.h"
#include "resource/r_data.h" // For flaretexid_t, lightingtexid_t, etc...
#include "resource/rawtexture.h"
#include "resource/texture.h"
#include "resource/texturevariantspec.h"
#include "Texture"
#include "TextureVariantSpec"

struct image_s;
struct texturecontent_s;
Expand Down
86 changes: 43 additions & 43 deletions doomsday/client/include/map/surface.h
Expand Up @@ -27,12 +27,12 @@

#include <QSet>
#include "resource/r_data.h"
#include "resource/material.h"
#include "Material"
#include "map/p_dmu.h"
#include "map/bspleaf.h"

#ifdef __cplusplus
#include "resource/materialsnapshot.h"
#include "MaterialSnapshot"
#endif

// Internal surface flags:
Expand All @@ -58,22 +58,22 @@ class Surface : public de::MapElement
#endif // __CLIENT__

public:
ddmobj_base_t base;
de::MapElement *owner; ///< Either @c DMU_SIDEDEF, or @c DMU_PLANE
int flags; ///< SUF_ flags
int oldFlags;
Material* material;
blendmode_t blendMode;
float tangent[3];
float bitangent[3];
float normal[3];
float offset[2]; ///< [X, Y] Planar offset to surface material origin.
float oldOffset[2][2];
float visOffset[2];
float visOffsetDelta[2];
float rgba[4]; ///< Surface color tint
short inFlags; ///< SUIF_* flags
unsigned int numDecorations;
ddmobj_base_t base;
de::MapElement *owner; ///< Either @c DMU_SIDEDEF, or @c DMU_PLANE
int flags; ///< SUF_ flags
int oldFlags;
Material *material;
blendmode_t blendMode;
float tangent[3];
float bitangent[3];
float normal[3];
float offset[2]; ///< [X, Y] Planar offset to surface material origin.
float oldOffset[2][2];
float visOffset[2];
float visOffsetDelta[2];
float rgba[4]; ///< Surface color tint
short inFlags; ///< SUIF_* flags
uint numDecorations;
struct surfacedecorsource_s *decorations;

public:
Expand All @@ -88,7 +88,7 @@ typedef QSet<Surface *> SurfaceSet;
* Mark the surface as requiring a full update. To be called
* during engine reset.
*/
void Surface_Update(Surface* surface);
void Surface_Update(Surface *surface);

/**
* Update the Surface's map space base origin according to relevant points in
Expand All @@ -106,24 +106,24 @@ void Surface_Update(Surface* surface);
*
* @param surface Surface instance.
*/
void Surface_UpdateBaseOrigin(Surface* surface);
void Surface_UpdateBaseOrigin(Surface *surface);

/// @return @c true= is drawable (i.e., a drawable Material is bound).
boolean Surface_IsDrawable(Surface* surface);
boolean Surface_IsDrawable(Surface *surface);

/// @return @c true= is sky-masked (i.e., a sky-masked Material is bound).
boolean Surface_IsSkyMasked(const Surface* suf);
boolean Surface_IsSkyMasked(Surface const *suf);

/// @return @c true= is owned by some element of the Map geometry.
boolean Surface_AttachedToMap(Surface* surface);
boolean Surface_AttachedToMap(Surface *surface);

/**
* Change Material bound to this surface.
*
* @param surface Surface instance.
* @param mat New Material.
*/
boolean Surface_SetMaterial(Surface* surface, Material *material);
boolean Surface_SetMaterial(Surface *surface, Material *material);

/**
* Change Material origin.
Expand All @@ -132,74 +132,74 @@ boolean Surface_SetMaterial(Surface* surface, Material *material);
* @param x New X origin in map space.
* @param y New Y origin in map space.
*/
boolean Surface_SetMaterialOrigin(Surface* surface, float x, float y);
boolean Surface_SetMaterialOrigin(Surface *surface, float x, float y);

/**
* Change Material origin X coordinate.
*
* @param surface Surface instance.
* @param x New X origin in map space.
*/
boolean Surface_SetMaterialOriginX(Surface* surface, float x);
boolean Surface_SetMaterialOriginX(Surface *surface, float x);

/**
* Change Material origin Y coordinate.
*
* @param surface Surface instance.
* @param y New Y origin in map space.
*/
boolean Surface_SetMaterialOriginY(Surface* surface, float y);
boolean Surface_SetMaterialOriginY(Surface *surface, float y);

/**
* Change surface color tint and alpha.
*
* @param surface Surface instance.
* @param red Red color component (0...1).
* @param green Green color component (0...1).
* @param blue Blue color component (0...1).
* @param alpha Alpha component (0...1).
* @param red Red color component [0..1].
* @param green Green color component [0..1].
* @param blue Blue color component [0..1].
* @param alpha Alpha component [0..1].
*/
boolean Surface_SetColorAndAlpha(Surface* surface, float red, float green, float blue, float alpha);
boolean Surface_SetColorAndAlpha(Surface *surface, float red, float green, float blue, float alpha);

/**
* Change surfacecolor tint.
*
* @param surface Surface instance.
* @param red Red color component (0...1).
* @param red Red color component [0..1].
*/
boolean Surface_SetColorRed(Surface* surface, float red);
boolean Surface_SetColorRed(Surface *surface, float red);

/**
* Change surfacecolor tint.
*
* @param surface Surface instance.
* @param green Green color component (0...1).
* @param green Green color component [0..1].
*/
boolean Surface_SetColorGreen(Surface* surface, float green);
boolean Surface_SetColorGreen(Surface *surface, float green);

/**
* Change surfacecolor tint.
*
* @param surface Surface instance.
* @param blue Blue color component (0...1).
* @param blue Blue color component [0..1].
*/
boolean Surface_SetColorBlue(Surface* surface, float blue);
boolean Surface_SetColorBlue(Surface *surface, float blue);

/**
* Change surface alpha.
*
* @param surface Surface instance.
* @param alpha New alpha value (0...1).
* @param alpha New alpha value [0..1].
*/
boolean Surface_SetAlpha(Surface* surface, float alpha);
boolean Surface_SetAlpha(Surface *surface, float alpha);

/**
* Change blendmode.
*
* @param surface Surface instance.
* @param blendMode New blendmode.
*/
boolean Surface_SetBlendMode(Surface* surface, blendmode_t blendMode);
boolean Surface_SetBlendMode(Surface *surface, blendmode_t blendMode);

/**
* Get a property value, selected by DMU_* name.
Expand All @@ -208,7 +208,7 @@ boolean Surface_SetBlendMode(Surface* surface, blendmode_t blendMode);
* @param args Property arguments.
* @return Always @c 0 (can be used as an iterator).
*/
int Surface_GetProperty(const Surface* surface, setargs_t* args);
int Surface_GetProperty(Surface const *surface, setargs_t *args);

/**
* Update a property value, selected by DMU_* name.
Expand All @@ -217,7 +217,7 @@ int Surface_GetProperty(const Surface* surface, setargs_t* args);
* @param args Property arguments.
* @return Always @c 0 (can be used as an iterator).
*/
int Surface_SetProperty(Surface* surface, const setargs_t* args);
int Surface_SetProperty(Surface *surface, setargs_t const *args);

#ifdef __CLIENT__
/**
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/render/r_draw.h
Expand Up @@ -23,7 +23,7 @@
#ifndef LIBDENG_RENDER_MISC_H
#define LIBDENG_RENDER_MISC_H

#include "resource/texture.h"
#include "Texture"

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/render/r_things.h
Expand Up @@ -25,7 +25,7 @@

#include "map/p_maptypes.h"
#include "resource/r_data.h"
#include "resource/materials.h"
#include "Materials"
#include "rend_model.h"

/**
Expand Down
7 changes: 3 additions & 4 deletions doomsday/client/include/render/rend_decor.h
Expand Up @@ -23,7 +23,6 @@
#include <de/libdeng1.h>

DENG_EXTERN_C byte useLightDecorations;
DENG_EXTERN_C float decorMaxDist; ///< No decorations are visible beyond this.
DENG_EXTERN_C float decorLightBrightFactor;
DENG_EXTERN_C float decorLightFadeAngle;

Expand All @@ -42,17 +41,17 @@ void Rend_DecorInit(void);
/**
* Decorations are generated for each frame.
*/
void Rend_InitDecorationsForFrame(void);
void Rend_DecorBeginFrame(void);

/**
* Create lumobjs for all decorations who want them.
*/
void Rend_AddLuminousDecorations(void);
void Rend_DecorAddLuminous(void);

/**
* Project all the non-clipped decorations. They become regular vissprites.
*/
void Rend_ProjectDecorations(void);
void Rend_DecorProject(void);

#ifdef __cplusplus
} // extern "C"
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/render/sky.h
Expand Up @@ -26,7 +26,7 @@

#include "color.h"
#include "resource/models.h"
#include "resource/material.h"
#include "Material"

#define MAX_SKY_LAYERS ( 2 )
#define MAX_SKY_MODELS ( 32 )
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/render/sprite.h
Expand Up @@ -49,7 +49,7 @@ DENG_EXTERN_C void Rend_SpriteRegister(void);
#ifdef __CLIENT__
#ifdef __cplusplus

#include "resource/materialvariantspec.h"
#include "MaterialVariantSpec"

de::MaterialVariantSpec const &Rend_SpriteMaterialSpec(int tclass = 0, int tmap = 0);

Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/include/resource/animgroups.h
Expand Up @@ -22,7 +22,7 @@
#ifndef LIBDENG_RESOURCE_ANIMGROUPS_H
#define LIBDENG_RESOURCE_ANIMGROUPS_H

#include "resource/texture.h"
#include "Texture"

#ifdef __cplusplus
extern "C" {
Expand Down

0 comments on commit cc5d52a

Please sign in to comment.