We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
中级任务
shader 里给 uniform 声明默认值是 glsl 非标准语法,设计之初用于方便运行时读取默认值,读取完成后再删除。
// line_vert.glsl layout(std140) uniform commonUniorm { vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; vec4 u_dash_array; vec4 u_blur; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; float u_icon_step: 100; float u_heightfixed: 0.0; float u_vertexScale: 1.0; float u_raisingHeight: 0.0; float u_strokeWidth: 0.0; float u_textureBlend; float u_line_texture; float u_linearDir: 1.0; float u_linearColor: 0; float u_time; };
将所有 shader 中默认值给删除,在对应使用 shader 的 model 中声明默认值。
比如 LineLayer 的 line model,line_frag.glsl 与 line_vert.glsl 给 uniform 声明默认值,将其删除
// packages/layers/src/line/shaders/line/line_vert.glsl layout(std140) uniform commonUniorm { - vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; + vec4 u_animate; vec4 u_dash_array; vec4 u_blur; vec4 u_sourceColor; vec4 u_targetColor; vec2 u_textSize; - float u_icon_step: 100; + float u_icon_step; ... };
删除默认值后,在对应的 model getCommonUniformsInfo 方法确保有设置默认值即可
// packages/layers/src/line/models/line.ts const commonOptions = { u_animate: this.animateOption2Array(animateOption as IAnimateOption), u_dash_array, u_blur: blur, u_sourceColor: sourceColorArr, u_targetColor: targetColorArr, u_textSize: [1024, this.iconService.canvasHeight || 128], u_icon_step: iconStep, // 是否固定高度 u_heightfixed: Number(heightfixed), // 顶点高度 scale u_vertexScale: vertexHeightScale, u_raisingHeight: Number(raisingHeight), // line border 参数 u_strokeWidth: strokeWidth, u_textureBlend: textureBlend === TextureBlend.NORMAL ? 0.0 : 1.0, u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识 u_linearDir: linearDir === LinearDir.VERTICAL ? 1.0 : 0.0, u_linearColor: useLinearColor, u_time: this.layer.getLayerAnimateTime() || 0, };
The text was updated successfully, but these errors were encountered:
heiyexing
No branches or pull requests
AntV Open Source Contribution Plan(可选)
Issue 类型
中级任务
任务介绍
shader 里给 uniform 声明默认值是 glsl 非标准语法,设计之初用于方便运行时读取默认值,读取完成后再删除。
将所有 shader 中默认值给删除,在对应使用 shader 的 model 中声明默认值。
参考说明
比如 LineLayer 的 line model,line_frag.glsl 与 line_vert.glsl 给 uniform 声明默认值,将其删除
删除默认值后,在对应的 model getCommonUniformsInfo 方法确保有设置默认值即可
The text was updated successfully, but these errors were encountered: