includepath "$\inc\"
$ FileName "t.exe"
'include "RTL32.inc"
'include "RTL64.inc"
title="Cloud"
include "OpenglSceneFrame.inc"
sys texn[16]
type tParticle
===============
float x,y,z
float xsize,ysize,speed,angle
float fade
float r,g,b
end type
'RANDOMISER
===========
'
sys seed
'
Function Rnd() as float
Static As float f, d=1/0x7fffffff
mov eax,seed
inc eax
rol eax,7
imul eax,eax,13
mov seed,eax
push eax
fild dword [esp]
add esp,4
fmul dword d
fstp dword f
return f
End Function
'ABS RANDOMISER
===============
'
Function arnd() as float
return Abs(Rnd)
End Function
Sub textureA(sys n)
===================
static long v[16]
v<=
0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff,
0x00ffffff, 0xffffffff, 0x88ffffff, 0x00ffffff,
0x00ffffff, 0x88ffffff, 0xffffffff, 0x00ffffff,
0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff
MakeTexture @v, 4, 4, n
End Sub
function QuadTex(float x,y,z)
=============================
glBegin GL_QUADS
glTexCoord2f 0.0,0.0 : glVertex3f -x,-y, z
glTexCoord2f 1.0,0.0 : glVertex3f x,-y, z
glTexCoord2f 1.0,1.0 : glVertex3f x, y, z
glTexCoord2f 0.0,1.0 : glVertex3f -x, y, z
glend
end function
Function DrawParticle (tparticle*p)
===================================
glPushMatrix
glTranslatef p.x, p.y, p.z
p.angle+=Rnd()
glscalef 1, p.angle*.0004+1, 1 'itr
glRotatef p.angle, 0, 0, 1
QuadTex p.xsize,p.ysize,0
glPopMatrix
End Function
Function ReNewParticle(tparticle*p,sys i,e)
===========================================
p(i).x = Rnd()*.5
p(i).y = 0
p(i).z = -e*.1 / i 'z layers
p(i).xsize = .1+aRnd()*0.05
p(i).ysize = .1+aRnd()*0.05
p(i).Speed = .05+aRnd()*.2
p(i).Angle = aRnd()*360
End Function
Function RenderParticles(tparticle*p,sys e)
===========================================
sys i
static float fr=0.0167 '1/60
for i = 1 to e
if p(i).x > 2 or p(i).speed=0
ReNewParticle(p,i,e)
else
p(i).xsize += .15*fr
p(i).ysize += .05*fr
p(i).x += .9*p(i).Speed*fr
p(i).y += .3*p(i).Speed*fr
glColor4f .99,.99,.99,.7-p(i).x *.35
drawParticle p(i)
end if
Next
End Function
sys GdiplusToken
sub initialize(sys hWnd)
========================
'
'GDIPLUS
'
sys hr
GdiplusStartupInput StartupInput
StartupInput.GdiplusVersion = 1
hr=GdiplusStartup GdiplusToken, StartupInput, null
'
if hr then
print "Error initializing GDIplus: " hex hr
exit function
end if
seed=0x12345678
glGenTextures 1, texn
textureA texn[1]
SetTimer hWnd,1,10,NULL
end sub
tparticle p[50]
sys count
sub scene(sys hWnd)
===================
'
'Ctrl-P take snapshot
'
static sys photo
if key[80] and key[17] and photo=0
TakeOpenglSnapShot hwnd,"tim50.jpg","image/jpeg",50
photo=1
elseif key[80]=0
photo=0
end if
'
static single ang1,angi1=1,ra,ri
'
glLoadIdentity
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glEnable GL_DEPTH_TEST
glClearColor 0.4, 0.45, 0.8, 0
glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
glEnable GL_BLEND
/*
float fcolor[4]={.5, .45, .8, .99}
glfogi GL_FOG_MODE,GL_EXP
glfogf GL_FOG_DENSITY,0.1
glfogfv GL_FOG_COLOR, fcolor
glfogf GL_FOG_INDEX, 0
glfogf GL_FOG_START, -1.0
glfogf GL_FOG_END, -100.0
glEnable GL_FOG
*/
glEnable GL_TEXTURE_2D
glBindTexture GL_TEXTURE_2D,texn[1]
glPushMatrix
gltranslatef -50.0, -40.0, -90.0
glscalef 50,25,1
RenderParticles p,40
glPopMatrix
glDisable GL_TEXTURE_2D
'
ang1+=angi1
if ang1>360 then ang1-=360
sleep 10
'
end sub
sub Release(sys hwnd)
=====================
killTimer hwnd, 1
glDeleteTextures 1, texn
GdiplusShutdown GdiplusToken
end sub
X