Skip to content

Commit 0df6ce5

Browse files
committed
Add AnselSDK
1 parent bc123e4 commit 0df6ce5

File tree

14 files changed

+709
-0
lines changed

14 files changed

+709
-0
lines changed

sdk/binaries/x64/AnselSDK64.dll

652 KB
Binary file not shown.

sdk/binaries/x86/AnselSDK32.dll

479 KB
Binary file not shown.

sdk/include/AnselSDK.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// This code contains NVIDIA Confidential Information and is disclosed to you
2+
// under a form of NVIDIA software license agreement provided separately to you.
3+
//
4+
// Notice
5+
// NVIDIA Corporation and its licensors retain all intellectual property and
6+
// proprietary rights in and to this software and related documentation and
7+
// any modifications thereto. Any use, reproduction, disclosure, or
8+
// distribution of this software and related documentation without an express
9+
// license agreement from NVIDIA Corporation is strictly prohibited.
10+
//
11+
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12+
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13+
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14+
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15+
//
16+
// Information and code furnished is believed to be accurate and reliable.
17+
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18+
// information or for any infringement of patents or other rights of third parties that may
19+
// result from its use. No license is granted by implication or otherwise under any patent
20+
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21+
// This code supersedes and replaces all information previously supplied.
22+
// NVIDIA Corporation products are not authorized for use as critical
23+
// components in life support devices or systems without express written approval of
24+
// NVIDIA Corporation.
25+
//
26+
// Copyright 2016 NVIDIA Corporation. All rights reserved.
27+
28+
#pragma once
29+
30+
#include <ansel/Configuration.h>
31+
#include <ansel/Session.h>
32+
#include <ansel/Camera.h>
33+
#include <ansel/Hints.h>
34+
#include <ansel/UserControls.h>
35+

sdk/include/ansel/Camera.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// This code contains NVIDIA Confidential Information and is disclosed to you
2+
// under a form of NVIDIA software license agreement provided separately to you.
3+
//
4+
// Notice
5+
// NVIDIA Corporation and its licensors retain all intellectual property and
6+
// proprietary rights in and to this software and related documentation and
7+
// any modifications thereto. Any use, reproduction, disclosure, or
8+
// distribution of this software and related documentation without an express
9+
// license agreement from NVIDIA Corporation is strictly prohibited.
10+
//
11+
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12+
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13+
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14+
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15+
//
16+
// Information and code furnished is believed to be accurate and reliable.
17+
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18+
// information or for any infringement of patents or other rights of third parties that may
19+
// result from its use. No license is granted by implication or otherwise under any patent
20+
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21+
// This code supersedes and replaces all information previously supplied.
22+
// NVIDIA Corporation products are not authorized for use as critical
23+
// components in life support devices or systems without express written approval of
24+
// NVIDIA Corporation.
25+
//
26+
// Copyright 2016 NVIDIA Corporation. All rights reserved.
27+
28+
#pragma once
29+
#include <ansel/Defines.h>
30+
#include <nv/Vec3.h>
31+
#include <nv/Quat.h>
32+
33+
namespace ansel
34+
{
35+
struct Camera
36+
{
37+
// Position of camera, in the game's coordinate space
38+
nv::Vec3 position;
39+
// Rotation of the camera, in the game's coordinate space. I.e. if you apply this
40+
// rotation to the default orientation of the game's camera you will get the current
41+
// orientation of the camera (again, in game's coordinate space)
42+
nv::Quat rotation;
43+
// Field of view in degrees. This value is either vertical or horizontal field of
44+
// view based on the 'fovType' setting passed in with setConfiguration.
45+
float fov;
46+
// The amount that the projection matrix needs to be offset by. These values are
47+
// applied directly as translations to the projection matrix. These values are only
48+
// non-zero during Highres capture.
49+
float projectionOffsetX, projectionOffsetY;
50+
// Values of the near and far planes
51+
float nearPlane, farPlane;
52+
// Projection matrix aspect ratio
53+
float aspectRatio;
54+
};
55+
56+
// Must be called on every frame an Ansel session is active. The 'camera' must contain
57+
// the current display camera settings when called. After calling 'camera' will contain the
58+
// new requested camera from Ansel.
59+
ANSEL_SDK_API void updateCamera(Camera& camera);
60+
61+
// Converts quaternion to rotation matrix vectors.
62+
ANSEL_SDK_API void quaternionToRotationMatrixVectors(const nv::Quat& q, nv::Vec3& right, nv::Vec3& up, nv::Vec3& forward);
63+
64+
// Converts rotation matrix vectors to quaternion.
65+
ANSEL_SDK_API void rotationMatrixVectorsToQuaternion(const nv::Vec3& right, const nv::Vec3& up, const nv::Vec3& forward, nv::Quat& q);
66+
}
67+

