MQMaterial class manages a material.
Basic | |
DeleteThis | Delete this material class |
GetUniqueID | Get an unique ID of this material |
Attributes | |
GetName | Get a name |
GetSelected | Get a selection status of a material |
GetShader | Get a shader type |
GetVertexColor | Get a type of a vertex color |
GetDoubleSided | Get single or double sided faces. |
GetColor | Get a base color |
GetAlpha | Get a transparency |
GetDiffuse | Get a diffuse value |
GetAmbient | Get an ambient value |
GetEmission | Get an emission value |
GetSpecular | Get a specular value |
GetPower | Get a power of a specular |
GetTextureName | Get a filename of a texture mapping |
GetAlphaName | Get a filename of an alpha mapping |
GetBumpName | Get a filename of a bump mapping |
GetMappingType | Get a projection type for a mapping |
GetMappingPosition | Get a projection position for a mapping |
GetMappingScaling | Get a projection scaling for a mapping |
GetMappingAngle | Get a projection angle for a mapping |
SetName | Set a name |
SetSelected | Set a selection status of a material |
SetShader | Set a shader type |
SetVertexColor | Set a type of a vertex color |
SetDoubleSided | Set single or double sided faces |
SetColor | Set a base color |
SetAlpha | Set a transparency |
SetDiffuse | Set a diffuse value |
SetAmbient | Set an ambient value |
SetEmission | Set an emission value |
SetSpecular | Set a specular value |
SetPower | Set a power of a specular |
SetTextureName | Set a filename of a texture mapping |
SetAlphaName | Set a filename of an alpha mapping |
SetBumpName | Set a filename of a bump mapping |
SetMappingType | Set a projection type for a mapping |
SetMappingPosition | Set a projection position for a mapping |
SetMappingScaling | Set a projection scaling for a mapping |
SetMappingAngle | Set a projection angle for a mapping |
User data | |
AllocUserData | Allocate an user data |
FreeUserData | Free an user data |
GetUserData | Get an user data |
GetUserDataPart | Get an user data partially |
SetUserData | Set an user data |
SetUserDataPart | Set an user data partially |
void MQMaterial::DeleteThis(void);
It deletes a material class.
This function is available for the material registered in a document. You must use MQDocument::DeleteMaterial() to delete a material that is not registered to any documents.
UINT MQMaterial::GetUniqueID(void);
(new in Rev2.40)
It gets an unique ID of the material.
An unique ID is assigned when the material is registered to the document by MQDocument::AddMaterial().
void MQMaterial::GetName(char *buffer, int size);
It stores this material's name to 'buffer'.
BOOL MQMaterial::GetSelected();
(new in Rev3.10)
it gets a selection status of the material.
This selection indicates a status for multiple selections on the material panel. A current material can be obtained by MQDocument::GetCurrentMaterialIndex().
int MQMaterial::GetShader(void);
(new in Rev2.30)
It gets a type of a shader of the material.
int MQMaterial::GetVertexColor(void);
(new in Rev2.30)
It gets a type of a vertex color.
BOOL MQMaterial::GetDoubleSided(void);
(new in Rev3.10)
It gets whether to show single or double sided faces.
MQColor MQMaterial::GetColor(void);
It gets a base color of this material.
float MQMaterial::GetAlpha(void);
float MQMaterial::GetDiffuse(void);
float MQMaterial::GetAmbient(void);
float MQMaterial::GetEmission(void);
float MQMaterial::GetSpecular(void);
float MQMaterial::GetPower(void);
It gets an alpha value (transparency), a diffuse value, an ambient value, an emission value, a specular value and a power of a specular.
It returns from 0 to 1. (from 0 to 100 for GetPower() only)
void MQMaterial::GetTextureName(char *buffer, int size);
void MQMaterial::GetAlphaName(char *buffer, int size);
void MQMaterial::GetBumpName(char *buffer, int size);
It stores a filename of a texture mapping, an alpha mapping and a bump mapping to the 'buffer'. The 'filename' is usually a relative path, and it is an absolute path in case that the filename is originally set as an absolute path.
You can use MQDocument::FindMappingFile()
to convert a returned relative path to an absolute path.
int MQMaterial::GetMappingType(void);
(new in Rev2.30)
It gets a type of a projection for a mapping.
MQPoint MQMaterial::GetMappingPosition(void);
(new in Rev2.30)
It gets a projection position for a mapping.
MQPoint MQMaterial::GetMappingScaling(void);
(new in Rev2.30)
It gets a projection scaling rate for a mapping.
MQAngle MQMaterial::GetMappingAngle(void);
(new in Rev2.30)
It gets a projection angle for a mapping.
void MQMaterial::SetName(const char *name);
It sets the material's name.
void MQMaterial::SetSelected(BOOL flag);
(new in Rev3.10)
it sets a selection status of the material.
This selection indicates a status for multiple selections on the material panel. A current material can be set by MQDocument::SetCurrentMaterialIndex().
void MQMaterial::SetShader(int shader);
(new in Rev2.30)
It sets a type of a shader.
void MQMaterial::SetVertexColor(int value);
(new in Rev2.30)
It sets a type of a vertex color.
void MQMaterial::SetDoubleSided(BOOL value);
(new in Rev3.10)
It sets whether to show single or double sided faces.
void MQMaterial::SetColor(MQColor color);
It sets a base color of the material.
void MQMaterial::SetAlpha(float value);
void MQMaterial::SetDiffuse(float value);
void MQMaterial::SetAmbient(float value);
void MQMaterial::SetEmission(float value);
void MQMaterial::SetSpecular(float value);
void MQMaterial::SetPower(float value);
It sets an alpha value (transparency), a diffuse value, an ambient value, an emission value, a specular value and a power of a specular.
The 'value' must be from 0 to 1. It must be from 0 to 100 in SetPower() only.
void MQMaterial::SetTextureName(const char *name);
void MQMaterial::SetAlphaName(const char *name);
void MQMaterial::SetBumpName(const char *name);
It assigns a texture mapping, an alpha mapping and a bump mapping with the specified filename. The name can be both a relative path and an absolute path.
void MQMaterial::SetMappingType(int type);
(new in Rev2.30)
It sets a type of a projection for a mapping.
void MQMaterial::SetMappingPosition(MQPoint pos);
(new in Rev2.30)
It sets a projection position for a mapping.
void MQMaterial::SetMappingScaling(MQPoint scale);
(new in Rev2.30)
It sets a projection scaling for a mapping.
void MQMaterial::SetMappingAngle(MQAngle angle);
(new in Rev2.30)
It sets a projection angle for a mapping.
BOOL MQMaterial::AllocUserData(int userdata_id);
(new in Rev3.10)
It allocates a memory area for an user data in the material.
It uses an user data ID created by MQDocument::CreateMaterialUserData() for 'userdata_id'.
When an user data that is already allocated is specified, this function will return TRUE without performing anything.
Please do not allocate an user data until it is actually needed because it is necessary for a memory.
void MQMaterial::FreeUserData(int userdata_id);
(new in Rev3.10)
It frees a memory area for an user data allocated by MQMaterial::AllocUserData().
Please free it immediately when it is not necessary any longer. A memory will be wasted if it continues allocating carelessly.
BOOL MQMaterial::GetUserData(int userdata_id, void *buffer);
(new in Rev3.10)
It gets an user data for a material.
A size of buffer must be equal to or larger than a size specified in MQDocument::CreateMaterialUserData().
It will return FALSE when you specify an user data that has not been allocated yet. And the buffer are filled with 0 when you specify an user data that has not been set yet by MQMaterial::SetUserData().
BOOL MQMaterial::GetUserDataPart(int userdata_id, int offset, int copy_bytes, void *buffer);
(new in Rev3.10)
It partially gets an user data for a material.
An area begins from the offset is stored to the buffer.
A size of buffer must be equal to or larger than copy_bytes. A whole user data, that is, a number of bytes specified in MQDocument::CreateMaterialUserData() is copied when 0 is specified for copy_bytes.
It will return FALSE when you specify an user data that has not been allocated yet. And the buffer are filled with 0 when you specify an user data that has not been set yet by MQMaterial::SetUserData().
BOOL MQMaterial::SetUserData(int userdata_id, const void *buffer);
(new in Rev3.10)
It sets an user data with the buffer.
A size of buffer must be equal to or larger than a size specified in MQDocument::CreateMaterialUserData().
It will return FALSE when you specify an user data that has not been allocated yet.
BOOL MQMaterial::SetUserDataPart(int userdata_id, int offset, int copy_bytes, const void *buffer);
(new in Rev3.10)
It partially sets an user data for a material.
A data in the buffer is copied to an area begins from the offset.
A size of buffer must be equal to or larger than copy_bytes. A whole user data, that is, a number of bytes specified in MQDocument::CreateMaterialUserData() is copied when 0 is specified for copy_bytes.
It will return FALSE when you specify an user data that has not been allocated yet.