/************************************************************************
 *
 *      Clean.ray
 *
 *      This is an example file for the rsdefs package originally
 *	created by Stuart Warmink and modified to use the rsdefs
 *	package.
 *
 *      Please do not edit this file, or any of the other files in
 *      this package!  Make additions to these in your own separate
 *      file.  If you think you have something that should be added
 *      permanently, please send it to Larry Coffin and/or David
 *      DeBry (email addresses listed below).  If we include it in
 *      the next release, we'll put your name in the contributor's
 *      list.
 *
 *      Contributors (in alphabetical order):
 *          Larry Coffin <lcoffin@clciris.chem.umr.edu>
 *          David DeBry <ddebry@dsd.es.com>
 *	    Stuart Warmink <sw@groucho.att.com>
 *
 ** Good clean fun
 **
 ** (c) Stuart Warmink, January 1993
 ** sw@groucho.att.com
 ** Feel free to use and/or distribute for non-commercial purposes as long
 ** as this header remains with the file.
 **
 ** "glass" object "borrowed" from the Example directory, generated by C. Kolb
 **
 ** Scene has been optimised for a 4 x 3 ratio image size.  Expect this to
 ** take *lots* of CPU time despite use of "grid"s because of the many
 ** objects (1033!) and samples = 3 or 4 required for the extended and area
 ** light sources.
 **
 */

#include	"defs.rh"	

/***************************************************************************
 *
 *	Surfaces
 */

RSSporcelain_pink(surface porcelain)

surface glass
        diffuse .08 .08 .08
        specular .2 .2 .2
        reflect 0.4
        transp 1
        body .9 .9 .9
        index 1.3
        specpow 80

surface Tile_gray
	ambient 0.25 0.25 0.25
        diffuse 0.35 0.35 0.35
        reflect 0.10
        specular 1 1 1
        specpow 40

surface Grout_white
	ambient 0.5 0.5 0.5
        diffuse 0.5 0.5 0.5

/***********************************************************************
 *
 *	Wall Tile constants
 */

#define		LEN	4.7 	/* cm, was 5.0 */
#define		RAD	0.6	/* cm, was 0.3 */
#define		SEP	(2*((LEN)+(RAD))+0.2)
#define		GD	0.03	/* cm */


/***********************************************************************
 *
 *	A tile
 */

name	Cyl
  list
    disc	(RAD)	(LEN) 0 0		 1 0 0
    cylinder	(RAD)	(LEN) 0 0		(-LEN) 0 0
    disc	(RAD)	(-LEN) 0 0	-1 0 0
  end

name	Tile
  union
    box	(LEN) (LEN) 0	(-LEN) (-LEN) (RAD)
    union
      list
        sphere	(RAD) (LEN) (LEN) 0
        sphere	(RAD) (LEN) (-LEN) 0
        sphere	(RAD) (-LEN) (LEN) 0
        sphere	(RAD) (-LEN) (-LEN) 0
      end
      list
        object Cyl			translate	0 (LEN) 0
        object Cyl			translate	0 (-LEN) 0
        object Cyl	rotate 0 0 1 90 translate	(LEN) 0 0
        object Cyl	rotate 0 0 1 90 translate	(-LEN) 0 0
      end
    end
  end
  scale	1 1 0.33


/***********************************************************************
 *
 *	Soap and soap dish
 */

RSPsoap_and_dish(,RSSsoap_light(),porcelain)
	translate	(-1*((SEP)/2)) 5 (-1*((SEP)/2))

/***********************************************************************
 *
 *	Glass holder
 */

RSPglass_holder(,porcelain)
	translate	(-5*((SEP)/2)) 5 (-1*((SEP)/2))

/***********************************************************************
 *
 *	Glass
 */

RSPglass(,glass)
	scale	3.4 3.4 5.5
	translate	((-5*((SEP)/2)-0.05)) 4.90 ((-1*((SEP)/2)-1))

