Ejemplo n.º 1
0
        private void Rasterize(void *mocBurstIntrinsicPtr, OcclusionMesh mesh)
        {
            MOC.BurstIntrinsics *mocBurstIntrinsic = (MOC.BurstIntrinsics *)mocBurstIntrinsicPtr;
            Debug.Assert(mocBurstIntrinsic != null);

            // Testing before rendering generally give good result, but it's a lot better if we are rasterize front to back
            MOC.CullingResult cullingResult = mocBurstIntrinsic->TestRect(
                mesh.screenMin.x, mesh.screenMin.y,
                mesh.screenMax.x, mesh.screenMax.y, mesh.screenMin.w);

            if (cullingResult == MOC.CullingResult.VISIBLE)
            {
                float *vertices = (float *)mesh.transformedVertexData.GetUnsafePtr();
                uint * indices  = (uint *)mesh.indexData.GetUnsafePtr();

                Debug.Assert(mesh.indexCount % 3 == 0);

                cullingResult = mocBurstIntrinsic->RenderTriangles(vertices, indices, mesh.indexCount / 3);
            }
        }
        private void Rasterize(void *mocNative, OcclusionMesh mesh)
        {
            //Testing before rendering generally give good result, but it's a lot better if we are rasterize front to back

            INTEL_MOC.CullingResult cullingResult = INTEL_MOC.CullingResult.VISIBLE;

            cullingResult = INTEL_MOC.MOCNative.TestRect(
                mocNative,
                mesh.screenMin.x, mesh.screenMin.y,
                mesh.screenMax.x, mesh.screenMax.y, mesh.screenMin.w);

            if (cullingResult == INTEL_MOC.CullingResult.VISIBLE)
            {
                float *vertices = (float *)mesh.transformedVertexData.GetUnsafePtr();
                uint * indices  = (uint *)mesh.indexData.GetUnsafePtr();

                Debug.Assert(mesh.indexCount % 3 == 0);

                INTEL_MOC.MOCNative.RenderTriangles(mocNative, vertices, indices, mesh.indexCount / 3);
            }
        }