diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index 3b5f6a267b..4e88d01ddf 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -107,6 +107,34 @@ void VoxelSystem::loadVoxelsFile(char* fileName) { // Complaints: Brad :) void VoxelSystem::createSphere(float r,float xc, float yc, float zc, float s, bool solid) { + // About the color of the sphere... we're going to make this sphere be a gradient + // between two RGB colors. We will do the gradient along the phi spectrum + unsigned char r1 = randomColorValue(165); + unsigned char g1 = randomColorValue(165); + unsigned char b1 = randomColorValue(165); + unsigned char r2 = randomColorValue(65); + unsigned char g2 = randomColorValue(65); + unsigned char b2 = randomColorValue(65); + + // we don't want them to match!! + if (r1==r2 && g1==g2 && b1==b2) + { + r2=r1/2; + g2=g1/2; + b2=b1/2; + } + + /** + std::cout << "creatSphere COLORS "; + std::cout << " r1=" << (int)r1; + std::cout << " g1=" << (int)g1; + std::cout << " b1=" << (int)b1; + std::cout << " r2=" << (int)r2; + std::cout << " g2=" << (int)g2; + std::cout << " b2=" << (int)b2; + std::cout << std::endl; + **/ + // Psuedocode for creating a sphere: // // for (theta from 0 to 2pi): @@ -157,10 +185,11 @@ void VoxelSystem::createSphere(float r,float xc, float yc, float zc, float s, bo std::cout << std::endl; */ - // random color data - unsigned char red = randomColorValue(65); - unsigned char green = randomColorValue(65); - unsigned char blue = randomColorValue(65); + // gradient color data + float gradient = (phi/M_PI); + unsigned char red = r1+((r2-r1)*gradient); + unsigned char green = g1+((g2-g1)*gradient); + unsigned char blue = b1+((b2-b1)*gradient); unsigned char* voxelData = pointToVoxel(x,y,z,s,red,green,blue); tree->readCodeColorBufferToTree(voxelData); diff --git a/interface/src/main.cpp b/interface/src/main.cpp index e572942823..3df7672a2f 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -718,7 +718,7 @@ void addRandomSphere() float xc = randFloatInRange(r,(1-r)); float yc = randFloatInRange(r,(1-r)); float zc = randFloatInRange(r,(1-r)); - float s = 0.002; // size of voxels to make up surface of sphere + float s = 0.001; // size of voxels to make up surface of sphere bool solid = false; printf("random sphere\n");