Commit 7f0e1974 authored by Scott Duensing's avatar Scott Duensing

Camera support.

parent 18fab39c
This diff is collapsed.
......@@ -27,9 +27,6 @@
#include "joey.h"
//***TODO*** verticies is vertices
typedef float j3Matrix4x4T[4][4];
typedef struct {
......@@ -79,11 +76,51 @@ typedef struct {
} j3WorldT;
#define jtCameraSetClippingBounds(x1, y1, x2, y2) \
clipMinX = (x1); j3MathCheckBounds(clipMinX, 0, 319); \
clipMinY = (y1); j3MathCheckBounds(clipMiny, 0, 199); \
clipMaxX = (x2); j3MathCheckBounds(clipMaxX, 0, 319); \
clipMaxY = (y2); j3MathCheckBounds(clipMaxy, 0, 199)
extern jint16 _j3VarClipMinX;
extern jint16 _j3VarClipMinY;
extern jint16 _j3VarClipMinZ;
extern jint16 _j3VarClipMaxX;
extern jint16 _j3VarClipMaxY;
extern jint16 _j3VarClipMaxZ;
extern jint16 _j3VarViewDistance;
extern float _j3VarAmbientLight;
extern j3Matrix4x4T _j3VarCameraMatrix;
extern j3VertexT _j3VarCameraLocation;
extern j3FacingT _j3VarCameraAngle;
extern bool _j3VarCameraLocationDirty;
extern bool _j3VarCameraAngleDirty;
extern j3VertexT _j3VarSunLocation;
#define j3CameraMove(ob, px, py, pz) \
_j3VarCameraLocation.x += (px); \
_j3VarCameraLocation.y += (py); \
_j3VarCameraLocation.z += (pz); \
_j3VarCameraLocationDirty = true
#define j3CameraMoveTo(ob, px, py, pz) \
_j3VarCameraLocation.x = (px); \
_j3VarCameraLocation.y = (py); \
_j3VarCameraLocation.z = (pz); \
_j3VarCameraLocationDirty = true
#define j3CameraRotate(ob, px, py, pz) \
_j3VarCameraAngle.x += (px); j3MathWrapBounds(_j3VarCameraAngle.x, 0, 360); \
_j3VarCameraAngle.y += (py); j3MathWrapBounds(_j3VarCameraAngle.y, 0, 360); \
_j3VarCameraAngle.z += (pz); j3MathWrapBounds(_j3VarCameraAngle.z, 0, 360); \
_j3VarCameraAngleDirty = true
#define j3CameraRotateTo(ob, px, py, pz) \
_j3VarCameraAngle.x = (px); j3MathWrapBounds(_j3VarCameraAngle.x, 0, 360); \
_j3VarCameraAngle.y = (py); j3MathWrapBounds(_j3VarCameraAngle.y, 0, 360); \
_j3VarCameraAngle.z = (pz); j3MathWrapBounds(_j3VarCameraAngle.z, 0, 360); \
_j3VarCameraAngleDirty = true
#define j3CameraSetClippingBounds(x1, y1, x2, y2) \
_j3VarClipMinX = (x1); j3MathCheckBounds(_j3VarClipMinX, 0, 319); \
_j3VarClipMinY = (y1); j3MathCheckBounds(_j3VarClipMiny, 0, 199); \
_j3VarClipMaxX = (x2); j3MathCheckBounds(_j3VarClipMaxX, 0, 319); \
_j3VarClipMaxY = (y2); j3MathCheckBounds(_j3VarClipMaxy, 0, 199)
#define j3MathCheckBounds(value, min, max) \
if (value < (min)) value = (min); \
......@@ -100,9 +137,9 @@ typedef struct {
ob.positionDirty = true
#define j3ObjectMoveTo(ob, px, py, pz) \
ob.position.x = (px); \
ob.position.y = (py); \
ob.position.z = (pz); \
ob.position.x = (px); \
ob.position.y = (py); \
ob.position.z = (pz); \
ob.positionDirty = true
#define j3ObjectRotate(ob, px, py, pz) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment