polygon node: early crude implementation
This commit is contained in:
@@ -110,7 +110,10 @@ void OpenGLProxy::FrameToValue(FramePtr frame, StreamPtr stream, NodeValueTable*
|
||||
bool has_alpha = PixelFormat::FormatHasAlphaChannel(frame->format());
|
||||
|
||||
// Convert frame to float for OCIO
|
||||
frame = PixelFormat::ConvertPixelFormat(frame, has_alpha ? PixelFormat::PIX_FMT_RGBA32F : PixelFormat::PIX_FMT_RGB32F);
|
||||
frame = PixelFormat::ConvertPixelFormat(frame,
|
||||
has_alpha
|
||||
? PixelFormat::PIX_FMT_RGBA32F
|
||||
: PixelFormat::PIX_FMT_RGB32F);
|
||||
|
||||
// If alpha is associated, disassociate for the color transform
|
||||
if (has_alpha && video_stream->premultiplied_alpha()) {
|
||||
@@ -281,7 +284,25 @@ void OpenGLProxy::RunNodeAccelerated(const Node *node, const TimeRange &range, N
|
||||
shader->setUniformValue(variable_location, value.toFloat());
|
||||
break;
|
||||
case NodeInput::kVec2:
|
||||
shader->setUniformValue(variable_location, value.value<QVector2D>());
|
||||
if (input->IsArray()) {
|
||||
NodeInputArray* array = static_cast<NodeInputArray*>(input);
|
||||
QVector<QVector2D> a(array->GetSize());
|
||||
|
||||
for (int i=0;i<a.size();i++) {
|
||||
a[i] = input_params[array->At(i)].Get(NodeParam::kVec2).value<QVector2D>();
|
||||
}
|
||||
|
||||
shader->setUniformValueArray(variable_location, a.constData(), a.size());
|
||||
|
||||
int count_location = shader->uniformLocation(QStringLiteral("%1_count").arg(input->id()));
|
||||
if (count_location > -1) {
|
||||
shader->setUniformValue(count_location,
|
||||
array->GetSize());
|
||||
}
|
||||
|
||||
} else {
|
||||
shader->setUniformValue(variable_location, value.value<QVector2D>());
|
||||
}
|
||||
break;
|
||||
case NodeInput::kVec3:
|
||||
shader->setUniformValue(variable_location, value.value<QVector3D>());
|
||||
|
||||
@@ -76,11 +76,6 @@ void RenderWorker::RunNodeAccelerated(const Node *node, const TimeRange &range,
|
||||
Q_UNUSED(output_params)
|
||||
}
|
||||
|
||||
StreamPtr RenderWorker::ResolveStreamFromInput(NodeInput *input)
|
||||
{
|
||||
return input->get_standard_value().value<StreamPtr>();
|
||||
}
|
||||
|
||||
DecoderPtr RenderWorker::ResolveDecoderFromInput(StreamPtr stream)
|
||||
{
|
||||
// Access a map of Node inputs and decoder instances and retrieve a frame!
|
||||
@@ -108,21 +103,12 @@ bool RenderWorker::IsStarted()
|
||||
return started_;
|
||||
}
|
||||
|
||||
void RenderWorker::InputProcessingEvent(NodeInput* input, const TimeRange& input_time, NodeValueTable *table)
|
||||
void RenderWorker::FootageProcessingEvent(StreamPtr stream, const TimeRange& input_time, NodeValueTable *table)
|
||||
{
|
||||
// Exception for Footage types where we actually retrieve some Footage data from a decoder
|
||||
if (input->data_type() == NodeParam::kFootage) {
|
||||
StreamPtr stream = ResolveStreamFromInput(input);
|
||||
DecoderPtr decoder = ResolveDecoderFromInput(stream);
|
||||
|
||||
if (stream) {
|
||||
DecoderPtr decoder = ResolveDecoderFromInput(stream);
|
||||
|
||||
if (decoder) {
|
||||
|
||||
FrameToValue(decoder, stream, input_time, table);
|
||||
|
||||
}
|
||||
}
|
||||
if (decoder) {
|
||||
FrameToValue(decoder, stream, input_time, table);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,12 +59,10 @@ protected:
|
||||
|
||||
virtual void FrameToValue(DecoderPtr decoder, StreamPtr stream, const TimeRange &range, NodeValueTable* table) = 0;
|
||||
|
||||
virtual void InputProcessingEvent(NodeInput *input, const TimeRange &input_time, NodeValueTable* table) override;
|
||||
virtual void FootageProcessingEvent(StreamPtr stream, const TimeRange &input_time, NodeValueTable* table) override;
|
||||
|
||||
virtual void ProcessNodeEvent(const Node *node, const TimeRange &range, NodeValueDatabase &input_params, NodeValueTable &output_params) override;
|
||||
|
||||
StreamPtr ResolveStreamFromInput(NodeInput* input);
|
||||
|
||||
DecoderPtr ResolveDecoderFromInput(StreamPtr stream);
|
||||
|
||||
const NodeDependency& CurrentPath() const;
|
||||
|
||||
@@ -201,20 +201,6 @@ void VideoRenderWorker::ResizeDownloadBuffer()
|
||||
download_buffer_.resize(PixelFormat::GetBufferSize(video_params_.format(), video_params_.effective_width(), video_params_.effective_height()));
|
||||
}
|
||||
|
||||
NodeValueTable VideoRenderWorker::RenderBlock(const TrackOutput *track, const TimeRange &range)
|
||||
{
|
||||
// A frame can only have one active block so we just validate the in point of the range
|
||||
Block* active_block = track->BlockAtTime(range.in());
|
||||
|
||||
NodeValueTable table;
|
||||
|
||||
if (active_block) {
|
||||
table = ProcessNode(NodeDependency(active_block, range));
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
ColorProcessorCache *VideoRenderWorker::color_cache()
|
||||
{
|
||||
return &color_cache_;
|
||||
|
||||
@@ -92,14 +92,12 @@ protected:
|
||||
|
||||
virtual void ParametersChangedEvent(){}
|
||||
|
||||
virtual void TextureToBuffer(const QVariant& texture, void *buffer, int linesize);
|
||||
void TextureToBuffer(const QVariant& texture, void *buffer, int linesize);
|
||||
|
||||
virtual void TextureToBuffer(const QVariant& texture, int width, int height, const QMatrix4x4& matrix, void *buffer, int linesize) = 0;
|
||||
|
||||
virtual NodeValueTable RenderInternal(const NodeDependency& CurrentPath, const qint64& job_time) override;
|
||||
|
||||
virtual NodeValueTable RenderBlock(const TrackOutput *track, const TimeRange& range) override;
|
||||
|
||||
ColorProcessorCache* color_cache();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user