Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2007 Blender Foundation. 00019 * All rights reserved. 00020 * 00021 * The Original Code is: all of this file. 00022 * 00023 * Contributor(s): André Pinto. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 * RE_raytrace.h: ray tracing api, can be used independently from the renderer. 00027 */ 00028 00034 #ifndef __RENDER_RAYINTERSECTION_H__ 00035 #define __RENDER_RAYINTERSECTION_H__ 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00041 struct RayObject; 00042 00043 /* Ray Hints */ 00044 00045 #define RE_RAY_LCTS_MAX_SIZE 256 00046 #define RT_USE_LAST_HIT /* last shadow hit is reused before raycasting on whole tree */ 00047 //#define RT_USE_HINT /* last hit object is reused before raycasting on whole tree */ 00048 00049 typedef struct LCTSHint { 00050 int size; 00051 struct RayObject *stack[RE_RAY_LCTS_MAX_SIZE]; 00052 } LCTSHint; 00053 00054 typedef struct RayHint { 00055 union { LCTSHint lcts; } data; 00056 } RayHint; 00057 00058 /* Ray Intersection */ 00059 00060 typedef struct Isect { 00061 /* ray start, direction (normalized vector), and max distance. on hit, 00062 the distance is modified to be the distance to the hit point. */ 00063 float start[3]; 00064 float dir[3]; 00065 float dist; 00066 00067 /* precomputed values to accelerate bounding box intersection */ 00068 int bv_index[6]; 00069 float idot_axis[3]; 00070 00071 /* intersection options */ 00072 int mode; /* RE_RAY_SHADOW, RE_RAY_MIRROR, RE_RAY_SHADOW_TRA */ 00073 int lay; /* -1 default, set for layer lamps */ 00074 int skip; /* skip flags */ 00075 int check; /* check flags */ 00076 void *userdata; /* used by bake check */ 00077 00078 /* hit information */ 00079 float u, v; 00080 int isect; /* which half of quad */ 00081 00082 struct { 00083 void *ob; 00084 void *face; 00085 } hit, orig; 00086 00087 /* last hit optimization */ 00088 struct RayObject *last_hit; 00089 00090 /* hints */ 00091 #ifdef RT_USE_HINT 00092 RayTraceHint *hint, *hit_hint; 00093 #endif 00094 RayHint *hint; 00095 00096 /* ray counter */ 00097 #ifdef RE_RAYCOUNTER 00098 RayCounter *raycounter; 00099 #endif 00100 } Isect; 00101 00102 /* ray types */ 00103 #define RE_RAY_SHADOW 0 00104 #define RE_RAY_MIRROR 1 00105 #define RE_RAY_SHADOW_TRA 2 00106 00107 /* skip options */ 00108 #define RE_SKIP_CULLFACE (1 << 0) 00109 /* if using this flag then *face should be a pointer to a VlakRen */ 00110 #define RE_SKIP_VLR_NEIGHBOUR (1 << 1) 00111 00112 /* check options */ 00113 #define RE_CHECK_VLR_NONE 0 00114 #define RE_CHECK_VLR_RENDER 1 00115 #define RE_CHECK_VLR_NON_SOLID_MATERIAL 2 00116 #define RE_CHECK_VLR_BAKE 3 00117 00118 /* arbitrary, but can't use e.g. FLT_MAX because of precision issues */ 00119 #define RE_RAYTRACE_MAXDIST 1e15f 00120 #define RE_RAYTRACE_EPSILON 0.0f 00121 00122 #ifdef __cplusplus 00123 } 00124 #endif 00125 00126 #endif /* __RENDER_RAYINTERSECTION_H__ */ 00127