Ejemplo n.º 1
0
        public void CollectVoxelizationPasses(VoxelizationPassList passList, IVoxelStorer storer, Matrix view, Vector3 resolution, VoxelAttribute attr, VoxelizationStage stage, bool output, bool shadows)
        {
            axisX.MultisampleCount = MultisampleCount;
            axisY.MultisampleCount = MultisampleCount;
            axisZ.MultisampleCount = MultisampleCount;

            axisX.CollectVoxelizationPasses(passList, storer, view, resolution, attr, stage, output, shadows);
            axisY.CollectVoxelizationPasses(passList, storer, view, resolution, attr, stage, output, shadows);
            axisZ.CollectVoxelizationPasses(passList, storer, view, resolution, attr, stage, output, shadows);
        }
Ejemplo n.º 2
0
 public VoxelViewContext(VoxelizationPassList passes, int viewIndex)
 {
     IsVoxelView = false;
     foreach (var pass in passes.passes)
     {
         if (pass.view.Index == viewIndex)
         {
             IsVoxelView = true;
             break;
         }
     }
 }
        public void CollectVoxelizationPasses(VoxelizationPassList passList, IVoxelStorer storer, Matrix view, Vector3 resolution, VoxelAttribute attr, VoxelizationStage stage, bool output, bool shadows)
        {
            var actualView = Matrix.Identity;

            if (VoxelizationAxis == Axis.Y)
            {
                actualView.ExchangeRows(1, 2);
            }
            if (VoxelizationAxis == Axis.X)
            {
                actualView.ExchangeRows(0, 2);
            }

            while (VoxelizationViews.Count <= currentViewIndex)
            {
                VoxelizationViews.Add(new RenderView());
                VoxelizationViewSizes[VoxelizationViews[VoxelizationViews.Count - 1]] = new Int2();
            }
            RenderView voxelizationView = VoxelizationViews[currentViewIndex];

            float  maxRes      = Math.Max(resolution.X, Math.Max(resolution.Y, resolution.Z));
            Matrix aspectScale = Matrix.Scaling(new Vector3(resolution.X, resolution.Z, resolution.Y) / maxRes);

            VoxelizationViewSizes[voxelizationView] = new Int2((int)maxRes, (int)maxRes);

            voxelizationView.View           = actualView;
            voxelizationView.Projection     = view * aspectScale;
            voxelizationView.ViewProjection = voxelizationView.View * voxelizationView.Projection;
            voxelizationView.ViewSize       = new Vector2(maxRes * 8, maxRes * 8);


            //The BoundingFrustum constructor doesn't end up calculating the correct Near Plane for the symmetric matrix, squish it so the Z is from 0 to 1
            Matrix SquishedMatrix = voxelizationView.ViewProjection * Matrix.Scaling(1f, 1f, 0.5f) * Matrix.Translation(new Vector3(0, 0, 0.5f));

            voxelizationView.Frustum = new BoundingFrustum(ref SquishedMatrix);

            voxelizationView.CullingMode   = CameraCullingMode.None;
            voxelizationView.NearClipPlane = 0.1f;
            voxelizationView.FarClipPlane  = 1000.0f;

            currentViewIndex++;

            passList.AddDirect(storer, this, voxelizationView, attr, stage, output, shadows);
        }
 public override void CollectVoxelizationPasses(VoxelizationPassList passList, IVoxelStorer storer, Matrix view, Vector3 resolution, VoxelizationStage stage, bool output)
 {
     passList.defaultVoxelizationMethod.CollectVoxelizationPasses(passList, storer, view, resolution, this, stage, output, false);
 }
Ejemplo n.º 5
0
 public abstract void CollectVoxelizationPasses(VoxelizationPassList passList, IVoxelStorer storer, Matrix view, Vector3 resolution, VoxelizationStage stage, bool output);