x_ite
TypeScript icon, indicating that this package has built-in type declarations

11.6.0 • Public • Published

X_ITE X3D Browser

npm Version Build Size jsDelivr Hits npm Downloads DeepScan grade

Introduction

X_ITE is a comprehensive 3D library entirely written in JavaScript and uses WebGL for 3D rendering. Authors can publish X3D, VRML, glTF and other 3D file formats online within an HTML5 page with X_ITE that works with web browsers without prior plug-in installation. Since X3D is backwardly compatible, X_ITE can also be used as a VRML viewer.

🚀 For more information and a live preview, please visit our home page.

Funding

X_ITE needs your support. If you become a Patreon, we can improve X_ITE even better, or simply subscribe to receive the latest news.

Quick Links

Using X_ITE with a CDN

Using a CDN improves website performance, reliability, and security by caching content closer to users, distributing traffic loads, and providing protection against attacks.

If you are going to use X_ITE in a production environment, you should use a fixed version of X_ITE. You can get a list of all available versions here on npm.

jsDelivr CDN

jsDelivr is an open-source content delivery network (CDN) renowned for its no-cost access, swift performance, and reliable service.

<script defer src="https://cdn.jsdelivr.net/npm/x_ite@11.6.0/dist/x_ite.min.js"></script>
<!-- or as ES module for use in scripts -->
<script type="module">
import X3D from "https://cdn.jsdelivr.net/npm/x_ite@11.6.0/dist/x_ite.min.mjs";
</script>

Info: It is no longer necessary to include the CSS file.

Get it from NPM

To install, use the following command:

$ npm install x_ite

Maybe you are curious now how to use X_ITE with Electron?

Also try x_ite-node, a pure Node.js version, without any dependencies on Electron or any browser. Suitable for just reading 3D files, analyzing, processing and generating X3D.

$ npm install x_ite-node

Usage

This script initializes an X3D canvas within an HTML page, configuring it to contain a scene, a camera and a geometric cube with default material properties. It then animates the rotation of the cube within the scene, ensuring that the camera captures the dynamic action.

Declarative Syntax

<script defer src="https://cdn.jsdelivr.net/npm/x_ite@11.6.0/dist/x_ite.min.js"></script>
<x3d-canvas update="auto" contentScale="auto">
  <X3D profile='Interchange' version='4.0'>
    <head>
      <unit category='angle' name='degree' conversionFactor='0.017453292519943295'></unit>
    </head>
    <Scene>
      <Viewpoint
          description='Initial View'
          position='2.869677 3.854335 8.769781'
          orientation='-0.7765887 0.6177187 0.1238285 28.9476440862198'></Viewpoint>
      <Transform DEF='Box'
          rotation='0 1 0 0'>
        <Shape>
          <Appearance>
            <Material></Material>
          </Appearance>
          <Box></Box>
        </Shape>
      </Transform>
      <TimeSensor DEF='Timer'
          cycleInterval='10'
          loop='true'></TimeSensor>
      <OrientationInterpolator DEF='Rotor'
          key='0, 0.25, 0.5, 0.75, 1'
          keyValue='0 1 0 0, 0 1 0 90, 0 1 0 180, 0 1 0 270, 0 1 0 0'></OrientationInterpolator>
      <ROUTE fromNode='Timer' fromField='fraction_changed' toNode='Rotor' toField='set_fraction'></ROUTE>
      <ROUTE fromNode='Rotor' fromField='value_changed' toNode='Box' toField='set_rotation'></ROUTE>
    </Scene>
  </X3D>
</x3d-canvas>

Pure JavaScript

The same scene can also be created using pure JavaScript:

<script type="module">
import X3D from "https://cdn.jsdelivr.net/npm/x_ite@11.6.0/dist/x_ite.min.mjs";

const
  canvas  = document .createElement ("x3d-canvas"), // Or get an already inserted <x3d-canvas> element.
  browser = canvas .browser,                        // Get X3DBrowser reference.
  scene   = await browser .createScene (browser .getProfile ("Interchange"), browser .getComponent ("Interpolation", 1));

// Append <x3d-canvas> element to body:

document .body .appendChild (canvas);

// Change Browser Options (this could also be done by setting the attributes of the canvas):

browser .setBrowserOption ("AutoUpdate",   true); // Disable animations if <x3d-canvas> is not visible.
browser .setBrowserOption ("ContentScale", -1);   // Increase resolution for HiDPI displays.

// Create Viewpoint:

const viewpointNode = scene .createNode ("Viewpoint");

viewpointNode .set_bind    = true;           // Bind the viewpoint.
viewpointNode .description = "Initial View"; // Appears now in the context menu.
viewpointNode .position    = new X3D .SFVec3f (2.869677, 3.854335, 8.769781);
viewpointNode .orientation = new X3D .SFRotation (-0.7765887, 0.6177187, 0.1238285, 0.5052317);

scene .rootNodes .push (viewpointNode);

// Create Box:

const
  transformNode  = scene .createNode ("Transform"),
  shapeNode      = scene .createNode ("Shape"),
  appearanceNode = scene .createNode ("Appearance"),
  materialNode   = scene .createNode ("Material"),
  boxNode        = scene .createNode ("Box");

