$#include "lm_pkg_lm.h"
typedef int int32;
typedef unsigned int uint32;
typedef float real;
module LM {
typedef struct {
rgb_color();
~rgb_color();
int r;
int g;
int b;
int a;
} rgb_color;
#define LM_X_AXIS @ X_AXIS
#define LM_Y_AXIS @ Y_AXIS
#define LM_Z_AXIS @ Z_AXIS
#define LM_NEGX_AXIS @ NEGX_AXIS
#define LM_NEGY_AXIS @ NEGY_AXIS
#define LM_NEGZ_AXIS @ NEGZ_AXIS
#define LM_FREE_AXIS @ FREE_AXIS
class LM_String @ String {
LM_String();
LM_String(const LM_String &str);
LM_String(const char *str);
~LM_String();
char *Buffer() const;
void Set(const char *str);
};
class LM_Point @ Point {
LM_Point();
~LM_Point();
void Set(int32 xVal, int32 yVal);
void Set(const LM_Point &p2);
LM_Point operator+(const LM_Point &p2) const;
LM_Point operator-(const LM_Point &p2) const;
int32 x;
int32 y;
};
class LM_Rect @ Rect {
LM_Rect();
~LM_Rect();
void Normalize();
bool Contains(const LM_Point &pt);
int32 left;
int32 top;
int32 right;
int32 bottom;
};
class LM_Vector2 @ Vector2 {
LM_Vector2();
~LM_Vector2();
void Set(real vx, real vy);
void Set(const LM_Vector2 &vec2);
real Dot(const LM_Vector2 &vec2);
real Mag();
real SquaredMag();
LM_Vector2 Norm();
void NormMe();
LM_Vector2 GetOrthogonal();
void Rotate(real angle);
LM_Vector2 operator+(const LM_Vector2 &vec2);
LM_Vector2 operator-(const LM_Vector2 &vec2);
LM_Vector2 operator*(real f);
LM_Vector2 operator/(real f);
real x;
real y;
};
class LM_Vector3 @ Vector3 {
LM_Vector3();
~LM_Vector3();
void Set(real vx, real vy, real vz);
void Set(const LM_Vector3 &vec2);
real Dot(const LM_Vector3 &vec2);
LM_Vector3 Cross(const LM_Vector3 &vec2);
real Mag();
real SquaredMag();
LM_Vector3 Norm();
void NormMe();
void GetOrthogonals(LM_Vector3 *vecU, LM_Vector3 *vecV);
void Rotate(int32 axis, real angle);
LM_Vector3 operator+(const LM_Vector3 &vec2);
LM_Vector3 operator-(const LM_Vector3 &vec2);
LM_Vector3 operator*(real f);
LM_Vector3 operator/(real f);
real x;
real y;
real z;
};
class LM_BBox @ BBox {
LM_BBox();
bool IsEmpty();
void Clear();
void AccumulatePoint(const LM_Vector3 &v);
void AccumulatePoint(const LM_Vector2 &v);
void AccumulateBBox(const LM_BBox &box);
void Normalize();
real MaxDimension();
real MinDimension();
real MaxDimension2D();
real MinDimension2D();
LM_Vector3 fMin, fMax;
};
class LM_Matrix @ Matrix {
LM_Matrix();
~LM_Matrix();
void Set(const LM_Matrix &m2);
real ScaleValue();
void Multiply(const LM_Matrix &m2);
void Transform(LM_Vector2 &pt);
void Transform(LM_BBox &box);
void TransformHomo @ Transform(LM_Vector3 &pt);
void Invert();
void Identity();
void Translate(real dx, real dy, real dz);
void Scale(real sx, real sy, real sz);
void Rotate(int32 axis, real angle);
void Perspective(real alpha, real nearr, real farr, real aspect);
};
class LM_ColorVector @ ColorVector {
LM_ColorVector();
~LM_ColorVector();
void Set(real cr, real cg, real cb);
void Set(real cr, real cg, real cb, real ca);
void Set(rgb_color col);
void Set(const LM_ColorVector &col);
real Mag();
real SquaredMag();
void Normalize();
void Invert();
bool IsBlack();
bool IsWhite();
bool IsOpaque();
bool IsTransparent();
rgb_color AsColorStruct() const;
LM_ColorVector operator+(const LM_ColorVector &col2);
LM_ColorVector operator-(const LM_ColorVector &col2);
LM_ColorVector operator*(const LM_ColorVector &col2);
LM_ColorVector operator*(real f);
LM_ColorVector operator/(real f);
real r;
real g;
real b;
real a;
};
extern void LM_Beep @ Beep();
extern void LM_Snooze @ Snooze(int32 msec);
extern int32 LM_Round @ Round(real f);
extern real LM_Clamp @ Clamp(real f, real min, real max);
extern real LM_Lerp @ Lerp(real f, real min, real max);
extern real LM_Slerp @ Slerp(real f, real min, real max);
}