本文整理汇总了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;
}
}
示例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;
}
}
}