![]() |
Polygon Crucher SDK - Documentation
Documentation
|
C3DStandardMaterial is a basic material that defines ambient, specular, bump and other coefficients. More...
C3DStandardMaterial is a basic material that defines ambient, specular, bump and other coefficients.
#include <3DMaterial.h>
Public Member Functions | |
void | SetAmbientColor (unsigned int time, const CRGBColor &color) |
CRGBColor | GetAmbientColor (unsigned int time, bool modulateByAmbient=false) const |
void | FloatGetAmbientColor (unsigned int time, float color[4]) |
CMaterialMap * | GetAmbientMaps () |
CMaterialMap * | GetDiffuseMaps () |
CMaterialMap * | GetNormalMaps () |
void | SetSpecularColor (unsigned int time, const CRGBColor &color) |
CRGBColor | GetSpecularColor (unsigned int time) const |
void | FloatGetSpecularColor (unsigned int time, float color[4]) const |
CMaterialMap * | GetSpecularMaps () |
void | SetBumpFactor (unsigned int time, float value) |
float | GetBumpFactor (unsigned int time) const |
CMaterialMap * | GetBumpMaps () |
void | SetAmbientFactor (unsigned int time, float value) |
float | GetAmbientFactor (unsigned int time) const |
void | SetSpecularFactor (unsigned int time, float value) |
float | GetSpecularFactor (unsigned int time) const |
CMaterialMap * | GetTransparencyMaps () |
void | SetReflectionFactor (unsigned int time, float value) |
Reflection coef between 0.0 and 1.0f (default 0.0) | |
float | GetReflectionFactor (unsigned int time) const |
void | SetRefractionFactor (unsigned int time, float value) |
IOR refraction indice >= 1.0 (default 1.0) | |
float | GetRefractionFactor (unsigned int time) const |
virtual C3DStandardMaterial * | ConvertToStandardMaterial (bool replaceCurrentByStandardMaterial) |
Must be overidden Return a standard material from the given material. If deleteCurrentAndReplaceByNewOne = false, the returned materials must be attached to CMaterials list, or deleted when no more need. If deleteCurrentAndReplaceByNewOne = true, the current material is destroyed (if not already a standard material) and the new standard is added to materials list to which the material is attached. | |
void | Serialize (CXArchive &ar) |
![]() | |
C3DMaterial () | |
Use CMaterials::CreateNewMaterial if the material is intended to belong to a material scene list. | |
CMaterials * | GetMaterials () const |
C3DScene * | GetScene () const |
The materials to which the material is attached. NULL if material not already attached to anything. | |
MATERIAL_CLASS | GetClass () const |
MaterialID | SetMaterialID (MaterialID refID=MATERIAL_UNDEFINED) |
Create a new material with the given MaterialID. If material is not attached to a material list, then provided id is always used. If the material is already attached to a material list, provided id might be modified if it is already used by the materials list. Note: if you intend to change a materialID which is already in the material list, you should remove it from the list before. | |
MaterialID | GetMaterialID () const |
unsigned int | GetFlags () |
void | SetFlags (unsigned int flags, bool set) |
void | SetFlag (MATERIAL_FLAGS flag, bool set) |
bool | IsOneFlagSet (unsigned int flags) const |
bool | IsFlagSet (MATERIAL_FLAGS flag) const |
CCustomData & | GetCustomData () |
const CCustomData & | GetCustomData () const |
void | Inherit (const C3DMaterial *refmat) |
Inherit basic information from refmat (mainly C3DMaterial information such name, materialID, flags, KeyframableID, DataID,...). The material should not be attached to any material list (materialid. | |
virtual C3DMaterial & | operator= (const C3DMaterial &refmat) |
virtual bool | HasSameParameters (const C3DMaterial &refmat) const |
Compare only settings. | |
virtual void | ChangeChannelID (CHashMap< CChannelInfo, const CChannelInfo &, CChannelInfo > &channelMap) |
Remap the materialmap channel ID to the new channelID provided by the map. Used mainly internally when concatenating different mesh for example. | |
CXString | GetName (void) const |
Get material name. | |
void | SetName (const CXString &) |
Set material name. | |
void | SetAlphaMode (unsigned int time, alphaModeEnum mode, float cutOffCoef=0.0f) |
Set alpha cut and cutoff coef. | |
float | GetAlphaModeCutoffCoef (unsigned int time) const |
Get cutoff coef. | |
alphaModeEnum | GetAlphaMode () const |
Get alpha mode. | |
void | SetTransparencyFactor (unsigned int time, float value) |
float | GetTransparencyFactor (unsigned int time) const |
virtual bool | IsTransparent (unsigned int time, bool checkDiffuseAlpha=false) const |
void | SetFaceMode (faceModeEnum mode) |
Set single / double face material mode. | |
faceModeEnum | GetFaceMode (void) const |
Get single / double face material mode. | |
void | SetSmoothAngle (unsigned int time, float value) |
Set normal break angle. | |
float | GetSmoothAngle (unsigned int time) const |
Get normal break angle. | |
bool | operator== (const C3DMaterial &refmat) const |
Compare 2 materials (name and settings) | |
bool | AdjustMaterial (unsigned int flags) |
flags is one or more AdjustMaterialFlags. return true if the material changed | |
bool | CopyTextures (const CXString &dstfolder, bool overwriteIfExists=false) |
Copy all material maps to the given path and update pathss. | |
bool | IsGenerateUVWNeeded (MapType type=MAPTYPE_UNDEFINED) const |
Return true if one of the map has a projection mode that require UVW to be generated, for all the map type (type == MAPTYPE_UNDEFINED) or for the specific MapType (type = MAPTYPE_DIFFUSE for example) | |
unsigned int | CreateMissingUVWBackChannels (const CGeomInfo *info, MapType type=MAPTYPE_UNDEFINED, CHANNEL_PROPERTIES channelTagFlag=CHANNEL_NONE) const |
Copy front UVW channels to back channels if back are missing. If type = MAPTYPE_UNDEFINED, then all maps are checked, otherwise only the provided map. | |
void | AdjustPaths (const CXString &targetPath, bool relativePathAllowed) |
Make internal filenames used by materials relative to provided path. | |
void | SetDiffuseColor (unsigned int time, const CRGBColor &color) |
virtual CRGBColor | GetDiffuseColor (unsigned int time, bool modulateByDiffuseFactor=false) const |
This can be overidden as derived class might have a different computation for this. | |
void | FloatGetDiffuseColor (unsigned int time, float color[4], bool modulateByDiffuseFactor=false) const |
void | SetDiffuseFactor (unsigned int time, float value) |
float | GetDiffuseFactor (unsigned int time) const |
void | SetVertexColor (unsigned int time, ChannelID channel, float modulationCoef=1.0f, unsigned int channelFlags=CMaterialMap::MAPCHANNEL_UNSPECIFIED) |
ChannelID | GetVertexColor (unsigned int time, float &modulationCoef, unsigned int *channelFlags=NULL) const |
bool | RemoveVertexColor () |
ChannelID | GetUVWChannelID (const CGeomInfo *info, MapType maptype, bool front=true) const |
int | GetRequiredUVWChannelID (const CGeomInfo *info, CHashTable< ChannelID > &channels, MapType maptype=MAPTYPE_UNDEFINED, bool clearMap=true) const |
ChannelID | GetVCChannelID (const CGeomInfo *info, unsigned int time, float &value) const |
int | GetRequiredVCChannelID (const CGeomInfo *info, CHashTable< ChannelID > &channels, MapType maptype=MAPTYPE_UNDEFINED, bool clearMap=true) const |
CMaterialMap * | AddMaterialMap (MapType type) |
CMaterialMap * | AddMaterialMap (const CXString &filename, ChannelID id, MapType type, MapProjection projection, unsigned int channelFlags=CMaterialMap::MAPCHANNEL_NONE) |
HashPos | GetFirstMap () |
CMaterialMap * | GetNextMap (HashPos &pos, MapType &type) |
bool | RemoveMaterialMap (MapType type) |
CMaterialMap * | GetMaterialMap (MapType type) |
const CMaterialMap * | GetMaterialMap (MapType type) const |
![]() | |
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) |
Additional Inherited Members | |
![]() | |
enum | _faceModeEnum { FACE_DEFAULT_MODE = 0 , SINGLE_SIDE , DOUBLE_SIDE } |
enum | _alphaModeEnum { ALPHA_BLEND = 0x01 , ALPHA_OPAQUE = 0x02 } |
enum | AdjustMaterialFlags { ADJUST_NONE = 0 , ADJUST_DIFFUSE_IF_NO_MODULATION = 0x01 } |
typedef enum C3DMaterial::_faceModeEnum | faceModeEnum |
typedef enum C3DMaterial::_alphaModeEnum | alphaModeEnum |
typedef enum C3DMaterial::AdjustMaterialFlags | AdjustMaterialFlags |
![]() | |
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 } |
![]() | |
static C3DMaterial * | Create (MATERIAL_CLASS materialClass) |
Create a C3DMaterial. Equivalent to xNew(C3DMaterial) | |
|
inlinevirtual |
Must be overidden Return a standard material from the given material. If deleteCurrentAndReplaceByNewOne = false, the returned materials must be attached to CMaterials list, or deleted when no more need. If deleteCurrentAndReplaceByNewOne = true, the current material is destroyed (if not already a standard material) and the new standard is added to materials list to which the material is attached.
Reimplemented from C3DMaterial.
CMaterialMap * C3DStandardMaterial::GetAmbientMaps | ( | ) |
CMaterialMap * C3DStandardMaterial::GetDiffuseMaps | ( | ) |
CMaterialMap * C3DStandardMaterial::GetNormalMaps | ( | ) |
Reimplemented from C3DMaterial.