This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::Material Class

Interface for material manipulation.

To use this class, include the UnigineMaterial.h file.

Unigine::Material Class

Members


virtual ~Material ()

Virtual destructor.

virtual void grab () =0

Grab Material. The Material should not be handled by the engine after this function is called.

virtual void release () =0

Release Material. The Material should be handled by the engine after this function is called.

virtual int isOwner () const =0

Return the "owner" flag.

Return value

Returns the "owner" flag.

virtual int isHidden () const =0

Returns a value indicating if the material is hidden.

Return value

Returns 1 if the material is hidden; otherwise, 0.

virtual int isEditable () const =0

Returns a value indicating if the material is editable.

Return value

Returns 1 if the material is editable; otherwise, 0.

virtual int isReflection2D () const =0

Returns a value indicating if the material has 2d reflection texture.

Return value

Returns 1 if the material has 2d reflection texture; otherwise, 0.

virtual int isReflectionCube () const =0

Returns a value indicating if the material has cube reflection texture.

Return value

Returns 1 if the material has cube reflection texture; otherwise, 0.

virtual int isProcedural () const =0

Returns a value indicating if the material has procedural texture.

Return value

Returns 1 if the material has procedural texture; otherwise, 0.

virtual int isFilter () const =0

Returns a value indicating if the material has filter texture.

Return value

Returns 1 if the material has filter texture; otherwise, 0.

virtual const char * getName () const =0

Returns a material name.

Return value

Material name.

virtual Ptr< Material > getParent () const =0

Returns the parent material smart pointer.

Return value

Parent material smart pointer.

virtual Ptr< Material > getCompare () const =0

Returns the compare material smart pointer.

Return value

Compare material smart pointer.

virtual int getNumChilds () const =0

Returns the number of children materials.

Return value

The number of children materials.

virtual Ptr< Material > getChild (int num) const =0

Returns the child material.

Arguments

  • int num - The child number.

Return value

The child material smart pointer.

virtual int isParent (const char * name) const =0

Returns a value indicating if the material is a parent one.

Arguments

  • const char * name - Material name.

Return value

Returns 1 if the material is a parent material.

virtual Ptr< Material > clone (const char * name) const =0

Clones the material.

Arguments

  • const char * name - New material name.

Return value

Return cloned material smart pointer.

virtual Ptr< Material > inherit (const char * name) const =0

Inherits the material.

Arguments

  • const char * name - New material name.

Return value

Return inherited material smart pointer.

virtual void setBlendFunc (int src, int dest) const =0

Sets the blending function.

Arguments

  • int src - Source blending function.
  • int dest - Destination blending function.

virtual int getBlendSrcFunc () const =0

Gets source blending function.

Return value

Returns source blending function.

virtual int getBlendDestFunc () const =0

Gets destination blending function.

Return value

Returns destination blending function.

virtual int isOpacity () const =0

Returns a value indicating if the material is opacity.

Return value

Returns 1 is the material is opacity; otherwise, 0.

virtual int isTransparent () const =0

Returns a value indicating if the material is transparent.

Return value

Returns 1 is the material is transparent; otherwise, 0.

virtual void setDownsize (int downsize) const =0

Sets downsize rendering mode.

Arguments

  • int downsize - Downsize rendering mode.

virtual int getDownsize () const =0

Gets downsize rendering mode.

Return value

Returns downsize rendering mode.

virtual void setGroup (int group) const =0

Sets rendering group.

Arguments

  • int group - Rendering group.

virtual int getGroup () const =0

Gets rendering group.

Return value

Returns rendering group.

virtual void setOrder (int order) const =0

Sets rendering order.

Arguments

  • int order - Rendering order.

virtual int getOrder () const =0

Gets rendering order.

Return value

Returns rendering order.

virtual void setOffset (int offset) const =0

Sets rendering polygon offset.

Arguments

  • int offset - Rendering polygon offset.

virtual int getOffset () const =0

Gets rendering polygon offset.

Return value

Returns rendering polygon offset.

virtual void setLightMask (int mask) const =0

Sets light mask.

Arguments

  • int mask - Light mask.

virtual int getLightMask () const =0

Gets light mask.

Return value

Returns light mask.

virtual void setViewportMask (int mask) const =0

Sets viewport mask.

Arguments

  • int mask - viewport mask.

virtual int getViewportMask () const =0

Gets viewport mask.

Return value

Returns viewport mask.

virtual void setPostDeferred (int enable) const =0

Sets post deferred option.

Arguments

  • int enable - post deferred option.

virtual int getPostDeferred () const =0

Gets post deferred option.

Return value

Returns post deferred option.

virtual void setPostRefraction (int enable) const =0

Sets post refraction option.

Arguments

  • int enable - post refraction option.

virtual int getPostRefraction () const =0

Gets post refraction option.

Return value

Returns post refraction option.

virtual void setPostScattering (int enable) const =0

Sets post scattering option.

Arguments

  • int enable - post scattering option.

virtual int getPostScattering () const =0

Gets post scattering option.

Return value

Returns post scattering option.

virtual void setDepthMask (int enable) const =0

Sets depth mask option.

Arguments

  • int enable - depth mask option.

virtual int getDepthMask () const =0

Gets depth mask option.

Return value

Returns depth mask option.

virtual void setGlowMask (int enable) const =0

Sets glow mask option.

Arguments

  • int enable - glow mask option.

virtual int getGlowMask () const =0

Gets glow mask option.

Return value

Returns glow mask option.

virtual void setParallaxMask (int enable) const =0

Sets parallax mask option.

Arguments

  • int enable - parallax mask option.

virtual int getParallaxMask () const =0

Gets parallax mask option.

Return value

Returns parallax mask option.

virtual void setOcclusionMask (int enable) const =0

Sets occlusion mask option.

Arguments

  • int enable - occlusion mask option.

virtual int getOcclusionMask () const =0

Gets occlusion mask option.

Return value

Returns occlusion mask option.

virtual void setAlphaTest (int enable) const =0

Sets alpha test option.

Arguments

  • int enable - alpha test option.

virtual int getAlphaTest () const =0

Gets alpha test option.

Return value

Returns alpha test option.

virtual void setTwoSided (int enable) const =0

Sets two sided option.

Arguments

  • int enable - two sided option.

virtual int getTwoSided () const =0

Gets two sided option.

Return value

Returns two sided option.

virtual void setLightBlending (int enable) const =0

Sets light blending option.

Arguments

  • int enable - light blending option.

virtual int getLightBlending () const =0

Gets light blending option.

Return value

Returns light blending option.

virtual void setCastShadow (int enable) const =0

Sets cast shadow option.

Arguments

  • int enable - cast shadow option.

virtual int getCastShadow () const =0

Gets cast shadow option.

Return value

Returns cast shadow option.

virtual void setReceiveShadow (int enable) const =0

Sets receive shadow option.

Arguments

  • int enable - receive shadow option.

virtual int getReceiveShadow () const =0

Gets receive shadow option.

Return value

Returns receive shadow option.

virtual void setCastWorldShadow (int enable) const =0

Sets cast world shadow option.

Arguments

  • int enable - cast world shadow option.

virtual int getCastWorldShadow () const =0

Gets cast world shadow option.

Return value

Returns cast world shadow option.

virtual void setReceiveWorldShadow (int enable) const =0

Sets receive world shadow option.

Arguments

  • int enable - receive world shadow option.

virtual int getReceiveWorldShadow () const =0

Gets receive world shadow option.

Return value

Returns receive world shadow option.

virtual void setCastTranslucent (int enable) const =0

Sets cast translucent option.

Arguments

  • int enable - cast translucent option.

virtual int getCastTranslucent () const =0

Gets cast translucent option.

Return value

Returns cast translucent option.

virtual void setReceiveTranslucent (int enable) const =0

Sets receive translucent option.

Arguments

  • int enable - receive translucent option.

virtual int getReceiveTranslucent () const =0

Gets receive translucent option.

Return value

Returns receive translucent option.

virtual int getNumStates () const =0

Returns the number of states.

Return value

Returns number of states.

virtual const char * getStateName (int num) const =0

Returns the state name.

