GithubHelp home page GithubHelp logo

the1sky / ng-three-viewer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cubicledowns/ng-three-viewer

0.0 2.0 0.0 13.73 MB

3D model viewer using Angular and Three.js

Home Page: http://blog.tempt3d.com

License: MIT License

JavaScript 98.74% GLSL 0.24% HTML 0.88% Batchfile 0.01% CSS 0.14%

ng-three-viewer's Introduction

ng-three-viewer

Overview

This project demonstrates two approaches (v1 & v2) to create an AngularJS and Three.js app. You can view the accompanying presentation on Google Slides.

Both approaches create the same app, a simple 3D model viewer.

v1 Approach

  • Most common Angular pattern (angularjs.org docs demonstrate this approach)
  • Uses grunt to uglify / minify
  • Uses Angular factories, services, filters, directives
  • Bootstraps components from ng-controller in DOM

v2 Approach

  • Prototypal Pattern for Everything!
  • Bridge to Angular 2.0
  • Controller as (local scope)
  • Closure Compilation
    • Annotations including @ngInject
    • type checking
    • --angular_pass
    • Dependency chains (goog.provide / goog.require)
    • minification
  • No closure pattern (factories). Services only.
  • App.js initialization for all components.

Getting Started

  1. Do a git pull https://github.com/cubicleDowns/ng-three-viewer.git
  2. You will probably have to install some grunt packages in both the v1 & v2 directories.
  • npm install grunt-package-name
  1. Open up the repo and run a server from the ng-three-viewer/ directory
  • grunt serve
  • python -m SimpleHTTPServer
  • or whatever.
  1. Browse to SERVER_NAME:PORT
  • Compiled Versions:
    • /v1/dist/
    • /v2/dist/
  • Uncompiled Versions:
    • /v1/
    • /v2/

v1 Compiling Code

  1. From v1/ grunt build
  • Joins all library files into libs.js
  • Minifies and ngAnnnotates
  • Exports the files to /v1/dist/

v2 Compiling Code

  1. Uncomment
  • //goog.require('Viewer.Scene'); in app.js
  • //goog.require's in scene.js
  1. From v2/ grunt
  2. Will show any warnings or errors from compilation
  3. If no errors, it'll output /v2/dist/app.min.js

A few Protractor tests for v2 of the app

Set up:

  1. Get Protractor:
npm install -g protractor
  1. Get Selenium:
webdriver-manager update
  1. Start Selenium server:
webdriver-manager start
  1. Start the app on localhost:8000. I used python -m SimpleHTTPServer.
  2. Run it! cd into test/ directory and run
protractor conf.js

That should launch Chrome and run the tests in it.

Files:

  • app.js -- page object containing some element locators and functions.
  • test.js -- the tests.
  • conf.js -- config file where, well, different options can be specified.

ng-three-viewer's People

Contributors

cubicledowns avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.