Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit ba8cc5e60f793b72d7eb3ba5aea3b35b5792873e @stephomi committed Jul 7, 2013
Showing with 9,530 additions and 0 deletions.
  1. +32 −0 .jshintrc
  2. +21 −0 LICENSE
  3. +6 −0 README.md
  4. +12 −0 build/build.sh
  5. BIN build/compiler.jar
  6. +44 −0 build/index-min.html
  7. +18 −0 build/sculptgl/css/style.css
  8. +44 −0 build/sculptgl/index.html
  9. +2 −0 build/sculptgl/lib/filesaver.min.js
  10. +28 −0 build/sculptgl/lib/gl-matrix-min.js
  11. +117 −0 build/sculptgl/lib/jquery.mousewheel.js
  12. BIN build/sculptgl/ressources/material1.jpg
  13. BIN build/sculptgl/ressources/material2.jpg
  14. +144 −0 build/sculptgl/sculptgl.min.js
  15. +36 −0 build/sculptgl/shaders/phongFragment.glsl
  16. +12 −0 build/sculptgl/shaders/phongVertex.glsl
  17. +28 −0 build/sculptgl/shaders/reflectionFragment.glsl
  18. +16 −0 build/sculptgl/shaders/reflectionVertex.glsl
  19. +21 −0 build/sculptgl/shaders/transparencyFragment.glsl
  20. +12 −0 build/sculptgl/shaders/transparencyVertex.glsl
  21. +38 −0 build/sculptgl/shaders/wireframeFragment.glsl
  22. +13 −0 build/sculptgl/shaders/wireframeVertex.glsl
  23. +18 −0 css/style.css
  24. +843 −0 editor/adaptive.js
  25. +548 −0 editor/decimation.js
  26. +442 −0 editor/sculpt.js
  27. +472 −0 editor/subdivision.js
  28. +13 −0 editor/topology.js
  29. +73 −0 index.html
  30. +2 −0 lib/filesaver.min.js
  31. +28 −0 lib/gl-matrix-min.js
  32. +117 −0 lib/jquery.mousewheel.js
  33. +117 −0 math3d/camera.js
  34. +186 −0 math3d/geometry.js
  35. +140 −0 math3d/grid.js
  36. +113 −0 math3d/picking.js
  37. +100 −0 misc/files.js
  38. +85 −0 misc/utils.js
  39. +210 −0 object/aabb.js
  40. +454 −0 object/mesh.js
  41. +198 −0 object/octree.js
  42. +294 −0 object/render.js
  43. +477 −0 object/states.js
  44. +27 −0 object/triangle.js
  45. +91 −0 object/vertex.js
  46. BIN ressources/material1.jpg
  47. BIN ressources/material2.jpg
  48. +3,077 −0 ressources/sphere.obj.js
  49. +585 −0 sculptgl.js
  50. +36 −0 shaders/phongFragment.glsl
  51. +12 −0 shaders/phongVertex.glsl
  52. +28 −0 shaders/reflectionFragment.glsl
  53. +16 −0 shaders/reflectionVertex.glsl
  54. +21 −0 shaders/transparencyFragment.glsl
  55. +12 −0 shaders/transparencyVertex.glsl
  56. +38 −0 shaders/wireframeFragment.glsl
  57. +13 −0 shaders/wireframeVertex.glsl
