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
|
// Copyright 2009-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#include "../common/tutorial/tutorial_device.h"
namespace embree {
struct Sphere
{
ALIGNED_STRUCT_(16)
Vec3fa p; //!< position of the sphere
float r; //!< radius of the sphere
RTCGeometry geometry;
unsigned int geomID;
};
struct Instance
{
ALIGNED_STRUCT_(16)
RTCGeometry geometry;
RTCScene object;
int userID;
AffineSpace3fa local2world;
AffineSpace3fa world2local;
LinearSpace3fa normal2world;
Vec3fa lower;
Vec3fa upper;
};
struct TutorialData
{
/* scene data */
RTCScene g_scene;
RTCScene g_scene0;
RTCScene g_scene1;
RTCScene g_scene2;
Sphere* g_spheres;
Sphere* g_sphere0;
Sphere* g_sphere1;
Instance* g_instance[4];
Vec3fa colors[5][4];
};
inline void TutorialData_Constructor(TutorialData* This)
{
This->g_scene = nullptr;
This->g_scene0 = nullptr;
This->g_scene1 = nullptr;
This->g_scene2 = nullptr;
This->g_spheres = nullptr;
This->g_sphere0 = nullptr;
This->g_sphere1 = nullptr;
This->g_instance[0] = nullptr;
This->g_instance[1] = nullptr;
This->g_instance[2] = nullptr;
This->g_instance[3] = nullptr;
}
inline void TutorialData_Destructor(TutorialData* This)
{
rtcReleaseScene (This->g_scene); This->g_scene = nullptr;
rtcReleaseScene (This->g_scene0); This->g_scene0 = nullptr;
rtcReleaseScene (This->g_scene1); This->g_scene1 = nullptr;
rtcReleaseScene (This->g_scene2); This->g_scene2 = nullptr;
rtcReleaseDevice(g_device); g_device = nullptr;
alignedFree(This->g_spheres); This->g_spheres = nullptr;
alignedFree(This->g_sphere0); This->g_sphere0 = nullptr;
alignedFree(This->g_sphere1); This->g_sphere1 = nullptr;
}
} // namespace embree
|