ai_drivers.h
Go to the documentation of this file.
1// Copyright 2022 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
19struct AtOutputIterator;
20struct 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) \
58AI_INSTANCE_COMMON_METHODS \
59driver_supports_pixel_type; \
60driver_extension; \
61driver_open; \
62driver_needs_bucket; \
63driver_prepare_bucket; \
64driver_process_bucket; \
65driver_write_bucket; \
66driver_close; \
67static AtDriverNodeMethods ai_driver_mtds = { \
68 DriverSupportsPixelType, \
69 DriverExtension, \
70 DriverOpen, \
71 DriverNeedsBucket, \
72 DriverPrepareBucket, \
73 DriverProcessBucket, \
74 DriverWriteBucket, \
75 DriverClose, \
76}; \
77static AtNodeMethods ai_node_mtds = { \
78 &ai_common_mtds, \
79 &ai_driver_mtds \
80}; \
81const AtNodeMethods *tag = &ai_node_mtds;
82
95#define driver_supports_pixel_type \
96static bool DriverSupportsPixelType(const AtNode* node, uint8_t pixel_type)
97
112#define driver_extension \
113static const char** DriverExtension()
114
127#define driver_open \
128static void DriverOpen(AtNode* node, struct AtOutputIterator* iterator, AtBBox2 display_window, AtBBox2 data_window, int bucket_size)
129
145#define driver_needs_bucket \
146static bool DriverNeedsBucket(AtNode* node, int bucket_xo, int bucket_yo, int bucket_size_x, int bucket_size_y, uint16_t tid)
147
164#define driver_prepare_bucket \
165static void DriverPrepareBucket(AtNode* node, int bucket_xo, int bucket_yo, int bucket_size_x, int bucket_size_y, uint16_t tid)
166
185#define driver_process_bucket \
186static 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)
187
204#define driver_write_bucket \
205static 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)
206
215#define driver_close \
216static void DriverClose(AtNode* node, struct AtOutputIterator* iterator)
217/* \}*/
218
224AI_API void AiDriverInitialize(AtNode* node, bool supports_multiple_outputs);
225AI_API void AiRawDriverInitialize(AtNode* node, const char** required_aovs, bool requires_depth);
226AI_API void AiDriverGetMatrices(AtMatrix& world_to_camera, AtMatrix& world_to_screen);
227AI_API const char** AiDriverExtension(const AtNodeEntry* node_entry);
228
229AI_API bool AiOutputIteratorGetNext(struct AtOutputIterator* iter, AtString* output_name, int* pixel_type, const void** bucket_data);
230AI_API void AiOutputIteratorReset(struct AtOutputIterator* iter);
231AI_API AtNode* AiOutputIteratorGetFilter(struct AtOutputIterator* iter);
232AI_API bool AiOutputIteratorIsHalf(struct AtOutputIterator* iter);
233AI_API AtString AiOutputIteratorGetLayerName(struct AtOutputIterator* iter);
234AI_API AtNode* AiOutputIteratorGetCamera(struct AtOutputIterator* iter);
235
236AI_API const AtNodeEntry* AiFindDriverType(const char* extension);
237
238/* \}*/
239
240/*\}*/
DLL export prefix for API functions (necessary for multi-platform development)
Axis-aligned bounding box types and utilities.
AtNode struct and methods.
Arnold String allows for fast string comparisons.
Definition: ai_string.h:46
AI_API const AtNodeEntry * AiFindDriverType(const char *extension)
Get correct driver node type from an extension.
Definition: ai_drivers.cpp:107
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
AI_API void AiRawDriverInitialize(AtNode *node, const char **required_aovs, bool requires_depth)
Allocates and initializes the driver structure.
Definition: ai_drivers.cpp:63
AI_API void AiOutputIteratorReset(struct AtOutputIterator *iter)
Reset an output iterator.
Definition: ai_output_iterator.cpp:14
AI_API AtString AiOutputIteratorGetLayerName(struct AtOutputIterator *iter)
Get the name of the targer layer of the current output.
Definition: ai_output_iterator.cpp:71
AI_API AtNode * AiOutputIteratorGetFilter(struct AtOutputIterator *iter)
Get the filter associated with the current output.
Definition: ai_output_iterator.cpp:49
AI_API bool AiOutputIteratorIsHalf(struct AtOutputIterator *iter)
Is the current output is half format.
Definition: ai_output_iterator.cpp:60
AI_API void AiDriverInitialize(AtNode *node, bool supports_multiple_outputs)
Allocates and initializes the driver structure.
Definition: ai_drivers.cpp:38
AI_API AtNode * AiOutputIteratorGetCamera(struct AtOutputIterator *iter)
Get the camera associated with the current output.
Definition: ai_output_iterator.cpp:82
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:87
AI_API bool AiOutputIteratorGetNext(struct AtOutputIterator *iter, AtString *output_name, int *pixel_type, const void **bucket_data)
Get information about the next output connected to a driver.
Definition: ai_output_iterator.cpp:36
2D axis-aligned bounding box (uses integers)
Definition: ai_bbox.h:169
Driver Node methods structure.
Definition: ai_drivers.h:45
Definition: ai_matrix.h:30
This represents a node type in Arnold.
This represents a node in Arnold.

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