feat(渲染器): 添加基础2D渲染系统
实现核心渲染功能,包括着色器管理、批处理系统、相机控制和纹理加载 - 添加着色器管理器用于加载和管理GLSL着色器程序 - 实现批处理系统优化绘制调用 - 添加相机控制支持视图和投影矩阵 - 实现纹理加载和管理功能 - 添加基础2D渲染API包括绘制四边形和精灵 - 集成到应用系统中,支持自动初始化和清理 - 添加示例着色器用于彩色四边形和纹理精灵 - 更新构建系统包含新的渲染相关文件
This commit is contained in:
34
Frostbite2D/include/frostbite2D/graphics/camera.h
Normal file
34
Frostbite2D/include/frostbite2D/graphics/camera.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <frostbite2D/types/type_math.h>
|
||||
|
||||
namespace frostbite2D {
|
||||
|
||||
class Camera {
|
||||
public:
|
||||
Camera();
|
||||
|
||||
void setPosition(const Vec2& pos);
|
||||
void setZoom(float zoom);
|
||||
void setViewport(int width, int height);
|
||||
void setFlipY(bool flip) { flipY_ = flip; } // 调试用:Y轴翻转开关
|
||||
|
||||
const Vec2& getPosition() const { return position_; }
|
||||
float getZoom() const { return zoom_; }
|
||||
|
||||
void lookAt(const Vec2& target);
|
||||
void move(const Vec2& delta);
|
||||
void zoomAt(float factor, const Vec2& screenPos);
|
||||
|
||||
glm::mat4 getViewMatrix() const;
|
||||
glm::mat4 getProjectionMatrix() const;
|
||||
|
||||
private:
|
||||
Vec2 position_;
|
||||
float zoom_ = 1.0f;
|
||||
int viewportWidth_ = 1280;
|
||||
int viewportHeight_ = 720;
|
||||
bool flipY_ = false; // 调试用:Y轴翻转开关
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user