Skip to content
New issue

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

fix: 修复windows环境下shader字符串中的换行符导致shader替换结果错误的bug #2068

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
globals: {
"AMap": true,
"L7": true,
'AMap': true,
'L7': true,
},
env: {
browser: true,
Expand All @@ -15,9 +15,9 @@ module.exports = {
ecmaVersion: 12,
sourceType: 'module'
},
plugins: ['@typescript-eslint',"unused-imports"],
plugins: ['@typescript-eslint','unused-imports'],
rules: {
"unused-imports/no-unused-imports": "error",
'unused-imports/no-unused-imports': 'error',
'@typescript-eslint/no-loss-of-precision':0,
'@typescript-eslint/no-inferrable-types': 0,
'no-constant-condition': 0,
Expand All @@ -29,7 +29,8 @@ module.exports = {
'no-useless-catch': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-explicit-any':0,
"@typescript-eslint/no-unused-vars": 0,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-duplicate-enum-values':0,
'prefer-rest-params':0,
},
settings: {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/services/shader/ShaderModuleService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export default class ShaderModuleService implements IShaderModuleService {
// return;
// }

moduleParams.vs = moduleParams.vs.replace(/\r\n/g, '\n'); // 将所有的\r\n替换为\n
moduleParams.fs = moduleParams.fs.replace(/\r\n/g, '\n'); // 将所有的\r\n替换为\n
const { vs, fs, uniforms: declaredUniforms, inject } = moduleParams;
const { content: extractedVS, uniforms: vsUniforms } = extractUniforms(vs);
const { content: extractedFS, uniforms: fsUniforms } = extractUniforms(fs);
Expand Down
Loading