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


C# Normal.ToVec方法代码示例

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


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

示例1: Sample

 public override void Sample(ref Vector wi, ref Normal n, float u0, float u1, float lambda, out Vector dir, out float f)
 {
     var nl = n.ToVec();
     dir = Geometry.Reflect(ref wi, ref n);
         //new Vector(wi - nl * 2f * nl&wi);
     f = 1f;
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:7,代码来源:Brdf.cs

示例2: Sample_f

        public override void Sample_f(ref Vector wo, ref Normal N, ref Normal shadeN, ref RgbSpectrum in_f, float u0, float u1, float u2, ref SurfaceTextureData surfaceData, out BsdfSampleData result) {
            EvalParams(ref surfaceData);

            bool into = (Normal.Dot(ref N, ref shadeN) > 0f);
            result = new BsdfSampleData();
            result.Type = this.Type;

            if (!into) {
                // No internal reflections
                result.Wi = (-wo);
                result.Pdf = 1f;
                result.Type = reflectionSpecularBounce ? BrdfType.Specular : BrdfType.Glossy;
                result.F =  Krefl;
            }
            else {
                // RR to choose if reflect the ray or go trough the glass
                float comp = u0 * totFilter;
                if (comp > transFilter) {
                    Vector mwo = -wo;
                    result.Wi = mwo - (2f * Vector.Dot(ref N, ref mwo)) * N.ToVec();
                    result.Pdf = reflPdf;
                    result.Type = reflectionSpecularBounce ? BrdfType.Specular : BrdfType.Glossy;
                    result.F = Krefrct;
                }
                else {
                    result.Wi = -wo;
                    result.Pdf = transPdf;
                    result.F = Krefrct;
                    result.Type = transmitionSpecularBounce ? BrdfType.Specular : BrdfType.Glossy;
                }
            }

        }
开发者ID:HungryBear,项目名称:rayden,代码行数:33,代码来源:ArchGlassMaterial.cs

示例3: Sample_f

 public override void Sample_f(ref Vector wo, ref Normal N, ref Normal shadeN, ref RgbSpectrum in_f, float u0, float u1, float u2, ref SurfaceTextureData surfaceData, out BsdfSampleData result) {
     Vector dir = -wo;
     float dp = Normal.Dot(ref shadeN, ref dir);
     result.Lambda = 0f;
     result.Wi = dir - (2f * dp) * shadeN.ToVec();
     result.Type = reflectionSpecularBounce ? BrdfType.Specular : BrdfType.Glossy;
     result.Pdf = 1f;
     result.F = Kr;            
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:9,代码来源:MirrorMaterial.cs

示例4: Sample

        public RgbSpectrum Sample(ref Point point, ref Normal n, float u0, float u1, float u2, out RayInfo ray, out float pdf)
        {
            var wi = MC.CosineSampleHemisphere(u1, u2);
            pdf = wi.z * MathLab.INVPI;

            Vector v1, v2;
            Vector.CoordinateSystem(n.ToVec(), out v1, out v2);

            wi = new Vector(
                v1.x * wi.x + v2.x * wi.y + n.x * wi.z,
                v1.y * wi.x + v2.y * wi.y + n.y * wi.z,
                v1.z * wi.x + v2.z * wi.y + n.z * wi.z);
            ray = new RayInfo(point, wi, 1e-4f, float.MaxValue);

            return Le(wi);
        }
开发者ID:HungryBear,项目名称:rayden,代码行数:16,代码来源:InfiniteLight.cs

示例5: CreateFrame

 public void CreateFrame(ref Normal n)
 {
     nn = n.ToVec().Normalize();
     Vector.CoordinateSystem(nn, out sn, out tn);
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:5,代码来源:AdvancedSurfaceMaterial.cs

示例6: TransformAccordingNormal

 public static void TransformAccordingNormal(Normal nn, Vector woL, ref Vector woW) {
     Vector sn = new Vector(), tn;
     float zz = (float)Math.Sqrt(1f - nn.z * nn.z);
     sn.z = 0f;
     if (Math.Abs(zz) < 1e-6f) {
         sn.x = 1f;
         sn.y = 0f;
     }
     else {
         sn.x = nn.y / zz;
         sn.y = -nn.x / zz;
     }
     tn = (nn.ToVec() ^ sn);
     woW = woL.x * sn + woL.y * tn + woL.z * (new Vector(nn.x, nn.y, nn.z));
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:15,代码来源:Transform.cs

示例7: Bsdf

        public Bsdf(ref Normal geoN, ref Normal shadeN)
        {
            nn = shadeN.ToVec();
            nn.Normalize();
            ng = geoN.ToVec();
            ng.Normalize();

            Vector.CoordinateSystem(ref nn, out sn, out tn);
            bxdfs = new List<BxDF>();
        }
开发者ID:HungryBear,项目名称:rayden,代码行数:10,代码来源:BxDF.cs

示例8: IntersectSphere

        protected static bool IntersectSphere(ref Normal N, float D, ref RayData ray, ref RayHit rayHit)
        {
            var vd = N.ToVec() & ray.Dir;

            if (vd > -MathLab.Epsilon && vd < MathLab.Epsilon)
            {
               rayHit.Index = RayBuffer.NotHit;
                return false;
            }

            var t = -((N.ToVec() & ray.Org.ToVec()) + D) / vd;

            var result = t > MathLab.Epsilon;
            if (result)
            {
                rayHit.Index = 0;
                rayHit.Distance = t;
            }
            rayHit.Index = RayBuffer.NotHit;
            return false;
        }
开发者ID:HungryBear,项目名称:rayden,代码行数:21,代码来源:SpherePlaneIntersectionDevice.cs

示例9: Reflect

 public static Vector Reflect(ref Vector dir, ref Normal N)
 {
     float dp = Normal.Dot(ref N, ref dir);
     return dir - (2f*dp)*N.ToVec();
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:5,代码来源:Geometry.cs


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