#include #include #include "pointOnSphere.h" #include "addSphereToScene.h" //////////////////////////////////////////////////////////// // // Put a sphere at a random location on a unit sphere. // // Give the sphere an emissive color. // // pointOnSphere() returns error code 1 on failure. SoMaterial * addEmissiveSphereToScene (SoSphere *sphereSample, SoSeparator *scene, double radius) { SbVec3f samplePoint; SoSeparator *sphereSep = new SoSeparator(); scene->addChild(sphereSep); SoMaterial *sphereMaterial; SoTransform *sphereTrans; while (pointOnSphere(samplePoint)) { // error } sphereMaterial = new SoMaterial(); sphereMaterial->ambientColor.setValue(0.0, 0.0, 0.0); sphereMaterial->diffuseColor.setValue(0.0, 0.0, 0.0); sphereMaterial->specularColor.setValue(0.0, 0.0, 0.0); sphereSep->addChild(sphereMaterial); sphereTrans = new SoTransform(); sphereTrans->translation = radius*samplePoint; sphereSep->addChild(sphereTrans); sphereSep->addChild(sphereSample); return (sphereMaterial); }