Added _release/Samples
@@ -0,0 +1,21 @@
|
|||||||
|
B3D Motion
|
||||||
|
1
|
||||||
|
|
||||||
|
17
|
||||||
|
0 644.072 -26.4 197.785 0 180 0 1 1 1 0 0 0 0
|
||||||
|
67 587.169 -6.34694 -358.156 6.99 161.89 -21.95 1 1 1 0 0 0 0
|
||||||
|
113 398.419 -58.8888 -622.165 8.17291 107.949 -78.4541 1 1 1 0 0 0 0
|
||||||
|
142 155.586 -68.5395 -652.304 -0.410908 86.3052 -34.7343 1 1 1 0 0 0 0
|
||||||
|
170 -114.301 -52.47 -635.107 -0.207478 87.8818 27.7637 1 1 1 0 0 0 0
|
||||||
|
183 -247.522 -16.5971 -666.336 -15.0302 103.897 24.5776 1 1 1 0 0 0 0
|
||||||
|
193 -353.421 2.04996 -667.489 4.42792 72.395 11.3806 1 1 1 0 0 0 0
|
||||||
|
225 -700.255 -54.45 -436.007 7.09998 9.8001 -56.3 1 1 1 0 0 0 0
|
||||||
|
254 -652.209 -4.24768 -172.992 5.14504 -11.1657 -40.7413 1 1 1 0 0 0 0
|
||||||
|
281 -581.891 -69.63 88.0191 2.48344 4.30973 25.9386 1 1 1 0 0 0 0
|
||||||
|
304 -673.933 -45.2472 351.064 -8.56151 22.8598 -3.49729 1 1 1 0 0 0 0
|
||||||
|
338 -750.156 1.98396 670.559 -0.439092 -47.3414 -96.7183 1 1 1 0 0 0 0
|
||||||
|
361 -538.051 -8.1492 692.269 4.80766 -94.6671 -39.1392 1 1 1 0 0 0 0
|
||||||
|
395 -120.212 -32.67 646.857 -3.41719 -93.1005 6.8817 1 1 1 0 0 0 0
|
||||||
|
450 492.552 -20.46 570.925 -1.40002 -102.8 -49 1 1 1 0 0 0 0
|
||||||
|
480 635.271 -4.94957 467.053 1.80924 -172.496 -34.2367 1 1 1 0 0 0 0
|
||||||
|
525 644.072 -26.4 197.785 0 -180 0 1 1 1 0 0 0 0
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
B3D Motion
|
||||||
|
1
|
||||||
|
|
||||||
|
18
|
||||||
|
0 644.072 39.6 197.785 0 180 0 1 1 1 0 0 0 0
|
||||||
|
67 550.324 -23.8369 -351.897 4.49119 161.794 -47.8532 1 1 1 0 0 0 0
|
||||||
|
113 385.085 -36.7788 -604.59 8.17291 107.949 -78.4541 1 1 1 0 0 0 0
|
||||||
|
142 124.429 -68.5395 -630.32 -1.91091 93.6052 6.26574 1 1 1 0 0 0 0
|
||||||
|
170 -157.178 -43.89 -642.503 0.092515 93.1819 27.7637 1 1 1 0 0 0 0
|
||||||
|
183 -269.144 -53.2271 -650.317 10.5698 91.6972 30.6776 1 1 1 0 0 0 0
|
||||||
|
193 -407.086 -53.72 -663.014 4.32792 75.295 45.4806 1 1 1 0 0 0 0
|
||||||
|
225 -652.251 -75.9 -523.12 -11.6 16.7001 -38.8 1 1 1 0 0 0 0
|
||||||
|
254 -624.976 -54.4077 -210.414 4.74504 -7.86568 15.4587 1 1 1 0 0 0 0
|
||||||
|
281 -588.317 -81.18 86.4795 2.28344 6.90973 25.9386 1 1 1 0 0 0 0
|
||||||
|
290 -634.629 -71.4966 205.182 -3.94413 28.9996 -9.95455 1 1 1 0 0 0 0
|
||||||
|
304 -709.767 -45.2472 353.567 -8.56151 22.8598 -75.4973 1 1 1 0 0 0 0
|
||||||
|
338 -756.658 1.98396 680.506 6.36091 -44.6414 -96.7183 1 1 1 0 0 0 0
|
||||||
|
361 -541.411 -25.9692 705.817 4.60766 -92.3671 -39.1392 1 1 1 0 0 0 0
|
||||||
|
395 -121.169 -50.49 667.667 -3.41719 -93.1005 1.2817 1 1 1 0 0 0 0
|
||||||
|
450 518.155 9.9 580.814 -1.20002 -104.3 -49 1 1 1 0 0 0 0
|
||||||
|
480 620.264 18.1504 412.466 4.10924 -153.396 -2.83666 1 1 1 0 0 0 0
|
||||||
|
525 644.072 39.6 197.785 0 -180 0 1 1 1 0 0 0 0
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
Global info1$="Birds Demo, by Adam Gore"
|
||||||
|
Global info2$="A small Blitz3D compatibility test"
|
||||||
|
Global info3$="Spline data imported from Lightwave"
|
||||||
|
|
||||||
|
Include "../start.bb"
|
||||||
|
|
||||||
|
Include "KBSplines.bb"
|
||||||
|
|
||||||
|
Global gwidth = 640;800
|
||||||
|
Global gheight = 480;600
|
||||||
|
Const FPS = 30
|
||||||
|
Global fstep
|
||||||
|
|
||||||
|
;Graphics3D gwidth,gheight
|
||||||
|
|
||||||
|
period=1000/FPS
|
||||||
|
time=MilliSecs()-period
|
||||||
|
|
||||||
|
cmot.Motion = New motion
|
||||||
|
b2mot.Motion = New Motion
|
||||||
|
b1mot.Motion = New Motion
|
||||||
|
|
||||||
|
If Load_Motion( "Cam.bbm", cmot ) = False Then RuntimeError "Error loading file" : End
|
||||||
|
If Load_Motion( "Bird1.bbm", b1mot ) = False Then RuntimeError "Error loading file" : End
|
||||||
|
If Load_Motion( "Bird2.bbm", b2mot ) = False Then RuntimeError "Error loading file" : End
|
||||||
|
|
||||||
|
camera=CreateCamera()
|
||||||
|
CameraRange camera,1,3000
|
||||||
|
|
||||||
|
AmbientLight 90,90,90
|
||||||
|
light_sun = CreateLight(1)
|
||||||
|
LightColor light_sun,200,200,100
|
||||||
|
RotateEntity light_sun,60,-90,0
|
||||||
|
|
||||||
|
mesh_canyon = LoadMesh( "Canyon.x" )
|
||||||
|
mesh_skybox = MakeSkyBox("Textures\sky")
|
||||||
|
mesh_bird = LoadMD2("Bird.md2")
|
||||||
|
tex1 = LoadTexture( "Textures\Bird.bmp" )
|
||||||
|
EntityTexture mesh_bird,tex1
|
||||||
|
mesh_bird2 = CopyEntity( mesh_bird )
|
||||||
|
|
||||||
|
AnimateMD2 mesh_bird,1,2.5,0,31
|
||||||
|
AnimateMD2 mesh_bird2,1,2.5,0,31
|
||||||
|
|
||||||
|
Apply_Motion(cmot,0,camera)
|
||||||
|
Apply_Motion(b1mot,0,mesh_bird)
|
||||||
|
Apply_Motion(b2mot,0,mesh_bird2)
|
||||||
|
fstep = 1
|
||||||
|
|
||||||
|
While KeyHit(1)<>True
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
elapsed=MilliSecs()-time
|
||||||
|
Until elapsed
|
||||||
|
|
||||||
|
ticks=elapsed/period
|
||||||
|
tween#=Float(elapsed Mod period)/Float(period)
|
||||||
|
|
||||||
|
For k=1 To ticks
|
||||||
|
time=time+period
|
||||||
|
If k=ticks Then CaptureWorld
|
||||||
|
|
||||||
|
Apply_Motion(cmot,fstep,camera)
|
||||||
|
Apply_Motion(b1mot,fstep,mesh_bird)
|
||||||
|
Apply_Motion(b2mot,fstep,mesh_bird2)
|
||||||
|
fstep = fstep + 1
|
||||||
|
If fstep > cmot\nsteps Then fstep = 1
|
||||||
|
|
||||||
|
PositionEntity mesh_skybox,EntityX(camera,1),EntityY(camera,1),EntityZ(camera,1)
|
||||||
|
|
||||||
|
UpdateWorld
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
RenderWorld tween
|
||||||
|
|
||||||
|
Flip
|
||||||
|
|
||||||
|
Wend
|
||||||
|
End
|
||||||
|
|
||||||
|
Function MakeSkyBox( file$ )
|
||||||
|
|
||||||
|
m=CreateMesh()
|
||||||
|
;front face
|
||||||
|
b=LoadBrush( file$+"_FR.bmp",49 )
|
||||||
|
s=CreateSurface( m,b )
|
||||||
|
AddVertex s,-1,+1,-1,0,0:AddVertex s,+1,+1,-1,1,0
|
||||||
|
AddVertex s,+1,-1,-1,1,1:AddVertex s,-1,-1,-1,0,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
FreeBrush b
|
||||||
|
;right face
|
||||||
|
b=LoadBrush( file$+"_LF.bmp",49 )
|
||||||
|
s=CreateSurface( m,b )
|
||||||
|
AddVertex s,+1,+1,-1,0,0:AddVertex s,+1,+1,+1,1,0
|
||||||
|
AddVertex s,+1,-1,+1,1,1:AddVertex s,+1,-1,-1,0,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
FreeBrush b
|
||||||
|
;back face
|
||||||
|
b=LoadBrush( file$+"_BK.bmp",49 )
|
||||||
|
s=CreateSurface( m,b )
|
||||||
|
AddVertex s,+1,+1,+1,0,0:AddVertex s,-1,+1,+1,1,0
|
||||||
|
AddVertex s,-1,-1,+1,1,1:AddVertex s,+1,-1,+1,0,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
FreeBrush b
|
||||||
|
;left face
|
||||||
|
b=LoadBrush( file$+"_RT.bmp",49 )
|
||||||
|
s=CreateSurface( m,b )
|
||||||
|
AddVertex s,-1,+1,+1,0,0:AddVertex s,-1,+1,-1,1,0
|
||||||
|
AddVertex s,-1,-1,-1,1,1:AddVertex s,-1,-1,+1,0,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
FreeBrush b
|
||||||
|
;top face
|
||||||
|
b=LoadBrush( file$+"_UP.bmp",49 )
|
||||||
|
s=CreateSurface( m,b )
|
||||||
|
AddVertex s,-1,+1,+1,0,1:AddVertex s,+1,+1,+1,0,0
|
||||||
|
AddVertex s,+1,+1,-1,1,0:AddVertex s,-1,+1,-1,1,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
FreeBrush b
|
||||||
|
|
||||||
|
ScaleMesh m,1700,1700,1700
|
||||||
|
FlipMesh m
|
||||||
|
EntityFX m,1
|
||||||
|
Return m
|
||||||
|
|
||||||
|
End Function
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
B3D Motion
|
||||||
|
1
|
||||||
|
|
||||||
|
12
|
||||||
|
0 644.072 0 197.785 0 180 0 1 1 1 0 0 0 0
|
||||||
|
30 644.072 0 -0.215451 0 180 0 1 1 1 0 0 0 0
|
||||||
|
67 583.957 -13.2769 -325.508 6.99118 161.894 2.34681 1 1 1 0 0 0 0
|
||||||
|
113 417.375 -58.8888 -562.76 2.77291 149.149 -78.4541 1 1 1 0 0 0 0
|
||||||
|
170 -87.9633 -45.21 -629.166 1.39252 90.1819 8.86372 1 1 1 0 0 0 0
|
||||||
|
225 -625.618 -70.29 -571.854 4.49998 36.1001 50 1 1 1 0 0 0 0
|
||||||
|
281 -599.109 -45.21 40.1402 11.4834 10.6097 0.138594 1 1 1 0 0 0 0
|
||||||
|
338 -769.359 -29.366 635.14 -3.23909 -55.2414 -5.21836 1 1 1 0 0 0 0
|
||||||
|
395 -170.892 -45.21 655.333 2.18281 -91.0005 6.8817 1 1 1 0 0 0 0
|
||||||
|
450 500.165 -6.6 631.131 2.59998 -177.1 -1.5 1 1 1 0 0 0 0
|
||||||
|
480 626.241 -4.94957 497.102 2.00924 -177.896 -1.13666 1 1 1 0 0 0 0
|
||||||
|
525 644.071 0 197.785 0 -180 0 1 1 1 0 0 0 0
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
;Kochanek-Bartels Splines
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
; VARIABLES
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Const nkeyframes = 50 ;maximum number of keyframes per motion
|
||||||
|
Const nchannels = 9 ;number of channel values
|
||||||
|
Dim icv#(nchannels-1) ;stores interpolated channel values
|
||||||
|
Global key0.KeyFrame, key1.KeyFrame
|
||||||
|
key0.KeyFrame = New keyframe : key1.KeyFrame = New keyframe
|
||||||
|
|
||||||
|
Type Motion
|
||||||
|
Field nkeys ;number of keyframes
|
||||||
|
Field nsteps ;last frame number
|
||||||
|
Field keylist.KeyFrame[nkeyframes-1];array of keyframes
|
||||||
|
End Type
|
||||||
|
|
||||||
|
Type KeyFrame
|
||||||
|
Field fstep ;frame number
|
||||||
|
Field cv#[nchannels-1] ;array of channel values (x y z h p b sx sy sz)
|
||||||
|
Field linear ;linear flag
|
||||||
|
Field tens# ;Kochanek-Bartels parameters
|
||||||
|
Field cont#
|
||||||
|
Field bias#
|
||||||
|
End Type
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
; FUNCTIONS
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Function Load_Motion( file$, m.Motion )
|
||||||
|
|
||||||
|
Local f,s$, i, ii
|
||||||
|
|
||||||
|
f = ReadFile( file )
|
||||||
|
If f = False Then Return False
|
||||||
|
|
||||||
|
If ReadLine$(f) <> "B3D Motion" Then Return False
|
||||||
|
If Int(ReadLine$(f)) <> "1" Then Return False
|
||||||
|
ReadLine$(f)
|
||||||
|
|
||||||
|
m\nkeys = Int(ReadLine$(f))
|
||||||
|
|
||||||
|
For i = 0 To m\nkeys ;read keyframe data
|
||||||
|
s$ = ReadLine$( f )
|
||||||
|
m\keylist[i] = New KeyFrame
|
||||||
|
m\keylist[i]\fstep = Int(Parse(s,1))
|
||||||
|
For ii = 0 To nchannels-1 : m\keylist[i]\cv[ii] = Float(Parse(s,2+ii)) : Next
|
||||||
|
m\keylist[i]\linear = Int(Parse(s,11))
|
||||||
|
m\keylist[i]\tens = Float(Parse(s,12))
|
||||||
|
m\keylist[i]\cont = Float(Parse(s,13))
|
||||||
|
m\keylist[i]\bias = Float(Parse(s,14))
|
||||||
|
Next
|
||||||
|
|
||||||
|
m\nsteps = m\keylist[m\nkeys-1]\fstep
|
||||||
|
|
||||||
|
CloseFile f
|
||||||
|
Return True
|
||||||
|
|
||||||
|
End Function
|
||||||
|
;------------------------------------------------------------------------
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------
|
||||||
|
Function Apply_Motion(m.Motion, tstep#, e)
|
||||||
|
|
||||||
|
Local dd0a#, dd0b#, ds1a#, ds1b#
|
||||||
|
Local adj0#, adj1#, dd0#, ds1#, d2#, t#, d10#
|
||||||
|
Local t2#, t3#, z#, h#[3]
|
||||||
|
Local i, tlen, key
|
||||||
|
|
||||||
|
;*** if there's only one key, the channel values are constant ***
|
||||||
|
|
||||||
|
If (m\nkeys = 1) Then
|
||||||
|
For i = 0 To nchannels-1 : icv(i) = m\keylist[0]\cv[i] : Next
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
;*** find keyframe pair to interpolate between ***
|
||||||
|
|
||||||
|
If tstep < m\keylist[0]\fstep Then Return
|
||||||
|
|
||||||
|
For key = 1 To m\nkeys
|
||||||
|
If tstep <= m\keylist[key]\fstep Then Exit
|
||||||
|
Next
|
||||||
|
key1 = m\keylist[key]
|
||||||
|
|
||||||
|
If key = m\nkeys Then Return
|
||||||
|
|
||||||
|
key0 = m\keylist[key - 1]
|
||||||
|
|
||||||
|
tlen = key1\fstep - key0\fstep
|
||||||
|
t = (tstep - key0\fstep) / tlen
|
||||||
|
|
||||||
|
If key1\linear = 0 Then
|
||||||
|
|
||||||
|
;*** precompute hermite spline coefficients ***
|
||||||
|
|
||||||
|
t2 = t * t
|
||||||
|
t3 = t * t2
|
||||||
|
z = 3 * t2 - t3 - t3
|
||||||
|
|
||||||
|
h[0] = 1 - z
|
||||||
|
h[1] = z
|
||||||
|
h[2] = t3 - t2 - t2 + t
|
||||||
|
h[3] = t3 - t2
|
||||||
|
|
||||||
|
dd0a = (1 - key0\tens) * (1 + key0\cont) * (1 + key0\bias)
|
||||||
|
dd0b = (1 - key0\tens) * (1 - key0\cont) * (1 - key0\bias)
|
||||||
|
ds1a = (1 - key1\tens) * (1 - key1\cont) * (1 + key1\bias)
|
||||||
|
ds1b = (1 - key1\tens) * (1 + key1\cont) * (1 - key1\bias)
|
||||||
|
|
||||||
|
If key0\fstep <> 0 Then
|
||||||
|
d2 = (key1\fstep - m\keylist[key - 2]\fstep)
|
||||||
|
adj0 = tlen / d2
|
||||||
|
End If
|
||||||
|
|
||||||
|
If key1\fstep <> m\nsteps Then
|
||||||
|
d2 = (m\keylist[key+1]\fstep - key0\fstep)
|
||||||
|
adj1 = tlen / d2
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
;*** compute channel components and store in icv() ***
|
||||||
|
|
||||||
|
For i = 0 To nchannels-1
|
||||||
|
|
||||||
|
d10 = key1\cv[i] - key0\cv[i]
|
||||||
|
|
||||||
|
If key1\linear = 0 Then
|
||||||
|
|
||||||
|
If key0\fstep = 0 Then
|
||||||
|
dd0 = 0.5 * (dd0a + dd0b) * d10
|
||||||
|
Else
|
||||||
|
dd0 = adj0 * (dd0a * (key0\cv[i] - m\keylist[key - 2]\cv[i]) + dd0b * d10)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If key1\fstep = m\nsteps Then
|
||||||
|
ds1 = 0.5 * (ds1a + ds1b) * d10
|
||||||
|
Else
|
||||||
|
ds1 = adj1 * (ds1a * d10 + ds1b * ( m\keylist[key + 1]\cv[i] - key1\cv[i] ))
|
||||||
|
End If
|
||||||
|
|
||||||
|
icv(i) = (h[0] * key0\cv[i]) + (h[1] * key1\cv[i]) + (h[2] * dd0) + (h[3] * ds1)
|
||||||
|
|
||||||
|
Else
|
||||||
|
icv(i) = key0\cv[i] + t * d10
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
PositionEntity e,icv(0),icv(1),icv(2)
|
||||||
|
RotateEntity e,icv(3),icv(4),icv(5)
|
||||||
|
ScaleEntity e,icv(6),icv(7),icv(8)
|
||||||
|
|
||||||
|
End Function
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
Function Parse$(s$,o)
|
||||||
|
|
||||||
|
Local a$,d$,bb,b,e#,even
|
||||||
|
s=Trim(s)+" " : d="" : bb=0 : e=0 : even=True
|
||||||
|
|
||||||
|
For b=1 To Len(s)
|
||||||
|
|
||||||
|
a = Mid(s,b,1)
|
||||||
|
|
||||||
|
If a = "'" Then e=e+1 : even = ( (e/2) = Int(e/2) )
|
||||||
|
|
||||||
|
If a = " "
|
||||||
|
If even = True
|
||||||
|
bb=bb+1
|
||||||
|
If bb = o Then Return Trim( Replace(d,"'"," ") ) Else d=""
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
d=d+a
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
End Function
|
||||||
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 192 KiB |
@@ -0,0 +1,153 @@
|
|||||||
|
Global info1$="Grass Demo, by Adam Gore"
|
||||||
|
|
||||||
|
Include "../start.bb"
|
||||||
|
|
||||||
|
;Field of grass + kludged lens flare
|
||||||
|
|
||||||
|
Global gwidth = 640
|
||||||
|
Global gheight = 480
|
||||||
|
Global length = 16 ;up this if you have a *very* fast computer
|
||||||
|
Global ystep# = .005
|
||||||
|
Global an#
|
||||||
|
|
||||||
|
Dim plane( length-1 )
|
||||||
|
|
||||||
|
;Graphics3D gwidth,gheight
|
||||||
|
|
||||||
|
mesh_skybox = MakeSkyBox("Data\sky")
|
||||||
|
|
||||||
|
camera=CreateCamera()
|
||||||
|
CameraZoom camera,1
|
||||||
|
PositionEntity camera,0,.1,0
|
||||||
|
CameraFogMode camera,1
|
||||||
|
CameraFogRange camera,0,75
|
||||||
|
CameraFogColor camera,222,252,255
|
||||||
|
AmbientLight 255,255,255
|
||||||
|
|
||||||
|
ClearTextureFilters
|
||||||
|
|
||||||
|
tex=LoadTexture( "Data\Ground.bmp",9 )
|
||||||
|
ScaleTexture tex,4,4
|
||||||
|
tex1=LoadTexture( "Data\GrassClip.bmp",10 )
|
||||||
|
ScaleTexture tex1,1.5,1.5
|
||||||
|
ground = CreatePlane(1)
|
||||||
|
EntityTexture ground,tex : PositionEntity ground,0,-1-.005,0
|
||||||
|
EntityOrder ground,9
|
||||||
|
|
||||||
|
flare = CreatePivot( mesh_skybox )
|
||||||
|
PositionEntity flare,0,120,-300
|
||||||
|
|
||||||
|
s1 = LoadSprite("Data\lens1.jpg",2,camera) : EntityFX s1,9 : ScaleSprite s1,6,6 : EntityColor s1,255,255,242
|
||||||
|
s2 = LoadSprite("Data\lens2.jpg",2,camera) : EntityFX s2,9 : ScaleSprite s2,1.1,1.1 : EntityColor s2,255,255,220
|
||||||
|
s3 = LoadSprite("Data\lens3.jpg",2,camera) : EntityFX s3,9 : ScaleSprite s3,1.5,1.5 : EntityColor s3,255,255,200
|
||||||
|
s4 = LoadSprite("Data\lens4.jpg",2,camera) : EntityFX s4,9 : ScaleSprite s4,1.8,1.8 : EntityColor s4,255,255,180
|
||||||
|
|
||||||
|
For a#=0 To length-1
|
||||||
|
plane(a) = CreatePlane()
|
||||||
|
EntityTexture plane(a),tex1
|
||||||
|
PositionEntity plane(a),0,-1 + (a * ystep),0
|
||||||
|
EntityColor plane(a),32,96+((a/(length-1))*96),0
|
||||||
|
EntityAlpha plane(a),.5+((1-(a/(length-1)))*2)
|
||||||
|
EntityOrder plane(a),8
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
While Not KeyHit(1)
|
||||||
|
|
||||||
|
an=an+1 : If an>359 Then an=0
|
||||||
|
s# = Cos(an)/15000
|
||||||
|
For b = 0 To length-1
|
||||||
|
MoveEntity plane(b),s*b,0,0
|
||||||
|
Next
|
||||||
|
|
||||||
|
If KeyDown(203) TurnEntity camera,0,.5,0
|
||||||
|
If KeyDown(205) TurnEntity camera,0,-.5,0
|
||||||
|
If KeyDown(200) MoveEntity camera,0,0,.01
|
||||||
|
If KeyDown(208) MoveEntity camera,0,0,-.01
|
||||||
|
|
||||||
|
PositionEntity mesh_skybox,EntityX(camera,1),EntityY(camera,1),EntityZ(camera,1)
|
||||||
|
|
||||||
|
CameraProject( camera,EntityX(flare,1),EntityY(flare,1),EntityZ(flare,1) )
|
||||||
|
|
||||||
|
vx# = ProjectedX() - (gwidth/2)
|
||||||
|
vy# = ProjectedY() - (gheight/2)
|
||||||
|
|
||||||
|
sx = vx + (gwidth/2) : sy = vy + (gheight/2)
|
||||||
|
PositionEntity s1,SpriteX(sx,sy,128),SpriteY(sx,sy,128),SpriteZ(sx,sy,128)
|
||||||
|
sx = -vx/2 + (gwidth/2) : sy = -vy/2 + (gheight/2)
|
||||||
|
PositionEntity s2,SpriteX(sx,sy,128),SpriteY(sx,sy,128),SpriteZ(sx,sy,128)
|
||||||
|
sx = -vx/5 + (gwidth/2) : sy = -vy/5 + (gheight/2)
|
||||||
|
PositionEntity s3,SpriteX(sx,sy,128),SpriteY(sx,sy,128),SpriteZ(sx,sy,128)
|
||||||
|
sx = -vx/1.2 + (gwidth/2) : sy = -vy/1.2 + (gheight/2)
|
||||||
|
PositionEntity s4,SpriteX(sx,sy,128),SpriteY(sx,sy,128),SpriteZ(sx,sy,128)
|
||||||
|
|
||||||
|
RotateSprite s1,-EntityYaw(camera)
|
||||||
|
EntityAlpha s1,ProjectedZ()
|
||||||
|
EntityAlpha s2,1-(Abs(vx)/(gwidth/2))
|
||||||
|
EntityAlpha s3,1-(Abs(vx)/(gwidth/2))
|
||||||
|
EntityAlpha s4,1-(Abs(vx)/(gwidth/2))
|
||||||
|
|
||||||
|
UpdateWorld : RenderWorld : Flip
|
||||||
|
|
||||||
|
Wend
|
||||||
|
End
|
||||||
|
|
||||||
|
|
||||||
|
Function SpriteX#(x#,y#,size#)
|
||||||
|
Return 2.0*(x-(gwidth/2))/size
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function SpriteY#(x#,y#,size#)
|
||||||
|
Return -2.0*(y-(gheight/2))/size
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function SpriteZ#(x#,y#,size#)
|
||||||
|
Return 1*gwidth/size
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function MakeSkyBox( file$ )
|
||||||
|
|
||||||
|
m=CreateMesh()
|
||||||
|
;front face
|
||||||
|
b=LoadBrush( file$+"_FR.bmp",49 )
|
||||||
|
s=CreateSurface( m,b )
|
||||||
|
AddVertex s,-1,+1,-1,0,0:AddVertex s,+1,+1,-1,1,0
|
||||||
|
AddVertex s,+1,-1,-1,1,1:AddVertex s,-1,-1,-1,0,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
FreeBrush b
|
||||||
|
;right face
|
||||||
|
b=LoadBrush( file$+"_LF.bmp",49 )
|
||||||
|
s=CreateSurface( m,b )
|
||||||
|
AddVertex s,+1,+1,-1,0,0:AddVertex s,+1,+1,+1,1,0
|
||||||
|
AddVertex s,+1,-1,+1,1,1:AddVertex s,+1,-1,-1,0,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
FreeBrush b
|
||||||
|
;back face
|
||||||
|
b=LoadBrush( file$+"_BK.bmp",49 )
|
||||||
|
s=CreateSurface( m,b )
|
||||||
|
AddVertex s,+1,+1,+1,0,0:AddVertex s,-1,+1,+1,1,0
|
||||||
|
AddVertex s,-1,-1,+1,1,1:AddVertex s,+1,-1,+1,0,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
FreeBrush b
|
||||||
|
;left face
|
||||||
|
b=LoadBrush( file$+"_RT.bmp",49 )
|
||||||
|
s=CreateSurface( m,b )
|
||||||
|
AddVertex s,-1,+1,+1,0,0:AddVertex s,-1,+1,-1,1,0
|
||||||
|
AddVertex s,-1,-1,-1,1,1:AddVertex s,-1,-1,+1,0,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
FreeBrush b
|
||||||
|
;top face
|
||||||
|
b=LoadBrush( file$+"_UP.bmp",49 )
|
||||||
|
s=CreateSurface( m,b )
|
||||||
|
AddVertex s,-1,+1,+1,0,1:AddVertex s,+1,+1,+1,0,0
|
||||||
|
AddVertex s,+1,+1,-1,1,0:AddVertex s,-1,+1,-1,1,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
FreeBrush b
|
||||||
|
|
||||||
|
ScaleMesh m,100,100,100
|
||||||
|
FlipMesh m
|
||||||
|
EntityFX m,9
|
||||||
|
EntityOrder m,10
|
||||||
|
Return m
|
||||||
|
|
||||||
|
End Function
|
||||||
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1,47 @@
|
|||||||
|
B3D Motion
|
||||||
|
1
|
||||||
|
|
||||||
|
43
|
||||||
|
0 0 -3.5 -0.5 0 0 0 1 1 1 0 0 0 0
|
||||||
|
150 0 -0.470629 -2.5297 0 0 0 1 1 1 0 0 0 0
|
||||||
|
167 0 -0.522981 -2.52171 0 0 0 1 1 1 1 0 0 0
|
||||||
|
171 0.958085 -0.716145 -2.48438 0 0 0 1 1 1 0 0 0 0
|
||||||
|
200 1.51219 -0.738686 -1.96232 0 0 0 1 1 1 0 0 0 0
|
||||||
|
237 1.52886 -0.719809 -2.03154 0 0 0 1 1 1 0 0 0 0
|
||||||
|
240 0.321325 -0.829845 -2.92304 0 0 0 1 1 1 0 0 0 0
|
||||||
|
260 -1.52513 -0.836848 -1.98861 0 0 0 1 1 1 0 0 0 0
|
||||||
|
278 -1.00675 -1.44899 -2.07649 0 0 0 1 1 1 0 0 0 0
|
||||||
|
305 -1.25387 -1.57446 -1.85209 0 0 0 1 1 1 0 0 0 0
|
||||||
|
308 -0.609554 -1.01392 -2.71949 0 0 0 1 1 1 0 0 0 0
|
||||||
|
350 0.354631 -0.0334752 -2.77583 0 0 0 1 1 1 0 0 0 0
|
||||||
|
380 0.358189 -0.0632377 -2.77691 0 0 0 1 1 1 0 0 0 0
|
||||||
|
383 0.456466 0.564408 -2.14185 0 0 0 1 1 1 0 0 0 0
|
||||||
|
417 0.477513 0.42323 -2.18419 0 0 0 1 1 1 0 0 0 0
|
||||||
|
420 0.0741423 -0.311634 -2.33229 0 0 0 1 1 1 0 0 0 0
|
||||||
|
430 -0.017926 -0.436128 -2.50972 0 0 0 1 1 1 0 0 0 0
|
||||||
|
469 0.306361 -0.39294 -2.57877 0 0 0 1 1 1 0 0 0 0
|
||||||
|
475 -0.137182 -0.357213 -2.81308 0 0 0 1 1 1 0 0 0 0
|
||||||
|
509 -0.0556873 -0.205175 -2.78174 0 0 0 1 1 1 1 0 0 0
|
||||||
|
525 -0.131777 -0.265644 -2.56918 0 0 0 1 1 1 1 0 0 0
|
||||||
|
550 -0.28009 -0.210101 -2.79211 0 0 0 1 1 1 0 0 0 0
|
||||||
|
567 0.421664 -0.291219 -2.77164 0 0 0 1 1 1 0 0 0 0
|
||||||
|
570 1.6325 -0.101249 -2.894 0 0 0 1 1 1 0 0 0 0
|
||||||
|
578 -0.198501 -0.101249 -2.828 0 0 0 1 1 1 0 0 0 0
|
||||||
|
595 0.168654 -0.397583 -2.82165 0 0 0 1 1 1 0 0 0 0
|
||||||
|
598 -0.22373 -0.674645 -2.80221 0 0 0 1 1 1 0 0 0 0
|
||||||
|
623 -0.645492 -1.07459 -2.59725 0 0 0 1 1 1 0 0 0 0
|
||||||
|
626 0.757452 -0.990998 -2.81049 0 0 0 1 1 1 0 0 0 0
|
||||||
|
664 1.46444 -1.18952 -2.35778 0 0 0 1 1 1 0 0 0 0
|
||||||
|
667 -0.249983 -0.376726 -2.88461 0 0 0 1 1 1 0 0 0 0
|
||||||
|
675 -1.53541 -0.242485 -2.65174 0 0 0 1 1 1 0 0 0 0
|
||||||
|
717 -2.47551 0.298615 0.47294 0 0 0 1 1 1 0 0 0 0
|
||||||
|
720 -0.952826 -0.110404 -2.87295 0 0 0 1 1 1 0 0 0 0
|
||||||
|
737 3.7573 -0.154886 -1.62369 0 0 0 1 1 1 0 0 0 0
|
||||||
|
870 1.93996 -0.792957 -3.487 0 0 0 1 1 1 0 0 0 0
|
||||||
|
873 0.973901 -0.570356 -4.14927 0 0 0 1 1 1 0 0 0 0
|
||||||
|
880 -2.39797e-006 -0.312249 -4.42026 0 0 0 1 1 1 0 0 0 0
|
||||||
|
906 0.0459905 0.058743 -18.9254 0 0 0 1 1 1 0 0 0 0
|
||||||
|
961 0.0260615 -0.61869 -7.8196 0 0 0 1 1 1 1 0 0 0
|
||||||
|
965 0.0236648 -1.11771 -7.30184 0 0 0 1 1 1 0 0 0 0
|
||||||
|
969 0.0209974 -0.646219 -6.94435 0 0 0 1 1 1 0 0 0 0
|
||||||
|
1000 7.98762e-008 -5.47026 0.132249 0 0 0 1 1 1 0 0 0 0
|
||||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,54 @@
|
|||||||
|
B3D Motion
|
||||||
|
1
|
||||||
|
|
||||||
|
50
|
||||||
|
0 0 -1.5 0 -90 0 0 1 1 1 0 0 0 0
|
||||||
|
150 0 -0.18 -0.45 -25.7 0 0 1 1 1 0 1 0 0
|
||||||
|
170 0 -0.18 -0.45 -27.4 0 0 1 1 1 1 0 0 0
|
||||||
|
180 0 -0.18 -0.337 -21.3782 36.4728 0 1 1 1 0 -1 0 0
|
||||||
|
200 0 -0.18 -0.337 -21.3782 36.4728 0 1 1 1 0 0 0 0
|
||||||
|
240 0 -0.18 -0.337 -21.3782 36.4728 0 1 1 1 0 0 0 0
|
||||||
|
250 0 -0.18 -0.337 -25.6782 -33.3272 0 1 1 1 0 0 0 0
|
||||||
|
271 0 -0.18 -0.337 -21.5782 -26.8272 0 1 1 1 0 0 0 0
|
||||||
|
310 0 -0.18 -0.337 -25.6782 -33.3272 0 1 1 1 0 0 0 0
|
||||||
|
350 0 -0.18 -0.337 4.12175 16.8728 0 1 1 1 0 1 0 0
|
||||||
|
361 0 -0.18 -0.337 3.02175 17.2728 1.8 1 1 1 0 0 0 0
|
||||||
|
375 0 -0.18 -0.337 4.12175 16.8728 0 1 1 1 1 0 0 0
|
||||||
|
385 0 -0.18 -0.337 4.12175 16.8728 8.4 1 1 1 0 0 0 0
|
||||||
|
395 0 -0.18 -0.337 4.12175 16.8728 -8 1 1 1 0 0 0 0
|
||||||
|
405 0 -0.18 -0.337 4.12175 16.8728 12.8 1 1 1 0 0 0 0
|
||||||
|
415 0 -0.18 -0.337 4.12175 16.8728 -3.5 1 1 1 0 0 0 0
|
||||||
|
425 0 -0.18 -0.337 -24.8783 -6.9272 1.9 1 1 1 0 0 0 0
|
||||||
|
435 -0.008 -0.153 -0.6 -24.8783 -7.4272 1.9 1 1 1 0 0 0 0
|
||||||
|
465 -0.008 -0.153 -0.55 -26.1783 -7.5272 1.9 1 1 1 1 0 0 0
|
||||||
|
475 0.0185 -0.153 -0.6 -24.7783 13.7728 1.9 1 1 1 0 0 0 0
|
||||||
|
505 0.0185 -0.153 -0.6 -23.7783 13.3728 0.900002 1 1 1 1 0 0 0
|
||||||
|
530 0 -0.18 -0.45 -16.5783 -12.6272 0 1 1 1 0 0 0 0
|
||||||
|
550 0 -0.18 -0.45 1.89088 -17.0549 -0.195134 1 1 1 0 1 0 0
|
||||||
|
560 0 -0.18 -0.45 0 0 0 1 1 1 1 0 0 0
|
||||||
|
570 0 -0.18 -0.45 0 0 0 1 1 1 1 0 0 0
|
||||||
|
572 0 -0.18 -0.45 0 90 0 1 1 1 0 0 0 0
|
||||||
|
574 0 -0.18 -0.45 0 180 0 1 1 1 0 0 0 0
|
||||||
|
576 0 -0.18 -0.45 0 270 0 1 1 1 0 0 0 0
|
||||||
|
578 0 -0.18 -0.45 0 360 0 1 1 1 0 0 0 0
|
||||||
|
620 0 -0.18 -0.45 -16.4 355.3 9.89999 1 1 1 0 0 0 0
|
||||||
|
650 0 -0.18 -0.45 -25.7036 377.056 -12.4185 1 1 1 0 0 0 0
|
||||||
|
675 0 -0.18 -0.45 -8.4204 355.355 -2.65794 1 1 1 0 0 0 0
|
||||||
|
685 0 -0.18 -0.45 10.9852 233.906 -3.71967 1 1 1 0 0 0 0
|
||||||
|
710 0 -0.18 -0.45 12.2852 230.706 -3.71967 1 1 1 1 0 0 0
|
||||||
|
725 0 -0.18 -0.45 -3.01482 355.406 0 1 1 1 0 0 0 0
|
||||||
|
740 0 -0.18 -0.45 0.685183 445.506 0 1 1 1 0 0 0 0
|
||||||
|
750 0 -0.18 -0.45 0.685183 445.506 0 1 1 1 0 0 0 0
|
||||||
|
780 1.00258 -0.18 -0.45 -15.3148 507.206 0 1 1 1 0 0 0 0
|
||||||
|
800 1.047 -0.18 0.4115 -21.1148 556.907 0 1 1 1 0 0 0 0
|
||||||
|
820 0.1655 -0.18 1.1265 -16.9148 631.007 0 1 1 1 0 0 0 0
|
||||||
|
840 -1.1115 -0.18 0.667501 -15.3148 691.307 0 1 1 1 0 0 0 0
|
||||||
|
860 -0.7535 -0.18 -0.174499 -17.9148 779.406 0 1 1 1 0 0 0 0
|
||||||
|
880 0 -0.18 -0.45 0 720 0 1 1 1 0 0 0 0
|
||||||
|
890 0 -0.18 -0.45 0 720 0 1 1 1 0 0 0 0
|
||||||
|
910 0 -0.18 -0.45 1.42884 720 0 0.890169 0.832117 1.8 0 0 0 0
|
||||||
|
935 0 -0.18 -0.45 2.89952 720 0 0.714604 0.896981 -1 0 0 0 0
|
||||||
|
960 0 -0.18 -0.45 0 720 0 1 1 1 0 0 0 0
|
||||||
|
965 0 -0.18 -0.45 -17.8 720 0 1 1 1 0 0 0 0
|
||||||
|
970 0 -0.18 -0.45 0 720 0 1 1 1 0 0 0 0
|
||||||
|
1000 0 -1.5 0 -90 720 0 1 1 1 0 -1 0 0
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
;Kochanek-Bartels Splines
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
; VARIABLES
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Const nkeyframes = 100 ;maximum number of keyframes per motion
|
||||||
|
Const nchannels = 9 ;number of channel values
|
||||||
|
Dim icv#(nchannels-1) ;stores interpolated channel values
|
||||||
|
Global key0.KeyFrame, key1.KeyFrame
|
||||||
|
key0.KeyFrame = New keyframe : key1.KeyFrame = New keyframe
|
||||||
|
|
||||||
|
Type Motion
|
||||||
|
Field nkeys ;number of keyframes
|
||||||
|
Field nsteps ;last frame number
|
||||||
|
Field keylist.KeyFrame[nkeyframes-1];array of keyframes
|
||||||
|
End Type
|
||||||
|
|
||||||
|
Type KeyFrame
|
||||||
|
Field fstep ;frame number
|
||||||
|
Field cv#[nchannels-1] ;array of channel values (x y z h p b sx sy sz)
|
||||||
|
Field linear ;linear flag
|
||||||
|
Field tens# ;Kochanek-Bartels parameters
|
||||||
|
Field cont#
|
||||||
|
Field bias#
|
||||||
|
End Type
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
; FUNCTIONS
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Function Load_Motion( file$, m.Motion )
|
||||||
|
|
||||||
|
Local f,s$, i, ii
|
||||||
|
|
||||||
|
f = ReadFile( file )
|
||||||
|
If f = False Then Return False
|
||||||
|
|
||||||
|
If ReadLine$(f) <> "B3D Motion" Then Return False
|
||||||
|
If Int(ReadLine$(f)) <> "1" Then Return False
|
||||||
|
ReadLine$(f)
|
||||||
|
|
||||||
|
m\nkeys = Int(ReadLine$(f))
|
||||||
|
|
||||||
|
For i = 0 To m\nkeys ;read keyframe data
|
||||||
|
s$ = ReadLine$( f )
|
||||||
|
m\keylist[i] = New KeyFrame
|
||||||
|
m\keylist[i]\fstep = Int(Parse(s,1))
|
||||||
|
For ii = 0 To nchannels-1 : m\keylist[i]\cv[ii] = Float(Parse(s,2+ii)) : Next
|
||||||
|
m\keylist[i]\linear = Int(Parse(s,11))
|
||||||
|
m\keylist[i]\tens = Float(Parse(s,12))
|
||||||
|
m\keylist[i]\cont = Float(Parse(s,13))
|
||||||
|
m\keylist[i]\bias = Float(Parse(s,14))
|
||||||
|
Next
|
||||||
|
|
||||||
|
m\nsteps = m\keylist[m\nkeys-1]\fstep
|
||||||
|
|
||||||
|
CloseFile f
|
||||||
|
Return True
|
||||||
|
|
||||||
|
End Function
|
||||||
|
;------------------------------------------------------------------------
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------
|
||||||
|
Function Apply_Motion(m.Motion, tstep#, e)
|
||||||
|
|
||||||
|
Local dd0a#, dd0b#, ds1a#, ds1b#
|
||||||
|
Local adj0#, adj1#, dd0#, ds1#, d2#, t#, d10#
|
||||||
|
Local t2#, t3#, z#, h#[3]
|
||||||
|
Local i, tlen, key
|
||||||
|
|
||||||
|
;*** if there's only one key, the channel values are constant ***
|
||||||
|
|
||||||
|
If (m\nkeys = 1) Then
|
||||||
|
For i = 0 To nchannels-1 : icv(i) = m\keylist[0]\cv[i] : Next
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
;*** find keyframe pair to interpolate between ***
|
||||||
|
|
||||||
|
If tstep < m\keylist[0]\fstep Then Return
|
||||||
|
|
||||||
|
For key = 1 To m\nkeys
|
||||||
|
If tstep <= m\keylist[key]\fstep Then Exit
|
||||||
|
Next
|
||||||
|
key1 = m\keylist[key]
|
||||||
|
|
||||||
|
If key = m\nkeys Then Return
|
||||||
|
|
||||||
|
key0 = m\keylist[key - 1]
|
||||||
|
|
||||||
|
tlen = key1\fstep - key0\fstep
|
||||||
|
t = (tstep - key0\fstep) / tlen
|
||||||
|
|
||||||
|
If key1\linear = 0 Then
|
||||||
|
|
||||||
|
;*** precompute hermite spline coefficients ***
|
||||||
|
|
||||||
|
t2 = t * t
|
||||||
|
t3 = t * t2
|
||||||
|
z = 3 * t2 - t3 - t3
|
||||||
|
|
||||||
|
h[0] = 1 - z
|
||||||
|
h[1] = z
|
||||||
|
h[2] = t3 - t2 - t2 + t
|
||||||
|
h[3] = t3 - t2
|
||||||
|
|
||||||
|
dd0a = (1 - key0\tens) * (1 + key0\cont) * (1 + key0\bias)
|
||||||
|
dd0b = (1 - key0\tens) * (1 - key0\cont) * (1 - key0\bias)
|
||||||
|
ds1a = (1 - key1\tens) * (1 - key1\cont) * (1 + key1\bias)
|
||||||
|
ds1b = (1 - key1\tens) * (1 + key1\cont) * (1 - key1\bias)
|
||||||
|
|
||||||
|
If key0\fstep <> 0 Then
|
||||||
|
d2 = (key1\fstep - m\keylist[key - 2]\fstep)
|
||||||
|
adj0 = tlen / d2
|
||||||
|
End If
|
||||||
|
|
||||||
|
If key1\fstep <> m\nsteps Then
|
||||||
|
d2 = (m\keylist[key+1]\fstep - key0\fstep)
|
||||||
|
adj1 = tlen / d2
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
;*** compute channel components and store in icv() ***
|
||||||
|
|
||||||
|
For i = 0 To nchannels-1
|
||||||
|
|
||||||
|
d10 = key1\cv[i] - key0\cv[i]
|
||||||
|
|
||||||
|
If key1\linear = 0 Then
|
||||||
|
|
||||||
|
If key0\fstep = 0 Then
|
||||||
|
dd0 = 0.5 * (dd0a + dd0b) * d10
|
||||||
|
Else
|
||||||
|
dd0 = adj0 * (dd0a * (key0\cv[i] - m\keylist[key - 2]\cv[i]) + dd0b * d10)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If key1\fstep = m\nsteps Then
|
||||||
|
ds1 = 0.5 * (ds1a + ds1b) * d10
|
||||||
|
Else
|
||||||
|
ds1 = adj1 * (ds1a * d10 + ds1b * ( m\keylist[key + 1]\cv[i] - key1\cv[i] ))
|
||||||
|
End If
|
||||||
|
|
||||||
|
icv(i) = (h[0] * key0\cv[i]) + (h[1] * key1\cv[i]) + (h[2] * dd0) + (h[3] * ds1)
|
||||||
|
|
||||||
|
Else
|
||||||
|
icv(i) = key0\cv[i] + t * d10
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
PositionEntity e,icv(0),icv(1),icv(2)
|
||||||
|
RotateEntity e,icv(3),icv(4),icv(5)
|
||||||
|
ScaleEntity e,icv(6),icv(7),icv(8)
|
||||||
|
|
||||||
|
End Function
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
Function Parse$(s$,o)
|
||||||
|
|
||||||
|
Local a$,d$,bb,b,e#,even
|
||||||
|
s=Trim(s)+" " : d="" : bb=0 : e=0 : even=True
|
||||||
|
|
||||||
|
For b=1 To Len(s)
|
||||||
|
|
||||||
|
a = Mid(s,b,1)
|
||||||
|
|
||||||
|
If a = "'" Then e=e+1 : even = ( (e/2) = Int(e/2) )
|
||||||
|
|
||||||
|
If a = " "
|
||||||
|
If even = True
|
||||||
|
bb=bb+1
|
||||||
|
If bb = o Then Return Trim( Replace(d,"'"," ") ) Else d=""
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
d=d+a
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
End Function
|
||||||
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,90 @@
|
|||||||
|
Global info1$="The Head Demo, by Adam Gore"
|
||||||
|
|
||||||
|
Include "../start.bb"
|
||||||
|
Include "KBSplines.bb"
|
||||||
|
|
||||||
|
Const FPS = 24
|
||||||
|
Global fstep
|
||||||
|
|
||||||
|
period=1000/FPS
|
||||||
|
time=MilliSecs()-period
|
||||||
|
|
||||||
|
headmot.Motion = New Motion
|
||||||
|
eyetmot.Motion = New Motion
|
||||||
|
|
||||||
|
If Load_Motion( "Head.bbm", headmot ) = False Then RuntimeError "Error loading file" : End
|
||||||
|
If Load_Motion( "EyeFocus.bbm", eyetmot ) = False Then RuntimeError "Error loading file" : End
|
||||||
|
|
||||||
|
camera=CreateCamera()
|
||||||
|
CameraRange camera,.05,150
|
||||||
|
PositionEntity camera,0,0,-1
|
||||||
|
RotateEntity camera,0,0,0
|
||||||
|
|
||||||
|
mesh_head = LoadMesh("Head.x")
|
||||||
|
mesh_reye = LoadMesh("Eye.x",mesh_head)
|
||||||
|
brush=LoadBrush( "Eye.jpg",1)
|
||||||
|
BrushShininess brush,1
|
||||||
|
PaintMesh mesh_reye,brush
|
||||||
|
mesh_leye = CopyEntity(mesh_reye,mesh_head)
|
||||||
|
piv_eyet = CreatePivot(mead_hesh)
|
||||||
|
|
||||||
|
bkgd=CreateMesh()
|
||||||
|
s=CreateSurface(bkgd)
|
||||||
|
AddVertex s,+1,+1,+1,0,0:AddVertex s,-1,+1,+1,1,0
|
||||||
|
AddVertex s,-1,-1,+1,1,1:AddVertex s,+1,-1,+1,0,1
|
||||||
|
AddTriangle s,0,1,2:AddTriangle s,0,2,3
|
||||||
|
ScaleMesh bkgd,130,130,100;225,225,225
|
||||||
|
EntityFX bkgd,1
|
||||||
|
FlipMesh bkgd
|
||||||
|
EntityOrder bkgd,10
|
||||||
|
|
||||||
|
PositionEntity mesh_reye,-.058,.256,-.146
|
||||||
|
PositionEntity mesh_leye,.058,.256,-.146
|
||||||
|
|
||||||
|
tex0=LoadTexture("Face.jpg")
|
||||||
|
tex1=LoadTexture("Reflection.jpg",64)
|
||||||
|
tex2=LoadTexture("Bkgd.jpg")
|
||||||
|
EntityTexture mesh_head,tex0
|
||||||
|
EntityTexture bkgd,tex2
|
||||||
|
|
||||||
|
AmbientLight 5,5,5
|
||||||
|
light1=CreateLight(1)
|
||||||
|
LightColor light1,255,255,255
|
||||||
|
RotateEntity light1,0,60,0
|
||||||
|
light2=CreateLight(1)
|
||||||
|
LightColor light2,200,0,0
|
||||||
|
RotateEntity light2,-5,-95,0
|
||||||
|
|
||||||
|
fstep = 1
|
||||||
|
Apply_Motion(headmot,fstep,mesh_head)
|
||||||
|
Apply_Motion(eyetmot,fstep,piv_eyet)
|
||||||
|
|
||||||
|
While KeyHit(1)<>True
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
elapsed=MilliSecs()-time
|
||||||
|
Until elapsed
|
||||||
|
|
||||||
|
ticks=elapsed/period
|
||||||
|
tween#=Float(elapsed Mod period)/Float(period)
|
||||||
|
|
||||||
|
For k=1 To ticks
|
||||||
|
time=time+period
|
||||||
|
If k=ticks Then CaptureWorld
|
||||||
|
|
||||||
|
fstep = fstep + 1 : If fstep > headmot\nsteps Then fstep = 1
|
||||||
|
Apply_Motion(headmot,fstep,mesh_head)
|
||||||
|
Apply_Motion(eyetmot,fstep,piv_eyet)
|
||||||
|
PointEntity mesh_reye,piv_eyet : PointEntity mesh_leye,piv_eyet
|
||||||
|
TurnEntity bkgd,0,0,1
|
||||||
|
If fstep = 574 EntityTexture mesh_head,tex1
|
||||||
|
If fstep = 1 EntityTexture mesh_head,tex0
|
||||||
|
|
||||||
|
UpdateWorld
|
||||||
|
Next
|
||||||
|
|
||||||
|
RenderWorld tween
|
||||||
|
Flip
|
||||||
|
|
||||||
|
Wend
|
||||||
|
End
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
SetGfx()
|
||||||
|
|
||||||
|
Function SetGfx()
|
||||||
|
Print info1$:Print info2$:Print info3$:Print info4$:Print
|
||||||
|
If Windowed3D()
|
||||||
|
yn$=Input$( "Use windowed mode?" )
|
||||||
|
If Left$( Lower$( yn$ ),1 )="y"
|
||||||
|
HidePointer
|
||||||
|
Graphics3D 640,480,0,2
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
Return
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
Print ""
|
||||||
|
Print "Display drivers:"
|
||||||
|
Print "----------------"
|
||||||
|
For k=1 To CountGfxDrivers()
|
||||||
|
Print k+":"+GfxDriverName$(k)
|
||||||
|
Next
|
||||||
|
Print
|
||||||
|
|
||||||
|
If CountGfxDrivers()>1
|
||||||
|
Repeat
|
||||||
|
driver=Input$( "Display driver (1-"+CountGfxDrivers()+"):" )
|
||||||
|
Until driver>=1 And driver<=CountGfxDrivers()
|
||||||
|
SetGfxDriver driver
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
cnt=CountGfxModes3D()
|
||||||
|
If cnt=0 Print "No 3D Graphics modes detected.":WaitKey:End
|
||||||
|
|
||||||
|
Print ""
|
||||||
|
Print "Display modes:"
|
||||||
|
Print "--------------"
|
||||||
|
For k=1 To CountGfxModes3D()
|
||||||
|
Print k+":"+GfxModeWidth(k)+","+GfxModeHeight(k)+","+GfxModeDepth(k)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
mode=Input$( "Display Mode (1-"+cnt+"):" )
|
||||||
|
Until mode>=1 And mode<=cnt
|
||||||
|
|
||||||
|
Graphics3D GfxModeWidth(mode),GfxModeHeight(mode),GfxModeDepth(mode),1
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
|
||||||
|
End Function
|
||||||
@@ -0,0 +1,440 @@
|
|||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; An exercise in atmosphere...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
; Run it at night with the lights off (NOT during the day!).
|
||||||
|
|
||||||
|
; Use MOUSE and CURSORS, QIII-style...
|
||||||
|
|
||||||
|
; DO NOT try to learn anything from this program, apart from the effects
|
||||||
|
; of tweaking various parameters, perhaps. This is a serious hack-job!
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; It's ugly down there, men...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Type Timer
|
||||||
|
Field start
|
||||||
|
Field timeOut
|
||||||
|
End Type
|
||||||
|
|
||||||
|
Function SetTimer.Timer (timeOut)
|
||||||
|
t.Timer = New Timer
|
||||||
|
t\start = MilliSecs ()
|
||||||
|
t\timeOut = t\start + timeOut
|
||||||
|
Return t
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function TimeOut (test.Timer)
|
||||||
|
If test <> Null
|
||||||
|
If test\timeOut < MilliSecs ()
|
||||||
|
Delete test
|
||||||
|
Return 1
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
End Function
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Lens stuff...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Global lensDiameter = 25
|
||||||
|
Include "incs/lensIncs.bb"
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Graphics/light...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Global dWidth = 640
|
||||||
|
Global dHeight = 480
|
||||||
|
|
||||||
|
Graphics3D dWidth, dHeight
|
||||||
|
SetBuffer BackBuffer ()
|
||||||
|
|
||||||
|
AmbientLight 0, 0, 0
|
||||||
|
|
||||||
|
wind = LoadSound ("snd/seawind2.wav")
|
||||||
|
sea = LoadSound ("snd/wavdance.wav")
|
||||||
|
rain = LoadSound ("snd/rainroof.wav")
|
||||||
|
thunder1 = LoadSound ("snd/thunder.wav")
|
||||||
|
thunder2 = LoadSound ("snd/txstorm.wav")
|
||||||
|
run = LoadSound ("snd/gravel.wav")
|
||||||
|
wade = LoadSound ("snd/water2.wav")
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; 747...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Function CenterPivot (model)
|
||||||
|
FitMesh model, 0, 0, 0, MeshWidth (model), MeshHeight (model), MeshDepth (model)
|
||||||
|
modelPivot = CreatePivot ()
|
||||||
|
PositionEntity modelPivot, MeshWidth (model) / 2, MeshHeight (model) / 2, MeshDepth (model) / 2
|
||||||
|
EntityParent model, modelPivot
|
||||||
|
Return modelPivot
|
||||||
|
End Function
|
||||||
|
|
||||||
|
gimme747 = 1;0
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Don't ask...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
If gimme747
|
||||||
|
b747Model = LoadMesh ("msh/747.x")
|
||||||
|
EntityShininess b747Model, 0.1
|
||||||
|
b747 = CenterPivot (b747Model)
|
||||||
|
ScaleEntity b747, 600, 600, 600 ; 500
|
||||||
|
PositionEntity b747, 3750, 400, 1300
|
||||||
|
RotateEntity b747, 3, 45, -1
|
||||||
|
scaler = 2
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Terrain...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
terrain = LoadTerrain ("gfx/height.bmp")
|
||||||
|
ScaleEntity terrain, 5, 150, 5
|
||||||
|
TerrainShading terrain, True
|
||||||
|
TerrainDetail terrain, 2500, True
|
||||||
|
grass = LoadTexture ("gfx/greygrass.bmp")
|
||||||
|
ScaleTexture grass, 20, 20
|
||||||
|
EntityTexture terrain, grass, 0, 1
|
||||||
|
MoveEntity terrain, 0, -4, 0
|
||||||
|
|
||||||
|
seabed = CreatePlane ()
|
||||||
|
EntityTexture seabed, grass
|
||||||
|
MoveEntity seabed, 0, -3.9, 0
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Water...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
water = CreatePlane ()
|
||||||
|
h20 = LoadTexture ("gfx/greywater.bmp")
|
||||||
|
EntityAlpha water, 0.75
|
||||||
|
PositionEntity water, 0, 2.5, 0
|
||||||
|
ScaleTexture h20, 200, 200
|
||||||
|
EntityTexture water, h20
|
||||||
|
EntityColor water, 64, 64, 64
|
||||||
|
EntityShininess water, 0.05
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Camera and fog...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
cam = CreatePivot ()
|
||||||
|
EntityRadius cam, 2
|
||||||
|
|
||||||
|
camera = CreateCamera (cam)
|
||||||
|
CameraViewport camera, 0, 0, dWidth, dHeight
|
||||||
|
CameraFogMode camera, 1
|
||||||
|
CameraFogRange camera, 1, 1600; * scaler
|
||||||
|
CameraFogColor camera, 0, 0, 0;75, 75, 75
|
||||||
|
CameraRange camera, 1, 1600 * scaler
|
||||||
|
PositionEntity cam, 2340, 0, 2390 ; 1394, 0, 4660 ;1298, 0, 4653 ; 3750, 45, 1370
|
||||||
|
|
||||||
|
dome = CreateSphere (12)
|
||||||
|
clouds = LoadTexture ("gfx/realsky.bmp")
|
||||||
|
;ScaleEntity dome, 1300 * scaler, 1300 * scaler, 1300 * scaler
|
||||||
|
ScaleEntity dome, 1600 * scaler, 1600 * scaler, 1600 * scaler
|
||||||
|
EntityTexture dome, clouds
|
||||||
|
ScaleTexture clouds, 0.25, 0.25
|
||||||
|
EntityOrder dome, 1
|
||||||
|
FlipMesh dome
|
||||||
|
EntityAlpha dome, 0.25
|
||||||
|
EntityFX dome, 8
|
||||||
|
|
||||||
|
flash = CreateLight ()
|
||||||
|
LightColor flash, 0, 0, 0
|
||||||
|
PositionEntity flash, 1900, 100, 0
|
||||||
|
RotateEntity flash, 90, 0, 0
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Collisions...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Const ENTITY_TERRAIN = 1
|
||||||
|
Const ENTITY_CAM = 2
|
||||||
|
Const ENTITY_PLANE = 3
|
||||||
|
|
||||||
|
EntityType terrain, ENTITY_TERRAIN
|
||||||
|
EntityType cam, ENTITY_CAM
|
||||||
|
|
||||||
|
If gimme747
|
||||||
|
EntityType b747Model, ENTITY_PLANE
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
Collisions ENTITY_CAM, ENTITY_TERRAIN, 2, 2
|
||||||
|
Collisions ENTITY_CAM, ENTITY_PLANE, 2, 2
|
||||||
|
|
||||||
|
Function CurveValue#(current#,destination#,curve)
|
||||||
|
current#=current#+((destination#-current#)/curve)
|
||||||
|
Return current#
|
||||||
|
End Function
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Main loop...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
FPS = 50
|
||||||
|
|
||||||
|
period = 1000 / FPS
|
||||||
|
time = MilliSecs () - period
|
||||||
|
|
||||||
|
SoundVolume wind, 0.25
|
||||||
|
SoundVolume sea, 0.65
|
||||||
|
SoundVolume rain, 0.75
|
||||||
|
SoundVolume run, 0
|
||||||
|
SoundVolume wade, 0
|
||||||
|
|
||||||
|
LoopSound wind
|
||||||
|
LoopSound sea
|
||||||
|
LoopSound rain
|
||||||
|
LoopSound run
|
||||||
|
LoopSound wade
|
||||||
|
|
||||||
|
PlaySound wind
|
||||||
|
PlaySound sea
|
||||||
|
PlaySound rain
|
||||||
|
runChannel = PlaySound (run)
|
||||||
|
wadeChannel = PlaySound (wade)
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Lens stuff...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
diameter = lensDiameter
|
||||||
|
magnification = 5
|
||||||
|
|
||||||
|
CreateLens (diameter, magnification)
|
||||||
|
|
||||||
|
dropx# = 0
|
||||||
|
dropy# = 0
|
||||||
|
|
||||||
|
dropx2# = 0
|
||||||
|
dropy2# = 0
|
||||||
|
|
||||||
|
sky# = 0
|
||||||
|
|
||||||
|
startlite# = 0
|
||||||
|
foglite# = 0
|
||||||
|
sunlite# = 0
|
||||||
|
|
||||||
|
;CameraFogColor camera, 36, 36, 36
|
||||||
|
|
||||||
|
; Titles...
|
||||||
|
horror = LoadSprite ("gfx/di.bmp", 48, camera)
|
||||||
|
ScaleSprite horror, 9, 5
|
||||||
|
PositionEntity horror, 0, 0, 10
|
||||||
|
horrorAlpha# = 0
|
||||||
|
EntityAlpha horror, horrorAlpha
|
||||||
|
showHorror = 1
|
||||||
|
|
||||||
|
steps# = 1.5
|
||||||
|
|
||||||
|
HidePointer
|
||||||
|
|
||||||
|
;chapel = LoadMesh ("G:\My Documents\Temp\chapel.x")
|
||||||
|
;RotateEntity chapel, -90, 0, 0
|
||||||
|
;PositionEntity chapel, 0, 400, 0
|
||||||
|
;EntityShininess chapel, 0
|
||||||
|
|
||||||
|
disclaimer$ = "Run it at night or you won't see a thing :)"
|
||||||
|
SetFont LoadFont ("arial")
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
|
||||||
|
If startlite < 40
|
||||||
|
startlite = startlite + 0.5
|
||||||
|
AmbientLight startlite, startlite, startlite
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If makesun = 0
|
||||||
|
sun = CreateLight ()
|
||||||
|
LightColor sun, 0, 0, 0
|
||||||
|
PositionEntity sun, 3000, 500, 3000
|
||||||
|
RotateEntity sun, 45, 0, 0
|
||||||
|
makesun = 1
|
||||||
|
Else
|
||||||
|
; Titles... requesting the services of Major Hack... Major Hack, you're needed for some titles...
|
||||||
|
If Not noMoreHorror
|
||||||
|
EntityAlpha horror, horrorAlpha
|
||||||
|
If Not reduce
|
||||||
|
If horrorAlpha <= 1
|
||||||
|
horrorAlpha = horrorAlpha + 0.05
|
||||||
|
Else
|
||||||
|
reduce = 1
|
||||||
|
EndIf
|
||||||
|
Else
|
||||||
|
If horrorAlpha => 0
|
||||||
|
horrorAlpha = horrorAlpha - 0.005
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
If horrorAlpha <= 0
|
||||||
|
FreeEntity horror
|
||||||
|
noMoreHorror = 1
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If sunlite < 70
|
||||||
|
sunlite = sunlite + 0.5
|
||||||
|
If sun
|
||||||
|
LightColor sun, sunlite, sunlite, sunlite
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If foglite < 20
|
||||||
|
foglite = foglite + 0.5
|
||||||
|
CameraFogColor camera, foglite, foglite, foglite
|
||||||
|
CameraClsColor camera, foglite, foglite, foglite
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
elapsed = MilliSecs () - time
|
||||||
|
Until elapsed
|
||||||
|
|
||||||
|
ticks = elapsed / period
|
||||||
|
|
||||||
|
tween# = Float (elapsed Mod period) / Float (period)
|
||||||
|
|
||||||
|
For framelimit = 1 To ticks
|
||||||
|
|
||||||
|
If framelimit = ticks Then CaptureWorld
|
||||||
|
time = time + period
|
||||||
|
|
||||||
|
PositionEntity cam, EntityX (cam), TerrainY (terrain, EntityX (cam), EntityY (cam), EntityZ (cam)) + 25, EntityZ (cam)
|
||||||
|
|
||||||
|
mxs = MouseXSpeed()
|
||||||
|
mys = MouseYSpeed()
|
||||||
|
|
||||||
|
dest_xang# = dest_xang + mys
|
||||||
|
dest_yang# = dest_yang - mxs
|
||||||
|
|
||||||
|
xang# = CurveValue (xang, dest_xang, 5)
|
||||||
|
yang# = CurveValue (yang, dest_yang, 5)
|
||||||
|
|
||||||
|
RotateEntity camera, xang, 0, 0
|
||||||
|
RotateEntity cam, 0, yang, 0
|
||||||
|
|
||||||
|
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
|
||||||
|
|
||||||
|
running# = 0
|
||||||
|
|
||||||
|
If KeyDown (200)
|
||||||
|
MoveEntity cam, 0, 0, steps
|
||||||
|
running = Rnd (0.35, 0.75)
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If KeyDown (208)
|
||||||
|
MoveEntity cam, 0, 0, -steps
|
||||||
|
running = Rnd (0.55, 0.95)
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If running > 0
|
||||||
|
ChannelPitch runChannel, Rnd (8000, 14000)
|
||||||
|
ChannelPitch wadeChannel, Rnd (7000, 9000)
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
wading# = 0
|
||||||
|
|
||||||
|
If running
|
||||||
|
If EntityY (cam) < EntityY (water) + 24
|
||||||
|
wading = Rnd (0.5, 1)
|
||||||
|
running = 0
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
ChannelVolume wadeChannel, wading
|
||||||
|
ChannelVolume runChannel, running
|
||||||
|
|
||||||
|
PositionEntity dome, EntityX (cam), EntityY (cam), EntityZ (cam)
|
||||||
|
TurnEntity dome, 0.005, 0.025, 0.005
|
||||||
|
|
||||||
|
UpdateWorld
|
||||||
|
|
||||||
|
; Mark's code, hacked cluelessly...
|
||||||
|
PositionEntity water, Sin (time * 0.01) * 10, (EntityY (water) + (Sin (time * 0.05) * 0.2) * 0.25), Cos (time * 0.02) * 10
|
||||||
|
|
||||||
|
If (Rnd (1000) > 998.8) Or (KeyDown (28))
|
||||||
|
startlite = 0
|
||||||
|
sunlite = 40;255;10
|
||||||
|
sky = 255
|
||||||
|
foglite = 255
|
||||||
|
thunderGo = 1
|
||||||
|
thunderTimer.Timer = SetTimer (Rnd (500, 1500))
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If thunderGo
|
||||||
|
If TimeOut (thunderTimer)
|
||||||
|
If Rnd (0, 2) > 1
|
||||||
|
thunder = thunder1
|
||||||
|
Else thunder = thunder2
|
||||||
|
EndIf
|
||||||
|
SoundPitch thunder, Rnd (9000, 14000)
|
||||||
|
PlaySound thunder
|
||||||
|
thunderGo = 0
|
||||||
|
Delete thunderTimer
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If sky > 10
|
||||||
|
sky = sky - Rnd (5, 20)
|
||||||
|
EndIf
|
||||||
|
LightColor flash, sky, sky, sky
|
||||||
|
|
||||||
|
If foglite > 20
|
||||||
|
foglite = foglite - 10
|
||||||
|
If foglite < 20 Then foglite = 20
|
||||||
|
EndIf
|
||||||
|
CameraClsColor camera, foglite, foglite, foglite
|
||||||
|
; CameraFogColor camera, foglite, foglite, foglite
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
; W is for Wireframe...
|
||||||
|
If KeyHit (17)
|
||||||
|
w = 1 - w
|
||||||
|
WireFrame w
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
RenderWorld tween
|
||||||
|
|
||||||
|
If Not nomorehorror
|
||||||
|
Text (GraphicsWidth () / 2) - (StringWidth (disclaimer$) / 2), GraphicsHeight () - (StringHeight (disclaimer$) * 2), disclaimer$
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
; Raindrops on lens...
|
||||||
|
If dropy <= GraphicsHeight () - diameter - 2
|
||||||
|
DrawLens (dropx, dropy, diameter)
|
||||||
|
dropy = dropy + 2
|
||||||
|
Else
|
||||||
|
dropx = Rnd (0, GraphicsWidth () - diameter)
|
||||||
|
dropy = 0
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If dropy2 <= GraphicsHeight () - diameter - 7
|
||||||
|
DrawLens (dropx2, dropy2, diameter)
|
||||||
|
dropy2 = dropy2 + 7
|
||||||
|
Else
|
||||||
|
dropx2 = Rnd (0, GraphicsWidth () - diameter)
|
||||||
|
dropy2 = 0
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
; Text 20, 20, EntityX (cam)
|
||||||
|
; Text 20, 40, EntityY (cam)
|
||||||
|
; Text 20, 60, EntityZ (cam)
|
||||||
|
|
||||||
|
Flip
|
||||||
|
|
||||||
|
; If KeyDown (57)
|
||||||
|
; SaveBuffer FrontBuffer (), "grab" + grab + ".bmp"
|
||||||
|
; grab = grab + 1
|
||||||
|
; EndIf
|
||||||
|
|
||||||
|
Until KeyDown (1)
|
||||||
|
|
||||||
|
End
|
||||||
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 3.0 MiB |
|
After Width: | Height: | Size: 133 KiB |
@@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
; ---------------------------
|
||||||
|
; (Don't try to run this! :)
|
||||||
|
; ---------------------------
|
||||||
|
|
||||||
|
; --------------
|
||||||
|
; How to use...
|
||||||
|
; --------------
|
||||||
|
|
||||||
|
; ---------------------------
|
||||||
|
; At the start of your code:
|
||||||
|
; ---------------------------
|
||||||
|
|
||||||
|
Global lensDiameter = 25 ; This line MUST come before the include line!!!
|
||||||
|
Include "lensIncs.bb"
|
||||||
|
|
||||||
|
; --------------------------------
|
||||||
|
; Somwhere before your main loop:
|
||||||
|
; --------------------------------
|
||||||
|
|
||||||
|
; ----------------------------------------------------------------------
|
||||||
|
; Set the amount to magnify (haven't quite figured this out -- a little
|
||||||
|
; under half of lensDiameter seems to work well):
|
||||||
|
; ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
magnification = 5
|
||||||
|
|
||||||
|
; ----------------------------------------------------------------------
|
||||||
|
; Do some pre-calc stuff:
|
||||||
|
; ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
CreateLens (lensDiameter, magnification)
|
||||||
|
|
||||||
|
; --------------------------------------------
|
||||||
|
; During your main loop, before calling Flip:
|
||||||
|
; --------------------------------------------
|
||||||
|
|
||||||
|
DrawLens (MouseX (), MouseY (), lensDiameter)
|
||||||
|
|
||||||
|
; ----------------------------------------------------------------
|
||||||
|
; MouseX () and MouseY () make a good demo, but change to suit...
|
||||||
|
; ----------------------------------------------------------------
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
Dim Tfm (lensDiameter * lensDiameter * 2)
|
||||||
|
Dim Org (lensDiameter * lensDiameter * 2, 3)
|
||||||
|
Dim Dest (lensDiameter * lensDiameter * 2, 3)
|
||||||
|
|
||||||
|
Function CreateLens (diameter, magnification)
|
||||||
|
r = Int (diameter / 2)
|
||||||
|
s# = Sqr# (r * r - magnification * magnification)
|
||||||
|
For y = -r To -r + (diameter)
|
||||||
|
For x = -r To r + (diameter - 1)
|
||||||
|
If (x * x + y * y) >= (s * s)
|
||||||
|
a = x
|
||||||
|
b = y
|
||||||
|
Else
|
||||||
|
z = Sqr# (r * r - x * x - y * y)
|
||||||
|
a = Int (x * magnification / z + 0.5)
|
||||||
|
b = Int (y * magnification / z + 0.5)
|
||||||
|
EndIf
|
||||||
|
Tfm (1 + (y + r) * diameter + (x + r)) = (b + r) * diameter + (a + r)
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function DrawLens (x, y, diameter)
|
||||||
|
LockBuffer BackBuffer ()
|
||||||
|
For i = x To (x + diameter) - 1
|
||||||
|
For j = y To (y + diameter) - 1
|
||||||
|
rgb = ReadPixelFast (i, j)
|
||||||
|
Org (cx, 1) = rgb Shr 16 And %11111111
|
||||||
|
Org (cx, 2) = rgb Shr 8 And %11111111
|
||||||
|
Org (cx, 3) = rgb And %11111111
|
||||||
|
cx = cx + 1
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
cx = 1
|
||||||
|
For i = x To (x + diameter) - 1
|
||||||
|
For j = y To (y + diameter) - 1
|
||||||
|
Dest (cx, 1) = Org (Tfm (cx), 1)
|
||||||
|
Dest (cx, 2) = Org (Tfm (cx), 2)
|
||||||
|
Dest (cx, 3) = Org (Tfm (cx), 3)
|
||||||
|
WritePixelFast i, j, Dest (cx, 3) Or (Dest (cx, 2) Shl 8) Or (Dest (cx, 1) Shl 16)
|
||||||
|
Plot (i, j)
|
||||||
|
cx = cx + 1
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
UnlockBuffer BackBuffer ()
|
||||||
|
End Function
|
||||||
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 3.0 MiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 192 KiB |
@@ -0,0 +1,429 @@
|
|||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Testbed thing -- HIGHLY UNFINISHED AND MESSY!
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
; Features
|
||||||
|
|
||||||
|
; Tracking gun emplacements (they aim ahead, depending on player's speed)
|
||||||
|
; Updating loadsa stuff via For... Each loops:
|
||||||
|
; - Enemy shots
|
||||||
|
; - Player shots
|
||||||
|
; - Fading of all flames
|
||||||
|
; - Enemies only fire within certain range
|
||||||
|
; Sprites-for-shots 'n' flames
|
||||||
|
; Blitz terrain
|
||||||
|
; Awful controls
|
||||||
|
|
||||||
|
; If you have a M$ control pad, you might need to turn off the tilt mode
|
||||||
|
; cos it makes things go all loopy!
|
||||||
|
|
||||||
|
noAliens = 50; 25;10
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Graphics/light...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Global dWidth =1024
|
||||||
|
Global dHeight = 768
|
||||||
|
|
||||||
|
Graphics3D dWidth, dHeight
|
||||||
|
SetBuffer BackBuffer ()
|
||||||
|
|
||||||
|
;AntiAlias True
|
||||||
|
|
||||||
|
AmbientLight 200, 200, 200
|
||||||
|
sun = CreateLight ()
|
||||||
|
LightColor sun, 255, 220, 180
|
||||||
|
RotateEntity sun, 0, 45, 0
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Terrain...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
terrain = LoadTerrain ("gfx/height.bmp")
|
||||||
|
ScaleEntity terrain, 5, 300, 5
|
||||||
|
TerrainShading terrain, True
|
||||||
|
TerrainDetail terrain, 2500, True
|
||||||
|
EntityPickMode terrain, 2, True
|
||||||
|
grass = LoadTexture ("gfx/grass.bmp")
|
||||||
|
ScaleTexture grass, 20, 20
|
||||||
|
EntityTexture terrain, grass, 0, 1
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Hack me an alien gun thing... ball with cylinder sticking out
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Type Alien
|
||||||
|
Field entity
|
||||||
|
End Type
|
||||||
|
|
||||||
|
ballAlien = CreateSphere ()
|
||||||
|
ScaleEntity ballAlien, 4, 4, 4
|
||||||
|
EntityColor ballAlien, 64, 64, 64
|
||||||
|
EntityShininess ballAlien, 1
|
||||||
|
ballAlienGun = CreateCylinder (12, 1, ballAlien)
|
||||||
|
ScaleEntity ballAlienGun, 0.25, 2.5, 0.25
|
||||||
|
MoveEntity ballAlienGun, 0, 0, 2
|
||||||
|
RotateEntity ballAlienGun, 90, 0, 0
|
||||||
|
EntityColor ballAlienGun, 32, 32, 32
|
||||||
|
EntityShininess ballAlienGun, 1
|
||||||
|
EntityPickMode ballAlien, 1, True
|
||||||
|
EntityRadius ballAlien, 9
|
||||||
|
Const ENTITY_ALIEN = 5
|
||||||
|
EntityType ballAlien, ENTITY_ALIEN
|
||||||
|
HideEntity ballAlien
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Copy alien x times...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
For a = 1 To noAliens
|
||||||
|
ball.Alien = New Alien
|
||||||
|
ball\entity = CopyEntity (ballAlien): ShowEntity ball\entity
|
||||||
|
bx = Rnd (TerrainSize (terrain) * 5)
|
||||||
|
bz = Rnd (TerrainSize (terrain) * 5)
|
||||||
|
PositionEntity ball\entity, bx, TerrainY (terrain, bx, 0, bz) + 1, bz
|
||||||
|
Next
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Water...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
water = CreatePlane ()
|
||||||
|
h20 = LoadTexture ("gfx/water.bmp")
|
||||||
|
ScaleTexture h20, 200, 200
|
||||||
|
EntityTexture water, h20
|
||||||
|
EntityAlpha water, 0.4
|
||||||
|
PositionEntity water, 0, 20, 0
|
||||||
|
EntityShininess water, 1
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Camera and fog...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Global cam = CreatePivot ()
|
||||||
|
Global camera = CreateCamera (cam)
|
||||||
|
CameraViewport camera, 0, 0, dWidth, dHeight
|
||||||
|
CameraFogMode camera, 1
|
||||||
|
CameraFogColor camera, 200, 220, 255
|
||||||
|
range = 2500
|
||||||
|
CameraRange camera, 1, range
|
||||||
|
CameraFogRange camera, 1, range - 10
|
||||||
|
CameraClsColor camera, 200, 220, 255
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Player...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Global ship = CreatePivot ()
|
||||||
|
Global shipMesh = LoadMesh ("msh/ship.x", ship)
|
||||||
|
MoveEntity shipMesh, -2.5, 0, -1
|
||||||
|
ScaleEntity shipMesh, 0.5, 0.5, 0.5
|
||||||
|
EntityRadius ship, 1.6
|
||||||
|
EntityShininess shipMesh, 1
|
||||||
|
|
||||||
|
Global aliensTarget = CreatePivot (ship) ; Sphere (5, ship)
|
||||||
|
MoveEntity aliensTarget, 0, 0, 200
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Attach camera to player...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
PositionEntity cam, 0, EntityY (ship) + 0.85, -4
|
||||||
|
EntityParent cam, ship
|
||||||
|
PositionEntity ship, 10, 50, 10
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; 2D stuff...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
; Target...
|
||||||
|
target = LoadImage ("gfx/target.bmp")
|
||||||
|
MaskImage target, 255, 0, 255
|
||||||
|
MidHandle target
|
||||||
|
|
||||||
|
; Flame...
|
||||||
|
Global fire = LoadSprite ("gfx/fire.bmp")
|
||||||
|
HandleSprite fire, 0, -1
|
||||||
|
ScaleSprite fire, 5, 5
|
||||||
|
EntityAlpha fire, 0.25
|
||||||
|
EntityFX fire, 8
|
||||||
|
HideEntity fire
|
||||||
|
|
||||||
|
; Splash...
|
||||||
|
Global splash = LoadSprite ("gfx/splash.bmp")
|
||||||
|
HandleSprite splash, 0, -1
|
||||||
|
ScaleSprite splash, 5, 5
|
||||||
|
EntityAlpha splash, 0.25
|
||||||
|
EntityFX splash, 8
|
||||||
|
HideEntity splash
|
||||||
|
|
||||||
|
; Alien shot...
|
||||||
|
Global afire = LoadSprite ("gfx/ashot.bmp")
|
||||||
|
HandleSprite afire, 0, -1
|
||||||
|
ScaleSprite afire, 3, 3
|
||||||
|
EntityFX afire, 8
|
||||||
|
EntityRadius afire, 4
|
||||||
|
HideEntity afire
|
||||||
|
|
||||||
|
Global hits
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Collisions...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Const ENTITY_TERRAIN = 1
|
||||||
|
Const ENTITY_SHIP = 2
|
||||||
|
Const ENTITY_WATER = 3
|
||||||
|
Const ENTITY_AFIRE = 4
|
||||||
|
|
||||||
|
EntityType terrain, ENTITY_TERRAIN
|
||||||
|
EntityType ship, ENTITY_SHIP
|
||||||
|
EntityType water, ENTITY_WATER
|
||||||
|
EntityType afire, ENTITY_AFIRE
|
||||||
|
|
||||||
|
Collisions ENTITY_SHIP, ENTITY_TERRAIN, 2, 2
|
||||||
|
Collisions ENTITY_SHIP, ENTITY_WATER, 2, 2
|
||||||
|
Collisions ENTITY_AFIRE, ENTITY_SHIP, 1, 1
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Auto-updated entity functions...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Type Flame
|
||||||
|
Field entity
|
||||||
|
Field alpha#
|
||||||
|
End Type
|
||||||
|
|
||||||
|
Function CreateFlame (x#, y#, z#, image)
|
||||||
|
flame.Flame = New Flame
|
||||||
|
flame\entity = CopyEntity (image): ShowEntity flame\entity
|
||||||
|
PositionEntity flame\entity, x, y, z
|
||||||
|
flame\alpha = 1
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function UpdateFlames ()
|
||||||
|
For a.Flame = Each Flame
|
||||||
|
a\alpha = a\alpha - 0.001
|
||||||
|
EntityAlpha a\entity, a\alpha
|
||||||
|
If a\alpha < 0.01 Then FreeEntity a\entity: Delete a
|
||||||
|
Next
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Type AlienShot
|
||||||
|
Field entity ; 'afire' sprite
|
||||||
|
Field alpha#
|
||||||
|
End Type
|
||||||
|
|
||||||
|
Function AlienShoot (a.Alien, image)
|
||||||
|
aShot.AlienShot = New AlienShot
|
||||||
|
aShot\entity = CopyEntity (image): ShowEntity aShot\entity
|
||||||
|
RotateEntity aShot\entity, EntityPitch (a\entity) + Rnd (-1, 1), EntityYaw (a\entity) + Rnd (-1, 1), 0;EntityRoll (a\entity) + Rnd (-1, 1)
|
||||||
|
PositionEntity aShot\entity, EntityX (a\entity), EntityY (a\entity), EntityZ (a\entity)
|
||||||
|
aShot\alpha = 1
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function UpdateAlienShots ()
|
||||||
|
For a.AlienShot = Each AlienShot
|
||||||
|
MoveEntity a\entity, 0, 0, 5
|
||||||
|
If EntityCollided (a\entity, ENTITY_SHIP)
|
||||||
|
; CreateFlame (EntityX (shipMesh), EntityY (shipMesh), EntityZ (shipMesh), fire)
|
||||||
|
hits = hits + 1
|
||||||
|
EndIf
|
||||||
|
a\alpha = a\alpha - 0.0025
|
||||||
|
EntityAlpha a\entity, a\alpha
|
||||||
|
If a\alpha < 0.01 Then FreeEntity a\entity: Delete a
|
||||||
|
Next
|
||||||
|
End Function
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Reduce roll rate to zero...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Function Diminish# (value#, amount#)
|
||||||
|
If Abs (value) <= Abs (amount) Then Return 0
|
||||||
|
value = value - (amount * Sgn (value))
|
||||||
|
Return value
|
||||||
|
End Function
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Player control variables...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
Global zAcc# = 0
|
||||||
|
Global shipRoll# = 0
|
||||||
|
Global shipPitch# = 0
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; Main loop...
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
MoveMouse GraphicsWidth () / 2, GraphicsHeight () / 2
|
||||||
|
|
||||||
|
Global topSpeed = 3
|
||||||
|
FPS = 50
|
||||||
|
|
||||||
|
period = 1000 / FPS
|
||||||
|
time = MilliSecs () - period
|
||||||
|
|
||||||
|
Global kills
|
||||||
|
Global damage
|
||||||
|
|
||||||
|
;WireFrame 1
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
elapsed = MilliSecs () - time
|
||||||
|
Until elapsed
|
||||||
|
|
||||||
|
ticks = elapsed / period
|
||||||
|
|
||||||
|
tween# = Float (elapsed Mod period) / Float (period)
|
||||||
|
|
||||||
|
For framelimit = 1 To ticks
|
||||||
|
If framelimit = ticks Then CaptureWorld
|
||||||
|
time = time + period
|
||||||
|
UpdateGame ()
|
||||||
|
UpdateWorld
|
||||||
|
PositionEntity water, Sin (time * 0.01) * 10, EntityY (water) + (Sin (time * 0.05) * 0.5) * 0.2, Cos (time * 0.02) * 10
|
||||||
|
Next
|
||||||
|
|
||||||
|
If KeyHit (17)
|
||||||
|
w = 1 - w
|
||||||
|
WireFrame w
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
RenderWorld tween
|
||||||
|
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
; Draw target...
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
|
||||||
|
x = (MouseX () - x) / 3 + x
|
||||||
|
y = (MouseY () - y) / 3 + y
|
||||||
|
|
||||||
|
DrawImage target, x, y
|
||||||
|
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
; Instructions...
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
|
||||||
|
Text 20, GraphicsHeight () - 60, "Cursors to move"
|
||||||
|
Text 20, GraphicsHeight () - 40, "Right mouse button to accelerate"
|
||||||
|
Text 20, GraphicsHeight () - 20, "Mouse + left button to fire"
|
||||||
|
|
||||||
|
; Text 20, 20, EntityX (shipMesh)
|
||||||
|
; Text 20, 40, EntityY (shipMesh)
|
||||||
|
; Text 20, 60, EntityZ (shipMesh)
|
||||||
|
|
||||||
|
Text 20, 80, "Kills: " + kills + " dead alien scum"
|
||||||
|
Text 20, 100, "Hits: " + "Hit by aliens " + hits + " times"
|
||||||
|
Text 20, 120, "Ground damage: " + damage
|
||||||
|
|
||||||
|
Flip
|
||||||
|
|
||||||
|
Until KeyDown (1)
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Function UpdateGame ()
|
||||||
|
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
; Left/right/up/down...
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
|
||||||
|
If KeyDown (203) Or JoyXDir () = -1
|
||||||
|
If shipRoll < 2 Then shipRoll = shipRoll + 0.125
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If KeyDown (205) Or JoyXDir () = 1
|
||||||
|
If shipRoll > -2 Then shipRoll = shipRoll - 0.125
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If KeyDown (200) Or JoyYDir () = -1
|
||||||
|
If shipPitch < 1 Then shipPitch = shipPitch + 0.02
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If KeyDown (208) Or JoyYDir () = 1
|
||||||
|
If shipPitch > -3 Then shipPitch = shipPitch - 0.023
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
; Speed up/slow down...
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
|
||||||
|
If MouseDown (2) Or JoyDown (8)
|
||||||
|
If zAcc < topSpeed Then zAcc = zAcc + 0.05
|
||||||
|
Else
|
||||||
|
If zAcc > 0.025 Then zAcc = zAcc - (0.025 * zAcc / 10)
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
; Ship "inertia"...
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
|
||||||
|
shipRoll = Diminish (shipRoll, 0.05)
|
||||||
|
shipRoll = shipRoll + Rnd (-0.075, 0.075)
|
||||||
|
shipPitch = Diminish (shipPitch, 0.0125)
|
||||||
|
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
; Position player and camera...
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
|
||||||
|
TurnEntity ship, shipPitch, 0, shipRoll
|
||||||
|
; TurnEntity ship, 0, ((Sin (EntityRoll (ship))) / topSpeed) * zAcc, 0, 1
|
||||||
|
TurnEntity ship, 0, 2 * (((Sin (EntityRoll (ship))) / topSpeed) * zAcc), 0, 1
|
||||||
|
TurnEntity cam, 0, EntityRoll (ship) / 90, 0, 1
|
||||||
|
MoveEntity ship, 0, 0, zAcc
|
||||||
|
PointEntity cam, ship
|
||||||
|
|
||||||
|
PositionEntity aliensTarget, 0, 0, 5 + zAcc * 50
|
||||||
|
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
; Fire button...
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
|
||||||
|
If MouseDown (1) Or JoyDown (1)
|
||||||
|
pickedEntity = CameraPick (camera, MouseX (), MouseY ())
|
||||||
|
If pickedEntity
|
||||||
|
For a.Alien = Each Alien
|
||||||
|
If pickedEntity = a\entity Then kills = kills + 1: FreeEntity a\entity: Delete a: Exit
|
||||||
|
Next
|
||||||
|
CreateFlame (PickedX (), PickedY (), PickedZ (), fire)
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
; Player-to-terrain collision check...
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
|
||||||
|
If EntityCollided (ship, ENTITY_TERRAIN)
|
||||||
|
CreateFlame (EntityX (ship), EntityY (ship), EntityZ (ship), fire)
|
||||||
|
damage = damage + 1
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If EntityCollided (ship, ENTITY_WATER)
|
||||||
|
CreateFlame (EntityX (ship), EntityY (ship), EntityZ (ship), splash)
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
; Aliens fire at player... sorta :)
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
|
||||||
|
For gun.Alien = Each Alien
|
||||||
|
PointEntity gun\entity, aliensTarget;ship
|
||||||
|
If Rnd (1000) > 950 And EntityDistance (gun\entity, ship) < 750
|
||||||
|
AlienShoot (gun, afire)
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
; Auto-update stuff...
|
||||||
|
; -----------------------------------------------------------
|
||||||
|
|
||||||
|
UpdateFlames ()
|
||||||
|
UpdateAlienShots ()
|
||||||
|
|
||||||
|
End Function
|
||||||
@@ -0,0 +1,221 @@
|
|||||||
|
;======================================================
|
||||||
|
;================== BY MATT DAVEY =====================
|
||||||
|
;============= www.fusionstudio.f2s.com ===============
|
||||||
|
;======================================================
|
||||||
|
|
||||||
|
;Wood texture used courtesy of Noctua Graphics
|
||||||
|
;www.noctua-graphics.de or www.hisoft.co.uk
|
||||||
|
|
||||||
|
Graphics3D 640 , 480 , 32
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
|
||||||
|
SeedRnd MilliSecs()
|
||||||
|
|
||||||
|
Const CT_BALL = 1
|
||||||
|
Const CT_PLANE = 2
|
||||||
|
|
||||||
|
Collisions CT_BALL , CT_PLANE , 2 , 0
|
||||||
|
|
||||||
|
;=================================== [ Data Structures ]
|
||||||
|
|
||||||
|
Type Ball
|
||||||
|
Field Entity
|
||||||
|
Field x# , y# , z#
|
||||||
|
Field xs# , ys# , zs#
|
||||||
|
Field r , g , b
|
||||||
|
End Type
|
||||||
|
|
||||||
|
Type Spark
|
||||||
|
Field Sprite
|
||||||
|
Field x# , y# , z#
|
||||||
|
Field Alpha#
|
||||||
|
End Type
|
||||||
|
|
||||||
|
;============================================== [ Vars ]
|
||||||
|
|
||||||
|
Local sysFpsTimer1#
|
||||||
|
Local sysFpsTimer2#
|
||||||
|
Local sysFps
|
||||||
|
|
||||||
|
Ground = LoadMesh("Plane.3ds")
|
||||||
|
|
||||||
|
PositionEntity(Ground , 0 , 0 , 0)
|
||||||
|
EntityType(Ground , CT_PLANE)
|
||||||
|
RotateMesh(Ground , 0 , 0 , 0)
|
||||||
|
ScaleMesh(Ground , 2 , 2 , 2)
|
||||||
|
EntityColor(Ground , 128 , 128 , 128)
|
||||||
|
|
||||||
|
GroundTexture = LoadTexture("planks02.jpg")
|
||||||
|
EntityTexture(Ground , GroundTexture)
|
||||||
|
|
||||||
|
Global SparkTemplate = LoadSprite("spark.bmp")
|
||||||
|
|
||||||
|
ScaleSprite(SparkTemplate , 15 , 15)
|
||||||
|
SpriteViewMode(SparkTemplate , 2)
|
||||||
|
RotateEntity(SparkTemplate , 90 , 0 , 0)
|
||||||
|
PositionEntity(SparkTemplate , 0 , -1000 , 0)
|
||||||
|
EntityBlend(SparkTemplate,3)
|
||||||
|
|
||||||
|
Local CamPivot = CreatePivot()
|
||||||
|
|
||||||
|
Local Cam = CreateCamera(CamPivot)
|
||||||
|
|
||||||
|
PositionEntity(Cam , 0 , 30 , -100)
|
||||||
|
PointEntity(Cam , Ground)
|
||||||
|
|
||||||
|
DirectionLight1 = CreateLight(1)
|
||||||
|
LightColor(DirectionLight1 , -128 , -128 , -128)
|
||||||
|
RotateEntity(DirectionLight1 , 0 , 180 , 0)
|
||||||
|
|
||||||
|
DirectionLight2 = CreateLight(1)
|
||||||
|
|
||||||
|
FrameTimer = CreateTimer(60)
|
||||||
|
|
||||||
|
StartTime = MilliSecs()
|
||||||
|
|
||||||
|
Repeat ;================================== [ Main Loop ]
|
||||||
|
|
||||||
|
CurTime = MilliSecs()
|
||||||
|
|
||||||
|
If CurTime > StartTime + (5000 - sysFps * 50)
|
||||||
|
CreateBall()
|
||||||
|
StartTime = MilliSecs()
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
TurnEntity(CamPivot , 0 , 0.3 , 0)
|
||||||
|
|
||||||
|
UpdateBalls(0.05)
|
||||||
|
UpdateSparks()
|
||||||
|
|
||||||
|
If KeyHit(17)
|
||||||
|
WireMode = Not WireMode
|
||||||
|
WireFrame WireMode
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
UpdateWorld()
|
||||||
|
RenderWorld()
|
||||||
|
|
||||||
|
sysFpsTimer2# = MilliSecs()
|
||||||
|
sysFps = 1.0 / ( (sysFpsTimer2 - sysFpsTimer1 ) / 1000.0)
|
||||||
|
|
||||||
|
sysFpsTimer1 = sysFpsTimer2
|
||||||
|
|
||||||
|
WaitTimer(FrameTimer)
|
||||||
|
|
||||||
|
If KeyHit(57) Then SaveBuffer(FrontBuffer(),"scrn.bmp")
|
||||||
|
|
||||||
|
Flip True
|
||||||
|
Until KeyHit(1); Or MouseXSpeed()<>0 Or MouseYSpeed()<>0
|
||||||
|
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
;======================================== [ Functions ]
|
||||||
|
|
||||||
|
Function UpdateBalls(Gravity#)
|
||||||
|
|
||||||
|
For instance.Ball = Each Ball
|
||||||
|
|
||||||
|
If Not instance = Null
|
||||||
|
|
||||||
|
instance\x# = instance\x# + instance\xs#
|
||||||
|
instance\z# = instance\z# + instance\zs#
|
||||||
|
|
||||||
|
instance\ys# = instance\ys# - Gravity#
|
||||||
|
instance\y# = instance\y# + instance\ys#
|
||||||
|
|
||||||
|
If EntityCollided(instance\Entity , CT_PLANE)
|
||||||
|
|
||||||
|
CreateSpark(instance\x# , instance\z# , instance\r , instance\g , instance\b)
|
||||||
|
|
||||||
|
instance\ys# = Abs(instance\ys# / 1.08)
|
||||||
|
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
PositionEntity(instance\Entity , instance\x# , instance\y# , instance\z#)
|
||||||
|
|
||||||
|
If instance\y# < -400
|
||||||
|
FreeEntity instance\Entity
|
||||||
|
Delete instance
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
;====================================================
|
||||||
|
|
||||||
|
Function CreateSpark(x# , z# , r , g , b)
|
||||||
|
|
||||||
|
instance.Spark = New Spark
|
||||||
|
|
||||||
|
instance\Sprite = CopyEntity(SparkTemplate)
|
||||||
|
instance\x# = x#
|
||||||
|
instance\z# = z#
|
||||||
|
instance\Alpha = 1.0
|
||||||
|
|
||||||
|
EntityColor(instance\Sprite , r , g , b)
|
||||||
|
PositionEntity(instance\Sprite , x# , 0.07 , z#)
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
;====================================================
|
||||||
|
|
||||||
|
Function UpdateSparks()
|
||||||
|
|
||||||
|
For instance.Spark = Each Spark
|
||||||
|
|
||||||
|
If Not instance = Null
|
||||||
|
|
||||||
|
instance\Alpha = instance\Alpha - 0.01
|
||||||
|
EntityAlpha(instance\Sprite , instance\Alpha)
|
||||||
|
|
||||||
|
If instance\Alpha <= 0
|
||||||
|
|
||||||
|
FreeEntity instance\Sprite
|
||||||
|
Delete instance
|
||||||
|
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
;====================================================
|
||||||
|
|
||||||
|
Function CreateBall()
|
||||||
|
|
||||||
|
Ball.Ball = New Ball
|
||||||
|
|
||||||
|
Ball\Entity = CreateSphere()
|
||||||
|
EntityType(Ball\Entity , CT_BALL)
|
||||||
|
ScaleEntity(Ball\Entity , 3 , 3 , 3)
|
||||||
|
EntityRadius(Ball\Entity , 4)
|
||||||
|
EntityShininess(Ball\Entity , 5.0)
|
||||||
|
|
||||||
|
Ball\x# = 0
|
||||||
|
Ball\y# = 80
|
||||||
|
Ball\z# = 0
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
|
||||||
|
Ball\xs# = Rnd(-0.3 , 0.3)
|
||||||
|
Ball\ys# = 0
|
||||||
|
Ball\zs# = Rnd(-0.3 , 0.3)
|
||||||
|
|
||||||
|
Until (Ball\xs# > 0.2 Or Ball\xs# < -0.2) Or (Ball\zs# > 0.2 Or ball\zs# < -0.2)
|
||||||
|
|
||||||
|
Ball\r = Rnd(255)
|
||||||
|
Ball\g = Rnd(255)
|
||||||
|
Ball\b = Rnd(255)
|
||||||
|
|
||||||
|
EntityColor(Ball\Entity , Ball\r , Ball\g , Ball\b)
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
;====================================================
|
||||||
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,249 @@
|
|||||||
|
;-----------------------------------------------------------------------
|
||||||
|
; Big Bang 1.b
|
||||||
|
; 07/31/01
|
||||||
|
;
|
||||||
|
; Written By Richard R Betson
|
||||||
|
; www.redeyeware.50megs.com
|
||||||
|
; vidiot@getgoin.net
|
||||||
|
; Copyright 2001, Richard Betson
|
||||||
|
;-----------------------------------------------------------------------
|
||||||
|
AppTitle "Big Bang 1.b"
|
||||||
|
Include "../start.bb"
|
||||||
|
|
||||||
|
AmbientLight 150,150,150
|
||||||
|
|
||||||
|
Dim sphere(2)
|
||||||
|
|
||||||
|
|
||||||
|
alpha#=1
|
||||||
|
inc#=0
|
||||||
|
os#=1
|
||||||
|
sx#=2
|
||||||
|
sy#=2
|
||||||
|
|
||||||
|
|
||||||
|
Global sky1
|
||||||
|
Global sky2
|
||||||
|
time=MilliSecs()+6000
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Camera
|
||||||
|
;----------------------------------
|
||||||
|
c_pivot=CreatePivot() ;Camera Pivot
|
||||||
|
camera=CreateCamera(c_pivot) ;Create Camera
|
||||||
|
PositionEntity camera,0,-8,13.5 ;Position camera
|
||||||
|
CameraZoom camera,1.4 ;Zoom in jus a bit
|
||||||
|
CameraRange camera,.1,150 ;Limit camera range
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Textures
|
||||||
|
;----------------------------------
|
||||||
|
texture1=CreateTexture(64,64)
|
||||||
|
SetBuffer TextureBuffer(texture1)
|
||||||
|
Color 128,255,32
|
||||||
|
For y=0 To 64 Step 8
|
||||||
|
For x=0 To 64
|
||||||
|
Rect x,y,1,1,1
|
||||||
|
Rect y,x,1,1,1
|
||||||
|
Rect y-x,x,1,1
|
||||||
|
Rect (64-y)+x,x,1,1
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Pressure Waves
|
||||||
|
;----------------------------------
|
||||||
|
texture1=LoadTexture("gate4.bmp",9)
|
||||||
|
s_pivot=CreatePivot()
|
||||||
|
sphere1=CreateSphere(10,s_pivot)
|
||||||
|
EntityTexture sphere1,texture1
|
||||||
|
;EntityFX sphere1,1
|
||||||
|
EntityBlend sphere1,3
|
||||||
|
ScaleEntity sphere1,.1,.1,.1
|
||||||
|
UpdateNormals sphere1
|
||||||
|
TurnEntity sphere1,58,0,0
|
||||||
|
PointEntity camera,sphere1
|
||||||
|
For i=0 To 2
|
||||||
|
sphere(i)=CopyEntity(sphere1)
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Sun
|
||||||
|
;----------------------------------
|
||||||
|
sun=LoadSprite("bigspark.bmp",8)
|
||||||
|
ScaleSprite sun,.2,.2
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Ring
|
||||||
|
;----------------------------------
|
||||||
|
ring=LoadSprite("ring2.bmp",8)
|
||||||
|
ScaleSprite ring,.2,.2
|
||||||
|
SpriteViewMode ring,2
|
||||||
|
PositionEntity ring,0,0,-1
|
||||||
|
TurnEntity ring,0,120,0
|
||||||
|
HideEntity ring
|
||||||
|
|
||||||
|
|
||||||
|
make_sky()
|
||||||
|
|
||||||
|
FreeEntity sphere1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
i=0
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Main Loop
|
||||||
|
;----------------------------------
|
||||||
|
While Not KeyHit(1)
|
||||||
|
sx=sx-.005
|
||||||
|
sy=sy-.005
|
||||||
|
os=os-.0025
|
||||||
|
|
||||||
|
If os>0 And go=0 And stm2<MilliSecs()
|
||||||
|
ScaleSprite sun,sx+Rnd#(os),sy+Rnd#(os)
|
||||||
|
stm2=MilliSecs+1
|
||||||
|
stm=MilliSecs()+200
|
||||||
|
Else
|
||||||
|
|
||||||
|
If stm>MilliSecs()
|
||||||
|
ShowEntity ring
|
||||||
|
ScaleSprite sun,20,20
|
||||||
|
Else
|
||||||
|
go=1
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If sky_tm<MilliSecs()
|
||||||
|
TurnEntity sky1,0,.2,0
|
||||||
|
TurnEntity sky2,0,.3,0
|
||||||
|
sky_tm=MilliSecs()+40
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If go=1
|
||||||
|
If tm<MilliSecs()
|
||||||
|
ScaleSprite sun,20-(inc*2),20-(inc*2)
|
||||||
|
EntityAlpha sun,alpha
|
||||||
|
If inc#>3 Then inc#=inc+.12 Else inc=inc+.14
|
||||||
|
swap#=swap+.1
|
||||||
|
alpha#=alpha-.011
|
||||||
|
tm=MilliSecs()+18
|
||||||
|
EndIf
|
||||||
|
If inc<16
|
||||||
|
i=0
|
||||||
|
ScaleEntity sphere(i),inc+inc2#,inc+inc2#,inc+inc2#
|
||||||
|
EntityAlpha sphere(i),alpha
|
||||||
|
TurnEntity sphere(i),0,0,-.5
|
||||||
|
UpdateNormals sphere(i)
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
If inc>1.5 And inc<18
|
||||||
|
i=1
|
||||||
|
ScaleEntity sphere(i),inc-1.5+inc2#,inc-1.5+inc2#,inc-1.5+inc2#
|
||||||
|
EntityAlpha sphere(i),alpha+.2
|
||||||
|
TurnEntity sphere(i),0,0,.5
|
||||||
|
UpdateNormals sphere(i)
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
If inc>3
|
||||||
|
i=2
|
||||||
|
ScaleEntity sphere(i),inc-3+inc2#,inc-3+inc2#,inc-3+inc2#
|
||||||
|
EntityAlpha sphere(i),alpha+.4
|
||||||
|
TurnEntity sphere(i),0,0,-1
|
||||||
|
UpdateNormals sphere(i)
|
||||||
|
ScaleSprite ring,(inc*2)-3,(inc*2)-3
|
||||||
|
EntityAlpha ring,alpha+.4
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
If inc>26
|
||||||
|
inc=0
|
||||||
|
alpha=1
|
||||||
|
ScaleSprite sun,3,3
|
||||||
|
EntityAlpha sun,1
|
||||||
|
HideEntity ring
|
||||||
|
go=0
|
||||||
|
os#=1
|
||||||
|
sx#=2
|
||||||
|
sy#=2
|
||||||
|
stm=MilliSecs()+200
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
UpdateWorld
|
||||||
|
RenderWorld
|
||||||
|
|
||||||
|
If time>MilliSecs()
|
||||||
|
Color 255,0,0
|
||||||
|
Text 10,10,"Big Bang * Written By Richard Betson"
|
||||||
|
Text 10,25,"www.redeyeware.50megs.com"
|
||||||
|
Color 64,255,32
|
||||||
|
Text 10,40,"Press Escape to Exit."
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
Flip
|
||||||
|
|
||||||
|
Wend
|
||||||
|
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Function make_sky()
|
||||||
|
;---------------------------------
|
||||||
|
;Create Texture for Sky (STARS)
|
||||||
|
;---------------------------------
|
||||||
|
heaven=CreateTexture(128,128,1)
|
||||||
|
SetBuffer TextureBuffer(heaven)
|
||||||
|
For i=0 To 150
|
||||||
|
If Rnd(100)>80
|
||||||
|
Color 32,32,255
|
||||||
|
Else
|
||||||
|
Color 255,255,255
|
||||||
|
EndIf
|
||||||
|
Plot Rnd(256),Rnd(256)
|
||||||
|
Next
|
||||||
|
|
||||||
|
heaven2=CreateTexture(128,128,1)
|
||||||
|
SetBuffer TextureBuffer(heaven2)
|
||||||
|
For i=0 To 80
|
||||||
|
If Rnd(100)>80
|
||||||
|
Color 255,32,32
|
||||||
|
Else
|
||||||
|
Color 255,255,255
|
||||||
|
EndIf
|
||||||
|
Plot Rnd(256),Rnd(256)
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------
|
||||||
|
;Create Spheres for Sky
|
||||||
|
;Set Entity and Texture Flags
|
||||||
|
;---------------------------------
|
||||||
|
|
||||||
|
sky1=CreateSphere()
|
||||||
|
ScaleTexture heaven,.16,.16
|
||||||
|
EntityTexture sky1,heaven,0,0;Apply Multiple Textures to Sphere
|
||||||
|
FlipMesh sky1 ;Flip Mesh (Texture) to face the inside of Sphere
|
||||||
|
ScaleEntity sky1,90,90,90 ;Scale the Sphere
|
||||||
|
EntityFX sky1,1 ;Set to FullBright
|
||||||
|
|
||||||
|
|
||||||
|
sky2=CreateSphere()
|
||||||
|
ScaleTexture heaven2,.16,.20
|
||||||
|
EntityTexture sky2,heaven2,0,0
|
||||||
|
FlipMesh sky2
|
||||||
|
ScaleEntity sky2,80,80,80
|
||||||
|
EntityAlpha sky2,.4
|
||||||
|
EntityFX sky2,1
|
||||||
|
|
||||||
|
End Function
|
||||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 192 KiB |
@@ -0,0 +1,163 @@
|
|||||||
|
;-----------------------------------------------------------------------
|
||||||
|
; Binary Cage 1.1 (multi-texture)
|
||||||
|
; 07/17/01
|
||||||
|
; Written By Richard R Betson
|
||||||
|
; Copyright, 2001 Richard R Betson
|
||||||
|
; www.redeyeware.50megs.com
|
||||||
|
; vidiot@getgoin.net
|
||||||
|
;-----------------------------------------------------------------------
|
||||||
|
AppTitle "Binary Cage"
|
||||||
|
Include "../start.bb"
|
||||||
|
;Graphics3D 640,480,16
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Variables
|
||||||
|
;----------------------------------
|
||||||
|
Dim boxes(40)
|
||||||
|
z=60
|
||||||
|
y=-5
|
||||||
|
x=-5
|
||||||
|
Global speed#=.3 ;Camera Pull-Back speed
|
||||||
|
Global C_Rotation#=.7 ;Camera Rotation speed
|
||||||
|
|
||||||
|
AmbientLight 200,200,200 ;Set lighting
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Textures
|
||||||
|
;----------------------------------
|
||||||
|
texture1=CreateTexture(64,64)
|
||||||
|
SetBuffer TextureBuffer(texture1)
|
||||||
|
;Color 32,255,64
|
||||||
|
Color 255,32,64
|
||||||
|
Rect 0,0,64,64,1
|
||||||
|
Color 0,0,0
|
||||||
|
;Color 255,255,255
|
||||||
|
Rect 1,1,62,62,1
|
||||||
|
|
||||||
|
font=LoadFont("Arial",18,False,False,False)
|
||||||
|
SetFont font
|
||||||
|
;texture2=CreateTexture(64,64,1)
|
||||||
|
;SetBuffer TextureBuffer(texture2)
|
||||||
|
;Color 255,255,255
|
||||||
|
;Color 0,0,0
|
||||||
|
;Rect 0,0,64,64
|
||||||
|
Color 32,32,200
|
||||||
|
Text 0,32,"3D"
|
||||||
|
Text 0,48,"BB-3D"
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Camera
|
||||||
|
;----------------------------------
|
||||||
|
c_pivot=CreatePivot()
|
||||||
|
camera=CreateCamera(c_pivot)
|
||||||
|
CameraZoom camera,.7
|
||||||
|
CameraRange camera,.1,30
|
||||||
|
CameraFogMode camera,1
|
||||||
|
CameraFogColor camera,16,0,128
|
||||||
|
CameraFogRange camera,10,60
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Boxes for Cage
|
||||||
|
;----------------------------------
|
||||||
|
box=CreateCube()
|
||||||
|
EntityTexture box,texture1,0,0
|
||||||
|
;EntityTexture box,texture2,0,1
|
||||||
|
UpdateNormals box
|
||||||
|
ScaleEntity box,5,5,5
|
||||||
|
EntityBlend box,3
|
||||||
|
EntityFX box,1
|
||||||
|
FlipMesh box
|
||||||
|
|
||||||
|
;hw=True
|
||||||
|
;HWMultiTex hw
|
||||||
|
|
||||||
|
;TextureBlend texture1,1
|
||||||
|
;TextureBlend texture2,3
|
||||||
|
|
||||||
|
;EntityBlend box,1
|
||||||
|
|
||||||
|
cage_pivot1=CreatePivot()
|
||||||
|
cage_pivot2=CreatePivot()
|
||||||
|
|
||||||
|
For b=1 To 20
|
||||||
|
boxes(b)=CopyEntity(box)
|
||||||
|
EntityParent boxes(b),cage_pivot1
|
||||||
|
Next
|
||||||
|
For b=21 To 40
|
||||||
|
boxes(b)=CopyEntity(box)
|
||||||
|
EntityParent boxes(b),cage_pivot2
|
||||||
|
Next
|
||||||
|
For b=1 To 20
|
||||||
|
PositionEntity boxes(b),y,x,z
|
||||||
|
y=y+5
|
||||||
|
ii=ii+1
|
||||||
|
If y=>5
|
||||||
|
y=-5
|
||||||
|
x=x+5
|
||||||
|
EndIf
|
||||||
|
If ii=10
|
||||||
|
x=-5
|
||||||
|
z=z-5
|
||||||
|
ii=0
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
For b=21 To 40
|
||||||
|
PositionEntity boxes(b),y,x,z
|
||||||
|
y=y+5
|
||||||
|
ii=ii+1
|
||||||
|
If y=>5
|
||||||
|
y=-5
|
||||||
|
x=x+5
|
||||||
|
;z=z-5
|
||||||
|
|
||||||
|
EndIf
|
||||||
|
If ii=10
|
||||||
|
x=-5
|
||||||
|
z=z-5
|
||||||
|
ii=0
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
|
||||||
|
FreeEntity box
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Line-up Camera and Cage
|
||||||
|
;----------------------------------
|
||||||
|
PositionEntity cage_pivot2,0,-10,-30
|
||||||
|
PositionEntity cage_pivot1,0,-40,-40
|
||||||
|
PositionEntity c_pivot,-2,-20,17
|
||||||
|
PositionEntity camera,0,0,0
|
||||||
|
TurnEntity c_pivot,-90,0,0
|
||||||
|
|
||||||
|
|
||||||
|
light=CreateLight()
|
||||||
|
;----------------------------------
|
||||||
|
; Main Loop
|
||||||
|
;----------------------------------
|
||||||
|
While Not KeyHit(1)
|
||||||
|
|
||||||
|
swap#=swap+speed ;Increment for cage swap
|
||||||
|
|
||||||
|
xx#=xx-speed ;increment to pull back camera
|
||||||
|
|
||||||
|
PositionEntity c_pivot,-2,-20+xx,17 ;Pull back parent entity of camera
|
||||||
|
TurnEntity camera,0,0,c_rotation ;Turn camera
|
||||||
|
PositionEntity light,-2,-10-xx,17
|
||||||
|
If swap=>25 ;Bring the furthest cage to the front
|
||||||
|
If cage=0
|
||||||
|
PositionEntity cage_pivot2,0,-40+xx,-30 ;Position cage just behind camera
|
||||||
|
cage=1
|
||||||
|
swap=0
|
||||||
|
Else
|
||||||
|
PositionEntity cage_pivot1,0,-40+xx,-40
|
||||||
|
swap=0
|
||||||
|
cage=0
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
UpdateWorld
|
||||||
|
RenderWorld
|
||||||
|
Flip
|
||||||
|
|
||||||
|
Wend
|
||||||
|
After Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,204 @@
|
|||||||
|
;-----------------------------------------------------------------------
|
||||||
|
; Power Fountain 1.b
|
||||||
|
; 07/28/01
|
||||||
|
;
|
||||||
|
; Written By Richard R Betson
|
||||||
|
; Copyright, 2001 Richard R Betson
|
||||||
|
; www.redeyeware.50megs.com
|
||||||
|
; vidiot@getgoin.net
|
||||||
|
; Spite movement based on code by Simon Harris (config2000@hotmail.com)
|
||||||
|
;-----------------------------------------------------------------------
|
||||||
|
AppTitle "Power Fountain"
|
||||||
|
Include "../start.bb"
|
||||||
|
;Graphics3D 640,480,16
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
AmbientLight 10,10,10
|
||||||
|
|
||||||
|
|
||||||
|
Dim sparks(80)
|
||||||
|
Global time=8000+MilliSecs()
|
||||||
|
Const total_sprites=80 ;Total number of sprites
|
||||||
|
Global fi#=.2
|
||||||
|
|
||||||
|
|
||||||
|
Type sprite_type
|
||||||
|
Field x#,y# ;Position
|
||||||
|
Field vx#,vy# ; Velocity
|
||||||
|
Field delay_time ; Delay
|
||||||
|
End Type
|
||||||
|
|
||||||
|
Global sprite.sprite_type
|
||||||
|
|
||||||
|
|
||||||
|
For d=1 To total_sprites
|
||||||
|
sprite.sprite_type=New sprite_type
|
||||||
|
sprite_pos()
|
||||||
|
sprite\delay_time=Rnd(50)
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Camera
|
||||||
|
;----------------------------------
|
||||||
|
c_pivot=CreatePivot() ;Camera Pivot
|
||||||
|
camera=CreateCamera(c_pivot) ;Create Camera
|
||||||
|
PositionEntity camera,0,-10,7.5 ;Position camera
|
||||||
|
;CameraZoom camera,1.1 ;Zoom in jus a bit
|
||||||
|
CameraRange camera,.1,100 ;Limit camera range
|
||||||
|
CameraFogMode camera,1 ;Fog on
|
||||||
|
CameraFogColor camera,16,0,128 ;Color fog
|
||||||
|
CameraFogRange camera,60,90 ;Visible fog range
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Sparks
|
||||||
|
;----------------------------------
|
||||||
|
;spark_pivot=CreatePivot()
|
||||||
|
spark=LoadSprite("spark.bmp",1) ;Load bitmap for sprite "1" colored
|
||||||
|
ScaleSprite spark,.7,.7 ;Scale the sprite a little smaller
|
||||||
|
If spark=0 Then End ;If the sprite did not load function error
|
||||||
|
|
||||||
|
|
||||||
|
For i=1 To 80
|
||||||
|
sparks(i)=CopyEntity(spark) ;Make a copy of the sprite and color it
|
||||||
|
EntityColor sparks(i),Rnd(255),Rnd(255),Rnd(255)
|
||||||
|
Next
|
||||||
|
|
||||||
|
FreeEntity spark
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Fountain
|
||||||
|
;----------------------------------
|
||||||
|
brick=LoadTexture("brick1.bmp",1) ;Load texture "1" colored
|
||||||
|
ScaleTexture brick,.5,.5 ;Scale texture
|
||||||
|
pad1_pivot=CreatePivot() ;create a pivot for fountain (not really needed)
|
||||||
|
pad1=CreateCube(pad1_pivot) ;Create a cube with it's parent a pivot
|
||||||
|
EntityTexture pad1,brick ;Apply texture
|
||||||
|
ScaleEntity pad1,.55,1.5,.55 ;Scale the cube
|
||||||
|
PositionEntity pad1,0,0,1.55 ;Position the cube
|
||||||
|
UpdateNormals pad1 ;Update texture
|
||||||
|
TurnEntity pad1,90,0,0 ;Turn the cube so it will match mirror plane
|
||||||
|
|
||||||
|
pad2=CreateCube(pad1_pivot)
|
||||||
|
EntityTexture pad2,brick
|
||||||
|
ScaleEntity pad2,1,.2,1
|
||||||
|
PositionEntity pad2,0,0,0;1.80
|
||||||
|
TurnEntity pad2,90,0,0
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Plane
|
||||||
|
;----------------------------------
|
||||||
|
stone=LoadTexture("stone.bmp",2) ;Load texture "2" Alpha
|
||||||
|
ScaleTexture stone,2,2 ;Scale texture
|
||||||
|
plane=CreatePlane(10,pad1) ;Create plane with segments of 10
|
||||||
|
EntityTexture plane,stone ;Texture plane
|
||||||
|
PositionEntity plane,0,-1.1,0
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Mirror
|
||||||
|
;----------------------------------
|
||||||
|
|
||||||
|
mirror=CreateMirror(pad1) ;Create mirror
|
||||||
|
PositionEntity mirror,0,-1.2,0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Light
|
||||||
|
;----------------------------------
|
||||||
|
|
||||||
|
light1=CreateLight(3) ;Create Light
|
||||||
|
LightConeAngles light1,1,90 ;Adjust Light Cone Angle
|
||||||
|
PositionEntity light1,0,-10,50 ;Position light
|
||||||
|
LightColor light1,255,255,255 ;Full brightt white light
|
||||||
|
LightRange light1,100 ;Set light range
|
||||||
|
EntityParent light1,c_pivot ;Make the lights parent camera's pivot
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PointEntity camera,pad1 ;Point to fountain
|
||||||
|
PointEntity light1,pad1
|
||||||
|
|
||||||
|
|
||||||
|
HideEntity plane ;Hide plane
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Main Loop
|
||||||
|
;----------------------------------
|
||||||
|
While Not KeyHit(1)
|
||||||
|
|
||||||
|
For sprite.sprite_type = Each sprite_type ;Loop through each sprite type
|
||||||
|
n=n+1 ;counter for sprites
|
||||||
|
If sprite\delay_time=0 ;Check condition of delay until 0
|
||||||
|
sprite\x#=sprite\x#-sprite\vx# ;Subtract velocity from position
|
||||||
|
sprite\vy#=sprite\vy#+.005 ;Velocity y +.005
|
||||||
|
sprite\y#=sprite\y#-sprite\vy# ;Subtract velocity from position
|
||||||
|
If sprite\y<-.5 Then sprite_pos() ;Collision detection
|
||||||
|
zz#=((Sin((n*2)*Pi)*sprite\x)) ;Add 3rd dimension to sparks based on x
|
||||||
|
PositionEntity sparks(n),sprite\x,zz,sprite\y ;Position sprite
|
||||||
|
Else
|
||||||
|
sprite\delay_time=sprite\delay_time-1 ;Subtract 1 from delay time
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
zz=0 ;reset
|
||||||
|
n=0
|
||||||
|
|
||||||
|
|
||||||
|
TurnEntity c_pivot,0,0,.5 ;Orbit camera and light
|
||||||
|
|
||||||
|
|
||||||
|
If KeyHit(2) ;key 1 for plane toggle
|
||||||
|
If on_off=0
|
||||||
|
ShowEntity plane ;show plane
|
||||||
|
on_off=1
|
||||||
|
Else
|
||||||
|
HideEntity plane ;hide plane
|
||||||
|
on_off=0
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If KeyHit(3) ;key 2 for spark color toggle
|
||||||
|
If on_off1=0
|
||||||
|
For i=1 To 80
|
||||||
|
EntityColor sparks(i),255,128,32 ;Set sparks color
|
||||||
|
Next
|
||||||
|
on_off1=1
|
||||||
|
Else
|
||||||
|
For i=1 To 80
|
||||||
|
EntityColor sparks(i),Rnd(255),Rnd(255),Rnd(255)
|
||||||
|
Next
|
||||||
|
on_off1=0
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UpdateWorld
|
||||||
|
RenderWorld
|
||||||
|
If time>MilliSecs()
|
||||||
|
Color 255,0,0
|
||||||
|
Text 10,10,"Power Fountain * Written By Richard Betson"
|
||||||
|
Text 10,25,"www.redeyeware.50megs.com"
|
||||||
|
Color 64,255,32
|
||||||
|
Text 10,40,"Press 1 to toggle Plane reflection on/off."
|
||||||
|
Text 10,55,"Press 2 to toggle Spark Color."
|
||||||
|
EndIf
|
||||||
|
Flip
|
||||||
|
|
||||||
|
Wend
|
||||||
|
|
||||||
|
|
||||||
|
Function sprite_pos()
|
||||||
|
sprite\x# =0 ;Set x width
|
||||||
|
sprite\y# =3.55 ;Ser y height
|
||||||
|
sprite\vx#=Rnd(.09)-Rnd(.09) ;Set velocity amount
|
||||||
|
sprite\vy#=-.2+Rnd(.15) ;Set velocity amount
|
||||||
|
End Function
|
||||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,11 @@
|
|||||||
|
Emerald Gate 1.0
|
||||||
|
Written By Richard Betson
|
||||||
|
www.redeyeware.50megs.com
|
||||||
|
vidiot@getgoin.net
|
||||||
|
|
||||||
|
Gate/Portal demo with animated texture and mesh wave deformation. The following files are Copyright 2001 Richard Betson:
|
||||||
|
my_stargate.3ds
|
||||||
|
water_anim.bmp
|
||||||
|
|
||||||
|
You can use theese file in any "not for profit" demo or other program. All other rights reserved.
|
||||||
|
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
;-----------------------------------------------------------------------
|
||||||
|
; Emerald Gate 1.0
|
||||||
|
; 07/26/01
|
||||||
|
;
|
||||||
|
; Written By Richard R Betson
|
||||||
|
; Copyright, 2001 Richard R Betson
|
||||||
|
; www.redeyeware.50megs.com
|
||||||
|
; vidiot@getgoin.net
|
||||||
|
; Texture wave motion code from Flag Demo, Blitz Basic 3D (Author Unknown)
|
||||||
|
;-----------------------------------------------------------------------
|
||||||
|
AppTitle "Emerald Gate"
|
||||||
|
Include "../start.bb"
|
||||||
|
;Graphics3D 800,600,16
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
|
||||||
|
|
||||||
|
AmbientLight 100,100,100
|
||||||
|
|
||||||
|
|
||||||
|
Const segs=40,width#=4,depth#=.09
|
||||||
|
time=MilliSecs()+8000
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Load Media
|
||||||
|
;----------------------------------
|
||||||
|
gate=LoadMesh("my_stargate3.3ds")
|
||||||
|
g_tex=LoadTexture("gate1.bmp",65)
|
||||||
|
tex=LoadAnimTexture( "water_anim.bmp",4,128,128,0,8 )
|
||||||
|
floor_t=LoadTexture("stone.bmp",2)
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Camera
|
||||||
|
;----------------------------------
|
||||||
|
c_pivot=CreatePivot() ;Camera Pivot
|
||||||
|
camera=CreateCamera(c_pivot) ;Create Camera
|
||||||
|
PositionEntity camera,0,-8,1.5 ;Position camera
|
||||||
|
|
||||||
|
CameraZoom camera,1.4 ;Zoom in jus a bit
|
||||||
|
CameraRange camera,.1,100 ;Limit camera range
|
||||||
|
CameraFogMode camera,1 ;Fog on
|
||||||
|
CameraFogColor camera,16,0,128 ;Color fog
|
||||||
|
CameraFogRange camera,0,60 ;Visible fog range
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Gate
|
||||||
|
;----------------------------------
|
||||||
|
FitMesh gate,-1,-1,-1,2,2,2,True
|
||||||
|
ScaleMesh gate,3,3,3
|
||||||
|
TurnEntity gate,90,0,0
|
||||||
|
PositionEntity gate,0,0,0
|
||||||
|
EntityTexture gate,g_tex
|
||||||
|
UpdateNormals gate
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Water Mesh
|
||||||
|
;----------------------------------
|
||||||
|
mesh=CreateMesh() ;Create water mesh
|
||||||
|
surf=CreateSurface( mesh ) ;Create a suface for mesh
|
||||||
|
|
||||||
|
For k=0 To segs ;Loop through segments of suface
|
||||||
|
x#=Float(k)*width/segs-width/2 ;Get x position as F. Point
|
||||||
|
u#=Float(k)/segs ;Get u pos. as F. Point
|
||||||
|
AddVertex surf,x,1,0,u,0 ;Add a vertex/index (texture) to surface
|
||||||
|
AddVertex surf,x,-1,0,u,1
|
||||||
|
Next
|
||||||
|
|
||||||
|
For k=0 To segs-1 ;Loop through segments of surface
|
||||||
|
AddTriangle surf,k*2,k*2+2,k*2+3 ;Add triangles to suface texture front and back
|
||||||
|
AddTriangle surf,k*2,k*2+3,k*2+1
|
||||||
|
AddTriangle surf,k*2,k*2+3,k*2+2
|
||||||
|
AddTriangle surf,k*2,k*2+1,k*2+3
|
||||||
|
Next
|
||||||
|
|
||||||
|
EntityTexture mesh,tex ;Texture water mesh
|
||||||
|
TurnEntity mesh,90,0,0 ;Turn
|
||||||
|
ScaleMesh mesh,1.24,2.50,0 ;Scale
|
||||||
|
PositionMesh mesh,0,.25,0 ;Position
|
||||||
|
EntityAlpha mesh,.6 ;Adjust mesh alpha (see through)
|
||||||
|
EntityFX mesh,.7
|
||||||
|
UpdateNormals mesh ;Update mesh normals
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Mirror and Plane (Floor)
|
||||||
|
;----------------------------------
|
||||||
|
plane=CreatePlane(10,gate) ;Create Plane
|
||||||
|
PositionEntity plane,0,-3.0,0 ;Position Plane
|
||||||
|
EntityTexture plane,Floor_t ;Apply texture to plane
|
||||||
|
|
||||||
|
mirror=CreateMirror(gate) ;Create mirror
|
||||||
|
PositionEntity mirror,0,-3.05,0
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Create Light
|
||||||
|
;----------------------------------
|
||||||
|
light1=CreateLight(3) ;Create Light
|
||||||
|
LightConeAngles light1,1,90 ;Adjust Light Cone Angle
|
||||||
|
PositionEntity light1,0,-10,20 ;Position light
|
||||||
|
LightColor light1,255,255,255 ;Full brightt white light
|
||||||
|
LightRange light1,100 ;Set light range
|
||||||
|
EntityParent light1,c_pivot ;Make the lights parent camera's pivot
|
||||||
|
|
||||||
|
light2=CreateLight(2)
|
||||||
|
LightColor light2,255,255,255
|
||||||
|
PositionEntity light2,-.6,0,-2
|
||||||
|
PointEntity light2,mesh
|
||||||
|
|
||||||
|
light3=CreateLight(2)
|
||||||
|
PositionEntity light2,-3,0,-2
|
||||||
|
PointEntity light3,mesh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;Point light and Camera at water mesh
|
||||||
|
PointEntity camera,mesh ;Point camera to water mesh
|
||||||
|
PointEntity light1,mesh ;Point light to water mesh
|
||||||
|
|
||||||
|
;----------------------------------
|
||||||
|
; Main Loop
|
||||||
|
;----------------------------------
|
||||||
|
While Not KeyHit(1)
|
||||||
|
ph#=MilliSecs()/1.3 ;Frequency of waves (time)
|
||||||
|
cnt=CountVertices(surf)-1 ;Count all of the Vertices in water mesh
|
||||||
|
|
||||||
|
For k=0 To cnt ;Loop through mesh and update vertices
|
||||||
|
x#=VertexX(surf,k)
|
||||||
|
y#=VertexY(surf,k)
|
||||||
|
z#=Sin(ph+x*200)*depth ;Create wave
|
||||||
|
VertexCoords surf,k,x,y,z ;Update
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
If tnt<MilliSecs() ;Timer
|
||||||
|
EntityTexture mesh,tex,tn ;Texture water mesh with next frame of animated texture
|
||||||
|
tn=tn+1 ;Counter
|
||||||
|
If tn=8 Then tn=0 ;Check if end of frame is reached
|
||||||
|
tnt=MilliSecs()+32 ;Reset timer
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
UpdateNormals mesh ;Update water mesh normals
|
||||||
|
|
||||||
|
|
||||||
|
TurnEntity c_pivot,0,0,.5 ;Orbit camera and light
|
||||||
|
|
||||||
|
UpdateWorld
|
||||||
|
RenderWorld
|
||||||
|
|
||||||
|
If time>MilliSecs()
|
||||||
|
Color 255,0,0
|
||||||
|
Text 10,10,"Emerald Gate * Written By Richard Betson"
|
||||||
|
Text 10,25,"www.redeyeware.50megs.com"
|
||||||
|
Color 64,255,32
|
||||||
|
Text 10,40,"Press Escape to Exit."
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
Flip
|
||||||
|
|
||||||
|
Wend
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Function error()
|
||||||
|
SetBuffer FrontBuffer()
|
||||||
|
Color 255,255,255
|
||||||
|
Text 20,20,"ERROR LOADING MEDIA FILES!!! PLEASE INSTALL AGAIN!!"
|
||||||
|
Delay 4000
|
||||||
|
End
|
||||||
|
End Function
|
||||||
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 384 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,611 @@
|
|||||||
|
;===================================================================
|
||||||
|
; Orbit The Nebula Demo 1.0
|
||||||
|
; Written by Richard Betson
|
||||||
|
; 07/16/01
|
||||||
|
; www.redeyeware.50megs.com
|
||||||
|
; Copyright 2001, Richard R Betson (if possible under NDA)
|
||||||
|
;===================================================================
|
||||||
|
|
||||||
|
AppTitle "Orbit The Nebula Demo 1.0"
|
||||||
|
Include "../start.bb"
|
||||||
|
|
||||||
|
;Graphics3D 640,480,16
|
||||||
|
;---------------------------------
|
||||||
|
;Variables
|
||||||
|
;---------------------------------
|
||||||
|
Dim rock_light(115)
|
||||||
|
Dim rock(115)
|
||||||
|
Dim spark(40)
|
||||||
|
|
||||||
|
;make_sky
|
||||||
|
Global sky1
|
||||||
|
Global sky2
|
||||||
|
|
||||||
|
;Make_sun
|
||||||
|
Global spark_pivot1
|
||||||
|
Global spark_pivot2
|
||||||
|
Global spark_pivot3
|
||||||
|
Global spark_pivot4
|
||||||
|
|
||||||
|
Global sun_light1
|
||||||
|
Global sun_light2
|
||||||
|
Global sun_light3
|
||||||
|
|
||||||
|
Global sun
|
||||||
|
|
||||||
|
Global spark_orbit_sprite1
|
||||||
|
Global spark_orbit_sprite2
|
||||||
|
|
||||||
|
;make_planet
|
||||||
|
Global ring
|
||||||
|
Global ring2
|
||||||
|
Global pv
|
||||||
|
Global planet_pivot
|
||||||
|
Global planet
|
||||||
|
Global planet_light
|
||||||
|
|
||||||
|
;make_moon
|
||||||
|
Global moon
|
||||||
|
Global moon_pivot
|
||||||
|
|
||||||
|
;make_rock
|
||||||
|
Global l1
|
||||||
|
Global rock_pivot
|
||||||
|
|
||||||
|
;lens_flare
|
||||||
|
Global flare1
|
||||||
|
Global flare2
|
||||||
|
Global flare3
|
||||||
|
Global flare4
|
||||||
|
|
||||||
|
|
||||||
|
sp1x_rate#=2.8
|
||||||
|
sp1y_rate#=-2.8
|
||||||
|
sp2x_rate#=-2.6
|
||||||
|
sp2y_rate#=2.6
|
||||||
|
sp3x_rate#=2.6
|
||||||
|
sp3y_rate#=2.6
|
||||||
|
sp4x_rate#=-.6
|
||||||
|
sp4y_rate#=-2.6
|
||||||
|
|
||||||
|
|
||||||
|
Const speed=4 ;Speed of Mouse Movement
|
||||||
|
Global yaw1#=.1 ;Speed of Sphere Rotation
|
||||||
|
Global yaw2#=.15
|
||||||
|
Const spitch#=.3
|
||||||
|
Const syaw#=.45
|
||||||
|
|
||||||
|
sw=GraphicsWidth()/2 ;Mouse Center Point
|
||||||
|
sh=GraphicsHeight()/2
|
||||||
|
|
||||||
|
time=MilliSecs()+8000
|
||||||
|
|
||||||
|
|
||||||
|
orbit_t#=.1
|
||||||
|
Global oldpx1#
|
||||||
|
time1=MilliSecs()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
signal=Load3DSound("signal.wav")
|
||||||
|
If signal=0 Then error()
|
||||||
|
LoopSound signal
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------
|
||||||
|
;Set Lighting
|
||||||
|
;---------------------------------
|
||||||
|
AmbientLight 70,70,70
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------
|
||||||
|
;Create Piviot and Camera Entities
|
||||||
|
;_________________________________
|
||||||
|
pivot=CreatePivot()
|
||||||
|
pv1=CreatePivot()
|
||||||
|
camera=CreateCamera(pivot)
|
||||||
|
|
||||||
|
|
||||||
|
;listen=CreateListener(sun,.1,.2,.2)
|
||||||
|
;EmitSound signal,sun
|
||||||
|
|
||||||
|
|
||||||
|
TurnEntity camera,80,0,0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
make_sky()
|
||||||
|
make_sun()
|
||||||
|
make_planet()
|
||||||
|
make_moon()
|
||||||
|
make_rocks()
|
||||||
|
lens_flare()
|
||||||
|
|
||||||
|
|
||||||
|
;listen=CreateListener(camera,.1,.5,.5)
|
||||||
|
;EmitSound signal,sun
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Main Loop
|
||||||
|
;--------------------------------
|
||||||
|
While Not KeyHit(1)
|
||||||
|
;If time1<MilliSecs()
|
||||||
|
|
||||||
|
|
||||||
|
fps=fps+1
|
||||||
|
If fps_t<MilliSecs()
|
||||||
|
;fps2=fps
|
||||||
|
fp$=" "+Str$(fps)
|
||||||
|
fps_t=1000+MilliSecs()
|
||||||
|
fps=0
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
fps2=fps2+1
|
||||||
|
If fps_t2<MilliSecs()
|
||||||
|
fps3#=fps2
|
||||||
|
;fp$=" "+Str$(fps)
|
||||||
|
fps_t2=30+MilliSecs()
|
||||||
|
fps2=0
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
;If fps3>2
|
||||||
|
|
||||||
|
;sp1x_rate#=2.8-(fps3-4.50)
|
||||||
|
;sp1y_rate#=-2.8-(fps3-4.50)
|
||||||
|
;sp2x_rate#=-2.6-(fps3-4.50)
|
||||||
|
;sp2y_rate#=2.6-(fps3-4.50)
|
||||||
|
;sp3x_rate#=0;(fps3)
|
||||||
|
;sp3y_rate#=0;(fps3)
|
||||||
|
;sp4x_rate#=0;-(diff/100)
|
||||||
|
;sp4y_rate#=0;-(diff/8)
|
||||||
|
;orbit_t=.075-(fps3/80)
|
||||||
|
;yaw1=.1-(fps3-1.5)
|
||||||
|
;yaw2=.2-(fps3-1)
|
||||||
|
;EndIf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TurnEntity sky1,0,yaw1,0,0 ;Turn (Yaw) Sphere 1
|
||||||
|
TurnEntity sky2,0,yaw2,0,0 ;Turn (Yaw) Sphere 2
|
||||||
|
|
||||||
|
|
||||||
|
TurnEntity planet_pivot,0,.9,0
|
||||||
|
TurnEntity pv,0,.9,0
|
||||||
|
TurnEntity moon_pivot,.8,.8,0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TurnEntity spark_pivot1,sp1x_rate,sp1y_rate,0
|
||||||
|
TurnEntity spark_pivot2,sp2x_rate,sp2y_rate,0
|
||||||
|
TurnEntity spark_pivot3,sp3x_rate,sp3y_rate,0
|
||||||
|
TurnEntity spark_pivot4,sp4x_rate,sp4y_rate,0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
si#=si#+.4+orbit_t
|
||||||
|
If si>=114.25 Then si=0
|
||||||
|
sx#=(5+(Sin(si*Pi)*20))
|
||||||
|
sy#=(190+(Cos(si*Pi)*70))
|
||||||
|
|
||||||
|
PositionEntity spark_orbit_sprite1,sx-(sx*2),sy,sx
|
||||||
|
PositionEntity spark_orbit_sprite2,sx,sy,sx
|
||||||
|
|
||||||
|
|
||||||
|
fi#=fi+orbit_t
|
||||||
|
If fi>=114.50 Then fi=0
|
||||||
|
|
||||||
|
px#=(2+(Sin(fi*Pi)*40))
|
||||||
|
py#=(30 + (Cos(fi*Pi)*265))
|
||||||
|
|
||||||
|
PositionEntity camera,px,py,0
|
||||||
|
|
||||||
|
PositionEntity sky1,px,py,0
|
||||||
|
PositionEntity sky2,px,py,0
|
||||||
|
|
||||||
|
If (fi>100 And fi<110) Or (fi>8 And fi<14)
|
||||||
|
flare_counter#=flare_counter#+.8
|
||||||
|
If fi>100 And fi<110 Then f_offset=15
|
||||||
|
ShowEntity flare1
|
||||||
|
ShowEntity flare2
|
||||||
|
ShowEntity flare3
|
||||||
|
ShowEntity flare4
|
||||||
|
PositionEntity flare1,EntityX#(sun)+10-f_offset,EntityY#(sun)+10-(flare_counter)-f_offset,EntityZ#(sun)+5+flare_counter
|
||||||
|
PositionEntity flare2,EntityX#(sun)+10-f_offset,EntityY#(sun)+20-(flare_counter)-f_offset,EntityZ#(sun)+10+flare_counter
|
||||||
|
PositionEntity flare3,EntityX#(sun)+10-f_offset,EntityY#(sun)+30-(flare_counter)-f_offset,EntityZ#(sun)+15+flare_counter
|
||||||
|
PositionEntity flare4,EntityX#(sun)+10-f_offset,EntityY#(sun)+40-(flare_counter)-f_offset,EntityZ#(sun)+20+flare_counter
|
||||||
|
|
||||||
|
Else
|
||||||
|
f_offset=0
|
||||||
|
flare_counter=0
|
||||||
|
HideEntity flare1
|
||||||
|
HideEntity flare2
|
||||||
|
HideEntity flare3
|
||||||
|
HideEntity flare4
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
PointEntity camera,planet,90
|
||||||
|
|
||||||
|
|
||||||
|
time1=MilliSecs()+delay_time
|
||||||
|
odlpy#=py
|
||||||
|
|
||||||
|
;EndIf
|
||||||
|
|
||||||
|
|
||||||
|
If KeyHit(2)
|
||||||
|
orbit_t=orbit_t+.025
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If KeyHit(3)
|
||||||
|
orbit_t=orbit_t-.025
|
||||||
|
If orbit_t<.025 Then orbit_t=.025
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
UpdateNormals planet
|
||||||
|
|
||||||
|
UpdateWorld ;Update's
|
||||||
|
RenderWorld ;.90
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If time>MilliSecs()
|
||||||
|
Color 255,255,255
|
||||||
|
Text 10,10,"Orbit The Nebula"
|
||||||
|
Text 10,25,"Orbit The Nebula Demo 1.0 by Richard Betson"
|
||||||
|
Color 255,0,0
|
||||||
|
Text 10,40,"www.redeyeware.50megs.com"
|
||||||
|
Color 128,255,0
|
||||||
|
Text 10,70,"Hit ESCAPE KEY to EXIT."
|
||||||
|
Text 10,80,"Hit 1 to speed up, 2 to slow down demo."
|
||||||
|
Else
|
||||||
|
Text 10,10,"FPS: "+fp$
|
||||||
|
EndIf
|
||||||
|
;Text 10,10,px
|
||||||
|
;Text 10,25,py
|
||||||
|
;Text 10,40,fi
|
||||||
|
|
||||||
|
;Text 10,60,oldpx1-px1
|
||||||
|
;Text 10,80,sp1x_rate
|
||||||
|
;Text 10,95,orbit_t
|
||||||
|
|
||||||
|
Flip ;Flip to FrontBuffer()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If KeyHit(68)=1
|
||||||
|
kh=1
|
||||||
|
xxp=CreateImage(sw*2,sh*2)
|
||||||
|
GrabImage xxp,0,0
|
||||||
|
SaveImage(xxp,"screen.bmp")
|
||||||
|
FreeImage xxp
|
||||||
|
EndIf
|
||||||
|
If GetKey()<>0 And kh=0
|
||||||
|
exit_tdp=1
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
|
||||||
|
oldpx1=px1
|
||||||
|
Wend
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------
|
||||||
|
Function make_sky()
|
||||||
|
;---------------------------------
|
||||||
|
;Create Texture for Sky (STARS)
|
||||||
|
;---------------------------------
|
||||||
|
heaven=CreateTexture(128,128,1)
|
||||||
|
SetBuffer TextureBuffer(heaven)
|
||||||
|
For i=0 To 150
|
||||||
|
Color 155+Rnd(100),255,255
|
||||||
|
Plot Rnd(256),Rnd(256)
|
||||||
|
Next
|
||||||
|
|
||||||
|
heaven2=CreateTexture(128,128,1)
|
||||||
|
SetBuffer TextureBuffer(heaven2)
|
||||||
|
For i=0 To 80
|
||||||
|
Color 155+Rnd(100),255,255
|
||||||
|
Plot Rnd(256),Rnd(256)
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
;---------------------------------
|
||||||
|
;Load Nebula Textures
|
||||||
|
;---------------------------------
|
||||||
|
nebula=LoadTexture("nebula1.bmp")
|
||||||
|
belt=LoadTexture("belt.bmp")
|
||||||
|
If nebula=0 Then error()
|
||||||
|
If belt=0 Then error()
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
|
||||||
|
;---------------------------------
|
||||||
|
;Create Spheres for Sky
|
||||||
|
;Set Entity and Texture Flags
|
||||||
|
;---------------------------------
|
||||||
|
|
||||||
|
sky1=CreateSphere()
|
||||||
|
ScaleTexture heaven,.16,.16
|
||||||
|
EntityTexture sky1,heaven,0,0 ;Apply Multiple Textures to Sphere
|
||||||
|
EntityTexture sky1,nebula,0,1
|
||||||
|
EntityTexture sky1,belt,0,2
|
||||||
|
|
||||||
|
TextureBlend heaven,1 ;Set Texture Flags
|
||||||
|
TextureBlend nebula,3
|
||||||
|
TextureBlend belt,3
|
||||||
|
|
||||||
|
FlipMesh sky1 ;Flip Mesh (Texture) to face the inside of Sphere
|
||||||
|
ScaleEntity sky1,1000,1000,1000 ;Scale the Sphere
|
||||||
|
EntityFX sky1,1 ;Set to FullBright
|
||||||
|
|
||||||
|
|
||||||
|
sky2=CreateSphere()
|
||||||
|
ScaleTexture heaven2,.16,.20
|
||||||
|
EntityTexture sky2,heaven2,0,0
|
||||||
|
TextureBlend heaven2,1
|
||||||
|
FlipMesh sky2
|
||||||
|
ScaleEntity sky2,900,900,900
|
||||||
|
EntityAlpha sky2,.4
|
||||||
|
EntityFX sky2,1
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------
|
||||||
|
Function make_sun()
|
||||||
|
|
||||||
|
spark_pivot1=CreatePivot()
|
||||||
|
spark_pivot2=CreatePivot()
|
||||||
|
spark_pivot3=CreatePivot()
|
||||||
|
spark_pivot4=CreatePivot()
|
||||||
|
|
||||||
|
PositionEntity spark_pivot1,0,190,0
|
||||||
|
PositionEntity spark_pivot2,0,190,0
|
||||||
|
PositionEntity spark_pivot3,0,190,0
|
||||||
|
PositionEntity spark_pivot4,0,190,0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sun=CreateSphere()
|
||||||
|
sun_brush=CreateBrush(255,32,0)
|
||||||
|
PaintEntity sun,sun_brush
|
||||||
|
PositionEntity sun,0,190,5
|
||||||
|
ScaleEntity sun,4,4,4
|
||||||
|
|
||||||
|
|
||||||
|
sun_light1=CreateLight(2)
|
||||||
|
sun_light2=CreateLight(2)
|
||||||
|
sun_light3=CreateLight(2)
|
||||||
|
|
||||||
|
LightColor sun_light1,255,255,255
|
||||||
|
LightColor sun_light2,255,255,255
|
||||||
|
LightColor sun_light3,255,255,255
|
||||||
|
|
||||||
|
LightRange sun_light1,150
|
||||||
|
LightRange sun_light2,150
|
||||||
|
LightRange sun_light3,150
|
||||||
|
|
||||||
|
|
||||||
|
PositionEntity sun_light1,120,120,-10
|
||||||
|
PositionEntity sun_light2,0,220,0
|
||||||
|
PositionEntity sun_light3,-60,120,10
|
||||||
|
|
||||||
|
PointEntity sun_light1,sun
|
||||||
|
PointEntity sun_light2,sun
|
||||||
|
PointEntity sun_light3,sun
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spark_sprite=LoadSprite("spark.bmp",1)
|
||||||
|
sun_sprite=LoadSprite("spark.bmp",1)
|
||||||
|
spark_orbit_sprite1=CopyEntity(spark_sprite)
|
||||||
|
spark_orbit_sprite2=CopyEntity(spark_sprite)
|
||||||
|
|
||||||
|
|
||||||
|
ScaleSprite spark_orbit_sprite1,4,4
|
||||||
|
ScaleSprite spark_orbit_sprite2,4,4
|
||||||
|
ScaleSprite spark_sprite,2,2
|
||||||
|
|
||||||
|
EntityColor spark_orbit_sprite1,255,0,0
|
||||||
|
EntityColor spark_orbit_sprite2,255,0,0
|
||||||
|
|
||||||
|
EntityColor spark_sprite,220,255,64
|
||||||
|
ScaleSprite spark_sprite,3,3
|
||||||
|
SpriteViewMode spark_sprite,3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
For i=1 To 40
|
||||||
|
spark(i)=CopyEntity(spark_sprite)
|
||||||
|
red=Rnd(255);+100
|
||||||
|
green=Rnd(255);+100
|
||||||
|
blue=Rnd(255);+100
|
||||||
|
EntityColor spark(i),128,255,128;,red,green,blue
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
For i=1 To 10
|
||||||
|
EntityParent spark(i),spark_pivot1
|
||||||
|
|
||||||
|
sx#=(Rnd(30)-15)
|
||||||
|
sy#=(Rnd(30)-15)
|
||||||
|
sz#=(Rnd(30)-15)
|
||||||
|
|
||||||
|
PositionEntity spark(i),sx,sy,sz
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
For i=11 To 20
|
||||||
|
EntityParent spark(i),spark_pivot2
|
||||||
|
PositionEntity spark(i),Rnd#(30)-15,Rnd#(30)-15,Rnd#(30)-15
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
For i=21 To 30
|
||||||
|
EntityParent spark(i),spark_pivot3
|
||||||
|
PositionEntity spark(i),Rnd#(30)-15,Rnd#(30)-15,5+Rnd#(30)-15
|
||||||
|
Next
|
||||||
|
|
||||||
|
For i=31 To 40
|
||||||
|
EntityParent spark(i),spark_pivot4
|
||||||
|
PositionEntity spark(i),Rnd#(24)-12,Rnd#(24)-12,5+Rnd#(24)-12
|
||||||
|
Next
|
||||||
|
|
||||||
|
EntityColor sun_sprite,220,255,64
|
||||||
|
ScaleSprite sun_sprite,45,45
|
||||||
|
PositionEntity sun_sprite,0,188,5
|
||||||
|
SpriteViewMode sun_sprite,3
|
||||||
|
EntityAlpha sun_sprite,.5
|
||||||
|
|
||||||
|
FreeEntity spark_sprite
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------
|
||||||
|
Function make_planet()
|
||||||
|
;---------------------------------
|
||||||
|
;Planet
|
||||||
|
;---------------------------------
|
||||||
|
ring=LoadSprite("ring2.bmp",1)
|
||||||
|
PositionEntity ring,0,-180,0
|
||||||
|
ScaleSprite ring,15,15
|
||||||
|
TurnEntity ring,110,0,0
|
||||||
|
SpriteViewMode ring,2
|
||||||
|
EntityAlpha ring,.4
|
||||||
|
ring2=CopyEntity(ring)
|
||||||
|
TurnEntity ring2,-180,0,0
|
||||||
|
EntityAlpha ring2,.2
|
||||||
|
|
||||||
|
|
||||||
|
planet_pivot=CreatePivot()
|
||||||
|
EntityParent ring,planet_pivot
|
||||||
|
EntityParent ring2,planet_pivot
|
||||||
|
|
||||||
|
|
||||||
|
planet=CreateSphere()
|
||||||
|
planet_tex=LoadTexture("io.bmp",9)
|
||||||
|
EntityTexture planet,planet_tex
|
||||||
|
EntityColor planet,222,100,100
|
||||||
|
PositionEntity planet,0,-180,0
|
||||||
|
ScaleEntity planet,4,4,4
|
||||||
|
|
||||||
|
pv=CreatePivot()
|
||||||
|
EntityParent planet,pv
|
||||||
|
PositionEntity planet_pivot,10,0,-10
|
||||||
|
PositionEntity pv,10,0,-10
|
||||||
|
|
||||||
|
planet_light=CreateLight(3)
|
||||||
|
PointEntity planet_light,planet
|
||||||
|
;LightRange planet_light,2
|
||||||
|
PositionEntity planet_light,0,-160,0
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------
|
||||||
|
Function make_moon()
|
||||||
|
|
||||||
|
moon_texture=LoadTexture("moon.bmp")
|
||||||
|
moon=CreateSphere()
|
||||||
|
EntityTexture moon,moon_texture
|
||||||
|
PositionEntity moon,-10,-195,0
|
||||||
|
moon_pivot=CreatePivot()
|
||||||
|
PositionEntity moon_pivot,10,-180,-10
|
||||||
|
EntityParent moon,moon_pivot
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------
|
||||||
|
Function make_rocks()
|
||||||
|
;---------------------------------
|
||||||
|
;Rocks
|
||||||
|
;---------------------------------
|
||||||
|
rt=LoadTexture("rock.bmp",8)
|
||||||
|
rock1=LoadMesh("rock.3ds")
|
||||||
|
FitMesh rock1,-1,-1,-1,2,2,2,True
|
||||||
|
EntityTexture rock1,rt
|
||||||
|
ScaleEntity rock1,1,1,1
|
||||||
|
rock_pivot=CreatePivot()
|
||||||
|
PositionEntity rock_pivot,0,190,5
|
||||||
|
|
||||||
|
|
||||||
|
For i=1 To 114 Step 2
|
||||||
|
rock(i)=CopyEntity(rock1)
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
For i=1 To 114 Step 2
|
||||||
|
ry#=(185+Sin(i*Pi)*100+Rnd(25))
|
||||||
|
rx#=(5+Cos(i*Pi)*100+Rnd(20))
|
||||||
|
|
||||||
|
PositionEntity rock(i),rx,ry,Rnd(20)
|
||||||
|
EntityParent rock(i),rock_pivot
|
||||||
|
Next
|
||||||
|
l1=CreateLight()
|
||||||
|
PositionEntity l1,-90,0,10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FreeEntity rock1
|
||||||
|
|
||||||
|
;rl=CreateLight()
|
||||||
|
;PositionEntity rl,0,55,0
|
||||||
|
;PositionEntity rock1,0,65,0
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------
|
||||||
|
Function lens_flare()
|
||||||
|
|
||||||
|
flare1=CreateSphere()
|
||||||
|
flare2=CreateSphere()
|
||||||
|
flare3=CreateSphere()
|
||||||
|
flare4=CreateSphere()
|
||||||
|
|
||||||
|
EntityColor flare1,255,0,0
|
||||||
|
EntityColor flare2,64,255,32
|
||||||
|
EntityColor flare3,32,255,64
|
||||||
|
EntityColor flare4,0,0,255
|
||||||
|
|
||||||
|
ScaleEntity flare1,25,25,25
|
||||||
|
ScaleEntity flare2,6,6,6
|
||||||
|
ScaleEntity flare3,10,10,10
|
||||||
|
ScaleEntity flare4,30,30,30
|
||||||
|
|
||||||
|
EntityAlpha flare1,.1
|
||||||
|
EntityAlpha flare2,.1
|
||||||
|
EntityAlpha flare3,.1
|
||||||
|
EntityAlpha flare4,.09
|
||||||
|
|
||||||
|
HideEntity flare1
|
||||||
|
HideEntity flare2
|
||||||
|
HideEntity flare3
|
||||||
|
HideEntity flare4
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------
|
||||||
|
Function error()
|
||||||
|
SetBuffer FrontBuffer()
|
||||||
|
Color 255,255,255
|
||||||
|
Text 20,20,"ERROR LOADING MEDIA FILES!!! PLEASE INSTALL AGAIN!!"
|
||||||
|
Delay 4000
|
||||||
|
End
|
||||||
|
End Function
|
||||||
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
SetGfx()
|
||||||
|
|
||||||
|
Function SetGfx()
|
||||||
|
Print info1$:Print info2$:Print info3$:Print info4$:Print
|
||||||
|
If Windowed3D()
|
||||||
|
yn$=Input$( "Use windowed mode?" )
|
||||||
|
If Left$( Lower$( yn$ ),1 )="y"
|
||||||
|
HidePointer
|
||||||
|
Graphics3D 640,480,0,2
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
Return
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
Print ""
|
||||||
|
Print "Display drivers:"
|
||||||
|
Print "----------------"
|
||||||
|
For k=1 To CountGfxDrivers()
|
||||||
|
Print k+":"+GfxDriverName$(k)
|
||||||
|
Next
|
||||||
|
Print
|
||||||
|
|
||||||
|
If CountGfxDrivers()>1
|
||||||
|
Repeat
|
||||||
|
driver=Input$( "Display driver (1-"+CountGfxDrivers()+"):" )
|
||||||
|
Until driver>=1 And driver<=CountGfxDrivers()
|
||||||
|
SetGfxDriver driver
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
cnt=CountGfxModes3D()
|
||||||
|
If cnt=0 Print "No 3D Graphics modes detected.":WaitKey:End
|
||||||
|
|
||||||
|
Print ""
|
||||||
|
Print "Display modes:"
|
||||||
|
Print "--------------"
|
||||||
|
For k=1 To CountGfxModes3D()
|
||||||
|
Print k+":"+GfxModeWidth(k)+","+GfxModeHeight(k)+","+GfxModeDepth(k)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
mode=Input$( "Display Mode (1-"+cnt+"):" )
|
||||||
|
Until mode>=1 And mode<=cnt
|
||||||
|
|
||||||
|
Graphics3D GfxModeWidth(mode),GfxModeHeight(mode),GfxModeDepth(mode),1
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
|
||||||
|
End Function
|
||||||
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,47 @@
|
|||||||
|
; simple bumpmapping effect demo in blitz3d
|
||||||
|
; works on all graphics cards!
|
||||||
|
;
|
||||||
|
; by Rob Cummings (bloodlocust@blueyonder.co.uk)
|
||||||
|
|
||||||
|
Global camera,plane,mx,my,c,b,s,l
|
||||||
|
HidePointer
|
||||||
|
AppTitle "Blitz3D Bump"
|
||||||
|
Graphics3D 640,480,16,2
|
||||||
|
camera=CreateCamera()
|
||||||
|
plane=CreateSprite(camera)
|
||||||
|
MoveEntity plane,0,0,2
|
||||||
|
ScaleEntity plane,500,500,500
|
||||||
|
EntityFX plane,1 ;fullbright
|
||||||
|
|
||||||
|
c=LoadTexture("c.jpg",3)
|
||||||
|
b=LoadTexture("b.jpg",3)
|
||||||
|
s=LoadTexture("s.jpg",3)
|
||||||
|
l=LoadTexture("glow.bmp",48)
|
||||||
|
|
||||||
|
While Not KeyHit(1)
|
||||||
|
mx=MouseX()-320
|
||||||
|
my=MouseY()-240
|
||||||
|
UpdateBump()
|
||||||
|
UpdateWorld
|
||||||
|
RenderWorld
|
||||||
|
Text 0,0,"Move mouse to see bump effect!"
|
||||||
|
Flip
|
||||||
|
Wend
|
||||||
|
End
|
||||||
|
|
||||||
|
Function UpdateBump()
|
||||||
|
offset#=0.00006
|
||||||
|
TextureBlend l,3
|
||||||
|
|
||||||
|
EntityTexture plane,c,0,0
|
||||||
|
EntityTexture plane,s,0,1
|
||||||
|
EntityTexture plane,b,0,2
|
||||||
|
EntityTexture plane,l,0,3
|
||||||
|
|
||||||
|
PositionTexture b,-mx*offset,-my*offset
|
||||||
|
PositionTexture s,mx*offset,my*offset
|
||||||
|
PositionTexture l,mx*0.002,my*0.002
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,90 @@
|
|||||||
|
; Pyromania demo by R.Cummings (bloodlocust@blueyonder.co.uk)
|
||||||
|
; if you decide to use my animation of an explosion, please
|
||||||
|
; either give me credit where due, or let me know :)
|
||||||
|
|
||||||
|
Const FPS=30
|
||||||
|
Global boomtex,bangsprite,camera,count,pitch#,yaw#,roll#,d
|
||||||
|
AppTitle "BLITZ3D PYROMANIA"
|
||||||
|
HidePointer
|
||||||
|
Type bang
|
||||||
|
Field frame#,obj
|
||||||
|
End Type
|
||||||
|
|
||||||
|
d=16 ; size of explosion grid
|
||||||
|
|
||||||
|
Include "start.bb"
|
||||||
|
;Graphics3D 640,480,16,3
|
||||||
|
SetBuffer BackBuffer()
|
||||||
|
boomtex=LoadAnimTexture("boomstrip.bmp",49,64,64,0,39)
|
||||||
|
bangsprite=CreateSprite()
|
||||||
|
EntityTexture bangsprite,boomtex,39
|
||||||
|
EntityBlend bangsprite,3
|
||||||
|
HideEntity bangsprite
|
||||||
|
camera=CreateCamera()
|
||||||
|
PositionEntity camera,0,0,0
|
||||||
|
|
||||||
|
|
||||||
|
period=1000/FPS
|
||||||
|
time=MilliSecs()-period
|
||||||
|
|
||||||
|
While Not KeyHit(1)
|
||||||
|
Repeat
|
||||||
|
elapsed=MilliSecs()-time
|
||||||
|
Until elapsed
|
||||||
|
|
||||||
|
ticks=elapsed/period
|
||||||
|
tween#=Float(elapsed Mod period)/Float(period)
|
||||||
|
|
||||||
|
For k=1 To ticks
|
||||||
|
time=time+period
|
||||||
|
If k=ticks Then CaptureWorld
|
||||||
|
UpdateGame()
|
||||||
|
UpdateWorld
|
||||||
|
Next
|
||||||
|
|
||||||
|
RenderWorld tween
|
||||||
|
Flip
|
||||||
|
Wend
|
||||||
|
End
|
||||||
|
|
||||||
|
|
||||||
|
Function UpdateGame()
|
||||||
|
pitch#=pitch#+.4
|
||||||
|
yaw#=yaw#-.2
|
||||||
|
roll#=roll#+.1
|
||||||
|
|
||||||
|
RotateEntity camera,pitch#,yaw#,roll#
|
||||||
|
|
||||||
|
For i=0 To Rnd(d)+20
|
||||||
|
AddBang(Rnd(-d,d),Rnd(-d,d),Rnd(-d,d))
|
||||||
|
Next
|
||||||
|
|
||||||
|
UpdateBangs()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Function AddBang(x#,y#,z#)
|
||||||
|
b.bang=New bang
|
||||||
|
b\obj=CopyEntity(bangsprite)
|
||||||
|
PositionEntity b\obj,x,y,z
|
||||||
|
RotateSprite b\obj,Rnd(-20,20)
|
||||||
|
; EntityColor b\obj,Rnd(255),Rnd(255),Rnd(255)
|
||||||
|
|
||||||
|
count=count+1
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function UpdateBangs()
|
||||||
|
For b.bang=Each bang
|
||||||
|
If b\frame#>38.5
|
||||||
|
FreeEntity b\obj
|
||||||
|
Delete b
|
||||||
|
count=count-1
|
||||||
|
Else
|
||||||
|
EntityTexture b\obj,boomtex,b\frame#
|
||||||
|
b\frame#=b\frame#+1
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
End Function
|
||||||
|
|
||||||
|
; EntityTexture sprite,boomtex,Floor(frame)
|
||||||
|
; frame=(frame+.5)Mod 39
|
||||||