Skip to content
Snippets Groups Projects
main.js 7.35 KiB
Newer Older
Amanda Ghassaei's avatar
Amanda Ghassaei committed
/**
 * Created by aghassaei on 1/7/15.
 */

Amanda Ghassaei's avatar
Amanda Ghassaei committed
require.config({
Amanda Ghassaei's avatar
Amanda Ghassaei committed

Amanda Ghassaei's avatar
Amanda Ghassaei committed
    baseUrl: 'js',
Amanda Ghassaei's avatar
Amanda Ghassaei committed

Amanda Ghassaei's avatar
Amanda Ghassaei committed
    paths: {
        jquery: '../dependencies/jquery-2.1.3',
        underscore: '../dependencies/underscore',
        backbone: '../dependencies/backbone',
        flatUI: '../dependencies/flatUI/js/flat-ui',
        fileSaverLib: '../dependencies/loaders/FileSaver.min',
Amanda Ghassaei's avatar
Amanda Ghassaei committed

        //three
        three: '../dependencies/three',
        orbitControls: '../dependencies/OrbitControls',
        stlLoader: '../dependencies/loaders/STLLoader',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        threeModel: 'three/ThreeModel',
        threeView: 'three/ThreeView',
        fillGeometry: 'three/FillGeometry',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        //models
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        globals: 'models/Globals',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        plist: 'models/PList',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        appState: 'models/AppState',
        fileSaver: 'models/FileSaver',
Amanda Ghassaei's avatar
Amanda Ghassaei committed

        //communication
        socketio: '../dependencies/socket.io-1.3.5',
        serialComm: 'models/SerialComm',

        //lattice classes and extra methods
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        latticeBase: 'lattice/LatticeBase',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        lattice: 'lattice/Lattice',
        compositeEditorLattice: 'lattice/CompositeEditorLattice',
        latticeImportGeo: 'lattice/ImportGeo',
        latticeCAM: 'lattice/latticeCAM',

        //lattice "subclasses"
        cubeLattice: 'lattice/latticeSubclasses/CubeLattice',
        gikLattice: 'lattice/latticeSubclasses/GIKLattice',
        kelvinLattice: 'lattice/latticeSubclasses/KelvinLattice',
        octaEdgeLattice: 'lattice/latticeSubclasses/OctaEdgeLattice',
        octaFaceLattice: 'lattice/latticeSubclasses/OctaFaceLattice',
        octaRotEdgeLattice: 'lattice/latticeSubclasses/OctaRotEdgeLattice',
        octaVertexLattice: 'lattice/latticeSubclasses/OctaVertexLattice',
        truncatedCubeLattice: 'lattice/latticeSubclasses/TruncatedCubeLattice',
        tetraStackedLattice: 'lattice/latticeSubclasses/TetraStackedLattice',
        tetraVertexLattice: 'lattice/latticeSubclasses/TetraVertexLattice',
Amanda Ghassaei's avatar
Amanda Ghassaei committed

        //baseplane
        baseplane: 'baseplane/BasePlane',
        squareBaseplane: 'baseplane/SquareBasePlane',
        octaBaseplane: 'baseplane/OctaBasePlane',
        rotEdgeOctaBaseplane: 'baseplane/RotEdgeOctaBasePlane',

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        //highlighter
        highlighter: 'highlighter/Highlighter',
        defaultHighlighter: 'highlighter/DefaultHighlighter',
        cubeHighlighter: 'highlighter/CubeHighlighter',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        superCellHighlighter: 'highlighter/SuperCellHighlighter',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        octaFaceHighlighter: 'highlighter/OctaFaceHighlighter',
        truncatedCubeHighlighter: 'highlighter/TruncatedCubeHighlighter',

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        //cells
        cell: 'cells/DMACell',
        octaFaceCell: 'cells/OctaFaceCell',
        octaEdgeCell: 'cells/OctaEdgeCell',
        octaVertexCell: 'cells/OctaVertexCell',
        octaRotEdgeCell: 'cells/OctaRotEdgeCell',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        tetraStackedCell: 'cells/TetraStackedCell',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        tetraVertexCell: 'cells/TetraVertexCell',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        truncatedCubeCell: 'cells/TruncatedCubeCell',
        kelvinCell: 'cells/KelvinCell',
        cubeCell: 'cells/CubeCell',
        gikCell: 'cells/GIKCell',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        superCell: 'cells/supercells/DMASuperCell',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        gikSuperCell: 'cells/supercells/GIKSuperCell',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        compositeCell: "cells/supercells/CompositeCell",
Amanda Ghassaei's avatar
Amanda Ghassaei committed

        //parts
        part: 'parts/DMAPart',
        octaFaceTriPart: 'parts/OctaFaceTriPart',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        octaEdgeVoxPart: 'parts/OctaEdgeVoxPart',
        octaEdgeVoxPartLowPoly: 'parts/OctaEdgeVoxPartLowPoly',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        gikPart: 'parts/GIKPart',
        gikPartLowPoly: 'parts/GIKPartLowPoly',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        //materials
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        materials: 'materials/DMAMaterials',
Amanda Ghassaei's avatar
Amanda Ghassaei committed

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        //UI
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        navbar: 'menus/Navbar',
        navViewMenu: 'menus/NavViewMenu',//view dropdown
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        ribbon: 'menus/Ribbon',
        modalView: 'menus/ModalView',
        menuWrapper: 'menus/MenuWrapperView',
        menuParent: 'menus/MenuParentView',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        latticeMenu: 'menus/LatticeMenuView',
        importMenu: 'menus/ImportMenuView',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        partMenu: 'menus/PartMenuView',
        scriptMenu: 'menus/ScriptMenuView',
        physicsMenu: 'menus/PhysicsMenuView',
        materialMenu: 'menus/MaterialMenuView',
        optimizeMenu: 'menus/OptimizationMenuView',
        assemblerMenu: 'menus/AssemblerMenuView',
        camMenu: 'menus/CamMenuView',
        animateMenu: 'menus/AnimationMenuView',
        sendMenu: 'menus/SendMenuView',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        compositeMenu: 'menus/CompositeMenuView',
        materialEditorMenu: 'menus/MaterialEditorMenuView',
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        setupCommMenu: 'menus/SetupCommMenuView',
        discoveryMenu: 'menus/DiscoveryMenuView',
        //templates
        navViewMenuTemplate: 'menus/templates/NavViewMenu.html',
        ribbonTemplate: 'menus/templates/Ribbon.html',
        modalViewTemplate: 'menus/templates/ModalView.html',
        menuWrapperTemplate: 'menus/templates/MenuWrapperView.html',
        latticeMenuTemplate: 'menus/templates/LatticeMenuView.html',
        importMenuTemplate: 'menus/templates/ImportMenuView.html',
        partMenuTemplate: 'menus/templates/PartMenuView.html',
        scriptMenuTemplate: 'menus/templates/ScriptMenuView.html',
        physicsMenuTemplate: 'menus/templates/PhysicsMenuView.html',
        materialMenuTemplate: 'menus/templates/MaterialMenuView.html',
        optimizeMenuTemplate: 'menus/templates/OptimizationMenuView.html',
        assemblerMenuTemplate: 'menus/templates/AssemblerMenuView.html',
        camMenuTemplate: 'menus/templates/CamMenuView.html',
        animateMenuTemplate: 'menus/templates/AnimationMenuView.html',
        sendMenuTemplate: 'menus/templates/SendMenuView.html',
        compositeMenuTemplate: 'menus/templates/CompositeMenuView.html',
        materialEditorMenuTemplate: 'menus/templates/MaterialEditorMenuView.html',
        setupCommMenuTemplate: 'menus/templates/SetupCommMenuView.html',
        discoveryMenuTemplate: 'menus/templates/DiscoveryMenuView.html',

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        //cam
        cam: 'cam/cam.js',

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        //assemblers
        crab: 'cam/assemblers/crab',

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        //stls (not sure why ../ is not working here?)
        octaFaceTrianglePartSTL: 'assets/stls/parts/OctaFaceTrianglePart.stl',
        octaEdgeVoxPartSTL: 'assets/stls/parts/OctaEdgeVoxPart.stl',
        octaEdgeVoxPartLowPolySTL: 'assets/stls/parts/OctaEdgeVoxPartLowPoly.stl',
        gikPartSTL: 'assets/stls/parts/GIKPart.stl',
        gikEndPartSTL: 'assets/stls/parts/GIKEndPart.stl',
        gikPartLowPolySTL: 'assets/stls/parts/GIKPartLowPoly.stl',
        gikEndPartLowPolySTL: 'assets/stls/parts/GIKEndPartLowPoly.stl',
        crabSTL: 'assets/stls/crab/crab.stl'
Amanda Ghassaei's avatar
Amanda Ghassaei committed

Amanda Ghassaei's avatar
Amanda Ghassaei committed

Amanda Ghassaei's avatar
Amanda Ghassaei committed
    shim: {
        three: {
            exports: 'THREE'
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        },
        orbitControls: {
            deps: ['three'],
            exports: 'THREE'
        },
        stlLoader: {
            deps: ['three'],
            exports: 'THREE'
        },
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        fileSaverLib: {
            exports: 'saveAs'
        },
        flatUI: {
            deps: ['jquery']
        },
        'socketio': {
            exports: 'io'
Amanda Ghassaei's avatar
Amanda Ghassaei committed

Amanda Ghassaei's avatar
Amanda Ghassaei committed

Amanda Ghassaei's avatar
Amanda Ghassaei committed
//require.onError = function (err) {
//    console.log(err.requireType);
//    console.log(err.requireModules);
//    throw err;
//};
Amanda Ghassaei's avatar
Amanda Ghassaei committed
//init stuff
Amanda Ghassaei's avatar
Amanda Ghassaei committed
require(['appState', 'lattice', 'navbar', 'threeModel', 'threeView', 'flatUI', 'ribbon', 'menuWrapper'],
    function(appState, lattice, Navbar, three, ThreeView){
Amanda Ghassaei's avatar
Amanda Ghassaei committed

    new Navbar({model:appState});

    new ThreeView({model:three});

Amanda Ghassaei's avatar
Amanda Ghassaei committed
//    if (lattice.get("connectionType") != "gik") lattice.getUItarget().addCellAtIndex({x:0,y:0,z:0});//add a cell