BRL-CAD
light.h
Go to the documentation of this file.
1/* L I G H T . H
2 * BRL-CAD
3 *
4 * Copyright (c) 1990-2023 United States Government as represented by
5 * the U.S. Army Research Laboratory.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; see the file named COPYING for more
18 * information.
19 */
20/** @addtogroup liboptical */
21/** @{ */
22/** @file light.h
23 *
24 * @brief
25 * Declarations related to light sources
26 *
27 */
28
29#ifndef OPTICAL_LIGHT_H
30#define OPTICAL_LIGHT_H
31
32#include "common.h"
33
34#include "bu/magic.h"
35#include "bu/list.h"
36#include "bn/tabdata.h"
37#include "rt/application.h"
38#include "optical/defines.h"
39#include "optical/shadework.h"
40
41__BEGIN_DECLS
42
43struct light_pt {
46};
47#define LPT_MAGIC 0x327649
48#define SOME_LIGHT_SAMPLES 128
49
51 struct bu_list l; /**< @brief doubly linked list */
52 /* User-specified fields */
53 vect_t lt_target; /**< @brief explicit coordinate aim point */
54 fastf_t lt_intensity; /**< @brief Intensity Lumens (cd*sr): total output */
55 fastf_t lt_angle; /**< @brief beam dispersion angle (degrees) 0..180 */
56 fastf_t lt_fraction; /**< @brief fraction of total light */
57 int lt_shadows; /**< @brief !0 if this light casts shadows, # of rays*/
58 int lt_infinite; /**< @brief !0 if infinitely distant */
59 int lt_visible; /**< @brief 0 if implicitly modeled or invisible */
60 int lt_invisible; /**< @brief 0 if implicitly modeled or invisible */
61 int lt_exaim; /**< @brief !0 if explicit aim in lt_target */
62 fastf_t lt_obscure; /**< @brief percentage obscuration of light */
63 /* Internal fields */
64 vect_t lt_color; /**< @brief RGB, as 0..1 */
65 fastf_t lt_radius; /**< @brief approximate radius of spherical light */
66 fastf_t lt_cosangle; /**< @brief cos of lt_angle */
67 vect_t lt_pos; /**< @brief location in space of light */
68 vect_t lt_vec; /**< @brief Unit vector from origin to light */
69 vect_t lt_aim; /**< @brief Unit vector - light beam direction */
70 char *lt_name; /**< @brief identifying string */
71 struct region *lt_rp; /**< @brief our region of origin */
72 int lt_pt_count; /**< @brief count of how many lt_sample_pts have been set */
73 struct light_pt *lt_sample_pts; /**< @brief dynamically allocated list of light sample points */
75};
76#define LIGHT_NULL ((struct light_specific *)0)
77#define RT_CK_LIGHT(_p) BU_CKMAG((_p), LIGHT_MAGIC, "light_specific")
78
79/* defined in sh_light.c */
80OPTICAL_EXPORT extern struct light_specific LightHead;
81
82OPTICAL_EXPORT extern void light_cleanup(void);
83OPTICAL_EXPORT extern void light_maker(int num, mat_t v2m);
84OPTICAL_EXPORT extern int light_init(struct application *ap);
85OPTICAL_EXPORT extern void light_obs(struct application *ap, struct shadework *swp, int have);
86
87__END_DECLS
88
89#endif /* OPTICAL_LIGHT_H */
90
91/** @} */
92/*
93 * Local Variables:
94 * mode: C
95 * tab-width: 8
96 * indent-tabs-mode: t
97 * c-file-style: "stroustrup"
98 * End:
99 * ex: shiftwidth=4 tabstop=8
100 */
Header file for the BRL-CAD common definitions.
void light_cleanup(void)
int light_init(struct application *ap)
void light_obs(struct application *ap, struct shadework *swp, int have)
struct light_specific LightHead
void light_maker(int num, mat_t v2m)
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition: vmath.h:345
double fastf_t
fastest 64-bit (or larger) floating point type
Definition: vmath.h:330
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
Definition: vmath.h:366
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:351
Global registry of recognized magic numbers.
Definition: list.h:131
Definition: light.h:43
vect_t lp_norm
Definition: light.h:45
point_t lp_pt
Definition: light.h:44
vect_t lt_pos
location in space of light
Definition: light.h:67
fastf_t lt_intensity
Intensity Lumens (cd*sr): total output.
Definition: light.h:54
fastf_t lt_parse_pt[6]
Definition: light.h:74
vect_t lt_aim
Unit vector - light beam direction.
Definition: light.h:69
fastf_t lt_angle
beam dispersion angle (degrees) 0..180
Definition: light.h:55
struct light_pt * lt_sample_pts
dynamically allocated list of light sample points
Definition: light.h:73
fastf_t lt_cosangle
cos of lt_angle
Definition: light.h:66
fastf_t lt_obscure
percentage obscuration of light
Definition: light.h:62
int lt_infinite
!0 if infinitely distant
Definition: light.h:58
fastf_t lt_fraction
fraction of total light
Definition: light.h:56
fastf_t lt_radius
approximate radius of spherical light
Definition: light.h:65
int lt_shadows
!0 if this light casts shadows, # of rays
Definition: light.h:57
vect_t lt_color
RGB, as 0..1.
Definition: light.h:64
int lt_visible
0 if implicitly modeled or invisible
Definition: light.h:59
struct region * lt_rp
our region of origin
Definition: light.h:71
struct bu_list l
doubly linked list
Definition: light.h:51
vect_t lt_target
explicit coordinate aim point
Definition: light.h:53
int lt_exaim
!0 if explicit aim in lt_target
Definition: light.h:61
int lt_invisible
0 if implicitly modeled or invisible
Definition: light.h:60
vect_t lt_vec
Unit vector from origin to light.
Definition: light.h:68
int lt_pt_count
count of how many lt_sample_pts have been set
Definition: light.h:72
char * lt_name
identifying string
Definition: light.h:70
Definition: region.h:44