#ifndef CAMERA_H #include "engine.h" #include "point.h" #include "util.h" #include // STRUCTURE struct Camera { inline Camera(void) { position.x = 0.0f; position.y = 0.0f; position.z = 0.0f; rotation.x = 0.0f; rotation.y = 0.0f; rotation.z = 0.0f; zClipBias0 = (CAMERA_FAR_CLIP + CAMERA_NEAR_CLIP) / (CAMERA_FAR_CLIP - CAMERA_NEAR_CLIP); zClipBias1 = (-2.0f * CAMERA_FAR_CLIP * CAMERA_NEAR_CLIP) / (CAMERA_FAR_CLIP - CAMERA_NEAR_CLIP); xZoom = 1.0f / tanf(DEG_TO_RAD(CAMERA_FOV/2.0f)); yZoom = (xZoom * WINDOW_WIDTH) / WINDOW_HEIGHT; xScale = (0.5f * WINDOW_WIDTH) - 0.5f; yScale = (0.5f * WINDOW_HEIGHT) - 0.5f; } Point position; Point rotation; float zClipBias0, zClipBias1; float xZoom, yZoom; float xScale, yScale; }; #define CAMERA_H #endif