Xgraph

From Bennu Wiki
Revision as of 09:48, 12 March 2012 by 82.74.128.190 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Up to Local Variables


Definition

The predefined local variable xgraph is assigned to each process. It is the so called "extended" graphic, and it allows graphics to be displayed that are controlled by the nearest process Angle. When the xgraph is defined, the normal variable Graph is ignored, and the graphic used for display is determined by the angle.

So when the angle changes, a different graphic is selected from a table (defined as an Array). The standard value of xgraph is 0, so normally it isn't used unless it is explicitly specified. Xgraps are usefull in combination with Mode7, to create graphics with perspectives. This mechanism is similair to how Wolfenstein3D, Doom and Duke Nukem 3D render their sprites. So it's not true 3d, but just a bunch of sprites wich perspective depends on the viewing angle.

How to use it

First, you'll have to make sprites for all intended perspective's. To more angle's you wish, the more perspectives you'll need.

Second, you must place the graphics in order of their angle, in clockwise fashion.


Third, you'll have to make a table with the graphic codes.

GLOBAL

perspective_table[]=4,10,11,12,13; // the length doesn't matter, but the more perspectives you wish, 
                                   // the more graphics you need to have.


Fourth, you'll have to assing the table offset to the xgraph.

xgraph=&perspective_table; // xgraph get's the offset adress of the array.

The Offset operator is get's the adress of the data, this is related to pointers.

Remarks

When xgraph is defined, it has to be set to 0 in order to deactivate it.

When a graphic code in the table has a negative number, this graphic will be mirrored horizontally.



Local variables
AngleBigbroC_numberCtypeFatherFileFlagsGraphHeightIdPriorityRegionReservedResolutionSizeSize_xSize_ySmallbroSonXXgraphYZ