1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): André Pinto.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/render/intern/include/rayobject.h
* \ingroup render
*/
#ifndef __RAYOBJECT_H__
#define __RAYOBJECT_H__
#ifdef __cplusplus
extern "C" {
#endif
struct Isect;
struct ObjectInstanceRen;
struct RayHint;
struct VlakRen;
/* RayObject
Can be a face/triangle, bvh tree, object instance, etc. This is the
public API used by the renderer, see rayobject_internal.h for the
internal implementation details. */
typedef struct RayObject RayObject;
/* Intersection, see rayintersection.h */
int RE_rayobject_raycast(RayObject *r, struct Isect *i);
/* Acceleration Structures */
RayObject* RE_rayobject_octree_create(int ocres, int size);
RayObject* RE_rayobject_instance_create(RayObject *target, float transform[][4], void *ob, void *target_ob);
RayObject* RE_rayobject_empty_create(void);
RayObject* RE_rayobject_blibvh_create(int size); /* BLI_kdopbvh.c */
RayObject* RE_rayobject_vbvh_create(int size); /* raytrace/rayobject_vbvh.c */
RayObject* RE_rayobject_svbvh_create(int size); /* raytrace/rayobject_svbvh.c */
RayObject* RE_rayobject_qbvh_create(int size); /* raytrace/rayobject_qbvh.c */
/* Building */
void RE_rayobject_add(RayObject *r, RayObject *);
void RE_rayobject_done(RayObject *r);
void RE_rayobject_free(RayObject *r);
void RE_rayobject_set_control(RayObject *r, void *data, int (*test_break)(void *data));
/* RayObject representing faces, all data is locally available instead
of referring to some external data structure, for possibly faster
intersection tests. */
typedef struct RayFace {
float v1[4], v2[4], v3[4], v4[3];
int quad;
void *ob;
void *face;
} RayFace;
#define RE_rayface_isQuad(a) ((a)->quad)
RayObject* RE_rayface_from_vlak(RayFace *face, struct ObjectInstanceRen *obi, struct VlakRen *vlr);
/* RayObject representing faces directly from a given VlakRen structure. Thus
allowing to save memory, but making code triangle intersection dependant on
render structures. */
typedef struct VlakPrimitive {
struct ObjectInstanceRen *ob;
struct VlakRen *face;
} VlakPrimitive;
RayObject* RE_vlakprimitive_from_vlak(VlakPrimitive *face, struct ObjectInstanceRen *obi, struct VlakRen *vlr);
/* Bounding Box */
/* extend min/max coords so that the rayobject is inside them */
void RE_rayobject_merge_bb(RayObject *ob, float *min, float *max);
/* initializes an hint for optiming raycast where it is know that a ray will pass by the given BB often the origin point */
void RE_rayobject_hint_bb(RayObject *r, struct RayHint *hint, float *min, float *max);
/* initializes an hint for optiming raycast where it is know that a ray will be contained inside the given cone*/
/* void RE_rayobject_hint_cone(RayObject *r, struct RayHint *hint, float *); */
/* Internals */
#include "../raytrace/rayobject_internal.h"
#ifdef __cplusplus
}
#endif
#endif
|