25 lines
779 B
Plaintext
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 |