A SERVICE OF

logo

200
Appendix B: Cosmo 3D Sample Application
csQuadSet *gset = new csQuadSet;
// cube vertices
csCoordSet3f *cset = new csCoordSet3f(numCubeCoords);
cset->point()->edit();
#if 0
for (i=0; i<numCubeCoords; i++)
cset->point()->set(i,
csVec3f(cubeCoords[i][0], cubeCoords[i][1], cubeCoords[i][2]));
#else
cset->point()->setRange(0, numCubeCoords, (csVec3f *)cubeCoords);
#endif
cset->point()->editDone();
gset->setCoordSet(cset);
// cube normals
csNormalSet3f *nset = new csNormalSet3f(numCubeNorms);
nset->vector()->edit();
#if 0
for (i=0; i<numCubeNorms; i++)
nset->vector()->set(i,
csVec3f(cubeNorms[i][0], cubeNorms[i][1], cubeNorms[i][2]));
#else
nset->vector()->setRange(0, numCubeNorms, (csVec3f *)cubeNorms);
#endif
nset->vector()->editDone();
gset->setNormalSet(nset);
gset->setPrimCount(6);
gset->setNormalBind(csGeoSet::PER_PRIM_NORMAL);
//Specify the appearance and material attributes.
// highlight, yellow.
csMaterial *hlMaterial = new csMaterial;
hlMaterial->setSpecularColor(0.0f, 0.0f, 0.0f);
hlMaterial->setDiffuseColor(1.0f, 1.0f, 0.0f);
hlMaterial->setShininess(.0078125 *16.0f);
hlMaterial->setTransparency(0.0f);