Ejemplo n.º 1
0
        public void VisualizeTexture3D(ShaderResourceView buffer, Camera camera, Vector3 position, Vector3 size, RenderTargetView target)
        {
            var d = ((Texture3D)buffer.Resource).Description;

            Content.MeshConcretize metaGrid3D = new Graphics.Content.MeshConcretize
            {
                MeshDescription = new Software.Meshes.Grid3D
                {
                    MeshType = MeshType.PointList,
                    Position = Vector3.Zero,
                    Size     = new Vector3(1, 1, 1),
                    NWidth   = d.Width - 1,
                    NHeight  = d.Height - 1,
                    NDepth   = d.Depth - 1
                }
            };
            var effect = view.Content.Peek <Effect>(visualizeTexture3DEffect);

            effect.GetVariableByName("Texture").AsResource().SetResource(buffer);
            effect.GetVariableByName("Position").AsVector().Set(position);
            effect.GetVariableByName("TextureResolution").AsVector().Set(new Vector3(d.Width, d.Height, d.Depth));
            effect.GetVariableByName("Size").AsVector().Set(size);
            effect.GetVariableByName("ViewProjection").AsMatrix().SetMatrix(camera.View * camera.Projection);
            var technique = effect.GetTechniqueByIndex(0);
            var mesh      = view.Content.Peek <Content.Mesh10>(metaGrid3D);

            mesh.Setup(view.Device10,
                       view.Content.Peek <InputLayout>(new Graphics.Content.VertexStreamLayoutFromEffect
            {
                Signature10 = technique.GetPassByIndex(0).Description.Signature,
                Layout      = mesh.VertexStreamLayout
            }));
            technique.GetPassByIndex(0).Apply();
            mesh.Draw(view.Device10);
        }
 public void VisualizeTexture3D(ShaderResourceView buffer, Camera camera, Vector3 position, Vector3 size, RenderTargetView target)
 {
     var d = ((Texture3D)buffer.Resource).Description;
     Content.MeshConcretize metaGrid3D = new Graphics.Content.MeshConcretize
     {
         MeshDescription = new Software.Meshes.Grid3D
         {
             MeshType = MeshType.PointList,
             Position = Vector3.Zero,
             Size = new Vector3(1, 1, 1),
             NWidth = d.Width - 1,
             NHeight = d.Height - 1,
             NDepth = d.Depth -1
         }
     };
     var effect = view.Content.Peek<Effect>(visualizeTexture3DEffect);
     effect.GetVariableByName("Texture").AsResource().SetResource(buffer);
     effect.GetVariableByName("Position").AsVector().Set(position);
     effect.GetVariableByName("TextureResolution").AsVector().Set(new Vector3(d.Width, d.Height, d.Depth));
     effect.GetVariableByName("Size").AsVector().Set(size);
     effect.GetVariableByName("ViewProjection").AsMatrix().SetMatrix(camera.View * camera.Projection);
     var technique = effect.GetTechniqueByIndex(0);
     var mesh = view.Content.Peek<Content.Mesh10>(metaGrid3D);
     mesh.Setup(view.Device10,
         view.Content.Peek<InputLayout>(new Graphics.Content.VertexStreamLayoutFromEffect
     {
         Signature10 = technique.GetPassByIndex(0).Description.Signature,
         Layout = mesh.VertexStreamLayout
     }));
     technique.GetPassByIndex(0).Apply();
     mesh.Draw(view.Device10);
 }