Pi the Demo(Scene) lazarus / 39-Graphics ---------------------------------------------------------------------- Key-Real · 2024-04-20 19:33 I saw people introduce there Games and DemoScene Effect in this Forum, so I thought why not to mention my Demo, Pi: https://www.pouet.net/prod.php?which=94183 To see the Source just click on the Source Button. Its nothing exiting BUT I'm proud of my gfx library, vipGFX https://sourceforge.net/projects/vipgfx/ It is a vscreen based, all drawing routines included(most of them written in fast asm) for 32bit and 64bit platforms(Linux, Windows, DOS, MAC Intel/AArch64) 2D engine. Use it for Demos, Games and programs made with Lazarus(it draws also on a Canvas). I'm still developing it, so if You find any Bugs or have suggestions, mail me or write a PM. I'm happy to help. Joint the #fpc IRC Channel on Libera (irc.libera.chat:6697) I'm there. Live a positive comment on Pouet or Blame me for not giving a proper credit to Clint Mansell for the Music ---------------------------------------------------------------------- KodeZwerg · 2024-04-21 07:35 Quote from: Key-Real on April 20, 2024, 09:33:52 pmI saw people introduce there Games and DemoScene Effect in this Forum, so I thought why not to mention my Demo, Pi: https://www.pouet.net/prod.php?which=94183 To see the Source just click on the Source Button. ... Live a positive comment on Pouet or Blame me for not giving a proper credit to Clint Mansell for the Music QuoteLoading... An unhandled exception occurred at $00000001000156C9: EAccessViolation: Access violation   $00000001000156C9   $0000000100018BEF   $00000001000198D7   $0000000100001BEB   $00000001000031C6   $0000000100010760   $0000000100001AD0   $00007FFC2A067034   $00007FFC2BD62651Right at that moment my comment would not be so pretty no matter about a named sound artist OS: Windows 10 64bit AV: Kaspersky AntiVirus - 64bit (no alert, nothing blocked) Downloaded Pi.zip, extracted to a non-Windows-write-protected folder, run "pi_win.exe" with and without "l" argument. same for pidemo-code-f77f924a33f9d102da1486d0f17f90c3df534ac4.zip where inside \BIN\ the pi.zip file is located. Does it have any hard- or software requirements that I am not aware about? ...buuuut I did found and run DarkHour made by you, classic intro in millenium style, plasma, fast fading, different scrollers, neon look, epilepsy pushing effects, that you should port over to your vipGFX for a high- res scaled version of it? Nice work on that, good classic one! ---------------------------------------------------------------------- AlexTP · 2024-04-21 07:52 I can run it! Win10 x64, very old PC with Intel i3 CPU and very old NVidia GeForce. Theme is very psychotic, which I do not like. What I also did not like is the REPEATING picture of some 'spot' or 'neuron network' in the center. But thanks. ---------------------------------------------------------------------- Key-Real · 2024-04-21 08:05 QuoteLoading... An unhandled exception occurred at $00000001000156C9: EAccessViolation: Access violation   $00000001000156C9   $0000000100018BEF   $00000001000198D7   $0000000100001BEB   $00000001000031C6   $0000000100010760   $0000000100001AD0   $00007FFC2A067034   $00007FFC2BD62651 hm... It runs at my Machine, it runs on the Compo Machine, it runs on all Machines i tested. perhaps Kaspersky, usually Defender pops up? perhaps the bass sound library? perhaps my own code? its a pity sorry for that I'm exited if the Linux version works. Quote...buuuut I did found and run DarkHour made by you, classic intro in millenium style, plasma, fast fading, different scrollers, neon look, epilepsy pushing effects, that you should port over to your vipGFX for a high- res scaled version of it? Nice work on that, good classic one! it is a honor to me you liked it what learned from making demos is, I would never again use 256 Color (DarkHour) and 3th party libraries(Bass). ---------------------------------------------------------------------- KodeZwerg · 2024-04-21 08:53 I still try to make it run, 2 errors corrected that stopped the initial loading sequence: file: music.pas line: 44 original: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   bassChn := BASS_StreamCreateFile(FALSE, PChar(ExtractFilePath(ParamStr(0))+'/pi.mp3'), 0, 0, 0);fixed: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   bassChn := BASS_StreamCreateFile(FALSE, PChar(ExtractFilePath(ParamStr(0)) + PathDelim + 'pi.mp3'), 0, 0, 0); file: allimg.pas line: 170 original: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i         openPKfile(ExtractFilePath(ParamStr(0))+'/data.dat');fixed: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i         openPKfile(ExtractFilePath(ParamStr(0)) + PathDelim + 'data.dat'); and now it stops here: file: sprite3.inc line: 74 error: roundss undefined Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i roundss xmm0,xmm0,0 Lazarus 3.99 (rev main_3_99-1865-gfdc1806f53) FPC 3.2.2 x86_64-win64-win32/win64 ---------------------------------------------------------------------- Key-Real · 2024-04-21 08:58 I compiled it only with the Trunk. roundss is a SSE instruction ---------------------------------------------------------------------- AlexTP · 2024-04-21 09:20 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ExtractFilePath(ParamStr(0)) + PathDelim + 'data.dat'No, ExtractFilePath gives the text with trailing slash already. ExtractFileDir - not. ---------------------------------------------------------------------- KodeZwerg · 2024-04-21 12:30 AlexTP +1 I am currently porting assembler to pascal, as of right now something happen on screen, yay! file: sprite3.inc original: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure ScaleSprite(where : gfxImage; x1, y1, x2, y2 : longint; sprite : gfxImage); overload;var xstep, ystep : single;    endX, endY : longint;    y : longint;    color : dword;begin asm           mov eax,x1          mov ebx,x2          cmp eax,ebx           jl @OK1        xchg eax,ebx           mov x2,eax          mov x1,ebx         @OK1:           mov eax,y1          mov ebx,y2          cmp eax,ebx         jl @OK2          xchg eax,ebx           mov y2,eax          mov y1,ebx         @OK2:          mov eax,x2          sub eax,x1          mov edx,eax           cmp edx,0           jl @theEnd           dec edx          mov endX,edx           mov ebx,y2          sub ebx,y1        mov edx,ebx          cmp edx,0           jl @theEnd           dec edx          mov endY,edx                cvtsi2ss xmm0,sprite.width    cvtsi2ss xmm1,eax         divss xmm0,xmm1         movss xstep,xmm0       cvtsi2ss xmm0,sprite.height      cvtsi2ss xmm1,ebx         divss xmm0,xmm1         movss ystep,xmm0            xor eax,eax           mov y,eax         xorps xmm6,xmm6        @YLoop:           xor edx,edx                 xorps xmm7,xmm7       @Xloop:          movss xmm0,xmm7         movss xmm1,xmm6        roundss xmm0,xmm0,0       roundss xmm1,xmm1,0              cvtss2si eax,xmm0      cvtss2si ebx,xmm1            mov rsi,sprite.data          imul ebx,sprite.width           add ebx,eax           shl ebx,2           add rsi,rbx           mov ebx,dword ptr [rsi]           mov color,ebx                   mov eax,x1           add eax,edx          cmp eax,0            jl @Skip            mov ecx,where.width          cmp eax,ecx           jge @Skip            mov ebx,y1           add ebx,y            cmp ebx,0            jl @Skip            cmp ebx,where.height           jge @Skip            mov rdi,where.data        imul ebx,ecx           add ebx,eax           shl ebx,2           add rdi,rbx           mov eax,color           mov dword ptr [rdi],eax @Skip:         movss xmm4,xstep         addss xmm7,xmm4               inc edx           cmp edx,endX            jb @Xloop        movss xmm4,ystep            addss xmm6,xmm4            inc y         mov eax,endY           cmp y,eax            jb @Yloop       @theEnd:          emms       end;end; converted to pascal: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure ScaleSprite(where: gfxImage; x1, y1, x2, y2: LongInt; sprite: gfxImage); overload;  procedure Swap(var A, B: LongInt); inline;  var    Temp: LongInt;  begin    Temp := A;    A := B;    B := Temp;  end;var  xstep, ystep: Single;  srcX, srcY,  endX, endY,  targetX: LongInt;  i, j, y: LongInt;  srcColor: DWord;begin  if x1 > x2 then  Swap(x1, x2);  if y1 > y2 then    Swap(y1, y2);   endX := x2 - x1;  endY := y2 - y1;  if (endX <= 0) or (endY <= 0) then    Exit;   xstep := sprite.width / endX;  ystep := sprite.height / endY;   for y := 0 to endY - 1 do    for i := 0 to endX - 1 do      begin        srcX := Round(i * xstep);        srcY := Round(y * ystep);        if (srcX >= 0) and (srcX < sprite.width) and (srcY >= 0) and (srcY < sprite.height) then          begin            srcColor := PDWord(PByte(sprite.data) + (srcY * sprite.width + srcX) * SizeOf(DWord))^;            j := y1 + y;            if (j >= 0) and (j < where.height) then              begin                targetX := x1 + i;                if (targetX >= 0) and (targetX < where.width) then                PDWord(PByte(where.data) + (j * where.width + targetX) * SizeOf(DWord))^ := srcColor;              end;          end;      end;end;Could you test and confirm if its running as it should at most likely same speed? Here it breaks after some word spoke, some browny plasma flying around, some font faded in and out. If you say that speed perform now bad than I stop translating it ---------------------------------------------------------------------- Key-Real · 2024-04-21 12:45 You can See how it supose to be in the YouTube capture. Link in pouet ---------------------------------------------------------------------- KodeZwerg · 2024-04-21 16:33 Quote from: KodeZwerg on April 21, 2024, 10:53:55 amfile: sprite3.inc line: 74 error: roundss undefinedI was not precise enough, error is "Illegal Instruction" Quote from: KodeZwerg on April 21, 2024, 02:30:59 pmHere it breaks after some word spoke, some browny plasma flying around, some font faded in and out.Again I failed to tell some important news, that statement was meant for "ShadowInTheBox" . Now I have found a folder called "draw32.all.pas", where it seems to be the original header translation is inside, when saying original I mean interpreted as pascal source. Here are my latest changes, when I find a time I might rewrite more, from point of speed my way could be a few ticks faster than the original. file: \gfxinc\draw32\draw32.all.x64\sprite3.inc original: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure ScaleSprite(where : gfxImage; x1, y1, x2, y2 : longint; sprite : gfxImage); overload;var xstep, ystep, sx, sy : single;    x, y, i : longint;    color : dword;begin   if x1 > x2 then begin    i:= x2;    x2:= x1;    x1:= i;  end;   if y1 > y2 then begin    i:= y2;    y2:= y1;    y1:= i;  end;   if (x2 - x1) <= 0 then exit;  if (y2 - y1) <= 0 then exit;     xstep:= sprite.width / (x2 - x1);  ystep:= sprite.height / (y2 - y1);  color:= 0;  y:= 0;  sy:= 0;   repeat     x:= 0;    sx:= 0;     Repeat      color:= getpixelClip(sprite, round(sx), round(sy));      putPixelClip(where, x1 + x, y1 + y, color);       sx:= sx + xstep;       inc(x);    until x >= (x2 - x1 - 1);     sy:= sy + ystep;    inc(y);  until y >= (y2 - y1 - 1); end;My version without knowing that above existed Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure ScaleSprite(where: gfxImage; x1, y1, x2, y2: LongInt; sprite: gfxImage); overload;  procedure Swap(var A, B: LongInt); inline;  var    Temp: LongInt;  begin    Temp := A;    A := B;    B := Temp;  end;var  stepX, stepY: Single;  srcX, srcY,  endX, endY,  dstX, dstY,  x, y: LongInt;  srcColor: DWord;begin  if x1 > x2 then    Swap(x1, x2);  if y1 > y2 then    Swap(y1, y2);   endX := x2 - x1;  endY := y2 - y1;  if (endX <= 0) or (endY <= 0) then    Exit;   stepX := sprite.width / endX;  stepY := sprite.height / endY;   for x := 0 to Pred(endX) do    for y := 0 to Pred(endY) do      begin        srcX := Round(x * stepX);        srcY := Round(y * stepY);        if (srcX >= 0) and (srcX < sprite.width) and (srcY >= 0) and (srcY < sprite.height) then          begin            srcColor := PDWord(PByte(sprite.data) + (srcY * sprite.width + srcX) * SizeOf(DWord))^;            dstX := x1 + x;            dstY := y1 + y;            if ((dstY >= 0) and (dstY < where.height) and (dstX >= 0) and (dstX < where.width)) then              PDWord(PByte(where.data) + (dstY * where.width + dstX) * SizeOf(DWord))^ := srcColor;          end;      end;end; original Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure ScaleSprite(where : gfxImage; x1, y1, x2, y2 : longint; mask : dword; sprite : gfxImage); overload;var xstep, ystep, sx, sy : single;    x, y, i : longint;    color : dword;begin     if x1 > x2 then begin      i:= x2;      x2:= x1;      x1:= i;    end;     if y1 > y2 then begin    i:= y2;      y2:= y1;      y1:= i;    end;     if (x2 - x1) <= 0 then exit;    if (x2 - y1) <= 0 then exit;     xstep:= sprite.width / (x2-x1);    ystep:= sprite.height / (y2-y1);     color:= 0;    y:= 0;    sy:= 0;     repeat      x:= 0;      sx:= 0;      Repeat         color:= getpixelClip(sprite, round(sx), round(sy));        if color <> mask then putPixelClip(where, x1 + x, y1 + y, color);         sx:= sx + xstep;         inc(x);      until x >= (x2 - x1 - 1);       sy:= sy + ystep;      inc(y);    until y >= (y2 - y1 - 1); end;my conversation: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure ScaleSprite(where: gfxImage; x1, y1, x2, y2: LongInt; mask: DWord; sprite: gfxImage); overload;  procedure Swap(var A, B: LongInt); inline;  var    Temp: LongInt;  begin    Temp := A;    A := B;    B := Temp;  end;var  stepX, stepY: Single;  srcX, srcY,  endX, endY,  dstX, dstY,  x, y: LongInt;  srcColor: DWord;begin  if x1 > x2 then    Swap(x1, x2);  if y1 > y2 then    Swap(y1, y2);   endX := x2 - x1;  endY := y2 - y1;  if (endX <= 0) or (endY <= 0) then    Exit;   stepX := sprite.width / endX;  stepY := sprite.height / endY;   for x := 0 to Pred(endX) do    for y := 0 to Pred(endY) do      begin        srcX := Round(x * stepX);        srcY := Round(y * stepY);        if (srcX >= 0) and (srcX < sprite.width) and (srcY >= 0) and (srcY < sprite.height) then          begin            srcColor := PDWord(PByte(sprite.data) + (srcY * sprite.width + srcX) * SizeOf(DWord))^;            if srcColor <> mask then              begin                dstX := x1 + x;                dstY := y1 + y;              if ((dstY >= 0) and (dstY < where.height) and (dstX >= 0) and (dstX < where.width)) then                  PDWord(PByte(where.data) + (dstY * where.width + dstX) * SizeOf(DWord))^ := srcColor;              end;          end;      end;end; There are many more methods that could be overhauled, for both 32 and 64bit. Currently I just use the "original" 64bit and added my two patches, it works great now. ---------------------------------------------------------------------- Key-Real · 2024-04-21 18:41 @KodeZwerg: "Shadow in the Box"....  Wow   You cloned all my repos and YES! Your version is faster, you saved 2 calls in the inner loop, that's good for cache You like the idea behind vipGFX? Does Pi runs now? You like it? You knew the Film? ---------------------------------------------------------------------- KodeZwerg · 2024-04-21 20:00 Quote from: Key-Real on April 21, 2024, 08:41:17 pm@KodeZwerg: "Shadow in the Box"....  Wow   You cloned all my reposI was curious why it did not work and loaded another repo in that used vipGFX to learn from where it fails on my test machine. Quote from: Key-Real on April 21, 2024, 08:41:17 pmand YES! Your version is faster, you saved 2 calls in the inner loop, that's good for cache Good to hear, time for VSync Quote from: Key-Real on April 21, 2024, 08:41:17 pmYou like the idea behind vipGFX?I have to say, what you have done works smooth and fast, I mean no flicker, so for you that knows how to handle it correctly, its a great helper, for me as a new-born, its first of all a challenge to find how out something works and how I can use such for my own pleasure. I was not checking yet the folders since it is a lot that I downloaded lol Does a demo for vipGFX exists that works with internal created images or image data? Like how do I fill a rectangle/ellipse/pie at TRect coordinates (to prepare internal a buffered image that I easy can transport to some display method ....) How do I put text from a TFont on screen? Such basic stuff to learn how to work with your lib would be amazing, maybe such already exists and I was ignorant  Later slightly more advanced, what image fileformat can be loaded from a stream to be used within vipGFX, that way I could store my images compressed within source instead of external data. As you might noticed, interested I am, if I become a fan of DirectX compared vs OpenGL, hard to answer, best would be that I could choose a renderer and vipGFX offers the methods to use them. My selfish answer would be, it doesnt matter to me since I anyway just code for windows Quote from: Key-Real on April 21, 2024, 08:41:17 pmDoes Pi runs now? You like it? You knew the Film?It's running! If I be a neutral judge, here are my category points (0 worst, 10 max)  - from point of how good works one scene with another: 6 to 7  - from point of how good does sound match screen: 8  - from point of used different effects: 7  - from point of filesize vs enjoyment: 4 to 5 (its more the filesize of your data.dat that count in negative)  - from point of high-res usage: 2  - from point of power usage: 3 to 4 (can just judge my own build of the directX headers, used fpc latest stable)  - from point of coolness factor: 7 So all in all my feeling for "liking it" is higher than that I was bored. The movie I do not know yet. After watching the trailer with original movie intro, last comparision to judge is how close is it to the original: pretty high beside missing text blend ins it look and feel like original. To be honest I would need to turn slow-mo on, for both, your intro and original trailer, to be able to say that here or there are too huge differences as to judge it good anymore. From my side both thumbs up! ---------------------------------------------------------------------- Key-Real · 2024-04-21 20:37 QuoteI have to say, what you have done works smooth and fast, I mean no flicker, so for you that knows how to handle it correctly, its a great helper, for me as a new-born, its first of all a challenge to find how out something works and how I can use such for my own pleasure. Yes enjoy QuoteDoes a demo for vipGFX exists that works with internal created images or image data? See the ./doc Folder QuoteLike how do I fill a rectangle/ellipse/pie at TRect coordinates (to prepare internal a buffered image that I easy can transport to some display method ....) en ellipse and pie are not supported jet. "TRect" are always just x and y and letz say radius for circle.... QuoteHow do I put text from a TFont on screen? There is a FreeType 1 integration, as it is a native pascal library QuoteSuch basic stuff to learn how to work with your lib would be amazing, maybe such already exists and I was ignorant  the doc is not complete, just tell me what you wanna knew and I add it to the doc. QuoteLater slightly more advanced, what image fileformat can be loaded from a stream to be used within vipGFX, that way I could store my images compressed within source instead of external data. ARGB QuoteAs you might noticed, interested I am, if I become a fan of DirectX compared vs OpenGL, hard to answer, best would be that I could choose a renderer and vipGFX offers the methods to use them. under Windows You can chose between DirectX, OepnGL and WIN32 API to flip on the screen QuoteTo be honest I would need to turn slow-mo on, for both, your intro and original trailer, to be able to say that here or there are too huge differences as to judge it good anymore. Don't do that it is not 100% QuoteFrom my side both thumbs up! tell them at Pouet.net ---------------------------------------------------------------------- KodeZwerg · 2024-04-21 22:22 Quote from: Key-Real on April 21, 2024, 10:37:58 pmSee the ./doc FolderThats my next mission, try to convert that simple copperbar demo I've lately made (BGRA & BGL) to the world of vipGFX. If I dont find what I need, like basic things I've earlier mentioned, dot, line, rectangle etc... I might create some to simplify the conversation (bitmap/canvas -> vipgfx) Quote from: Key-Real on April 21, 2024, 10:37:58 pmtell them at Pouet.net I've tried, see attachment, feel free to put there a link up that point to here so interested can read my opinion(s)