Cocos2d-x  v4
Material Class Reference

Material. More...

Inherits Ref.

Inherited by Sprite3DMaterial.

Public Member Functions

std::string getName () const
 returns the material name
 
void setName (const std::string &name)
 sets the material name
 
Technique * getTechniqueByName (const std::string &name)
 Returns a Technique by its name. More...
 
Technique * getTechniqueByIndex (ssize_t index)
 Returns a Technique by index. More...
 
Technique * getTechnique () const
 Returns the Technique used by the Material.
 
const Vector< Technique * > & getTechniques () const
 Returns the list of Techniques.
 
ssize_t getTechniqueCount () const
 Returns the number of Techniques in the Material.
 
void addTechnique (Technique *technique)
 Adds a Technique into the Material.
 
void setTechnique (const std::string &techniqueName)
 Sets the current technique.
 
virtual Material * clone () const
 returns a clone (deep-copy) of the material
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Ref * autorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Static Public Member Functions

static Material * createWithFilename (const std::string &path)
 Creates a Material using the data from the Properties object defined at the specified URL, where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>" (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional). More...
 
static Material * createWithProgramState (backend::ProgramState *programState)
 Creates a Material with a GLProgramState. More...
 
static Material * createWithProperties (Properties *materialProperties)
 Creates a material from the specified properties object. More...
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

Member Function Documentation

◆ createWithFilename()

static Material* createWithFilename ( const std::string &  path)
static

Creates a Material using the data from the Properties object defined at the specified URL, where the URL is of the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>" (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional).

Parameters
urlThe URL pointing to the Properties object defining the material.
Returns
A new Material or NULL if there was an error.

◆ createWithProgramState()

static Material* createWithProgramState ( backend::ProgramState *  programState)
static

Creates a Material with a GLProgramState.

It will only contain one Technique and one Pass. Added in order to support legacy code.

◆ createWithProperties()

static Material* createWithProperties ( Properties *  materialProperties)
static

Creates a material from the specified properties object.

Parameters
materialPropertiesThe properties object defining the material (must have namespace equal to 'material').
Returns
A new Material.

◆ getTechniqueByName()

Technique* getTechniqueByName ( const std::string &  name)

Returns a Technique by its name.

returns nullptr if the Technique can't be found.

◆ getTechniqueByIndex()

Technique* getTechniqueByIndex ( ssize_t  index)

Returns a Technique by index.

returns nullptr if the index is invalid.


The documentation for this class was generated from the following file: