/// <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); } }
public virtual void GenerateAdditionalData(GPUModelResource modelResource, computestage stage, int batches, int submesh = 0) { }