|
1 | | -# VTK.wasm from the JavaScript side |
| 1 | +# VTK.wasm from JavaScript |
2 | 2 |
|
3 | | -While VTK is a comprehensive C++ library, WASM is giving us an opportunity to enable it on servers and clients like your browser. |
| 3 | +This guide focuses on using the VTK WASM bundle from plain JavaScript, requiring no prior C++ knowledge. |
4 | 4 |
|
5 | | -In this guide we will focus on how WASM can be used from plain JavaScript without any C++ knowledge and using the WASM bundle generated for our trame needs. |
| 5 | +## Overview |
| 6 | +Most C++ classes from the [VTK C++ Documentation](https://vtk.org/doc/nightly/html/) are available through a single JavaScript object, which we refer to as the **vtk** namespace. |
6 | 7 |
|
7 | | -## Available environment |
| 8 | +Once you have access to the **vtk** namespace (see [Bundler Integration](./bundler.md)), you can interact with VTK classes using standard JavaScript. |
8 | 9 |
|
9 | | -Web development has many faces between ESM, UMD and plain script usage. Each path is different to some extent so we will cover each of them in their own guide. |
| 10 | +## The Why |
10 | 11 |
|
11 | | -- Plain JavaScript usage |
12 | | -- Using modern bundler |
| 12 | +VTK is a powerful library with a somewhat steep learning curve, but VTK.wasm allows you to use VTK without needing to learn C++. This can be particularly beneficial for web developers who are already familiar with JavaScript and want to integrate advanced visualization capabilities into their web applications. |
13 | 13 |
|
14 | | -## What does it looks like? |
15 | | - |
16 | | -Since our WASM bundle is based on our trame needs, it currently mainly focus on the rendering stack (PolyData, Mappers and Actors...) but we plan to extend it with more VTK class coverage down the road. |
17 | | - |
18 | | -So if we ignore how to get your hand on a __vtk__ namespace (see section above), you will be able to write code like below to interact with the available VTK classes in plain JavaScript. |
19 | | - |
20 | | -<<< ../../public/demo/example.js |
21 | | - |
22 | | -Result: |
23 | | - |
24 | | -<iframe src="/vtk-wasm/demo/plain-javascript.html" style="width: 100%; height: 40vh; border: none;"></iframe> |
| 14 | +The following sections will guide you through the essential aspects of using VTK.wasm with JavaScript: |
25 | 15 |
|
| 16 | +- [Working With Objects](./objects.md) |
| 17 | +- [Observers](./observers.md) |
| 18 | +- [HTML Script Tag](./plain.md) |
| 19 | +- [Bundler Integration](./bundler.md) |
0 commit comments