sdk/include/ansel/Configuration.h

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
// This code contains NVIDIA Confidential Information and is disclosed to you
2+
// under a form of NVIDIA software license agreement provided separately to you.
3+
//
4+
// Notice
5+
// NVIDIA Corporation and its licensors retain all intellectual property and
6+
// proprietary rights in and to this software and related documentation and
7+
// any modifications thereto. Any use, reproduction, disclosure, or
8+
// distribution of this software and related documentation without an express
9+
// license agreement from NVIDIA Corporation is strictly prohibited.
10+
//
11+
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12+
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13+
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14+
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15+
//
16+
// Information and code furnished is believed to be accurate and reliable.
17+
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18+
// information or for any infringement of patents or other rights of third parties that may
19+
// result from its use. No license is granted by implication or otherwise under any patent
20+
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21+
// This code supersedes and replaces all information previously supplied.
22+
// NVIDIA Corporation products are not authorized for use as critical
23+
// components in life support devices or systems without express written approval of
24+
// NVIDIA Corporation.
25+
//
26+
// Copyright 2016 NVIDIA Corporation. All rights reserved.
27+
28+
#pragma once
29+
#include <ansel/Defines.h>
30+
#include <ansel/Session.h>
31+
#include <ansel/Version.h>
32+
#include <nv/Vec3.h>
33+
#include <stdint.h>
34+
35+
namespace ansel
36+
{
37+
enum SetConfigurationStatus
38+
{
39+
// successfully initialized the Ansel SDK
40+
kSetConfigurationSuccess,
41+
// the version provided in the Configuration structure is not the same as the one stored inside the SDK binary (header/binary mismatch)
42+
kSetConfigurationIncompatibleVersion,
43+
// the Configuration structure supplied for the setConfiguration call is not consistent
44+
kSetConfigurationIncorrectConfiguration,
45+
// the Ansel SDK is delay loaded and setConfiguration is called before the SDK is actually loaded
46+
kSetConfigurationSdkNotLoaded
47+
};
48+
49+
enum FovType
50+
{
51+
kHorizontalFov,
52+
kVerticalFov
53+
};
54+
55+
struct Configuration
56+
{
57+
// Basis vectors used by the game. They specify the handedness and orientation of
58+
// the game's coordinate system. Think of them as the default orientation of the game
59+
// camera.
60+
nv::Vec3 right, up, forward;
61+
// The speed at which camera moves in the world
62+
float translationalSpeedInWorldUnitsPerSecond;
63+
// The speed at which camera rotates
64+
float rotationalSpeedInDegreesPerSecond;
65+
// How many frames it takes for camera update to be reflected in a rendered frame
66+
uint32_t captureLatency;
67+
// How many frames we must wait for a new frame to settle - i.e. temporal AA and similar
68+
// effects to stabilize after the camera has been adjusted
69+
uint32_t captureSettleLatency;
70+
// Game scale, the size of a world unit measured in meters
71+
float metersInWorldUnit;
72+
// Integration will support Camera::projectionOffsetX/projectionOffsetY
73+
bool isCameraOffcenteredProjectionSupported;
74+
// Integration will support Camera::position
75+
bool isCameraTranslationSupported;
76+
// Integration will support Camera::rotation
77+
bool isCameraRotationSupported;
78+
// Integration will support Camera::horizontalFov
79+
bool isCameraFovSupported;
80+
// Game name, in utf8 encoding, used to name the resulting image files from capturing.
81+
// It is not mandatory to set this field. The name chosen is based on the following
82+
// selection order:
83+
// 1. If GeForce profile exists for the game that name will be used
84+
// 2. If 'titleNameUtf8' is set that will be used
85+
// 3. The executable name is used as a last resort
86+
const char* titleNameUtf8;
87+
// Camera structure will contain vertical FOV if this is set to kVerticalFov
88+
// but horizontal FOV if this is set to kHorizontalFov. To simplify integration set
89+
// this to the same orientation as the game is using.
90+
FovType fovType;
91+
92+
// These callbacks will be called on the same thread Present()/glSwapBuffers is called
93+
// The thread calling to updateCamera() might be a different thread
94+
95+
// User defined pointer which is then passed to all the callbacks (nullptr by default)
96+
void* userPointer;
97+
98+
// The window handle for the game/application where input messages are processed
99+
void* gameWindowHandle;
100+
101+
// Called when user activates Ansel. Return kDisallowed if the game cannot comply with the
102+
// request. If the function returns kAllowed the following must be done:
103+
// 1. Change the SessionConfigruation settings, but only where you need to (the object
104+
// is already populated with default settings).
105+
// 2. On the next update loop the game will be in an Ansel session. During an Ansel session
106+
// the game :
107+
// a) Must stop drawing UI and HUD elements on the screen, including mouse cursor
108+
// b) Must call ansel::updateCamera on every frame
109+
// c) Should pause rendering time (i.e. no movement should be visible in the world)
110+
// d) Should not act on any input from mouse and keyboard and must not act on any input
111+
// from gamepads
112+
// 3. Step 2 is repeated on every iteration of update loop until Session is stopped.
113+
StartSessionCallback startSessionCallback;
114+
115+
// Called when Ansel is deactivated. This call will only be made if the previous call
116+
// to the startSessionCallback returned kAllowed.
117+
// Normally games will use this callback to restore their camera to the settings it had
118+
// when the Ansel session was started.
119+
StopSessionCallback stopSessionCallback;
120+
121+
// Called when the capture of a multipart shot (highres, 360, etc) has started.
122+
// Handy to disable those fullscreen effects that aren't uniform (like vignette)
123+
// This callback is optional (leave nullptr if not needed)
124+
StartCaptureCallback startCaptureCallback;
125+
// Called when the capture of a multipart shot (highres, 360, etc) has stopped.
126+
// Handy to enable those fullscreen effects that were disabled by startCaptureCallback.
127+
// This callback is optional (leave nullptr if not needed)
128+
StopCaptureCallback stopCaptureCallback;
129+
// The 'isFilterOutsideSessionAllowed' setting has been phased out in version 1.3 of the
130+
// SDK. This feature was only temporarily supported and no games took advantage of it.
131+
bool unused2;
132+
// The 'isExrSupported' setting has been phased out in version 1.1 of the SDK. Use
133+
// 'isRawAllowed' setting in SessionConfiguration to enable/disable captures into EXR
134+
// format.
135+
bool unused1;
136+
// Holds the sdk version, doesn't require modifications
137+
uint64_t sdkVersion;
138+
139+
Configuration()
140+
{
141+
right.x = 0.0f;
142+
right.y = 1.0f;
143+
right.z = 0.0f;
144+
up.x = 0.0f;
145+
up.y = 0.0f;
146+
up.z = 1.0f;
147+
forward.x = 1.0f;
148+
forward.y = 0.0f;
149+
forward.z = 0.0f;
150+
translationalSpeedInWorldUnitsPerSecond = 1.0f;
151+
rotationalSpeedInDegreesPerSecond = 45.0f;
152+
captureLatency = 1;
153+
captureSettleLatency = 0;
154+
metersInWorldUnit = 1.0f;
155+
isCameraOffcenteredProjectionSupported = true;
156+
isCameraTranslationSupported = true;
157+
isCameraRotationSupported = true;
158+
isCameraFovSupported = true;
159+
titleNameUtf8 = nullptr;
160+
fovType = kHorizontalFov;
161+
userPointer = nullptr;
162+
gameWindowHandle = 0;
163+
startSessionCallback = nullptr;
164+
stopSessionCallback = nullptr;
165+
startCaptureCallback = nullptr;
166+
stopCaptureCallback = nullptr;
167+
unused2 = true;
168+
unused1 = false;
169+
sdkVersion = ANSEL_SDK_VERSION;
170+
}
171+
};
172+
173+
// Called during startup by the game. See 'Configuration' for further documentation.
174+
ANSEL_SDK_API SetConfigurationStatus setConfiguration(const Configuration& cfg);
175+
176+
// Can be called *after* D3D device has been created to see if Ansel is available.
177+
// If called prior to D3D device creation it will always return false.
178+
// Can be called *before* calling setConfiguration in which case it'll return true if Ansel is potentially available, otherwise false.
179+
// If setConfiguration fails for any reason this function will return false (even if Ansel would be available otherwise)
180+
// until a successfull call to setConfiguration has been made.
181+
ANSEL_SDK_API bool isAnselAvailable();
182+
}
183+

