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


C# Light.IntensityAt方法代码示例

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


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

示例1: Lambertian

 /// <summary>
 /// Calculate lambertian (diffuse) contribution
 /// </summary>
 /// <param name="light">light source</param>
 /// <param name="lightv">direction of light ray to point of intersection</param>
 /// <param name="normal">normal of surface</param>
 /// <param name="distance">distance from intersection to the light</param>
 /// <returns>Diffuse colour</returns>
 public Color Lambertian(Vector3 normal, Light light, Vector3 lightv, float distance)
 {
     var cosAngle = Math.Abs(Vector3.Dot(lightv, normal));
     return Colour * cosAngle * light.IntensityAt(distance) * light.Colour;
 }
开发者ID:rikkit,项目名称:raytracer-winrt,代码行数:13,代码来源:Shader.cs

示例2: Specular

        /// <summary>
        /// Calculate specular contribution (blinn-phong)
        /// </summary>
        /// <param name="light">light source</param>
        /// <param name="rayDir">incoming direction of tracer ray</param>
        /// <param name="lightv">incoming direction of light ray</param>
        /// <param name="normal">normal of the surface</param>
        /// <param name="distance">distance from intersection to the light</param>
        /// <returns></returns>
        public Color Specular(Vector3 normal, Vector3 rayDir, Light light, Vector3 lightv, float distance)
        {
            // get the h component
            var added = -rayDir + -lightv; // rayDir and lightDir are the wrong way round
            added.Normalize();
            var h = added/Vector3.Distance(added, Vector3.Zero);

            const int phongExponent = 100;
            var dot = Vector3.Dot(h, normal);
            var specular =(float) Math.Pow(dot, phongExponent);

            return specular*light.IntensityAt(distance) * light.Colour;
        }
开发者ID:rikkit,项目名称:raytracer-winrt,代码行数:22,代码来源:Shader.cs

示例3: Ambient

 /// <summary>
 /// Calculate Ambient contribution, fraction of light colour and intensity
 /// </summary>
 /// <param name="light">Light source</param>
 /// <param name="distance"></param>
 /// <returns>Ambient colour</returns>
 public Color Ambient(Light light, float distance)
 {
     var a = AmbientFraction*light.IntensityAt(distance)*light.Colour;
     return a;
 }
开发者ID:rikkit,项目名称:raytracer-winrt,代码行数:11,代码来源:Shader.cs


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