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