Arguments

  • int num - The state number.

Return value

State name.

virtual int getStateType (int num) const =0

Returns the state type.

Arguments

  • int num - The state number.

Return value

State type.

virtual int isStateHidden (int num) const =0

Returns a value indicating if the state is hidden.

Arguments

  • int num - The state number.

Return value

Returns 1 is the state is hidden; otherwise, 0.

virtual int findState (const char * name) const =0

Finds a state by its name.

Arguments

  • const char * name - State name.

Return value

State number.

virtual void setState (int num, int value) const =0

Sets state value.

Arguments

  • int num - State number.
  • int value - State value.

virtual int getState (int num) const =0

Gets state value.

Arguments

  • int num - State number.

Return value

State value.

virtual int getStateSwitchNumItems (int num) const =0

Returns the number of switch item names.

Arguments

  • int num - State number.

Return value

Number of switch item names.

virtual const char * getStateSwitchItem (int num, int item) const =0

Returns the switch item name.

Arguments

  • int num - State number.
  • int item - Item number.

Return value

Switch item name.

virtual ShaderPtr getShader (int pass, int node) const =0

Returns the rendering shader smart pointer for specified rendering pass and node type.

Arguments

  • int pass - Rendering pass.
  • int node - Node type.

Return value

Shader smart pointer.

virtual ShaderPtr getShader (int pass) const =0

Returns the post processing shader smart pointer for specified rendering pass.

Arguments

  • int pass - Rendering pass.

Return value

Shader smart pointer.

virtual int getNumTextures () const =0

Returns the number of textures.

Return value

Returns number of textures.

virtual const char * getTextureName (int num) const =0

Returns the texture name.

Arguments

  • int num - The texture number.

Return value

State name.

virtual int getTextureType (int num) const =0

Returns the texture type.

Arguments

  • int num - The texture number.

Return value

State type.

virtual int isTextureHidden (int num) const =0

Returns a value indicating if the texture is hidden.

Arguments

  • int num - The texture number.

Return value

Returns 1 is the texture is hidden; otherwise, 0.

virtual int findTexture (const char * name) const =0

Finds a texture by its name.

Arguments

  • const char * name - State name.

Return value

State number.

virtual void setImageTextureName (int num, const char * name) const =0

Sets the image texture name.

Arguments

  • int num - Texture number.
  • const char * name - Image texture name.

virtual const char * getImageTextureName (int num) const =0

Gets the image texture name.

Arguments

  • int num - Texture number.

Return value

Returns image texture name.

virtual int setImageTextureImage (int num, const ImagePtr & image, int dynamic) const =0

Sets the image texture image.

Arguments

  • int num - Texture number.
  • const ImagePtr & image - Image smart pointer.
  • int dynamic - Dynamic texture flag.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int getImageTextureImage (int num, const ImagePtr & image) const =0

Gets the image texture image.

Arguments

  • int num - Texture number.
  • const ImagePtr & image - Image smart pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual void setImageTexture (int num, const TexturePtr & texture) const =0

Sets the image texture smart pointer.

Arguments

  • int num - Texture number.
  • const TexturePtr & texture - Texture smart pointer.

virtual TexturePtr getImageTexture (int num) const =0

Gets the image texture smart pointer.

Arguments

  • int num - Texture number.

Return value

Returns image texture smart pointer.

virtual int setProceduralTextureImage (int num, const ImagePtr & image) const =0

Sets the procedural texture image.

Arguments

  • int num - Texture number.
  • const ImagePtr & image - Image smart pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int getProceduralTextureImage (int num, const ImagePtr & image) const =0

Gets the procedural texture image.

Arguments

  • int num - Texture number.
  • const ImagePtr & image - Image smart pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual TexturePtr getProceduralTexture (int num) const =0

Gets the procedural texture smart pointer.

Arguments

  • int num - Texture number.

Return value

Returns procedural texture smart pointer.

virtual int getNumParameters () const =0

Returns the number of parameters.

Return value

Returns number of parameters.

virtual const char * getParameterName (int num) const =0

Returns the parameter name.

Arguments

  • int num - The parameter number.

Return value

State name.

