Skip to content

Commit

Permalink
Add an option to disable bilinear filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Popov72 committed Dec 24, 2022
1 parent 15529f2 commit 67a0a57
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion babylonJS/public/dist/trn_babylon.js
Original file line number Diff line number Diff line change
Expand Up @@ -12520,8 +12520,9 @@ var SceneParser = /** @class */ (function () {
this.tscene.setCamera(new _Camera__WEBPACK_IMPORTED_MODULE_1__["default"](camera));
};
SceneParser.prototype.createTextures = function () {
var noInterpolation = document.location.href ? document.location.href.indexOf("nobilinear") !== -1 : false;
for (var t = 0; t < this.json.textures.length; ++t) {
var texture = this.json.textures[t], image = this.getImage(texture.image), tex = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("data:" + texture.uuid, this.scene, true, false, babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"].BILINEAR_SAMPLINGMODE, null, null, image.url);
var texture = this.json.textures[t], image = this.getImage(texture.image), tex = new babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"]("data:" + texture.uuid, this.scene, noInterpolation, false, noInterpolation ? babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"].NEAREST_SAMPLINGMODE : babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"].TRILINEAR_SAMPLINGMODE, null, null, image.url);
tex.wrapU = tex.wrapV = babylonjs__WEBPACK_IMPORTED_MODULE_0__["Texture"].CLAMP_ADDRESSMODE;
tex.hasAlpha = true;
this.textures.push(tex);
Expand Down
2 changes: 1 addition & 1 deletion babylonJS/public/dist/trn_babylon.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions babylonJS/src/SceneParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,16 @@ export default class SceneParser {
}

private createTextures(): void {
const noInterpolation = document.location.href ? document.location.href.indexOf("nobilinear") !== -1 : false;
for (let t = 0; t < this.json.textures.length; ++t) {
const texture = this.json.textures[t],
image = this.getImage(texture.image),
tex = new Texture(
"data:" + texture.uuid,
this.scene,
true,
noInterpolation,
false,
Texture.BILINEAR_SAMPLINGMODE,
noInterpolation ? Texture.NEAREST_SAMPLINGMODE : Texture.TRILINEAR_SAMPLINGMODE,
null, null,
image.url
);
Expand Down

0 comments on commit 67a0a57

Please sign in to comment.