| |

Molsoft ActiveIcm for JavaScript (IcmJS) technical manual


Introduction to the Molsoft IcmJS

| IcmJS Webinar Recording |
IcmJS (Formerly known as ActiveIcmJS) is a JavaScript/HTML5 version of the ActiveICM plugin. Since early 2015 Chrome no longer supports NPAPI plugins because of security and compatibility issues (other browsers may follow too) Molsoft released JavaScript/HTML5 version which does not require any plugin or browser extension and runs inside any modern browser. It uses low-level subset of JavaScript (asm.js) technology which runs extremely fast (only 2-4 times slower than native code).

This makes it a perfect tool for data sharing and publishing.

Quick Start

The simplest way to embed a 3D object into your web page is shown in the HTML code below: There are three basic steps:

  1. include IcmJS source code.
  2. create container element (usually 'div')
  3. create JavaScript function with special name 'onLoadActiveIcm' where initialization code needs to be placed.


<html>
<head>
<script src="lib/acticm.js"> </script>
</head>

<body>
<h2>IcmJS Demo Page</h2>

<div id="con" style="width: 800px; height: 600px; border: 2px solid #ABABAB">
</div>

<script>
function onLoadActiveIcm()
{
act = new ActiveIcmJS("con");
act.projectFile = "myproject.icb"; // or pdb, mol
}

</script>
</body>
</html>

Technology

We use emscripten compiler to compile C/C++ code into highly optimizable, low-level subset of JavaScript called asm.js. Most modern browsers will recognize asm.js, compile, optimize and run at near native speed.

Another part was to port OpenGL calls into WebGL subset. We implemented efficient run-time layer which translates normal OpenGL functions into WebGL compatible calls. That allows us to keep the same code-base and bring highest quality 3D graphics inside the browser almost without any restrictions.

JavaScript API

Module.ActiveIcm object

Module.ActiveIcm is a JavaScript object which implements single ICM shell and graphics window. You may have multiple IcmJS object on the same web page.

Methods:

Properties: