light.h

Go to the documentation of this file.
00001 /*                         L I G H T . H
00002  * BRL-CAD
00003  *
00004  * Copyright (c) 1990-2006 United States Government as represented by
00005  * the U.S. Army Research Laboratory.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this file; see the file named COPYING for more
00019  * information.
00020  */
00021 /** @addtogroup librt */
00022 /*@{*/
00023 /** @file light.h
00024  *
00025  * @brief
00026  *  Declarations related to light sources
00027  *
00028  *  @par Source
00029  *      SECAD/VLD Computing Consortium, Bldg 394
00030  *@n    The U. S. Army Ballistic Research Laboratory
00031  *@n    Aberdeen Proving Ground, Maryland  21005-5066
00032  *
00033  *  @(#)$Header: /cvsroot/brlcad/brlcad/include/light.h,v 14.13 2006/09/18 05:24:07 lbutler Exp $ (BRL)
00034  */
00035 
00036 #ifndef SEEN_LIGHT_H
00037 #define SEEN_LIGHT_H seen
00038 
00039 #include "common.h"
00040 
00041 #include "machine.h"
00042 #include "bu.h"
00043 #include "bn.h"
00044 #include "raytrace.h"
00045 
00046 /* XXX replicated from optical.h */
00047 #ifndef OPTICAL_EXPORT
00048 #  if defined(_WIN32) && !defined(__CYGWIN__) && defined(BRLCAD_DLL)
00049 #    ifdef OPTICAL_EXPORT_DLL
00050 #      define OPTICAL_EXPORT __declspec(dllexport)
00051 #    else
00052 #      define OPTICAL_EXPORT __declspec(dllimport)
00053 #    endif
00054 #  else
00055 #    define OPTICAL_EXPORT
00056 #  endif
00057 #endif
00058 
00059 
00060 __BEGIN_DECLS
00061 
00062 struct light_pt {
00063         point_t lp_pt;
00064         vect_t  lp_norm;
00065 };
00066 #define LPT_MAGIC 0x327649
00067 #define SOME_LIGHT_SAMPLES 128
00068 
00069 struct light_specific {
00070         struct bu_list  l;      /**< @brief doubly linked list */
00071         /* User-specified fields */
00072         vect_t  lt_target;      /**< @brief explicit coordinate aim point */
00073         fastf_t lt_intensity;   /**< @brief Intensity Lumens (cd*sr): total output */
00074         fastf_t lt_angle;       /**< @brief beam dispersion angle (degrees) 0..180 */
00075         fastf_t lt_fraction;    /**< @brief fraction of total light */
00076         int     lt_shadows;     /**< @brief !0 if this light casts shadows, # of rays*/
00077         int     lt_infinite;    /**< @brief !0 if infinitely distant */
00078         int     lt_visible;     /**< @brief 0 if implicitly modeled or invisible */
00079         int     lt_invisible;   /**< @brief 0 if implicitly modeled or invisible */
00080         int     lt_exaim;       /**< @brief !0 if explicit aim in lt_target */
00081         fastf_t lt_obscure;     /**< @brief percentage obscuration of light */
00082         /* Internal fields */
00083 #if RT_MULTISPECTRAL
00084         struct bn_tabdata *lt_spectrum; /**< @brief Units?  mw*sr ? */
00085 #else
00086         vect_t  lt_color;       /**< @brief RGB, as 0..1 */
00087 #endif
00088         fastf_t lt_radius;      /**< @brief approximate radius of spherical light */
00089         fastf_t lt_cosangle;    /**< @brief cos of lt_angle */
00090         vect_t  lt_pos;         /**< @brief location in space of light */
00091         vect_t  lt_vec;         /**< @brief Unit vector from origin to light */
00092         vect_t  lt_aim;         /**< @brief Unit vector - light beam direction */
00093         char    *lt_name;       /**< @brief identifying string */
00094         struct  region *lt_rp;  /**< @brief our region of origin */
00095         int     lt_pt_count;    /**< @brief count of how many lt_sample_pts have been set */
00096         struct light_pt *lt_sample_pts; /**< @brief dynamically allocated list of light sample points */
00097         fastf_t lt_parse_pt[6];
00098 };
00099 #define LIGHT_NULL      ((struct light_specific *)0)
00100 #define LIGHT_MAGIC     0xdbddbdb7
00101 #define RT_CK_LIGHT(_p) BU_CKMAG((_p), LIGHT_MAGIC, "light_specific")
00102 
00103 /* defined in sh_light.c */
00104 OPTICAL_EXPORT extern struct light_specific     LightHead;
00105 
00106 OPTICAL_EXPORT extern void light_cleanup(void);
00107 OPTICAL_EXPORT extern void light_maker(int num, mat_t v2m);
00108 OPTICAL_EXPORT extern int light_init(struct application *ap);
00109 OPTICAL_EXPORT extern void light_obs(struct application *ap, struct shadework *swp, int have);
00110 
00111 __END_DECLS
00112 
00113 #endif /* SEEN_LIGHT_H */
00114 /*@}*/
00115 /*
00116  * Local Variables:
00117  * mode: C
00118  * tab-width: 8
00119  * c-basic-offset: 4
00120  * indent-tabs-mode: t
00121  * End:
00122  * ex: shiftwidth=4 tabstop=8
00123  */
00124 

Generated on Mon Sep 18 01:24:41 2006 for BRL-CAD by  doxygen 1.4.6