/*
 * Copyright (c) 1993 Argonaut Software Ltd. All rights reserved.
 */

/* A simple real time physical simulation */

#define S0 BR_SCALAR(0)
#define S1 BR_SCALAR(1)

/* Specify number of vertices in sheet */

#define SHEETX 9
#define SHEETY 9
#define XSTART BR_SCALAR(-0.8)
#define YSTART BR_SCALAR(-0.8)

#define VERTEX(model,i,j) (model->vertices[(i)+(j)*SHEETX])

struct br_vertex vertices[SHEETX*SHEETY];
struct br_face faces[4*(SHEETX-1)*(SHEETY-1)];

enum { S_FIXED = 1 };
enum { SPRING_X, SPRING_Z };

#define FORCE_CONSTANT BR_SCALAR(0.015)
#define NATURAL_LENGTH BR_SCALAR(0.18)
#define NATURAL_LENGTH2 BR_SCALAR(0.18*0.18)
#define MAX_LENGTH BR_SCALAR(0.20)
#define GRAVITY BR_SCALAR(-0.0001)
#define DT BR_SCALAR(1)
#define FRICTION BR_SCALAR(0.3)
#define CYCLES 20
#define RADIUS BR_SCALAR(0.3)
#define RADIUS2 BR_SCALAR(0.3*0.3)
#define FORCE BR_SCALAR(0.7)
#define PLANE_FORCE BR_SCALAR(0.3)
#define DAMPING BR_SCALAR(0.8)

#define ROLLING_BALL_SENSITIVITY 500
#define MSCALE BR_SCALAR(0.006)

int Control(br_actor *world, br_actor *observer, br_actor *target);
void ControlObject(br_actor *target);