DeltaVR/Assets/Scripts/DeltaHoone/Weather_System/Grass/Compute/ConvertCellsToObjects.compute
2020-11-28 16:54:41 +02:00

25 lines
779 B
Plaintext

#pragma kernel Converter
struct grassCell {
uint grassElementIndexes[512];//map to grass elements
};
StructuredBuffer<grassCell> grassCellBuffer;
StructuredBuffer<uint> grassCellIndexBuffer;
AppendStructuredBuffer<uint> outGrassBuffer;
[numthreads(8,8,8)]
void Converter (uint callIndex : SV_GroupIndex, uint3 groupID : SV_GroupID) {
uint realIndex = groupID.x + groupID.y + groupID.z;
uint cellIndex = grassCellIndexBuffer[realIndex];
grassCell cell = grassCellBuffer[ cellIndex ];
int elementIndex = callIndex;//Correct
uint objIndex = cell.grassElementIndexes[elementIndex];
if(objIndex != 0) outGrassBuffer.Append(objIndex);
}
//So the error seems to have been the usement of the wrong ID... but there must have been something else as well