Esempio n. 1
0
void
sge::postprocessing::fullscreen_quad::render(
	sge::renderer::context::core &_context)
{
	sge::renderer::vertex::scoped_declaration scoped_vd(
		_context,
		vertex_declaration_);

	sge::renderer::vertex::scoped_buffer scoped_vb(
		_context,
		*vertex_buffer_);

	_context.render_nonindexed(
		sge::renderer::vertex::first(
			0u),
		sge::renderer::vertex::count(
			vertex_buffer_->linear_size()),
		sge::renderer::primitive_type::triangle_strip);
}
Esempio n. 2
0
void
flake::volume::density_visualization::raycaster::object::render(
	sge::renderer::context::core &_context)
{
	sge::renderer::vertex::scoped_declaration scoped_vd(
		_context,
		*vertex_declaration_);

	sge::shader::scoped_pair scoped_shader(
		_context,
		shader_);

	mvp_parameter_.set(
		sge::camera::matrix_conversion::world_projection(
			camera_.coordinate_system(),
			camera_.projection_matrix()));

	camera_position_parameter_.set(
		-camera_.coordinate_system().position().get());

	camera_is_inside_cube_parameter_.set(
		this->camera_is_inside_cube()
		?
			static_cast<sge::renderer::scalar>(
				1.0f)
		:
			static_cast<sge::renderer::scalar>(
				0.0f));

	sge::renderer::state::core::blend::scoped scoped_blend_state(
		_context,
		*blend_state_);

	sge::renderer::state::core::rasterizer::object_unique_ptr const rasterizer_state(
		renderer_.create_rasterizer_state(
			sge::renderer::state::core::rasterizer::parameters(
				this->camera_is_inside_cube()
				?
					sge::renderer::state::core::rasterizer::cull_mode::counter_clockwise
				:
					sge::renderer::state::core::rasterizer::cull_mode::clockwise,
				sge::renderer::state::core::rasterizer::fill_mode::solid,
				sge::renderer::state::core::rasterizer::enable_scissor_test(
					false))));

	sge::renderer::state::core::rasterizer::scoped scoped_rasterizer_state(
		_context,
		*rasterizer_state);

	sge::renderer::state::core::sampler::scoped scoped_sampler_state{
		_context,
		sge::renderer::state::core::sampler::const_object_ref_map{
			sge::renderer::state::core::sampler::const_object_ref_map::value_type{
				sge::renderer::texture::stage{
					0u
				},
				fcppt::make_cref(
					*sampler_state_
				)
			}
		}
	};

	sge::renderer::vertex::scoped_buffer scoped_vb(
		_context,
		*vertex_buffer_);

	_context.render_nonindexed(
		sge::renderer::vertex::first(
			0u),
		sge::renderer::vertex::count(
			36u),
		sge::renderer::primitive_type::triangle_list);
}