appearanceNode .material = materialNode;

shapeNode .appearance = appearanceNode;
shapeNode .geometry   = boxNode;

transformNode .children .push (shapeNode);

scene .rootNodes .push (transformNode);

// Give the node a name if you like.
scene .addNamedNode ("Box", transformNode);

// Create animation:

const
  timeSensorNode   = scene .createNode ("TimeSensor"),
  interpolatorNode = scene .createNode ("OrientationInterpolator");

timeSensorNode .cycleInterval = 10;
timeSensorNode .loop          = true;

for (let i = 0; i < 5; ++ i)
{
  interpolatorNode .key [i]      = i / 4;
  interpolatorNode .keyValue [i] = new X3D .SFRotation (0, 1, 0, Math .PI / 2 * i);
}

scene .rootNodes .push (timeSensorNode, interpolatorNode);

// Add routes:

scene .addRoute (timeSensorNode,   "fraction_changed", interpolatorNode, "set_fraction");
scene .addRoute (interpolatorNode, "value_changed",    transformNode,    "set_rotation");

// Show scene.

await browser .replaceWorld (scene);
</script>

Read more in Accessing the External Browser.

Contributing

Contributions are always welcome. There is no special form to do this. A good idea is to fork the X_ITE repository and create a separate branch from the development branch, make your changes and then make a pull request.

For more information see CONTRIBUTING.

License

X_ITE is free software and licensed under the MIT License.

See Also

  • x_ite-node — Pure Node.js version of X_ITE
  • x3d-tidy — X3D converter, beautifier and minimizer
  • x3d-image — render image files from X3D
  • sunrize — a multi-platform X3D editor

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
11.6.0105latest

Version History

VersionDownloads (Last 7 Days)Published
11.6.0105
11.5.1521
11.5.146
11.5.128
11.5.114
11.5.107
11.5.91
11.5.80
11.5.70
11.5.61
11.5.50
11.5.41
11.5.31
11.5.21
11.5.11
11.5.00
11.4.21
11.4.11
11.4.01
11.3.21
11.3.10
11.3.00
11.2.30
11.2.20
11.2.10
11.2.00
11.1.12
11.1.00
11.0.70
11.0.60
11.0.53
11.0.40
11.0.30
11.0.20
11.0.10
11.0.00
10.5.151
10.5.141
10.5.130
10.5.121
10.5.111
10.5.100
10.5.90
10.5.81
10.5.70
10.5.60
10.5.50
10.5.40
10.5.30
10.5.21
10.5.10
10.5.01
10.4.20
10.4.10
10.4.00
10.3.10
10.3.00
10.2.00
10.1.01
10.0.51
10.0.40
10.0.31
10.0.20
10.0.10
10.0.00
9.7.00
9.6.31
9.6.23
9.6.11
9.6.01
9.5.21
9.5.11
9.5.01
9.4.51
9.4.41
9.4.31
9.4.20
9.4.10
9.4.00
9.3.20
9.3.10
9.3.01
9.2.70
9.2.61
9.2.51
9.2.41
9.2.30
9.2.20
9.2.10
9.2.00
9.1.110
9.1.100
9.1.90
9.1.81
9.1.70
9.1.60
9.1.50
9.1.40
9.1.31
9.1.20
9.1.10
9.1.00
9.0.30
9.0.20
9.0.10
9.0.00
8.12.50
8.12.40
8.12.30
8.12.20
8.12.11
8.12.00
8.11.170
8.11.160
8.11.151
8.11.140
8.11.131
8.11.120
8.11.111
8.11.100
8.11.90
8.11.80
8.11.71
8.11.61
8.11.50
8.11.40
8.11.31
8.11.20
8.11.10
8.11.01
8.10.10
8.10.01
8.9.60
8.9.50
8.9.40
8.9.30
8.9.20
8.9.10
8.9.01
8.8.70
8.8.60
8.8.50
8.8.41
8.8.30
8.8.20
8.8.10
8.8.00
8.7.90
8.7.80
8.7.70
8.7.60
8.7.50
8.7.40
8.7.30
8.7.21
8.7.10
8.7.00
8.6.240
8.6.231
8.6.221
8.6.200
8.6.190
8.6.180
8.6.170
8.6.160
8.6.150
8.6.140
8.6.131
8.6.120
8.6.110
8.6.101
8.6.90
8.6.80
8.6.70
8.6.60
8.6.50
8.6.40
8.6.30
8.6.21
8.6.11
8.6.00
8.5.50
8.5.40
8.5.30
8.5.01
8.4.31
8.4.20
8.4.10
8.4.00
8.3.30
8.3.21
8.3.10
8.3.01
8.1.00
8.0.00
6.1.00
6.0.01
5.0.30
5.0.20
5.0.01
4.7.150
4.7.140
4.7.120
4.7.110
4.7.100
4.7.90
4.7.80
4.7.71
4.7.60
4.7.50
4.6.80
4.2.170
4.0.7-a0
4.0.51
4.0.20

Package Sidebar

Install

npm i x_ite

Weekly Downloads

220

Version

11.6.0

License

MIT

Unpacked Size

32.2 MB

Total Files

125

Last publish

Collaborators

  • create3000