Skip to content

Commit d407c30

Browse files
committed
Try to fix
1 parent 2593365 commit d407c30

File tree

7 files changed

+176
-7
lines changed

7 files changed

+176
-7
lines changed

Hilo3d

Submodule Hilo3d updated 57 files

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@
102102
"typedoc-plugin-markdown": "^1.1.25",
103103
"typedoc-plugin-no-inherit": "^1.1.4",
104104
"typedoc-webpack-plugin": "^1.1.4",
105-
"typescript": "^3.7.2",
105+
"typescript": "^3.9.5",
106106
"uglify-js": "^3.6.0",
107107
"url-loader": "^0.5.7",
108108
"webpack": "^3.12.0",
109109
"webpack-dev-server": "^2.10.1"
110110
}
111-
}
111+
}

src/Info/StateActor.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export default class StateActor<IOptionTypes extends Object = {}> extends InfoAc
2727
public isStateActor = true;
2828
public readonly updatePriority = InfoActor.UPDATE_PRIORITY.State;
2929

30+
/**
31+
* 自定义复制接口,你可以定制改写它。
32+
*/
3033
public copy(state: StateActor) {
3134
if (!state) {
3235
return;

src/Material/Material.ts

Lines changed: 164 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,171 @@
77
import Hilo3d from '../Core/Hilo3d';
88
import {IMaterialUniform} from '../Material/ShaderChunk';
99
import Game from '../Core/Game';
10+
import Texture from '../Texture/Texture';
11+
import {Matrix3} from '../Core/Math';
1012

11-
export type IMaterial = Hilo3d.IMaterial;
13+
export interface IMaterial {
14+
/**
15+
* name
16+
*/
17+
name?: string;
18+
/**
19+
* shader cache id
20+
*/
21+
shaderCacheId?: string;
22+
/**
23+
* 光照类型
24+
*/
25+
lightType?: string;
26+
/**
27+
* 是否开启网格模式
28+
*/
29+
wireframe?: boolean;
30+
/**
31+
* 是否开启深度测试
32+
*/
33+
depthTest?: boolean;
34+
/**
35+
* SAMPLE_ALPHA_TO_COVERAGE
36+
*/
37+
sampleAlphaToCoverage?: boolean;
38+
/**
39+
* 是否开启depthMask
40+
*/
41+
depthMask?: boolean;
42+
/**
43+
* 深度测试Range
44+
*/
45+
depthRange?: any[];
46+
/**
47+
* 深度测试方法
48+
*/
49+
depthFunc?: GLenum;
50+
/**
51+
* 法线贴图
52+
*/
53+
normalMap?: Texture;
54+
/**
55+
* 视差贴图
56+
*/
57+
parallaxMap?: Texture;
58+
/**
59+
* 法线贴图scale
60+
*/
61+
normalMapScale?: number;
62+
/**
63+
* 是否忽略透明度
64+
*/
65+
ignoreTranparent?: boolean;
66+
/**
67+
* 是否开启 gamma 矫正
68+
*/
69+
gammaCorrection?: boolean;
70+
/**
71+
* 是否使用物理灯光
72+
*/
73+
usePhysicsLight?: boolean;
74+
/**
75+
* 是否环境贴图和环境光同时生效
76+
*/
77+
isDiffuesEnvAndAmbientLightWorkTogether?: boolean;
78+
/**
79+
* 渲染顺序数字小的先渲染(透明物体和不透明在不同的队列)
80+
*/
81+
renderOrder?: number;
82+
/**
83+
* 是否预乘 alpha
84+
*/
85+
premultiplyAlpha?: boolean;
86+
/**
87+
* gammaOutput
88+
*/
89+
gammaOutput?: boolean;
90+
/**
91+
* gamma值
92+
*/
93+
gammaFactor?: number;
94+
/**
95+
* 是否投射阴影
96+
*/
97+
castShadows?: boolean;
98+
/**
99+
* 是否接受阴影
100+
*/
101+
receiveShadows?: boolean;
102+
/**
103+
* uv transform eg:new Matrix3().fromRotationTranslationScale(Math.PI/2, 0, 0, 2, 2)
104+
*/
105+
uvMatrix?: Matrix3;
106+
/**
107+
* uv1 transform eg:new Matrix3().fromRotationTranslationScale(Math.PI/2, 0, 0, 2, 2)
108+
*/
109+
uvMatrix1?: Matrix3;
110+
/**
111+
* 是否开启 CullFace
112+
*/
113+
cullFace?: boolean;
114+
/**
115+
* CullFace 类型
116+
*/
117+
cullFaceType?: GLenum;
118+
/**
119+
* 显示面,可选值 FRONT, BACK, FRONT_AND_BACK
120+
*/
121+
side?: GLenum;
122+
/**
123+
* 是否开启颜色混合
124+
*/
125+
blend?: boolean;
126+
/**
127+
* 颜色混合方式
128+
*/
129+
blendEquation?: GLenum;
130+
/**
131+
* 透明度混合方式
132+
*/
133+
blendEquationAlpha?: GLenum;
134+
/**
135+
* 颜色混合来源比例
136+
*/
137+
blendSrc?: GLenum;
138+
/**
139+
* 颜色混合目标比例
140+
*/
141+
blendDst?: GLenum;
142+
/**
143+
* 透明度混合来源比例
144+
*/
145+
blendSrcAlpha?: GLenum;
146+
/**
147+
* 透明度混合目标比例
148+
*/
149+
blendDstAlpha?: GLenum;
150+
/**
151+
* 当前是否需要强制更新
152+
*/
153+
isDirty?: boolean;
154+
/**
155+
* 透明度 0~1
156+
*/
157+
transparency?: number;
158+
/**
159+
* 是否需要透明
160+
*/
161+
transparent?: boolean;
162+
/**
163+
* 透明度剪裁,如果渲染的颜色透明度大于等于这个值的话渲染为完全不透明,否则渲染为完全透明
164+
*/
165+
alphaCutoff?: number;
166+
/**
167+
* 是否使用HDR
168+
*/
169+
useHDR?: boolean;
170+
/**
171+
* 曝光度,仅在 useHDR 为 true 时生效
172+
*/
173+
exposure?: number;
174+
};
12175

13176
/**
14177
* 判断一个实例是否为`Material`。

src/Material/RawShaderMaterial.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ void main() {
500500
/**
501501
* 获取定制的渲染参数,一般用于宏开关。
502502
*/
503-
public getCustomRenderOption(options: any) {
503+
public getCustomRenderOption = (options: any) => {
504504

505505
}
506506

@@ -523,5 +523,7 @@ void main() {
523523
texture.destroy();
524524
}
525525
}
526+
527+
return this;
526528
}
527529
}

