Constructor
new RenderAPI()
Web technologies allow Canvas and WebGL rendering
Members
Methods
applyStateBlock(stateBlock)
Apply the given state block
Parameters:
Name | Type | Description |
---|---|---|
stateBlock |
StateBlock | A StateBlock instance |
bindFrameBuffer(framebufferID)
Bind the given framebuffer
Parameters:
Name | Type | Description |
---|---|---|
framebufferID |
number | An identifier, -1 to bind the default frame buffer |
bindTexture(slot, texture)
Bind texture to the the given slot
Parameters:
Name | Type | Description |
---|---|---|
slot |
number | Targeted slot's index |
texture |
TextureInterface | A Texture instance |
bindTextureCube(slot, texture)
Bind texture cube to the the given slot
Parameters:
Name | Type | Description |
---|---|---|
slot |
number | Targeted slot's index |
texture |
TextureCube | A TextureCube instance |
clear(color)
Clear the rendering target
Parameters:
Name | Type | Description |
---|---|---|
color |
Color | A Color instance |
createFrameBuffer() → {number}
Create a new frame buffer
An identifier to work with it later
number
drawIndexedPrimitives(drawingMode, firstVertexIndex, vertexCount)
Draw indexed primitives
Parameters:
Name | Type | Description |
---|---|---|
drawingMode |
DrawingMode | Drawing mode to use |
firstVertexIndex |
number | Index of the first vertex to draw, useful to draw some parts |
vertexCount |
number | Vertex count to draw |
drawPrimitives(drawingMode, firstVertexIndex, vertexCount)
Draw primitives
Parameters:
Name | Type | Description |
---|---|---|
drawingMode |
DrawingMode | Drawing mode to use |
firstVertexIndex |
number | Index of the first vertex to draw, useful to draw some parts |
vertexCount |
number | Vertex count to draw |
initFrameBuffer(framebufferID, textures, useDepthBufferopt, useStencilBufferopt)
Init frame buffer: attach it to textures, depth buffer and/or a stencil buffer
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
framebufferID |
number | Targeted slot's index | ||
textures |
Array.<Texture> | An array of Texture instances | ||
useDepthBuffer |
boolean |
<optional> |
true | True to use a depth buffer |
useStencilBuffer |
boolean |
<optional> |
false | True to use a depth buffer |
setActiveCamera(camera)
Set camera to use
Parameters:
Name | Type | Description |
---|---|---|
camera |
Camera | A Camera instance |
setBlendMode(blendMode)
Set blend mode to apply
Parameters:
Name | Type | Description |
---|---|---|
blendMode |
BlendMode | A BlendMode instance |
setDepthState(depthTest, writeTest, depthFunction)
Set depth state
Parameters:
Name | Type | Description |
---|---|---|
depthTest |
boolean | True to activate depth testing, otherwise false |
writeTest |
boolean | True to activate depth writing otherwise false |
depthFunction |
DepthFunction | Depth function to apply |
setFaceCulling(mode)
Set face culling state.
Parameters:
Name | Type | Description |
---|---|---|
mode |
FaceCulling | Face culling mode to set. |
setGeometry(geometry)
Set geometry to use
Parameters:
Name | Type | Description |
---|---|---|
geometry |
Geometry | A Geometry instance |
setIndexBuffer(buffer)
Set index buffer to use
Parameters:
Name | Type | Description |
---|---|---|
buffer |
number | WebGLBuffer | A buffer instance |
setProgram(program) → {number}
Set program to use
Parameters:
Name | Type | Description |
---|---|---|
program |
Program | A Program instance to use |
-1: an error occured, 0: everything is ok, 2 : program have been changed
number
setScissorTest(state, x, y, w, h)
Set scissor test state
Parameters:
Name | Type | Description |
---|---|---|
state |
boolean | True to activate scissor testing, otherwise false |
x |
number | Position on x from the left of the screen |
y |
number | Position on y from the bottom of the screen |
w |
number | Width of the rectangle |
h |
number | Height of the rectangle |
setStencilFunction(stencilFunction, reference, mask)
Set stencil function to use
Parameters:
Name | Type | Description |
---|---|---|
stencilFunction |
StencilFunction | Function to use |
reference |
number | Reference value |
mask |
number | Mask to use |
setStencilOperations(sFail, dpFail, dppPass)
Set stencil operations to use
Parameters:
Name | Type | Description |
---|---|---|
sFail |
StencilOperation | Function to use |
dpFail |
StencilOperation | Reference value |
dppPass |
StencilOperation | Mask to use |
setStencilState(activate, writeMask)
Set stencil test state
Parameters:
Name | Type | Description |
---|---|---|
activate |
boolean | True to active stencil testing, otherwise false |
writeMask |
number | Stencil writing value |
setUniform(program, name, type, value, groupCountopt) → {boolean}
Set uniform value
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
program |
Program | A Program instance to use | |
name |
string | Uniform's name | |
type |
Type | Type of value to send | |
value |
?Array.<number> | Texture | boolean | number | Float32Array | A value | |
groupCount |
number |
<optional> |
When an element is an array, you can create group (like sub-array) |
True if uniform has been set successfully, otherwise false
boolean
setVertexBuffer(stream, buffer)
Set vertex buffer to use
Warning: You must call "setVertexFormat" before!
Parameters:
Name | Type | Description |
---|---|---|
stream |
number | An integer representing stream to use |
buffer |
number | WebGLBuffer | A buffer instance |
setVertexFormat(format)
Set vertex format to use
Parameters:
Name | Type | Description |
---|---|---|
format |
VertexFormat | A VertexFormat instance |