Files
test/source/blender/compositor/operations/COM_TrackPositionOperation.h
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00

91 lines
1.9 KiB
C++

/* SPDX-FileCopyrightText: 2012 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <string.h>
#include "COM_ConstantOperation.h"
#include "DNA_movieclip_types.h"
#include "DNA_tracking_types.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
namespace blender::compositor {
/**
* Class with implementation of green screen gradient rasterization
*/
class TrackPositionOperation : public ConstantOperation {
protected:
MovieClip *movie_clip_;
int framenumber_;
char tracking_object_name_[64];
char track_name_[64];
int axis_;
CMPNodeTrackPositionMode position_;
int relative_frame_;
bool speed_output_;
int width_, height_;
float marker_pos_[2];
float relative_pos_[2];
float track_position_;
bool is_track_position_calculated_;
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
public:
TrackPositionOperation();
void set_movie_clip(MovieClip *clip)
{
movie_clip_ = clip;
}
void set_tracking_object(char *object)
{
BLI_strncpy(tracking_object_name_, object, sizeof(tracking_object_name_));
}
void set_track_name(char *track)
{
BLI_strncpy(track_name_, track, sizeof(track_name_));
}
void set_framenumber(int framenumber)
{
framenumber_ = framenumber;
}
void set_axis(int value)
{
axis_ = value;
}
void set_position(CMPNodeTrackPositionMode value)
{
position_ = value;
}
void set_relative_frame(int value)
{
relative_frame_ = value;
}
void set_speed_output(bool speed_output)
{
speed_output_ = speed_output;
}
void init_execution() override;
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
const float *get_constant_elem() override;
private:
void calc_track_position();
};
} // namespace blender::compositor