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


C# ShadingState.getRasterY方法代码示例

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


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

示例1: lookupShadingCache

 private Color lookupShadingCache(ShadingState state, IShader shader)
 {
     lock (lockObj)
     {
         if (state.getNormal() == null)
             return null;
         cacheLookups++;
         int cx = (int)(state.getRasterX() * shadingCacheResolution);
         int cy = (int)(state.getRasterY() * shadingCacheResolution);
         int hash = hashfunc(cx, cy);
         CacheEntry e = _shadingCache[hash & (_shadingCache.Length - 1)];
         if (e == null)
         {
             cacheEmptyEntryMisses++;
             return null;
         }
         // entry maps to correct pixel
         if (e.cx == cx && e.cy == cy)
         {
             // search further
             for (Sample s = e.first; s != null; s = s.next)
             {
                 if (s.i != state.getInstance())
                     continue;
                 // if (s.prim != state.getPrimitiveID())
                 // continue;
                 if (s.s != shader)
                     continue;
                 if (state.getNormal().dot(s.nx, s.ny, s.nz) < 0.95f)
                     continue;
                 // we have a match
                 cacheHits++;
                 return s.c;
             }
         }
         else
             cacheWrongEntryMisses++;
         return null;
     }
 }
开发者ID:rzel,项目名称:sunflowsharp,代码行数:40,代码来源:LightServer.cs

示例2: addShadingCache

 private void addShadingCache(ShadingState state, IShader shader, Color c)
 {
     lock (lockObj)
     {
         // don't cache samples with null normals
         if (state.getNormal() == null)
             return;
         cacheEntryAdditions++;
         int cx = (int)(state.getRasterX() * shadingCacheResolution);
         int cy = (int)(state.getRasterY() * shadingCacheResolution);
         int h = hashfunc(cx, cy) & (_shadingCache.Length - 1);
         CacheEntry e = _shadingCache[h];
         // new entry ?
         if (e == null)
             e = _shadingCache[h] = new CacheEntry();
         Sample s = new Sample();
         s.i = state.getInstance();
         // s.prim = state.getPrimitiveID();
         s.s = shader;
         s.c = c;
         s.nx = state.getNormal().x;
         s.ny = state.getNormal().y;
         s.nz = state.getNormal().z;
         if (e.cx == cx && e.cy == cy)
         {
             // same pixel - just add to the front of the list
             s.next = e.first;
             e.first = s;
         }
         else
         {
             // different pixel - new list
             e.cx = cx;
             e.cy = cy;
             s.next = null;
             e.first = s;
         }
     }
 }
开发者ID:rzel,项目名称:sunflowsharp,代码行数:39,代码来源:LightServer.cs


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