Difference between revisions of "Darwinbots3/Module/Graphics.Core"
(New page: '''Graphics.Core''' is an interface module which allows other modules to draw without understanding the different APIs involved. == Selecting a graphics module == Depending on the platfor...) |
(No difference)
|
Revision as of 03:02, 15 June 2009
Graphics.Core is an interface module which allows other modules to draw without understanding the different APIs involved.
Contents
Selecting a graphics module
Depending on the platform (windows, XBox, etc.) different graphics APIs might be used. Often, there is a choice between multiple different APIs. The GraphicsAdapterManager singleton searches through the current executing assembly for graphics modules which can be used. The current executing directory is also searched for binaries of the form "Graphics*.dll", and any graphics modules found in them are extracted.
GraphicsAdapaterManager.Modules is an IEnumberable<string> containing the names of all the available modules. Select one from the list and set the current adapter with a call to GraphicsAdapterManager.Singleton.SetCurrentModule(moduleName);
DrawPrimitive
A DrawPrimitive is all the information necessary to draw a shape in a body's local space. It contains all the information about transformations, vertices, colors, draw order, style, and color. Plus obviously what sort of shape it is.
The DrawPrimitive is the most basic form for all graphics.
Collages
A collage is a collection of draw primitives. A collage defines a template for drawing a compound shape.
Adding DrawPrimitives to a collage can be done manually. However the preferred use is to use the collage as an object which knows how to add primitives to itself. By setting the Color and Style properties, the collage can act as a sort of immediate mode smart drawing canvas.
Collage Ref
Collages are templates for drawing compound shapes. In order to actually draw the collage, you must initialize a CollageRef.
Entity
An entity represents an actual drawable object. It combines a CollageRef with a world transform.
Cel
As in animation cel. A cel can contain multiple entities. In order to keep the draw orders sane, draw order only affects the draw order in a cel. Once a cel has been drawn, the draw order buffer is wiped clean so that the next cel can be drawn. It helps to think of a cel as a piece of cellophane on which entities are painted according to their draw order. Just like in an animation studio, multiple cels can make up a final scene (for instance, a background cel, a foreground cel, and a character cel can all be drawn).
DrawQueue
A draw queue holds the different cels to be drawn, and orders them appropriately.
WindowHandle
A window handle represents an actual drawable surface somewhere on screen. By submitting the draw queue to be drawn, graphics can be put on to the screen.