|
Project Information
|
Hangar is a HTML5 JavaScript library to render 3D models in AC3D format (.ac) using WebGL. The AC3D file format (.ac) is a text file format used to store 3D models by many projects, like FlightGear, an open-source flight simulation, or Torcs, an open-source car racing simulator. Hangar library supports the SGI image file format (.sgi, .rgba, .rgb, .ra, bw) used for some old models to store textures. DemoFlight Gallery is a basic 3D FlightGear models viewer showing library capacities. Use mouse button and wheel to have some fun! Video
ViewerTo render an .ac file to a canvas you just must to create an HG.Viewer object and call the show function with the name (url) of the .ac file: var viewer = new HG.Viewer(canvas); viewer.show(filename); File is loaded, parsed and rendered using WebGL, with textures if any, and auto fitted to the canvas size. A default trackball controller is provided, so you can rotate and zoom the rendereed model using the mouse. You can also use the library to parse individuals files for your own proposals (see above). RenderPolygon surfaces are tessellated to equivalent triangulated surfaces. Both convex and concave surfaces are allowed. Degenerated polygons are discarted. That is, polygons with less than three vertices, polygons with collinear coordinates, polygons with vertices not contained in an only one plane, polygons crossing edges, and so... Normal vectors are calculated per surface. Smoothed normal vectors are calculated per vertex. Illumination model is based on the Phong one. Ligths on .ac files are ignored, render always perfomed using one static directional light without attenuation factors. AC3DTo parse a loaded .ac file you just must to create an AC.File object: var file = new AC.File(data); data argument must be a JavaScript String with the content of a valid .ac file. AC.File objects have the following properties:
AC.Material objects have the following properties:
AC.Object objects have the following properties:
AC.Surface objects have the following properties:
SGITo parse a loaded .rgb (.sgi, .rgba, .rb, .bw) file you just must to create an SGI.File object: var file = new SGI.File(data); data argument must be a JavaScript ArrayBuffer with the content of a valid .rgb file. SGI.File objects have the following properties:
SGI.Header objects have the following properties:
Original header attributes magic, bpc, dimension, pixmin, pixman, imagename and colormap are ignored. Always taken 8 bits per channel. SGI.Image objects have the following properties:
Original vertical image orientation is flip backed and always four channel are returned. Dependenciesgl-matrix is used to operated with vectors, matrices and quaternions. |