encima / encima/jsc3d

multiple stl view

Open
#52 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
HTML
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
Hello, I would like to load multiple stl files on a scene.
I also wants to set the color of each models.

I saw this issue : https://code.google.com/p/jsc3d/issues/detail?id=36
But I didn't found a working example.

Here is my code (it loads only one model) :

JSC3D Demo




It seems you are using an outdated browser that does not support canvas :-(


var canvas = document.getElementById('cv');
var viewer = new JSC3D.Viewer(canvas);

var components = ['stl/dragon.stl', 'stl/cow.stl'];
var theScene = new JSC3D.Scene;
var numOfLoaded = 0;

var onModelLoaded = function(scene) {
var meshes = scene.getChildren();
for (var i=0; i<meshes.length; i++) {
theScene.addChild(meshes[i]);
}
if (++numOfLoaded == components.length)
viewer.replaceScene(theScene);
};
for (var i=0; i<components.length; i++) {
var loader = new JSC3D.StlLoader;
loader.onload = onModelLoaded;
loader.loadFromUrl(components[i]);
}

viewer.setParameter('ModelColor', '#FF0000');
viewer.setParameter('BackgroundColor1', '#E5D7BA');
viewer.setParameter('BackgroundColor2', '#383840');
viewer.setParameter('Renderer', 'webgl');
viewer.init();
viewer.update();

Thanks a lot.
```

Original issue reported on code.google.com by `nathap...@gmail.com` on 16 Dec 2013 at 4:39

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with jsc3d.js and jsc3d.webgl.js, then trace the StlLoader and Scene usage shown in the example. Check how loaded meshes and ModelColor are currently handled, and whether per-model color is supported. Done should be demonstrated by loading both listed STL files in one scene with distinct colors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.