Cube.cxx Explained
195
Cube.cxx Explained
Example B-1 shows the cube.cxx application. It also includes embedded comments (not
found in the cube.cxx file) that explain the functionality of each section of cube.cxx. The
sections that follow Example B-1 explain the structure and functionality of the code in
more generic terms, so that you can understand the principles of programming Cosmo
3D applications.
Example B-1 cube.cxx
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <Cosmo3D/csField.h>
#include <Cosmo3D/csWindow.h>
#include <Cosmo3D/csColorSet.h>
#include <Cosmo3D/csNormalSet.h>
#include <Cosmo3D/csCoordSet.h>
#include <Cosmo3D/csQuadSet.h>
#include <Cosmo3D/csContext.h>
#include <Cosmo3D/csAppearance.h>
#include <Cosmo3D/csPerspCamera.h>
#include <Cosmo3D/csOrthoCamera.h>
#include <Cosmo3D/csTransform.h>
#include <Cosmo3D/csDrawAction.h>
#include <Cosmo3D/csShape.h>
#include <Cosmo3D/csPointLight.h>
#include <Cosmo3D/csMaterial.h>
#include <Cosmo3D/csEnvironment.h>
static csGroup* makeCube();
static csTransform* fgTransform;
static csTransform* bgTransform;
static csAppearance* highlight;
static csGroup* root;
static csDrawAction* da;
static csContext* ctx;
static int doFlash = 0;
static int doBorders = 1;
int frame(void*);