Simple test for asyncio.library.
[AROS-Contrib.git] / gfx / povray / octree.h
blob1fd5e8e231214ba4eb4c2d5b6c5b120c049e06f7
1 /****************************************************************************
2 * octree.h
4 * Oct-tree routine prototypes. Use by Radiosity calculation routies.
5 * Implemented by and (c) 1994 Jim McElhiney, mcelhiney@acm.org or cserve 71201,1326
6 * All standard POV distribution rights granted. All other rights reserved.
8 * from Persistence of Vision(tm) Ray Tracer
9 * Copyright 1996,1999 Persistence of Vision Team
10 *---------------------------------------------------------------------------
11 * NOTICE: This source code file is provided so that users may experiment
12 * with enhancements to POV-Ray and to port the software to platforms other
13 * than those supported by the POV-Ray Team. There are strict rules under
14 * which you are permitted to use this file. The rules are in the file
15 * named POVLEGAL.DOC which should be distributed with this file.
16 * If POVLEGAL.DOC is not available or for more info please contact the POV-Ray
17 * Team Coordinator by email to team-coord@povray.org or visit us on the web at
18 * http://www.povray.org. The latest version of POV-Ray may be found at this site.
20 * This program is based on the popular DKB raytracer version 2.12.
21 * DKBTrace was originally written by David K. Buck.
22 * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
24 *************************************************************************/
26 #ifndef OCTREE_H
27 #define OCTREE_H
30 /*****************************************************************************
31 * Global preprocessor defines
32 ******************************************************************************/
34 #define OT_BIAS 10000000.
36 #define MAX3(a,b,c) ( ((a)>(b)) ? max((a),(c)) : max((b),(c)) )
39 /*****************************************************************************
40 * Global typedefs
41 ******************************************************************************/
43 typedef struct ot_block_struct OT_BLOCK;
44 typedef struct ot_id_struct OT_ID;
45 typedef struct ot_node_struct OT_NODE;
47 /* Each node in the oct-tree has a (possibly null) linked list of these
48 data blocks off it. */
49 struct ot_block_struct
51 OT_BLOCK *next;
52 VECTOR Point, S_Normal;
53 float drdx, dgdx, dbdx, drdy, dgdy, dbdy, drdz, dgdz, dbdz;
54 RGB Illuminance;
55 float Harmonic_Mean_Distance, Nearest_Distance;
56 VECTOR To_Nearest_Surface;
57 short Bounce_Depth;
60 /* This is the information necessary to name an oct-tree node. */
61 struct ot_id_struct
63 long x, y, z;
64 long Size;
67 /* These are the structures that make up the oct-tree itself, known as nodes */
68 struct ot_node_struct
70 OT_ID Id;
71 OT_BLOCK *Values;
72 OT_NODE *Kids[8];
76 /*****************************************************************************
77 * Global variables
78 ******************************************************************************/
82 /*****************************************************************************
83 * Global functions
84 ******************************************************************************/
86 void ot_ins (OT_NODE **root, OT_BLOCK *new_block, OT_ID *new_id);
87 void ot_list_insert (OT_BLOCK **list_ptr, OT_BLOCK *item);
88 void ot_newroot (OT_NODE **root_ptr);
89 long ot_dist_traverse (OT_NODE *subtree, VECTOR point, int bounce_depth, \
90 long (*func)(OT_BLOCK *block, void *handle1), void *handle2);
91 long ot_point_in_node (VECTOR point, OT_ID *node);
92 void ot_index_sphere (VECTOR point, DBL radius, OT_ID *id);
93 void ot_index_box (VECTOR min_point, VECTOR max_point, OT_ID *id);
94 void ot_parent (OT_ID *dad, OT_ID *kid);
95 long ot_save_tree (OT_NODE *rootptr, FILE *fd);
96 long ot_write_block (OT_BLOCK *bl, void * handle);
97 long ot_free_tree (OT_NODE **ppRoot);
98 long ot_read_file (FILE * fd);
101 /* a trunc function which always returns the floor integer */
102 long Trunc (DBL value);
106 #endif