Permalink
Browse files

clean up mocap code and integrate into seen namespace.

  • Loading branch information...
1 parent 4dcc856 commit 39668af0a86476655e71af4694fac9d0afcf897b @themadcreator committed Oct 9, 2015
View
@@ -14,7 +14,6 @@ DISTS = {
'seen.js' : [
'src/namespace.coffee'
'src/util.coffee'
- 'src/ext/simplex.coffee'
'src/events.coffee'
'src/matrix.coffee'
'src/transformable.coffee'
@@ -35,11 +34,15 @@ DISTS = {
'src/interaction.coffee'
'src/surface.coffee'
'src/model.coffee'
+ 'src/animator.coffee'
'src/shapes/primitives.coffee'
+ 'src/shapes/mocap.coffee'
'src/shapes/obj.coffee'
- 'src/animator.coffee'
'src/camera.coffee'
'src/scene.coffee'
+ # Extensions
+ 'src/ext/simplex.coffee'
+ 'src/ext/bvh-parser.js'
]
}
@@ -65,14 +68,22 @@ task 'build', 'Build and uglify seen', () ->
console.log "Building #{javascript}..."
# Concat all coffeescript together for Docco
- coffeeCode = sources.map((source) -> fs.readFileSync(source, 'utf-8')).join('\n\n')
+ coffeeCode = sources
+ .filter((source) -> /\.coffee$/.test(source))
+ .map((source) -> fs.readFileSync(source, 'utf-8')).join('\n\n')
coffeeCode = "\n\n# #{license}\n\n" + coffeeCode
fs.writeFileSync path.join(DIST, javascript.replace(/\.js$/, '.coffee')), coffeeCode, {flags: 'w'}
console.log ' Joined.'
# Compile to javascript
jsCode = CoffeeScript.compile coffeeCode
- fs.writeFileSync path.join(DIST, javascript), MIN_LICENSE + jsCode, {flags: 'w'}
+ otherJsCode = _.chain(sources)
+ .filter((source) -> /\.js$/.test(source))
+ .map((source) -> fs.readFileSync(source, 'utf-8'))
+ .map((source) -> source.replace(/(?:\/\*(?:[\s\S]*?)\*\/)/gm, '')) # strip comments
+ .join('\n\n')
+ .value()
+ fs.writeFileSync path.join(DIST, javascript), MIN_LICENSE + jsCode + otherJsCode, {flags: 'w'}
console.log ' Compiled.'
# Uglify
@@ -514,13 +514,6 @@ class seen.Point
@divide(n)
return @
- # Returns a new point that is perpendicular to this point
- perpendicular : () ->
- n = @copy().cross(seen.Points.Z())
- mag = n.magnitude()
- if mag isnt 0 then return n.divide(mag)
- return @copy().cross(seen.Points.X()).normalize()
-
# Apply a transformation from the supplied `Matrix`.
transform : (matrix) ->
r = POINT_POOL
@@ -2062,7 +2055,7 @@ seen.Models = {
}
- # ## Shapes
+# ## Shapes
# #### Shape primitives and shape-making methods
# ------------------
@@ -2227,19 +2220,6 @@ seen.Shapes = {
triangles = seen.Shapes._subdivideTriangles(triangles)
return new seen.Shape('sphere', triangles.map (triangle) -> new seen.Surface(triangle.map (v) -> v.copy()))
- # Returns a cylinder whose main axis is aligned from point1 to point2
- pipe : (point1, point2, offset = 1, segments = 3) ->
- axis = point2.copy().subtract(point1)
- perp1 = axis.perpendicular()
- perp2 = axis.copy().cross(perp1).normalize()
- pts = [
- point1.copy().add(perp1).subtract(perp2)
- point1.copy().add(perp1).add(perp2)
- point1.copy().subtract(perp1).add(perp2)
- point1.copy().subtract(perp1).subtract(perp2)
- ]
- return seen.Shapes.extrude(pts, axis)
-
# Returns a planar triangular patch. The supplied arguments determine the
# number of triangle in the patch.
patch: (nx = 20, ny = 20) ->
View
@@ -527,16 +527,6 @@
return this;
};
- Point.prototype.perpendicular = function() {
- var mag, n;
- n = this.copy().cross(seen.Points.Z());
- mag = n.magnitude();
- if (mag !== 0) {
- return n.divide(mag);
- }
- return this.copy().cross(seen.Points.X()).normalize();
- };
-
Point.prototype.transform = function(matrix) {
var r;
r = POINT_POOL;
@@ -2613,20 +2603,6 @@
}));
}));
},
- pipe: function(point1, point2, offset, segments) {
- var axis, perp1, perp2, pts;
- if (offset == null) {
- offset = 1;
- }
- if (segments == null) {
- segments = 3;
- }
- axis = point2.copy().subtract(point1);
- perp1 = axis.perpendicular();
- perp2 = axis.copy().cross(perp1).normalize();
- pts = [point1.copy().add(perp1).subtract(perp2), point1.copy().add(perp1).add(perp2), point1.copy().subtract(perp1).add(perp2), point1.copy().subtract(perp1).subtract(perp2)];
- return seen.Shapes.extrude(pts, axis);
- },
patch: function(nx, ny) {
var aa, ab, ac, column, len1, len2, len3, o, p, pts, pts0, pts1, ref, ref1, ref2, ref3, surfaces, u, x, y;
if (nx == null) {
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 39668af

Please sign in to comment.