View script | License | Download script | History | Other scripts by: crazyaxe |
30-Apr 12:46 UTC
[0.067] 13.051k
[0.067] 13.051k
Archive version of: advanced-r3d.r ... version: 1 ... crazyaxe 9-Oct-2012Amendment note: new script || Publicly available? Yes REBOL [ Title: "Advanced R3D demo" Author: "Massimiliano Vessi" Email: maxint@tiscali.it Date: 09-Oct-2012 version: 2.0.2 file: %advanced-r3d.r Purpose: "R3D demo" ;following data are for www.rebol.org library ;you can find a lot of rebol script there library: [ level: 'intermidiate platform: 'all type: [demo tool] domain: [animation graphics] tested-under: [windows linux] support: none license: [gpl] see-also: none ] ] ;do %temp.r do http://www.rebol.org/download-a-script.r?script-name=r3d2.r img: load-image http://www.rebol.com/view/demos/palms.jpg Transx: Transy: 300 Transz: 0 projection: 250 hr: 1 ; Set some camera Lookatx: Lookaty: Lookatz: 100.0 ; positions to ; start with. model: reduce [cube-model (r3d-scale 100.0 150.0 125.0) red ] do update-3d: does [ ; This "update" function is where world: copy [] ; everything is defined. append world reduce [ model ] camera: r3d-position-object reduce [Transx Transy Transz] reduce [Lookatx Lookaty Lookatz] reduce [sine hr 0 cosine hr] RenderTriangles: render world camera (r3d-perspective projection) 400x360 ;probe RenderTriangles ; This line demonstrates what's going on ] ; under the hood. You can eliminate it. view layout [ scrn: box 400x360 black effect [draw RenderTriangles] ; basic draw radio-line true "Box red made of 12 triangle faces" [model: reduce [cube-model (r3d-scale 100.0 150.0 125.0) red ] update-3d show scrn ] radio-line "Box with transparent effect" [model: reduce [cube-model (r3d-scale 100.0 150.0 125.0) img ] update-3d show scrn ] radio-line "Cube red made of 6 square faces" [model: reduce [cube2-model (r3d-scale 100.0 150.0 125.0) red ] update-3d show scrn ] radio-line "Cube with image made of 6 square faces" [model: reduce [cube2-model (r3d-scale 100.0 150.0 125.0) img ] update-3d show scrn ] radio-line "Triangular pyramid" [model: reduce [pyramid-model (r3d-scale 100 100 100 ) red] update-3d show scrn ] radio-line "Triangular pyramid transparent effect" [model: reduce [pyramid-model (r3d-scale 100 100 100 ) img] update-3d show scrn ] radio-line "Square pyramid transparent red" [model: reduce [square-pyramid-model (r3d-scale 100 100 100 ) red] update-3d show scrn ] radio-line "Square pyramid transparent effect" [model: reduce [square-pyramid-model (r3d-scale 100 100 100 ) img] update-3d show scrn ] radio-line "Just a face, faces have just one side shown, move TransY it to see it" [model: reduce [wall-model (r3d-scale 100 100 100 ) img] update-3d show scrn ] across return label "TransX" slider 0.5 60x16 [Transx: (value * 600 ) - 300 update-3d show scrn] label "TransY" slider 0.5 60x16 [Transy: (value * 600 ) - 300 update-3d show scrn] label "TransZ" slider 0.5 60x16 [Transz: (value * 600) - 300 update-3d show scrn] return label "LookatX" slider 0.17 60x16 [Lookatx: (value * 600 ) update-3d show scrn] label "LookatY" slider 0.17 60x16 [Lookaty: (value * 600 ) update-3d show scrn] label "LookatZ" slider 0.17 60x16 [Lookatz: (value * 600 ) update-3d show scrn] return label "Projection" slider 0.5 60x16 [projection: (value * 500 ) if projection = 0 [projection: 0.1] update-3d show scrn] label "Head rotation" slider 60x16 [hr: (value * 360 ) if hr = 0 [hr: 0.1] update-3d show scrn ] ] |