+static void update(void)
+{
+ int i, j;
+ float t = time_msec / 1000.0f;
+ struct g3d_vertex *vptr;
+
+ mouse_orbit_update(&cam_theta, &cam_phi, &cam_dist);
+
+ /* update mesh */
+ vptr = gmesh.varr;
+ for(i=0; i<GMESH_GRIDSZ + 1; i++) {
+ for(j=0; j<GMESH_GRIDSZ + 1; j++) {
+ float u = (float)j / GMESH_GRIDSZ - 0.5f;
+ float v = (float)i / GMESH_GRIDSZ - 0.5f;
+ float x = u * 32.0f;
+ float y = v * 32.0f;
+ float r = sqrt(x * x + y * y);
+
+ vptr->z = sin(x * 0.5 + t) + cos(x * 0.8f) * 0.5f;
+ vptr->z += cos(y * 0.5 + t);
+ vptr->z += sin(r + t) * 0.5f;
+ vptr->z *= r * 0.1f > 1.0f ? 1.0f : r * 0.1f;
+ vptr++;
+ }
+ }
+}
+