@@ -0,0 +1,32 @@
+{
+ "asi": false,
+ "boss": false,
+ "camelcase": false,
+ "curly": false,
+ "eqeqeq": true,
+ "eqnull": true,
+ "es5": true,
+ "evil": false,
+ "expr": false,
+ "forin": true,
+ "funcscope": false,
+ "immed": true,
+ "indent": 2,
+ "latedef": true,
+ "loopfunc": false,
+ "maxerr": 100,
+ "newcap": true,
+ "node": true,
+ "nonew": true,
+ "plusplus": false,
+ "quotmark": "single",
+ "regexdash": false,
+ "shadow": false,
+ "strict": false,
+ "sub": false,
+ "supernew": false,
+ "trailing": true,
+ "undef": true,
+ "unused": true,
+ "white": true
+}
21 LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2013 stéphane GINIER
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
@@ -0,0 +1,6 @@
+SculptGL
+========
+
+#### A WebGL sculpting app ####
+
+[Website](http://stephaneginier.com/)
@@ -0,0 +1,12 @@
+rm -rf sculptgl
+mkdir sculptgl
+mkdir sculptgl/css
+mkdir sculptgl/ressources
+mkdir sculptgl/shaders
+mkdir sculptgl/lib
+java -jar compiler.jar --js=../object/aabb.js --js=../math3d/camera.js --js=../misc/files.js --js=../math3d/geometry.js --js=../math3d/grid.js --js=../object/mesh.js --js=../object/octree.js --js=../math3d/picking.js --js=../object/render.js --js=../editor/sculpt.js --js=../misc/utils.js --js=../editor/topology.js --js=../editor/subdivision.js --js=../editor/decimation.js --js=../editor/adaptive.js --js=../object/triangle.js --js=../object/states.js --js=../object/vertex.js --js=../sculptgl.js --js=../ressources/sphere.obj.js --js_output_file=sculptgl/sculptgl.min.js
+cp ../lib/*.js sculptgl/lib/
+cp ../ressources/*.jpg sculptgl/ressources/
+cp ../shaders/*.glsl sculptgl/shaders/
+cp ../css/*.css sculptgl/css/
+cp index-min.html sculptgl/index.html
Binary file not shown.
@@ -0,0 +1,44 @@
+<!doctype html>
+<html lang='en'>
+<head>
+ <meta charset='utf-8' />
+ <meta name='description' content='SculptGL is a small sculpting application powered by JavaScript and webGL.'>
+ <meta name='author' content='stéphane GINIER'>
+ <title> SculptGL - A WebGL sculpting app </title>
+ <link rel='stylesheet' href='css/style.css' type='text/css' />
+ <script src='http://code.jquery.com/jquery-1.10.1.min.js'></script>
+ <script src='lib/jquery.mousewheel.js'></script>
+ <script>
+ 'use strict';
+ $(document).ready(function ()
+ {
+ var sculptgl = new SculptGL();
+ sculptgl.start();
+ });
+ </script>
+</head>
+<!--
+ ____ _ _ ____ _
+/ ___| ___ _ _| |_ __ | |_ / ___| |
+\___ \ / __| | | | | '_ \| __| | _| |
+ ___) | (__| |_| | | |_) | |_| |_| | |___
+|____/ \___|\__,_|_| .__/ \__|\____|_____|
+ |_|
+A tiny sculpting application. This is basically a port in JavaScript/WebGL
+from a previous C++/OpenGL application that I made.
+
+Stéphane GINIER
+-->
+<body oncontextmenu='return false;'>
+ <input type='file' id='fileopen' style='display: none'/>
+ <canvas id='canvas'></canvas>
+
+ <!-- 3rd party libraries -->
+ <script src='http://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.5/dat.gui.min.js' > </script>
+ <script src='lib/filesaver.min.js'></script>
+ <script src='lib/gl-matrix-min.js'></script>
+
+ <!-- minified sculptgl -->
+ <script src='sculptgl.min.js'></script>
+</body>
+</html>
@@ -0,0 +1,18 @@
+* { margin:0; padding:0; }
+
+html, body{
+ height: 100%;
+ width: 100%;
+ padding: 0;
+ margin: 0;
+ font-family: Helvetica, Arial, sans-serif;
+}
+
+#canvas {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ height: 100%;
+ width: 100%;
+ display: block;
+}
@@ -0,0 +1,44 @@
+<!doctype html>
+<html lang='en'>
+<head>
+ <meta charset='utf-8' />
+ <meta name='description' content='SculptGL is a small sculpting application powered by JavaScript and webGL.'>
+ <meta name='author' content='stéphane GINIER'>
+ <title> SculptGL - A WebGL sculpting app </title>
+ <link rel='stylesheet' href='css/style.css' type='text/css' />
+ <script src='http://code.jquery.com/jquery-1.10.1.min.js'></script>
+ <script src='lib/jquery.mousewheel.js'></script>
+ <script>
+ 'use strict';
+ $(document).ready(function ()
+ {
+ var sculptgl = new SculptGL();
+ sculptgl.start();
+ });
+ </script>
+</head>
+<!--
+ ____ _ _ ____ _
+/ ___| ___ _ _| |_ __ | |_ / ___| |
+\___ \ / __| | | | | '_ \| __| | _| |
+ ___) | (__| |_| | | |_) | |_| |_| | |___
+|____/ \___|\__,_|_| .__/ \__|\____|_____|
+ |_|
+A tiny sculpting application. This is basically a port in JavaScript/WebGL
+from a previous C++/OpenGL application that I made.
+
+Stéphane GINIER
+-->
+<body oncontextmenu='return false;'>
+ <input type='file' id='fileopen' style='display: none'/>
+ <canvas id='canvas'></canvas>
+
+ <!-- 3rd party libraries -->
+ <script src='http://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.5/dat.gui.min.js' > </script>
+ <script src='lib/filesaver.min.js'></script>
+ <script src='lib/gl-matrix-min.js'></script>
+
+ <!-- minified sculptgl -->
+ <script src='sculptgl.min.js'></script>
+</body>
+</html>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,117 @@
+/*! Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
+ * Licensed under the MIT License (LICENSE.txt).
+ *
+ * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
+ * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
+ * Thanks to: Seamus Leahy for adding deltaX and deltaY
+ *
+ * Version: 3.1.3
+ *
+ * Requires: 1.2.2+
+ */
+
+ (function (factory) {
+ if ( typeof define === 'function' && define.amd ) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS style for Browserify
+ module.exports = factory;
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function ($) {
+
+ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'];
+ var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'];
+ var lowestDelta, lowestDeltaXY;
+
+ if ( $.event.fixHooks ) {
+ for ( var i = toFix.length; i; ) {
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
+ }
+ }
+
+ $.event.special.mousewheel = {
+ setup: function() {
+ if ( this.addEventListener ) {
+ for ( var i = toBind.length; i; ) {
+ this.addEventListener( toBind[--i], handler, false );
+ }
+ } else {
+ this.onmousewheel = handler;
+ }
+ },
+
+ teardown: function() {
+ if ( this.removeEventListener ) {
+ for ( var i = toBind.length; i; ) {
+ this.removeEventListener( toBind[--i], handler, false );
+ }
+ } else {
+ this.onmousewheel = null;
+ }
+ }
+ };
+
+ $.fn.extend({
+ mousewheel: function(fn) {
+ return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
+ },
+
+ unmousewheel: function(fn) {
+ return this.unbind("mousewheel", fn);
+ }
+ });
+
+
+ function handler(event) {
+ var orgEvent = event || window.event,
+ args = [].slice.call(arguments, 1),
+ delta = 0,
+ deltaX = 0,
+ deltaY = 0,
+ absDelta = 0,
+ absDeltaXY = 0,
+ fn;
+ event = $.event.fix(orgEvent);
+ event.type = "mousewheel";
+
+ // Old school scrollwheel delta
+ if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; }
+ if ( orgEvent.detail ) { delta = orgEvent.detail * -1; }
+
+ // New school wheel delta (wheel event)
+ if ( orgEvent.deltaY ) {
+ deltaY = orgEvent.deltaY * -1;
+ delta = deltaY;
+ }
+ if ( orgEvent.deltaX ) {
+ deltaX = orgEvent.deltaX;
+ delta = deltaX * -1;
+ }
+
+ // Webkit
+ if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY; }
+ if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX * -1; }
+
+ // Look for lowest delta to normalize the delta values
+ absDelta = Math.abs(delta);
+ if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; }
+ absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX));
+ if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; }
+
+ // Get a whole value for the deltas
+ fn = delta > 0 ? 'floor' : 'ceil';
+ delta = Math[fn](delta / lowestDelta);
+ deltaX = Math[fn](deltaX / lowestDeltaXY);
+ deltaY = Math[fn](deltaY / lowestDeltaXY);
+
+ // Add event and delta to the front of the arguments
+ args.unshift(event, delta, deltaX, deltaY);
+
+ return ($.event.dispatch || $.event.handle).apply(this, args);
+ }
+
+}));
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit ba8cc5e

Please sign in to comment.