OK. Ich lass' mir was einfallen.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: UserN//Anim Example// Draw Object #2...
X_LOADOBJ "moon.ddd", 1
LOADSPRITE "moon.bmp", 1
X_LOADOBJ "sun.ddd", 2
LOADSPRITE "sun.bmp", 2
WHILE TRUE
X_MAKE3D 1, 1200, 60
X_CAMERA 0, 0, 100, 0, 0, 0
X_SPOT_LT 0, RGB(255,255,255), 0,50,100,0,10,100,180
phi=phi+GETTIMER()/10
permil=permil+GETTIMER()/20000;
IF permil>=1 THEN permil=0
X_MOVEMENT 30, 0, 0
X_ROTATION 270, 1,0,0
X_ROTATION phi, 0,-1,0
X_SETTEXTURE 1, -1
X_DRAWANIM 1, 0, 128, permil, TRUE
Quote from: UserNSHOWSCREEN
WEND
LOADSPRITE "MyPointer.bmp", 12
start:
MOUSESTATE mx, my, b1, b2
SPRITE 12, mx, my
SHOWSCREEN
GOTO start
start:
MOUSESTATE mx, my, b1, b2
PRINT "X", mx, my
SHOWSCREEN
GOTO start
// --------------------------------- //
// Project:
// Start: Monday, March 29, 2004
// IDE Version: 1.40327
// rule = “l [ + l ] l [ - l] l†[Jürgens Hartmut, Peitgen Heinz-Otto, Saupe Dietmar:
// Fraktale - eine neue Sprache für komplexe Strukturen,
// Spektrum der Wissenschaft (9/1989), p.62.] with
// l = line
// + = +28.58 degrees
// - = -28.58 degrees
// [ = start of a branch
// ] = end of a branch
NewBranch(200,200,0, 0, -90, 0, 10)
SHOWSCREEN
MOUSEWAIT
// ------------------------------------------------------------- //
// -=# NEWBRANCH #=-
// ------------------------------------------------------------- //
FUNCTION NewBranch: x, y, z, phi, psi, depth, maxdepth
LOCAL ex, ey, ez, px, py, pz, lngth, ln_bottom, dphi, dpsi
LOCAL n, nbranches, col
lngth = 100/(1+depth)
ln_bottom = lngth*COS(psi)
nbranches = 2
ex = x + COS(phi)*ln_bottom
ey = y + SIN(psi)*lngth
ez = z + SIN(phi)*ln_bottom
IF (depth FOR n=1 TO nbranches
pos = n/(nbranches+1)
px = x+(ex-x)*pos
py = y+(ey-y)*pos
pz = z+(ez-z)*pos
dphi = phi + (RND(2)-1)*28.58
dpsi = psi + (RND(2)-1)*28.58
NewBranch(px, py, pz, dphi, dpsi, depth+1, maxdepth)
NEXT
ENDIF
col = RGB(200 - 200*(depth/maxdepth), 64+128*(depth/maxdepth), 0)
// Front
DRAWLINE x, y, ex, ey, col
// Left
DRAWLINE z+120, y, ez+120, ey, col
// Top
DRAWLINE x, z+320, ex, ez+320, col
ENDFUNCTION
// --------------------------------- //
// Project:
// Start: Monday, March 29, 2004
// IDE Version: 1.40327
// rule = “l [ + l ] l [ - l] l†[Jürgens Hartmut, Peitgen Heinz-Otto, Saupe Dietmar:
// Fraktale - eine neue Sprache für komplexe Strukturen,
// Spektrum der Wissenschaft (9/1989), p.62.] with
// l = line
// + = +28.58 degrees
// - = -28.58 degrees
// [ = start of a branch
// ] = end of a branch
NewBranch(200,200,0, 0, -90, 0, 10)
SHOWSCREEN
MOUSEWAIT
// ------------------------------------------------------------- //
// -=# NEWBRANCH #=-
// ------------------------------------------------------------- //
FUNCTION NewBranch: x, y, z, phi, psi, depth, maxdepth
LOCAL ex, ey, ez, px, py, pz, lngth, ln_bottom, dphi, dpsi
LOCAL n, nbranches, col
lngth = 100/(1+depth)
ln_bottom = lngth*COS(psi)
nbranches = 2
ex = x + COS(phi)*ln_bottom
ey = y + SIN(psi)*lngth
ez = z + SIN(phi)*ln_bottom
IF (depth FOR n=1 TO nbranches
pos = n/(nbranches+1)
px = x+(ex-x)*pos
py = y+(ey-y)*pos
pz = z+(ez-z)*pos
dphi = phi + (RND(2)-1)*28.58
dpsi = psi + (RND(2)-1)*28.58
NewBranch(px, py, pz, dphi, dpsi, depth+1, maxdepth)
NEXT
ENDIF
col = RGB(200 - 200*(depth/maxdepth), 64+128*(depth/maxdepth), 0)
// Front
DRAWLINE x, y, ex, ey, col
// Left
DRAWLINE z+120, y, ez+120, ey, col
// Top
DRAWLINE x, z+320, ex, ez+320, col
ENDFUNCTION
// ------------------------------------------------------------- //
// -=# CREATEHELIX #=-
// Creates a helix aka. spiral object
// R1 : Raduis of Helix
// R2 : Radius of Helix Intersection
// Nu : Number of elemtents along helix
// Nv : Number of elements around intersection
// cycles: Number or spiral repetitions
// height: Complete length of the helix
// col : Color of Helix-Material
// ------------------------------------------------------------- //
FUNCTION CreateHelix: num, R1, R2, Nu, Nv, cycles, height, col
LOCAL du, dv, u, v, x, y, z, tx, ty, q, nu, nv
du = cycles * 360 / Nu
dv = 360 / Nv
X_OBJSTART num
FOR i=0 TO Nu-1
u = i * du
FOR j=0 TO Nv-1
v = j * dv
FOR q = 0 TO 3
nu=0; nv=0 // Use next u/next v
IF q=0 OR q=3 THEN nu=1
IF q>1 THEN nv=1
nu = MOD(q, 2)
nv=INTEGER(q / 2)
qu = u+nu*du
qv = v+nv*dv
x = R1 * COS(qu) * (1 + COS(qv) * R2/R1)
z = R1 * SIN(qu) * (1 + COS(qv) * R2/R1)
y = SIN(qv)*R2 + qu*height/(360 * cycles)
tx = (i+nu)/Nu * cycles
ty = (j+nv)/Nv
X_OBJADDVERTEX x, y, z, tx, ty, col
NEXT
NEXT
X_OBJNEWGROUP
NEXT
X_OBJEND
ENDFUNCTION
// ------------------------------------------------------------- //
// -=# CREATEHELICOID #=-
// Creates a helicoid - minimal surface of a helix
// R1 : Raduis of Helix
// Nu : Number of elemtents along helix
// Nv : Number of elements around intersection
// cycles: Number or spiral repetitions
// height: Complete length of the helix
// col : Color of Helix-Material
// ------------------------------------------------------------- //
FUNCTION CreateHelicoid: num, R1, Nu, Nv, cycles, height, col
LOCAL du, dv, u, v, x, y, z, tx, ty, q, nu, nv
du = cycles*360 / Nu
dv = R1 / Nv
X_OBJSTART num
FOR i=0 TO Nu-1
u = i * du
FOR j=0 TO Nv-1
v = j * dv
FOR q = 0 TO 3
nu=0; nv=0 // Use next u/next v
IF q=0 OR q=3 THEN nu=1
IF q>1 THEN nv=1
nu = MOD(q, 2)
nv=INTEGER(q / 2)
qu = u+nu*du
qv = v+nv*dv
x = qv * COS(qu)
z = qv * SIN(qu)
y = qu/(cycles*360) * height
tx = (i+nu)/Nu * cycles
ty = (j+nv)/Nv
X_OBJADDVERTEX x, y, z, tx, ty, col
NEXT
NEXT
X_OBJNEWGROUP
NEXT
X_OBJEND
ENDFUNCTION