1
Freebasic / Re: Fireworks (particle-test-demo)
« on: March 25, 2007 »
Vey nice.... Could be the start of a very nice particle engine... Good Work
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
sub pgl_cls(byval col as integer = rgb(0, 0, 0))
asm
mov ebx, [pgl_screen_ptr]
mov edx, [pgl_screen_length]
mov ecx, [col]
lea eax, [ebx + edx]
rep:
mov [ebx], ecx
add ebx, 4
cmp ebx, eax
jbe rep
end asm
end subsub pgl_blit_screen(byval src_buffer as integer ptr, byval alpha as ubyte)
dim p_alpha as integer = alpha shl 16 or alpha shl 8 or alpha
asm
mov eax, [src_buffer]
mov ebx, [pgl_screen_ptr]
mov ecx, [pgl_screen_length]
lea ecx, [ebx + ecx]
add eax, 12
pxor mm6, mm6
movd mm2, [p_alpha] 'mm2 has alpha value
punpcklbw mm2, mm6 'unpack it for processing
dloop:
movd mm0, [eax] 'image pixel col in mm0
movd mm1, [ebx] 'screen pixel col in mm2
punpcklbw mm0, mm6 'unpack mm0 using blank mm6 register as interleave
punpcklbw mm1, mm6 'same for screen color
psubw mm0, mm1 'subtract image color from screen color
pmullw mm0, mm2 'multiply resulting color by alpha
psrlw mm0, 8 'divide that by 255
add eax, 4 'increment image position
paddb mm0, mm1 'and then add screen color back in
packuswb mm0, mm0 'repack image pixel back to lower 32 bits of mm0
movd [ebx], mm0 'move result back to screen
add ebx, 4 'increment screen position
cmp ebx, ecx 'check for end of screen
jbe dloop 'if were not there wrap!!!!
emms 'restore floating point stuff, fuck this is expensive..
end asm
end sub
ScreenBuffer(PosX+PosY*ScreenWidth)=Colour
dim y_offset(screen_y) as uinteger
for i = 0 to 599
y_offset(i) = i * screen_x
next i
scr_buffer(100 + y_offset(100)) = rgb(255, 255, 255)#include "tinyptc.bi"
const screen_x = 800
const screen_y = 600
const screen_size = screen_x * screen_y
dim shared scr_buffer(0 to screen_size - 1) as integer
ptc_open("test", screen_x, screen_y)
dim y_offset(screen_y) as uinteger
for i = 0 to screen_y - 1
y_offset(i) = i * screen_x
next i
while inkey$ = ""
scr_buffer(100 + y_offset(100)) = rgb(255, 255, 255)
ptc_update @scr_buffer(0)
wend
ptc_close()
end
Have you ever showed someone whos not really into the scene a cracktro, intro or demo, and then tried to explain to them whats going on and why the thing they are watching has been produced only for them to look blankly at you and not get it at all..... Well I dont get it, but then i suppose these things are art and as such they will only appeal to a certain audience... I mean i cant picture myself going to an art gallery and having a good time, yet lots of people do.... Anyway rambling now so ill leave it there.....