G2D.pdf

(79 KB) Pobierz
Revolution
2D Graphics Library (G2D)
Version 1.00
The contents in this document are highly
confidential and should be handled accordingly.
© 2006-2007 Nintendo
CONFIDENTIAL
RVL-06-0036-001-B
Released: October 22, 2007
Revolution 2D Graphics Library (G2D)
Revolution SDK
Confidential
These coded instructions, statements, and computer programs contain proprietary information of Nintendo
of America Inc. and/or Nintendo Company Ltd. and are protected by Federal copyright law. They may not be
disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written
consent of Nintendo.
RVL-06-0036-001-B
Released: October 22, 2007
2
© 2006-2007 Nintendo
CONFIDENTIAL
Revolution SDK
Revolution 2D Graphics Library (G2D)
Contents
Revision History .................................................................................................................................. 4
1 Overview....................................................................................................................................... 5
2 Functions ...................................................................................................................................... 7
3 Graphics Requirements................................................................................................................ 9
Code Examples
Code 2–1 G2D API ............................................................................................................................. 7
Figures
Figure 1–1 G2D API Overview............................................................................................................ 6
Figure 2–1 Example of G2DDrawLayer Functionality......................................................................... 8
Figure 3–1 Layout Restrictions ........................................................................................................... 9
© 2006-2007 Nintendo
CONFIDENTIAL
3
RVL-06-0036-001-B
Released: October 22, 2007
Revolution 2D Graphics Library (G2D)
Revolution SDK
Revision History
Version
1.00
Date
Revised
2006/03/01
Item
-
Description
First release by Nintendo of America Inc.
RVL-06-0036-001-B
Released: October 22, 2007
4
© 2006-2007 Nintendo
CONFIDENTIAL
Revolution SDK
Revolution 2D Graphics Library (G2D)
1
Overview
We provide the Revolution 2D Graphics API (G2D) in source code form. The main focus of the API is tile-
based 2D games. The API includes the following features:
Supports multiple independently-scrollable layers of tiles
Supports layers of different sizes (that is, layer width and height values can be any power of 2 up to the
limitations of RAM)
Allows a different tile size for each layer (i.e., tile width and height can be 16, 32, 64, 128, 256, 512, or
1024)
Layers may be wrapped or non-wrapped independently
Tiles within a single layer can be chosen from multiple source textures (but they must be of a fixed
size)
Supports all normal texture formats, as well as tiles using only color or empty tiles which are not ren-
dered
Supports rotation with “free” antialiasing, provided that tiles are designed with a border color restriction
(see "3
Graphics Requirements"
on page 9)
Supports alpha blending
Supports two formats for map data—either 1 byte per index or 2 bytes per index
Allows viewport to be specified
Optimizes display performance by determining the visible tiles intersecting the viewport, sorting by tile
type and rendering with a minimal amount of state-flipping in the graphics pipeline
"Figure
1–1 G2D API Overview"
on page 6 shows an overview of the relationships in the API. The diagram
is a little complicated but it summarizes the entire structure of a layer.
A layer is composed of a grid of tiles (that is, an array of tile indices). A layer can use either 8-bit indices or
16-bit indices depending on the total number of distinct tiles used in the layer.
The tile index references a Tile Descriptor Table. This table stores a material index for each tile, and other
data associated with the tile.
The material index references a Material Descriptor Table, which stores the category of the material and
the address of the source data (texture map or color lookup table) for tiles using that material. When ren-
dering, the API sorts tiles by material index so that all tiles with the same material index located within the
viewport are rendered together. Textured materials can have an optional material color, in which case the
material color is modulated by the texture data to produce the final output color at each pixel.
For efficiency, all width and height values in this API are restricted to powers of 2. This includes tile sizes,
texture map sizes, layer sizes and world space size. This improves texture cache coherency by ensuring
that layers will wrap properly with respect to world coordinates.
© 2006-2007 Nintendo
CONFIDENTIAL
5
RVL-06-0036-001-B
Released: October 22, 2007
Zgłoś jeśli naruszono regulamin