Example #1
0
 public MeshRenderer(MeshCache meshCache, ContentArchive content, int maximumInstancesPerDraw = 2048) : base(
         content.Load <GLSLContent>(@"ShapeDrawing\RenderMeshes.glvs").Source,
         content.Load <GLSLContent>(@"ShapeDrawing\RenderMeshes.glfs").Source
         )
 {
     this.meshCache  = meshCache;
     instances       = new StructuredBuffer <MeshInstance>(BufferTarget.ShaderStorageBuffer, maximumInstancesPerDraw, $"Mesh Instances");
     vertexConstants = new ConstantsBuffer <RasterizedVertexConstants>(BufferTarget.UniformBuffer, debugName: $"Mesh Renderer Vertex Constants");
 }
Example #2
0
        public MeshRenderer(Device device, MeshCache meshCache, ShaderCache cache, int maximumInstancesPerDraw = 2048)
        {
            this.meshCache = meshCache;
            instances      = new StructuredBuffer <MeshInstance>(device, maximumInstancesPerDraw, $"Mesh Instances");

            vertexConstants = new ConstantsBuffer <RasterizedVertexConstants>(device, debugName: $"Mesh Renderer Vertex Constants");

            vertexShader = new VertexShader(device, cache.GetShader(@"ShapeDrawing\RenderMeshes.hlsl.vshader"));
            pixelShader  = new PixelShader(device, cache.GetShader(@"ShapeDrawing\RenderMeshes.hlsl.pshader"));
        }
 public ShapesExtractor(Device device, ParallelLooper looper, BufferPool pool, int initialCapacityPerShapeType = 1024)
 {
     spheres        = new QuickList <SphereInstance>(initialCapacityPerShapeType, pool);
     capsules       = new QuickList <CapsuleInstance>(initialCapacityPerShapeType, pool);
     boxes          = new QuickList <BoxInstance>(initialCapacityPerShapeType, pool);
     triangles      = new QuickList <TriangleInstance>(initialCapacityPerShapeType, pool);
     meshes         = new QuickList <MeshInstance>(initialCapacityPerShapeType, pool);
     this.MeshCache = new MeshCache(device, pool);
     this.pool      = pool;
     this.looper    = looper;
 }
Example #4
0
        public ShapesExtractor(Device device, ParallelLooper looper, BufferPool pool, int initialCapacityPerShapeType = 1024)
        {
            QuickList <SphereInstance, Array <SphereInstance> > .Create(new PassthroughArrayPool <SphereInstance>(), initialCapacityPerShapeType, out spheres);

            QuickList <CapsuleInstance, Array <CapsuleInstance> > .Create(new PassthroughArrayPool <CapsuleInstance>(), initialCapacityPerShapeType, out capsules);

            QuickList <BoxInstance, Array <BoxInstance> > .Create(new PassthroughArrayPool <BoxInstance>(), initialCapacityPerShapeType, out boxes);

            QuickList <TriangleInstance, Array <TriangleInstance> > .Create(new PassthroughArrayPool <TriangleInstance>(), initialCapacityPerShapeType, out triangles);

            QuickList <MeshInstance, Array <MeshInstance> > .Create(new PassthroughArrayPool <MeshInstance>(), initialCapacityPerShapeType, out meshes);

            this.MeshCache = new MeshCache(device, pool);
            this.looper    = looper;
        }