class FoxRenderer
package foxlite.renderer
Static variables
staticinitialized:Bool = false
The GL render context name FoxLite is running on, this can be: - OPENGL: Windows/Linux - WEBGL: Browsers - OPENGLES: Mobile, ES devices
staticmustRebuildDrawGroups:Bool = true
If true, all scenes must rebuild their draw groups. Draw groups are required for material and mesh drawing/sorting.
This is set whenever: - A material changes render priority - A mesh assigned a new material - A model has been added/removed from a scene - A model has changed visibility - A model assigned/changed its meshes - Or an Instanced Model was set from/to 0 instances
We can afford doing this per frame because the builder isn't that expensive, however it's better to keep it as static as possible in HScript for best performance.
staticcalculateMotionVectors:Bool = false
If enabled, motion vectors will be calculated for 3D objects.
Motion vectors are used for all sort of neat effects such as Motion Blur and Temporal Reprojection, plus some additional advanced rendering
Note that to output motion vector data you'll need a compatible shader with the respective flags enabled
This technique might require a bit more memory since previous transfomation matrices are stored in memory for each object.
staticdebugWireframe:Float = 0.0
If greater than 0, forces the renderer to render using GL.LINES with the specified width
Static methods
staticinlinegetContext():Context3D
Gets and updates the Context3D that can be used to do most OpenGL operations.
This contains a WebGLRenderContext, meaning things can be limited
staticgetSupportedExtensionsObject():Map<String, Dynamic>
Returns a Map containing the supported extensions for the OpenGL context.
It is different than gl.getSupportedExtensions() since most of the time, the extension object does not exist even if it's listed as supported.
This function returns the extensions that do exist in lime.
staticsetTarget(?target:FoxFramebuffer, side:FoxCubemapSide = 5):Void
Sets the target framebuffer where to render stuff to. Setting it to null unbinds the target.
Parameters:
side | If the target is a |
|---|
staticuseTexture(sampler:Int, texture:FoxTexture):Void
Binds a texture to a sampler texture unit in the current render state.
In reality, a cut-down version of this method is used to set textures to uniforms, but this is here if you need it.
Parameters:
sampler | The sampler texture unit |
|---|---|
texture | A FoxTexture |
staticuseMaterial(context:Context3D, material:FoxMaterial):Int
Prepares a material for the render state.
Returns:
The next sampler index available for a texture, useful if you want to add more textures to the render state afterwards.
staticdrawMesh(context:Context3D, mesh:FoxMesh, shader:FoxShader):Void
Renders a mesh, simple as that! Render pipeline must be set up for this.
staticdrawMeshInstanced(context:Context3D, mesh:FoxMesh, shader:FoxShader, count:Int, instanceData:FoxInstanceData):Void
Draws a mesh multiple times via instancing, useful for particles.
Note: For this, you need to supply extra data for each individual transform, aswell as using an instancing-compatible shader.
Note 2: Instancing operations only works in OpenGL 3.0+
staticenableAlphaBlending(context:Context3D):Void
Enables alpha blending without changing the color function
staticcreateTextureStorage(width:Int, height:Int, format:String = "rgba", type:String = "unsigned_byte"):Texture
A GPU texture that can be of any available format It can hold any sort of values, for deferred renderers and storage.
For a friendly list of available formats, check MDN's texImage2D() types.
It applies for standard OpenGL aswell, with the exception of WEBGL_.
staticcreateTextureCubemapStorage(size:Int, format:String = "rgba", type:String = "unsigned_byte"):CubeTexture
staticuploadFromGLSLProgram3D(program:Program3D, vertexSource:String, fragmentSource:String):Void
Uploads vertex and fragment sources for the GLSL program.
This is a cut-down copy of Program3D.uploadSources() to remove that annoying prefix and reduce memory usage/processing