执行以下命令生成协议 .js 文件:
pbjs --target static-module --wrap commonjs --out <.js 输出路径> <.proto 输入路径,可为通配符>| const { link, copy, ensureDir, stat, readdir, realpath, symlink } = require('fs-extra'); | |
| const { relative, join } = require('path'); | |
| (async () => { | |
| await myCopy( | |
| String.raw`X:\Temp\editor-ci-build-test\editor-3d\app`, | |
| // String.raw`X:\Temp\6`, | |
| String.raw`X:\Temp\editor-ci-build-test\editor-3d\.publish\CocosCreator\resources\app`, | |
| ); | |
| })(); | 
| class Vec2 { | |
| public int x = 0; | |
| public int y = 0; | |
| public Vec2(int p_x, int p_y) { | |
| this.x = p_x; | |
| this.y = p_y; | |
| } | |
| public Vec2 copy() { | |
| return new Vec2(this.x, this.y); | 
| interface IVec2 { | |
| x: number; | |
| y: number; | |
| } | |
| interface IBounds { | |
| min: IVec2; | |
| max: IVec2; | 
在 spawn(command, args, options) 时,
若 options 指定了 shell: true ,将用 shell 来启动目标进程;
否则,(在 Windows 上)将直接调用 command 来创建进程。
一个重要的差别就是 shell 会处理执行参数 args,例如,(在 Windows 上)解释引号:
spawn(command, ['"<含有空格的路径>"'], { shell: true })| const shaderTypes: [number, string][] = [ | |
| [gl.VERTEX_SHADER, 'Vertex shader'], | |
| [gl.FRAGMENT_SHADER, 'Fragment shader'], | |
| ]; | |
| const precisionTypes: [number, string][] = [ | |
| [gl.HIGH_FLOAT, 'High float'], | |
| [gl.MEDIUM_FLOAT, 'Medium float'], | |
| [gl.LOW_FLOAT, 'Low float'], | |
| [gl.HIGH_INT, 'High int'], | |
| [gl.MEDIUM_INT, 'Medium int'], | 
| import { _decorator, Component, Node, renderer, director, Material, GFXPrimitiveMode, Mesh, GFXBufferUsageBit, GFXMemoryUsageBit, Mat4, Vec3, IGFXAttribute, GFXFormat, GFXAttributeName, Scene, GFXBuffer, GFXComparisonFunc } from 'cc'; | |
| type RenderingSubMesh = Parameters<renderer.Model['initSubModel']>[1]; | |
| class VisualRelations { | |
| private _buffer: Float32Array; | |
| private _relationIndices: number[] = []; | |
| private _watchedNodes: Node[] = []; | |
| private _minPos: Vec3 = new Vec3(); | |
| private _maxPos: Vec3 = new Vec3(); |