-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathUsdCamera.h
62 lines (48 loc) · 1.49 KB
/
UsdCamera.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
// Copyright 2020 The Khronos Group
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "UsdBaseObject.h"
#include "UsdBridgedBaseObject.h"
enum class UsdCameraComponents
{
VIEW = 0,
PROJECTION
};
struct UsdCameraData
{
UsdSharedString* name = nullptr;
UsdSharedString* usdName = nullptr;
int timeVarying = 0xFFFFFFFF; // TimeVarying bits
UsdFloat3 position = {0.0f, 0.0f, 0.0f};
UsdFloat3 direction = {0.0f, 0.0f, -1.0f};
UsdFloat3 up = {0.0f, 1.0f, 0.0f};
UsdFloatBox2 imageRegion = {0.0f, 0.0f, 1.0f, 1.0f};
// perspective/orthographic
float aspect = 1.0f;
float near = 1.0f;
float far = 10000;
float fovy = M_PI/3.0f;
float height = 1.0f;
};
class UsdCamera : public UsdBridgedBaseObject<UsdCamera, UsdCameraData, UsdCameraHandle, UsdCameraComponents>
{
public:
UsdCamera(const char* name, const char* type, UsdDevice* device);
~UsdCamera();
void remove(UsdDevice* device) override;
enum CameraType
{
CAMERA_UNKNOWN = 0,
CAMERA_PERSPECTIVE,
CAMERA_ORTHOGRAPHIC
};
static constexpr ComponentPair componentParamNames[] = {
ComponentPair(UsdCameraComponents::VIEW, "view"),
ComponentPair(UsdCameraComponents::PROJECTION, "projection")};
protected:
bool deferCommit(UsdDevice* device) override;
bool doCommitData(UsdDevice* device) override;
void doCommitRefs(UsdDevice* device) override {}
void copyParameters(UsdBridgeCameraData& camData);
CameraType cameraType = CAMERA_UNKNOWN;
};