Beispiel #1
0
        public override void SetAdditionalShaderParams(GPUModelResource modelResource)
        {
            Config_Grass config = Config as Config_Grass;

            modelResource.SetInt("size", Config.Amount);

            Vector4 info = new Vector4(config.Segments, config.Segmentheight, config.Grasswidth, 0);

            modelResource.SetVector("info", info);
        }
Beispiel #2
0
        /// <summary>
        /// Per batch, we wíll be calculating the offset within the vertices and indices buffer
        /// </summary>
        /// <param name="batches"></param>
        public override void GenerateAdditionalData(GPUModelResource _modelResource, computestage stage, int batches, int submesh = 0)
        {
            if (batches <= 0)
            {
                _modelResource.SetCommandBufferParam(GPUModelResource.computestage.indices, "_VerticesBatchOffset", 0);
                _modelResource.SetCommandBufferParam(GPUModelResource.computestage.indices, "_IndicesBatchOffset", 0);
                return;
            }

            int xDim = IndicesKernelDimensions.x;
            int yDim = IndicesKernelDimensions.y;

            int batchamount = Mathf.CeilToInt(xDim / batches);

            int[] indicesbatchoffets = new int[batches];
            int[] vertbatchoffsets   = new int[batches];

            int j = 1;

            indicesbatchoffets[0] = 0;
            vertbatchoffsets[0]   = 0;



            // we will be updating size to the amount of models calculated per batch
            _modelResource.SetCommandBufferParam(computestage.indices, "size", batchamount);

            for (int i = 0; i < batches; i++, j++)
            {
                if (j < batches)
                {
                    indicesbatchoffets[j] = batchamount * j * yDim * 3;
                    vertbatchoffsets[j]   = batchamount * j * yDim * 2;
                }

                _modelResource.SetCommandBufferParam(computestage.indices, "_IndicesBatchOffset", indicesbatchoffets[i], i);                   //change to pass batched, and give list?
                _modelResource.SetCommandBufferParam(computestage.indices, "_VerticesBatchOffset", vertbatchoffsets[i], i);
            }
        }
Beispiel #3
0
 public virtual void SetAdditionalShaderParams(GPUModelResource modelResource)
 {
 }
Beispiel #4
0
 public virtual void GenerateAdditionalData(GPUModelResource modelResource, computestage stage, int batches, int submesh = 0)
 {
 }