Exemple #1
0
        public MeshSpatialObject(GraphicsState graphics, SpatialState spatial, AssetFactoryState assets, Mesh mesh,
                                 bool culling)
        {
            Graphics = graphics;
            Spatial  = spatial;
            Mesh     = mesh;
            // TextureLayer = textureLayer;

            VertexBuffer = new ArrayBuffer <Vertex>(graphics, BufferUsage.StructuredBufferReadOnly,
                                                    mesh.Vertices, ShaderStages.Compute);
            WorldVertexBuffer = new ArrayBuffer <Vertex>(graphics, BufferUsage.StructuredBufferReadWrite,
                                                         mesh.Vertices.Length, ShaderStages.Compute | ShaderStages.Vertex);
            ScreenCoordsBuffer = new ArrayBuffer <Vector3D>(graphics, BufferUsage.StructuredBufferReadWrite,
                                                            mesh.Vertices.Length, ShaderStages.Compute | ShaderStages.Vertex);
            ParameterBuffer = new StructBuffer <Parameters>(graphics, BufferUsage.UniformBuffer,
                                                            ShaderStages.Compute);
            // Texture = texture;

            FaceBuffer = new ResourcelessArrayBuffer <Face>(graphics, BufferUsage.VertexBuffer, mesh.Faces);

            TransformPipeline = new ComputePipeline(graphics,
                                                    assets.Get <ShaderSet>("Shaders.MeshSpatialObject.Transform"),
                                                    VertexBuffer, WorldVertexBuffer, ScreenCoordsBuffer, ParameterBuffer);
            ColorPipeline = new GraphicsPipeline(graphics, Blend.Override, DepthTest.On, culling,
                                                 assets.Get <ShaderSet>("Shaders.MeshSpatialObject.Color"), graphics.IntermediateOutputDescription,
                                                 WorldVertexBuffer, ScreenCoordsBuffer);
            Commands = new Commands(graphics);
        }
Exemple #2
0
        public SpatialViewLayer(GraphicsState graphics, SpatialState spatial, AssetFactoryState assets)
        {
            Graphics = graphics;
            Spatial  = spatial;
            Assets   = assets;

            spatial.Objects.Add(new MeshSpatialObject(graphics, spatial, assets,
                                                      assets.Get <SpatialModel>("Characters.Raccoon").Meshes["Body"], true));
        }
Exemple #3
0
 public DebugViewLayer(GraphicsState graphics, SpatialState spatial, AssetFactoryState assets)
 {
     Graphics      = graphics;
     Spatial       = spatial;
     Assets        = assets;
     TextViewLayer = new LightTextViewLayer(graphics, assets, 8, 0, 1024, 1024,
                                            assets.Get <LightFont>("Fonts.Light.FiraSansItalic"),
                                            new[]
     {
         new Feature("kern"), new Feature("liga"), new Feature("clig"), new Feature("onum"),
         new Feature("tnum")
     },
                                            24, 24, new RgbaFloat(0, 0, 0, 0.6f), "");
 }