RavEngine
Loading...
Searching...
No Matches
Camera.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2014-2022 NVIDIA Corporation. All rights reserved.
26
27#pragma once
28
29#include "NvFlowTypes.h"
30
31struct NvFlowCamera;
32
34
35enum NvFlowCameraAction
36{
37 eNvFlowCameraAction_unknown = 0,
38 eNvFlowCameraAction_down = 1,
39 eNvFlowCameraAction_up = 2,
40
41 eNvFlowCameraAction_maxEnum = 0x7FFFFFFF
42};
43
44enum NvFlowCameraMouseButton
45{
46 eNvFlowCameraMouseButton_unknown = 0,
47 eNvFlowCameraMouseButton_left = 1,
48 eNvFlowCameraMouseButton_middle = 2,
49 eNvFlowCameraMouseButton_right = 3,
50
51 eNvFlowCameraMouseButton_maxEnum = 0x7FFFFFFF
52};
53
54enum NvFlowCameraKey
55{
56 eNvFlowCameraKey_unknown = 0,
57 eNvFlowCameraKey_up = 1,
58 eNvFlowCameraKey_down = 2,
59 eNvFlowCameraKey_left = 3,
60 eNvFlowCameraKey_right = 4,
61
62 eNvFlowCameraKey_maxEnum = 0x7FFFFFFF
63};
64
66{
67 NvFlowFloat3 position;
68 NvFlowFloat3 eyeDirection;
69 NvFlowFloat3 eyeUp;
70 float eyeDistanceFromPosition;
71};
72
74{
75 NvFlowBool32 isProjectionRH;
76 NvFlowBool32 isOrthographic;
77 NvFlowBool32 isReverseZ;
78 float nearPlane;
79 float farPlane;
80 float fovAngleY;
81 float orthographicY;
82 float panRate;
83 float tiltRate;
84 float zoomRate;
85 float keyTranslationRate;
86};
87
88NV_FLOW_API NvFlowCamera* NvFlowCameraCreate(int winw, int winh);
89
90NV_FLOW_API void NvFlowCameraDestroy(NvFlowCamera* camera);
91
92NV_FLOW_API void NvFlowCameraGetDefaultState(NvFlowCameraState* state, bool yUp);
93
94NV_FLOW_API void NvFlowCameraGetDefaultConfig(NvFlowCameraConfig* config);
95
96NV_FLOW_API void NvFlowCameraGetState(NvFlowCamera* camera, NvFlowCameraState* state);
97
98NV_FLOW_API void NvFlowCameraSetState(NvFlowCamera* camera, const NvFlowCameraState* state);
99
100NV_FLOW_API void NvFlowCameraGetConfig(NvFlowCamera* camera, NvFlowCameraConfig* config);
101
102NV_FLOW_API void NvFlowCameraSetConfig(NvFlowCamera* camera, const NvFlowCameraConfig* config);
103
104NV_FLOW_API void NvFlowCameraGetView(NvFlowCamera* camera, NvFlowFloat4x4* view);
105
106NV_FLOW_API void NvFlowCameraGetProjection(NvFlowCamera* camera, NvFlowFloat4x4* projection, float aspectWidth, float aspectHeight);
107
108NV_FLOW_API void NvFlowCameraMouseUpdate(NvFlowCamera* camera, NvFlowCameraMouseButton button, NvFlowCameraAction action, int mouseX, int mouseY, int winw, int winh);
109
110NV_FLOW_API void NvFlowCameraKeyUpdate(NvFlowCamera* camera, NvFlowCameraKey key, NvFlowCameraAction action);
111
112NV_FLOW_API void NvFlowCameraAnimationTick(NvFlowCamera* camera, float deltaTime);
Definition Camera.h:74
Definition Camera.h:66
Definition Camera.cpp:32