ai_cameras.h
Go to the documentation of this file.
1 // Copyright 2020 Autodesk, Inc. All rights reserved.
2 //
3 // Use of this software is subject to the terms of the Autodesk license
4 // agreement provided at the time of installation or download, or which
5 // otherwise accompanies this software in either electronic or hard copy form.
6 
12 #pragma once
13 #include "ai_nodes.h"
14 #include "ai_vector.h"
15 
24 struct AtCameraInput {
25  float sx, sy;
28  float dsx, dsy;
29  float lensx, lensy;
30  float relative_time;
31 };
32 
44  AtVector dOdx, dOdy;
45  AtVector dDdx, dDdy;
47 };
48 
51  void (*CreateRay)(const AtNode*, const AtCameraInput&, AtCameraOutput&, uint16_t tid);
52  bool (*ReverseRay)(const AtNode* node, const AtVector &Po, float relative_time, AtVector2 &Ps);
53 };
54 
56 #define AI_CAMERA_NODE_EXPORT_METHODS(tag) \
57 AI_INSTANCE_COMMON_METHODS \
58 camera_create_ray; \
59 camera_reverse_ray; \
60 static AtCameraNodeMethods ai_cam_mtds = { \
61  CameraCreateRay, \
62  CameraReverseRay \
63 }; \
64 static AtNodeMethods ai_node_mtds = { \
65  &ai_common_mtds, \
66  &ai_cam_mtds \
67 }; \
68 const AtNodeMethods* tag = &ai_node_mtds;
69 
70 
75 AI_API void AiCameraInitialize(AtNode* node);
76 AI_API void AiCameraUpdate(AtNode* node, bool plane_distance);
77 /*\}*/
78 
96 #define camera_create_ray \
97 static void CameraCreateRay(const AtNode* node, const AtCameraInput& input, AtCameraOutput& output, uint16_t tid)
98 
114 #define camera_reverse_ray \
115 static bool CameraReverseRay(const AtNode* node, const AtVector &Po, float relative_time, AtVector2 &Ps)
116 
117 /* \}*/
118 
119 /*\}*/
float relative_time
time relative to this camera (in [0,1))
Definition: ai_cameras.h:30
RGB color.
Definition: ai_color.h:31
This represents a node in Arnold.
AtNode struct and methods.
Vector math types, operators and utilities.
3D point (single precision)
Definition: ai_vector.h:29
AtVector origin
ray origin in camera space (required)
Definition: ai_cameras.h:42
2D point
Definition: ai_vector.h:254
float lensy
lens sampling coordinates in [0,1)^2
Definition: ai_cameras.h:29
AtVector dDdy
derivative of the ray direction with respect to the pixel coordinates (optional - defaults to 0) ...
Definition: ai_cameras.h:45
AtVector dOdy
derivative of the ray origin with respect to the pixel coordinates (optional - defaults to 0) ...
Definition: ai_cameras.h:44
AI_API void AiCameraUpdate(AtNode *node, bool plane_distance)
Updates camera's internal data.
Definition: ai_camera.cpp:343
Camera node methods structure.
Definition: ai_cameras.h:50
AI_API void AiCameraInitialize(AtNode *node)
Initialize the camera's internal data.
Definition: ai_camera.cpp:310
float sy
screen-space coordinates will range between (screen_window_min.x, screen_window_min.y/frame_aspect_ratio) and (screen_window_max.x, screen_window_max.y/frame_aspect_ratio)
Definition: ai_cameras.h:25
Camera ray creation outputs.
Definition: ai_cameras.h:41
Camera ray creation inputs.
Definition: ai_cameras.h:24
AtRGB weight
weight of this ray (used for vignetting) (optional - defaults to AI_RGB_WHITE)
Definition: ai_cameras.h:46
float dsy
derivatives of the screen-space coordinates with respect to pixel coordinates
Definition: ai_cameras.h:28
AtVector dir
ray direction in camera space (required)
Definition: ai_cameras.h:43

© 2020 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com