Skip to content
yvt edited this page Aug 27, 2013 · 10 revisions

Rendering is done through an interface called spades::client::IRenderer.

How is it used to render a scene

  1. Setup a struct SceneDefinition and give it to BeginScene
  2. Add objects including:
  • Models
  • Dynamic Light
  • Debug Line
  1. Call EndScene to tell the renderer that we have nothing to add to the scene anymore
  2. Draw 2D images
  3. Call FrameDone.
  4. Call Flip. The renderer will transfer the rendered image to the screen.

GLRenderer Implementation

GLRenderer is an OpenGL 3.0 implementation of IRenderer and supports all required function. GLRenderer is currently the only implementation of IRenderer.

  • BeginScene just initializes the rendering
  • EndScene renders the scene in multiple passes:
    • Preparation
    • Shadow Maps Generation
    • Sun-light Pass
    • Dynamic Light Pass
    • Post-process
  • FrameDone flushes 2D rendering command buffer.
  • Flip calls Swap of the OpenGL device.

GL1Renderer Implementation

NOTE: This is not implemented. There are no plans to implement this. Just an idea.

GL1Renderer will be an OpenGL 1.x implementation of IRenderer and will support all required function.

CLRenderer Implementation

NOTE: This is not implemented. There are no plans to implement this. Just an idea.

CLRenderer will be a OpenCL implementation (like GPU-accelerated VOXLAP) of IRenderer and will support all required function.

SWRenderer Implementation

NOTE: This is not implemented. There are no plans to implement this. Just an idea.

SWRenderer will be a software implementation (like VOXLAP) of IRenderer and will support all required function.

SMP Renderer

When cg_smp is set to 1, multi-threaded rendering architecture is enabled. Client issues commands to AsyncRenderer, and AsyncRenderer sends the commands to IRenderer in a separate thread.

This architecture is similar to cg_smp of id Software's Quake 3.

Note that SMP renderer is unstable, difficult to trace errors, and there is some lag because of thread scheduling. Logging might not work correctly.

Future Extensions

CPU/GPU Ray-tracing renderer might be added (something like VOXLAP) in the future.