示例#1
0
        public void Execute(int index) //row major
        {
            int3           tileIndex;
            TileLightIndex tileLightIndex = m_lightIndices[index];

            tileLightIndex.Reset();
            tileIndex.x = index % m_TileCount.x;
            tileIndex.y = index / m_TileCount.x;
            m_TileLightIndicesMinMax[index] = new uint2(1024, 0);
            var lightCount = 0;

            for (int i = 0; i < m_LightPos.Length; i++)
            {
                float3 lightPosition = m_LightPos[i];
                var    range         = m_LightRange[i];
                var    tileIsLit     = PlaneCircleCollision(m_ClusterInfo.ClusterXPlaneNormal[tileIndex.x],
                                                            m_ClusterInfo.ClusterXPlanePoints[tileIndex.x], lightPosition, range) && // plane left
                                       PlaneCircleCollision(-m_ClusterInfo.ClusterXPlaneNormal[tileIndex.x + 1],
                                                            m_ClusterInfo.ClusterXPlanePoints[tileIndex.x + 1], lightPosition, range) &&// plane right
                                       PlaneCircleCollision(m_ClusterInfo.ClusterYPlaneNormal[tileIndex.y],
                                                            m_ClusterInfo.ClusterYPlanePoints[tileIndex.y], lightPosition, range) && // plane top
                                       PlaneCircleCollision(-m_ClusterInfo.ClusterYPlaneNormal[tileIndex.y + 1],
                                                            m_ClusterInfo.ClusterYPlanePoints[tileIndex.y + 1], lightPosition, range);
                uint unsignedi = (uint)i;
                if (tileIsLit)
                {
                    tileLightIndex.SetIndex(i);
                    m_TileLightIndicesMinMax[index] = new uint2(min(unsignedi, m_TileLightIndicesMinMax[index].x),
                                                                max(unsignedi, m_TileLightIndicesMinMax[index].y));
                    lightCount += 1;
                }
            }
            m_lightIndices[index]   = tileLightIndex;
            m_TileLightCount[index] = lightCount;
        }
示例#2
0
        public void Execute(int jobId)
        {
            int2 tileId          = new int2(jobId % m_TileCount.x, jobId / m_TileCount.x);
            int2 bigTileId       = tileId / m_LastPhaseToCurTileScale;
            int2 bigTileCount    = (m_TileCount + m_LastPhaseToCurTileScale - new int2(1, 1)) / m_LastPhaseToCurTileScale;
            int  bigTileBufferID = bigTileId.x + bigTileId.y * bigTileCount.x;
            int  lightCount      = 0;

            m_ResTileLightIndicesMask[jobId].Clear();
            BitField32 lightIndicies = new BitField32();

            for (int lightIndex = 0; lightIndex < m_LightPos.Length; lightIndex++)
            {
                if (m_SrcTileLightIndicesMask[bigTileBufferID].IsSet(lightIndex))
                {
                    float3 lightPosition = m_LightPos[lightIndex];
                    var    range         = m_LightAffectingRange[lightIndex];
                    var    tileIsLit     = CullingUtls.PlaneSphereInclusion(m_ClusterInfo.ClusterXPlaneNormal[tileId.x],
                                                                            m_ClusterInfo.ClusterXPlanePoints[tileId.x], lightPosition, range) && // plane left
                                           CullingUtls.PlaneSphereInclusion(-m_ClusterInfo.ClusterXPlaneNormal[tileId.x + 1],
                                                                            m_ClusterInfo.ClusterXPlanePoints[tileId.x + 1], lightPosition, range) &&// plane right
                                           CullingUtls.PlaneSphereInclusion(m_ClusterInfo.ClusterYPlaneNormal[tileId.y],
                                                                            m_ClusterInfo.ClusterYPlanePoints[tileId.y], lightPosition, range) && // plane top
                                           CullingUtls.PlaneSphereInclusion(-m_ClusterInfo.ClusterYPlaneNormal[tileId.y + 1],
                                                                            m_ClusterInfo.ClusterYPlanePoints[tileId.y + 1], lightPosition, range);
                    uint unsignedLightIndex = (uint)lightIndex;
                    if (tileIsLit)
                    {
                        lightIndicies.SetBits(lightIndex, true);

                        m_TileLightIndicesMinMax[jobId] = new uint2(min(unsignedLightIndex, m_TileLightIndicesMinMax[jobId].x),
                                                                    max(unsignedLightIndex, m_TileLightIndicesMinMax[jobId].y));
                        lightCount += 1;
                    }
                }
            }

            m_ResTileLightIndicesMask[jobId] = lightIndicies;
            m_TileLightCount[jobId]          = lightCount;
        }
