From FIFE development wiki
Revision as of 12:55, 21 March 2012 by Helios2000 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Document Data structures Data strucures
Concepts illustrated here are relevant to understand what kind of data FIFE engine is able to process.


FIFE has a bunch of different renderers for different cases. In the following I will try to explain what functions each renderer has and when to use them. But first a few basic things about FIFE. The coordinates for rendering must be counter clockwise and orientated on the top left corner.

So for a quad the order would be something like this:

Point(0,100) bottom left
Point(100,100) bottom right
Point(100,0) top right
Point(0,0) top left

Most renderers need a camera so a loaded map is needed. The exceptions are as only the OffRenderer and the TargetRenderer. These are also the only ones who can handle direct coordinates, the others need Instances or RendererNodes. Except for these two share all other the following API.

-returns a pointer to renderer
getInstance(Camera* camera)

-get current pipeline position

-change pipeline positon means that you can change the order of  which the renderers draw
renderer.setPipelinePosition(int32 position)

-enables(true) or disables(false) the renderer
renderer.setEnabled(bool enabled)

-returns a bool that indicates if the renderer is enabled(true) or disabled(false)

-adds active layer to renderer, only active layers are rendered!!!
renderer.addActiveLayer(Layer* layer)

-removes active layer from renderer
renderer.removeActiveLayer(Layer* layer)

-removes all active layers from renderer

-activates all layers from given map
renderer.activateAllLayers(Map* map)

returns a list that contain pointer to all active layers

Renderer Usage


The most important and mostly used renderer is the InstanceRenderer. The renderer is enabled by default, all loaded/created instances that have a visual are rendered with it. Additional you can use it to generate outlines or colorings for your instances. here it goes: InstanceRenderer


This is used to show you e.g. in editor, which instances on your map have blocking property. To visualize this the underlaying cell is framed. You can change the used color, more info here: BlockingInfoRenderer


Quite similar to the BlockingInfoRenderer. But you can select by your own, which cells to be framed. more info here: CellSelectionRenderer


The renderer is able to display LayerCoordinates on the map. You have to set a font which is then used to render the coordinates. more info here: CoordinateRenderer


As the name suggest the renderer is used to draw floating textes. So if you call instance.say() the text is rendered with it. You can set the font, define a background, more info here: FloatingTextRenderer


This one is able to draw all sorts of primitives, images and animations. It uses RendererNodes for positioning of elements. You can use it to render some special fx or other things. But note that the z ordering is not in harmony with the InstanceRenderer. If the same layer is used and the pipeline position is unchanged then the GenericRenderer draws on top of the InstanceRenderer. You can group different sorts of elements, more info here: GenericRenderer


Is used in editor to display the geometrie of the active layer/grid. Works not for an empty layer(without instances) because the layer need a size. So the minimum is to place edge instances. You can change the used color, more info here: GridRenderer


As you may probably already thought this renderer is used to draw lights. It uses the same RendererNodes as GenericRenderer to position them. You can use images, animations or simple lights(consisting of triangles to generate a shape effect), more info here: LightRenderer


This renderer should be used if no map is loaded. It can draw directly on the screen. It can be used to generate as example some sort of a intro. The API is pretty much the same as for the GenericRenderer but it will be used screen coordinates instead of RendererNodes, more info here: OffRenderer


With this you can render directly into an image. It uses OffRenderer elements so the API is the same, more info here: TargetRenderer