当前位置: 首页>>代码示例>>C++>>正文


C++ ShapeWrapper::Use方法代码示例

本文整理汇总了C++中shapes::ShapeWrapper::Use方法的典型用法代码示例。如果您正苦于以下问题:C++ ShapeWrapper::Use方法的具体用法?C++ ShapeWrapper::Use怎么用?C++ ShapeWrapper::Use使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shapes::ShapeWrapper的用法示例。


在下文中一共展示了ShapeWrapper::Use方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Render

    void Render(double time) {
        const double day_duration = 67.0;
        auto sun =
          Vec3f(0.000, 1.000, 0.000) * 1e10 * SineWave(time / day_duration) +
          Vec3f(0.000, 0.000, -1.000) * 1e10 * CosineWave(time / day_duration);

        auto camera = CamMatrixf::Orbiting(
          Vec3f(),
          5.0,
          FullCircles(-0.10 - time / 27.0),
          Degrees(-20 - SineWave(time / 17.0) * 30));

        auto model = ModelMatrixf::RotationA(
          Vec3f(1.0, 1.0, 1.0), FullCircles(time / 13.0));

        gl.Clear().ColorBuffer().DepthBuffer();

        sky_box.Use();
        sky_box_prog.Use();
        sky_box_camera_matrix.Set(camera);
        sky_box_sun_position.Set(sun);
        sky_box.Draw();

        shape.Use();
        shape_prog.Use();
        shape_model_matrix.Set(model);
        shape_camera_matrix.Set(camera);
        shape_camera_position.Set(camera.Position());
        shape_sun_position.Set(sun);
        shape.Draw();
    }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:31,代码来源:023_sky.cpp

示例2: Update

	void Update(double time)
	{
		gl.Viewport(size, size);

		fbo.Bind(Framebuffer::Target::Draw);
		Framebuffer::AttachColorTexture(
			Framebuffer::Target::Draw,
			1,
			holder.CurrentHeightMap(),
			0
		);
		Context::ColorBuffer draw_buffs[2] = {
			FramebufferColorAttachment::_0,
			FramebufferColorAttachment::_1
		};
		gl.DrawBuffers(draw_buffs);

		prog.Use();
		prog.hmap_1.Set(holder.HMapUnit1());
		prog.hmap_2.Set(holder.HMapUnit2());
		prog.time.Set(time);

		screen.Use();

		gl.Disable(Capability::DepthTest);
		screen.Draw();
		gl.Enable(Capability::DepthTest);

		holder.Swap();
	}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:30,代码来源:027_flow.cpp

示例3: Render

	void Render(double time)
	{
		flow.Update(time);

		Framebuffer::BindDefault(Framebuffer::Target::Draw);
		gl.DrawBuffer(ColorBuffer::BackLeft);
		gl.Viewport(width, height);
		gl.Clear().ColorBuffer().DepthBuffer();

		screen_prog.Use();
		screen.Use();
		screen.Draw();
	}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:13,代码来源:027_flow.cpp

示例4: Use

	void Use(void)
	{
		gl.ClearDepth(1.0f);
		gl.ClearColor(0.8f, 0.8f, 0.8f, 0.0f);

		gl.Enable(Capability::DepthTest);
		gl.Enable(Capability::CullFace);
		gl.CullFace(Face::Back);

		dfb.Bind(Framebuffer::Target::Draw);
		gl.Viewport(width, height);

		prog.Use();
		cube.Use();

		SetProjection();
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:17,代码来源:026_nv_path_rendering.cpp

示例5: Use

	void Use(void)
	{
		gl.ClearDepth(1.0f);
		gl.ClearColor(0.9f, 0.4f, 0.4f, 1.0f);

		gl.Enable(Capability::DepthTest);
		gl.Enable(Capability::CullFace);
		gl.CullFace(Face::Back);

		fbo.Bind(Framebuffer::Target::Draw);
		gl.Viewport(tex_side, tex_side);

		prog.Use();
		shape.Use();

		projection_matrix.Set(CamMatrixf::PerspectiveX(Degrees(48), 1.0, 1, 100));
	}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:17,代码来源:025_rendered_texture_mt.cpp

示例6: Render

	void Render(double time)
	{
		GLfloat bs_rad = shape.BoundingSphere().Radius()*1.2f;

		auto light =
			CamMatrixf::Orbiting(
				shape.BoundingSphere().Center(),
				shape.BoundingSphere().Radius()*10.0f,
				FullCircles(time / 23.0),
				Degrees(-CosineWave(time / 31.0) * 80)
			);

		auto camera =
			CamMatrixf::Orbiting(
				shape.BoundingSphere().Center(),
				shape.BoundingSphere().Radius()*
				GLfloat(3.2+SineWave(time / 23.0)*0.8),
				FullCircles(time / 19.0),
				Degrees(SineWave(time / 21.0) * 80)
			);

		GLfloat cam_tgt_dist = Distance(
			shape.BoundingSphere().Center(),
			camera.Position()
		);

		auto cam_proj =
			CamMatrixf::PerspectiveX(
				Degrees(45),
				width, height,
				cam_tgt_dist-bs_rad,
				cam_tgt_dist+bs_rad
			);

		auto model =
			ModelMatrixf::RotationZ(Degrees(SineWave(time / 21.0)*25))*
			ModelMatrixf::Translation(0.0f,-bs_rad*0.25f, 0.0f);

		data_prog.Use();
		data_prog.camera_matrix.Set(cam_proj*camera);
		data_prog.model_matrix.Set(model);
		data_prog.camera_position.Set(camera.Position());
		data_prog.light_position.Set(light.Position());

		data_buffer.Bind();

		gl.Enable(Capability::DepthTest);
		gl.Clear().ColorBuffer().DepthBuffer();

		shape.Use();
		shape.Draw();

		draw_prog.Use();
		draw_prog.slider.Set(GLfloat(CosineWave01(time / 11.0)*width));

		DefaultFramebuffer().Bind(Framebuffer::Target::Draw);

		gl.Disable(Capability::DepthTest);
		gl.Clear().ColorBuffer();

		screen.Use();
		screen.Draw();
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:63,代码来源:026_ssao.cpp

示例7: operator

	void operator()(void)
	{
		gl.Use(prog);
		mesh.Use();
		mesh.Draw();
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:6,代码来源:029_gpu_sort_tfb.cpp


注:本文中的shapes::ShapeWrapper::Use方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。