Inherits DD::Image::Iop.
Public Member Functions | |
void | _validate (bool) |
void | setclip (const Box &) |
void | _request (int x, int y, int r, int t, ChannelMask, int count) |
void | engine (int y, int x, int r, ChannelMask allchan, Row &row) |
Transform (Node *node=0) | |
Transform * | getTransform () |
virtual void | setInputsValid (bool) |
virtual HandlesMode | doAnyHandles (ViewerContext *ctx) |
void | build_handles (ViewerContext *ctx) |
void | draw_handle (ViewerContext *ctx) |
Matrix4 * | matrix () |
virtual void | matrix (const Matrix4 &m) |
bool | transform (double x, double y, double &X, double &Y, double &Z) |
bool | concat_transform (double x, double y, double &X, double &Y, double &Z) |
void | reset () |
void | multiply (const Matrix4 &m) |
void | multiply (const Transform &t) |
void | premultiply (const Matrix4 &m) |
void | premultiply (const Transform &t) |
void | scale (float s) |
void | scale (float x, float y, float z=1.0) |
void | rotateX (float radians) |
void | rotateY (float radians) |
void | rotateZ (float radians) |
void | rotate (float radians) |
void | rotate (float a, float x, float y, float z) |
void | skew (float a) |
void | translate (float x, float y) |
void | translate (float x, float y, float z) |
const Filter * | filter () const |
int | filter_type () const |
void | filter_type (int t) |
bool | clamp () const |
void | clamp (bool v) |
bool | black_outside () const |
void | black_outside (bool v) |
const char * | Class () const |
const char * | node_help () const |
unsigned | node_color () const |
const Matrix4 & | concat_matrix () const |
Iop * | concat_input () const |
void | filter_knobs (Knob_Callback) |
void | motionblur_knobs (Knob_Callback cb) |
void | knobs (Knob_Callback) |
float | getMotionBlur () const |
bool | isMotionBlurring () const |
float | motionBlurSample (int x, int y, RowCacheTile &i, ChannelMask iChannels, Pixel &out) |
do motion blurring for the pixel, returns the guestimated path length of the sample | |
mFnDeprecatedInNuke11Func ("The use of Interest class might cause performance drop when a high number of threads are used. Use RowCacheTile class instead.", float motionBlurSample(int x, int y, Interest &i, ChannelMask iChannels, Pixel &out)) | |
void | sample (const Vector2 ¢er, const Vector2 &dU, const Vector2 &dV, Filter *filter, Pixel &out) |
void | sample (float cx, float cy, float w, float h, Filter *filter, Pixel &out) |
bool | set_texturemap (ViewerContext *, bool) |
Op * | realParent () |
Static Public Member Functions | |
static double | mitchell (double b, double c, double x) |
Protected Member Functions | |
bool | degenerate () |
virtual void | matrixAt (const OutputContext &, Matrix4 &dest) |
void | concatMatrixAt (const OutputContext &, Matrix4 &dest) |
void | append (Hash &hash) |
void | updateConcat (bool setInfo) |
update the concat_matrix_ / concat_input_ / concat_clamp_ / concat_black_outside_ | |
Protected Attributes | |
Matrix4 | matrix_ |
Matrix4 | concat_matrix_ |
Iop * | concat_input_ |
bool | clamp_ |
bool | black_outside_ |
bool | concat_clamp_ |
bool | concat_black_outside_ |
bool | can_concat |
float | _motionblur |
amount of motion blur to do, '1' being heuristically'enough' | |
ShutterControls | _shutter |
shutter controls for motion blurring | |
Filter | filter_ |
Friends | |
class | TransformI |
Transforms the input image by a 4x4 transformation matrix.
Transform::Transform | ( | Node * | node = 0 | ) |
The constructor sets the transformation to the identity matrix.
References _motionblur, and DD::Image::Matrix4::makeIdentity().
bool Transform::degenerate | ( | ) | [protected] |
_validate() calls this when the output image is invisible or otherwise cannot be calculated. It deletes the tp object to indicate this.
References DD::Image::IopInfo::black_outside(), DD::Image::IopInfoOwner::info_, DD::Image::Box::set(), and DD::Image::Op::slowness().
Referenced by _validate().
void Transform::matrixAt | ( | const OutputContext & | context, |
Matrix4 & | dest | ||
) | [protected, virtual] |
For implementing motion blur, return the matrix at various times. Default version changes the knobs and calls validate(), but a subclass can replace this if there is a faster way.
References matrix(), DD::Image::Op::outputContext(), DD::Image::Op::setKnobsToContext(), and DD::Image::Op::validate().
void Transform::append | ( | Hash & | hash | ) | [protected, virtual] |
Since _validate is fetching out values of knobs at nearby times to do motionblurring, we have to hash those in here, otherwise changing the velocity of the curve without changing its value will not result in the hash changing.
Reimplemented from DD::Image::Op.
References _shutter, DD::Image::Matrix4::append(), DD::Image::ShutterControls::calcOffset(), DD::Image::ShutterControls::getDuration(), matrix(), DD::Image::Op::outputContext(), step(), and DD::Image::Op::validate().
void Transform::_validate | ( | bool | for_real | ) | [virtual] |
_validate() will combine all adjacent Transform operators into a single one. When you call engine() it will skip the earlier operators, read from the input to the first one (concat_input()), and process by a concatenated transformation matrix (concat_matrix()).
Reimplemented from DD::Image::Iop.
References _motionblur, _shutter, DD::Image::IopInfo::black_outside(), DD::Image::ShutterControls::calcOffset(), DD::Image::IopInfoOwner::channels(), degenerate(), DD::Image::ShutterControls::getDuration(), DD::Image::Box::h(), DD::Image::IopInfoOwner::info(), DD::Image::IopInfoOwner::info_, DD::Image::Iop::input0(), DD::Image::Filter::interpolative(), matrix(), DD::Image::Box::merge(), DD::Image::Box::move(), DD::Image::Op::outputContext(), DD::Image::Box::pad(), DD::Image::Box::set(), DD::Image::Op::slowness(), DD::Image::IopInfoOwner::t(), updateConcat(), DD::Image::Op::validate(), DD::Image::IopInfoOwner::w(), DD::Image::Box::w(), DD::Image::Box::x(), DD::Image::Box::y(), DD::Image::IopInfoOwner::ydirection(), and DD::Image::IopInfo::ydirection().
void Transform::setclip | ( | const Box & | box | ) |
After _validate() is called a subclass can call this to force the Transform to clip the output to a rectangle and put black outside it. The rectangle is exactly 1 pixel inside the passed Box (ie the box includes the black edge). The info() is set to this box. This is used by Reformat.
References DD::Image::IopInfoOwner::info_, and DD::Image::Box::set().
void Transform::setInputsValid | ( | bool | nowValid | ) | [virtual] |
this needs calling whenever the input pointers change even if they are pointing to equivalent Ops, as the Transform keeps its own pointers to its inputs.
Reimplemented from DD::Image::Op.
References DD::Image::Iop::input(), and updateConcat().
void Transform::build_handles | ( | ViewerContext * | ctx | ) | [virtual] |
draw_handle() will draw the input texture map. We only want this to happen for the first operator, so that if the user has several open at once the texture is only drawn once.
Reimplemented from DD::Image::Iop.
References DD::Image::Op::add_draw_handle(), DD::Image::Op::build_input_handles(), DD::Image::Op::build_knob_handles(), DD::Image::CONNECTED, DD::Image::ViewerContext::connected(), DD::Image::ViewerContext::modelmatrix, DD::Image::Op::node_disabled(), DD::Image::Op::panel_visible(), DD::Image::Op::pushed(), DD::Image::Iop::set_texturemap(), DD::Image::SHOW_OBJECT, DD::Image::SHOW_PUSHED_OBJECT, DD::Image::ViewerContext::transform_mode(), DD::Image::Op::validate(), and DD::Image::VIEWER_2D.
void Transform::draw_handle | ( | ViewerContext * | ctx | ) | [virtual] |
Draws a rectangle the size of the input format, filled with the input as a texture map if possible.
Reimplemented from DD::Image::Op.
References DD::Image::ViewerContext::display3d(), DD::Image::ViewerContext::draw_lines(), DD::Image::ViewerContext::draw_transparent(), DD::Image::IopInfoOwner::format(), DD::Image::glColor(), DD::Image::IopInfoOwner::info(), DD::Image::ViewerContext::node_color(), DD::Image::Box::r(), DD::Image::IopInfoOwner::r(), DD::Image::Iop::set_texturemap(), DD::Image::style_needs_wireframe(), DD::Image::Box::t(), DD::Image::IopInfoOwner::t(), DD::Image::Iop::unset_texturemap(), DD::Image::Box::x(), and DD::Image::Box::y().
double Transform::mitchell | ( | double | b, |
double | c, | ||
double | x | ||
) | [static] |
Evaluate a Mitchell filter at position x. This can be used by Nuke to view the filter shapes.
Matrix4 * Transform::matrix | ( | ) |
This virtual function should return the matrix used. A subclass can call reset() and then scale, translate, etc to get the matrix wanted and then return Transform::matrix(). You can also skip doing anything and return Transform::matrix() if valid() is true, since you know the matrix has been calculated then.
Referenced by _validate(), append(), matrixAt(), and updateConcat().
bool Transform::transform | ( | double | x, |
double | y, | ||
double & | X, | ||
double & | Y, | ||
double & | Z | ||
) |
Transform an input uv position into an output xyw.
Returns false for w <= 0. Such a point is not visible and has no output x/y position. However this version makes a "guess" as to what direction visible pixels that are near uv are and returns very large values for x,y in that direction. This is useful for calculating resulting bounding boxes.
bool Transform::concat_transform | ( | double | x, |
double | y, | ||
double & | X, | ||
double & | Y, | ||
double & | Z | ||
) |
Same as transform() but it uses the concatenated matrix, thus transforming coordinates from concat_input(). This only works after validate() has been called.
void DD::Image::Transform::reset | ( | ) | [inline] |
Set the transformation to the identity.
void DD::Image::Transform::multiply | ( | const Matrix4 & | m | ) | [inline] |
Transform further by an arbitrary transformation matrix. Like OpenGL all transformation operations are done by post-multiply, so this transformation is applied in the object's space. For instance a rotate(1) followed by a translate(1,0) will move the center of the object along a diagonal line.
void Transform::rotateX | ( | float | radians | ) | [inline] |
Rotate about x (top towards camera) by angle radians.
void Transform::rotateY | ( | float | radians | ) | [inline] |
Rotate about y (left edge towards camera) by angle radians.
void Transform::rotateZ | ( | float | radians | ) | [inline] |
Rotate about z (counter-clockwise) by angle radians.
int Transform::filter | ( | ) | const [inline] |
Return the current filter type.
void DD::Image::Transform::clamp | ( | bool | v | ) | [inline] |
If true then any negative intermediate results are set to zero. This can improve the results from high-contrast images and filters with negative lobes if you know nothing in the input is negative, by deleting a lot of the ringing in black areas.
The default value is false.
void DD::Image::Transform::black_outside | ( | bool | v | ) | [inline] |
If true the transform will act as though any data outside the incoming bounding box is black. It will also produce an alpha channel if there is none in the input.
If this is false, Transform will replicate the pixels outside the bounding box instead. This will prevent any antialiasing on the edge. This is used by the Reformat operator, and may be useful for tile or camera shake type operators.
The default value is true.
unsigned Transform::node_color | ( | ) | const [virtual] |
All transform operators default to a purpleish color.
Reimplemented from DD::Image::Op.
const Matrix4 & DD::Image::Transform::concat_matrix | ( | ) | const [inline] |
After _validate() is done, this returns the transformation between the concat_input() and the output of this operator.
Referenced by updateConcat().
Iop * DD::Image::Transform::concat_input | ( | ) | const [inline] |
After _validate() is done this returns the operator that input will actually be read from.
Referenced by updateConcat().
void Transform::filter_knobs | ( | Knob_Callback | cb | ) |
Subclasses should call this to insert a filter-selection control into their control panels. This adds the "filter type" and "clamp" controls.
References DD::Image::Bool_knob(), DD::Image::Filter::knobs(), DD::Image::Knob::NODEGRAPH_ONLY, DD::Image::SetFlags(), and DD::Image::Tooltip().
Referenced by knobs().
void Transform::motionblur_knobs | ( | Knob_Callback | cb | ) |
Adds the motionblur amount and shutter knobs
do the shutter controls
References _motionblur, _shutter, DD::Image::Float_knob(), DD::Image::ShutterControls::knobs(), DD::Image::Knob::NODEGRAPH_ONLY, DD::Image::SetFlags(), and DD::Image::Tooltip().
Referenced by knobs().
void Transform::knobs | ( | Knob_Callback | cb | ) | [virtual] |
Does filter_knobs, adds the "black outside" knob, and does motionblur_knobs()
Reimplemented from DD::Image::Op.
References DD::Image::Bool_knob(), filter_knobs(), motionblur_knobs(), DD::Image::Knob::NODEGRAPH_ONLY, DD::Image::Obsolete_knob(), DD::Image::SetFlags(), and DD::Image::Tooltip().
void Transform::sample | ( | const Vector2 & | center, |
const Vector2 & | dU, | ||
const Vector2 & | dV, | ||
Filter * | filter, | ||
Pixel & | out | ||
) | [virtual] |
Texture filtering function. Disables motion blur!
Reimplemented from DD::Image::Iop.
References DD::Image::Op::aborted(), DD::Image::Filter::Coefficients::array, DD::Image::Iop::at(), DD::Image::Filter::Coefficients::count, DD::Image::Filter::Coefficients::delta, DD::Image::Filter::Coefficients::first, DD::Image::Filter::get(), DD::Image::IopInfoOwner::info(), DD::Image::Filter::Coefficients::normalize, DD::Image::Box::r(), DD::Image::Iop::sample(), DD::Image::Box::t(), DD::Image::IopInfoOwner::x(), DD::Image::Box::x(), and DD::Image::Box::y().
Referenced by sample().
bool Transform::set_texturemap | ( | ViewerContext * | ctx, |
bool | gl | ||
) | [virtual] |
Uses the input's texture map, but changes the OpenGL texture matrix to show it correctly translated.
Reimplemented from DD::Image::Iop.
References DD::Image::Matrix4::array(), and DD::Image::Iop::set_texturemap().