SketchUp SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Enumerations | Functions
material.h File Reference
#include <slapi/color.h>
#include <slapi/slapi.h>
#include <slapi/unicodestring.h>
#include <slapi/model/defs.h>

Go to the source code of this file.

Enumerations

enum  SUMaterialType { SUMaterialType_Colored = 0, SUMaterialType_Textured, SUMaterialType_ColorizedTexture }
 Indicates material type. More...
 

Functions

SU_EXPORT SUEntityRef SUMaterialToEntity (SUMaterialRef material)
 Converts from an SUMaterialRef to an SUEntityRef. This is essentially an upcast operation. More...
 
SU_EXPORT SUMaterialRef SUMaterialFromEntity (SUEntityRef entity)
 Converts from an SUEntityRef to an SUMaterialRef. This is essentially a downcast operation so the given SUEntityRef must be convertible to an SUMaterialRef. More...
 
SU_RESULT SUMaterialCreate (SUMaterialRef *material)
 Creates a material. More...
 
SU_RESULT SUMaterialRelease (SUMaterialRef *material)
 Releases a material and its resources. More...
 
SU_RESULT SUMaterialSetName (SUMaterialRef material, const char *name)
 Sets the name of a material object. More...
 
SU_RESULT SUMaterialGetName (SUMaterialRef material, SUStringRef *name)
 Retrieves the name of a material object. More...
 
SU_RESULT SUMaterialSetColor (SUMaterialRef material, const SUColor *color)
 Sets the color of a material object. More...
 
SU_RESULT SUMaterialGetColor (SUMaterialRef material, SUColor *color)
 Retrieves the color value of a material object. More...
 
SU_RESULT SUMaterialSetTexture (SUMaterialRef material, SUTextureRef texture)
 Sets the texture of a material object. More...
 
SU_RESULT SUMaterialGetTexture (SUMaterialRef material, SUTextureRef *texture)
 Retrieves the texture of a material object. More...
 
SU_RESULT SUMaterialGetOpacity (SUMaterialRef material, double *alpha)
 Retrieves the alpha value (0.0 - 1.0) of a material object. More...
 
SU_RESULT SUMaterialSetOpacity (SUMaterialRef material, double alpha)
 Sets the alpha value of a material object. More...
 
SU_RESULT SUMaterialGetUseOpacity (SUMaterialRef material, bool *use_opacity)
 Retrieves the flag indicating whether alpha values are used from a material object. More...
 
SU_RESULT SUMaterialSetUseOpacity (SUMaterialRef material, bool use_opacity)
 Sets the flag indicating whether alpha values are used on a material object. More...
 
SU_RESULT SUMaterialSetType (SUMaterialRef material, enum SUMaterialType type)
 Sets the type of a material object. More...
 
SU_RESULT SUMaterialGetType (SUMaterialRef material, enum SUMaterialType *type)
 Retrieves the type of a material object. More...
 

Enumeration Type Documentation

Indicates material type.

Enumerator
SUMaterialType_Colored 

Colored material.

SUMaterialType_Textured 

Textured material.

SUMaterialType_ColorizedTexture 

Colored and textured material.

Function Documentation

SU_RESULT SUMaterialCreate ( SUMaterialRef material)

Creates a material.

If the material is not associated with any face, it must be deallocated with SUMaterialRelease.

Parameters
[out]materialThe material created.
Returns
SU_EXPORT SUMaterialRef SUMaterialFromEntity ( SUEntityRef  entity)

Converts from an SUEntityRef to an SUMaterialRef. This is essentially a downcast operation so the given SUEntityRef must be convertible to an SUMaterialRef.

Parameters
[in]entityThe given entity reference.
Returns
  • The converted SUMaterialRef if the downcast operation succeeds
  • If not, the returned reference will be invalid
SU_RESULT SUMaterialGetColor ( SUMaterialRef  material,
SUColor color 
)

Retrieves the color value of a material object.

Parameters
[in]materialThe material object.
[out]colorThe color value retrieved.
Returns
SU_RESULT SUMaterialGetName ( SUMaterialRef  material,
SUStringRef name 
)

Retrieves the name of a material object.

Parameters
[in]materialThe material object.
[out]nameThe name retrieved.
Returns
SU_RESULT SUMaterialGetOpacity ( SUMaterialRef  material,
double *  alpha 
)

Retrieves the alpha value (0.0 - 1.0) of a material object.

Parameters
[in]materialThe material object.
[out]alphaThe alpha value retrieved.
Returns
SU_RESULT SUMaterialGetTexture ( SUMaterialRef  material,
SUTextureRef texture 
)

Retrieves the texture of a material object.

Parameters
[in]materialThe material object.
[out]textureThe texture object retrieved.
Returns
SU_RESULT SUMaterialGetType ( SUMaterialRef  material,
enum SUMaterialType type 
)

Retrieves the type of a material object.

Parameters
[in]materialThe material object.
[out]typeThe type retrieved.
Returns
SU_RESULT SUMaterialGetUseOpacity ( SUMaterialRef  material,
bool *  use_opacity 
)

Retrieves the flag indicating whether alpha values are used from a material object.

Parameters
[in]materialThe material object.
[out]use_opacityThe flag retrieved.
Returns
SU_RESULT SUMaterialRelease ( SUMaterialRef material)

Releases a material and its resources.

The material must not be associated with a parent object such as a face.

Parameters
[in]materialThe material to be released.
Returns
SU_RESULT SUMaterialSetColor ( SUMaterialRef  material,
const SUColor color 
)

Sets the color of a material object.

Parameters
[in]materialThe material object.
[in]colorThe color value to set the material color.
Returns
SU_RESULT SUMaterialSetName ( SUMaterialRef  material,
const char *  name 
)

Sets the name of a material object.

Parameters
[in]materialThe material object.
[in]nameThe name to set the material name. Assumed to be UTF-8 encoded.
Returns
SU_RESULT SUMaterialSetOpacity ( SUMaterialRef  material,
double  alpha 
)

Sets the alpha value of a material object.

Parameters
[in]materialThe material object.
[in]alphaThe alpha value to set. Must be within range [0.0, 1.0].
Returns
SU_RESULT SUMaterialSetTexture ( SUMaterialRef  material,
SUTextureRef  texture 
)

Sets the texture of a material object.

Parameters
[in]materialThe material object.
[in]textureThe texture object to set the material texture.
Returns
SU_RESULT SUMaterialSetType ( SUMaterialRef  material,
enum SUMaterialType  type 
)

Sets the type of a material object.

Parameters
[in]materialThe material object.
[in]typeThe type to set.
Returns
SU_RESULT SUMaterialSetUseOpacity ( SUMaterialRef  material,
bool  use_opacity 
)

Sets the flag indicating whether alpha values are used on a material object.

Parameters
[in]materialThe material object.
[in]use_opacityThe flag boolean value to set.
Returns
SU_EXPORT SUEntityRef SUMaterialToEntity ( SUMaterialRef  material)

Converts from an SUMaterialRef to an SUEntityRef. This is essentially an upcast operation.

Parameters
[in]materialThe given material reference.
Returns
  • The converted SUEntityRef if material is a valid object
  • If not, the returned reference will be invalid