LDraw.org Discussion Forums
WebGL renderer - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html)
+--- Thread: WebGL renderer (/thread-6835.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16


Re: WebGL renderer - Nicola - 2013-08-21

Of course it is, that's why i made it Smile


Re: WebGL renderer - Willy Tschager - 2013-08-30

Question is: Is there a way to use it here on the forums in some ways? For example generating pics of models or parts people just submit as .ldr or .dat and a pic of the content is added to the post?

w.


Re: WebGL renderer - Nicola - 2013-08-30

Yes, that shouldn't be hard. What you need to run it is loading the part library to some folder on the same origin as the page running it. I think Ldraw should already have it avaiable. The rest is standard javascript fiddling (include JS files, add some snippet of code, etc).

Here's a more detailed howto.

You can take a look at the simplest example here.
Rebrickable is also using brigl on their part detail page.


Re: WebGL renderer - Steffen - 2013-08-30

WOW; that would be AWESOME...

EVEN the parts tracker could show the PARTS this way...

imagine a 3D object there, interacting with your mouse...


Re: WebGL renderer - Rolf Osterthun - 2013-09-12

Hey Nicola,

indeed, the LDraw site should have the complete library online (can somebody confirm that?).
I think the biggest challange is, that your renderer needs the complete library in a special
folder structure (one folder or your suggested subfolder structure).

I have almost no skills in JavaScript, but I had a closer look into your code, tried some
changes and used copy and past to generate the following code snippet (the paths are
hardcoded):

Code:
asyncReq: function(partName, callback)
{
  var purl = "../parts/"+partName;
  purl = purl.replace(/\\/gi,"/");
  this.asyncnum++;
  new Ajax.Request(purl, {
    method:'get',

    onSuccess: (function(transport) {
      var res = transport.responseText;
      this.asyncnum--;
      callback(res);
    }).bind(this),

    onFailure: (function() {
      purl = "../p/"+partName;
      new Ajax.Request(purl, {
        method:'get',
        
        onSuccess: (function(transport) {
          var res = transport.responseText;
          this.asyncnum--;
          callback(res);
        }).bind(this),
  
        onFailure: (function() {
          this.asyncnum--;
          alert( 'Something went wrong loading: '+purl);
        }).bind(this)
      });
    }).bind(this)
  });
},

Due to my missing knowledge of JavaSkript, I have no idea if my code causes deadlocks or
dead threads or ... whatever. But it seems to work with the standart folder structure: http://www.digital-bricks.de/en/index.php?site=3d&part=3005

I would really like to see your Brigl renderer used at the parts tracker and / or in this forum.

Rolf


Re: WebGL renderer - Orion Pobursky - 2013-09-12

This is in the works. I just want to make sure it "fails gracefully" on unsupported browsers/hardware


Re: WebGL renderer - Steffen - 2013-09-14

YAY! hurray!


Re: WebGL renderer - Orion Pobursky - 2013-09-18

I'm having trouble implementing the viewer.
Everything seems to be working fine. The log messages are displaying but the viewer doesn't appear.

I think this might be a file path issue. I'm using:
Code:
var builder = new BRIGL.Builder("parts/",{dontUseSubfolders:true});

What should the library path I pass to the viewer be relative to? The html file containing the viewer code? Absolute for the webserver?


Re: WebGL renderer - Rolf Osterthun - 2013-09-19

Hey Orion,

for the digital-bricks.de website, I use the following line:

Code:
var builder = new BRIGL.Builder("../parts/", {dontUseSubfolders:"true"});

I use the relative path from the html file containing the viewer code. When your parts folder and this file are in the same folder you may try "./parts/".

Rolf


Re: WebGL renderer - Orion Pobursky - 2013-09-19

Ok. It was a path and permissions problem with my local server. Hopefully I fixed it and can have this up soon on the forums.