Debian Codegraph @

common/main/lighting.h

raw
1 /*
2 * Portions of this file are copyright Rebirth contributors and licensed as
3 * described in COPYING.txt.
4 * Portions of this file are copyright Parallax Software and licensed
5 * according to the Parallax license below.
6 * See COPYING.txt for license details.
7
8 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
9 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
10 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
11 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
12 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
13 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
14 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
15 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
16 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
17 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
18 */
19
20 /*
21 *
22 * Lighting system prototypes, structures, etc.
23 *
24 */
25
26 #pragma once
27
28 #include "maths.h"
29 #include "vecmat.h"
30
31 #include "fwd-object.h"
32 #include "fwd-segment.h"
33 #include "3d.h"
34 #include "d_array.h"
35
36 #define MIN_LIGHT_DIST (F1_0*4)
37
38 namespace dcx {
39
40 struct d_level_unique_light_state
41 {
42 enumerated_array<g3s_lrgb, MAX_VERTICES, vertnum_t> Dynamic_light;
43 };
44
45 }
46
47 #ifdef DXX_BUILD_DESCENT
48 namespace dsx {
49
50 #if DXX_BUILD_DESCENT == 2
51 struct d_level_unique_headlight_state
52 {
53 unsigned Num_headlights{};
54 std::array<const object_base *, 8> Headlights{};
55 };
56
57 struct d_level_unique_light_state :
58 d_level_unique_headlight_state,
59 ::dcx::d_level_unique_light_state
60 {
61 };
62 #endif
63
64 extern d_level_unique_light_state LevelUniqueLightState;
65 }
66 extern const object *old_viewer;
67
68 namespace dsx {
69 // compute the lighting for an object. Takes a pointer to the object,
70 // and possibly a rotated 3d point. If the point isn't specified, the
71 // object's center point is rotated.
72 g3s_lrgb compute_object_light(const d_level_unique_light_state &LevelUniqueLightState, vcobjptridx_t obj);
73
74 // turn headlight boost on & off
75 #if DXX_BUILD_DESCENT == 2
76 void toggle_headlight_active(object &);
77 #endif
78 }
79 void start_lighting_frame(const object &viewer);
80 #endif