File: CameraShared.h

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 (70 lines) | stat: -rw-r--r-- 1,772 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
64
65
66
67
68
69
70
// Copyright 2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#pragma once

#ifdef __cplusplus
namespace ispc {
#endif // __cplusplus

#if defined(__cplusplus) && !defined(OSPRAY_TARGET_SYCL)
typedef void *Camera_initRay;
#else
struct Camera;
struct CameraSample;
struct Ray;
struct RayCone;

// Fct pointer type for 'virtual' method that sets a pixel,
// generated ray.dir must be normalized to ensure ray.t is world-space distance
// generated rayCone is in normalized camera coordinates for y (height)
typedef void (*Camera_initRay)(const Camera *uniform,
    varying Ray &ray,
    varying RayCone &rayCone,
    const varying CameraSample &sample);
#endif

enum CameraType
{
  CAMERA_TYPE_PERSPECTIVE,
  CAMERA_TYPE_ORTHOGRAPHIC,
  CAMERA_TYPE_PANORAMIC,
  CAMERA_TYPE_UNKNOWN,
};

struct Camera
{
  CameraType type;
  Camera_initRay initRay; // the 'virtual' initRay() method

  float nearClip;
  box2f subImage; // viewable tile / subrange to compute, in [0..1]^2 x [0..1]^2
  range1f shutter; // camera shutter open start and end time, in [0..1]
  bool globalShutter;
  bool motionBlur; // for the camera itself only, not in general
  bool needLensSample;
  bool needTimeSample;
  bool rollingShutterHorizontal;
  float rollingShutterDuration;
  RTCScene scene; // only to call rtcGetGeometryTransformFromScene

#ifdef __cplusplus
  Camera()
      : type(CAMERA_TYPE_UNKNOWN),
        initRay(nullptr),
        nearClip(1e-6f),
        subImage(0.f),
        shutter(0.f),
        globalShutter(false),
        motionBlur(false),
        needLensSample(false),
        needTimeSample(false),
        rollingShutterHorizontal(false),
        rollingShutterDuration(0.f),
        scene(nullptr)
  {}
};
} // namespace ispc
#else
};
#endif // __cplusplus