Exemplo n.º 1
0
void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) {

	//needs to be done before changes is reset to 0, to not force the editor to redraw
	VS::get_singleton()->emit_signal("frame_pre_draw");

	changes = 0;

	VSG::rasterizer->begin_frame(frame_step);

	VSG::scene->update_dirty_instances(); //update scene stuff

	VSG::viewport->draw_viewports();
	VSG::scene->render_probes();
	_draw_margins();
	VSG::rasterizer->end_frame(p_swap_buffers);

	while (frame_drawn_callbacks.front()) {

		Object *obj = ObjectDB::get_instance(frame_drawn_callbacks.front()->get().object);
		if (obj) {
			Variant::CallError ce;
			const Variant *v = &frame_drawn_callbacks.front()->get().param;
			obj->call(frame_drawn_callbacks.front()->get().method, &v, 1, ce);
			if (ce.error != Variant::CallError::CALL_OK) {
				String err = Variant::get_call_error_text(obj, frame_drawn_callbacks.front()->get().method, &v, 1, ce);
				ERR_PRINTS("Error calling frame drawn function: " + err);
			}
		}

		frame_drawn_callbacks.pop_front();
	}
	VS::get_singleton()->emit_signal("frame_post_draw");
}
Exemplo n.º 2
0
void VisualServerRaster::draw(bool p_swap_buffers) {

	changes = 0;

	VSG::rasterizer->begin_frame();

	VSG::scene->update_dirty_instances(); //update scene stuff

	VSG::viewport->draw_viewports();
	VSG::scene->render_probes();
	_draw_margins();
	VSG::rasterizer->end_frame(p_swap_buffers);

	while (frame_drawn_callbacks.front()) {

		Object *obj = ObjectDB::get_instance(frame_drawn_callbacks.front()->get().object);
		if (obj) {
			Variant::CallError ce;
			const Variant *v = &frame_drawn_callbacks.front()->get().param;
			obj->call(frame_drawn_callbacks.front()->get().method, &v, 1, ce);
			if (ce.error != Variant::CallError::CALL_OK) {
				String err = Variant::get_call_error_text(obj, frame_drawn_callbacks.front()->get().method, &v, 1, ce);
				ERR_PRINTS("Error calling frame drawn function: " + err);
			}
		}

		frame_drawn_callbacks.pop_front();
	}

	emit_signal("frame_drawn_in_thread");
}