Great Job Green Gandalf
I modified some of you code to increase the size of the ocean and "roughen up the sea" by pressing the left mouse button. If you get sea sick press the right mouse button. I was amazed that these changes had no noticeable effect on FPS
` Green Gandalf's FX test - uses code from the DBP FX browser
` Created: 5/04/2006
` Modified: 21/04/2006
` declarations
global cx#: global cy#: global cz#
global scX# = 5000.0 :global scY# = 300.0 :global scZ# = 5000.0 :
type valuestype name$ vartype hooked endtype
dim values$(0) as valuestype : empty array values$(): array insert at bottom values$()
r=make vector4(1)
` initialise screen
set display mode 800,600,32
sync on : sync rate 0 : sync
backdrop on: color backdrop rgb(20,80,40)
` load effect
objectName$="mediaggWater.x"
objectEffect$="mediaggWater.fx"
objectTexture$="mediaSeaWeed.JPG"
found=loadObjectEffectImage(objectName$,objectEffect$,objectTexture$)
if found<2
print "": print " Problem loading effect and/or object (found="+str$(found)+")"
sync
wait key
` end
endif
cls rgb(20,80,40)
` Create list of Effect Values
numConstants=findFXConstants(1)
if numConstants>0
print " Constant Name Type Hooked"
for c=1 to numConstants
name$=left$(values$(c).name$,14)
name$=name$+space$(14-len(name$))
print name$," ",values$(c).vartype," ",values$(c).hooked
next c
else
print " No FX constants found"
endif
print "": print " Press any key to continue"
sync
wait key
backdrop on
` check object size and find suitable camera and lighting position
position object 1, 1000,0,1000
size#=object size(1): isize=int(size#+1.0)
position camera 0,size#,-3*size#
point camera 0,0,0
positionLight()
while spacekey() ` wait for space key to clear
endwhile
repeat
text 20,20, "VIEWING EFFECT "+objectEffect$+" ON OBJECT "+objectName$
text 20,50, "FPS="+str$(screen fps())
text 20,70, "Object size="+str$(size#,2)
text 20,90, "Object size (x,y,z)="+str$(object size x(1),2)+" "+str$(object size y(1),2)+" "+str$(object size z(1),2)
text 20,110, "Poly count="+str$(statistic(1))
text 20,140, "Use up/down keys to move camera forwards/backwards."
text 20,160, "Use mouse to rotate camera."
text 20,180, "Use left and right mouse click to change size of waves."
positionCamera()
positionLight()
sync
if mouseclick() = 1 then scY# = scY# * 1.01 : scale object 1, scX#,scY#,scz#
if mouseclick() = 2 then scY# = scY# / 1.01 : scale object 1, scX#,scY#,scz#
until spacekey()
end
`
` Subroutines and functions
`
function findFXConstants(fxNum)
perform checklist for effect values 1: num=checklist quantity()
empty array values$(): array insert at bottom values$()
for c=1 to num
array insert at bottom values$()
values$(c).name$=checklist string$(c)
values$(c).vartype=checklist value a(c)
values$(c).hooked=checklist value b(c)
next c
endfunction num
function loadObjectEffectImage(objFile$,fxFile$,imgFile$)
if object exist(1)=1 then delete object 1
if effect exist(1)=1 then delete effect 1
load object objFile$,1
load effect fxFile$, 1, 1
` load image imgFile$, 1
position object 1, -10, 0, 0
set object effect 1, 1
set effect constant float 1, "h", 1.0
` texture object 1, 1
found=effect exist(1)+object exist(1)
scale object 1,scX#,scY#,scZ#
endfunction found
function positionCamera()
` use up and down arrow keys to move camera backwards and forwards
` rotate camera using mouse to view object
control camera using arrowkeys 0,1,0
cx#=cx#+mousemovey():cy#=cy#+mousemovex()
rotate camera cx#,cy#,0
endfunction
function positionLight()
set point light 0, camera position x(),camera position y()+size#,camera position z()-size#
endfunction
I really have to get into shaders after seeing these effects
All the best
Codger
System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem