-
Notifications
You must be signed in to change notification settings - Fork 1
RendererAbstract
Alexander Orzechowski edited this page Oct 20, 2015
·
2 revisions
The Tessellator.RendererAbstract
is a renderer that cannot be used itself to render anything but a object that uses Tessellator.extend()
to add functionality to the RendererAbstract
###Constructor
-
RendererAbstract(void)
This will create a standaloneRendererAbstract
that is ready for its.setShader()
function to be called with a valid shader otherwise nothing will render if it be used.
-
RendererAbstract(shader)
will create a RendererAbstract object that will use the passed shader when rendering.
###Functions
-
.setShader(Tessellator.Program shader)
This will set the current shader of the renderer. If the shader's tessellator object does not match the renderer's tessellator, a exception will be thrown. The.tessellator
object will be set with the shader's Tessellator and the.shader
object will be set with the shader passed.
Note: Setting the shader while the renderer is rendering may lead to the application having some issues.
-
.render(<optional>Tessellator.RenderMatrix matrix, <optional>arg)
The shader will render with the supped matrix. If there is no matrix, one is created. The arg argument will simply be passed to the main rendering function as extra information for the renderer to interpret.
NOTE: if the matrix value is populated then it is assumed that the render is rendering off of another renderer. In that case.preRender()
and.postRender()
will not be called.
-
.setUniformSetter(function setter)
This will set a custom function that will be called whenever theTessellator.RenderMatrix
object that belongs to the shader needs it's default values set.
-
.init(Tessellator.RenderMatrix matrix, <optional>arg)
this will initialize the renderer. It will return true if this renderer is ready to render and false if it is not ready. Returns: boolean
-
.configure(Tessellator.RenderMatrix matrix)
This is called when the passed matrix needs it's default values set. If there is a uniformSetter set by the.setUniformSetter()
function, then that will be called.
-
.preRender()
This will be called before the renderer renders.
-
.postRender()
This will be called when the renderer has finished rendering.
-
.renderRaw(Tessellator.RenderMatrix matrix, <optional>arg)
This is the function that does all the heavy lifting. Everything that the renderer is supposed to render should be called form this function.
NOTE: this function will only be called when the program is sure that the renderer is ready to render via the.init()
function.
NOTE: this function needs to be extended by its subclasses. If not, an exception is thrown.
NOTE: the arg object can be anything. It is only a argument that is supposed to assist in rendering. It is up to the subclass to define whether this argument should be set to a value or not.
###Uniforms
-
window
A vec2 that represents the resolution of the rendering target. - INHERITER:
Tessellator.Program.UNIFY_WINDOW
. This inheriter adds the call toWenGLRenderingContext.viewport()
to notify WebGL of the rendering target.
-
time
A float that increments one unit per second that is 0 at creation of the renderer.
-
source
Tessellator-
renderers
RendererAbstract
ModelRenderer
BufferedRenderer FullScreenRenderer -
shaders
Shader
Program
RenderMatrix -
geometry
Object
-