You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
761 B
Plaintext

3 years ago
#pragma kernel CSMain
struct TerrainPosition
{
int terrainID;
uint2 min;
uint2 max;
int affected;
};
Texture2D<float4> Input;
RWStructuredBuffer<TerrainPosition>outputBuffer;
float fitnessThreshold;
int testInt;
int numberOfTerrains = 0;
[numthreads(8,8,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
if(Input[id.xy].r>fitnessThreshold)
{
for(int i=0;i<numberOfTerrains;i++)
{
TerrainPosition currentPos = outputBuffer[i];
if( id.x >= currentPos.min.x &&
id.y >= currentPos.min.y &&
id.x <= currentPos.max.x &&
id.y <= currentPos.max.y )
{
outputBuffer[i].affected = 1;
}
}
}
}