Skip to content

Commit 15b9f75

Browse files
committed
clarify in the output file that it is the user the responsable for loading the textures used
1 parent 2dcd64b commit 15b9f75

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/export/Script.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,27 @@ export class Script {
161161
//
162162
// uniforms
163163
//
164-
output += "\n" + exportKeyword + " const $uniforms = {\n" +
165-
this.uniforms.map( uniform => `${uniform[0]} : uniform( ${uniform[2]} )`).join(",")
166-
+"\n}\n";
164+
if( this.uniforms.length )
165+
{
166+
output += "\n" + exportKeyword + " const $uniforms = {\n" +
167+
this.uniforms.map( uniform => `${uniform[0]} : uniform( ${uniform[2]} )`).join(",")
168+
+"\n}\n";
169+
}
170+
167171

168172
//
169173
// image loaders...
170174
//
171175
if( this.imagePaths.length )
172176
{
177+
output += `
178+
/**
179+
* --- IMAGE LOADING: README!! ---
180+
* You are responsable for loading the textures. You must import and call "setCustomImageLoader" that function will recieve
181+
* the URL of the image it wants to load. You must return a THREE.Texture instance.
182+
*/
183+
`;
184+
173185
//
174186
// utility function to load the texture...
175187
//
@@ -181,7 +193,7 @@ let onImageError = (url, err)=>console.error( "Failed to load: "+url, err );
181193
* @param {(failedUrl:string, error:unknown)=>void customErrorHandler}
182194
* @returns
183195
*/
184-
${exportKeyword} const setCustomImageErrorHanlder = ( customErrorHandler )=>onImageError=customErrorHandler;
196+
${exportKeyword} const setCustomImageErrorHandler = ( customErrorHandler )=>onImageError=customErrorHandler;
185197
186198
let loadTexture = (url, mimeType, onLoaded) => {
187199
if (mimeType.includes("exr")) {

0 commit comments

Comments
 (0)