SaturnRingLibrary 0.6
SGL wrapper
 
Loading...
Searching...
No Matches
SRL::VDP2::RBG0 Class Reference

Detailed Description

RBG0 interface.

#include <srl_vdp2.hpp>

Inheritance diagram for SRL::VDP2::RBG0:
SRL::VDP2::ScrollScreen< RBG0, scnRBG0, RBG0ON >

Static Public Member Functions

static void * GetCellAddress ()
 Gets the starting address in VRAM of Cel data allocated to this scroll.
 
static uint32_t GetCellOffset (SRL::Tilemap::TilemapInfo &tile, void *cellAddress)
 Compute the offset that must be added to map data When Corresponding Cel Data does not start on a VRAM bank boundary.
 
static void * GetMapAddress ()
 Gets the starting address in VRAM of Map data allocated to this scroll.
 
static void * GetPageAddress (uint8_t index)
 returns the VRAM Address of the specified page number in a scroll's Page Table or nullptr if the requested page is outside of allocated Map Bounds
 
static uint32_t GetPalOffset (int8_t paletteID=-1)
 Gets the Pallet Bank That must be included in Map Data to Reference a Palette in CRAM.
 
static void * GetPlaneAddress (uint8_t index)
 Gets the VRAM Address of the specified plane in a scroll's Page Table (units of 1x1, 2x1, or 2x2 pages)
 
static void Init (SRL::Tilemap::TilemapInfo &info)
 Initializes the ScrollScreen's tilemap specifications.
 
static void LoadTilemap (SRL::Tilemap::ITilemap &tilemap)
 Loads Tilemap data to VRAM using ITilemap Interface and configures the Scroll Screen to use it.
 
static void ScrollDisable ()
 Removes the Scroll Screen from VDP2 cycle pattern register to disable display.
 
static void ScrollEnable ()
 Registers Scroll in VDP2 cycle pattern to enable display of this Scroll Screen.
 
static void * SetCellAddress (void *address, int size)
 Manually Sets VRAM area for Cell Data (Advanced Use Cases)
 
static void SetCurrentTransform ()
 Writes the current matrix transform to RBG0RA Rotation parameters to update its position and perspective.
 
static void * SetMapAddress (void *Address, int Size)
 Manually Sets VRAM area for Map Data (Advanced Use Cases)
 
static void SetMapLayout (uint8_t a, uint8_t b, uint8_t c, uint8_t d)
 Manually set the Plane layout of a Scroll Screen.
 
static void SetOpacity (Types::Fxp opacity=1.0)
 Set the opacity of a scroll screen.
 
static void SetPlanes (void *a, void *b, void *c, void *d)
 Sets the plane of Tilemap Data to be displayed.
 
static void SetPriority (SRL::VDP2::Priority pr)
 Set the Display Priority of a Scroll Screen.
 
static void SetRotationMode (VDP2::RotationMode mode, bool vblank=true)
 Select what type of rotation to use for the rotating scroll (Call before Loading RBG0)
 

Static Public Attributes

static void * CellAddress
 VRAM Address to start of Cell data when displying Tilemap or Bitmap data when using bitmaps.
 
static int CellAllocSize
 
static Tilemap::TilemapInfo Info
 Tilemap config info for the ScrollScreen.
 
static void * KtableAddress = (void*)(VDP2_VRAM_A0 - 1)
 VRAM Address of RBG0 Coefficient table.
 
static void * MapAddress
 VRAM Address of ScrollScreen's Map data when displaying Tilemap.
 
static int MapAllocSize
 Size of manually allocated VRAM for Map Data.
 
static constexpr int16_t ScreenID
 SGL identifier for the ScrollScreen.
 
static constexpr uint16_t ScreenON
 SGL flag for the ScrollScreen.
 
static CRAM::Palette TilePalette
 CRAM Pallet for the ScrollScreen.
 

Member Function Documentation

◆ GetCellAddress()

static void * SRL::VDP2::ScrollScreen< RBG0 , Id, On >::GetCellAddress ( )
inlinestaticinherited

Gets the starting address in VRAM of Cel data allocated to this scroll.

Returns
Address of Cel data
Note
Returns starting address of bitmap when displaying Bitmap Scroll

◆ GetCellOffset()

static uint32_t SRL::VDP2::ScrollScreen< RBG0 , Id, On >::GetCellOffset ( SRL::Tilemap::TilemapInfo & tile,
void * cellAddress )
inlinestaticinherited

Compute the offset that must be added to map data When Corresponding Cel Data does not start on a VRAM bank boundary.

Parameters
tileThe data configuration of the tilemap
cellAddressAddress of corresponding Cel Data in VRAM (must be a 32 byte boundary)
Returns
The Cel Offset to add to to map data

