FinalMesh WebGL API

Main goal of FinalMesh JS framework is to provide an ability to load and preview pre-processed, compressed 3d models in WebGL enabled browser. Loading and displaying of 3d file is performed automatically, without single line of extra code. Additional customizations of viewer or manipulations with objects are possible via API, for instance:

  • switch node on/off
  • change materials
  • change view
  • animate

Objects

iv.window 3d Window/Viewport
iv.space 3d Space
iv.node 3d Node
iv.object Base 3d object class
iv.mesh 3d Mesh
iv.light 3d Light
iv.camera 3d Camera
iv.material 3d Material
mat4 3d Matrix

Tutorials and Samples

Scene Traversing

Whole scene tree may be traversed by calling node.traverse() method. In case of root node it will be view.space.root.traverse();
This method invokes callback function for each node. node and world space tm are passed as arguments.

Reference Counting

Since 3D system works with OpenGL resources code should mange OpenGL resources and destroy when they are no longer needed. For this purpose all nodes should be inserted and removed from parent with help of node.insert / node.remove or node.clear. Object should be attached or removed via node.setObject. New node has zero reference count. After insertion reference count will be 1. After removing it will reach zero and all sub nodes and objects will be destroyed. If you want to keep object or node in for future use you should call .addRef() method and call .release() when it no longer needed.

Data Loading

3D Space is loaded from files prepared by FinalMesh. This greatly improves loading speed and reduces amount of required memory on client computer. But there are importers for .STL, .AMF and few more file formats.

In this article