MiMoEngine ASM: x86-64 MASM汇编+C混合架构游戏引擎
核心热路径(数学/内存/字符串/性能分析)用MASM汇编(SSE/AVX2) 外围系统(窗口/渲染/ECS/音频/UI/脚本)用C语言 含自研编辑器、VisualScript积木编程、中文渲染(glyph_atlas)
This commit is contained in:
commit
2d56cb3bc9
91 files changed
+9988
No files matched your search
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
// ============================================================================
|
||||
// camera.h - 摄像机
|
||||
// ============================================================================
|
||||
|
||||
#include "../include/engine_api.h"
|
||||
#include "../ASM/math_c_fallback.h"
|
||||
|
||||
typedef enum {
|
||||
CAMERA_PERSPECTIVE,
|
||||
CAMERA_ORTHOGRAPHIC,
|
||||
} CameraType;
|
||||
|
||||
typedef struct {
|
||||
CameraType type;
|
||||
Vec3 position;
|
||||
Vec3 target;
|
||||
Vec3 up;
|
||||
float fov_y;
|
||||
float aspect;
|
||||
float near_z;
|
||||
float far_z;
|
||||
float ortho_width;
|
||||
float ortho_height;
|
||||
Mat4 view;
|
||||
Mat4 projection;
|
||||
int dirty;
|
||||
} Camera;
|
||||
|
||||
// 创建默认透视摄像机
|
||||
Camera camera_perspective(float fov_y, float aspect, float near_z, float far_z);
|
||||
|
||||
// 创建正交摄像机
|
||||
Camera camera_orthographic(float width, float height, float near_z, float far_z);
|
||||
|
||||
// 更新矩阵
|
||||
void camera_update(Camera* camera);
|
||||
|
||||
// 获取矩阵
|
||||
const Mat4* camera_get_view(Camera* camera);
|
||||
const Mat4* camera_get_projection(Camera* camera);
|
||||
|
||||
// 移动
|
||||
void camera_move_forward(Camera* camera, float distance);
|
||||
void camera_move_right(Camera* camera, float distance);
|
||||
void camera_move_up(Camera* camera, float distance);
|
||||
|
||||
// 旋转
|
||||
void camera_rotate_yaw(Camera* camera, float angle);
|
||||
void camera_rotate_pitch(Camera* camera, float angle);
|
||||
|
||||
// 设置目标
|
||||
void camera_look_at(Camera* camera, Vec3 target);
|
||||
Reference in new issue
Block a user