◆ GetMapAddress()

static void * SRL::VDP2::ScrollScreen< RBG0 , Id, On >::GetMapAddress ( )
inlinestaticinherited

Gets the starting address in VRAM of Map data allocated to this scroll.

Returns
Address of Map data

◆ GetPageAddress()

static void * SRL::VDP2::ScrollScreen< RBG0 , Id, On >::GetPageAddress ( uint8_t index)
inlinestaticinherited

returns the VRAM Address of the specified page number in a scroll's Page Table or nullptr if the requested page is outside of allocated Map Bounds

Parameters
indexThe index of desired page in the page table
Returns
VRAM Address of the page index

◆ GetPalOffset()

static uint32_t SRL::VDP2::ScrollScreen< RBG0 , Id, On >::GetPalOffset ( int8_t paletteID = -1)
inlinestaticinherited

Gets the Pallet Bank That must be included in Map Data to Reference a Palette in CRAM.

Parameters
paletteID(optional) specify to reference an arbitrary palette, otherwise uses Id from ScrollScreen::TilePalette
Returns
The Formatted Palette ID to be included in Map Indicies to reference a specified palette

◆ GetPlaneAddress()

static void * SRL::VDP2::ScrollScreen< RBG0 , Id, On >::GetPlaneAddress ( uint8_t index)
inlinestaticinherited

Gets the VRAM Address of the specified plane in a scroll's Page Table (units of 1x1, 2x1, or 2x2 pages)

Parameters
indexThe index of desired plane in page table
Returns
VRAM Address of the plane index
Note
PlaneAddress and PageAddress are equal when Plane Size is set to 1x1

◆ Init()

static void SRL::VDP2::RBG0::Init ( SRL::Tilemap::TilemapInfo & info)
inlinestatic

Initializes the ScrollScreen's tilemap specifications.

Parameters
infoTile map info

◆ LoadTilemap()

static void SRL::VDP2::ScrollScreen< RBG0 , Id, On >::LoadTilemap ( SRL::Tilemap::ITilemap & tilemap)
inlinestaticinherited

Loads Tilemap data to VRAM using ITilemap Interface and configures the Scroll Screen to use it.

If VRAM for this ScrollScreen's data has already been allocated by the user, SRL will attempt to load to the allocated VRAM and raise assert if the Tilemap Data does not fit within the existing allocation. If VRAM was not allocated SRL will attempt to auto allocate the Tilemap data and raise assert if there is not enough VRAM available to allocate.

Parameters
tilemapThe Tilemap to load
Note
Manual VRAM allocation is for advanced use cases as is NOT verified for proper bank alignment
Does not turn Scroll Display on- once loaded use ScrollEnable() to display a Scroll Screen
It is recommended to perform loading/allocation for RBG0 before NBG0-3 screens if using it

◆ ScrollDisable()

static void SRL::VDP2::ScrollScreen< RBG0 , Id, On >::ScrollDisable ( )
inlinestaticinherited

Removes the Scroll Screen from VDP2 cycle pattern register to disable display.

Asserts when registration of a scroll fails due to cycle pattern conflicts. Possible causes: Assert should never occur here unless the user independently invoked SGL's slScrAutoDisp() with specifications differing from those tracked by SRL

◆ ScrollEnable()

static void SRL::VDP2::ScrollScreen< RBG0 , Id, On >::ScrollEnable ( )
inlinestaticinherited

Registers Scroll in VDP2 cycle pattern to enable display of this Scroll Screen.

Asserts when registration of a scroll fails due to cycle pattern conflicts. Possible causes: -Too many Scroll Layers with higher bit depth are storing data in the same VRAM bank -NBG0 or NBG1 have their minimum scale limit set too small(eg 1/2x or 1/4x scale) -NBG Data was stored in a bank reserved by RBG0 Potential conflicts are minimized when using Automatic Allocation and setting the desired scale limits of NBG0/NBG1 beforehand.

◆ SetCellAddress()

static void * SRL::VDP2::ScrollScreen< RBG0 , Id, On >::SetCellAddress ( void * address,
int size )
inlinestaticinherited

Manually Sets VRAM area for Cell Data (Advanced Use Cases)

This function manually sets an area in VRAM for a scrolls Cel Data to be loaded to. Unless the Address is obtained from VDP2::VRAM::Allocate(), the VRAM allocator will be bypassed entirely. No Checks are performed for proper data allignment or cycle conflicts. For advanced use cases only.

