Commit 153cdbe5 authored by Kirinn's avatar Kirinn

Rendering stuff is now managed by Rendermatic

parent 679032bd
......@@ -177,7 +177,7 @@ begin
BoxHub.TextBoxer(tickcount);
// Update the screen.
Renderer;
Rendermatic.RenderEverything;
// Frame limiter... wait for it.
if sakuparam.frameDelay = 0 then begin
......
......@@ -554,7 +554,7 @@ begin
BoxHub.TextBoxer(tickcount);
// Update the screen.
Renderer;
Rendermatic.RenderEverything;
// Frame limiter... wait for it.
if sakuparam.frameDelay = 0 then begin
......
......@@ -275,6 +275,8 @@ end;
{$include sakuchoicematic-header.pas}
{$include sakurendermatic-header.pas}
// BGRA buffer for the full game window: windowSize.w * windowSize.h * 4
var mv_OutputBuffy : pointer;
// Another BGRA buffer of the same size. Some effects and transitions need a textboxless view of the game window, which is
......@@ -335,8 +337,6 @@ end;
// The dat-loader may need to resize the game window.
procedure SpawnWindow; forward;
{$endif}
// Visual transition helper.
procedure StashRender(viewnum : dword); forward;
// User input key poller, invoked from sakufiberwops.
function PollKey(keyval : byte) : longint; forward;
// Viewports need to refresh the screen if they receive a param change.
......
......@@ -564,7 +564,7 @@ begin
transitionStyle := style;
EffectHub.transitionActive := self.fxIndex;
StashRender(viewnum);
Rendermatic.StashRender(viewnum);
end;
procedure TEffectTransition.Update;
......
......@@ -17,7 +17,7 @@
{ along with SuperSakura. If not, see <https://www.gnu.org/licenses/>. }
{ }
// SuperSakura-con rendering functions.
// SuperSakura console-specific rendering functions.
// The Ascii Blitzer needs to run fast, so it has platform-specific code. Bear in mind SuperSakura does frequent full-screen
// transitions. On Windows only the WriteConsoleOutput command is fast enough; trying to write things one character at a time
......@@ -28,7 +28,7 @@
{$ifdef WINDOWS}
var asciiBuf : array of dword;
{$endif}
procedure BlitzAscii(x1, y1, x2, y2 : longint);
procedure TRendermatic.BlitzAscii(x1, y1, x2, y2 : longint);
var x, y : longint;
r, g, b, l : dword;
srcp : pointer;
......@@ -132,9 +132,9 @@ end;
// ------------------------------------------------------------------
{$include sakurender-all.pas}
{$include sakurendermatic-implementation.pas}
procedure Renderer;
procedure TRendermatic.RenderEverything;
// Handles all visual output into outputbuffy^.
var i : dword;
refreshed : boolean;
......@@ -161,7 +161,7 @@ begin
while numfresh <> 0 do begin
dec(numfresh);
// First draw into a full RGBX output buffer. (But at a very low resolution.)
RenderGobs(refresh[numfresh], mv_OutputBuffy);
RenderRect(refresh[numfresh], mv_OutputBuffy);
// Then convert to ASCII and write to the console.
with refresh[numfresh] do BlitzAscii(left, top, right, bottom);
end;
......
{ }
{ Copyright 2009 :: Kirinn Bunnylin / Mooncore }
{ }
{ This file is part of SuperSakura. }
{ }
{ SuperSakura is free software: you can redistribute it and/or modify }
{ it under the terms of the GNU General Public License as published by }
{ the Free Software Foundation, either version 3 of the License, or }
{ (at your option) any later version. }
{ }
{ SuperSakura is distributed in the hope that it will be useful, }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the }
{ GNU General Public License for more details. }
{ }
{ You should have received a copy of the GNU General Public License }
{ along with SuperSakura. If not, see <https://www.gnu.org/licenses/>. }
{ }
// Namespace object for the Rendermatic. It builds output frames from graphic assets and framebuffer effects.
type TRendermatic = object
procedure ClipRGB(clipdata : pblitstruct);
procedure BuildRGBtweakTable(r1, g1, b1 : longint);
procedure RenderTransition;
procedure RenderRect(const refrect : TEdgeCoordP; const destbuf : pointer);
procedure StashRender(viewnum : dword);
procedure RenderEverything;
{$ifdef sakucon}
procedure BlitzAscii(x1, y1, x2, y2 : longint);
{$endif}
end;
var Rendermatic : TRendermatic;
......@@ -19,7 +19,7 @@
// Supersakura common rendering functions
procedure ClipRGB(clipdata : pblitstruct);
procedure TRendermatic.ClipRGB(clipdata : pblitstruct);
// This function takes graphic dimensions and coordinates, and returns a blitstruct with offsets used by DrawRGB24, DrawRGBA32
// and StoreRGB.
// The destination is always mv_OutputBuffy, or any other 32-bit buffer of equal size. The source bitmap must be a contiguous
......@@ -91,7 +91,7 @@ begin
end;
end;
procedure BuildRGBtweakTable(r1, g1, b1 : longint);
procedure TRendermatic.BuildRGBtweakTable(r1, g1, b1 : longint);
// Fills RGBtweaktable[] with conversion values.
// The table can be used to apply changes to a pixel's colors efficiently. First call this procedure to create the lookup
// table, where each color channel gets an individual adjustment curve from your input arguments.
......@@ -164,15 +164,13 @@ begin
for i := 255 downto 0 do RGBtweakTable[i or 512] := (a * word(i * i) + b * i) div 4145280 + pStart;
end;
procedure ApplyRGBtweak;//(clipdata : pblitstruct);
{procedure ApplyRGBtweak;//(clipdata : pblitstruct);
// Takes the area in rendertarget^ at the given clip destination coordinates, and runs every pixel through a gamma correction
// conversion, as precalculated by BuildRGBtweakTable into the RGBtweakTable[] array.
{$note fix applyrgbtweak}
// Must take premul alpha into account; the RGB tweak function which currently could take any input 0..255 and return any
// output 0..255 must be scaled to return output in the range 0.. this pixel's alpha.
//var x, y : dword;
begin
{$ifdef bonk}
y := bdata^.sourcerows;
while y <> 0 do begin
dec(y);
......@@ -188,10 +186,9 @@ begin
end;
inc(bdata^.destofs, bdata^.destskipwidth);
end;
{$endif}
end;
end;}
procedure RenderTransition;
procedure TRendermatic.RenderTransition;
// Mixes an old stashed view with the currently active one. Transitionactive must be the index of a valid transition effect,
// which is used to track the transition's progress. When starting a transition, StashRender should be called to retain a view
// to transition from.
......@@ -395,7 +392,7 @@ begin
srcp := NIL; destp := NIL;
end;
procedure RenderGobs(const refrect : TEdgeCoordP; const destbuf : pointer);
procedure TRendermatic.RenderRect(const refrect : TEdgeCoordP; const destbuf : pointer);
// Completely redraws everything in the given rectangle. The destination buffer must be mv_OutputBuffy or stashBuffy.
// If rendering into stashBuffy, draws everything except textboxes.
{$define !newrenderer} // <-- doesn't work yet
......@@ -724,7 +721,7 @@ begin
end;
{$endif oldrenderer}
procedure StashRender(viewnum : dword);
procedure TRendermatic.StashRender(viewnum : dword);
// Erases all visible textboxes and copies the viewport's area from mv_OutputBuffy^ into stashBuffy^.
// The resulting image can be used as a snapshot of an earlier game state, for example as the departing transition image, or as
// a save game thumbnail.
......@@ -747,7 +744,7 @@ begin
// Draw over all the textboxes.
while numfresh <> 0 do begin
dec(numfresh);
RenderGobs(refresh[numfresh], stashBuffy);
RenderRect(refresh[numfresh], stashBuffy);
end;
// Restore the refresh regions.
refresh := backupfresh;
......
......@@ -17,11 +17,11 @@
{ along with SuperSakura. If not, see <https://www.gnu.org/licenses/>. }
{ }
// SuperSakura-SDL rendering functions.
// SuperSakura SDL-specific rendering functions.
{$include sakurender-all.pas}
{$include sakurendermatic-implementation.pas}
procedure Renderer;
procedure TRendermatic.RenderEverything;
// Handles all visual output into outputbuffy^.
var rekt : TSDL_Rect;
windowbytewidth : dword;
......@@ -31,7 +31,7 @@ begin
dec(numfresh);
// Draw stuff.
RenderGobs(refresh[numfresh], mv_OutputBuffy);
RenderRect(refresh[numfresh], mv_OutputBuffy);
// Push into the output texture.
with refresh[numfresh] do begin
......
......@@ -69,7 +69,7 @@ paszlib; // standard compression/decompression unit for savegames etc
{$include inc/sakueffects-implementation.pas}
// Rendering and visual effect functions.
{$include inc/sakurender-con.pas}
{$include inc/sakurendermatic-con.pas}
// Choicematic functions.
{$include inc/sakuchoicematic-implementation.pas}
......
......@@ -76,7 +76,7 @@ paszlib; // standard compression/decompression unit for savegames etc
{$include inc/sakueffects-implementation.pas}
// Rendering and visual effect functions.
{$include inc/sakurender-sdl.pas}
{$include inc/sakurendermatic-sdl.pas}
// Choicematic functions.
{$include inc/sakuchoicematic-implementation.pas}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment