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 CathodeRetroclass.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
graphicsDevicemust extend past the lifetime of the CathodeRetro instance being created. sigType-
Type:
SignalTypeThe type of signal that to emulate (for instance,
CompositeorSVideo). inputWidth-
Type:
uint32_tThe width of the input texture that
Renderwill be provided. inputHeight-
Type:
uint32_tThe height of the input texture that
Renderwill 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
sigTypeis 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:
SignalTypeThe type of signal to emulate (for instance,
CompositeorSVideo). inputWidth-
Type:
uint32_tThe width of the input texture that
Renderwill be provided. inputHeight-
Type:
uint32_tThe height of the input texture that
Renderwill 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
sigTypeis 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
Rendermethod.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
Renderis 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:
ScanlineTypeThe 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 *deviceType
IGraphicsDevice *Description
Pointer to the graphics device that this instance of the CathodeRetroclass should use. This is the same device that was supplied to the constructor. - signalType
-
SignalType signalTypeType
SignalTypeDescription
The type of input signal that is being emulated. - cachedSourceSettings
-
SourceSettings cachedSourceSettingsType
SourceSettingsDescription
A cached copy of the source settings provided via the constructor or a call to UpdateSourceSettings. Used byUpdateSourceSettingsto detect if the source settings are being changed (and, thus, internal objects and textures need to be rebuilt). - cachedArtifactSettings
-
ArtifactSettings cachedArtifactSettingsType
ArtifactSettingsDescription
A cached copy of the artifact settings supplied by the last call to UpdateSettings. Used byUpdateSourceSettingsto updatesignalGenerator's settings if it is rebuilt. - cachedKnobSettings
-
TVKnobSettings cachedKnobSettingsType
TVKnobSettingsDescription
A cached copy of the TV knob settings supplied by the last call to UpdateSettings. Used byUpdateSourceSettingsto updatesignalDecoder's settings if it is rebuilt. - cachedOverscanSettings
-
OverscanSettings cachedOverscanSettingsType
OverscanSettingsDescription
A cached copy of the overscan settings supplied by the last call to UpdateSettings. Used byUpdateSourceSettingsto updatergbToCRT's settings if it is rebuilt. - cachedScreenSettings
-
ScreenSettings cachedScreenSettingsType
ScreenSettingsDescription
A cached copy of the screen settings supplied by the last call to UpdateSettings. Used byUpdateSourceSettingsto updatergbToCRT's settings if it is rebuilt. - inWidth
-
uint32_t inWidth = 0Type
uint32_tDescription
The expected width of the input texture supplied to the Rendermethod. - inHeight
-
uint32_t inHeight = 0Type
uint32_tDescription
The expected height of the input texture supplied to the Rendermethod. - outWidth
-
uint32_t outWidth = 0Type
uint32_tDescription
The expected width of the output texture supplied to the Rendermethod. - outHeight
-
uint32_t outHeight = 0Type
uint32_tDescription
The expected height of the output texture supplied to the Rendermethod. - signalGenerator
-
std::unique_ptr<Internal:: SignalGenerator> signalGenerator Type
std::unique_ptr< Internal:: SignalGenerator >Description
If
signalTypeis notSignalType::, this contains an instance of anRGB Internal::used to convert the input image into the emulated signal scanlines.SignalGenerator If
signalTypeisSignalType::, this will beRGB null. - signalDecoder
-
std::unique_ptr<Internal:: SignalDecoder> signalDecoder Type
std::unique_ptr< Internal:: SignalDecoder >Description
If
signalTypeis notSignalType::, this contains an instance of anRGB Internal::used to decode the emulated scanlines that are generated bySignalDecoder signalGeneratorinto an RGB texture.If
signalTypeisSignalType::, 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 currentFrameInputRGBparameter to theRendermethod or the output fromsignalDecoder) and apply the CRT emulation pass to it to get the output of the entire rendering process.