lumieres

Description

Sans lumières, impossible de voir quelque chose. Heureusement, fluxus vous en donne une par défaut, une blanche en point diffusant attaché à la caméra. Pour des éclairages plus intéressants, vous aurez besoin de ces fonctions. Utilisant le pipeline graphique avec les fonction fixes standarts, très simplement, OpenGl multipile ces valeurs avec le matériau de la surface (choisi avec les commandes d'états locaux comme l'ambient et le diffuse) et la couleur de texture pour donner le rendu final.

Example

 ; éteindre la lumière principale
 (light-diffuse 0 (vector 0 0 0))
 (light-specular 0 (vector 0 0 0))
 (light-ambient 0 (vector 0 0 0))

 (define mylight (make-light 'point 'free))
 (light-position mylight (vector 5 2 0))
 (light-diffuse mylight (rndvec))
 (light-ambient mylight (vmul (rndvec) 0.1))
 (light-specular mylight (vmul (rndvec) 10))

 (with-state
     (ambient (vector 1 1 1))
     (colour (vector 1 1 1))
     (specular (vector 0.5 0.5 0.5))
     (shinyness 20)
     (build-torus 1 2 20 20))

(make-light type-symbol verrou-camera-symbol)

Returns lightid-nombre

Fabrique une nouvellle lampe. Le type peut être: point, directional ou spot. Si la chaîne de caractère du verrou caméra n'est pas vide, alors elle sera attachée à la caméra, et se déplaceront ensemble.

Example

 ; éteindre la lumière principale
 (light-diffuse 0 (vector 0 0 0))
 (light-specular 0 (vector 0 0 0))
 (light-ambient 0 (vector 0 0 0))

 (define mylight (make-light 'point 'free))
 (light-position mylight (vector 5 2 0))
 (light-diffuse mylight (rndvec))
 (light-ambient mylight (vmul (rndvec) 0.1))
 (light-specular mylight (vmul (rndvec) 10))

 (with-state
     (ambient (vector 1 1 1))
     (colour (vector 1 1 1))
     (specular (vector 0.5 0.5 0.5))
     (shinyness 20)
     (build-torus 1 2 20 20))

(light-ambient lightid-nombre couleur)

Returns void

Détermine l'apport en lumière ambiente pour la lampe spécifiée.

Example

 ; éteindre la lumière principale
 (light-diffuse 0 (vector 0 0 0))
 (light-specular 0 (vector 0 0 0))
 (light-ambient 0 (vector 0 0 0))

 (define mylight (make-light 'point 'free))
 (light-position mylight (vector 5 2 0))
 (light-diffuse mylight (rndvec))
 (light-ambient mylight (vmul (rndvec) 0.1))
 (light-specular mylight (vmul (rndvec) 10))

 (with-state
     (ambient (vector 1 1 1))
     (colour (vector 1 1 1))
     (specular (vector 0.5 0.5 0.5))
     (shinyness 20)
     (build-torus 1 2 20 20))

(light-diffuse lightid-nombre couleur)

Returns void

Détermine l'apport en lumière diffusante de la lumière spécifiée.

Example

 ; éteindre la lumière principale
 (light-diffuse 0 (vector 0 0 0))
 (light-specular 0 (vector 0 0 0))
 (light-ambient 0 (vector 0 0 0))

 (define mylight (make-light 'point 'free))
 (light-position mylight (vector 5 2 0))
 (light-diffuse mylight (rndvec))
 (light-ambient mylight (vmul (rndvec) 0.1))
 (light-specular mylight (vmul (rndvec) 10))

 (with-state
     (ambient (vector 1 1 1))
     (colour (vector 1 1 1))
     (specular (vector 0.5 0.5 0.5))
     (shinyness 20)
     (build-torus 1 2 20 20))

(light-specular lightid-nombre couleur)

Returns void

Détermine l'apport de lumière spéculaire à la lumière spécifiée.

Example

 ; éteindre la lumière principale
 (light-diffuse 0 (vector 0 0 0))
 (light-specular 0 (vector 0 0 0))
 (light-ambient 0 (vector 0 0 0))

 (define mylight (make-light 'point 'free))
 (light-position mylight (vector 5 2 0))
 (light-diffuse mylight (rndvec))
 (light-ambient mylight (vmul (rndvec) 0.1))
 (light-specular mylight (vmul (rndvec) 10))

 (with-state
     (ambient (vector 1 1 1))
     (colour (vector 1 1 1))
     (specular (vector 0.5 0.5 0.5))
     (shinyness 20)
     (build-torus 1 2 20 20))

(light-position lightid-nombre position-vecteur)

Returns void

Détermine la position de la lampe spécifiée. Dans l'espace si libre, dans l'espace camera si attachée.

Example

 ; éteindre la lumière principale
 (light-diffuse 0 (vector 0 0 0))
 (light-specular 0 (vector 0 0 0))
 (light-ambient 0 (vector 0 0 0))
 
 (define mylight (make-light 'point 'free))
 (light-position mylight (vector 5 2 0))
 (light-diffuse mylight (rndvec))
 (light-ambient mylight (vmul (rndvec) 0.1))
 (light-specular mylight (vmul (rndvec) 10))
 
 (with-state
     (ambient (vector 1 1 1))
     (colour (vector 1 1 1))
     (specular (vector 0.5 0.5 0.5))
     (shinyness 20)
     (build-torus 1 2 20 20)) 

