CathodeRetro::CathodeRetro
The main class that handles the whole Cathode Retro pipeline.
At creation time it is supplied a pointer to an IGraphicsDevice
instance, which it will
subsequently use to do the actual rendering.
See Using the Main CathodeRetro Class for information on how to use this class.
Public Members
Public Methods
Public Methods
- (constructor)
-
CathodeRetro( IGraphicsDevice *graphicsDevice, SignalType sigType, uint32_t inputWidth, uint32_t inputHeight, const SourceSettings &sourceSettings)
Description
Construct a new instance of the CathodeRetro
class.Parameters
graphicsDevice
-
Type:
IGraphicsDevice *
Pointer to the graphics device instance that this instance should use for all of its drawing-related functionality. This pointer will be cached so the lifetime of
graphicsDevice
must extend past the lifetime of the CathodeRetro instance being created. sigType
-
Type:
SignalType
The type of signal that to emulate (for instance,
Composite
orSVideo
). inputWidth
-
Type:
uint32_t
The width of the input texture that
Render
will be provided. inputHeight
-
Type:
uint32_t
The height of the input texture that
Render
will be provided. sourceSettings
-
Type:
const SourceSettings &
A description of the properties of the hypothetical source "machine" that is generating the composite or S-Video signal that should be emulated (if
sigType
is not set toSignalType::
).RGB
- UpdateSourceSettings
-
void UpdateSourceSettings( SignalType sigType, uint32_t inputWidth, uint32_t inputHeight, const SourceSettings &sourceSettings)
Description
Update the source signal properties.
Call this whenever the input signal type changes (signal type, timings, or input dimensions). These changes require internal textures and other objects to be potentially reallocated, so care should be taken when updating these settings.
Parameters
sigType
-
Type:
SignalType
The type of signal to emulate (for instance,
Composite
orSVideo
). inputWidth
-
Type:
uint32_t
The width of the input texture that
Render
will be provided. inputHeight
-
Type:
uint32_t
The height of the input texture that
Render
will be provided. sourceSettings
-
Type:
const SourceSettings &
A description of the properties of the hypothetical source "machine" that is generating the composite or S-Video signal that should be emulated (if
sigType
is not set toSignalType::
).RGB
- UpdateSettings
-
void UpdateSettings( const ArtifactSettings &artifactSettings, const TVKnobSettings &knobSettings, const OverscanSettings &overscanSettings, const ScreenSettings &screenSettings)
Description
Updates the various generator/decoder/screen emulation settings used by Cathode Retro.
Call this to change any settings other than the ones specified by
UpdateSourceSettings
. No reallocations or texture re-creations will occur here, so it is fine to update these parameters per-frame.Parameters
artifactSettings
-
Type:
const ArtifactSettings &
The new artifact settings used in the signal generation process.
knobSettings
-
Type:
const TVKnobSettings &
The new TV knob settings used in the signal decode process.
overscanSettings
-
Type:
const OverscanSettings &
The new overscan settings used in the CRT emulation process.
screenSettings
-
Type:
const ScreenSettings &
The new screen settings used in the CRT emulation process.
- SetOutputSize
-
void SetOutputSize( uint32_t outputWidth, uint32_t outputHeight)
Description
Update the expected size of the output texture that will be supplied to the
Render
method.These changes require internal textures to be potentially reallocated, so care should be taken when updating these settings.
This must be called at least once before
Render
is called.Parameters
- Render
-
void Render( const ITexture *currentFrameRGBInput, IRenderTarget *outputTexture, ScanlineType scanType)
Description
Performs the actual rendering of the Cathode Retro effect.
Parameters
currentFrameRGBInput
-
Type:
const ITexture *
The RGB or RGBA input texture. Must have dimensions that match those supplied to the constructor or
UpdateSourceSettings
. outputTexture
-
Type:
IRenderTarget *
The RGB or RGBA output texture. Must have dimensions that mtach those supplied to
SetOutputSize
. scanType
-
Type:
ScanlineType
The type of scanline (even or odd) that this frame will render. This should alternate between even and odd for interlacing, or stay even or odd in "progressive" modes.
Private Members
Private Fields
Private Fields
- device
-
IGraphicsDevice *device
Type
IGraphicsDevice *
Description
Pointer to the graphics device that this instance of the CathodeRetro
class should use. This is the same device that was supplied to the constructor. - signalType
-
SignalType signalType
Type
SignalType
Description
The type of input signal that is being emulated. - cachedSourceSettings
-
SourceSettings cachedSourceSettings
Type
SourceSettings
Description
A cached copy of the source settings provided via the constructor or a call to UpdateSourceSettings
. Used byUpdateSourceSettings
to detect if the source settings are being changed (and, thus, internal objects and textures need to be rebuilt). - cachedArtifactSettings
-
ArtifactSettings cachedArtifactSettings
Type
ArtifactSettings
Description
A cached copy of the artifact settings supplied by the last call to UpdateSettings
. Used byUpdateSourceSettings
to updatesignalGenerator
's settings if it is rebuilt. - cachedKnobSettings
-
TVKnobSettings cachedKnobSettings
Type
TVKnobSettings
Description
A cached copy of the TV knob settings supplied by the last call to UpdateSettings
. Used byUpdateSourceSettings
to updatesignalDecoder
's settings if it is rebuilt. - cachedOverscanSettings
-
OverscanSettings cachedOverscanSettings
Type
OverscanSettings
Description
A cached copy of the overscan settings supplied by the last call to UpdateSettings
. Used byUpdateSourceSettings
to updatergbToCRT
's settings if it is rebuilt. - cachedScreenSettings
-
ScreenSettings cachedScreenSettings
Type
ScreenSettings
Description
A cached copy of the screen settings supplied by the last call to UpdateSettings
. Used byUpdateSourceSettings
to updatergbToCRT
's settings if it is rebuilt. - inWidth
-
uint32_t inWidth = 0
Type
uint32_t
Description
The expected width of the input texture supplied to the Render
method. - inHeight
-
uint32_t inHeight = 0
Type
uint32_t
Description
The expected height of the input texture supplied to the Render
method. - outWidth
-
uint32_t outWidth = 0
Type
uint32_t
Description
The expected width of the output texture supplied to the Render
method. - outHeight
-
uint32_t outHeight = 0
Type
uint32_t
Description
The expected height of the output texture supplied to the Render
method. - signalGenerator
-
std::
unique_ptr<Internal:: SignalGenerator> signalGenerator Type
std::
unique_ptr< Internal:: SignalGenerator >Description
If
signalType
is notSignalType::
, this contains an instance of anRGB Internal::
used to convert the input image into the emulated signal scanlines.SignalGenerator If
signalType
isSignalType::
, this will beRGB null
. - signalDecoder
-
std::
unique_ptr<Internal:: SignalDecoder> signalDecoder Type
std::
unique_ptr< Internal:: SignalDecoder >Description
If
signalType
is notSignalType::
, this contains an instance of anRGB Internal::
used to decode the emulated scanlines that are generated bySignalDecoder signalGenerator
into an RGB texture.If
signalType
isSignalType::
, this will beRGB null
. - rgbToCRT
-
std::
unique_ptr<Internal:: RGBToCRT> rgbToCRT Type
std::
unique_ptr< Internal:: RGBToCRT >Description
This contains an instance of an Internal::
that is used to take an RGB image (either supplied via theRGBToCRT currentFrameInputRGB
parameter to theRender
method or the output fromsignalDecoder
) and apply the CRT emulation pass to it to get the output of the entire rendering process.