Skip to content

Commit 2dcd64b

Browse files
committed
if the texture doesn't use mipmaps then use the same settings as the magFilter
1 parent d96db5d commit 2dcd64b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/export/Script.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ let onImageError = (url, err)=>console.error( "Failed to load: "+url, err );
178178
179179
/**
180180
* If an image fails to load this will be called...
181-
* @param {(failedUrl:string, error:unknown)=>void customErrorHandler
181+
* @param {(failedUrl:string, error:unknown)=>void customErrorHandler}
182182
* @returns
183183
*/
184184
${exportKeyword} const setCustomImageErrorHanlder = ( customErrorHandler )=>onImageError=customErrorHandler;
@@ -201,16 +201,20 @@ let loadTexture = (url, mimeType, onLoaded) => {
201201
* @returns
202202
*/
203203
${exportKeyword} const setCustomImageLoader = ( customLoader )=>loadTexture=customLoader;
204-
`;
204+
205+
/**
206+
* These are the image textures used by your node setup...
207+
*/
208+
`;
205209

206210
//
207211
// for each used texture...
208212
//
209213
this.imagePaths.forEach( ([ path, mime, previewUrl, setupTexture ], index)=>{
210214

211215
output += `
212-
const texture${ index } = loadTexture('${ forExport? path : previewUrl }', '${mime}'${ setupTexture? `, texture => { ${setupTexture(`texture`)} }` :"" });`;
213-
216+
const texture${ index } = loadTexture('${ forExport? path : previewUrl }', '${mime}'${ setupTexture? `, texture => { ${setupTexture(`texture`)} }` :"" });
217+
`;
214218
});
215219
}
216220

src/properties/TextureInterpolationProperty.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export class TextureInterpolationProperty extends ComboBoxProperty {
1515
returnTextureSetupJs( textureName:string ) {
1616

1717
return `
18-
${ textureName}.magFilter = ${ this.value.includes(".Linear")? this.modes[0][0] : this.modes[1][0] };
19-
${ textureName}.minFilter = ${ this.value };
18+
${ textureName}.magFilter = ${ this.value.includes(".Linear")? this.modes[1][0] : this.modes[0][0] };
19+
${ textureName}.minFilter = ${textureName}.generateMipmaps? ${ this.value } : ${ textureName}.magFilter;
2020
`;
2121
}
2222
}

0 commit comments

Comments
 (0)