[ Back to Geeks3D.com ]
 GeeXLab
Laboratory for Real Time 3D Programming (prototyping and demos) OpenGL, Lua, Python, GLSL, PhysX and more...Reference Guide Host-API Lua / Python
» Back to Homepage
» Back to Developer's Guide Index
HYP_Material Library
Material library
Number of functions: 36
HYP_Material.Create
Creates a new material object.
: Lua - Python
matId [INTEGER]: material identifier
:
matId = HYP_Material.Create()
HYP_Material.Destroy
Destroys an existing material object.
: Lua - Python
matId [INTEGER]: material identifier
:
HYP_Material.Destroy(matId)
HYP_Material.ApplyToRenderer
Applies material properties to the renderer. This function is useful with render to texture or in direct rendering scripts.
: Lua - Python
matId [INTEGER]: material identifier
:
HYP_Material.ApplyToRenderer(matId)
HYP_Material.GetNumMaterials
Returns the total number of materials created. All materials are stored in a global list.
: Lua - Python
n [INTEGER]: number of materials
:
n = HYP_Material.GetNumMaterials()
HYP_Material.GetIdByIndex
Returns a material based on its index in the materials list.
: Lua - Python
index [INTEGER]: material index. - Values = [0 ; GetNumMaterials()-1]
matId [INTEGER]: material identifier
:
matId = HYP_Material.GetIdByIndex(0)
HYP_Material.GetNameByIndex
Returns material's name based on its index in the materials list.
: Lua - Python
index [INTEGER]: material index. - Values = [0 ; GetNumMaterials()-1]
name [STRING]: material name
:
name = HYP_Material.GetNameByIndex(0)
HYP_Material.GetId
Returns material identifier from its name.
: Lua - Python
name [STRING]: material name
matId [INTEGER]: material identifier
:
matId = HYP_Material.GetId(name)
HYP_Material.GetName
Returns material name from its id.
: Lua - Python
matId [INTEGER]: material identifier
name [STRING]: material name
:
name = HYP_Material.GetName(matId)
HYP_Material.SetName
Sets material name.
: Lua - Python
matId [INTEGER]: material identifier
name [STRING]: material name
:
HYP_Material.SetName(matId, name)
HYP_Material.SetRenderState
Sets the render state of the material. If this state is set to 0, objects that use this material will not be rendered.
: Lua - Python
matId [INTEGER]: material identifier
state [INTEGER]: render state
:
HYP_Material.SetRenderState(matId, 0)
HYP_Material.GetRenderState
Gets the render state.
: Lua - Python
matId [INTEGER]: material identifier
state [INTEGER]: render state
:
state = HYP_Material.GetRenderState(matId)
HYP_Material.SetTexturingState
Sets the texturing state. If the state is set to 0, texture mapping is disabled for all objects that use this material.
: Lua - Python
matId [INTEGER]: material identifier
state [INTEGER]: texturing state
:
HYP_Material.SetTexturingState(matId, 0)
HYP_Material.GetTexturingState
Gets the texturing state.
: Lua - Python
matId [INTEGER]: material identifier
state [INTEGER]: texturing state
:
state = HYP_Material.GetTexturingState(matId)
HYP_Material.GetNumberOfTextures
Returns the number of textures attached to a material.
: Lua - Python
matId [INTEGER]: material identifier
numTextures [INTEGER]: number of textures.
:
n = HYP_Material.GetNumberOfTextures(matId)
HYP_Material.KillAllTextures
Removes and destroys all textures attached to a material.
: Lua - Python
matId [INTEGER]: material identifier
:
HYP_Material.KillAllTextures(matId)
HYP_Material.RemoveAllTextures
Removes all textures attached to a material. The textures are not destroyed.
: Lua - Python
matId [INTEGER]: material identifier
:
HYP_Material.RemoveAllTextures(matId)
HYP_Material.AddTexture
Adds a texture to a material. A material can have an unlimited number of textures (multitexturing) but the number of textures used during the rendering is limited by the graphics hardware.
: Lua - Python
matId [INTEGER]: material identifier
textureId [INTEGER]: texture identifier
textureUnit [INTEGER]: texture unit where the texture is attached.
:
HYP_Material.AddTexture(matId, textureId01)
HYP_Material.AddTexture(matId, textureId02)
HYP_Material.SetTexture
Modifies an existing material's texture.
: Lua - Python
matId [INTEGER]: material identifier
textureId [INTEGER]: texture identifier
textureUnit [INTEGER]: texture unit where the texture is attached. - Values = [0 ; (GetNumberOfTextures()-1)]
:
HYP_Material.SetTexture(matId, textureId01, 0)
HYP_Material.SetTexture(matId, textureId02, 1)
HYP_Material.RemoveTexture
Removes a texture from a material.
: Lua - Python
matId [INTEGER]: material identifier
textureUnit [INTEGER]: texture unit - Values = [0 ; (GetNumberOfTextures()-1)] />
matId [INTEGER]: material identifier
textureUnit [INTEGER]: texture unit where the texture is attached. - Values = [0 ; (GetNumberOfTextures()-1)]
textureId [INTEGER]: texture identifier
:
textureId = HYP_Material.GetTextureId(matId, textureUnit)
HYP_Material.SetShaderProgram
(DEPRECATED - Use SetGpuProgram instead) Sets the shader program (or gpu shader) that will be enabled when the material will be used.
: Lua - Python
matId [INTEGER]: material identifier
shaderId [INTEGER]: GPU shader program identifier.
:
HYP_Material.SetShaderProgram(matId, shaderId)
HYP_Material.SetShaderProgramForAmbientPass
(DEPRECATED - Use SetGpuProgramForAmbientPass instead) Sets the shader program (or gpu shader) that will be enabled when the material will be used. This shader will be used in shadow ambient pass only.
: Lua - Python
matId [INTEGER]: material identifier
shaderId [INTEGER]: GPU shader program identifier.
:
HYP_Material.SetShaderProgramForAmbientPass(matId, shaderId)
HYP_Material.SetGpuProgram
Sets the gpu program that will be enabled when the material will be used.
: Lua - Python
matId [INTEGER]: material identifier
gpuProgramId [INTEGER]: GPU program identifier.
:
HYP_Material.SetGpuProgram(matId, gpuProgramId)
HYP_Material.SetGpuProgramForAmbientPass
Sets the gpu program that will be enabled when the material will be used. This gpu program will be used in shadow ambient pass only.
: Lua - Python
matId [INTEGER]: material identifier
shaderId [INTEGER]: GPU program identifier.
:
HYP_Material.SetGpuProgramForAmbientPass(matId, gpuProgramId)
HYP_Material.SetAmbient
Sets material's ambient reflexion coefficients.
: Lua - Python
matId [INTEGER]: material identifier
r, g, b, a [REAL]: RGBA reflexion coefficients.
:
HYP_Material.SetAmbient(matId, 0.2, 0.2, 0.2, 1.0)
HYP_Material.GetAmbient
Gets material's ambient reflexion coefficients.
: Lua - Python
matId [INTEGER]: material identifier
r, g, b, a [REAL]: RGBA reflexion coefficients.
:
r, g, b, a = HYP_Material.GetAmbient(matId)
HYP_Material.SetDiffuse
Sets material's diffuse reflexion coefficients.
: Lua - Python
matId [INTEGER]: material identifier
r, g, b, a [REAL]: RGBA reflexion coefficients.
:
HYP_Material.SetDiffuse(matId, 0.2, 0.2, 0.2, 1.0)
HYP_Material.GetDiffuse
Gets material's diffuse reflexion coefficients.
: Lua - Python
matId [INTEGER]: material identifier
r, g, b, a [REAL]: RGBA reflexion coefficients.
:
r, g, b, a = HYP_Material.GetDiffuse(matId)
HYP_Material.SetSpecular
Sets material's specular reflexion coefficients.
: Lua - Python
matId [INTEGER]: material identifier
r, g, b, a [REAL]: RGBA reflexion coefficients.
:
HYP_Material.SetSpecular(matId, 0.2, 0.2, 0.2, 1.0)
HYP_Material.GetSpecular
Gets material's specular reflexion coefficients.
: Lua - Python
matId [INTEGER]: material identifier
r, g, b, a [REAL]: RGBA reflexion coefficients.
:
r, g, b, a = HYP_Material.GetSpecular(matId)
HYP_Material.SetShininess
Sets material's specular power factor or shininess.
: Lua - Python
matId [INTEGER]: material identifier
shininess [REAL]: power factor.
:
shininess = 90.0
HYP_Material.SetShininess(matId, shininess)
HYP_Material.GetShininess
Gets material's specular power factor or shininess.
: Lua - Python
matId [INTEGER]: material identifier
shininess [REAL]: power factor.
:
shininess = HYP_Material.GetShininess(matId, shininess
HYP_Material.SetEmissive
Sets material's emissive color.
: Lua - Python
matId [INTEGER]: material identifier
r, g, b, a [REAL]: RGBA color.
:
HYP_Material.SetEmissive(matId, 0.8, 0.1, 0.1, 1.0)
HYP_Material.GetEmissive
Gets material's emissive color.
: Lua - Python
matId [INTEGER]: material identifier
r, g, b, a [REAL]: RGBA color.
:
r, g, b, a = HYP_Material.GetEmissive(matId)
HYP_Material.SetResilience
Sets material's change rebound coefficient. For PhysX.
: Lua - Python
matId [INTEGER]: material identifier
resilience [REAL]: resilience factor.
:
HYP_Material.SetResilience(matId, 0.5)
HYP_Material.SetStaticFriction
Sets material's static friction coefficient. For PhysX.
: Lua - Python
matId [INTEGER]: material identifier
friction [REAL]: friction factor.
:
HYP_Material.SetStaticFriction(matId, 0.2)
HYP_Material.SetDynamicFriction
Sets material's dynamic friction coefficient. For PhysX.
: Lua - Python
matId [INTEGER]: material identifier
friction [REAL]: friction factor.
:
HYP_Material.SetDynamicFriction(matId, 0.2)
|