/*************************************************************************/ /* */ /* Copyright (c) 1994 Stanford University */ /* */ /* All rights reserved. */ /* */ /* Permission is given to use, copy, and modify this software for any */ /* non-commercial purpose as long as this copyright notice is not */ /* removed. All other uses, including redistribution in whole or in */ /* part, are forbidden without prior written permission. */ /* */ /* This software is provided with absolutely no warranty and no */ /* support. */ /* */ /*************************************************************************/ /****************************************************************************** * * * option.c: Rendering options selected. * * * ******************************************************************************/ #include "incl.h" long block_xlen,block_ylen; BOOLEAN adaptive; /* adaptive ray tracing? */ /* During shading: */ long density_epsilon; /* minimum (density*map_divisor) */ /* (>= MIN_DENSITY) */ long magnitude_epsilon; /* minimum (magnitude*grd_divisor)**2 */ /* (> MIN_MAGNITUDE) */ /* Shading parameters of reflective surface: */ float density_opacity[MAX_DENSITY+1]; /* opacity as function of density */ float magnitude_opacity[MAX_MAGNITUDE+1];/* opacity as function of magnitude*/ /* Global lighting parameters: */ PIXEL background; /* color of background assumed to be zero */ /* because of hack for producing final */ /* image on host from node images */ float light[NM]; /* normalized vector from object to light */ /* Lighting parameters of reflective surface:*/ float ambient_color; /* color of ambient reflection */ float diffuse_color; /* color of diffuse reflection */ float specular_color; /* color of specular reflection */ float specular_exponent; /* exponent of specular reflection */ /* Depth cueing parameters: */ float depth_hither; /* percentage of full intensity at hither */ float depth_yon; /* percentage of full intensity at yon */ float depth_exponent; /* exponent of falloff from hither to yon */ /* During shading, rendering, ray tracing: */ float opacity_epsilon; /* minimum opacity */ /* (usually >= MIN_OPACITY, */ /* < MIN_OPACITY during shading shades */ /* all voxels for generation of mipmap) */ /* During rendering and ray tracing: */ float opacity_cutoff; /* cutoff opacity */ /* (<= MAX_OPACITY) */ /* During ray tracing: */ long highest_sampling_boxlen; /* highest boxlen for adaptive sampling */ /* (>= 1) */ long lowest_volume_boxlen; /* lowest boxlen for volume data */ /* (>= 1) */ long volume_color_difference; /* minimum color diff for volume data */ /* (>= MIN_PIXEL) */ long pyr_highest_level; /* highest level of pyramid to look at */ /* (<= MAX_PYRLEVEL) */ long pyr_lowest_level; /* lowest level of pyramid to look at */ /* (>= 0) */ float angle[NM]; /* initial viewing angle */ EXTERN_ENV void Init_Options() { norm_address = NULL; opc_address = NULL; pyr_address[0] = NULL; background = NULL_PIXEL; Init_Opacity(); Init_Lighting(); angle[X] = 90.0; angle[Y] = -36.0; angle[Z] = 0.0; Init_Parallelization(); opacity_epsilon = 0.0; opacity_cutoff = 0.95; highest_sampling_boxlen = HBOXLEN; /* this must be less than BLOCK_LEN */ /* and both must be powers of 2 */ lowest_volume_boxlen = 1; volume_color_difference = 16; pyr_highest_level = 5; pyr_lowest_level = 2; } void Init_Opacity() { long i; float increment; density_epsilon = 96; magnitude_epsilon = 1; /* initialize opacity functions (hardwired for simplicity) */ density_opacity[MIN_DENSITY] = 0.0; density_opacity[95] = 0.0; density_opacity[135] = 1.0; density_opacity[MAX_DENSITY] = 1.0; for (i=MIN_DENSITY; i<95; i++) density_opacity[i] = 0.0; increment = 1.0/(135.0-95.0); for (i=95; i<134; i++) density_opacity[i+1] = density_opacity[i]+increment; for (i=135; i