-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNanoRT_Geom.h
74 lines (60 loc) · 2.97 KB
/
NanoRT_Geom.h
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
// ======================================================================== //
// Copyright 2009-2015 Intel Corporation //
// //
// Licensed under the Apache License, Version 2.0 (the "License"); //
// you may not use this file except in compliance with the License. //
// You may obtain a copy of the License at //
// //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
// Unless required by applicable law or agreed to in writing, software //
// distributed under the License is distributed on an "AS IS" BASIS, //
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
// See the License for the specific language governing permissions and //
// limitations under the License. //
// ======================================================================== //
#pragma once
#ifdef USE_CPP_INTERFACE
# include "../cpp_renderer/geometry/Geometry.h"
#else
# include "geometry/Geometry.h"
#endif
#include "ospray/common/Data.h"
#include "nanort.h"
#include <memory>
namespace ospray {
struct NanoRT : public Geometry
{
NanoRT();
std::string toString() const override;
void finalize(Model *model) override;
size_t numTris{-1};
size_t idxSize{0};
size_t vtxSize{0};
size_t norSize{0};
const int *index; //!< mesh's triangle index array
const float *vertex; //!< mesh's vertex array
const float *normal; //!< mesh's vertex normal array
const vec4f *color; //!< mesh's vertex color array
const vec2f *texcoord; //!< mesh's vertex texcoord array
const uint32 *prim_materialID; //!< per-primitive material ID
Material **materialList; //!< per-primitive material list
int geom_materialID;
Ref<Data> indexData; /*!< triangle indices (A,B,C,materialID) */
Ref<Data> vertexData; /*!< vertex position (vec3fa) */
Ref<Data> normalData; /*!< vertex normal array (vec3fa) */
Ref<Data> colorData; /*!< vertex color array (vec3fa) */
Ref<Data> texcoordData; /*!< vertex texcoord array (vec2f) */
Ref<Data> prim_materialIDData; /*!< data array for per-prim material ID (uint32) */
Ref<Data> materialListData; /*!< data array for per-prim materials */
uint32 eMesh; /*!< embree triangle mesh handle */
void** ispcMaterialPtrs; /*!< pointers to ISPC equivalent materials */
// NanoRT stuff //
std::unique_ptr<unsigned int> uindex;
std::unique_ptr<nanort::TriangleMesh<float>> triangle_mesh;
nanort::BVHAccel<float,
nanort::TriangleMesh<float>,
nanort::TriangleSAHPred<float>,
nanort::TriangleIntersector<>> accel;
};
} // ::ospray