-
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
12 changed files
with
154 additions
and
6 deletions.
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Component | ||
|
||
Babylon的特征之一就是是ECS(Entity-Component-System实体-组件-系统),其核心是遵循组合优于继承原则。 | ||
以scene场景为单元作为一个实体,每个scene实体包含多个组件。 | ||
这样对scene进行解耦,使得每个模块如layers,post-process模块独立性更强。 | ||
|
||
既然以scene为单元,engine对象也是绑定在scene内部,渲染时不需要通过去调引擎,Mesh对象构造时也是依赖与某个scene的 | ||
|
||
scene与engine是双向的,scene引用engine,engine引用scene | ||
正是因为这种互相引用,方便了业务层面上的相互应用,避免了全局引用 | ||
|
||
自v3.1所有场景对象都继承自Node接口, | ||
```js | ||
/** | ||
* Node is the basic class for all scene objects (Mesh, Light, Camera.) | ||
*/ | ||
export class Node implements IBehaviorAware<Node> { | ||
} | ||
``` | ||
一般框架中基类会基础事件接口,方便各个部件处理,如three-js中 | ||
```js | ||
class Object3D extends EventDispatcher { | ||
} | ||
``` | ||
|
||
# EventSystem | ||
|
||
使用observable观察者模式 | ||
|
||
## Ammo.js | ||
|
||
Ammo.js 使用Emscripten将 Bullet物理引擎 直接移植到JavaScript | ||
|
||
## Monaco Editor | ||
|
||
monaco基于浏览器,而VSCode基于electron |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
# dev | ||
先执行 | ||
npm run start | ||
打开packages/tools目录下服务,执行相应的script | ||
|
||
开启playground,依赖npm run start中的服务 | ||
也是tools目录下的一个server,单独开启server:dev模式 | ||
|
||
## tools | ||
|
||
### babylonServer | ||
|
||
### playground | ||
|
||
playground中的代码保存时会存入https://snippet.babylonjs.com/中,返回一个对象,含有snippetIdentifier标识符,用来定位所有的代码内容, | ||
playground中的examples是通过https://babylonjs-newdocs.search.windows.net的一个接口返回文档中的snippet内容 | ||
|
||
snippet服务是一个小server,参考[snippet server reference](https://github.com/BabylonJS/SnippetServerReference/blob/main/index.js) | ||
就是一个读写服务器。 | ||
|
||
### devHost | ||
简单的一个基本场景加载逻辑,通过创建一个scene函数来运行,可以定制scene代码的逻辑 |
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,4 @@ | ||
# BabylonJS | ||
|
||
[shader](./shader.md) | ||
- [dev](./dev.md) | ||
- [shader](./shader.md) |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Material | ||
|
||
## Effect | ||
Effect containing vertex and fragment shader that can be executed on an object | ||
```js | ||
class Effect { | ||
constructor() { | ||
this._processingContext = this._engine._getShaderProcessingContext(this._shaderLanguage); | ||
} | ||
} | ||
|
||
``` | ||
|
||
## Node Material | ||
|
||
### NMD(Node Material Decorator) | ||
节点材质装饰器 |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Mesh | ||
|
||
## SubMesh | ||
现代引擎中的一个概念 | ||
A mesh has 1 to n submeshes, which divide its vertex data to n parts. This is useful for many cases (from collision to Octree, to MultiMatrials and co). | ||
babylonjs中符合这样的概念。 | ||
Defines a subdivision inside a mesh |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Rendering | ||
|
||
在RenderingManager类中可以看到至少有四个render group | ||
|
||
## RenderingGroup | ||
|
||
# Renderer | ||
|
||
## EdgesRender | ||
|
||
```js | ||
class EdgesRenderer { | ||
constructor() { | ||
if (isWebGPU) { | ||
drawWrapper = new DrawWrapper(engine); | ||
} | ||
} | ||
render() { | ||
// drawWrapper是处理WebGPU的 | ||
if (drawWrapper) { | ||
Shader._setDrawWrapper(drawWrapper); | ||
} | ||
engine.bindBuffers | ||
Shader.bind | ||
engine.drawElementsType | ||
Shader.unbind | ||
} | ||
} | ||
// | ||
``` | ||
大致流程还是标准的数据处理 | ||
|
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
glsl可以编译为webassembly的数据格式 |
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
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
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
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
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