DEKI/ENGINE 文档
deki-rendering 0.19.0
Deki 包参考
deki-rendering

核心渲染管线:相机、渲染系统、标准 2D 渲染器、QuadBlit、渲染通道和排序。

仓库:github.com/dekiengine/deki-rendering · 最新版本:0.19.0 · 需要引擎 0.19.0 或更高版本

使用 DekiEditor --packages-add deki-rendering <project> 或通过包管理器安装。引擎自身的组件和 C++ API 见 Deki 文档。

在编辑器中显示为 **Rendering**。

组件

组件 类别 说明
CameraComponent 核心 视图:位置、显示的世界范围大小,以及清除颜色。

组件参考

CameraComponent

视图:位置、显示的世界范围大小,以及清除颜色。

检视器中的名称:相机组件 · 类别:核心 · 类型:DekiRendering::CameraComponent

属性 类型 默认值 约束 说明
clearColor Color "#314D79FF" 绘制任何内容之前用来填充屏幕的颜色。没有内容覆盖的地方就显示这个颜色。
projection enum "Orthographic" Orthographic, Perspective 正交以平面方式显示固定高度的世界范围。透视显示有纵深的视野,用于 3D 网格;精灵仍按平面绘制。
orthoHeight float 15 0.01 到 100000;单位 m;projection 允许时显示 相机从上到下显示的世界范围。每个屏幕都会缩放它以填满自身高度(旁边的 x)。
pixelPerfect bool false projection 允许时显示 用于像素画。只按整数倍缩放,使每个美术像素在屏幕上大小相同,并将相机吸附到美术像素网格。向下取整:相机显示的范围会比正交高度略多,而小于 1x 的屏幕会被裁剪。
fieldOfView float 60 10 到 150;projection 允许时显示 垂直视野角度。屏幕越宽,两侧看到的越多。60 是常用默认值;越大视野越广,边缘畸变也越明显。
nearPlane float 0.1 projection 允许时显示 比此距离更近的内容不会绘制。调大它没有开销,还能提高深度精度,因此在场景允许的范围内尽量设大。
farPlane float 100 projection 允许时显示 比此距离更远的内容不会绘制。
clearEveryFrame bool true 每帧开始前清除屏幕。关闭时上一帧会保留在下方:当全屏背景覆盖一切时更快,有时也正好用于制作拖尾效果。

项目设置

渲染 设置

项目设置分区 Rendering(RenderingProjectSettings)。

类别:设置 · 类型:DekiRendering::RenderingProjectSettings

属性 类型 默认值 约束 说明
halfWidthFramebuffer bool false 以一半的水平分辨率渲染,显示时再加倍。传输开销和帧缓冲内存减半,但像素画在水平方向上看起来被拉伸为 2:1。
interlaced60hz bool false 以 60Hz 一帧渲染奇数扫描线,下一帧渲染偶数扫描线。每帧工作量减半,但垂直运动时会出现可见的梳状纹。
dirtyTileTracking bool false 脏矩形跟踪:记录每帧绘制的矩形,下一帧只清除这些矩形,并只把有变化的部分(本帧和上一帧的矩形)推送到显示屏。对大部分静止的场景收益很大;对全部在动的场景只有很小的记录开销。无法显示局部帧的显示屏仍会收到完整帧。
dirtyTileSize int32 32 1 到 256;dirtyTileTracking 允许时显示 脏矩形的对齐像素数:每个矩形都会向外取整到此值的倍数。越大 = 推送次数更少、每次更大,小幅移动可复用同一矩形;越小 = 矩形更紧凑。

更新日志

更新日志为英文。

0.19.0

Changed

  • minEngine 0.19.0: built against engine 0.19.0, whose component metadata records the package each class is in. A build of this package from before does not load and is rebuilt.

Added

  • Japanese, Simplified Chinese and Korean: editor/lang/ja.json, zh.json and ko.json translate the names, tooltips and enum values this package's components show in the Inspector.
  • The package's editor text goes through the editor's translation (Tr), so it shows in the editor's language. Needs the editor release that adds Localization.h; raise minEngine to it when releasing.

0.18.2

Added

  • RenderProfiler: once enabled, the draws, content time, blit time and pixels per frame of each component type, and the frame's clear. The ESP32's DEKI:PROFILE console request reports it.

Changed

  • Blits are several times faster on the ESP32.

    • A pixel is read from RGB565 sources byte by byte. With memcpy, which GCC makes a function call on the ESP32's Xtensa when the pixel may be unaligned, every pixel cost a call.
    • A 1:1 sprite drawn onto RGB565 with a tint or alpha tint runs in one loop per row, with the tint worked out once for each of RGB565's channel values. It went through the per-pixel pipeline.
    • So does a sprite drawn onto RGB565A8 scaled or tinted: each particle into its emitter's composite. The demo's two fountains took 3.6 ms a frame on a LilyGO T-Deck, now 2.4 ms.

    The pixels are the same as before.

更早的版本:CHANGELOG.md


由包的反射数据生成(引擎 0.19.0)。属性名就是场景文件中使用的键。重命名后会保留别名(兼容性)。