mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 18:44:00 +02:00
add spheres from command line
This commit is contained in:
parent
6ec9949098
commit
055c46c60f
1 changed files with 21 additions and 0 deletions
|
@ -43,6 +43,23 @@ const int MAX_VOXEL_TREE_DEPTH_LEVELS = 10;
|
|||
|
||||
AgentList agentList('V', VOXEL_LISTEN_PORT);
|
||||
|
||||
void addRandomSphere(VoxelTree * tree) {
|
||||
float r = randFloatInRange(0.05,0.1);
|
||||
float xc = randFloatInRange(r,(1-r));
|
||||
float yc = randFloatInRange(r,(1-r));
|
||||
float zc = randFloatInRange(r,(1-r));
|
||||
float s = 0.001; // size of voxels to make up surface of sphere
|
||||
bool solid = true;
|
||||
|
||||
printf("random sphere\n");
|
||||
printf("radius=%f\n",r);
|
||||
printf("xc=%f\n",xc);
|
||||
printf("yc=%f\n",yc);
|
||||
printf("zc=%f\n",zc);
|
||||
|
||||
tree->createSphere(r,xc,yc,zc,s,solid);
|
||||
}
|
||||
|
||||
int randomlyFillVoxelTree(int levelsToGo, VoxelNode *currentRootNode) {
|
||||
// randomly generate children for this node
|
||||
// the first level of the tree (where levelsToGo = MAX_VOXEL_TREE_DEPTH_LEVELS) has all 8
|
||||
|
@ -139,6 +156,10 @@ int main(int argc, const char * argv[])
|
|||
// octal codes to the tree nodes that it is creating
|
||||
randomlyFillVoxelTree(MAX_VOXEL_TREE_DEPTH_LEVELS, randomTree.rootNode);
|
||||
}
|
||||
|
||||
if (cmdOptionExists(argc, argv, "--AddRandomSpheres")) {
|
||||
addRandomSphere(&randomTree);
|
||||
}
|
||||
|
||||
unsigned char *voxelPacket = new unsigned char[MAX_VOXEL_PACKET_SIZE];
|
||||
unsigned char *voxelPacketEnd;
|
||||
|
|
Loading…
Reference in a new issue