ai_filters.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 #include <stdint.h> // uint32_t etc
16 
17 // forward declaration
18 struct AtAOVSampleIterator;
19 
40  uint8_t (*FilterOutputType)(const AtNode*, uint8_t);
41  void (*FilterPixel)(AtNode*, AtAOVSampleIterator*, void*, uint8_t);
42 };
43 
45 #define AI_FILTER_NODE_EXPORT_METHODS(tag) \
46 AI_INSTANCE_COMMON_METHODS \
47 filter_output_type; \
48 filter_pixel; \
49 static AtFilterNodeMethods ai_filter_mtds = { \
50  FilterOutputType, \
51  FilterPixel \
52 }; \
53 static AtNodeMethods ai_node_mtds = { \
54  &ai_common_mtds, \
55  &ai_filter_mtds \
56 }; \
57 const AtNodeMethods *tag = &ai_node_mtds;
58 
78 #define filter_output_type \
79 static uint8_t FilterOutputType(const AtNode* node, uint8_t input_type)
80 
94 #define filter_pixel \
95 static void FilterPixel(AtNode* node, AtAOVSampleIterator* iterator, void* data_out, uint8_t data_type)
96 
97 /* \}*/
98 
103 AI_API void AiFilterInitialize(AtNode* node, bool requires_depth, const char** required_aovs);
104 AI_API void AiFilterUpdate(AtNode* node, float width);
105 /* \}*/
106 
111 AI_API void AiAOVSampleIteratorInitPixel(AtAOVSampleIterator* iter, int x, int y);
112 AI_API void AiAOVSampleIteratorGetPixel(AtAOVSampleIterator* iter, int &x, int &y);
113 AI_API void AiAOVSampleIteratorReset(AtAOVSampleIterator* iter);
114 AI_API bool AiAOVSampleIteratorGetNext(AtAOVSampleIterator* iter);
115 AI_API bool AiAOVSampleIteratorGetNextDepth(AtAOVSampleIterator* iter);
116 AI_API AI_PURE AtVector2 AiAOVSampleIteratorGetOffset(const AtAOVSampleIterator* iter);
117 AI_API AI_PURE float AiAOVSampleIteratorGetInvDensity(const AtAOVSampleIterator* iter);
118 AI_API AI_PURE int AiAOVSampleIteratorGetDepth(const AtAOVSampleIterator* iter);
119 AI_API AI_PURE bool AiAOVSampleIteratorHasValue(const AtAOVSampleIterator* iter);
120 AI_API AI_PURE bool AiAOVSampleIteratorHasAOVValue(const AtAOVSampleIterator* iter, AtString name, uint8_t type);
121 /* \}*/
122 
127 AI_API AI_PURE bool AiAOVSampleIteratorGetBool (const AtAOVSampleIterator* iter);
128 AI_API AI_PURE int AiAOVSampleIteratorGetInt (const AtAOVSampleIterator* iter);
129 AI_API AI_PURE unsigned int AiAOVSampleIteratorGetUInt (const AtAOVSampleIterator* iter);
130 AI_API AI_PURE float AiAOVSampleIteratorGetFlt (const AtAOVSampleIterator* iter);
131 AI_API AI_PURE AtRGB AiAOVSampleIteratorGetRGB (const AtAOVSampleIterator* iter);
132 AI_API AI_PURE AtRGBA AiAOVSampleIteratorGetRGBA (const AtAOVSampleIterator* iter);
133 AI_API AI_PURE AtVector AiAOVSampleIteratorGetVec (const AtAOVSampleIterator* iter);
134 AI_API AI_PURE AtVector2 AiAOVSampleIteratorGetVec2 (const AtAOVSampleIterator* iter);
135 AI_API AI_PURE AtMatrix AiAOVSampleIteratorGetMatrix(const AtAOVSampleIterator* iter);
136 AI_API AI_PURE const void* AiAOVSampleIteratorGetPtr (const AtAOVSampleIterator* iter);
137 /* \}*/
138 
143 AI_API AI_PURE bool AiAOVSampleIteratorGetAOVBool (const AtAOVSampleIterator* iter, const AtString name);
144 AI_API AI_PURE int AiAOVSampleIteratorGetAOVInt (const AtAOVSampleIterator* iter, const AtString name);
145 AI_API AI_PURE unsigned int AiAOVSampleIteratorGetAOVUInt (const AtAOVSampleIterator* iter, const AtString name);
146 AI_API AI_PURE float AiAOVSampleIteratorGetAOVFlt (const AtAOVSampleIterator* iter, const AtString name);
147 AI_API AI_PURE AtRGB AiAOVSampleIteratorGetAOVRGB (const AtAOVSampleIterator* iter, const AtString name);
148 AI_API AI_PURE AtRGBA AiAOVSampleIteratorGetAOVRGBA (const AtAOVSampleIterator* iter, const AtString name);
149 AI_API AI_PURE AtVector AiAOVSampleIteratorGetAOVVec (const AtAOVSampleIterator* iter, const AtString name);
150 AI_API AI_PURE AtVector2 AiAOVSampleIteratorGetAOVVec2 (const AtAOVSampleIterator* iter, const AtString name);
151 AI_API AI_PURE AtMatrix AiAOVSampleIteratorGetAOVMatrix(const AtAOVSampleIterator* iter, const AtString name);
152 AI_API AI_PURE const void* AiAOVSampleIteratorGetAOVPtr (const AtAOVSampleIterator* iter, const AtString name);
153 /* \}*/
154 
155 /*\}*/
AI_API void AiAOVSampleIteratorReset(AtAOVSampleIterator *iter)
Reset the iterator to its initial state (start of the same pixel).
Definition: ai_sample_iterator.cpp:40
AI_API void AiFilterUpdate(AtNode *node, float width)
Updates an AOV filter.
Definition: ai_aov_filters.cpp:45
RGB color.
Definition: ai_color.h:31
AI_API void AiFilterInitialize(AtNode *node, bool requires_depth, const char **required_aovs)
Initializes an AOV filter.
Definition: ai_aov_filters.cpp:22
AI_API bool AiAOVSampleIteratorGetNext(AtAOVSampleIterator *iter)
Advance iterator to next sample (or return false if none are left).
Definition: ai_sample_iterator.cpp:53
AI_API AI_PURE bool AiAOVSampleIteratorHasValue(const AtAOVSampleIterator *iter)
Test if the iterator has a value for the primary AOV at the current location.
Definition: ai_sample_iterator.cpp:133
AI_API bool AiAOVSampleIteratorGetNextDepth(AtAOVSampleIterator *iter)
Advance the iterator through the "deep" sample off of the current sub-pixel sample.
Definition: ai_sample_iterator.cpp:65
This represents a node in Arnold.
AI_API AI_PURE bool AiAOVSampleIteratorHasAOVValue(const AtAOVSampleIterator *iter, AtString name, uint8_t type)
Test if the iterator has a value for an arbitrary AOV at the current location.
Definition: ai_sample_iterator.cpp:151
AtNode struct and methods.
Vector math types, operators and utilities.
Filter Node methods structure.
Definition: ai_filters.h:39
Arnold String allows for fast string comparisons.
Definition: ai_string.h:46
3D point (single precision)
Definition: ai_vector.h:29
Definition: ai_matrix.h:30
2D point
Definition: ai_vector.h:254
AI_API AI_PURE float AiAOVSampleIteratorGetInvDensity(const AtAOVSampleIterator *iter)
Get the inverse of the sampling density of the current sample.
Definition: ai_sample_iterator.cpp:105
AI_API void AiAOVSampleIteratorGetPixel(AtAOVSampleIterator *iter, int &x, int &y)
Returns the pixel coordinates that the iterator was initialized for.
Definition: ai_sample_iterator.cpp:28
AI_API AI_PURE int AiAOVSampleIteratorGetDepth(const AtAOVSampleIterator *iter)
Get the depth of the current sample.
Definition: ai_sample_iterator.cpp:118
RGB color + alpha.
Definition: ai_color.h:266
AI_API void AiAOVSampleIteratorInitPixel(AtAOVSampleIterator *iter, int x, int y)
Initialize the iterator for looping over the sample of the specified pixel.
Definition: ai_sample_iterator.cpp:16
AI_API AI_PURE AtVector2 AiAOVSampleIteratorGetOffset(const AtAOVSampleIterator *iter)
Get the (x,y) offset from the pixel center.
Definition: ai_sample_iterator.cpp:79

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