1 | // Copyright 2009-2021 Intel Corporation |
---|---|
2 | // SPDX-License-Identifier: Apache-2.0 |
3 | |
4 | #include "primitive.h" |
5 | #include "curveNv.h" |
6 | #include "curveNi.h" |
7 | #include "curveNi_mb.h" |
8 | #include "linei.h" |
9 | #include "triangle.h" |
10 | #include "trianglev.h" |
11 | #include "trianglev_mb.h" |
12 | #include "trianglei.h" |
13 | #include "quadv.h" |
14 | #include "quadi.h" |
15 | #include "subdivpatch1.h" |
16 | #include "object.h" |
17 | #include "instance.h" |
18 | #include "subgrid.h" |
19 | |
20 | namespace embree |
21 | { |
22 | /********************** Curve4v **************************/ |
23 | |
24 | template<> |
25 | const char* Curve4v::Type::name () const { |
26 | return "curve4v"; |
27 | } |
28 | |
29 | template<> |
30 | size_t Curve4v::Type::sizeActive(const char* This) const |
31 | { |
32 | if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR) |
33 | return ((Line4i*)This)->size(); |
34 | else |
35 | return ((Curve4v*)This)->N; |
36 | } |
37 | |
38 | template<> |
39 | size_t Curve4v::Type::sizeTotal(const char* This) const |
40 | { |
41 | if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR) |
42 | return 4; |
43 | else |
44 | return ((Curve4v*)This)->N; |
45 | } |
46 | |
47 | template<> |
48 | size_t Curve4v::Type::getBytes(const char* This) const |
49 | { |
50 | if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR) |
51 | return Line4i::bytes(sizeActive(This)); |
52 | else |
53 | return Curve4v::bytes(sizeActive(This)); |
54 | } |
55 | |
56 | /********************** Curve4i **************************/ |
57 | |
58 | template<> |
59 | const char* Curve4i::Type::name () const { |
60 | return "curve4i"; |
61 | } |
62 | |
63 | template<> |
64 | size_t Curve4i::Type::sizeActive(const char* This) const |
65 | { |
66 | if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR) |
67 | return ((Line4i*)This)->size(); |
68 | else |
69 | return ((Curve4i*)This)->N; |
70 | } |
71 | |
72 | template<> |
73 | size_t Curve4i::Type::sizeTotal(const char* This) const |
74 | { |
75 | if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR) |
76 | return 4; |
77 | else |
78 | return ((Curve4i*)This)->N; |
79 | } |
80 | |
81 | template<> |
82 | size_t Curve4i::Type::getBytes(const char* This) const |
83 | { |
84 | if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR) |
85 | return Line4i::bytes(sizeActive(This)); |
86 | else |
87 | return Curve4i::bytes(sizeActive(This)); |
88 | } |
89 | |
90 | /********************** Curve4iMB **************************/ |
91 | |
92 | template<> |
93 | const char* Curve4iMB::Type::name () const { |
94 | return "curve4imb"; |
95 | } |
96 | |
97 | template<> |
98 | size_t Curve4iMB::Type::sizeActive(const char* This) const |
99 | { |
100 | if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR) |
101 | return ((Line4i*)This)->size(); |
102 | else |
103 | return ((Curve4iMB*)This)->N; |
104 | } |
105 | |
106 | template<> |
107 | size_t Curve4iMB::Type::sizeTotal(const char* This) const |
108 | { |
109 | if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR) |
110 | return 4; |
111 | else |
112 | return ((Curve4iMB*)This)->N; |
113 | } |
114 | |
115 | template<> |
116 | size_t Curve4iMB::Type::getBytes(const char* This) const |
117 | { |
118 | if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR) |
119 | return Line4i::bytes(sizeActive(This)); |
120 | else |
121 | return Curve4iMB::bytes(sizeActive(This)); |
122 | } |
123 | |
124 | /********************** Line4i **************************/ |
125 | |
126 | template<> |
127 | const char* Line4i::Type::name () const { |
128 | return "line4i"; |
129 | } |
130 | |
131 | template<> |
132 | size_t Line4i::Type::sizeActive(const char* This) const { |
133 | return ((Line4i*)This)->size(); |
134 | } |
135 | |
136 | template<> |
137 | size_t Line4i::Type::sizeTotal(const char* This) const { |
138 | return 4; |
139 | } |
140 | |
141 | template<> |
142 | size_t Line4i::Type::getBytes(const char* This) const { |
143 | return sizeof(Line4i); |
144 | } |
145 | |
146 | /********************** Triangle4 **************************/ |
147 | |
148 | template<> |
149 | const char* Triangle4::Type::name () const { |
150 | return "triangle4"; |
151 | } |
152 | |
153 | template<> |
154 | size_t Triangle4::Type::sizeActive(const char* This) const { |
155 | return ((Triangle4*)This)->size(); |
156 | } |
157 | |
158 | template<> |
159 | size_t Triangle4::Type::sizeTotal(const char* This) const { |
160 | return 4; |
161 | } |
162 | |
163 | template<> |
164 | size_t Triangle4::Type::getBytes(const char* This) const { |
165 | return sizeof(Triangle4); |
166 | } |
167 | |
168 | /********************** Triangle4v **************************/ |
169 | |
170 | template<> |
171 | const char* Triangle4v::Type::name () const { |
172 | return "triangle4v"; |
173 | } |
174 | |
175 | template<> |
176 | size_t Triangle4v::Type::sizeActive(const char* This) const { |
177 | return ((Triangle4v*)This)->size(); |
178 | } |
179 | |
180 | template<> |
181 | size_t Triangle4v::Type::sizeTotal(const char* This) const { |
182 | return 4; |
183 | } |
184 | |
185 | template<> |
186 | size_t Triangle4v::Type::getBytes(const char* This) const { |
187 | return sizeof(Triangle4v); |
188 | } |
189 | |
190 | /********************** Triangle4i **************************/ |
191 | |
192 | template<> |
193 | const char* Triangle4i::Type::name () const { |
194 | return "triangle4i"; |
195 | } |
196 | |
197 | template<> |
198 | size_t Triangle4i::Type::sizeActive(const char* This) const { |
199 | return ((Triangle4i*)This)->size(); |
200 | } |
201 | |
202 | template<> |
203 | size_t Triangle4i::Type::sizeTotal(const char* This) const { |
204 | return 4; |
205 | } |
206 | |
207 | template<> |
208 | size_t Triangle4i::Type::getBytes(const char* This) const { |
209 | return sizeof(Triangle4i); |
210 | } |
211 | |
212 | /********************** Triangle4vMB **************************/ |
213 | |
214 | template<> |
215 | const char* Triangle4vMB::Type::name () const { |
216 | return "triangle4vmb"; |
217 | } |
218 | |
219 | template<> |
220 | size_t Triangle4vMB::Type::sizeActive(const char* This) const { |
221 | return ((Triangle4vMB*)This)->size(); |
222 | } |
223 | |
224 | template<> |
225 | size_t Triangle4vMB::Type::sizeTotal(const char* This) const { |
226 | return 4; |
227 | } |
228 | |
229 | template<> |
230 | size_t Triangle4vMB::Type::getBytes(const char* This) const { |
231 | return sizeof(Triangle4vMB); |
232 | } |
233 | |
234 | /********************** Quad4v **************************/ |
235 | |
236 | template<> |
237 | const char* Quad4v::Type::name () const { |
238 | return "quad4v"; |
239 | } |
240 | |
241 | template<> |
242 | size_t Quad4v::Type::sizeActive(const char* This) const { |
243 | return ((Quad4v*)This)->size(); |
244 | } |
245 | |
246 | template<> |
247 | size_t Quad4v::Type::sizeTotal(const char* This) const { |
248 | return 4; |
249 | } |
250 | |
251 | template<> |
252 | size_t Quad4v::Type::getBytes(const char* This) const { |
253 | return sizeof(Quad4v); |
254 | } |
255 | |
256 | /********************** Quad4i **************************/ |
257 | |
258 | template<> |
259 | const char* Quad4i::Type::name () const { |
260 | return "quad4i"; |
261 | } |
262 | |
263 | template<> |
264 | size_t Quad4i::Type::sizeActive(const char* This) const { |
265 | return ((Quad4i*)This)->size(); |
266 | } |
267 | |
268 | template<> |
269 | size_t Quad4i::Type::sizeTotal(const char* This) const { |
270 | return 4; |
271 | } |
272 | |
273 | template<> |
274 | size_t Quad4i::Type::getBytes(const char* This) const { |
275 | return sizeof(Quad4i); |
276 | } |
277 | |
278 | /********************** SubdivPatch1 **************************/ |
279 | |
280 | const char* SubdivPatch1::Type::name () const { |
281 | return "subdivpatch1"; |
282 | } |
283 | |
284 | size_t SubdivPatch1::Type::sizeActive(const char* This) const { |
285 | return 1; |
286 | } |
287 | |
288 | size_t SubdivPatch1::Type::sizeTotal(const char* This) const { |
289 | return 1; |
290 | } |
291 | |
292 | size_t SubdivPatch1::Type::getBytes(const char* This) const { |
293 | return sizeof(SubdivPatch1); |
294 | } |
295 | |
296 | SubdivPatch1::Type SubdivPatch1::type; |
297 | |
298 | /********************** Virtual Object **************************/ |
299 | |
300 | const char* Object::Type::name () const { |
301 | return "object"; |
302 | } |
303 | |
304 | size_t Object::Type::sizeActive(const char* This) const { |
305 | return 1; |
306 | } |
307 | |
308 | size_t Object::Type::sizeTotal(const char* This) const { |
309 | return 1; |
310 | } |
311 | |
312 | size_t Object::Type::getBytes(const char* This) const { |
313 | return sizeof(Object); |
314 | } |
315 | |
316 | Object::Type Object::type; |
317 | |
318 | /********************** Instance **************************/ |
319 | |
320 | const char* InstancePrimitive::Type::name () const { |
321 | return "instance"; |
322 | } |
323 | |
324 | size_t InstancePrimitive::Type::sizeActive(const char* This) const { |
325 | return 1; |
326 | } |
327 | |
328 | size_t InstancePrimitive::Type::sizeTotal(const char* This) const { |
329 | return 1; |
330 | } |
331 | |
332 | size_t InstancePrimitive::Type::getBytes(const char* This) const { |
333 | return sizeof(InstancePrimitive); |
334 | } |
335 | |
336 | InstancePrimitive::Type InstancePrimitive::type; |
337 | |
338 | /********************** SubGrid **************************/ |
339 | |
340 | const char* SubGrid::Type::name () const { |
341 | return "subgrid"; |
342 | } |
343 | |
344 | size_t SubGrid::Type::sizeActive(const char* This) const { |
345 | return 1; |
346 | } |
347 | |
348 | size_t SubGrid::Type::sizeTotal(const char* This) const { |
349 | return 1; |
350 | } |
351 | |
352 | size_t SubGrid::Type::getBytes(const char* This) const { |
353 | return sizeof(SubGrid); |
354 | } |
355 | |
356 | SubGrid::Type SubGrid::type; |
357 | |
358 | /********************** SubGridQBVH4 **************************/ |
359 | |
360 | template<> |
361 | const char* SubGridQBVH4::Type::name () const { |
362 | return "SubGridQBVH4"; |
363 | } |
364 | |
365 | template<> |
366 | size_t SubGridQBVH4::Type::sizeActive(const char* This) const { |
367 | return 1; |
368 | } |
369 | |
370 | template<> |
371 | size_t SubGridQBVH4::Type::sizeTotal(const char* This) const { |
372 | return 1; |
373 | } |
374 | |
375 | template<> |
376 | size_t SubGridQBVH4::Type::getBytes(const char* This) const { |
377 | return sizeof(SubGridQBVH4); |
378 | } |
379 | } |
380 |