File: Volume.ih

package info (click to toggle)
ospray 3.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,048 kB
  • sloc: cpp: 80,569; ansic: 951; sh: 805; makefile: 170; python: 69
file content (63 lines) | stat: -rw-r--r-- 1,578 bytes parent folder | download | duplicates (2)
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
// Copyright 2009 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#ifdef OSPRAY_ENABLE_VOLUMES

#pragma once

#include "common/Embree.h"
#ifdef ISPC
#include "openvkl/openvkl.isph"
// comment break to prevent clang-format from reordering openvkl includes
#include "openvkl/device/openvkl.isph"
#else
#include "openvkl/openvkl.h"
// comment break to prevent clang-format from reordering openvkl includes
#include "openvkl/device/openvkl.h"
#endif
#include "common/FeatureFlags.ih"
#include "rkcommon/math/box.ih"
// c++ shared
#include "VolumeShared.h"

OSPRAY_BEGIN_ISPC_NAMESPACE

// Helper functions ///////////////////////////////////////////////////////////

inline float Volume_getSample(const Volume *uniform volume, const vec3f &P)
{
  return vklComputeSampleV(&volume->vklSampler, &((const vkl_vec3f &)P));
}

inline vec3f Volume_getGradient(const Volume *uniform volume,
    const vec3f &P,
    const uniform FeatureFlagsHandler &ffh)
{
  const uniform FeatureFlags ff = getFeatureFlags(ffh);

  vkl_vec3f result = vklComputeGradientV(&volume->vklSampler,
      &((const vkl_vec3f &)P)
#ifdef OSPRAY_TARGET_SYCL
          ,
      0,
      0.f,
      ff.volume
#endif
  );

  // TODO: remove it once VKL no longer returns sporadic NaNs
  if (isnan(result.x))
    result.x = 1.f;
  if (isnan(result.y))
    result.y = 1.f;
  if (isnan(result.z))
    result.z = 1.f;

  return *((varying vec3f *)&result);
}

RTC_SYCL_INDIRECTLY_CALLABLE unmasked void Volume_intersect_kernel(
    RTCIntersectFunctionNArguments *uniform args);

OSPRAY_END_ISPC_NAMESPACE

#endif