示例#3
0
 public uint2x2(uint m00, uint m01,
                uint m10, uint m11)
 {
     this.c0 = new uint2(m00, m10);
     this.c1 = new uint2(m01, m11);
 }
示例#4
0
 public uint2x3(float v)
 {
     this.c0 = (uint2)v;
     this.c1 = (uint2)v;
     this.c2 = (uint2)v;
 }
示例#5
0
 public uint2x3(bool2x3 v)
 {
     this.c0 = math.select(new uint2(0u), new uint2(1u), v.c0);
     this.c1 = math.select(new uint2(0u), new uint2(1u), v.c1);
     this.c2 = math.select(new uint2(0u), new uint2(1u), v.c2);
 }
示例#6
0
 public uint2x3(bool v)
 {
     this.c0 = math.select(new uint2(0u), new uint2(1u), v);
     this.c1 = math.select(new uint2(0u), new uint2(1u), v);
     this.c2 = math.select(new uint2(0u), new uint2(1u), v);
 }
示例#7
0
 public uint2x3(uint2 c0, uint2 c1, uint2 c2)
 {
     this.c0 = c0;
     this.c1 = c1;
     this.c2 = c2;
 }
 public uint2x2(float2x2 v)
 {
     this.c0 = (uint2)v.c0;
     this.c1 = (uint2)v.c1;
 }
示例#9
0
 public float2(uint2 v)
 {
     this.x = v.x;
     this.y = v.y;
 }
示例#10
0
 public static float2 float2(uint2 v)
 {
     return(new float2(v));
 }
示例#11
0
 public static uint csum(uint2 a)
 {
     return(a.x + a.y);
 }
示例#12
0
 public static int2 int2(uint2 v)
 {
     return(new int2(v));
 }
示例#13
0
 public int2(uint2 v)
 {
     this.x = (int)v.x;
     this.y = (int)v.y;
 }
示例#14
0
 public static uint2x4 uint2x4(uint2 c0, uint2 c1, uint2 c2, uint2 c3)
 {
     return(new uint2x4(c0, c1, c2, c3));
 }
示例#15
0
 public uint3(uint2 xy, uint z)
 {
     this.x = xy.x;
     this.y = xy.y;
     this.z = z;
 }
 public static uint2x2 uint2x2(uint2 c0, uint2 c1)
 {
     return(new uint2x2(c0, c1));
 }
 public uint2x2(int v)
 {
     this.c0 = (uint2)v;
     this.c1 = (uint2)v;
 }
示例#18
0
 public DebuggerProxy(uint2 v)
 {
     x = v.x;
     y = v.y;
 }
示例#19
0
 public uint2x3(double v)
 {
     this.c0 = (uint2)v;
     this.c1 = (uint2)v;
     this.c2 = (uint2)v;
 }
示例#20
0
 public static uint2 uint2(uint2 xy)
 {
     return(new uint2(xy));
 }
示例#21
0
 public uint2x3(uint v)
 {
     this.c0 = v;
     this.c1 = v;
     this.c2 = v;
 }
示例#22
0
 public static uint hash(uint2 v)
 {
     return(csum(v * uint2(0x4473BBB1u, 0xCBA11D5Fu)) + 0x685835CFu);
 }
示例#23
0
 public static uint2x3 uint2x3(uint2 c0, uint2 c1, uint2 c2)
 {
     return(new uint2x3(c0, c1, c2));
 }
示例#24
0
 public static uint2 hashwide(uint2 v)
 {
     return((v * uint2(0xC3D32AE1u, 0xB966942Fu)) + 0xFE9856B3u);
 }
示例#25
0
 public uint2x3(int2x3 v)
 {
     this.c0 = (uint2)v.c0;
     this.c1 = (uint2)v.c1;
     this.c2 = (uint2)v.c2;
 }
示例#26
0
 public static uint shuffle(uint2 a, uint2 b, ShuffleComponent x)
 {
     return(select_shuffle_component(a, b, x));
 }
示例#27
0
 public uint2x2(uint2 c0, uint2 c1)
 {
     this.c0 = c0;
     this.c1 = c1;
 }
示例#28
0
 public static uint2 shuffle(uint2 a, uint2 b, ShuffleComponent x, ShuffleComponent y)
 {
     return(uint2(
                select_shuffle_component(a, b, x),
                select_shuffle_component(a, b, y)));
 }
示例#29
0
 public uint2x2(uint v)
 {
     this.c0 = v;
     this.c1 = v;
 }
 public uint2x2(double2x2 v)
 {
     this.c0 = (uint2)v.c0;
     this.c1 = (uint2)v.c1;
 }