src/Material/ShaderChunk.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Texture from '../Texture/Texture';
88
import CubeTexture from '../Texture/CubeTexture';
99
import {Vector2, Vector3, Vector4, Matrix3, Matrix4, Color, SphericalHarmonics3} from '../Core/Math';
1010
import {ISemanticObject} from './Semantic';
11+
import Hilo3d from '../Core/Hilo3d';
1112

1213
/**
1314
* 可用的attribute的预定义的semantic。
@@ -54,7 +55,7 @@ export type TMaterialSemanticUniforms<
5455
* 自定义的uniform的值。
5556
*/
5657
export interface IMaterialUniform {
57-
value: Texture | CubeTexture | number | number[] | SphericalHarmonics3 | Vector2 | Vector3 | Vector4 | Matrix3 | Matrix4 | Color;
58+
value: Texture | CubeTexture | number | number[] | SphericalHarmonics3 | Vector2 | Vector3 | Vector4 | Matrix3 | Matrix4 | Color | Hilo3d.TypedArray;
5859
isGlobal?: boolean;
5960
}
6061

src/Material/SkyboxMaterial.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void main()
155155
this.type = options.type;
156156
}
157157

158-
public getCustomRenderOption(options: any) {
158+
public getCustomRenderOption = (options: any) => {
159159
if (this.type === 'Cube') {
160160
options.SKYBOX_CUBE = 1;
161161
} else if (this.type === 'Panoramic') {

0 commit comments

Comments
 (0)