CCL Home Page
Up Directory CCL sub
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh 'sub.h' <<'END_OF_FILE'
X/*
X * sub.h - include file depecting a generic fast attack submarine
X *
X * It should be easy to add more details, such as a periscope and
X * vent holes for close-up scenes if desired.
X *
X * Stuart Warmink
X * sw@groucho.att.com
X * 11/19/92
X */
X
Xdefine	Center_hull_len		(4)
Xdefine	Bow_len			(4)
Xdefine	Stern_len		(9)
X
Xdefine	Oval_factor		(1.1)
Xdefine	Deck_level		(0.95)
X
Xdefine	Sail_wid		(0.3)
Xdefine	Sail_front		(0.6)
Xdefine	Sail_rear		(1.2)
Xdefine	Sail_height		(2.0)	/* From centerline */
Xdefine	Sail_to_bow		(0)	/* From origin to "center" of sail */
X
Xdefine	Fin_wid			(0.3)
Xdefine	Fin_dep			(0.05)
Xdefine	Fin_len			(0.95)
Xdefine	Fin_from_rear		(2)	/* From rear to "center" of tailfin */
Xdefine	Fin_from_top		(0.4)	/* From top of sail */
X
X
X
X/* Generic objects that can be scaled and translated etc. later */
X
Xname	unit_cylinder		/* along z axis */
X	list
X		disc		1	0 0 1	0 0 1
X		cylinder	1	0 0 0	0 0 1
X		disc		1	0 0 0	0 0 -1
X	end
X
Xname	unit_sphere
X	sphere			1	0 0 0
X
Xname	unit_box
X	box			1 1 0	-1 -1	1
X
X/* Build a pair of fins */
X
Xname	ver_fin
X	list
X		object	unit_cylinder
X			scale	(Fin_wid) (Fin_dep) (1)
X		object	unit_cylinder
X			rotate	1 0 0	180
X			scale	(Fin_wid) (Fin_dep) (1)
X	end
X
Xname	hor_fin
X	list
X		object	unit_cylinder
X			rotate	1 0 0	90
X			scale	(Fin_wid) 1 (Fin_dep)
X		object	unit_cylinder
X			rotate	1 0 0	270
X			scale	(Fin_wid) 1 (Fin_dep)
X	end
X
Xname	tail_fins
X	union
X		object	ver_fin
X		object	hor_fin
X	end
X
X
X/* Build main hull */
X
Xname	bow
X	difference
X		object	unit_sphere
X			scale	(Bow_len) 1 (Oval_factor)
X		object	unit_box
X			rotate		0 1 0	-90
X			scale	((Bow_len)+1) 2 ((Oval_factor)+1) 
X	end
X
Xname	stern
X	union
X		difference
X			object	unit_sphere
X				scale	(Stern_len) 1 (Oval_factor)
X			object	unit_box
X				rotate		0 1 0	90
X				scale	((Stern_len)+1) 2 ((Oval_factor)+1)
X		end
X		object	tail_fins
X			translate
X			(-1*(((Center_hull_len)/2)+(Stern_len)-(Fin_from_rear))) 0 0
X	end
X
Xname	center
X	union
X		object	unit_cylinder
X			rotate		0 1 0	90
X			scale	((Center_hull_len)/2) 1 (Oval_factor)
X		object	unit_cylinder
X			rotate		0 1 0	-90
X			scale	((Center_hull_len)/2) 1 (Oval_factor)
X	end
X
Xname 	basic_hull
X	difference
X		union
X			union
X				object bow
X					translate	((Center_hull_len)/2) 0 0
X				object	center
X			end
X			object stern
X				translate	(-1*((Center_hull_len)/2)) 0 0
X		end
X		object	unit_box
X			scale		10 10 2
X			translate	0 0 (Deck_level)
X	end
X
X/* Build sail */
X
Xname	sail_front
X	difference
X		object	unit_cylinder
X			scale	(Sail_front) (Sail_wid) (Sail_height)
X		object	unit_box
X			rotate		0 1 0	-90
X			scale	((Sail_front)+1) ((Sail_wid)+1) ((Sail_height)+1)
X	end
X
Xname	sail_rear
X	difference
X		object	unit_cylinder
X			scale	(Sail_rear) (Sail_wid) (Sail_height)
X		object	unit_box
X			rotate		0 1 0	90
X			scale	((Sail_rear)+1) ((Sail_wid)+1) ((Sail_height)+1)
X	end
X
Xname	sail
X	union
X		union
X		
X			object	sail_front
X			object	sail_rear
X		end
X		object	hor_fin
X			translate	0 0
X					((Sail_height)-(Fin_from_top))
X	end
X
X/* Make up full hull structure */
X
Xname	hull
X	union
X		object	basic_hull
X		object	sail
X			translate	(Sail_to_bow) 0 0
X	end
X
Xname	sub
X	object	hull
X		texture bump 0.05
X			scale	0.1 0.1 0.1
END_OF_FILE
if test 3123 -ne `wc -c <'sub.h'`; then
    echo shar: \"'sub.h'\" unpacked with wrong size!
