ai_drivers.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_api.h"
15 #include "ai_bbox.h"
16 #include <stdint.h> // uint32_t etc
17 
18 // forward declaration
19 struct AtOutputIterator;
20 struct AtAOVSampleIterator;
21 
46  bool (*DriverSupportsPixelType)(const AtNode*, uint8_t);
47  const char** (*DriverExtension)();
48  void (*DriverOpen)(AtNode*, struct AtOutputIterator*, AtBBox2, AtBBox2, int);
49  bool (*DriverNeedsBucket)(AtNode*, int, int, int, int, uint16_t);
50  void (*DriverPrepareBucket)(AtNode*, int, int, int, int, uint16_t);
51  void (*DriverProcessBucket)(AtNode*, struct AtOutputIterator*, struct AtAOVSampleIterator*, int, int, int, int, uint16_t);
52  void (*DriverWriteBucket)(AtNode*, struct AtOutputIterator*, struct AtAOVSampleIterator*, int, int, int, int);
53  void (*DriverClose)(AtNode*, struct AtOutputIterator*);
54 };
55 
57 #define AI_DRIVER_NODE_EXPORT_METHODS(tag) \
58 AI_INSTANCE_COMMON_METHODS \
59 driver_supports_pixel_type; \
60 driver_extension; \
61 driver_open; \
62 driver_needs_bucket; \
63 driver_prepare_bucket; \
64 driver_process_bucket; \
65 driver_write_bucket; \
66 driver_close; \
67 static AtDriverNodeMethods ai_driver_mtds = { \
68  DriverSupportsPixelType, \
69  DriverExtension, \
70  DriverOpen, \
71  DriverNeedsBucket, \
72  DriverPrepareBucket, \
73  DriverProcessBucket, \
74  DriverWriteBucket, \
75  DriverClose, \
76 }; \
77 static AtNodeMethods ai_node_mtds = { \
78  &ai_common_mtds, \
79  &ai_driver_mtds \
80 }; \
81 const AtNodeMethods *tag = &ai_node_mtds;
82 
95 #define driver_supports_pixel_type \
96 static bool DriverSupportsPixelType(const AtNode* node, uint8_t pixel_type)
97 
104 #define driver_extension \
105 static const char** DriverExtension()
106 
119 #define driver_open \
120 static void DriverOpen(AtNode* node, struct AtOutputIterator* iterator, AtBBox2 display_window, AtBBox2 data_window, int bucket_size)
121 
137 #define driver_needs_bucket \
138 static bool DriverNeedsBucket(AtNode* node, int bucket_xo, int bucket_yo, int bucket_size_x, int bucket_size_y, uint16_t tid)
139 
156 #define driver_prepare_bucket \
157 static void DriverPrepareBucket(AtNode* node, int bucket_xo, int bucket_yo, int bucket_size_x, int bucket_size_y, uint16_t tid)
158 
177 #define driver_process_bucket \
178 static void DriverProcessBucket(AtNode* node, struct AtOutputIterator* iterator, struct AtAOVSampleIterator* sample_iterator, int bucket_xo, int bucket_yo, int bucket_size_x, int bucket_size_y, uint16_t tid)
179 
196 #define driver_write_bucket \
197 static void DriverWriteBucket(AtNode* node, struct AtOutputIterator* iterator, struct AtAOVSampleIterator* sample_iterator, int bucket_xo, int bucket_yo, int bucket_size_x, int bucket_size_y)
198 
207 #define driver_close \
208 static void DriverClose(AtNode* node, struct AtOutputIterator* iterator)
209 /* \}*/
210 
216 AI_API void AiDriverInitialize(AtNode* node, bool supports_multiple_outputs);
217 AI_API void AiRawDriverInitialize(AtNode* node, const char** required_aovs, bool requires_depth);
218 AI_API void AiDriverGetMatrices(AtMatrix& world_to_camera, AtMatrix& world_to_screen);
219 AI_API const char** AiDriverExtension(const AtNodeEntry* node_entry);
220 
221 AI_API bool AiOutputIteratorGetNext(struct AtOutputIterator* iter, const char** output_name, int* pixel_type, const void** bucket_data);
222 AI_API void AiOutputIteratorReset(struct AtOutputIterator* iter);
223 
224 AI_API const AtNodeEntry* AiFindDriverType(const char* extension);
225 
226 /* \}*/
227 
228 /*\}*/
AI_API void AiDriverInitialize(AtNode *node, bool supports_multiple_outputs)
Allocates and initializes the driver structure.
Definition: ai_drivers.cpp:38
This represents a node in Arnold.
Axis-aligned bounding box types and utilities.
AtNode struct and methods.
AI_API const char ** AiDriverExtension(const AtNodeEntry *node_entry)
Invokes a driver's driver_extension method which returns a NULL-terminated array of filename extensio...
Definition: ai_drivers.cpp:25
Definition: ai_matrix.h:30
DLL export prefix for API functions (necessary for multi-platform development)
AI_API void AiDriverGetMatrices(AtMatrix &world_to_camera, AtMatrix &world_to_screen)
Get Renderman compliant matrices from the active camera for use in file headers.
Definition: ai_drivers.cpp:95
AI_API bool AiOutputIteratorGetNext(struct AtOutputIterator *iter, const char **output_name, int *pixel_type, const void **bucket_data)
Get information about the next output connected to a driver.
Definition: ai_output_iterator.cpp:41
2D axis-aligned bounding box (uses integers)
Definition: ai_bbox.h:177
This represents a node type in Arnold.
Driver Node methods structure.
Definition: ai_drivers.h:45
AI_API void AiOutputIteratorReset(struct AtOutputIterator *iter)
Reset an output iterator.
Definition: ai_output_iterator.cpp:14
AI_API void AiRawDriverInitialize(AtNode *node, const char **required_aovs, bool requires_depth)
Allocates and initializes the driver structure.
Definition: ai_drivers.cpp:67
AI_API const AtNodeEntry * AiFindDriverType(const char *extension)
Get correct driver node type from an extension.
Definition: ai_drivers.cpp:114

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