Beispiel #1
0
int OilEffect::process_realtime(VFrame *input, VFrame *output)
{
    need_reconfigure |= load_configuration();



//printf("OilEffect::process_realtime %f %d\n", config.radius, config.use_intensity);
    this->input = input;
    this->output = output;

    if(EQUIV(config.radius, 0))
    {
        if(input->get_rows()[0] != output->get_rows()[0])
            output->copy_from(input);
    }
    else
    {
        if(input->get_rows()[0] == output->get_rows()[0])
        {
            if(!temp_frame) temp_frame = new VFrame(0,
                                                        -1,
                                                        input->get_w(),
                                                        input->get_h(),
                                                        input->get_color_model(),
                                                        -1);
            temp_frame->copy_from(input);
            this->input = temp_frame;
        }


        if(!engine)
        {
            engine = new OilServer(this, (PluginClient::smp + 1));
        }

        engine->process_packages();
    }



    return 0;
}
Beispiel #2
0
void SceneNode::render(VFrame *frame, int do_camera)
{
	const int debug = 0;
	if(debug) printf("SceneNode::render %d this=%p title=%s image=%p x=%f y=%f frame=%p do_camera=%d\n", 
		__LINE__, 
		this,
		title,
		image,
		this->x,
		this->y,
		frame,
		do_camera);

	VFrame *temp = 0;
	VFrame *temp2 = 0;
	if(image)
	{
		float x = this->x;
		float y = this->y;
		float sx = this->sx;
		float sy = this->sy;
		float ry = this->ry;
		if(parent) 
			parent->transform_coord(&x, &y, &sx, &sy, &ry);

		if(do_camera) scene->transform_camera(frame, 
			&x, 
			&y, 
			&sx, 
			&sy, 
			get_flip());

		if(debug) printf("SceneNode::render %d at_y=%f\n", 
			__LINE__, 
			((SceneCamera*)scene->cameras.get(0))->at_y);

// Render everything into a temporary, then overlay the temporary
// 		if(!EQUIV(ry, 0) || get_flip())
// 		{
		temp = new VFrame(image->get_w(), 
			image->get_h(), 
			image->get_color_model());
//		}
		if(debug) printf("SceneNode::render %d\n", __LINE__);


// 1st comes our image
		temp->copy_from(image);

// Then come the subnodes without camera transforms
		if(debug) printf("SceneNode::render %d this=%p nodes=%d\n", __LINE__, this, nodes.size());
		for(int i = 0; i < nodes.size(); i++)
			nodes.get(i)->render(temp, 0);



		if(debug) printf("SceneNode::render %d\n", __LINE__);

// Then comes rotation into temp2
		VFrame *src = temp;
		if(!EQUIV(ry, 0))
		{
			src = temp2 = new VFrame(image->get_w(), 
				image->get_h(), 
				image->get_color_model());
			if(!scene->affine) scene->affine = 
				new AffineEngine(scene->cpus, scene->cpus);
			scene->affine->rotate(temp2,
				temp,
				ry);
			if(debug) printf("SceneNode::render %d ry=%f\n", __LINE__, ry);
		}

// Then comes flipping
		if(get_flip())
			src->flip_horiz();

		if(debug) printf("SceneNode::render %d src=%p x=%f y=%f sx=%f sy=%f\n", 
			__LINE__, 
			src,
			x,
			y,
			sx,
			sy);

// Overlay on the output frame
		if(!scene->overlayer) scene->overlayer = new OverlayFrame(scene->cpus);

		if(get_flip())
		{
			scene->overlayer->overlay(frame, 
				src, 
				0, 
				0, 
				image->get_w(), 
				image->get_h(), 
				frame->get_w() - x - image->get_w() * sx, 
				y, 
				frame->get_w() - x, 
				y + image->get_h() * sy, 
				1,
				TRANSFER_NORMAL,
				NEAREST_NEIGHBOR);
		}
		else
		{
			if(debug) printf("SceneNode::render %d image=%p src=%p frame=%p\n", 
				__LINE__, 
				image,
				src,
				frame);
			scene->overlayer->overlay(frame, 
				src, 
				0, 
				0, 
				image->get_w(), 
				image->get_h(), 
				x, 
				y, 
				x + image->get_w() * sx, 
				y + image->get_h() * sy, 
				1,
				TRANSFER_NORMAL,
				NEAREST_NEIGHBOR);
		}

		if(debug) printf("SceneNode::render %d\n", __LINE__);

	}
	else
	{
		for(int i = 0; i < nodes.size(); i++)
			nodes.get(i)->render(frame, 1);
	}

	if(debug) printf("SceneNode::render %d this=%p title=%s\n", __LINE__, this, title);

	if(temp) delete temp;
	if(temp2) delete temp2;
}