Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/embree/kernels/geometry/primitive.h
9905 views
1
// Copyright 2009-2021 Intel Corporation
2
// SPDX-License-Identifier: Apache-2.0
3
4
#pragma once
5
6
#include "../common/default.h"
7
#include "../common/scene.h"
8
#include "../../common/simd/simd.h"
9
#include "../builders/primref.h"
10
#include "../builders/primref_mb.h"
11
12
namespace embree
13
{
14
struct PrimitiveType
15
{
16
/*! returns name of this primitive type */
17
virtual const char* name() const = 0;
18
19
/*! Returns the number of stored active primitives in a block. */
20
virtual size_t sizeActive(const char* This) const = 0;
21
22
/*! Returns the number of stored active and inactive primitives in a block. */
23
virtual size_t sizeTotal(const char* This) const = 0;
24
25
/*! Returns the number of bytes of block. */
26
virtual size_t getBytes(const char* This) const = 0;
27
};
28
29
template<typename Primitive>
30
struct PrimitivePointQuery1
31
{
32
static __forceinline bool pointQuery(PointQuery* query, PointQueryContext* context, const Primitive& prim)
33
{
34
bool changed = false;
35
for (size_t i = 0; i < Primitive::max_size(); i++)
36
{
37
if (!prim.valid(i)) break;
38
STAT3(point_query.trav_prims,1,1,1);
39
AccelSet* accel = (AccelSet*)context->scene->get(prim.geomID(i));
40
context->geomID = prim.geomID(i);
41
context->primID = prim.primID(i);
42
changed |= accel->pointQuery(query, context);
43
}
44
return changed;
45
}
46
47
static __forceinline void pointQueryNoop(PointQuery* query, PointQueryContext* context, const Primitive& prim) { }
48
};
49
}
50
51