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

C++ ObjectDesc函数代码示例

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

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



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

示例1: make

	static Program make(void)
	{
		Program prog;

		prog << VertexShader(ObjectDesc("Mesh"),
			"#version 330\n"
			"uniform mat4 ProjectionMatrix, CameraMatrix, ModelMatrix;"
			"in vec4 Position;"

			"void main(void)"
			"{"
			"	gl_Position = "
			"		ProjectionMatrix*CameraMatrix*ModelMatrix*Position;"
			"}"
		);

		prog << FragmentShader(ObjectDesc("Mesh"),
			"#version 330\n"
			"out vec3 fragColor;"

			"void main(void)"
			"{"
			"	fragColor = vec3(0.1);"
			"}"
		);
		prog.Link();

		return prog;
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:29,代码来源:029_gpu_sort_tfb.cpp


示例2: make_prog

	static Program make_prog(FBTexExample& example)
	{
		Program prog(ObjectDesc("Thread"));

		prog.AttachShader(example.vertex_shader);

		FragmentShader fs(ObjectDesc("Thread fragment"));
		fs.Source(
			"#version 330\n"
			"in vec3 vertNormal;"
			"in vec3 vertLight;"
			"in vec2 vertTexCoord;"
			"out vec3 fragColor;"
			"void main(void)"
			"{"
			"	float d = max(dot("
			"		vertNormal, "
			"		normalize(vertLight)"
			"	), 0.0);"
			"	float i = int("
			"		vertTexCoord.x*18.0+"
			"		vertTexCoord.y*14.0 "
			"	) % 2;"
			"	vec3 Red =   vec3(1.0, 0.2, 0.2);"
			"	vec3 White = vec3(1.0, 1.0, 1.0);"
			"	fragColor = (0.4+0.8*d)*mix(Red, White, i);"
			"}"
		);
		fs.Compile();
		prog.AttachShader(fs);

		prog.Link().Use();

		return std::move(prog);
	}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:35,代码来源:025_rendered_texture_mt.cpp


示例3: ShapeVertShader

	ShapeVertShader(void)
	 : VertexShader(
		ObjectDesc("Shape vertex shader"),
		StrCRef("#version 330\n"

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

		"in vec4 Position;"
		"in vec3 Normal;"
		"in vec3 Tangent;"
		"in vec2 TexCoord;"

		"out vec3 vertPosition;"
		"out vec3 vertViewDir;"
		"out vec3 vertNormal;"
		"out vec3 vertTangent;"
		"out vec3 vertBitangent;"
		"out vec2 vertTexCoord;"
		"void main(void)"
		"{"
		"	gl_Position = ModelMatrix * Position;"
		"	vertPosition = gl_Position.xyz;"
		"	vertViewDir = CameraPosition - gl_Position.xyz;"
		"	vertNormal =  (ModelMatrix * vec4(Normal,  0.0)).xyz;"
		"	vertTangent =  (ModelMatrix * vec4(Tangent,  0.0)).xyz;"
		"	vertBitangent = cross(vertNormal, vertTangent);"
		"	vertTexCoord = mat2(0.0, 2.0, 1.0, 0.0) * TexCoord;"
		"	gl_Position = "
		"		ProjectionMatrix * "
		"		CameraMatrix * "
		"		gl_Position;"
		"}")
	)
	{ }
开发者ID:xubingyue,项目名称:oglplus,代码行数:35,代码来源:029_flares.cpp


示例4: make

 static Program make() {
     Program prog(ObjectDesc("Shape program"));
     prog.AttachShader(ShapeVertShader());
     prog.AttachShader(ShapeFragShader());
     prog.Link().Use();
     return prog;
 }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:7,代码来源:029_flares.cpp


示例5: make

	static Program make(void)
	{
		Program prog(ObjectDesc("Sketch"));
		prog.AttachShader(SketchFragShader());
		prog.MakeSeparable().Link().Use();
		return prog;
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:7,代码来源:031_sketch.cpp


示例6: PointVertShader

    PointVertShader()
      : VertexShader(
          ObjectDesc("Vertex shader"),
          "#version 140\n"
          "uniform mat4 ProjectionMatrix, CameraMatrix, ModelMatrix;"
          "uniform vec3 Color1, Color2;"
          "uniform float Status;"

          "in vec4 Position1, Position2;"
          "in float Radiance1, Radiance2;"

          "out vec3 vertColor;"

          "void main()"
          "{"
          "	gl_Position = "
          "		ProjectionMatrix * "
          "		CameraMatrix * "
          "		ModelMatrix * "
          "		mix(Position1, Position2, Status);"
          "	gl_PointSize = (2.0 + 3.0 * mix("
          "		Radiance1, "
          "		Radiance2, "
          "		Status"
          "	));"
          "	vertColor = mix("
          "		(0.2 + Radiance1) * Color1,"
          "		(0.2 + Radiance2) * Color2,"
          "		Status"
          "	);"
          "}") {}
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:31,代码来源:021_morphing.cpp


示例7: CubeVertShader

	CubeVertShader(void)
	 : VertexShader(
		ObjectDesc("Cube vertex"),
		"#version 400\n"
		"uniform vec3 LightPosition;"
		"uniform vec3 CameraPosition;"
		"uniform mat4 ProjectionMatrix, CameraMatrix, ModelMatrix;"

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

		"out vec3 vertNormal;"
		"out vec3 vertLightDir;"
		"out vec3 vertLightRefl;"
		"out vec3 vertViewDir;"
		"out vec2 vertTexCoord;"
		"void main(void)"
		"{"
		"	gl_Position = ModelMatrix* Position;"
		"	vertNormal = mat3(ModelMatrix)*Normal;"
		"	vertLightDir = normalize(LightPosition - gl_Position.xyz);"
		"	vertLightRefl = reflect(-vertLightDir, vertNormal);"
		"	vertViewDir = normalize(CameraPosition - gl_Position.xyz);"
		"	gl_Position = ProjectionMatrix * CameraMatrix * gl_Position;"
		"	vertTexCoord = TexCoord.xy;"
		"}"
	)
	{ }
开发者ID:Extrunder,项目名称:oglplus,代码行数:29,代码来源:025_subroutines.cpp


示例8: make

	static Program make(void)
	{
		Program prog(ObjectDesc("Metal"));
		prog.AttachShader(MetalFragmentShader());
		prog.MakeSeparable().Link().Use();
		return prog;
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:7,代码来源:033_metal_and_glass.cpp


示例9: make

 static Program make() {
     Program prog(ObjectDesc("Point program"));
     prog.AttachShader(PointVertShader());
     prog.AttachShader(PointFragShader());
     prog.Link().Use();
     return prog;
 }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:7,代码来源:021_morphing.cpp


示例10: make

 static Program make() {
     Program prog(ObjectDesc("Metal program"));
     prog.AttachShader(MetalVertShader());
     prog.AttachShader(MetalFragShader());
     prog.Link().Use();
     return prog;
 }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:7,代码来源:031_blob.cpp


示例11: make_prog

	Program make_prog(void)
	{
		Program result(ObjectDesc("Main"));

		vertex_shader.Source(
			"#version 330\n"
			"uniform mat4 ProjectionMatrix, CameraMatrix, ModelMatrix;"
			"in vec4 Position;"
			"in vec3 Normal;"
			"in vec2 TexCoord;"
			"out vec3 vertNormal;"
			"out vec3 vertLight;"
			"out vec2 vertTexCoord;"
			"uniform vec3 LightPos;"
			"void main(void)"
			"{"
			"	vertNormal = mat3(ModelMatrix)*Normal;"
			"	gl_Position = ModelMatrix * Position;"
			"	vertLight = LightPos-gl_Position.xyz;"
			"	vertTexCoord = TexCoord;"
			"	gl_Position = ProjectionMatrix * CameraMatrix * gl_Position;"
			"}"
		).Compile();
		result.AttachShader(vertex_shader);

		FragmentShader fs(ObjectDesc("Main fragment"));
		fs.Source(
			"#version 330\n"
			"uniform sampler2D TexUnit;"
			"in vec3 vertNormal;"
			"in vec3 vertLight;"
			"in vec2 vertTexCoord;"
			"out vec4 fragColor;"
			"void main(void)"
			"{"
			"	float d = dot(vertNormal, normalize(vertLight));"
			"	float i = 0.6 + max(d, 0.0);"
			"	fragColor = texture(TexUnit, vertTexCoord)*i;"
			"}"
		);
		fs.Compile();
		result.AttachShader(fs);

		result.Link().Use();

		return std::move(result);
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:47,代码来源:026_nv_path_rendering.cpp


示例12: make

	static Program make(const VertexShader& vs)
	{
		Program prog;

		FragmentShader fs(ObjectDesc("Draw"));
		fs.Source(
			"#version 140\n"
			"const vec3 LightColor = vec3(0.6, 0.6, 1.0);"
			"const vec3 Up = normalize(vec3(0.1, 1.0, 0.1));"

			"uniform vec3 LightScreenPos;"
			"uniform vec2 ScreenSize;"
			"uniform sampler2DRect LightMap;"
			"uniform sampler2DShadow ShadowMap;"

			"in vec3 vertNormal;"
			"in vec3 vertLightDir;"
			"in vec4 vertShadowCoord;"

			"out vec3 fragColor;"

			"void main(void)"
			"{"
			"	vec3 ShadowCoord = (vertShadowCoord.xyz/vertShadowCoord.w)*0.5 + 0.5;"
			"	float s = 0.0f;"
			"	if("
			"		ShadowCoord.x >= 0.0 && "
			"		ShadowCoord.x <= 1.0 && "
			"		ShadowCoord.y >= 0.0 && "
			"		ShadowCoord.y <= 1.0 && "
			"		ShadowCoord.z <= 1.0"
			"	) s = texture(ShadowMap, ShadowCoord);"
			"	float a = 0.1*(max(dot(vertNormal, Up)+0.1, 0.0)+0.1);"
			"	float d = max(dot(vertNormal, vertLightDir)+0.1, 0.0)+a;"


			"	vec2 LMCoord = gl_FragCoord.xy;"
			"	vec2 LPos = (LightScreenPos.xy*0.5+0.5)*ScreenSize;"
			"	vec2 Ray = LMCoord - LPos;"
			"	float Len = length(Ray);"
			"	int NSampl = int(max(abs(Ray.x), abs(Ray.y)))+1;"
			"	vec2 RayStep = Ray / NSampl;"
			"	float r = texture(LightMap, LMCoord).r;"
			"	NSampl = min(NSampl, int(min(ScreenSize.x, ScreenSize.y)*0.25));"
			"	for(int s=0; s!=NSampl;++s)"
			"	{"
			"		r += texture(LightMap, LPos+RayStep*s).r;"
			"	}"
			"	r /= NSampl;"
			"	r = min(r, 1.0);"
			"	fragColor = LightColor * (mix(a, d, s) + r);"
			"}"
		).Compile();

		prog.AttachShader(vs).AttachShader(fs);
		prog.Link().Use();

		return prog;
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:59,代码来源:030_light_rays.cpp


示例13: make

	static Program make(void)
	{
		Program prog(ObjectDesc("Light program"));
		prog.AttachShader(LightVertShader());
		prog.AttachShader(LightFragShader());
		prog.Link().Use();
		return prog;
	}
开发者ID:xubingyue,项目名称:oglplus,代码行数:8,代码来源:029_flares.cpp


示例14: make

	static Program make(void)
	{
		Program prog(ObjectDesc("Cube program"));
		prog.AttachShader(CubeVertShader());
		prog.AttachShader(CubeFragShader());
		prog.Link().Use();
		return prog;
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:8,代码来源:025_subroutines.cpp


示例15: make_fs

	// makes a fragment shader from the prologe, custom part and epilogue
	static Shader make_fs(const char* color_fs, const char* desc)
	{
		Shader shader(ShaderType::Fragment, ObjectDesc(desc));
		const GLchar* src[3] = {fs_prologue(), color_fs, fs_epilogue()};
		shader.Source(src);
		shader.Compile();
		return shader;
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:9,代码来源:020_shaded_objects.cpp


示例16: make_prog

	static Program make_prog(void)
	{
		Program prog(ObjectDesc("Screen"));

		prog.AttachShader(VertexShader(
			ObjectDesc("Screen vertex"),
			StrLit(
			"#version 330\n"

			"in vec4 Position;"
			"in vec2 TexCoord;"

			"out vec2 vertTexCoord;"

			"void main(void)"
			"{"
			"	gl_Position = Position;"
			"	vertTexCoord = TexCoord;"
			"}"
			)
		)).AttachShader(FragmentShader(
			ObjectDesc("Screen fragment"),
			StrLit(
			"#version 330\n"

			"uniform sampler2D Background, NormalMap;"

			"in vec2 vertTexCoord;"

			"out vec3 fragColor;"

			"void main(void)"
			"{"
			"	vec4 nm = texture(NormalMap, vertTexCoord);"
			"	vec2 offs = nm.xy*0.05+vec2(0.004, 0.004)*nm.w;"
			"	vec4 c = texture(Background, vertTexCoord+offs);"
			"	float l = clamp(nm.w+pow(dot(nm.xy,vec2(0.2,0.2)), 9.0), 0.3, 1.1);"
			"	fragColor = c.rgb*mix(1.2, 0.8, l);"
			"}"
			)
		)).Link().Use();

		return std::move(prog);
	}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:44,代码来源:027_flow.cpp


示例17: LightFragShader

    LightFragShader()
      : FragmentShader(
          ObjectDesc("Light fragment shader"),
          StrCRef("#version 150\n"

                  "out vec3 fragColor;"

                  "void main()"
                  "{"
                  "	fragColor = vec3(1.0, 1.0, 1.0);"
                  "}")) {}
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:11,代码来源:029_flares.cpp


示例18: LineGeomShader

	LineGeomShader(void)
	 : GeometryShader(
		ObjectDesc("Line geometry shader"),
		"#version 150\n"
		"layout(lines) in;"
		"layout(line_strip, max_vertices=4) out;"

		"in gl_PerVertex {"
		"	vec4 gl_Position;"
		"} gl_in[];"
		"in float vertNoise[];"
		"in vec3 vertNormal[];"
		"in vec3 vertLightDir[], vertViewDir[];"
		"in vec2 vertTexCoord[];"
		"in vec4 vertLightTexCoord[];"

		"out gl_PerVertex {"
		"	vec4 gl_Position;"
		"};"
		"out float geomOpacity;"

		"void main(void)"
		"{"
		"	vec4 p0 = gl_in[0].gl_Position;"
		"	vec4 p1 = gl_in[1].gl_Position;"
		"	vec4 n0 = vec4(vertNormal[0], 0.0);"
		"	vec4 n1 = vec4(vertNormal[1], 0.0);"
		"	float dp = pow(length(p1 - p0), 0.25);"
		"	float l0 = cos(vertNoise[0]*1.618)*dp;"
		"	float l1 = sin(vertNoise[1]*1.618)*dp;"
		"	vec4 v0 = p0 + n0*l0*0.01;"
		"	vec4 v1 = p1 + n1*l1*0.01;"
		"	vec4 v = v1 - v0;"

		"	gl_Position = v0 - v*abs(l1*0.41);"
		"	geomOpacity = 0.0;"
		"	EmitVertex();"

		"	gl_Position = p0;"
		"	geomOpacity = 1.0;"
		"	EmitVertex();"

		"	gl_Position = p1;"
		"	geomOpacity = 1.0;"
		"	EmitVertex();"

		"	gl_Position = v1 + v*abs(l0*0.44);"
		"	geomOpacity = 0.0;"
		"	EmitVertex();"

		"	EndPrimitive();"
		"}"
	)
	{ }
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:54,代码来源:031_sketch.cpp


示例19: PointFragShader

    PointFragShader()
      : FragmentShader(
          ObjectDesc("Fragment shader"),
          "#version 140\n"

          "in vec3 vertColor;"
          "out vec3 fragColor;"

          "void main()"
          "{"
          "	fragColor = vertColor;"
          "}") {}
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:12,代码来源:021_morphing.cpp


示例20: MetalFragShader

    MetalFragShader()
      : FragmentShader(
          ObjectDesc("Metal fragment shader"),
          "#version 150\n"
          "const vec3 Color1 = vec3(0.7, 0.6, 0.5);"
          "const vec3 Color2 = vec3(0.9, 0.8, 0.7);"

          "uniform sampler2D MetalTex;"

          "in vec3 vertNormal, vertTangent, vertBitangent;"
          "in vec3 vertLightDir, vertViewDir;"
          "in vec2 vertTexCoord;"

          "out vec3 fragColor;"

          "void main()"
          "{"
          "	vec3 Sample = texture(MetalTex, vertTexCoord).rgb;"
          "	vec3 LightColor = vec3(1.0, 1.0, 0.9);"

          "	vec3 Normal = normalize("
          "		2.0*vertNormal + "
          "		(Sample.r - 0.5)*vertTangent + "
          "		(Sample.g - 0.5)*vertBitangent"
          "	);"

          "	vec3 LightRefl = reflect("
          "		-normalize(vertLightDir),"
          "		Normal"
          "	);"

          "	float Specular = pow(max(dot("
          "		normalize(LightRefl),"
          "		normalize(vertViewDir)"
          "	)+0.04, 0.0), 16+Sample.b*48)*pow(0.4+Sample.b*1.6, 4.0);"

          "	Normal = normalize(vertNormal*3.0 + Normal);"

          "	float Diffuse = pow(max(dot("
          "		normalize(Normal), "
          "		normalize(vertLightDir)"
          "	), 0.0), 2.0);"

          "	float Ambient = 0.5;"

          "	vec3 Color = mix(Color1, Color2, Sample.b);"

          "	fragColor = "
          "		Color * Ambient +"
          "		LightColor * Color * Diffuse + "
          "		LightColor * Specular;"
          "}") {}
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:52,代码来源:031_blob.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ObjectDistanceOrder函数代码示例发布时间:2022-05-30
下一篇:
C++ Object函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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