MQMaterial class

MQMaterial class manages a material.

Basic
DeleteThis Delete this material class
GetUniqueID Get an unique ID of this material
Attributes
GetName Get a name
GetShader Get a shader type
GetVertexColor Get a type of a vertex color
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
SetShader Set a shader type
SetVertexColor Set a type of a vertex color
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

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);

Return value
An unique ID

(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);

buffer
A buffer to receive a material name
size
A length of a buffer

It stores this material's name to 'buffer'.


int MQMaterial::GetShader(void);

Return value
A type of a shader
[MQMATERIAL_SHADER_CLASSIC] Classic shader
[MQMATERIAL_SHADER_CONSTANT] Constant shader
[MQMATERIAL_SHADER_LAMBERT] Lambert shader
[MQMATERIAL_SHADER_PHONG] Phong shader
[MQMATERIAL_SHADER_BLINN] Blinn shader

(new in Rev2.30)

It gets a type of a shader of the material.


int MQMaterial::GetVertexColor(void);

Return value
A type of a vertex color
[MQMATERIAL_VERTEXCOLOR_DISABLE] Disabled
[MQMATERIAL_VERTEXCOLOR_DIFFUSE] Applies to a diffuse color

(new in Rev2.30)

It gets a type of a vertex color.


MQColor MQMaterial::GetColor(void);

Return value
Color

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);

Return value
A value for the attribute

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);

buffer
A buffer to receive a filename
size
A length of a buffer

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);

Return value
A type of a projection
[MQMATERIAL_PROJECTION_UV] UV mapping
[MQMATERIAL_PROJECTION_FLAT] Flat mapping
[MQMATERIAL_PROJECTION_CYLINDER] Cylinder mapping
[MQMATERIAL_PROJECTION_SPHERE] Sphere mapping

(new in Rev2.30)

It gets a type of a projection for a mapping.


MQPoint MQMaterial::GetMappingPosition(void);

Return value
A projection position for a mapping

(new in Rev2.30)

It gets a projection position for a mapping.


MQPoint MQMaterial::GetMappingScaling(void);

Return value
A projection scaling for a mapping

(new in Rev2.30)

It gets a projection scaling rate for a mapping.


MQAngle MQMaterial::GetMappingAngle(void);

Return value
A projection angle for a mapping

(new in Rev2.30)

It gets a projection angle for a mapping.


void MQMaterial::SetName(const char *name);

name
A buffer contains a name

It sets the material's name.


void MQMaterial::SetShader(int shader);

shader
A type of a shader
[MQMATERIAL_SHADER_CLASSIC] Classic shader
[MQMATERIAL_SHADER_CONSTANT] Constant shader
[MQMATERIAL_SHADER_LAMBERT] Lambert shader
[MQMATERIAL_SHADER_PHONG] Phong shader
[MQMATERIAL_SHADER_BLINN] Blinn shader

(new in Rev2.30)

It sets a type of a shader.


void MQMaterial::SetVertexColor(int value);

value
A type of a vertex color
[MQMATERIAL_VERTEXCOLOR_DISABLE] Disabled
[MQMATERIAL_VERTEXCOLOR_DIFFUSE] Applies to a diffuse color

(new in Rev2.30)

It sets a type of a vertex color.


void MQMaterial::SetColor(MQColor color);

color
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);

value
A value for each attribute

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);

name
A buffer contains a new 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);

type
A type of a projection
[MQMATERIAL_PROJECTION_UV] UV mapping
[MQMATERIAL_PROJECTION_FLAT] Flat mapping
[MQMATERIAL_PROJECTION_CYLINDER] Cylinder mapping
[MQMATERIAL_PROJECTION_SPHERE] Sphere mapping

(new in Rev2.30)

It sets a type of a projection for a mapping.


void MQMaterial::SetMappingPosition(MQPoint pos);

pos
A projection position for a mapping

(new in Rev2.30)

It sets a projection position for a mapping.


void MQMaterial::SetMappingScaling(MQPoint scale);

scale
A projection scaling for a mapping

(new in Rev2.30)

It sets a projection scaling for a mapping.


void MQMaterial::SetMappingAngle(MQAngle angle);

angle
A projection angle for a mapping

(new in Rev2.30)

It sets a projection angle for a mapping.