Mesh Questions

sign up sign in

I'm still tinkering with snowkit, thinking about using it for the ld48 game jam in a week or so... had some questions about the Mesh class. I realize the 3d stuff is still very much in development, so this might not work at all, and that's fine.

First question, is there a way to create a few copies of a mesh that share the same Geometry but have a different transform?

//create the mesh
    var tex = Luxe.loadTexture('assets/simpletex.png');     
    tex.clamp = repeat;    
    tex.filter = nearest;
    mesh = new Mesh({ file:'assets/cube_bevel.obj', texture: tex });

    // works -- load another copy
mesh2 = new Mesh({ file:'assets/cube_bevel.obj', texture: tex });

// doesn't work
    // mesh2 = new Mesh( { geometry: mesh.geometry, texture : tex });
    mesh2.pos.set_xyz( 3.0, 1.5, -4.0 );

They don't need to be real instances, what I'm doing is simple enough that the drawing could be a separate copy, I just don't want to take the hit on loading/parsing 100 identical objects...

Second question, related... I'm loading a mesh from an OBJ file, it's not huge, about 1500 faces, 178k file . Works fine in the mac target, but the web target I get chrome or FF killing the page because it's unresponsive. Looking at where it stops in FF, it looks like it's in platform.ByteArray.writeUTFBytes(), I tried using Parcel, or trying other ways to make it more async, but that didn't seem to help.

You should be able to see the problem by replacing the tower.obj in the Mesh example with this one:
https://www.dropbox.com/s/yncxiyql0jvcvin/player.obj?dl=0

Despite these little problems, overall, I'm pretty impressed with it. I'm already able to build a scene, load custom shaders, and even use the render-to-texture to apply full screen effects, and then draw all the 2d menus and hud stuff with the 2d engine.

thanks again!
Joel

Tags
luxemesh3d