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


C++ Degrees函数代码示例

本文整理汇总了C++中Degrees函数的典型用法代码示例。如果您正苦于以下问题:C++ Degrees函数的具体用法?C++ Degrees怎么用?C++ Degrees使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		auto lightAzimuth = FullCircles(time * -0.5);
		light_pos.Set(
			Vec3f(
				Cos(lightAzimuth),
				1.0f,
				Sin(lightAzimuth)
			) * 2.0f
		);
		//
		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				3.0f,
				Degrees(-45),
				Degrees(SineWave(time / 30.0) * 70)
			)
		);

		// set the model matrix
		model_matrix.Set(
			ModelMatrixf::RotationY(FullCircles(time * 0.05))
		);

		cube.Bind();
		gl.CullFace(Face::Back);
		cube_instr.Draw(cube_indices);
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:31,代码来源:021_wooden_crate.cpp

示例2: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();

		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				4.0,
				Degrees(time * 25),
				Degrees(SineWave(time / 30.0) * 90)
			)
		);

		model_matrix.Set(
			ModelMatrixf::RotationA(
				Vec3f(1.0f, 1.0f, 1.0f),
				FullCircles(time * 0.5)
			)
		);

		shape.Draw();

		thread_ready.Signal();
		parent_ready.Wait();
	}
开发者ID:xubingyue,项目名称:oglplus,代码行数:25,代码来源:025_rendered_texture_mt.cpp

示例3: Render

    void Render(double time)
    {
        gl.Clear().ColorBuffer().DepthBuffer();
        //
        auto camera = CamMatrixf::Orbiting(
                          Vec3f(),
                          4.5,
                          Degrees(time * 35),
                          Degrees(SineWave(time / 30.0) * 60)
                      );

        auto model =
            ModelMatrixf::RotationY(FullCircles(time * 0.25)) *
            ModelMatrixf::RotationX(FullCircles(time * 0.33));

        camera_matrix.Set(camera);
        model_matrix.Set(model);
        transf_time.Set(time);

        face_pp.Bind();
        gl.PolygonMode(PolygonMode::Fill);
        torus_instr.Draw(torus_indices);

        frame_pp.Bind();
        gl.PolygonMode(PolygonMode::Line);
        torus_instr.Draw(torus_indices);
    }
开发者ID:GLDRorg,项目名称:oglplus,代码行数:27,代码来源:024_extruded_torus.cpp

示例4: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		// set the matrix for camera orbiting the origin
		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				4.5,
				Degrees(time * 35),
				Degrees(SineWave(time / 20.0) * 60)
			)
		);
		// set the model matrix
		model_matrix.Set(
			ModelMatrixf::RotationX(FullCircles(time * 0.25))
		);

		torus.Bind();
		gl.PolygonMode(PolygonMode::Line);
		gl.CullFace(Face::Front);
		torus_instr.Draw(torus_indices);
		//
		gl.PolygonMode(PolygonMode::Fill);
		gl.CullFace(Face::Back);
		torus_instr.Draw(torus_indices);
	}
开发者ID:detunized,项目名称:oglplus,代码行数:27,代码来源:016_noise_torus.cpp

示例5: Draw

	double Draw(double time)
	{
		assert(!shapes.empty());
		assert(ishape != shapes.end());
		shapes::ShapeWrapper& shape = *ishape;


		const double interval = 11.0;
		double segment = time - shape_time;
		double fade = segment*(interval-segment);
		fade -= 1.0;
		if(fade < 0.0) fade = 0.0;
		fade = std::sqrt(fade/interval);
		if(fade > 1.0) fade = 1.0;

		if(segment > interval)
		{
			if(++ishape == shapes.end())
			{
				ishape = shapes.begin();
			}
			shape_time = time;
		}

		gl.Clear().DepthBuffer();

		float dist = (1.0+SineWave(time / 13.0))*2.5;

		projection_matrix.Set(
			CamMatrixf::PerspectiveX(
				Degrees(45),
				1.0,
				1.0+dist,
				shape.BoundingSphere().Radius()*2.0+1.0+dist
			)
		);

		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				shape.BoundingSphere().Radius()+1.5+dist,
				FullCircles(time / 27.0),
				Degrees(SineWave(time / 23.0) * 89)
			)
		);
		model_matrix.Set(
			ModelMatrixf::RotationA(
				Vec3f(1,1,1),
				FullCircles(time /-37.0)
			)
		);

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

		return fade;
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:58,代码来源:030_pin_display.cpp

