예제 #1
0
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Update the rendered image, with or without passes
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void BlenderSession::do_write_update_render_img(bool do_update_only) {
	int x = 0;
	int y = 0;
	int w = width;
	int h = height;

	// Get render result
	BL::RenderResult b_rr = begin_render_result(b_engine, x, y, w, h, b_rlay_name.c_str());

	// Can happen if the intersected rectangle gives 0 width or height
	if (!b_rr.ptr.data) return;

	BL::RenderResult::layers_iterator b_single_rlay;
	b_rr.layers.begin(b_single_rlay);
	BL::RenderLayer b_rlay = *b_single_rlay;

    if(do_update_only) {
		// Update only needed
		update_render_result(b_rr, b_rlay);
		end_render_result(b_engine, b_rr, true, true);
	}
	else {
		// Write result
		write_render_result(b_rr, b_rlay);
		end_render_result(b_engine, b_rr, false, true);
	}
} //do_write_update_render_img()
void BlenderSession::do_write_update_render_tile(RenderTile& rtile, bool do_update_only)
{
	BufferParams& params = rtile.buffers->params;
	int x = params.full_x - session->tile_manager.params.full_x;
	int y = params.full_y - session->tile_manager.params.full_y;
	int w = params.width;
	int h = params.height;

	/* get render result */
	BL::RenderResult b_rr = begin_render_result(b_engine, x, y, w, h, b_rlay_name.c_str(), b_rview_name.c_str());

	/* can happen if the intersected rectangle gives 0 width or height */
	if(b_rr.ptr.data == NULL) {
		return;
	}

	BL::RenderResult::layers_iterator b_single_rlay;
	b_rr.layers.begin(b_single_rlay);

	/* layer will be missing if it was disabled in the UI */
	if(b_single_rlay == b_rr.layers.end())
		return;

	BL::RenderLayer b_rlay = *b_single_rlay;

	if(do_update_only) {
		/* update only needed */

		if(rtile.sample != 0) {
			/* sample would be zero at initial tile update, which is only needed
			 * to tag tile form blender side as IN PROGRESS for proper highlight
			 * no buffers should be sent to blender yet
			 */
			update_render_result(b_rr, b_rlay, rtile);
		}

		end_render_result(b_engine, b_rr, true, true);
	}
	else {
		/* write result */
		write_render_result(b_rr, b_rlay, rtile);
		end_render_result(b_engine, b_rr, false, true);
	}
}