virtual int getParameterType (int num) const =0

Returns the parameter type.

Arguments

  • int num - The parameter number.

Return value

State type.

virtual int isParameterHidden (int num) const =0

Returns a value indicating if the parameter is hidden.

Arguments

  • int num - The parameter number.

Return value

Returns 1 is the parameter is hidden; otherwise, 0.

virtual int findParameter (const char * name) const =0

Finds a parameter by its name.

Arguments

  • const char * name - State name.

Return value

State number.

virtual void setParameter (int num, const vec4 & value) const =0

Sets parameter value.

Arguments

  • int num - Parameter number.
  • const vec4 & value - Parameter value.

virtual vec4 getParameter (int num) const =0

Gets parameter value.

Arguments

  • int num - Parameter number.

Return value

Parameter value.

virtual void setParameterSlider (int num, float value) const =0

Sets slider parameter value.

Arguments

  • int num - Parameter number.
  • float value - Slider parameter value.

virtual float getParameterSlider (int num) const =0

Gets slider parameter value.

Arguments

  • int num - Parameter number.

Return value

Slider parameter value.

virtual int setParameterExpression (int num, const char * src) const =0

Sets expression parameter source.

Arguments

  • int num - Parameter number.
  • const char * src - expression parameter source.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual const char * getParameterExpression (int num) const =0

Gets expression parameter source.

Arguments

  • int num - Parameter number.

Return value

Exponential parameter source.

virtual void setParameterArray (int num, const Vector< vec4 > & values) const =0

Sets array parameter values.

Arguments

  • int num - Parameter number.
  • const Vector< vec4 > & values - Values array.

virtual void getParameterArray (int num, Vector< vec4 > & values) const =0

Gets array parameter values.

Arguments

  • int num - Parameter number.
  • Vector< vec4 > & values - Values array.

virtual int loadWorld (const XmlPtr & xml) const =0

Load a render state from the Xml.

Arguments

  • const XmlPtr & xml - Xml smart pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int saveWorld (const XmlPtr & xml) const =0

Save a render state into the Xml.

Arguments

  • const XmlPtr & xml - Xml smart pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int saveState (const StreamPtr & stream) const =0

Save a render state into the stream.

Arguments

  • const StreamPtr & stream - Stream smart pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int restoreState (const StreamPtr & stream) const =0

Restore a render state from the stream.

Arguments

  • const StreamPtr & stream - Stream smart pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

Unigine::Material::anonymous_22 Enumeration

DOWNSIZE_NONE = 0
DOWNSIZE_ALWAYS_SCALE
DOWNSIZE_ALWAYS_FILTER
DOWNSIZE_GREATER_SCALE
DOWNSIZE_GREATER_FILTER
DOWNSIZE_FORWARD_SCALE
DOWNSIZE_FORWARD_FILTER

Unigine::Material::anonymous_23 Enumeration

STATE_TOGGLE = 0
STATE_SWITCH

Unigine::Material::anonymous_24 Enumeration

TEXTURE_IMAGE = 0
TEXTURE_ALPHA_FADE
TEXTURE_ENVIRONMENT
TEXTURE_DEFERRED_DEPTH
TEXTURE_DEFERRED_COLOR
TEXTURE_DEFERRED_NORMAL
TEXTURE_DEFERRED_PARALLAX
TEXTURE_DEFERRED_OCCLUSION
TEXTURE_DEFERRED_LIGHT
TEXTURE_LIGHT_IMAGE
TEXTURE_LIGHT_COLOR
TEXTURE_LIGHT_DEPTH
TEXTURE_LIGHT_NOISE
TEXTURE_LIGHT_VCUBE
TEXTURE_REFLECTION_2D
TEXTURE_REFLECTION_CUBE
TEXTURE_DOWNSIZE
TEXTURE_PROCEDURAL
TEXTURE_FILTER

Unigine::Material::anonymous_25 Enumeration

PARAMETER_CONSTANT = 0
PARAMETER_COLOR
PARAMETER_SLIDER
PARAMETER_EXPRESSION
PARAMETER_ARRAY
Last update: 2017-07-03
Build: ()