Hi!
I've made a screensaver template in DBP. It's based on Batvink's newsletter vertexmanipulation tutorial.
Rem Project: Screensaver
Rem Created: 13.12.2006 22:05:20
Rem ***** Main Source File *****
rem running twice?
hide window
b = Is Single Instance("Saver")
if b=0 then end
rem commandline
command$=UPPER$(left$(CL$(),2))
rem preview
if command$="/P" then end
rem config
if command$="/C"
exit prompt "Sorry, nothing to config","no config"
end
endif
if command$="/A"
exit prompt "Sorry, i'm a lazy boy. No Password support!","No Password"
end
endif
rem Init
set display mode 1024,768,32
sync on : sync rate 0 :sync
autocam off
hide mouse
` Vertex type. This stores the object number, limb and vertex number
` In this example the object and limb numbers are academic,
` but we have a system which we can build on.
type tVertex
obj
limb
id
vector
endtype
` Variable required to track vector number
global gVector
rem get sreenwipe image
cls rgb(5,5,5)
get image 2,0,0,512,512,0
cls 0
rem texture
box 0,0,512,512,rgb(64,0,0),rgb(64,0,64),rgb(0,64,64),rgb(64,64,0)
get image 1,0,0,511,511,0
cls 0
VectorInit()
make object sphere 1,130 ,60,5
set object wireframe 1,0
texture object 1,1
set object cull 1,1
set object smoothing 1,100
ghost object on 1
disable object zwrite 1
SaveVertex(1,0)
rem sprite for screenwipe
sprite 2,0,0,2
size sprite 2,1024,768
set sprite 2,0,1
set sprite alpha 2,2
color backdrop rgb(15,15,15)
backdrop off
position camera 0,0,-100
point camera 0,0,0
set normalization on
set ambient light 55
null = make vector3(1000)
null = make vector3(1001)
null = make vector3(1002)
max# = (object size y(1) / 5000.0)
sin1# = 0
sin2# = 0
sin3# = 0
wire = 0
show window
rem MAIN LOOP
REPEAT
time=timer()
if time>delay
delay=time+30
lock vertexdata for limb 1,0,1
count = 0
for n = 1 to array count(vertex())
x# = X VECTOR3(vertex(n).vector)
y# = Y VECTOR3(vertex(n).vector)
z# = Y VECTOR3(vertex(n).vector)
newposx# = abs(x#) * sin(sin1#) *max#
newposy# = abs(y#) * cos(sin2#) *max#
newposz# = abs(z#) * sin(sin3#) *max#
copy vector3 1000,vertex(n).vector
copy vector3 1001,vertex(n).vector
copy vector3 1002,vertex(n).vector
scale vector3 1000,1000, (.250 + newposx#)
scale vector3 1001,1001, (.250 + newposy#)
scale vector3 1002,1002, (.250 + newposz#)
set VertexData Position vertex(n).id,x vector3(1000), y vector3(1001),z vector3(1002)
next n
unlock vertexdata
pitch object up 1,0.8
roll object left 1,0.5
turn object right 1,0.7
sin1#=wrapvalue(sin1#+1)
sin2#=wrapvalue(sin2#+2)
sin3#=wrapvalue(sin3#+3)
scroll object texture 1,0.002,0.003
wireframe=wrapvalue(wireframe+1)
if wireframe=0
cls 0
wire=1-wire
set object wireframe 1,wire
endif
endif
sync
UNTIL mouseclick() or scancode() or mousemovex()>5 or mousemovey()>5
END
function VectorInit()
` Initialise the Vector System
` Define the Array which will store our vertex information
dim vertex() as tVertex
add to queue vertex()
gVector = 0
endfunction
function SaveVertex(obj, limb)
` Register all of the vertices
` For each one, we will store it's id, object and limb references
` We will create a vector for it's position data,
` and store the vector id in our array
lock vertexdata for limb obj,limb,1
for n=0 to get VertexData Vertex Count()
add to queue vertex()
vertex().obj = obj
vertex().limb = limb
vertex().id = n
x = getVector()
vertex().vector = x
null = make vector3(x)
x# = get VertexData Position X(n)
y# = get VertexData Position Y(n)
z# = get VertexData Position Z(n)
SET VECTOR3 x, x#,y#,z#
next n
unlock vertexdata
endfunction
function getVector()
` Gets the next available vector number.
inc gVector, 1
endfunction gVector
The code requires the STYX-Plugin for checking running the saver twice.
If you don't have STYX download the attached file.
/edit:
Sorry, wrong file. Now it's zipped
Hope you like it!