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.

41 lines
942 B
HLSL

/******************************************************************************/
/*
Project - MudBun
Publisher - Long Bunny Labs
http://LongBunnyLabs.com
Author - Ming-Lun "Allen" Chou
http://AllenChou.net
*/
/******************************************************************************/
#ifndef MUDBUN_VOXEL_FUNCS
#define MUDBUN_VOXEL_FUNCS
#include "VoxelDefs.cginc"
int allocate_node(float3 center, int nodeDepth, int iParent, int key)
{
int iNode;
InterlockedAdd(aNumNodesAllocated[nodeDepth + 1], 1, iNode);
InterlockedAdd(aNumNodesAllocated[0], 1, iNode);
if (iNode < int(nodePoolSize))
{
nodePool[iNode].center = center;
nodePool[iNode].sdfValue = kFltMax;
nodePool[iNode].iParent = iParent;
nodePool[iNode].iBrushMask = -1;
nodePool[iNode].key = key;
}
else
{
aNumNodesAllocated[0] = nodePoolSize;
iNode = -1;
}
return iNode;
}
#endif