Skip to content

Commit

Permalink
Increase backwards compatibility to 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
brianzinn committed Oct 8, 2021
1 parent fca9a8c commit f46f4f8
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Tools/Config/config.json
Expand Up @@ -128,6 +128,7 @@
"namespace": "BABYLON.Debug"
}
],
"namedExportPathsToExclude": "Buffers/buffer",
"hiddenConsts": [
"Debug"
]
Expand Down Expand Up @@ -526,7 +527,8 @@
"babylonjs": "BABYLON",
"babylonjs-loaders": "BABYLON",
"babylonjs-serializers": "BABYLON"
}
},
"namedExportPathsToExclude": "3D/materials/fluent/fluentMaterial"
}
},
"es6": {
Expand Down
12 changes: 11 additions & 1 deletion Tools/Gulp/helpers/gulp-processAmdDeclarationToModule.js
Expand Up @@ -7,8 +7,13 @@ var processData = function(data, options) {

var str = "" + data;

console.log(data, options);

// Start process by extracting all lines.
let lines = str.split('\n');
const input = `export {.*} from ".*${options.namedExportPathsToExclude}"`;
console.log('regex input:', input);
const namedExportPathsToExcludeRegExp = options.namedExportPathsToExclude !== undefined ? new RegExp(input) : undefined;

// Let's go line by line and check if we have special folder replacements
// Replaces declare module '...'; by declare module 'babylonjs/...'; for instance
Expand Down Expand Up @@ -37,6 +42,11 @@ var processData = function(data, options) {
}
// If not Append Module Name
if (!externalModule) {
// SKIP known named exports that are for backwards compatibility
if (namedExportPathsToExcludeRegExp && namedExportPathsToExcludeRegExp.test(line)) {
line = (line.startsWith(' ')) ? ' //' + line.substr(3) : "// " + line
}

// Declaration
line = line.replace(/declare module "/g, `declare module "${moduleName}/`);
// From
Expand All @@ -60,7 +70,7 @@ var processData = function(data, options) {
line = `${spaces}readonly ${name}: boolean;`;
}
else if (value.startsWith('"')) {
line = `${spaces}readonly ${name}: string;`;
line = `${spaces}readonly ${name}: string;`;
}
else {
line = `${spaces}readonly ${name}: number;`;
Expand Down
2 changes: 1 addition & 1 deletion dist/preview release/what's new.md
Expand Up @@ -333,7 +333,7 @@
- `SkeletonViewer` is now enabled by default ([Deltakosh](https://github.com/deltakosh))
- `BindEyePosition` has been moved from `Material` to `Scene` to avoid a circular dependency problem and is now a non-static method (`bindEyePosition`) ([Popov72](https://github.com/Popov72))
- The depth renderer was not generating correct values for orthographic cameras when **storeNonLinearDepth = false** ([Popov72](https://github.com/Popov72))
- `dataBuffer.ts` and `buffer.ts` have been moved from `Meshes/` to `Buffers/` ([Popov72](https://github.com/Popov72))
- `dataBuffer.ts` has been moved from `Meshes/` to `Buffers/` ([Popov72](https://github.com/Popov72))
- By default, the glTF loader now uses sRGB buffers for gamma encoded textures (when supported by the GPU), which is more accurate than using regular buffers. However, it can lead to small visual differences. You can disable usage of sRGB buffers by setting `glTFFileLoader.useSRGBBuffers` to `false` ([Popov72](https://github.com/Popov72))
- 4th (`isAnimationSheetEnabled`) and 5th (`customEffect`) parameters of `GPUParticleSystem` constructor have been inverted to match `ParticleSystem` constructor ([Popov72](https://github.com/Popov72))
- `PBRSubSurfaceConfiguration.useGltfStyleThicknessTexture` has been renamed to `PBRSubSurfaceConfiguration.useGltfStyleTextures` ([Popov72](https://github.com/Popov72))
Expand Down
4 changes: 4 additions & 0 deletions gui/src/3D/materials/fluentMaterial.ts
@@ -0,0 +1,4 @@
/**
* This is here for backwards compatibility with 4.2
*/
export { FluentMaterial } from './fluent/fluentMaterial';
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -105,7 +105,7 @@
"ts-node": "^9.1.1",
"tslib": "^2.3.1",
"tslint": "^6.1.2",
"typedoc": "^0.17.7",
"typedoc": "^0.19.0",
"typescript": "^4.4.2",
"webpack": "~4.46.0",
"webpack-bundle-analyzer": "^4.4.0",
Expand All @@ -115,4 +115,4 @@
"xmlbuilder": "15.1.1"
},
"dependencies": {}
}
}
5 changes: 5 additions & 0 deletions src/Meshes/buffer.ts
@@ -0,0 +1,5 @@
/**
* This is here for backwards compatibility with 4.2
* @hidden
*/
export { VertexBuffer, Buffer } from '../Buffers/buffer';

0 comments on commit f46f4f8

Please sign in to comment.