示例6: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer().StencilBuffer();
		// make the camera matrix orbiting around the origin
		// at radius of 3.5 with elevation between 15 and 90 degrees
		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				5.0,
				Degrees(time * 11),
				Degrees(15 + (-SineWave(0.25+time/12.5)+1.0)*0.5*75)
			)
		);
		ModelMatrixf identity;
		// make the model transformation matrix
		ModelMatrixf model =
			ModelMatrixf::Translation(0.0f, 1.5f, 0.0) *
			ModelMatrixf::RotationZ(Degrees(time * 43))*
			ModelMatrixf::RotationY(Degrees(time * 63))*
			ModelMatrixf::RotationX(Degrees(time * 79));
		// make the reflection matrix
		auto reflection = ModelMatrixf::Reflection(false, true, false);
		//
		gl.Disable(Capability::Blend);
		gl.Disable(Capability::DepthTest);
		gl.Enable(Capability::StencilTest);
		gl.ColorMask(false, false, false, false);
		gl.StencilFunc(CompareFunction::Always, 1, 1);
		gl.StencilOp(StencilOp::Keep, StencilOp::Keep, StencilOp::Replace);

		gl.Bind(plane);
		model_matrix.Set(identity);
		gl.DrawArrays(PrimitiveType::TriangleStrip, 0, 4);

		gl.ColorMask(true, true, true, true);
		gl.Enable(Capability::DepthTest);
		gl.StencilFunc(CompareFunction::Equal, 1, 1);
		gl.StencilOp(StencilOp::Keep, StencilOp::Keep, StencilOp::Keep);

		// draw the cube using the reflection program
		model_matrix.Set(reflection * model);
		gl.Bind(cube);
		cube_instr.Draw(cube_indices);

		gl.Disable(Capability::StencilTest);

		// draw the cube using the normal object program
		model_matrix.Set(model);
		cube_instr.Draw(cube_indices);

		// blend-in the plane
		gl.Enable(Capability::Blend);
		gl.BlendEquation(BlendEquation::Max);
		gl.Bind(plane);
		model_matrix.Set(identity);
		gl.DrawArrays(PrimitiveType::TriangleStrip, 0, 4);
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:57,代码来源:023_reflected_cube.cpp

示例7: Render

	void Render(double time)
	{
		auto camera =
			CamMatrixf::Roll(Degrees(SineWave(time / 11.0)*7+SineWave(time/13.0)*5))*
			CamMatrixf::Orbiting(
				Vec3f(),
				40.0f,
				Degrees(SineWave(time / 11.0)*10+CosineWave(time/19.0)*10-90),
				Degrees(SineWave(time / 17.0)*10+SineWave(time/13.0)*10)
			);

		auto mm_identity = ModelMatrixf();
		auto mm_rotation = ModelMatrixf::RotationZ(FullCircles(time / 7.0));

		Uniform<Mat4f>* model_matrix = nullptr;

		GLuint drawing_fan = fan_index;
		auto drawing_driver =
			[
				&model_matrix,
				&mm_identity,
				&mm_rotation,
				&drawing_fan
			](GLuint phase) -> bool
			{
				if(phase == drawing_fan)
					model_matrix->Set(mm_rotation);
				else model_matrix->Set(mm_identity);
				return true;
			};

		// render the light mask
		light_fbo.Bind(Framebuffer::Target::Draw);

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

		mask_vao.Bind();
		mask_prog.Use();
		mask_prog.camera_matrix.Set(camera);
		model_matrix = &mask_prog.model_matrix;

		meshes.Draw(drawing_driver);

		// render the final image
		DefaultFramebuffer().Bind(Framebuffer::Target::Draw);

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

		draw_vao.Bind();
		draw_prog.Use();
		Vec4f lsp = projection * camera * Vec4f(light_position, 1.0);
		draw_prog.light_screen_pos = lsp.xyz()/lsp.w();
		draw_prog.camera_matrix.Set(camera);
		model_matrix = &draw_prog.model_matrix;

		meshes.Draw(drawing_driver);
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:57,代码来源:030_light_rays.cpp

示例8: printGeo

void printGeo(PredicThirteen::geodetic_t *geo){
    Serial.print("lat: ");
    Serial.println(Degrees(geo->lat));
    Serial.print("lon: ");
    Serial.println(Degrees(geo->lon));
    Serial.print("alt: ");
    Serial.println(geo->alt);
    Serial.print("theta: ");
    Serial.println(geo->theta);
}
开发者ID:BackupGGCode,项目名称:qrptracker,代码行数:10,代码来源:PredicThirteen.cpp

示例9: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();

		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				GLfloat(30.0 - SineWave(time / 17.0)*25.0),
				Degrees(time * 47),
				Degrees(SineWave(time / 31.0) * 90)
			)
		);

		gl.DrawArrays(PrimitiveType::Patches, 0, 16);
	}
开发者ID:xubingyue,项目名称:oglplus,代码行数:15,代码来源:019_bpatch_tess.cpp

