NGLMaterial Class Reference
Inherits from | NSObject |
Conforms to | NGLMaterial |
Declared in | NGLMaterial.h |
Overview
The basic material definition to NinevehGL.
The NGLMaterial is an user friendly API to deal with OpenGL’s fragment shaders. Each material’s property represents a specific predefined behavior in the fragment shaders. Obviously you can define and construct custom shaders. The materials is just a simple way to deal with the most used and populars behaviors in the fragment shaders.
The actual version of NGLMaterial can deal with:
- Alpha and transparency;
- Ambient color and texture;
- Diffuse color and texture;
- Emissive color and texture;
- Shininess;
- Specular component;
- Bump effect;
- Reflection map.
Even using the materials (that is the default immutable NinevehGL’s behavior) you can create your shaders. The both shaders will be merged to form a new shader with unique behavior.
Tasks
-
name
The item’s name. This can also be used by identify this object.
property -
identifier
The identifier of this object.
property -
alpha
The alpha component in a range of (0.0, 1.0). The 0.0 means a fully transparent material and 1.0 indicates a fully opaque material.
property -
ambientColor
The material’s ambient color reflection. This property is taken by the shaders as reflection an ambient multi directional white light placed at the infinity, that means it will cover all the surface with the same color and intensity.
property -
diffuseColor
The material’s diffuse color reflection. This property suffers influence from the scene lights.
property -
emissiveColor
The material’s emissive color amount. This property simulates an emission of light from this material by adding an uniform glow effect on it.
property -
specularColor
The material’s specular color reflection. This property simulates the specular color and intensity from lights on this material.
property -
shininess
The shininess specifies the specular exponent, also known as glossiness. This defines the focus of the specular highlight. The value lies in a range of (0.0, 1000.0), the high exponent results in a tight reflective light, a concentrated highlight, low exponent results in large and spread reflection.
property -
reflectiveLevel
The reflective level attenuates the reflective map. The value lies in a range of (0.0, 1.0), where 0 means no reflection and 1 means full reflection. The default value is 0.5.
property -
refraction
The refraction property indicates the index of refraction to this object.
property -
alphaMap
The alpha defined by a texture map. To achieve more precision, the map should be constructed with grey scale only, where a full white represents the fully opaque areas and full black represents the fully transparent areas.
property -
ambientMap
Defines the material’s ambient color reflection by a texture map.
property -
diffuseMap
Defines the material’s diffuse color reflection by a texture map.
property -
emissiveMap
Defines the material’s emissive color amount by a texture map.
property -
specularMap
Defines the material’s specular color reflection by a texture map.
property -
shininessMap
Defines the shininess by a texture map. To achieve more precision, the map should be constructed with grey scale only, where the full white represents the value of 1000 and full black represents the 0.
property -
bumpMap
Defines the bump effect by a texture map. By default the bump map should be constructed with a normal map with the tangent space colors.
property -
reflectiveMap
Defines the reflection of the material by a texture map. All the reflection maps will be treated as an enviroment spherical map.
property -
values
(Internal only) Returns a pointer to the material scalar values. You should not call this method directly.
property -
+ material
Returns an autorelease instance of NGLMaterial.
-
+ materialBrass
Returns the brass material.
-
+ materialBronze
Returns the bronze material.
-
+ materialCooper
Returns the cooper material.
-
+ materialGold
Returns the gold material.
-
+ materialSilver
Returns the silver material.
-
+ materialChrome
Returns the chrome material.
-
+ materialPewter
Returns the pewter material.
-
+ materialEmerald
Returns the emerald material.
-
+ materialJade
Returns the jade material.
-
+ materialObsidian
Returns the obsidian material.
-
+ materialRuby
Returns the ruby material.
-
+ materialTurqoise
Returns the turqoise material.
Properties
alpha
The alpha component in a range of (0.0, 1.0). The 0.0 means a fully transparent material and 1.0 indicates a fully opaque material.
@property (nonatomic) float alpha
Discussion
The alpha component in a range of (0.0, 1.0). The 0.0 means a fully transparent material and 1.0 indicates a fully opaque material.
Declared In
NGLMaterial.h
alphaMap
The alpha defined by a texture map. To achieve more precision, the map should be constructed with grey scale only, where a full white represents the fully opaque areas and full black represents the fully transparent areas.
@property (nonatomic, retain) NGLTexture *alphaMap
Discussion
The alpha defined by a texture map. To achieve more precision, the map should be constructed with grey scale only, where a full white represents the fully opaque areas and full black represents the fully transparent areas.
The texture coordinates (UV Map) of the mesh will be used to place the map on the mesh.
Declared In
NGLMaterial.h
ambientColor
The material’s ambient color reflection. This property is taken by the shaders as reflection an ambient multi directional white light placed at the infinity, that means it will cover all the surface with the same color and intensity.
@property (nonatomic) NGLvec4 ambientColor
Discussion
The material’s ambient color reflection. This property is taken by the shaders as reflection an ambient multi directional white light placed at the infinity, that means it will cover all the surface with the same color and intensity.
The color is given by NGLvec4 data type with a range of (0.0, 1.0).
You can use the nglColorMake()
static function to make sure the values
will be clamped to that range.
Declared In
NGLMaterial.h
ambientMap
Defines the material’s ambient color reflection by a texture map.
@property (nonatomic, retain) NGLTexture *ambientMap
Discussion
Defines the material’s ambient color reflection by a texture map.
The texture coordinates (UV Map) of the mesh will be used to place the map on the mesh.
Declared In
NGLMaterial.h
bumpMap
Defines the bump effect by a texture map. By default the bump map should be constructed with a normal map with the tangent space colors.
@property (nonatomic, retain) NGLTexture *bumpMap
Discussion
Defines the bump effect by a texture map. By default the bump map should be constructed with a normal map with the tangent space colors.
For more information about this kind of texture map, check out:
- Photoshop Plugin by NVIDIA;
- PixPlant App;
- Photoshop tutorial to create normal maps with no plugins;
- Tutorial about normal map concept.
The texture coordinates (UV Map) of the mesh will be used to place the map on the mesh.
Declared In
NGLMaterial.h
diffuseColor
The material’s diffuse color reflection. This property suffers influence from the scene lights.
@property (nonatomic) NGLvec4 diffuseColor
Discussion
The material’s diffuse color reflection. This property suffers influence from the scene lights.
The color is given by NGLvec4 data type with a range of (0.0, 1.0).
You can use the nglColorMake()
static function to make sure the values
will be clamped to that range.
Declared In
NGLMaterial.h
diffuseMap
Defines the material’s diffuse color reflection by a texture map.
@property (nonatomic, retain) NGLTexture *diffuseMap
Discussion
Defines the material’s diffuse color reflection by a texture map.
The texture coordinates (UV Map) of the mesh will be used to place the map on the mesh.
Declared In
NGLMaterial.h
emissiveColor
The material’s emissive color amount. This property simulates an emission of light from this material by adding an uniform glow effect on it.
@property (nonatomic) NGLvec4 emissiveColor
Discussion
The material’s emissive color amount. This property simulates an emission of light from this material by adding an uniform glow effect on it.
The color is given by NGLvec4 data type with a range of (0.0, 1.0).
You can use the nglColorMake()
static function to make sure the values
will be clamped to that range.
Declared In
NGLMaterial.h
emissiveMap
Defines the material’s emissive color amount by a texture map.
@property (nonatomic, retain) NGLTexture *emissiveMap
Discussion
Defines the material’s emissive color amount by a texture map.
The texture coordinates (UV Map) of the mesh will be used to place the map on the mesh.
Declared In
NGLMaterial.h
identifier
The identifier of this object.
@property (nonatomic) unsigned int identifier
Discussion
The identifier of this object.
Declared In
NGLMaterial.h
name
The item’s name. This can also be used by identify this object.
@property (nonatomic, copy) NSString *name
Discussion
The item’s name. This can also be used by identify this object.
Declared In
NGLMaterial.h
reflectiveLevel
The reflective level attenuates the reflective map. The value lies in a range of (0.0, 1.0), where 0 means no reflection and 1 means full reflection. The default value is 0.5.
@property (nonatomic) float reflectiveLevel
Discussion
The reflective level attenuates the reflective map. The value lies in a range of (0.0, 1.0), where 0 means no reflection and 1 means full reflection. The default value is 0.5.
See Also
Declared In
NGLMaterial.h
reflectiveMap
Defines the reflection of the material by a texture map. All the reflection maps will be treated as an enviroment spherical map.
@property (nonatomic, retain) NGLTexture *reflectiveMap
Discussion
Defines the reflection of the material by a texture map. All the reflection maps will be treated as an enviroment spherical map.
Declared In
NGLMaterial.h
refraction
The refraction property indicates the index of refraction to this object.
@property (nonatomic) float refraction
Discussion
The refraction property indicates the index of refraction to this object.
The value lies in the range of (0.001, 10.0). The default is 1 and means that light doesn’t bend when pass through the object. A glass should have a value of 1.5. Values under 1 generate non real behaviors.
Declared In
NGLMaterial.h
shininess
The shininess specifies the specular exponent, also known as glossiness. This defines the focus of the specular highlight. The value lies in a range of (0.0, 1000.0), the high exponent results in a tight reflective light, a concentrated highlight, low exponent results in large and spread reflection.
@property (nonatomic) float shininess
Discussion
The shininess specifies the specular exponent, also known as glossiness. This defines the focus of the specular highlight. The value lies in a range of (0.0, 1000.0), the high exponent results in a tight reflective light, a concentrated highlight, low exponent results in large and spread reflection.
Declared In
NGLMaterial.h
shininessMap
Defines the shininess by a texture map. To achieve more precision, the map should be constructed with grey scale only, where the full white represents the value of 1000 and full black represents the 0.
@property (nonatomic, retain) NGLTexture *shininessMap
Discussion
Defines the shininess by a texture map. To achieve more precision, the map should be constructed with grey scale only, where the full white represents the value of 1000 and full black represents the 0.
The texture coordinates (UV Map) of the mesh will be used to place the map on the mesh.
Declared In
NGLMaterial.h
specularColor
The material’s specular color reflection. This property simulates the specular color and intensity from lights on this material.
@property (nonatomic) NGLvec4 specularColor
Discussion
The material’s specular color reflection. This property simulates the specular color and intensity from lights on this material.
The color is given by NGLvec4 data type with a range of (0.0, 1.0).
You can use the nglColorMake()
static function to make sure the values
will be clamped to that range.
Declared In
NGLMaterial.h
specularMap
Defines the material’s specular color reflection by a texture map.
@property (nonatomic, retain) NGLTexture *specularMap
Discussion
Defines the material’s specular color reflection by a texture map.
The texture coordinates (UV Map) of the mesh will be used to place the map on the mesh.
Declared In
NGLMaterial.h
values
(Internal only) Returns a pointer to the material scalar values. You should not call this method directly.
@property (nonatomic, readonly) NGLMaterialValues *values
Discussion
(Internal only) Returns a pointer to the material scalar values. You should not call this method directly.
Declared In
NGLMaterial.h
Class Methods
material
Returns an autorelease instance of NGLMaterial.
+ (id)material
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns an autorelease instance of NGLMaterial.
This material represents the default grey material, which will be automatically assigned to a mesh with no materials on it. This material is the same used by many 3D softwares like Maya, 3DS Max, LightWave, Modo and others. It’s also known as clay material.
Declared In
NGLMaterial.h
materialBrass
Returns the brass material.
+ (id)materialBrass
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns the brass material.
Declared In
NGLMaterial.h
materialBronze
Returns the bronze material.
+ (id)materialBronze
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns the bronze material.
Declared In
NGLMaterial.h
materialChrome
Returns the chrome material.
+ (id)materialChrome
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns the chrome material.
Declared In
NGLMaterial.h
materialCooper
Returns the cooper material.
+ (id)materialCooper
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns the cooper material.
Declared In
NGLMaterial.h
materialEmerald
Returns the emerald material.
+ (id)materialEmerald
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns the emerald material.
Declared In
NGLMaterial.h
materialGold
Returns the gold material.
+ (id)materialGold
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns the gold material.
Declared In
NGLMaterial.h
materialJade
Returns the jade material.
+ (id)materialJade
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns the jade material.
Declared In
NGLMaterial.h
materialObsidian
Returns the obsidian material.
+ (id)materialObsidian
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns the obsidian material.
Declared In
NGLMaterial.h
materialPewter
Returns the pewter material.
+ (id)materialPewter
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns the pewter material.
Declared In
NGLMaterial.h
materialRuby
Returns the ruby material.
+ (id)materialRuby
Return Value
A NGLMaterial autoreleased instance.
Discussion
Returns the ruby material.
Declared In
NGLMaterial.h