A javascript (using Canvas and WebGL if available) 3D model viewer. Uses the Three.js 3D Engine. Check out the Examples.
<script src="/javascripts/Three.js"></script>
<script src="/javascripts/plane.js"></script>
<script src="/javascripts/thingiview.js"></script>
<script>
window.onload = function() {
thingiurlbase = "/javascripts";
thingiview = new Thingiview("viewer");
thingiview.setObjectColor('#C0D8F0');
thingiview.initScene();
thingiview.loadSTL("/objects/cube.stl");
}
</script>
<div id="viewer" style="width:300px;height:300px"></div>
It's important that everything is done within window.onload.
Must be set to the path where the javascript files are located so that related scripts can be loaded dynamically.
Pass the id of the div to place the viewer into. You can set the width and height on the css for that div.
Loads the scene into the container div.
Make sure you pass the full url path to the model file you want to load. This will make an ajax call to the server to fetch it.
true or false. Show or hide the 100x100 grid plane under the object.
Sets the background color of the viewer's container.
solid or wireframe. Changes the object's material.
Yep, it sets the object's color.
true or false. This causes the object to slowly rotate around the z axis.
Possible values include: top, side, bottom, diagonal. Resets the camera view to the desired angle.
Pass a positive number to zoom the camera in or a negative number to zoom out.
Displays the text passed in a window inside the viewer with an Ok button to then hide it.