• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ shapes::ShapeWrapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了ShapeWrapper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: gl

	LightRayExample(void)
	 : gl()
	 , mesh_loader(
		mesh_input.stream,
		shapes::ObjMesh::LoadingOptions(false).Normals()
	), meshes(List("Position")("Normal").Get(), mesh_loader)
	 , fan_index(mesh_loader.GetMeshIndex("Fan"))
	 , light_position(0.0, 0.0, -100.0)
	 , vert_shader()
	 , mask_prog(vert_shader)
	 , mask_vao(meshes.VAOForProgram(mask_prog))
	 , draw_prog(vert_shader)
	 , draw_vao(meshes.VAOForProgram(draw_prog))
	 , shadow_tex_unit(0)
	 , light_tex_unit(1)
	{
		mesh_input.stream.close();

		gl.ClearDepth(1.0f);
		gl.Enable(Capability::DepthTest);

		RenderShadowMap(512);

		SetupLightMask();

		mask_prog.Use();
		mask_prog.light_position.Set(light_position);

		draw_prog.Use();
		draw_prog.light_position.Set(light_position);

		gl.ClearColor(1.0f, 1.0f, 1.0f, 0.0f);
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:33,代码来源:030_light_rays.cpp


示例3: 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


示例4: 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


示例5: 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


示例6: 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:BrainlessLabsInc,项目名称:oglplus,代码行数:25,代码来源:025_rendered_texture_mt.cpp


示例7: gl

	ObjMeshExample(void)
	 : gl()
	 , objects(load_objects())
	 , depth_prog()
	 , draw_prog()
	 , depth_vao(objects.VAOForProgram(depth_prog))
	 , draw_vao(objects.VAOForProgram(draw_prog))
	{
		UniformSampler(draw_prog, "DepthTex").Set(0);
		Texture::Active(0);
		depth_tex.Bind(Texture::Target::Rectangle);

		gl.ClearColor(0.8f, 0.8f, 0.7f, 0.0f);
		gl.Enable(Capability::DepthTest);
		gl.Enable(Capability::CullFace);
	}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:16,代码来源:021_translucent_arrow.cpp


示例8: Draw

	void Draw(double time, double fade)
	{
		// Shadow map
		shadows_fbo.Bind(FramebufferTarget::Draw);
		gl.Viewport(shadow_size, shadow_size);
		gl.Clear().DepthBuffer();

		auto light = CamMatrixf::Orbiting(
			Vec3f(0, side*0.25, 0),
			side*1.5,
			Degrees(-time * 27),
			Degrees(SineWave(time / 19.0)*25  + 45)
		);

		shadow_prog.fade.Set(fade);
		shadow_prog.camera_matrix.Set(light);

		shadow_prog.Use();
		shadow_vao.Bind();
		gl.Enable(Capability::PolygonOffsetFill);
		cube.Draw(side*side);
		gl.Disable(Capability::PolygonOffsetFill);
		gl.Finish();

		// On-screen
		default_fb.Bind(Framebuffer::Target::Draw);
		gl.Viewport(width, height);
		gl.Clear().ColorBuffer().DepthBuffer();

		auto camera = CamMatrixf::Orbiting(
			Vec3f(),
			side*1.1,
			Degrees(time * 19),
			Degrees(SineWave(time / 20.0) * 39 + 50)
		);

		display_prog.fade.Set(fade);
		display_prog.light_pos.Set(light.Position());
		display_prog.camera_pos.Set(camera.Position());
		display_prog.light_matrix.Set(light);
		display_prog.camera_matrix.Set(camera);

		display_prog.Use();
		display_vao.Bind();
		cube.Draw(side*side);
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:46,代码来源:030_pin_display.cpp


示例9: Render

	void Render(double time)
	{
		gl.ClearDepth(0.0f);
		gl.Clear().DepthBuffer();

		auto camera =
			CamMatrixf::Orbiting(
				objects.BoundingSphere().Center(),
				objects.BoundingSphere().Radius()*2.8,
				FullCircles(time / 19.0),
				Degrees(SineWave(time / 17.0) * 90)
			);



		depth_prog.Use();
		gl.DepthFunc(CompareFn::Greater);
		gl.CullFace(Face::Front);
		depth_prog.camera_matrix.Set(camera);
		depth_prog.model_matrix.Set(Mat4f());
		objects.Draw();

		Texture::CopyImage2D(
			Texture::Target::Rectangle,
			0,
			PixelDataInternalFormat::DepthComponent,
			0, 0,
			width,
			height,
			0
		);

		gl.ClearDepth(1.0f);
		gl.Clear().ColorBuffer().DepthBuffer();

		draw_prog.Use();
		gl.DepthFunc(CompareFn::Less);
		gl.CullFace(Face::Back);
		draw_prog.camera_matrix.Set(camera);
		draw_prog.model_matrix.Set(Mat4f());

		objects.Draw();
	}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:43,代码来源:021_translucent_arrow.cpp


示例10: ParallaxExample

    ParallaxExample()
      : prog(make_prog())
      , projection_matrix(prog, "ProjectionMatrix")
      , camera_matrix(prog, "CameraMatrix")
      , camera_position(prog, "CameraPosition")
      , light_position(prog, "LightPosition")
      , shape(
          List("Position")("TexCoord").Get(),
          shapes::Plane(
            Vec3f(),
            Vec3f(1.0f, 0.0f, 0.0f),
            Vec3f(0.0f, 0.0f, -1.0f),
            32,
            32)) {
        shape.UseInProgram(prog);

        auto tex_image = images::LoadTexture("stones_color_hmap");

        Texture::Active(0);
        try {
            UniformSampler(prog, "ColorMap").Set(0);
            gl.Bound(Texture::Target::_2D, color_tex)
              .MinFilter(TextureMinFilter::LinearMipmapLinear)
              .MagFilter(TextureMagFilter::Linear)
              .WrapS(TextureWrap::Repeat)
              .WrapT(TextureWrap::Repeat)
              .Image2D(tex_image)
              .GenerateMipmap();
        } catch(Error&) {
        }

        Texture::Active(1);
        try {
            UniformSampler(prog, "BumpMap").Set(1);
            gl.Bound(Texture::Target::_2D, bump_tex)
              .MinFilter(TextureMinFilter::LinearMipmapLinear)
              .MagFilter(TextureMagFilter::Linear)
              .WrapS(TextureWrap::Repeat)
              .WrapT(TextureWrap::Repeat)
              .Image2D(
                images::NormalMap(tex_image, images::NormalMap::FromAlpha()))
              .GenerateMipmap();
        } catch(Error&) {
        }

        gl.ClearColor(0.1f, 0.1f, 0.1f, 0.0f);
        gl.ClearDepth(1.0f);

        (Capability::DepthTest) << true;
        (Capability::CullFace) << false;

        (Functionality::ClipDistance | 0) << true;
        (Functionality::ClipDistance | 1) << true;
        (Functionality::ClipDistance | 2) << true;
    }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:55,代码来源:029_muddy_stones.cpp


示例11: Render

	void Render(double time)
	{
		float o = 2;
		float s = 24;
		prog.offset.Set(
			GLfloat(CosineWave(time/59.0)*o),
			GLfloat(SineWave(time/61.0)*o)
		);
		prog.scale.Set(GLfloat(s + 1 + SineWave(time / 19.0)*s));

		screen.Draw();
	}
开发者ID:xubingyue,项目名称:oglplus,代码行数:12,代码来源:007_voronoi.cpp


示例12: gl

	BarDisplay(void)
	 : gl()
	 , side(128)
	 , shadow_size(512)
	 , cube(
		List("Position")("Normal").Get(),
		shapes::Cube(0.95, 1.0, 0.95, 0.0, 0.5, 0.0)
	), display_vao(cube.VAOForProgram(display_prog))
	 , shadow_vao(cube.VAOForProgram(shadow_prog))
	{
		init_shadows();
		init_heights();
		init_offsets();

		auto light_proj = CamMatrixf::PerspectiveX(
			Degrees(74),
			1.0,
			1, 3*side
		);
		display_prog.light_proj_matrix.Set(light_proj);
		shadow_prog.projection_matrix.Set(light_proj);
		gl.PolygonOffset(4.0, 4.0);
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:23,代码来源:030_pin_display.cpp


示例13: ParallaxMapExample

    ParallaxMapExample()
      : prog(make())
      , projection_matrix(prog, "ProjectionMatrix")
      , camera_matrix(prog, "CameraMatrix")
      , model_matrix(prog, "ModelMatrix")
      , camera_position(prog, "CameraPosition")
      , light_position(prog, "LightPosition")
      , shape(
          List("Position")("Normal")("Tangent")("TexCoord").Get(),
          shapes::Torus(1.0f, 0.5, 72, 48)) {
        shape.UseInProgram(prog);

        auto tex_image = images::LoadTexture("bricks_color_hmap");

        Texture::Active(0);
        try {
            UniformSampler(prog, "ColorMap").Set(0);
            gl.Bound(Texture::Target::_2D, color_tex)
              .MinFilter(TextureMinFilter::LinearMipmapLinear)
              .MagFilter(TextureMagFilter::Linear)
              .WrapS(TextureWrap::Repeat)
              .WrapT(TextureWrap::Repeat)
              .Image2D(tex_image)
              .GenerateMipmap();
        } catch(Error&) {
        }

        Texture::Active(1);
        try {
            UniformSampler(prog, "BumpMap").Set(1);
            gl.Bound(Texture::Target::_2D, bump_tex)
              .MinFilter(TextureMinFilter::LinearMipmapLinear)
              .MagFilter(TextureMagFilter::Linear)
              .WrapS(TextureWrap::Repeat)
              .WrapT(TextureWrap::Repeat)
              .Image2D(
                images::NormalMap(tex_image, images::NormalMap::FromAlpha()))
              .GenerateMipmap();
        } catch(Error&) {
        }

        gl.ClearColor(0.1f, 0.1f, 0.1f, 0.0f);
        gl.ClearDepth(1.0f);
        gl.Enable(Capability::DepthTest);
        gl.Disable(Capability::CullFace);

        gl.Enable(Functionality::ClipDistance, 0);
        gl.Enable(Functionality::ClipDistance, 1);
        gl.Enable(Functionality::ClipDistance, 2);
    }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:50,代码来源:031_brick_torus.cpp


示例14: Render

    void Render(ExampleClock& clock) {
        gl.Clear().ColorBuffer().DepthBuffer();

        double time = clock.Now().Seconds();

        auto langle = FullCircles(time / 23.0);
        light_position.Set(
          GLfloat(Cos(langle) * 20.0),
          GLfloat((1.2 + Sin(langle)) * 15.0),
          GLfloat(Sin(langle) * 20.0));

        double x = SineWave(time / 13.0);
        if(x + 0.93 < 0.0)
            clock.Pace(0.2);
        else
            clock.Pace(1.0);

        auto camera = CamMatrixf::Orbiting(
          Vec3f(),
          GLfloat(9.5 + x * 5.1),
          FullCircles(time / 17.0),
          Degrees(SineWave(time / 20.0) * 89));

        camera_matrix.Set(camera);
        camera_position.Set(camera.Position());

        model_matrix.Set(
          ModelMatrixf::TranslationX(+2.0f) *
          ModelMatrixf::RotationX(FullCircles(time / 13.0)));
        shape.Draw();

        model_matrix.Set(
          ModelMatrixf::TranslationX(-2.0f) *
          ModelMatrixf::RotationZ(FullCircles(time / 11.0)));
        shape.Draw();
    }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:36,代码来源:031_brick_torus.cpp


示例15: 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


示例16: 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


示例17: Render

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

        auto camera = CamMatrixf::Orbiting(
          Vec3f(),
          2.9f,
          FullCircles(time / 17.0),
          Degrees(45 + SineWave(time / 20.0) * 40));

        camera_matrix.Set(camera);
        camera_position.Set(camera.Position());

        auto langle = FullCircles(time / 31.0);
        light_position.Set(
          GLfloat(Cos(langle) * 20.0f),
          GLfloat((1.2 + Sin(langle)) * 15.0f),
          GLfloat(Sin(langle) * 20.0f));

        shape.Draw();
    }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:20,代码来源:029_muddy_stones.cpp


示例18: Render

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

		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				3.0,
				Degrees(time * 35),
				Degrees(SineWave(time / 20.0) * 60)
			)
		);

		model_matrix.Set(ModelMatrixf::RotationX(FullCircles(time * 0.25)));

		assert(thread_ready);
		thread_ready->Wait();

		cube.Draw();

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


