1 #ifndef _RENDER_PLACE_OBJECTS_CLASS_
2 #define _RENDER_PLACE_OBJECTS_CLASS_
3 /*
4 
5 	Copyright (C) 1991-2001 and beyond by Bungie Studios, Inc.
6 	and the "Aleph One" developers.
7 
8 	This program is free software; you can redistribute it and/or modify
9 	it under the terms of the GNU General Public License as published by
10 	the Free Software Foundation; either version 3 of the License, or
11 	(at your option) any later version.
12 
13 	This program is distributed in the hope that it will be useful,
14 	but WITHOUT ANY WARRANTY; without even the implied warranty of
15 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 	GNU General Public License for more details.
17 
18 	This license is contained in the file "COPYING",
19 	which is included with this source code; it is available online at
20 	http://www.gnu.org/licenses/gpl.html
21 
22 	Rendering Object-Placement Class
23 	by Loren Petrich,
24 	August 6, 2000
25 
26 	Defines a class for placing inhabitants in appropriate rendering order; from render.c
27 	Works from RenderSortPoly stuff.
28 
29 	Made [view_data *view] a member and removed it as an argument
30 
31 Oct 13, 2000
32 	LP: replaced GrowableLists and ResizableLists with STL vectors
33 */
34 
35 #include <vector>
36 #include "world.h"
37 #include "interface.h"
38 #include "render.h"
39 #include "RenderSortPoly.h"
40 
41 
42 /* ---------- render objects */
43 
44 struct render_object_data
45 {
46 	struct sorted_node_data *node; /* node we are being drawn inside */
47 	struct clipping_window_data *clipping_windows; /* our privately calculated clipping window */
48 
49 	struct render_object_data *next_object; /* the next object in this chain */
50 
51 	struct rectangle_definition rectangle;
52 
53 	int16 ymedia;
54 };
55 
56 
57 class RenderPlaceObjsClass
58 {
59 	// Auxiliary data and routines:
60 
61 	void initialize_render_object_list();
62 
63 	render_object_data *build_render_object(long_point3d *origin,
64 		_fixed floor_intensity, _fixed ceiling_intensity,
65 		sorted_node_data **base_nodes, short *base_node_count,
66 		short object_index, float Opacity, long_point3d *rel_origin);
67 
68 	void sort_render_object_into_tree(render_object_data *new_render_object,
69 		sorted_node_data **base_nodes, short base_node_count);
70 
71 	short build_base_node_list(short origin_polygon_index,
72 		world_point3d *origin, world_distance left_distance, world_distance right_distance,
73 		sorted_node_data **base_nodes);
74 
75 	void build_aggregate_render_object_clipping_window(render_object_data *render_object,
76 		sorted_node_data **base_nodes, short base_node_count);
77 
78 	shape_information_data *rescale_shape_information(shape_information_data *unscaled,
79 		shape_information_data *scaled, uint16 flags);
80 
81 public:
82 
83 	// LP additions: growable list of render objects; these are all the inhabitants
84 	// Length changed in build_render_object()
85 	// keep SortedNodes in sync
86 	vector<render_object_data> RenderObjects;
87 
88 	// Pointers to view and calculated visibility tree and sorted polygons
89 	view_data *view;
90 	RenderVisTreeClass *RVPtr;
91 	RenderSortPolyClass *RSPtr;
92 
93 	void build_render_object_list();
94 
95   	// Inits everything
96  	RenderPlaceObjsClass();
97 };
98 
99 #endif
100