本文整理匯總了C#中Chunk.DestroyMesh方法的典型用法代碼示例。如果您正苦於以下問題:C# Chunk.DestroyMesh方法的具體用法?C# Chunk.DestroyMesh怎麽用?C# Chunk.DestroyMesh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Chunk
的用法示例。
在下文中一共展示了Chunk.DestroyMesh方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: LoadChunks
void LoadChunks()
{
if (loadTimer >= 0.0f && !busy)
{
if (chunkQueue.Keys.Count > 0)
{
busy = true;
Vector3 info = chunkQueue.Keys.First();
chunkQueue.Remove(chunkQueue.Keys.First());
Chunk chunk = new Chunk();
loadingChunk = chunk;
Vector3 position = new Vector3((int) info.x, (int) info.y, (int) info.z);
int lod = 2;
Vector3 min = position - new Vector3(octreeSize / 2.0f, octreeSize / 2.0f, octreeSize / 2.0f);
float dist = Mathf.Abs((min - Camera.main.transform.position).magnitude);
if (dist <= 96.0f)
lod = 6;
else if (dist > 96.0f && dist <= 192.0f)
lod = 5;
else if (dist > 192.0f && dist <= 288.0f)
lod = 4;
else if (dist > 288.0f && dist <= 384.0f)
lod = 3;
else if (dist > 384.0f && dist <= 512.0f)
lod = 2;
if(chunk.CreateChunk(computeShader, thread, lod, position))
{
cpuStartTime = Time.realtimeSinceStartup;
}
else
{
chunk.containsNothing = true;
loadingChunk.DestroyMesh();
chunks.Add(min, loadingChunk);
loadingChunk = null;
busy = false;
}
}
loadTimer = 0;
}
loadTimer += Time.deltaTime;
}