示例19: 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


示例20: SkyBoxExample

    SkyBoxExample()
      : sky_box(List("Position").Get(), shapes::SkyBox())
      , shape(List("Position")("Normal").Get(), shapes::WickerTorus())
      , sky_box_prog()
      , sky_box_projection_matrix(sky_box_prog, "ProjectionMatrix")
      , sky_box_camera_matrix(sky_box_prog, "CameraMatrix")
      , shape_projection_matrix(shape_prog, "ProjectionMatrix")
      , shape_camera_matrix(shape_prog, "CameraMatrix")
      , shape_model_matrix(shape_prog, "ModelMatrix")
      , sky_box_sun_position(sky_box_prog, "SunPosition")
      , shape_sun_position(shape_prog, "SunPosition")
      , shape_camera_position(shape_prog, "CameraPosition") {
        VertexShader sky_box_vs;
        sky_box_vs.Source(
          "#version 140\n"
          "uniform mat4 ProjectionMatrix, CameraMatrix;"
          "mat4 Matrix = ProjectionMatrix*CameraMatrix;"

          "in vec3 Position;"
          "out vec3 vertTexCoord;"
          "void main()"
          "{"
          "	gl_Position = Matrix * vec4(Position * 100.0, 1.0);"
          "	vertTexCoord = Position;"
          "}");
        sky_box_vs.Compile();
        sky_box_prog.AttachShader(sky_box_vs);

        VertexShader shape_vs;
        shape_vs.Source(
          "#version 140\n"

          "uniform vec3 SunPosition;"
          "uniform vec3 CameraPosition;"
          "uniform mat4  ProjectionMatrix,CameraMatrix,ModelMatrix;"

          "in vec4 Position;"
          "in vec3 Normal;"

          "out vec3 vertNormal, vertViewRefl, vertLightDir;"

          "void main()"
          "{"
          "	gl_Position = ModelMatrix * Position;"
          "	vertNormal = mat3(ModelMatrix)*Normal;"
          "	vertViewRefl = reflect("
          "		gl_Position.xyz - CameraPosition,"
          "		vertNormal"
          "	);"
          "	vertLightDir = SunPosition - gl_Position.xyz;"
          "	gl_Position = ProjectionMatrix*CameraMatrix*gl_Position;"
          "}");
        shape_vs.Compile();
        shape_prog.AttachShader(shape_vs);

        FragmentShader sky_box_fs;
        sky_box_fs.Source(
          "#version 140\n"

          "in vec3 vertTexCoord;"

          "out vec3 fragColor;"

          "vec3 sky_color(vec3 vd);"

          "void main()"
          "{"
          "	fragColor = sky_color(normalize(vertTexCoord));"
          "}");
        sky_box_fs.Compile();
        sky_box_prog.AttachShader(sky_box_fs);

        FragmentShader shape_fs;
        shape_fs.Source(
          "#version 140\n"

          "in vec3 vertNormal, vertViewRefl, vertLightDir;"

          "out vec3 fragColor;"

          "vec3 sky_color(vec3 vd);"

          "void main()"
          "{"
          "	float l = max(dot(normalize(vertNormal), "
          "normalize(vertLightDir))+0.1, 0.0);"
          "	float a = 0.1;"
          "	fragColor = "
          "		0.1*vec3(1.0, 1.0, 1.0)*(a+l)+"
          "		0.9*sky_color(normalize(vertViewRefl));"
          "}");
        shape_fs.Compile();
        shape_prog.AttachShader(shape_fs);

        FragmentShader sky_fs;
        sky_fs.Source(
          "#version 140\n"

          "const float WorldRadius = 6371000;"
          "const float AtmThickness = 50000;"
//.........这里部分代码省略.........
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:101,代码来源:023_sky.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ shareablebitmap::Handle类代码示例发布时间:2022-05-31
下一篇:
C++ shapes::Cube类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap