3D Part Preview added to Parts Tracker


RE: 3D Part Preview added to Parts Tracker
#35
(2019-07-18, 6:42)Lasse Deleuran Wrote: The following should cover that scenario:

Code:
      // Half-Harlequin-mode:       var acceptedColors = [1, 2, 4, 5, 13, 14, 19, 22, 25, 27, 69, 71, 72, 73, 74, 77, 288, 308, 484];       THREE.LDRStep.prototype.addSubModel = function(subModel) {         subModel.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)];         this.subModels.push(subModel);       }       LDR.LDRGeometry.prototype.fromPartType = function(loader, pt) {         loader.getMainModel().IS_MAIN_MODEL = true;         let geometries = [];         if(pt.steps.length === 0) {           console.warn("No steps in " + pt.ID);           return; // Empty - just make empty.         }         if(pt.IS_MAIN_MODEL) { // Harlequin the triangles and quads:           pt.steps.forEach(step => {             step.quads.forEach(quad => quad.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)]);             step.triangles.forEach(triangle => triangle.colorID = acceptedColors[Math.floor(Math.random() * acceptedColors.length)]);           });         }         pt.steps.forEach(step => {             let g = new LDR.LDRGeometry();             g.fromStep(loader, step);             geometries.push(g);         });         this.replaceWith(LDR.mergeGeometries(geometries));       }

It took me a bit longer to come up with this solution that I would like to admit! Big Grin

I've implemented this but the rendering has errors:


.png   test.png (Size: 23.05 KB / Downloads: 702)
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: 3D Part Preview added to Parts Tracker - by Orion Pobursky - 2019-07-18, 22:38

Forum Jump:


Users browsing this thread: 1 Guest(s)