forked from badnotes/Game-Programming-Patterns-CN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,19 @@ | ||
Dirty Flag | ||
|
||
脏标记模式 | ||
============================ | ||
# 目的 | ||
|
||
*使用延时计算避免不必要的工作* | ||
|
||
## 动机 | ||
|
||
许多游戏都有一个称之为*screen graph*(场景图)的东西.这是一个大的数据结构,包含了游戏世界中所有的物体.渲染引擎使用他来决定将物体绘制到屏幕的什么地方. | ||
|
||
简单来说,一个*scene graph*(场景图)是包含多个物体的列表.每个物体都含有一个model(模型)或者其他图元(graphic primitive),和一个<span name="transform">*transform*(变换)</span>.transform(变换)描述了物体在世界中的位置,旋转角度和缩放大小.想要移动或者旋转物体,我们可以修改他的变换. | ||
|
||
<aside name="transform"> | ||
|
||
变换的存贮和应用的机制不在我们的讨论范围之内.概括的说他是一个4x4的矩阵.你可以将两个转换 | ||
矩阵合并为一个——举个例子,移动一个物体再旋转——可以将这两个转换矩阵相乘得到一个等价的新矩阵. | ||
|
||
这么做的方法和原理作为一个练习留给读者. |