LDraw.org Discussion Forums

Full Version: WebGL renderer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Of course it is, that's why i made it Smile
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.
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.
WOW; that would be AWESOME...

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

imagine a 3D object there, interacting with your mouse...
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.ph...&part=3005

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

Rolf
This is in the works. I just want to make sure it "fails gracefully" on unsupported browsers/hardware
YAY! hurray!
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?
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
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.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16