示例10: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();

		int period = int(time * 0.125);
		if(prev_period < period)
		{
			if(period % 2)
				gl.PolygonMode(PolygonMode::Line);
			else gl.PolygonMode(PolygonMode::Fill);
			prev_period = period;
		}

		auto camera = CamMatrixf::Orbiting(
			Vec3f(0.0f, 2.0f, 0.0f),
			17.0f - CosineWave(time / 31.0f) * 10.0f,
			FullCircles(time / 43.0f),
			Degrees(45 - SineWave(time / 29.0f) * 35)
		);
		camera_matrix.Set(camera);
		camera_position.Set(camera.Position());

		anim_time.Set(time);

		plane_instr.Draw(plane_indices);
	}
开发者ID:detunized,项目名称:oglplus,代码行数:26,代码来源:023_waves.cpp

示例11: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		// set the matrix for camera orbiting the origin
		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				4.5 - SineWave(time / 16.0) * 2.0,
				FullCircles(time / 12.0),
				Degrees(SineWave(time / 30.0) * 90)
			)
		);

		// set the model matrix
		model_matrix.Set(
			ModelMatrixf::RotationA(
				Vec3f(1.0f, 1.0f, 1.0f),
				FullCircles(time / 10.0)
			)
		);

		shape.Bind();
		shape_instr.Draw(shape_indices);
	}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:25,代码来源:020_icosphere.cpp

示例12: Reshape

    void Reshape(GLuint vp_width, GLuint vp_height) {
        width = vp_width;
        height = vp_height;

        float aspect = float(width) / height;

        auto projection = CamMatrixf::PerspectiveX(Degrees(60), aspect, 1, 20);

        plane_projection_matrix.Set(projection);
        shape_projection_matrix.Set(projection);

        gl.Bound(Texture::Target::Rectangle, depth_tex)
          .Image2D(
            0,
            PixelDataInternalFormat::DepthComponent,
            width / tex_size_div,
            height / tex_size_div,
            0,
            PixelDataFormat::DepthComponent,
            PixelDataType::Float,
            nullptr);
        gl.Bound(Texture::Target::Rectangle, reflect_tex)
          .Image2D(
            0,
            PixelDataInternalFormat::RGB,
            width / tex_size_div,
            height / tex_size_div,
            0,
            PixelDataFormat::RGB,
            PixelDataType::UnsignedByte,
            nullptr);
    }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:32,代码来源:027_reflected_shape.cpp

示例13: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		// set the matrix for camera orbiting the origin
		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				4.0 - SineWave(time / 6.0) * 2.0,
				FullCircles(time * 0.4),
				Degrees(SineWave(time / 30.0) * 90)
			)
		);

		// set the model matrix
		model_matrix.Set(
			ModelMatrixf::RotationZ(FullCircles(time * 0.1))
		);

		cube.Bind();
		gl.CullFace(Face::Front);
		cube_instr.Draw(cube_indices);
		gl.CullFace(Face::Back);
		cube_instr.Draw(cube_indices);
	}
开发者ID:xdray,项目名称:oglplus,代码行数:25,代码来源:019_honeycomb_cube.cpp

示例14: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		liquid_prog.time = time;


		auto camera = CamMatrixf::Orbiting(
			Vec3f(0, 0, 0),
			4.5 - SineWave(time / 14.0),
			FullCircles(time / 26.0),
			Degrees(55 + SineWave(time / 14.0) * 30)
		);
		Vec3f camera_position = camera.Position();

		liquid_prog.camera_position = camera_position;
		liquid_prog.camera_matrix = perspective*camera;

		for(int z=-grid_repeat; z!=grid_repeat; ++z)
		for(int x=-grid_repeat; x!=grid_repeat; ++x)
		{
			liquid_prog.grid_offset.Set(x, -0.5, z);
			grid.Draw();
		}

	}
开发者ID:JanChou,项目名称:oglplus,代码行数:26,代码来源:028_ripples.cpp

示例15: Render

	void Render(double time)
	{
		const Vec3f light_position(16.0, 10.0, 9.0);
		const Vec3f torus_center(0.0, 1.5, 0.0);

		const Mat4f torus_matrix =
			ModelMatrixf::Translation(torus_center) *
			ModelMatrixf::RotationZ(FullCircles(time / 16.0));

		const Mat4f light_proj_matrix =
			CamMatrixf::PerspectiveX(Degrees(10), 1.0, 1, 80) *
			CamMatrixf::LookingAt(light_position, torus_center);

		transf_prog.light_position.Set(light_position);

		RenderFrameShadowMap(
			light_position,
			torus_matrix,
			light_proj_matrix
		);
		RenderGlassShadowMap(
			light_position,
			torus_center,
			torus_matrix,
			light_proj_matrix
		);
		RenderImage(
			time,
			torus_center,
			torus_matrix,
			light_proj_matrix
		);
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:33,代码来源:033_metal_and_glass.cpp


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