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

Detailed Description

Interface to control VDP2 settings for the Sprite Layer (data from VDP1 framebuffer), such as Display priority and VDP2 color calculation)

#include <srl_vdp2.hpp>

Static Public Member Functions

static void ColorCalcOFF ()
 Turns VDP2 Color Calculation Off for Sprite Layer.
 
static void ColorCalcON ()
 Turns VDP2 Color Calculation on for Sprite Layer.
 
static void SetColorCondition (VDP2::ColorCondition Condition, SRL::VDP2::Priority TestValue)
 Set conditions under which VDP2 color calculation is performed on sprites based on their priority.
 
static void SetOpacity (Types::Fxp opacity, VDP2::SpriteBank bank=VDP2::SpriteBank::Bank0)
 Set the opacities that sprites can select from in CC regesters.
 
static void SetPriority (SRL::VDP2::Priority pr, VDP2::SpriteBank bank=VDP2::SpriteBank::Bank0)
 Set the priority Layers That sprites can select from in PR registers.
 

Member Function Documentation

◆ SetColorCondition()

static void SRL::VDP2::SpriteLayer::SetColorCondition ( VDP2::ColorCondition Condition,
SRL::VDP2::Priority TestValue )
inlinestatic

Set conditions under which VDP2 color calculation is performed on sprites based on their priority.

Sets up the condition that allows only select sprites to recieve Half Transparent color calculation with VDP2 layers. To make a sprite fully opaque, selectively turn color calculation off for it by assigning it to use a Priority Bank containing a priority layer that does not satisfy the Color Condition. The default VDP2 initialization uses ColorCondition::PriorityEquals Priority::Layer4, with SpriteBank0 set to Layer3 and SpriteBank1 set to Layer4. With this config RGB sprites recieve no color calculation, while Palette sprites only recieve color calculation when select priority from bank1

Parameters
ConditionThe type of condition that VDP2 Color Calculation will follow
TestValueThe Layer that a sprite's priority will be tested against in the condition

◆ SetOpacity()

static void SRL::VDP2::SpriteLayer::SetOpacity ( Types::Fxp opacity,
VDP2::SpriteBank bank = VDP2::SpriteBank::Bank0 )
inlinestatic

Set the opacities that sprites can select from in CC regesters.

This Function takes the opacity specified as a fixed point value and converts it to one of the 32 color calculation ratios that the system can use (value is floored to the nearest ratio). It then sets the ratio in the specified sprite cc register (cc register 0 if not specified)

Note
Color ratios only apply to highest priority pixels in frame
When Color Calc is ON, max opacity is ~(0.97). Fully opaque sprites must select with color condition
When ColorCalcMode is set to UseColorAddition, The Opacity levels are ignored and Color addition is applied to all sprites whose priority meets the color condition (see SpriteLayer::SetColorCondition() for details)
RGB sprites always use the opacity set in CC register[bank0]
Does NOT turn color calc ON or OFF for the Sprite Layer(use SpriteLayer::ColorCalcON,OFF())
available cc registers vary by Palette code config- default allows all 8 banks
Parameters
opacityFxp decimal value between 0.0 and 1.0 representing pixel opacity of the cc register
bank(optional) which of the 8 CC registers to Set the opacity in (defaults to 0)

◆ SetPriority()

static void SRL::VDP2::SpriteLayer::SetPriority ( SRL::VDP2::Priority pr,
VDP2::SpriteBank bank = VDP2::SpriteBank::Bank0 )
inlinestatic

Set the priority Layers That sprites can select from in PR registers.

This function sets one of the 8 priority registers that a Palette sprite can reference (default bank0)

Note
available registers vary by Palette code config- default can only pull from bank0 and bank1
RGB sprites always use the priority from bank0
During VDP2 init, priority bank0 and bank1 are initialized to Layer3 and Layer4 respectively
Changing these priorities will result in differing behavior for sprite color calculation (See SpriteLayer::SetColorCondition() for more details
Parameters
prenum VDP2::Priority Layer
bank(optional) enum VDP2::SpriteBank designating which priority bank to write to