create3000 / cobweb

Cobweb is now X_ITE
https://github.com/create3000/x_ite
Other
10 stars 5 forks source link

Data URI support #2

Closed andreasplesch closed 8 years ago

andreasplesch commented 9 years ago

The X3D tag expects an url attribute for the content of the x3d scene. Are data uri's supported as an url for in place x3d content ?

create3000 commented 9 years ago

Yes Andreas, we work hard on data url support eiter for ImageTexture, where it is extremely important or on all other url fields. For now please use the url attribute in a more normal way.

Best regards, and greetings Holger

Am 18.11.2015 um 14:28 schrieb Andreas Plesch:

The X3D tag expects an url attribute for the content of the x3d scene. Are data uri's supported as an url for in place x3d content ?

— Reply to this email directly or view it on GitHub https://github.com/create3000/cobweb/issues/2.

Holger Seelig Mediengestalter Digital – Digital Media Designer

Scheffelstraße 31a 04277 Leipzig Germany

Cellular: +49 1577 147 26 11 E-Mail: holger.seelig@yahoo.de Web: http://titania.create3000.de

Future to the fantasy ★ ★

andreasplesch commented 9 years ago

Thanks. It looks like XMLHttpRequest2 via $.ajax() should support data urls, perhaps after setting some response headers but perhaps browsers do not implement this. I just wanted an easy way to get "live" x3d content into the x3d browser and will look now into createX3DfromString() usage.

create3000 commented 9 years ago

Yes, you can use createX3DfromString. But keep in mind, external browser interaction is still rudimentary. And if you wanna do this have a look at the »cobweb.html« to see how to get the external browser.

andreasplesch commented 9 years ago

Yes, that is exactly what I did for https://github.com/andreasplesch/Library/blob/gh-pages/Viewer/index.html

One issue for users to be aware of is that the X3D object is not available for (external) javascripts early in the page loading. Not sure when the X3D object is created and becomes available.

create3000 commented 9 years ago

Yes: The X3D object is always available, but it expects at least on function handler that is called when the X3D tags are ready, or the second function handler is called if not.

X3D (callback[, errorCallback]); 

The callback function is called when the browser is available onto the X3D tags. The callback function takes on argument elements, that holds all X3D tags;

function callback (elements)

The elements can than be used to access the browser of an X3D tag as follow:

X3D (function (elements)
{
   var browser = X3D .getBrowser (elements);
   var nodes = new X3D .MFNode ();
});
create3000 commented 9 years ago

If you want access to a specific browser:

X3D (function (elements)
{
   var browser = X3D .getBrowser (elements [0]);
});
create3000 commented 9 years ago

If something went wrong, the error callback is called:

X3D (function (elements)
{
   var browser = X3D .getBrowser (elements);
},
function (elements)
{
   // No browser
});
create3000 commented 8 years ago

Fix committed for data uri support.

andreasplesch commented 8 years ago

Thanks ! Here is the commit SHA for reference: 2072d41f0411c44358cbbbaecd1852a52f4476ea

smash.x3d exercises loading a data uri for Inline. I may try it for the x3d element as well. Should it also work for ImageTexture urls ?

create3000 commented 8 years ago

If you want you can also take a try for ImageTexture as well as AudioClip.

create3000 commented 8 years ago

And well, you can even try MovieTexture.

andreasplesch commented 8 years ago

Hm, I could not get this data uri of an apple png to work:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Interchange' version='3.0'  xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' http://www.web3d.org/specifications/x3d-3.0.xsd '>
<head>
<meta name='identifier' content=' http://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/ImageTexture/256jpg.x3d '/>
</head>
<Scene>
<NavigationInfo type='"EXAMINE" "WALK" "FLY" "ANY"'/>
<Shape>
<Appearance>
<ImageTexture
  url=' "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAulBMVEUAAADMzDP/zGb/1FW/vz9Uf1Tl5Vnn3Fzr4Vro31mYbkjOw0vOw0xRelFsolzj11Tq4Vrq4VfNwk3LwU3WzlCJd0vq4Flro13FrFLq4Fjq4Fjq4Vjq4Vno4Vns4mvp4Vdwm1hejVPSyVDw6Ybf11Zqnltfj1bTx1Daz1PSxlCfkkClkz7o3FbQw0/q4VfLwE7Ow0/q31fNwk78/PTq31no4WHq31fNwU7r42nLwE7p4Vnn3lZso13q4VmSX1atAAAAPHRSTlMABQUGCBIUFjM5Q0RJS1BUVVdcX19iZG1vfIeIiZGYm5yisbK6u8DBwcLDxMjKz9HR0tPT1Nrd6Ojq+f2VfTqfAAAAeElEQVQYGVXBhRaCQBQFwKsYGNiFhS0WduL9/9/yPBbWszNQll2Ypt8KDM5qUoQh28afVR+41Z7br6URyc9JbnckgxzE+MqEB3F/MfGAuFELIEbUhhAFajYie8bOUFofKh0omVlIsUghVj7564O/KUFrvo+XZwPiB0IqGTjXsgzbAAAAAElFTkSuQmCC" '
   />
</Appearance>
<Box/>
</Shape>
</Scene>
</X3D>

I used this cobweb.min.js

