Skip to content

Commit

Permalink
Refactor: Moved type definitions for material_t to material.h
Browse files Browse the repository at this point in the history
material_t is no longer defined using mapdata.hs
  • Loading branch information
danij-deng committed Jan 7, 2013
1 parent 854fea3 commit 3e2c4a1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 73 deletions.
1 change: 1 addition & 0 deletions doomsday/engine/api/dd_maptypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#define DMT_BSPLEAF_POLYOBJ DDVT_PTR // NULL, if there is no polyobj.
#define DMT_BSPLEAF_SECTOR DDVT_PTR

/// Material properties:
#define DMT_MATERIAL_FLAGS DDVT_SHORT
#define DMT_MATERIAL_WIDTH DDVT_INT
#define DMT_MATERIAL_HEIGHT DDVT_INT
Expand Down
37 changes: 1 addition & 36 deletions doomsday/engine/include/map/p_maptypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,41 +140,6 @@ typedef struct bspleaf_s {
unsigned int reverb[NUM_REVERB_DATA];
} BspLeaf;

typedef enum {
MEC_UNKNOWN = -1,
MEC_FIRST = 0,
MEC_METAL = MEC_FIRST,
MEC_ROCK,
MEC_WOOD,
MEC_CLOTH,
NUM_MATERIAL_ENV_CLASSES
} material_env_class_t;

#define VALID_MATERIAL_ENV_CLASS(v) ((v) >= MEC_FIRST && (v) < NUM_MATERIAL_ENV_CLASSES)

struct material_variantlist_node_s;

typedef struct material_s {
runtime_mapdata_header_t header;
struct ded_material_s* _def;
struct material_variantlist_node_s* _variants;
material_env_class_t _envClass; // Environmental sound class.
materialid_t _primaryBind; // Unique identifier of the MaterialBind associated with this Material or @c NULL if not bound.
Size2* _size; // Logical dimensions in world-space units.
short _flags; // @see materialFlags
boolean _inAnimGroup; // @c true if belongs to some animgroup.
boolean _isCustom;
struct texture_s* _detailTex;
float _detailScale;
float _detailStrength;
struct texture_s* _shinyTex;
blendmode_t _shinyBlendmode;
float _shinyMinColor[3];
float _shinyStrength;
struct texture_s* _shinyMaskTex;
byte _prepared;
} material_t;

// Internal surface flags:
#define SUIF_FIX_MISSING_MATERIAL 0x0001 ///< Current material is a fix replacement
/// (not sent to clients, returned via DMU etc).
Expand All @@ -195,7 +160,7 @@ typedef struct surface_s {
void* owner; // Either @c DMU_SIDEDEF, or @c DMU_PLANE
int flags; // SUF_ flags
int oldFlags;
material_t* material;
struct material_s* material;
blendmode_t blendMode;
float tangent[3];
float bitangent[3];
Expand Down
39 changes: 2 additions & 37 deletions doomsday/engine/include/mapdata.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,48 +132,13 @@ struct BspLeaf
- uint[NUM_REVERB_DATA] reverb
end

internal
typedef enum {
MEC_UNKNOWN = -1,
MEC_FIRST = 0,
MEC_METAL = MEC_FIRST,
MEC_ROCK,
MEC_WOOD,
MEC_CLOTH,
NUM_MATERIAL_ENV_CLASSES
} material_env_class_t;

#define VALID_MATERIAL_ENV_CLASS(v) ((v) >= MEC_FIRST && (v) < NUM_MATERIAL_ENV_CLASSES)

struct material_variantlist_node_s;
end

public
/// Material properties:
#define DMT_MATERIAL_FLAGS DDVT_SHORT
#define DMT_MATERIAL_WIDTH DDVT_INT
#define DMT_MATERIAL_HEIGHT DDVT_INT
end

struct material
- ded_material_s* _def
- material_variantlist_node_s* _variants
- material_env_class_t _envClass // Environmental sound class.
- materialid_t _primaryBind // Unique identifier of the MaterialBind associated with this Material or @c NULL if not bound.
- Size2i* _size // Logical dimensions in world-space units.
- short _flags // @see materialFlags
- boolean _inAnimGroup // @c true if belongs to some animgroup.
- boolean _isCustom
- texture_s* _detailTex;
- float _detailScale;
- float _detailStrength;
- texture_s* _shinyTex;
- blendmode_t _shinyBlendmode;
- float[3] _shinyMinColor;
- float _shinyStrength;
- texture_s* _shinyMaskTex;
- byte _prepared;
end

internal
// Internal surface flags:
#define SUIF_FIX_MISSING_MATERIAL 0x0001 ///< Current material is a fix replacement
Expand All @@ -195,7 +160,7 @@ struct Surface
- void* owner // Either @c DMU_SIDEDEF, or @c DMU_PLANE
INT int flags // SUF_ flags
- int oldFlags
PTR material_t* material
PTR material_s* material
BLENDMODE blendmode_t blendMode
FLOAT float[3] tangent
FLOAT float[3] bitangent
Expand Down
35 changes: 35 additions & 0 deletions doomsday/engine/include/resource/material.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,41 @@
#include "map/p_maptypes.h"
#include "map/p_dmu.h"

typedef enum {
MEC_UNKNOWN = -1,
MEC_FIRST = 0,
MEC_METAL = MEC_FIRST,
MEC_ROCK,
MEC_WOOD,
MEC_CLOTH,
NUM_MATERIAL_ENV_CLASSES
} material_env_class_t;

#define VALID_MATERIAL_ENV_CLASS(v) ((v) >= MEC_FIRST && (v) < NUM_MATERIAL_ENV_CLASSES)

struct material_variantlist_node_s;

typedef struct material_s {
runtime_mapdata_header_t header;
struct ded_material_s *_def;
struct material_variantlist_node_s *_variants;
material_env_class_t _envClass; /// Environmental sound class.
materialid_t _primaryBind; /// Unique identifier of the MaterialBind associated with this Material or @c NULL if not bound.
Size2 *_size; /// Logical dimensions in world-space units.
short _flags; /// @see materialFlags
boolean _inAnimGroup; /// @c true if belongs to some animgroup.
boolean _isCustom;
struct texture_s *_detailTex;
float _detailScale;
float _detailStrength;
struct texture_s *_shinyTex;
blendmode_t _shinyBlendmode;
float _shinyMinColor[3];
float _shinyStrength;
struct texture_s *_shinyMaskTex;
byte _prepared;
} material_t;

#ifdef __cplusplus

#include <QList>
Expand Down

0 comments on commit 3e2c4a1

Please sign in to comment.