/***********************************************************************
 *
 *	Toothbrushes!
 */

RSPtoothbrush(,RSSplastic_yellow())
	rotate	0 1 0	-92
	rotate	0 0 1	-155
	translate	((-5*((SEP)/2)+5.5)) (0.5+4.5+2.8) ((-1*((SEP)/2)+0.8))

RSPtoothbrush(,RSSplastic())
	rotate	0 1 0	-92
	rotate	0 0 1	-70
	translate	((-5*((SEP)/2)-5.5)) (0.5+4.5+2.8) ((-1*((SEP)/2)+0.8))

/***********************************************************************
 *
 *	Wall of tiles
 */

name	Tiled_wall
grid	10 1 6
object  Tile_gray Tile rotate 1 0 0 -90 translate ( 1*(SEP)+0.03) 0 0
object  Tile_gray Tile rotate 1 0 0 -90 translate          0 0 0.03
object  Tile_gray Tile rotate 1 0 0 -90 translate (-1*(SEP)) 0 0
object  Tile_gray Tile rotate 1 0 0 -90 translate (-2*(SEP)-0.02) 0 0
object  Tile_gray Tile rotate 1 0 0 -90 translate (-3*(SEP)-0.035) 0 0.045
  
object  Tile_gray Tile rotate 1 0 0 -90 translate ( 1*(SEP)) 0 (-1*(SEP))
object  porcelain Tile rotate 1 0 0 -90 translate          -0.04 0 (-1*(SEP))
object  Tile_gray Tile rotate 1 0 0 -90 translate (-1*(SEP)) 0 (-1*(SEP)-0.04)
object  porcelain Tile rotate 1 0 0 -90 translate (-2*(SEP)) 0 (-1*(SEP))
object  Tile_gray Tile rotate 1 0 0 -90 translate (-3*(SEP)+0.015) 0 (-1*(SEP))
  
object  Tile_gray Tile rotate 1 0 0 -90 translate ( 1*(SEP)) 0 (-2*(SEP)+0.04)
object  Tile_gray Tile rotate 1 0 0 -90 translate          0 0 (-2*(SEP))
object  Tile_gray Tile rotate 1 0 0 -90 translate (-1*(SEP)+0.02) 0 (-2*(SEP))
object  Tile_gray Tile rotate 1 0 0 -90 translate (-2*(SEP)) 0 (-2*(SEP)-0.01)
object  Tile_gray Tile rotate 1 0 0 -90 translate (-3*(SEP)-0.01) 0 (-2*(SEP))
end

object  Tiled_wall
	translate	(-1*((SEP)/2)) 0 ((SEP)/2)
     	texture bump 0.05	scale 7 7 7
     	texture bump 0.02	scale 2 3 4

plane   Grout_white	0 (GD) 0	0 1 0
        texture bump	0.7	scale 0.01 0.01 0.01
        texture bump 	0.3     scale 2  2  2


background	0.8 0.8 0.8	/* easy way out of simulating white walls... */



/***********************************************************************
 *
 * light over the sink - two spotlights
 */

light 0.4	extended	4
		(-3*((SEP)/2)+12) 10  (12*((SEP)/2))
light 0.4	extended	4
		(-3*((SEP)/2)-12) 10  (12*((SEP)/2))

/***********************************************************************
 *
 * fake window lighting, more realistic
 */

light	0.8	area
		-20 190 0	-80 190 0	2
				-20 190 100	3
		
/***********************************************************************
 *
 * simulates inter-diffuse reflections
 */

light 1.0	ambient

/***********************************************************************
 *
 * normal view
 */

eyep	-30 145 35
lookp	(-3.1*((SEP)/2)) 7 ((-2.9/5)*((SEP)/2))
fov	15

/***********************************************************************
 *
 * default settings - but keep 4x3 ratio and sample at least 3
 */

screen 640 480
sample 3