https://cdn.rawgit.com/create3000/cobweb/153295feaba657fa4467bdabb4b624cd3fff7c5e/cobweb.js/cobweb.min.js

which seemed to be the lastest one.

The scene should look like this: stabilebssa14_fig8

create3000 commented 8 years ago

Well I can really reproduce this! But cannot see a bite within the apple. Besides this ImageTexture, AudioClip and MovieTexture data url support should work out of the box and any issue should be forwarded to Mozilla as Cobweb only uses the <-img-> <-sound-> and <-video-> tag that comes with HTML5. More important is to see data url work in Inline and the X3D tag itself.

create3000 commented 8 years ago

No, https://rawgit.com/create3000/cobweb/master/cobweb.js/cobweb.min.js is indeed the absolutely latest version (development-test-version) and should now indeed really fix the so called »Star Wars Issue«.

andreasplesch commented 8 years ago

Ok, it works with the latest master branch version.

create3000 commented 8 years ago

And what is not so obvious data url should work within scripting Browser.loadURL and Browser,createX3DFromURL what is not always easy to test.

coderextreme commented 8 years ago

I'm trying to figure out why the cobwebWindow.X3D attribute is undefined in this code the first time through.

// HTML5 with iframe reference to cobwebframe.html

<!— snip —>

    var content = $('textarea#xml').val();
    var cobwebWindow = document.getElementById("cobwebframe").contentWindow ;
    var cobwebEle = cobwebWindow.document.getElementById("x3dele");
    if (typeof cobwebWindow.X3D !== 'undefined') {
        var browser = cobwebWindow.X3D.getBrowser(cobwebEle);
        browser.replaceWorld(browser.createX3DFromString(content));
    } else {
        console.error("Cobweb disabled.  Use Firefox.");
    }

———— cobwebframe.html ———— <!DOCTYPE html>

Cobweb Iframe loader

Your browser may not support all features required by Cobweb!

create3000 commented 8 years ago

The X3D element is first really accessable after the page is completely loaded. To ensure this use the following construct.

X3D (function (dom) { var Browser = X3D .getBrowser (dom); ... });

Am 09.01.2016 um 23:46 schrieb John Carlson:

I'm trying to figure out why the X3D attribute is undefined in this code:

// HTML5 with iframe reference to cobwebframe.html

<!— snip —>

|var content = $('textarea#xml').val(); var cobwebWindow = document.getElementById("cobwebframe").contentWindow ; var cobwebEle = cobwebWindow.document.getElementById("x3dele"); if (typeof cobwebWindow.X3D !== 'undefined') { var browser = cobwebWindow.X3D.getBrowser(cobwebEle); browser.replaceWorld(browser.createX3DFromString(content)); } else { console.error("Cobweb disabled. Use Firefox."); } |

———— cobwebframe.html ———— <!DOCTYPE html>

Cobweb Iframe loader


X3D {
width: 192px;
height:108px;
}

body {
margin:0px;
padding:0px;
}

Your browser may not support all features required by Cobweb!

— Reply to this email directly or view it on GitHub https://github.com/create3000/cobweb/issues/2#issuecomment-170288880.

Holger Seelig Mediengestalter Digital – Digital Media Designer

Scheffelstraße 31a 04277 Leipzig Germany

Cellular: +49 1577 147 26 11 E-Mail: holger.seelig@create3000.de Web: http://titania.create3000.de

Future to the fantasy ★ ★

coderextreme commented 8 years ago

This didn’t work for me. I am calling Cobweb in an iframe.

Thanks,

John

On Feb 19, 2016, at 11:58 AM, Holger Seelig notifications@github.com wrote:

The X3D element is first really accessable after the page is completely loaded. To ensure this use the following construct.

X3D (function (dom) { var Browser = X3D .getBrowser (dom); ... });

Am 09.01.2016 um 23:46 schrieb John Carlson:

I'm trying to figure out why the X3D attribute is undefined in this code:

// HTML5 with iframe reference to cobwebframe.html

<!— snip —>

|var content = $('textarea#xml').val(); var cobwebWindow = document.getElementById("cobwebframe").contentWindow ; var cobwebEle = cobwebWindow.document.getElementById("x3dele"); if (typeof cobwebWindow.X3D !== 'undefined') { var browser = cobwebWindow.X3D.getBrowser(cobwebEle); browser.replaceWorld(browser.createX3DFromString(content)); } else { console.error("Cobweb disabled. Use Firefox."); } |

———— cobwebframe.html ———— <!DOCTYPE html>

Cobweb Iframe loader


X3D {
width: 192px;
height:108px;
}

body {
margin:0px;
padding:0px;
}

Your browser may not support all features required by Cobweb!

— Reply to this email directly or view it on GitHub https://github.com/create3000/cobweb/issues/2#issuecomment-170288880.

Holger Seelig Mediengestalter Digital – Digital Media Designer

Scheffelstraße 31a 04277 Leipzig Germany

Cellular: +49 1577 147 26 11 E-Mail: holger.seelig@create3000.de Web: http://titania.create3000.de

Future to the fantasy ★ ★ — Reply to this email directly or view it on GitHub https://github.com/create3000/cobweb/issues/2#issuecomment-186302825.