-
-
Notifications
You must be signed in to change notification settings - Fork 574
Architectural Documentation
The code is separated into two logical parts: the engine and the website.
Source: source/engine
.
The main goal of the engine to provide a reusable 3D model viewer functionality. The engine contains all the import, export, and visualization logics, and it is designed to be embedded in any website. The engine depends on some third-party libraries, the most important one is three.js.
Source: source/website
for javascript, website
for html and css.
The website contains all the code for the web application that you see at 3dviewer.net. The website uses the engine under the hood, and contains only the codes that needed for the web application to work.
Actually, there are two sites. One that you see when you visit the page (index.html
), and one that you see when you embed the page (embed.html
). The embedded page is a simplified version of the website without any controls, but you can modify almost every settings of the website using url parameters.
The most important architectural choice is the presence of the internal model format. Every 3D model is converted to the internal format, and it's converted to the three.js model format. This makes available for all the functionality to be independent of the format of the input model.
The figure below shows the conversion flow between the model formats, and explains which model is used for what.
The whole conversion process is grouped together in the ThreeModelLoader
class. It gets a list of files, and the returns both the internal and the three.js models. It can work on both file urls and file binary objects.