Provides a simple shading solution with a single global point light without falloff.
The DefaultRendering object will request the following shaders to the ShaderManager:
These are the effects supported by this renderer:
The following meta material properties are supported for the scene renderables:
Non-opaque material that will blend with the background. The renderable will be rendered back to front and will be ignored during lighting calculations. Materials using effects with alpha test enabled but without blending enabled do not need this flag.
Non-opaque material that will blend with the surface immediately below. The renderable will be ignored during lighting calculations. Materials using effects with alpha test enabled but without blending enabled do not need this flag.
The renderable will be rendered last if opaque or first if transparent and will be ignored during lighting calculations.
The following TechniqueParameters properties are supported for the scene renderables:
Array with 4 numbers providing the material color
Array of 6 numbers forming a 3x2 transformation matrix applied to the uv coordinates
Texture that will provide the diffuse color
Texture that will provide the specular color
Texture that will provide the per pixel normal
Texture that will provide the emissive color
Cubemap texture that will provide the skybox color
Texture that will provide the alpha component
The renderables are rendered in the following passes:
Required scripts
The DefaultRendering object requires:
/*{{ javascript("jslib/renderingcommon.js") }}*/
/*{{ javascript("jslib/defaultrendering.js") }}*/
Summary
Syntax
var renderer = DefaultRendering.create(graphicsDevice, mathDevice, shaderManager, effectManager);
Summary
Sets the position in world space of the global point light.
Syntax
var position = mathsDevice.v3Build(100, 500, 100);
renderer.setGlobalLightPosition(position);
Summary
Sets the color of the global point light.
Syntax
var color = mathDevice.v3Build(1.0, 1.0, 1.0);
renderer.setGlobalLightColor(color);
Summary
Sets the ambient color.
Syntax
var color = mathDevice.v3Build(0.2, 0.2, 0.3);
renderer.setAmbientColor(color);
Summary
Set the default texture to be used when a material does not provide one.
Syntax
var texture = textureManager.get('default');
renderer.setDefaultTexture(texture);
Summary
Enables or disables rendering of the scene as wireframe.
Syntax
var wireframeInfo = {
wireColor : mathDevice.v4Build(1, 1, 1, 1), //choose color for the wireframe lines
fillColor : mathDevice.v4Build(0, 0.2, 0.6, 0), //choose color for the interior of the polygons
alphaRef : 0 //set to greater than zero (e.g. 0.1) to remove the interior of the polygons (transparent fill)
};
renderer.setWireframe(true, wireframeInfo);
Note
For wireframeInfo.fillColor, leave alpha (the fourth value) as zero to allow transparent fill.
Summary
This method does nothing, it is provided for interface compatibility with other renderers.
Syntax
renderer.updateBuffers(graphicsDevice, width, height);
Summary
This method does nothing, it is provided for interface compatibility with other renderers.
Syntax
renderer.updateShader(shaderManager);
Summary
Updates light and material information to prepare for rendering.
Syntax
renderer.update(graphicsDevice, camera, scene, currentTime);
Call this function after the scene and the camera have been updated for the current frame.
Summary
Renders the scene.
Syntax
renderer.draw(graphicsDevice,
clearColor,
drawDecalsFn,
drawTransparentFn,
drawDebugFn);
The callback executed to draw extra visible decals, it can be set to null. For example:
function drawDecalsFn()
{
fxm.drawDecals(graphicsDevice);
}
The callback executed to draw extra visible transparent objects, it can be set to null. For example:
function drawTransparentFn()
{
fxm.drawTransparent(graphicsDevice);
}
The callback executed to allow the application draw any debugging information required, it can be set to null. For example:
function drawDebugFn()
{
scene.drawNodesExtents(graphicsDevice, camera);
}
Get the default size of the buffer used by skinning. This will be undefined until the shaders are loaded.
See also GPUSkinController.
For example:
GPUSkinController.setDefaultBufferSize(renderer.getDefaultSkinBufferSize());
Summary
Releases the DefaultRendering object and all the resources it allocated.
Syntax
renderer.destroy();
Summary
The version number of the DefaultRendering implementation.
Syntax
var versionNumber = DefaultRendering.version;
Summary
A dictionary of passes to passIndex used by DrawParameters to specify the pass they are rendered in.
Valid values are:
Syntax
drawParameters.userData.passIndex = renderer.passIndex.transparent;