sdk/include/ansel/Defines.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// This code contains NVIDIA Confidential Information and is disclosed to you
2+
// under a form of NVIDIA software license agreement provided separately to you.
3+
//
4+
// Notice
5+
// NVIDIA Corporation and its licensors retain all intellectual property and
6+
// proprietary rights in and to this software and related documentation and
7+
// any modifications thereto. Any use, reproduction, disclosure, or
8+
// distribution of this software and related documentation without an express
9+
// license agreement from NVIDIA Corporation is strictly prohibited.
10+
//
11+
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12+
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13+
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14+
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15+
//
16+
// Information and code furnished is believed to be accurate and reliable.
17+
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18+
// information or for any infringement of patents or other rights of third parties that may
19+
// result from its use. No license is granted by implication or otherwise under any patent
20+
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21+
// This code supersedes and replaces all information previously supplied.
22+
// NVIDIA Corporation products are not authorized for use as critical
23+
// components in life support devices or systems without express written approval of
24+
// NVIDIA Corporation.
25+
//
26+
// Copyright 2016 NVIDIA Corporation. All rights reserved.
27+
28+
#pragma once
29+
30+
#ifdef ANSEL_SDK_EXPORTS
31+
#define ANSEL_SDK_API __declspec(dllexport)
32+
#define ANSEL_SDK_INTERNAL_API extern "C" __declspec(dllexport)
33+
#define ANSEL_SDK_CLASS_API __declspec(dllexport)
34+
#elif !defined(ANSEL_SDK_DELAYLOAD)
35+
#define ANSEL_SDK_API __declspec(dllimport)
36+
#define ANSEL_SDK_INTERNAL_API extern "C" __declspec(dllimport)
37+
#define ANSEL_SDK_CLASS_API __declspec(dllimport)
38+
#else
39+
#define ANSEL_SDK_API
40+
#define ANSEL_SDK_INTERNAL_API
41+
#define ANSEL_SDK_CLASS_API
42+
#endif

0 commit comments

Comments
 (0)