(light-spot-angle lightid-nombre angle-nombre)

Returns void

Détermine l'angle du cône de lumière spot pour la lampe spécifiée. Si la lampe n'est pas un spot, la commande n'aura aucun effet.

Example

 ; éteindre la lumière principale
 (light-diffuse 0 (vector 0.1 0.1 0.1))
 (light-specular 0 (vector 0 0 0))
 (light-ambient 0 (vector 0 0 0))
 
 (define mylight (make-light 'spot 'free))
 (light-position mylight (vector (+ 4 (crndf)) (crndf) 2))
 (light-diffuse mylight (rndvec))
 (light-ambient mylight (vmul (rndvec) 0.1))
 (light-specular mylight (vmul (rndvec) 10))
 (light-spot-angle mylight (+ 5 (random 40)))
 (light-spot-exponent mylight 500)
 (light-attenuation mylight 'constant 1) 
 (light-direction mylight (vector -1 0 -1))
 
 (with-state
     (ambient (vector 1 1 1))
     (colour (vector 1 1 1))
     (specular (vector 0.5 0.5 0.5))
     (shinyness 20)
     (build-torus 1 2 20 20)
     (scale (vector 10 10 10))
     (translate (vector -0.5 -0.5 0))
     (build-seg-plane 20 20)) 

(light-spot-exponent lightid-nombre exposant-nombre)

Returns void

Règle l'exposant du spot (le flou du cône) pour la lumière spécifiée. Si la lampe n'est pas un spot, la commande n'aura aucun effet.

Example

 ; éteindre la lumière principale
 (light-diffuse 0 (vector 0.1 0.1 0.1))
 (light-specular 0 (vector 0 0 0))
 (light-ambient 0 (vector 0 0 0))
 
 (define mylight (make-light 'spot 'free))
 (light-position mylight (vector (+ 4 (crndf)) (crndf) 2))
 (light-diffuse mylight (rndvec))
 (light-ambient mylight (vmul (rndvec) 0.1))
 (light-specular mylight (vmul (rndvec) 10))
 (light-spot-angle mylight (+ 5 (random 40)))
 (light-spot-exponent mylight 500)
 (light-attenuation mylight 'constant 1) 
 (light-direction mylight (vector -1 0 -1))
 
 (with-state
     (ambient (vector 1 1 1))
     (colour (vector 1 1 1))
     (specular (vector 0.5 0.5 0.5))
     (shinyness 20)
     (build-torus 1 2 20 20)
     (scale (vector 10 10 10))
     (translate (vector -0.5 -0.5 0))
     (build-seg-plane 20 20)) 

(light-attenuation lightid-nombre type-symbol attenuation-nombre)

Returns void

Détermine l'atténuation (estompement avec la distance) de la lumière spécifiée. Le symbol de type peut être: constant, linear ou quadratic

Example

 ; éteindre la lumière principale
 (light-diffuse 0 (vector 0.1 0.1 0.1))
 (light-specular 0 (vector 0 0 0))
 (light-ambient 0 (vector 0 0 0))

 (define mylight (make-light 'spot 'free))
 (light-position mylight (vector (+ 4 (crndf)) (crndf) 2))
 (light-diffuse mylight (rndvec))
 (light-ambient mylight (vmul (rndvec) 0.1))
 (light-specular mylight (vmul (rndvec) 10))
 (light-spot-angle mylight (+ 5 (random 40)))
 (light-spot-exponent mylight 500)
 (light-attenuation mylight 'constant 1)
 (light-direction mylight (vector -1 0 -1))

 (with-state
     (ambient (vector 1 1 1))
     (colour (vector 1 1 1))
     (specular (vector 0.5 0.5 0.5))
     (shinyness 20)
     (build-torus 1 2 20 20)
     (scale (vector 10 10 10))
     (translate (vector -0.5 -0.5 0))
     (build-seg-plane 20 20))

(light-direction lightid-nombre direction-vecteur)

Returns void

Détermine la direction d'une lampe directionnelle. Si ce n'est pas une lampe directionnelle, la commande n'aura aucun effet.

Example

 ; éteindre la lumière principale
 (light-diffuse 0 (vector 0.1 0.1 0.1))
 (light-specular 0 (vector 0 0 0))
 (light-ambient 0 (vector 0 0 0))

 (define mylight (make-light 'spot 'free))
 (light-position mylight (vector (+ 4 (crndf)) (crndf) 2))
 (light-diffuse mylight (rndvec))
 (light-ambient mylight (vmul (rndvec) 0.1))
 (light-specular mylight (vmul (rndvec) 10))
 (light-spot-angle mylight (+ 5 (random 40)))
 (light-spot-exponent mylight 500)
 (light-attenuation mylight 'constant 1)
 (light-direction mylight (vector -1 0 -1))

 (with-state
     (ambient (vector 1 1 1))
     (colour (vector 1 1 1))
     (specular (vector 0.5 0.5 0.5))
     (shinyness 20)
     (build-torus 1 2 20 20)
     (scale (vector 10 10 10))
     (translate (vector -0.5 -0.5 0))
     (build-seg-plane 20 20))