vulkan游戏引擎的renderer_types实现

1.renderer_types.inl

#pragma once

#include "defines.h"

#include "math/math_types.h"

typedef enum renderer_backend_type

{

RENDERER_BACKEND_TYPE_VULKAN,

RENDERER_BACKEND_TYPE_OPENGL,

RENDERER_BACKEND_TYPE_DIRECTX

}renderer_backend_type;

typedef struct global_uniform_object {

// Projection matrix for transforming 3D space to clip space

mat4 projection;

// View matrix for transforming world space to camera space

mat4 view;

// Reserved matrix, can be used for future expansion

mat4 m_reserved0;

// Reserved matrix, can be used for future expansion

mat4 m_reserved1;

} global_uniform_object;

typedef struct renderer_backend{

struct platform_state* plat_state;

u64 frame_number;

b8 (*initialize)(struct renderer_backend* backend,const char* application_name,struct platform_state* plat_state);

void (*shutdown)(struct renderer_backend* backend);

void (*resized)(struct renderer_backend* backend,u16 width,u16 height);

b8 (*begin_frame)(struct renderer_backend* backend,f32 delta_time);

void (*update_global_state)(mat4 projection,mat4 view,vec3 view_position,vec4 ambient_colour,i32 mode);

b8 (*end_frame)(struct renderer_backend* backend,f32 delta_time);

void (*update_object)(mat4 model);

void (*create_texture)(

const char* name,

b8 auto_release,

i32 width,

i32 height,

i32 channel_count,

const u8* pixels,

b8 has_transparency,

struct texture* out_texture

);

void (*destroy_texture)( struct texture* texture);

}renderer_backend;

typedef struct render_packet{

f32 delta_time;

}render_packet;

相关推荐
七夜zippoe11 小时前
OpenClaw 内置工具详解
unity·ai·游戏引擎·openclaw·内置工具
mxwin16 小时前
Unity Shader 细节贴图技术在不增加显存开销的前提下,有效提升近距离纹理细节的渲染质量
unity·游戏引擎·贴图
魔士于安17 小时前
unity 低多边形 动物 带场景 有氛围感
游戏·unity·游戏引擎·贴图
魔士于安19 小时前
unity 动物包 大象 鹿 狐狸
游戏·unity·游戏引擎·贴图·模型
mxwin1 天前
Unity URP 中 Mipmap 纹理多级渐远技术 解决远处纹理闪烁(摩尔纹)与性能优化的完整指南
unity·游戏引擎
mxwin1 天前
Unity Shader Blinn-Phong vs PBR传统经验模型与现代物理基础渲染
unity·游戏引擎·shader
风酥糖1 天前
Godot游戏练习01-第23节-新增Player名称显示
游戏·游戏引擎·godot
mxwin1 天前
Unity Shader BRDF双向反射分布函数
unity·游戏引擎
十五年专注C++开发1 天前
Cocos2d - x: 一款开源跨平台 2D 游戏框架
运维·c++·游戏·开源·游戏引擎·cocos2d
魔士于安2 天前
unity完整项目走廊
游戏·unity·游戏引擎·贴图·模型