Jump to content

hw3web
 Share

Recommended Posts

Hi there

 

I try to load babylon file from STRING, 

 

I found : BABYLON.SceneLoader.Load("", "data:...", engine, function (newScene) { });

 

on : http://doc.babylonjs.com/exporters/Working_with_Blender

 

but it just don't show model , even if it is only box .

 

I am interested can I put something like 

var scenetexture = "data:image/png;base64,iVBORw0KGgo ...";

var scenebabylon = "data:{ .......}";

 

BABYLON.SceneLoader.Load(scenetexture, scenebabylon, engine, function (newScene) { });

 

 

and fallowing question if that possible , can we use more then one texture in string as texture for model in babylon scene ??

 

Regards

 

Link to comment
Share on other sites

Your error is that the way the SceneLoader.Load() function should not receive a picture "scenetexture" but a path where this file .babylon is.

Then load this file .babylon to find images. but if it does not exist (the images) the scene returns an error.

 

I think your method to load the scene on the playground, is not a good method.

Link to comment
Share on other sites

Hi there

 

that is a reasons why I put this topic on: to ask if anyone know how to load scene from string not file that was suggest on : 

http://doc.babylonjs.com/exporters/Working_with_Blender

 

I know is not working 

 

but I tried use structure 

BABYLON.SceneLoader.Load("", "data:...", engine, function (newScene) { });

 

I try to get it to work

 

 

so is there anyone who will be able to solve this miss use loading 

Link to comment
Share on other sites

Hi,
 
Sorry, I did not watch the first post
 
I do not think the playground it may be possible models with textures from external link.
maybe manually adding external links in babylon file. and add an http link in the playground. maybe it could work.
 

BABYLON.SceneLoader.Load("http://www.link.com/folderMeshAndTextures/", "mesh.babylon", engine, function (newScene) { });
Link to comment
Share on other sites

I really do not understand what you try to do.

 

here:

BABYLON.SceneLoader.Load("", scenelink, engine, function (newscene) {

 

You load a file name is path. and in the way you leave blank

 

The first parameter of the Load function is not a name like ImportMesh function but with a path to the file szene.

 

BABYLON.SceneLoader.Load("path", "file.babylon",

 

BABYLON.SceneLoader.ImportMesh("name", "path",  "file.babylon",

Link to comment
Share on other sites

What I try to do is load scene and texture from browser storage not server if that make any sense .

 

to be able to do this I  need have texture(s) and scene in string not as files 

 

 

So I have all in strings texture(s) and scene in string value and now I try load it on stage.

Link to comment
Share on other sites

Try to look at here:

https://github.com/BabylonJS/Babylon.js/blob/1f3b216f2e91117c9876e634de24b99764f19654/src/Loading/babylon.sceneLoader.ts#L32

 

On that file you can also look at the declaration of Load. Seems like the loader is plugin based, and depends on the extension of the filename.

 

Anyway you can create your own loader plugin like this:
 

here https://github.com/BabylonJS/Babylon.js/blob/1f3b216f2e91117c9876e634de24b99764f19654/src/Loading/Plugins/babylon.babylonFileLoader.ts#L1351

 

Hope that helps.

Link to comment
Share on other sites

I found problem if I want to use

 

 BABYLON.SceneLoader.Load 

 

and scene is string 

 

data:{ ..... works when I want load via

 

 BABYLON.SceneLoader.ImportMesh("name", "path",  "data: { ...} ",

 

bat not with Load as full scene - I am not sure why ???

 

Anyone any idea ??

 

I even try file: 

Link to comment
Share on other sites

Sounds better :)

 

The error is because the playground checks if the returned scene contains a camera and in your case there is no returned scene so a default one is created with no camera. Your scene is only created when the file is loaded. So just do not take care of this message

 

For the texture, as there is no extension due to string loading, you have to manually get the texture once loaded and set hasAlpha = true

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...