Esempio n. 1
0
        public void AddDirect(IVoxelStorer storer, IVoxelizationMethod method, RenderView view, VoxelAttribute attr, VoxelizationStage stage, bool output, bool shadows)
        {
            bool toAdd = true;

            foreach (VoxelizationPass pass in passes)
            {
                if (pass.storer.Equals(storer) &&
                    pass.method.Equals(method) &&
                    pass.view.ViewProjection == view.ViewProjection)
                {
                    pass.Add(attr, stage, output, shadows);
                    toAdd = false;
                    break;
                }
            }
            if (toAdd)
            {
                VoxelizationPass pass = new VoxelizationPass
                {
                    storer = storer,
                    method = method,
                    view   = view
                };
                pass.Add(attr, stage, output, shadows);
                passes.Add(pass);
            }
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public bool CanShareRenderStage(IVoxelStorer storer)
        {
            VoxelStorerClipmap storerClipmap = storer as VoxelStorerClipmap;

            if (storerClipmap == null)
            {
                return(false);
            }

            bool singleClipA = UpdatesOneClipPerFrame();
            bool singleClipB = storerClipmap.UpdatesOneClipPerFrame();

            return(singleClipA == singleClipB);
        }
        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);
 }
Esempio n. 6
0
 public abstract void CollectVoxelizationPasses(VoxelizationPassList passList, IVoxelStorer storer, Matrix view, Vector3 resolution, VoxelizationStage stage, bool output);