#ifndef rdo_finish_H #define rdo_finish_H /* Optical properties of object surfaces. */ #define rdo_finish_H_COPYRIGHT "Copyright © 2008 Danillo Pereira and J. Stolfi, UNICAMP" /* Last edited on 2024-12-21 11:54:12 by stolfi */ #include #include #include #include #include typedef struct finish_t { char *name; /* Name of finish (used to attach it to objects). */ /* Spontaneous light emission parameters: */ frgb_t emission; /* Coefficient of spontaneous emission (`ambient'). */ /* Light scattering parameters (components of the albedo): */ frgb_t diffusion; /* Lambertian scattering coefficient. */ frgb_t polish; /* Polished scattering coefficient (`highlights'). */ frgb_t reflection; /* Mirror reflection coefficient. */ } finish_t; /* Optical properties of a surface. */ double rdo_finish_get_diffusion_coeff(finish_t *fn, int channel); /* Gets the Lambertian scattering (`diffusion') coefficient fo finish {fn} in the color band {channel}. */ double rdo_finish_get_emission_coeff(finish_t *fn, int channel); /* Gets the spontaneous Lambertian emission (`ambient coefficient' in raytracing jargon) of finish {fn} in the color band {channel}. */ void rdo_finish_write(FILE *wr, finish_t *fn); /* Writes to {wr} a description of finish {fn}. */ finish_t rdo_finish_read(FILE *rd); /* Reads from {rd} the description of a surface finish, in the format produced by {rdo_write_finish}. */ void rdo_finish_check_max_albedo(finish_t *fn, double max_albedo); /* Checks whether the total albedo of {fn}, in any channel, exceeds the given {max_albedo}. If it does, aborts the program. */ /* LIST OF FINISHES */ vec_typedef(finish_vec_t, finish_vec, finish_t); /* A self-delimited vector of finishes, {v.e[0..v.ne-1]}. Also defines the functions {finish_vec_new()}, {finish_vec_expand()}, {finish_vec_trim()}, {finish_vec_free()}. */ void rdo_finish_vec_write(FILE *wr, finish_vec_t *fns); /* Writes to {wr} the list of finishes {fns}. */ finish_vec_t rdo_finish_vec_read(FILE *rd); /* Reads from {rd}a list of finishes, in the format produced by {rdo_finish_vec_write}. */ #endif