123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- #ifndef RENDERER_HH
- #define RENDERER_HH
- #include "VRAMObserver.hh"
- #include "openmsx.hh"
- #include <cstdint>
- namespace openmsx {
- class PostProcessor;
- class DisplayMode;
- class RawFrame;
- /** Abstract base class for Renderers.
- * A Renderer is a class that converts VDP state to visual
- * information (for example, pixels on a screen).
- *
- * The update methods are called exactly before the change occurs in
- * the VDP, so that the renderer can update itself to the specified
- * time using the old settings.
- */
- class Renderer : public VRAMObserver
- {
- public:
- virtual ~Renderer() = default;
- /** See VDP::getPostProcessor. */
- virtual PostProcessor* getPostProcessor() const = 0;
- /** Reinitialise Renderer state.
- */
- virtual void reInit() = 0;
- /** Signals the start of a new frame.
- * The Renderer can use this to get fixed-per-frame settings from
- * the VDP, such as PAL/NTSC timing.
- * @param time The moment in emulated time the frame starts.
- */
- virtual void frameStart(EmuTime::param time) = 0;
- /** Signals the end of a frame.
- * @param time The moment in emulated time the frame ends.
- * Note: this is the same time stamp as the start of the next frame.
- */
- virtual void frameEnd(EmuTime::param time) = 0;
- /** Informs the renderer of a VDP transparency enable/disable change.
- * @param enabled The new transparency state.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateTransparency(bool enabled, EmuTime::param time) = 0;
- /** Informs the renderer of a VDP superimposing change.
- * @param videoSource Video that should be superimposed, nullptr if none.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateSuperimposing(const RawFrame* videoSource,
- EmuTime::param time) = 0;
- /** Informs the renderer of a VDP foreground color change.
- * @param color The new foreground color.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateForegroundColor(int color, EmuTime::param time) = 0;
- /** Informs the renderer of a VDP background color change.
- * @param color The new background color.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateBackgroundColor(int color, EmuTime::param time) = 0;
- /** Informs the renderer of a VDP blink foreground color change.
- * @param color The new blink foreground color.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateBlinkForegroundColor(int color, EmuTime::param time) = 0;
- /** Informs the renderer of a VDP blink background color change.
- * @param color The new blink background color.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateBlinkBackgroundColor(int color, EmuTime::param time) = 0;
- /** Informs the renderer of a VDP blinking state change.
- * @param enabled The new blink state.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateBlinkState(bool enabled, EmuTime::param time) = 0;
- /** Informs the renderer of a VDP palette change.
- * @param index The index [0..15] in the palette that changes.
- * @param grb The new definition for the changed palette index:
- * bit 10..8 is green, bit 6..4 is red and bit 2..0 is blue;
- * all other bits are zero.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updatePalette(int index, int grb, EmuTime::param time) = 0;
- /** Informs the renderer of a vertical scroll change.
- * @param scroll The new scroll value.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateVerticalScroll(int scroll, EmuTime::param time) = 0;
- /** Informs the renderer of a horizontal scroll change:
- * the lower scroll value has changed.
- * @param scroll The new scroll value.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateHorizontalScrollLow(byte scroll, EmuTime::param time) = 0;
- /** Informs the renderer of a horizontal scroll change:
- * the higher scroll value has changed.
- * @param scroll The new scroll value.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateHorizontalScrollHigh(byte scroll, EmuTime::param time) = 0;
- /** Informs the renderer of a horizontal scroll change:
- * the border mask has been enabled/disabled.
- * @param masked true iff enabled.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateBorderMask(bool masked, EmuTime::param time) = 0;
- /** Informs the renderer of a horizontal scroll change:
- * the multi page setting has changed.
- * @param multiPage The new multi page flag.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateMultiPage(bool multiPage, EmuTime::param time) = 0;
- /** Informs the renderer of a horizontal adjust change.
- * Note that there is no similar method for vertical adjust updates,
- * because vertical adjust is calculated at start of frame and
- * then fixed.
- * @param adjust The new adjust value.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateHorizontalAdjust(int adjust, EmuTime::param time) = 0;
- /** Informs the renderer of a VDP display enabled change.
- * Both the regular border start/end and forced blanking by clearing
- * the display enable bit are considered display enabled changes.
- * @param enabled The new display enabled state.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateDisplayEnabled(bool enabled, EmuTime::param time) = 0;
- /** Informs the renderer of a VDP display mode change.
- * @param mode The new display mode.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateDisplayMode(DisplayMode mode, EmuTime::param time) = 0;
- /** Informs the renderer of a name table base address change.
- * @param addr The new base address.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateNameBase(int addr, EmuTime::param time) = 0;
- /** Informs the renderer of a pattern table base address change.
- * @param addr The new base address.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updatePatternBase(int addr, EmuTime::param time) = 0;
- /** Informs the renderer of a color table base address change.
- * @param addr The new base address.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateColorBase(int addr, EmuTime::param time) = 0;
- /** Informs the renderer of a VDP sprites enabled change.
- * @param enabled The new sprites enabled state.
- * @param time The moment in emulated time this change occurs.
- */
- virtual void updateSpritesEnabled(bool enabled, EmuTime::param time) = 0;
- /** Sprite palette in Graphic 7 mode.
- * Each palette entry is a word in GRB format:
- * bit 10..8 is green, bit 6..4 is red and bit 2..0 is blue.
- */
- static const uint16_t GRAPHIC7_SPRITE_PALETTE[16];
- protected:
- Renderer() = default;
- };
- } // namespace openmsx
- #endif
|