![]() |
Polygon Crucher SDK - Documentation
Documentation
|
CMaterialMap handles material texture map. More...
CMaterialMap handles material texture map.
CMaterialMap refers to a bitmap file and optionnaly an alpha bitmap file. This material map has a type given by CMaterialMap::GetType and can be relative to the material diffuse, normap map, transparency...
The material map defines also a projection type, get by CMaterialMap::GetProjection. MAPPROJ_UVW requires a CUVWChannel whereas the other value means that map is projected and the UV values are computed depending on the corresponding projection.
#include <MaterialMap.h>
Public Types | |
enum | MaterialMapSize { MATERIALMAP_ANY_SIZE = -1 , MATERIALMAP_DEFAULT_SIZE = 0 } |
enum | MapChannelFlags { MAPCHANNEL_UNSPECIFIED = (unsigned int) - 1 , MAPCHANNEL_NONE = 0 , MAPCHANNEL_FIRST_CHANNEL_FOUND = 0x01 } |
typedef enum CMaterialMap::MaterialMapSize | MaterialMapSize |
typedef enum CMaterialMap::MapChannelFlags | MapChannelFlags |
![]() | |
enum | TimeStamp { INVALID_TIME = -1 } |
enum | KeyframeFlags { KEYFRAME_NONE = 0x00 , KEYFRAME_REPLACE_KEY = 0x01 , KEYFRAME_DONT_EVALUATE = 0x02 } |
typedef enum C3DKeyframable::TimeStamp | TimeStamp |
![]() | |
enum | FindKey { KEYFRAME_PREV = 0x01 , KEYFRAME_NEXT = 0x02 , KEYFRAME_SAME = 0x04 } |
Public Member Functions | |
virtual void | Serialize (CXArchive &ar) |
C3DMaterial * | GetMaterial () const |
Return the material to which the map is attached. | |
C3DScene * | GetScene () const |
Return scene to which the map belong to (from C3DMaterials) | |
CXString | GetBitmapPath (bool alpha, bool fullPath=false) const |
fullPath = true ensure that we have no relative path, otherwise the path might be relative to the scene filepath. Alpha = true, means that we return the alpha filename | |
CXString | AdjustPath (CXString filename, const CXString &newTargetPath=CXString(), bool allowRelative=true) const |
Adjust a single filename and make it relative to newTargetPath if provided or the scene path otherwise. | |
void | AdjustPaths (const CXString &targetPath, bool relativePathAllowed) |
Make all internal filenames used by materials relative to provided path. | |
bool | BitmapFileExists (bool alpha=false) |
Check if the bitmap file exists. | |
fileuint | GetFileSize (bool alpha=false) |
The file size of the source bitmap which might differ from the size of the requested bitmap. | |
bool | HasAlpha () |
Check if the map bitmap file has an alpha channel (if MAPPROP_DISABLE_ALPHA not set) | |
bool | operator== (CMaterialMap &refMap) const |
CMaterialMap & | operator= (CMaterialMap &refmap) |
CCustomData & | GetCustomData () |
const CCustomData & | GetCustomData () const |
void | SetFlag (MAP_PROPERTIES flag, bool set) |
bool | IsFlagSet (MAP_PROPERTIES flag) const |
void | SetType (MapType reftype) |
MapType | GetType () const |
void | SetProjection (MapProjection reftype) |
MapProjection | GetProjection () const |
void | SetAlphaFileName (const CXString &filename, const CXString &newReferencePath=CXString()) |
operator If newReferencePath is provided, the filename will be make relative to that directory if possible | |
void | SetFileName (const CXString &filename) |
void | SetHPBRotation (unsigned int time, const C3DVector &hpbvector) |
void | ResetTransformation () |
void | SetScale (unsigned int time, const C3DVector &vect) |
void | Scale (unsigned int time, const C3DVector &vect) |
void | SetTranslation (unsigned int time, const C3DVector &vect) |
void | Translate (unsigned int time, const C3DVector &vect) |
void | SetRotation (unsigned int time, const CQuaternion &quat) |
void | Rotate (unsigned int time, const CQuaternion &quat) |
void | SetTile (unsigned int time, const C3DVector &vect) |
void | SetMatrix (unsigned int time, const C4x4Matrix &matrix) |
void | SetAxis (MapAxis axis) |
void | SetChannelID (ChannelID uvwChannelID, bool front=true, unsigned int channelFlags=MAPCHANNEL_UNSPECIFIED) |
Handle the channel id of the material map. The corresponding channel is an UVW_CHANNEL. | |
ChannelID | GetChannelID (bool front=true, unsigned int *channelFlags=NULL) const |
Return the material map channel ID, as set in SetChannelID (the flag MAPPROP_USE_FRONT_CHANNEL_WHEN_BACK_MISSING is not taken into account). Can also return CHANNELID_FIRST_CHANNEL_FOUND. GetUVWChannelID should be used as an helper to get the final channel ID to use for a given object. | |
void | ChangeChannelID (CHashMap< CChannelInfo, const CChannelInfo &, CChannelInfo > &channelMap) |
Remap the materialmap channel ID to the new channelID provided by the map. | |
void | GetFileName (CXString &filename) const |
This returns the raw image filename as it is stored in the map, when reading a file. The path can be relative, absolute... Use GetBitmapPath resolves absolute / relative path and potentially fixe texture location changes. | |
void | GetAlphaFileName (CXString &filename) const |
Same as GetFileName, but for the alpha image. | |
void | GetScale (unsigned int time, C3DVector &vect) const |
void | GetTranslation (unsigned int time, C3DVector &vect) const |
void | GetHPBRotation (unsigned int time, C3DVector &vect) const |
void | GetRotation (unsigned int time, CQuaternion &vect) const |
void | GetMatrix (unsigned int time, C4x4Matrix &vect) const |
void | GetTile (unsigned int time, C3DVector &vect) const |
MapAxis | GetAxis () const |
void | SwapCoordinates (unsigned int swapmode) |
![]() | |
int | AddKey (int time, C3DKeyframe *newkey) |
Return -1 if fails or keyframe number. | |
int | AddKey (int time, const C3DKeyframe &newkey) |
Return keyframe number. | |
int | DeleteKey (int time, longuint classid=KEYFRAME_NULLID) |
If time = INVALID_TIME, then all key of classid are deleted or all keys are deleted if classid = KEYFRAME_NULLID. | |
void | DeleteAllKeys () |
C3DKeyframe * | CreateKey (int time, longuint classid, unsigned int flags=KEYFRAME_NONE) |
Create key of the given classid. flags is one or more KeyframeFlags. | |
C3DKeyframe * | GetKeyByIndex (unsigned int index, int *time=NULL, longuint classid=KEYFRAME_NULLID) |
This invalidate the cache, and can lead to slower computation. | |
const C3DKeyframe * | GetConstKeyByIndex (unsigned int index, int *time=NULL, longuint classid=KEYFRAME_NULLID) const |
int | GetKeyNbr (longuint classid=KEYFRAME_NULLID) const |
bool | Evaluate (int time, C3DKeyframe &findkey) const |
This method evaluate the key at the given time. Same but slower that the following method that return a pointer. | |
const C3DKeyframe * | Evaluate (int time, longuint classid) const |
This method evaluate the key at the given time. This is the fastest method. The key content cannot be changed. | |
int | CopyKeys (const C3DKeyframable *srckeys, longuint classid=KEYFRAME_NULLID, CTimeRange range=CTimeRange(0, CTimeRange::MAX_TIME)) |
Copy key of the given classid in the given time range. | |
bool | operator== (const C3DKeyframable &refkeys) const |
bool | operator= (const C3DKeyframable &key) |
virtual void | OnKeyframesChanged (longuint classID) const |
virtual CTimeRange | GetTimeRange (longuint classid=KEYFRAME_NULLID) const |
virtual const C3DKeyframe * | GetConstKey (int time, unsigned int findKeyFlag, longuint classid=KEYFRAME_NULLID, int *findKeyTime=NULL) const |
Retrieve a keyframe at / before or after the specified time depending on findKeyFlag. | |
![]() | |
int | GetKeyTime (int time, unsigned int pos, longuint classid=KEYFRAME_NULLID) |
Static Public Member Functions | |
static CXString | GetMapName (MapType type) |
Friends | |
class | C3DMaterial |
class | CMaterialMapCache |
Reimplemented from C3DKeyframable.
void CMaterialMap::SetChannelID | ( | ChannelID | uvwChannelID, |
bool | front = true , |
||
unsigned int | channelFlags = MAPCHANNEL_UNSPECIFIED |
||
) |
Handle the channel id of the material map. The corresponding channel is an UVW_CHANNEL.
The material might define a back channel ID for double sided face that have both side the same material with different UVs If no back channel is define, then front / back side share the same UV and GetChannelID return frontChannelID for front / back side