News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Pre rendered vs real-time drawing

Started by daydreamer, August 17, 2023, 07:44:19 PM

Previous topic - Next topic

daydreamer

Hi
I been researching isometric 3d and written slow isometric tile drawing with gdi lines and another program I write to. Bmp files
Many old games used lot of prerendered graphics when 3d hardware drawing was inferior

Would be nice speed test draw everything each frame vs initialize lots of 3d tiles/3d background like described above and only bitblt

updated,had to find my code first
pseudo3diso3d draws isometric with gdi lines+other things
threadsxv2 writes out to 2 bmp files

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

#1
Some pseudocode mixed with asm,new version
Bmp handle background dd 0
Map array [1024*1024 ] ; tile map
Placables [1024*1024] ; placables data
Isometric
Init
Background =Loadbmp "c:/bmp/prerendered background"
Openf "/bmp/map1.bmp"
Map array fRead array
Close
Mov ecx,map array length
Lea esi,map array
Lea edi,placables array
L1:Mov eax,[esi]
Cmp eax,0 ; if tile height zero
Jne l2
Inc eax ; put placables there
; else no placables
L2:Mov [edi],eax
Inc esi
Inc edi
Dec ecx
Jne l1
;Faster several Xorps map array  invert to placables map




Wm_paint
Bitblt background
Draw isometric (dc)
Proc scale,x,y ; scale isometric drawing to fit different screen resolution
Fild x
Fmul xscale ; scale x, so max X is inside screen
Fistp x
Fild y
Fmul yscale ;scale y,so max y fits inside screen
Fistp y

Ret
Endp scale
Macro To iso
Mov eax,y ; or register that is used for y
Mov ebx,x ; or register used for x
Sub ebx,y
Add eax,x
Sal eax,1 ; div 2
End macro
Draw isometric
For y= 0 to max {
Mov esi, 32 pixels ; if bigger 64 tile wide map unroll this
Mov edi, 32 placables
For x=0 to 31
Rol esi,1
Jump if carry clear l over
Isox = x-y
Isox=(x+Y) /2
Invoke scale,Isox,isoy
Draw tile Isox,isoy ,height ; maybe keep tile in xmm regs and mem copy 256 colors pixels = xmm regs fit 16 pixel wide
Lover :
Rol edi,1
Jump if carry clear lover 2
To iso ; macro
Invoke scale,Isox,isoy
Draw oval Isox,isoy,height ; or coin. Ico

Lover 2:

} // y

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

Used loadbitmap in my windows to load bmp generated by earlier console program
Now got stuck try using bitblt in wm_paint :(
Only want to display bitmap from file,not manipulate it
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

Quote from: daydreamer on September 02, 2023, 05:33:49 AMNow got stuck try using bitblt in wm_paint :(

Full project attached, 49 lines of purest Masm32 SDK code :cool:

daydreamer

There is lot of file system macros in masm32, so you can delete old version of file before writing new version
But any way to first get last time it was written and later down in code get last time again and check if updated version of file exist
Delete object and loadbitmap again?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

Quote from: daydreamer on January 19, 2024, 12:04:47 AMany way to first get last time it was written and later down in code get last time again

WIN32_FIND_DATA.ftLastWriteTime maybe?

daydreamer

Quote from: jj2007 on January 19, 2024, 07:59:33 AM
Quote from: daydreamer on January 19, 2024, 12:04:47 AMany way to first get last time it was written and later down in code get last time again

WIN32_FIND_DATA.ftLastWriteTime maybe?
Maybe
Api to get detailed info on file and check that
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007