Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
Material Class Reference

Material defines the apperance of the objects. More...

Inherits RenderState.

Inherited by Sprite3DMaterial.

Public Member Functions

std::string getName () const
 Gets the material name Material name.
 
var getName ()
 Gets the material name Material name.
 
local getName ()
 Gets the material name Material name.
 
void setName (const std::string &name)
 Sets the material name Material name.
 
var setName ( var name)
 Sets the material name Material name.
 
local setName ( local name)
 Sets the material name Material name.
 
TechniquegetTechniqueByName (const std::string &name)
 Gets a Technique by its name. More...
 
local getTechniqueByName ( local name)
 Gets a Technique by its name. More...
 
TechniquegetTechniqueByIndex (ssize_t index)
 Gets a Technique by index. More...
 
TechniquegetTechnique () const
 Gets the Technique used by the Material. More...
 
var getTechnique ()
 Gets the Technique used by the Material. More...
 
local getTechnique ()
 Gets the Technique used by the Material. More...
 
const Vector< Technique * > & getTechniques () const
 Gets the list of Techniques. More...
 
ssize_t getTechniqueCount () const
 Gets the number of Techniques in the Material. More...
 
var getTechniqueCount ()
 Gets the number of Techniques in the Material. More...
 
local getTechniqueCount ()
 Gets the number of Techniques in the Material. More...
 
void addTechnique (Technique *technique)
 Adds a Technique into the Material. More...
 
var addTechnique ( var technique)
 Adds a Technique into the Material. More...
 
local addTechnique ( local technique)
 Adds a Technique into the Material. More...
 
void setTechnique (const std::string &techniqueName)
 Sets the current technique. More...
 
var setTechnique ( var techniqueName)
 Sets the current technique. More...
 
local setTechnique ( local techniqueName)
 Sets the current technique. More...
 
virtual Materialclone () const
 Clone (deep-copy) of the material. More...
 
var clone ()
 Clone (deep-copy) of the material. More...
 
local clone ()
 Clone (deep-copy) of the material. More...
 
- Public Member Functions inherited from RenderState
std::string getName () const
 Get name Name.
 
void setTexture (Texture2D *texture)
 Texture that will use in the CC_Texture0 uniform. More...
 
Texture2DgetTexture () const
 Returns the texture that is going to be used for CC_Texture0. More...
 
void bind (Pass *pass)
 Binds the render state for this RenderState and any of its parents, top-down, for the given pass. More...
 
RenderStategetTopmost (RenderState *below)
 Returns the topmost RenderState in the hierarchy below the given RenderState. More...
 
var getTopmost ( var below)
 Returns the topmost RenderState in the hierarchy below the given RenderState. More...
 
local getTopmost ( local below)
 Returns the topmost RenderState in the hierarchy below the given RenderState. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
local retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor.
 

Static Public Member Functions

static MaterialcreateWithFilename (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...
 
local createWithFilename ( local 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 MaterialcreateWithGLStateProgram (GLProgramState *programState)
 Creates a Material with a GLProgramState. More...
 
var createWithGLStateProgram ( var programState)
 Creates a Material with a GLProgramState. More...
 
local createWithGLStateProgram ( local programState)
 Creates a Material with a GLProgramState. More...
 
static MaterialcreateWithProperties (Properties *materialProperties)
 Creates a material from the specified properties object. More...
 
local createWithProperties ( local materialProperties)
 Creates a material from the specified properties object. More...
 
- Static Public Member Functions inherited from RenderState
static void initialize ()
 Static initializer that is called during game startup.
 
static void finalize ()
 Static finalizer that is called during game shutdown.
 

Additional Inherited Members

- Public Types inherited from RenderState
enum  DepthFunction
 Defines the supported depth compare functions. More...
 
enum  CullFaceSide
 Defines culling criteria for front-facing, back-facing and both-side facets.
 
enum  FrontFace
 Defines the winding of vertices in faces that are considered front facing. More...
 
enum  StencilFunction
 Defines the supported stencil compare functions. More...
 
enum  StencilOperation
 Defines the supported stencil operations to perform. More...
 
- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 
bool _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 
local _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 

Detailed Description

Material defines the apperance of the objects.

It contains shaders, uniform values, and OpenGL states. Material can be create from files.

Member Function Documentation

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

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

var createWithFilename ( var  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).

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

local createWithFilename ( local  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).

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

static Material*
createWithGLStateProgram
( GLProgramState programState)
static

Creates a Material with a GLProgramState.

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

var createWithGLStateProgram ( var  programState)
static

Creates a Material with a GLProgramState.

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

local createWithGLStateProgram ( local  programState)
static

Creates a Material with a GLProgramState.

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

static Material*
createWithProperties
( Properties materialProperties)
static

Creates a material from the specified properties object.

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

var createWithProperties ( var  materialProperties)
static

Creates a material from the specified properties object.

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

local createWithProperties ( local  materialProperties)
static

Creates a material from the specified properties object.

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

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

Gets a Technique by its name.

Technique name. nullptr if the Technique can't be found.

var getTechniqueByName ( var  name)

Gets a Technique by its name.

Technique name. nullptr if the Technique can't be found.

local getTechniqueByName ( local  name)

Gets a Technique by its name.

Technique name. nullptr if the Technique can't be found.

Technique* getTechniqueByIndex ( ssize_t  index)

Gets a Technique by index.

technique index. nullptr if the index is invalid.

var getTechniqueByIndex ( var  index)

Gets a Technique by index.

technique index. nullptr if the index is invalid.

local getTechniqueByIndex ( local  index)

Gets a Technique by index.

technique index. nullptr if the index is invalid.

Technique* getTechnique ( ) const

Gets the Technique used by the Material.

Technique used by material.

var getTechnique ( )

Gets the Technique used by the Material.

Technique used by material.

local getTechnique ( )

Gets the Technique used by the Material.

Technique used by material.

const Vector<Technique*>
& getTechniques
( ) const

Gets the list of Techniques.

Technique list.

var getTechniques ( )

Gets the list of Techniques.

Technique list.

local getTechniques ( )

Gets the list of Techniques.

Technique list.

ssize_t getTechniqueCount ( ) const

Gets the number of Techniques in the Material.

Technique number.

var getTechniqueCount ( )

Gets the number of Techniques in the Material.

Technique number.

local getTechniqueCount ( )

Gets the number of Techniques in the Material.

Technique number.

void addTechnique ( Technique technique)

Adds a Technique into the Material.

Technique being added.

var addTechnique ( var  technique)

Adds a Technique into the Material.

Technique being added.

local addTechnique ( local  technique)

Adds a Technique into the Material.

Technique being added.

void setTechnique ( const std::string &  techniqueName)

Sets the current technique.

Technique name being current technique.

var setTechnique ( var  techniqueName)

Sets the current technique.

Technique name being current technique.

local setTechnique ( local  techniqueName)

Sets the current technique.

Technique name being current technique.

virtual Material* clone ( ) const
virtual

Clone (deep-copy) of the material.

Copy of material.

Reimplemented in Sprite3DMaterial.

var clone ( )
virtual

Clone (deep-copy) of the material.

Copy of material.

Reimplemented in Sprite3DMaterial.

local clone ( )
virtual

Clone (deep-copy) of the material.

Copy of material.

Reimplemented in Sprite3DMaterial.


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