//Manually Set NBG0 to store 16bpp Cel Data in an 0x8000 byte region allocated in VRAM bank A1:
SRL::VDP2::NBG0::SetCelAddress(SRL::VDP2::VRAM::Allocate(0x8000,32,SRL::VDP2::VramBank::A1, 3),0x8000);
static void * Allocate(uint32_t size, uint32_t boundary, VDP2::VramBank bank, uint8_t cycles=0)
Linearly Allocates Vram in a bank.
Definition srl_vdp2.hpp:93
Parameters
addressthe VRAM address of the allocation
sizethe size of the allocation
Returns
Echoes Address

◆ SetMapAddress()

static void * SRL::VDP2::ScrollScreen< RBG0 , Id, On >::SetMapAddress ( void * Address,
int Size )
inlinestaticinherited

Manually Sets VRAM area for Map Data (Advanced Use Cases)

This function manually sets an area in VRAM for a scroll's Map Data to be loaded to. Unless the Address is obtained from VDP2::VRAM::Allocate() the VRAM allocator will be bypassed entirely. No Checks are performed for proper data alignment or cycle conflicts. For advanced use cases only.

//Manually Set NBG0 to store Map Data in an 0x8000 byte region allocated in VRAM bank A1:
SRL::VDP2::NBG0::SetMapAddress(SRL::VDP2::VRAM::Allocate(0x8000,1024,SRL::VDP2::VramBank::A1, 1),0x8000);
static void * SetMapAddress(void *Address, int Size)
Manually Sets VRAM area for Map Data (Advanced Use Cases)
Definition srl_vdp2.hpp:407
Parameters
Addressthe VRAM address of the allocation
Sizethe size of the allocation
Returns
Echoes Address

◆ SetMapLayout()

static void SRL::VDP2::ScrollScreen< RBG0 , Id, On >::SetMapLayout ( uint8_t a,
uint8_t b,
uint8_t c,
uint8_t d )
inlinestaticinherited

Manually set the Plane layout of a Scroll Screen.

This function manually sets the 4 planes comprising a NBG scroll screen in cases when the default plane tiling pattern is not desired.

Parameters
a,b,c,dthe plane indicies of the 4 planes that will display in the normal scroll
Note
RBG0 does not currently support multi plane patterns, so only plane [a] will be used

◆ SetOpacity()

static void SRL::VDP2::ScrollScreen< RBG0 , Id, On >::SetOpacity ( Types::Fxp opacity = 1.0)
inlinestaticinherited

Set the opacity of a scroll screen.

This Function takes the opacity specified as a fixed point value and converts it to one of the 32 color calculation ratios that a scroll screen can use (value is floored to the nearest ratio). Color Calculation is turned on if Opacity < 1.0, or off if Opacity>= 1.0. Color calculation is unchanged if value is negative.

Note
Color ratios only apply to highest priority pixels in frame
When ColorCalcMode is set to UseColorAddition, all scrolls with opacity < 1.0 will use color addition in place of their specified ratios.
Parameters
opacityFxp decimal value between 0.0 and 1.0 representing pixel opacity for the scroll screen (Default 1.0)

◆ SetPlanes()

static void SRL::VDP2::RBG0::SetPlanes ( void * a,
void * b,
void * c,
void * d )
inlinestatic

Sets the plane of Tilemap Data to be displayed.

Parameters
a,b,c,dPage Table addresses of the planes to display
Note
Multi Plane Maps are not supported yet for RBG0, only plane a is used

◆ SetPriority()

static void SRL::VDP2::ScrollScreen< RBG0 , Id, On >::SetPriority ( SRL::VDP2::Priority pr)
inlinestaticinherited

Set the Display Priority of a Scroll Screen.

Note
Higher value layers display on top of lower layers
When 2 or more scroll screens are assigned the same layer, their priority resolves as SPRITE>RBG0>NBG0>NBG1>NBG2>NBG3
Parameters
prThe Priority Layer for the Scroll Screen

◆ SetRotationMode()

static void SRL::VDP2::RBG0::SetRotationMode ( VDP2::RotationMode mode,
bool vblank = true )
inlinestatic

Select what type of rotation to use for the rotating scroll (Call before Loading RBG0)

Parameters
modeThe RotationMode to use for this scroll
vblankChose to update VRAM at VBLANK to reduce amount of coefficient data required for rotation of a plane (default = true)
Note
when 2 or 3 axis rotation is Selected, VRAM will be allocated to store necessary coefficient data. If Vblank is set false, all coefficients will be statically stored in VRAM as a 0x18000 byte table. If Vblank is set true, only the coefficients necessary for the current frame will be dynamically written to VRAM at Vblank, reducing required VRAM footprint to 0x2000 bytes per rotation parameter.

Member Data Documentation

◆ CellAllocSize

int SRL::VDP2::ScrollScreen< RBG0 , Id, On >::CellAllocSize
inlinestaticinherited

Size of manually allocated VRAM for Cel Data