fi
# end of 'sub.h'
fi
if test -f 'sub.ray' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sub.ray'\"
else
echo shar: Extracting \"'sub.ray'\" \(1255 characters\)
sed "s/^X//" >'sub.ray' <<'END_OF_FILE'
X/*
X * sub.ray (requires sub.h include file)
X *
X * Attack sub just below the surface
X *
X * Stuart Warmink
X * sw@groucho.att.com
X * 11/19/92
X */
X
X#include "sub.h"
X
Xsurface water 			
X	ambient 0 0.0 0.3
X	diffuse 0 0.0 0.5
X	specular 0.8 0.8 0.8 
X	specpow 30 
X	reflect 0.03
X	transp 0.99 index 1.326
X
Xsurface dark_grey
X	ambient		0.2 0.2 0.2
X	diffuse		0.4 0.4 0.4
X
X/* for quick testing */
X/*
Xsphere	dark_grey
X	1 0 0 -3
X	scale 9 1 1
X	rotate	15	0 1 0
X	rotate	-10	1 0 0
X*/
X
X/* the real thing */
Xobject	dark_grey sub
X	rotate	15	0 1 0
X	rotate	-10	1 0 0
X	translate	2 0 -3
X
Xplane water	0 0 0	0 0 1
X	/* to create "caustics" */
X	texture sky 0.75 0.5 2.0 6 0.56 0.36
X		scale	0.5 .9 1
X	/* two scales of wave action */
X	texture bump	1	
X		scale	2 8 1
X	texture bump	0.2	
X		scale	1.2 2.3 1
X
X/* dark blue background */
Xbackground 	0 0 0.4
X
X/* even deeper blue water colour */
Xatmosphere 1.326 	mist
X	0 0 0.3	20 20 20	0	-200
X
X/* the dark, dark depths... */
Xplane	ambient 0 0 0
X	0 0 -6		0 0 1
X
Xeyep	24 16 -3
Xlookp	2 0 -2
Xfov	24
X
Xscreen 800 600
Xsample 2
X
X/* simulates glow of sunlight through water */
Xlight	3	area
X	 11 4 -0.5	-11 4 -0.5	2
X	 11 -4 -0.5			6
X
X/* a little "ambient" lighting */
Xlight	0.7	point
X	24 16 -3
X
X/* to create the "caustics" */
Xlight	0.8	point
X	1000 1000 3000
END_OF_FILE
if test 1255 -ne `wc -c <'sub.ray'`; then
    echo shar: \"'sub.ray'\" unpacked with wrong size!
fi
# end of 'sub.ray'
fi
echo shar: End of shell archive.
exit 0
Modified: Wed Dec 11 17:00:00 1996 GMT
Page accessed 4857 times since Sat Apr 17 21:59:14 1999 GMT