/* #ident	"%W%"	%G% */

/* ************************************************************************
# Copyright (C) 1994 Kubota Graphics Corp.
# 
# Permission to use, copy, modify, and distribute this material for
# any purpose and without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all
# copies, and that the name of Kubota Graphics not be used in
# advertising or publicity pertaining to this material.  Kubota
# Graphics Corporation MAKES NO REPRESENTATIONS ABOUT THE ACCURACY
# OR SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED
# "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE AND KUBOTA GRAPHICS CORPORATION DISCLAIMS ALL WARRANTIES,
# EXPRESS OR IMPLIED.
**************************************************************************/

#include "dore.h"
#include "dore_proto.h"

makeobjects()
{
   makespheres();
}
/*
  ======================================================================
 */
makespheres()
{
   DtInt indexmultiplier;
   DtColorRGB color;
   DtReal scalefactor;
   DtInt xindex, yindex;
   DtReal x, y, z;
   DtObject sphereobject;

   DuOpenGroupByName("spheregroup");

   sphereobject = DoPrimSurf(0);

   indexmultiplier = 10;

   color[0] = 1.;
   color[1] = 1.;
   color[2] = 0.;

   scalefactor = 3. / (DtReal)indexmultiplier;

   for (xindex=-1*indexmultiplier;xindex<=1*indexmultiplier;xindex++) {
      for (yindex=-1*indexmultiplier;yindex<=1*indexmultiplier;yindex++) {
	 x = xindex;
	 y = yindex;
	 z = 0.;

	 DgAddObj(DoPushMatrix());
	 DgAddObj(DoDiffuseColor(DcRGB,color));
	 DgAddObj(DoTranslate(x,y,z));
	 DgAddObj(DoScale(scalefactor,scalefactor,scalefactor));
	 DgAddObj(sphereobject);
	 DgAddObj(DoPopMatrix());
      }
   }

   DgClose();
}
/*
  ======================================================================
 */
DuOpenGroupByName(groupname)
     char *groupname;
{
   DtObject groupobj;

   groupobj = DsInqObj(DcNameString,groupname,DcTypeGroup);

   if (groupobj == DcNullObject) {
      groupobj = DoGroup(DcTrue);

      DsSetObjName(groupobj,DcNameString,groupname,DcFalse);

   } else {
      DgOpen(groupobj);
   }
}
/*
  ======================================================================
 */

/* end %M% */
