jax 0.0.0.5 → 0.0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +26 -1
- data/Rakefile +3 -1
- data/builtin/shaders/picking/common.ejs +2 -0
- data/builtin/shaders/picking/fragment.ejs +4 -0
- data/builtin/shaders/picking/material.js +14 -0
- data/builtin/shaders/picking/vertex.ejs +24 -0
- data/lib/jax/generators/app/templates/public/javascripts/jax.js +289 -681
- data/lib/jax/generators/app/templates/spec/javascripts/support/spec_layout.html.erb +55 -2
- data/lib/jax/generators/shader/templates/common.ejs.tt +2 -2
- data/lib/jax/packager/sprockets_template.rb +1 -4
- data/lib/jax/routes.rb +3 -0
- data/lib/jax/version.rb +1 -1
- data/spec/example_app/app/controllers/noise_controller.js +37 -5
- data/spec/example_app/app/controllers/picking_controller.js +32 -0
- data/spec/example_app/app/helpers/picking_helper.js +3 -0
- data/spec/example_app/app/models/blob.js +38 -0
- data/spec/example_app/app/resources/blobs/default.yml +2 -0
- data/spec/example_app/app/resources/materials/blob.yml +2 -2
- data/spec/example_app/app/shaders/blob/common.ejs +8 -13
- data/spec/example_app/app/shaders/blob/fragment.ejs +1 -1
- data/spec/example_app/app/shaders/blob/material.js +15 -12
- data/spec/example_app/app/shaders/blob/vertex.ejs +33 -8
- data/spec/example_app/app/views/picking/index.js +4 -0
- data/spec/example_app/config/routes.rb +1 -0
- data/spec/example_app/spec/javascripts/controllers/picking_controller_spec.js +11 -0
- data/spec/example_app/spec/javascripts/helpers/picking_helper_spec.js +12 -0
- data/spec/example_app/spec/javascripts/models/blob_spec.js +11 -0
- data/spec/example_app/spec/javascripts/support/spec_layout.html.erb +40 -2
- data/spec/javascripts/jax/model_spec.js +10 -0
- data/spec/javascripts/jax/world_spec.js +74 -1
- data/spec/javascripts/shaders/preprocessor_spec.js +35 -0
- data/src/constants.yml +1 -1
- data/src/jax.js +30 -8
- data/src/jax/anim_frame.js +6 -2
- data/src/jax/builtin/meshes/cube.js +22 -1
- data/src/jax/builtin/meshes/plane.js +27 -0
- data/src/jax/builtin/meshes/quad.js +7 -1
- data/src/jax/builtin/meshes/sphere.js +20 -1
- data/src/jax/builtin/meshes/teapot.js +10 -0
- data/src/jax/builtin/meshes/torus.js +18 -0
- data/src/jax/compatibility.js +165 -2
- data/src/jax/context.js +176 -9
- data/src/jax/core.js +6 -3
- data/src/jax/core/math.js +18 -3
- data/src/jax/core/matrix_stack.js +4 -3
- data/src/jax/core/util.js +15 -0
- data/src/jax/events.js +67 -12
- data/src/jax/geometry.js +5 -1
- data/src/jax/geometry/plane.js +59 -5
- data/src/jax/{controller.js → mvc/controller.js} +38 -0
- data/src/jax/mvc/helper.js +35 -0
- data/src/jax/mvc/model.js +301 -0
- data/src/jax/{route_set.js → mvc/route_set.js} +0 -0
- data/src/jax/{view.js → mvc/view.js} +6 -0
- data/src/jax/{view_manager.js → mvc/view_manager.js} +1 -0
- data/src/jax/noise.js +13 -0
- data/src/jax/prototype/class.js +3 -0
- data/src/jax/prototype/extensions.js +26 -8
- data/src/jax/webgl/camera.js +6 -6
- data/src/jax/webgl/core/framebuffer.js +4 -4
- data/src/jax/webgl/material.js +16 -0
- data/src/jax/webgl/mesh.js +19 -4
- data/src/jax/webgl/scene/light_manager.js +8 -0
- data/src/jax/webgl/scene/light_source.js +3 -3
- data/src/jax/webgl/shader.js +4 -2
- data/src/jax/webgl/shader_chain.js +1 -0
- data/src/jax/webgl/world.js +157 -6
- data/vendor/glmatrix/glMatrix.js +365 -408
- metadata +32 -10
- data/src/jax/helper.js +0 -8
- data/src/jax/model.js +0 -163
@@ -51,8 +51,33 @@
|
|
51
51
|
If not, you'll need to point it at a Jax controller manually:
|
52
52
|
*/
|
53
53
|
// context.redirect_to("controller_name/action_name");
|
54
|
+
|
55
|
+
/* Set up framerate monitoring */
|
56
|
+
function updateFramerateMessage() {
|
57
|
+
document.getElementById('jax_fps').innerHTML = parseInt(context.getFramesPerSecond());
|
58
|
+
document.getElementById('jax_ups').innerHTML = parseInt(context.getUpdatesPerSecond());
|
59
|
+
}
|
60
|
+
window.context.afterUpdate(function() { if (document.show_framerate) updateFramerateMessage(); });
|
54
61
|
};
|
55
62
|
})();
|
63
|
+
|
64
|
+
/*
|
65
|
+
helpers for the framerate links. Updating the DIV with framerates incurs a performance
|
66
|
+
hit, so it's disabled by default; enable it when you need it, leave it when you don't.
|
67
|
+
*/
|
68
|
+
function showFramerate() {
|
69
|
+
document.show_framerate = true;
|
70
|
+
document.getElementById('jax_fpsups').style.display = 'inline';
|
71
|
+
document.getElementById('jax_showfps').style.display = "none";
|
72
|
+
}
|
73
|
+
|
74
|
+
function hideFramerate() {
|
75
|
+
document.show_Framerate = false;
|
76
|
+
context.disableFrameSpeedCalculations();
|
77
|
+
context.disableUpdateSpeedCalculations();
|
78
|
+
document.getElementById('jax_fpsups').style.display = "none";
|
79
|
+
document.getElementById('jax_showfps').style.display = "inline";
|
80
|
+
}
|
56
81
|
</script>
|
57
82
|
|
58
83
|
<% js_files.each do |js_file| %>
|
@@ -68,17 +93,30 @@
|
|
68
93
|
background-color: #fff0f0;
|
69
94
|
font-size:14pt;
|
70
95
|
}
|
96
|
+
|
97
|
+
#jax_fpsups { display:none; }
|
98
|
+
#jax_fps { display:inline; }
|
99
|
+
#jax_ups { display:inline; }
|
71
100
|
</style>
|
72
101
|
</head>
|
73
102
|
<body>
|
74
103
|
<div id="jax_banner">
|
75
|
-
Jax
|
104
|
+
<!-- or we could use <%%=Jax::Version::STRING%> for the Rubygem version -->
|
105
|
+
Jax v<script type="text/javascript">document.write(Jax.VERSION);</script>
|
106
|
+
→
|
107
|
+
<a href="#" id="jax_showfps" onclick="showFramerate();return false;">Show Framerate</a>
|
108
|
+
<div id="jax_fpsups">
|
109
|
+
Frames per second: <div id="jax_fps">(calculating...)</div>
|
110
|
+
Updates per second: <div id="jax_ups">(calculating...)</div>
|
111
|
+
<a href="#" onclick="hideFramerate();return false;">Hide Framerate</a>
|
112
|
+
</div>
|
76
113
|
</div>
|
77
114
|
<div id="jax_nav">
|
78
115
|
<a href="#" onclick="context.redirectTo('/');return false;">Lighting w/Multiple Sources</a> |
|
79
116
|
<a href="#" onclick="context.redirectTo('shadows');return false;">Shadows</a> |
|
80
117
|
<a href="#" onclick="context.redirectTo('textures');return false;">Textures</a> |
|
81
|
-
<a href="#" onclick="context.redirectTo('noise');return false;">Noise Functions</a>
|
118
|
+
<a href="#" onclick="context.redirectTo('noise');return false;">Noise Functions</a> |
|
119
|
+
<a href="#" onclick="context.redirectTo('picking');return false;">Picking</a>
|
82
120
|
</div>
|
83
121
|
<div id="jasmine_content"></div>
|
84
122
|
</body>
|
@@ -23,6 +23,16 @@ describe("Jax.Model", function() {
|
|
23
23
|
expect(model.one.value).not.toEqual(2);
|
24
24
|
});
|
25
25
|
});
|
26
|
+
|
27
|
+
describe("added to world without a mesh", function() {
|
28
|
+
var context;
|
29
|
+
beforeEach(function() { model = new (Jax.Model.create({after_initialize:function(){}}))({position:[0,0,0]}); context = new Jax.Context('canvas-element'); context.world.addObject(model); });
|
30
|
+
afterEach(function() { context.dispose(); });
|
31
|
+
|
32
|
+
it("should not cause errors when rendering", function() {
|
33
|
+
expect(function() { context.world.render(); }).not.toThrow();
|
34
|
+
});
|
35
|
+
});
|
26
36
|
|
27
37
|
describe("without any custom methods", function() {
|
28
38
|
beforeEach(function() {
|
@@ -4,11 +4,84 @@ describe("Jax.World", function() {
|
|
4
4
|
|
5
5
|
beforeEach(function() {
|
6
6
|
context = new Jax.Context('canvas-element');
|
7
|
+
context.prepare();
|
7
8
|
world = context.world;
|
8
9
|
});
|
9
10
|
|
10
11
|
afterEach(function() {
|
11
|
-
|
12
|
+
context.dispose();
|
13
|
+
});
|
14
|
+
|
15
|
+
describe("picking", function() {
|
16
|
+
var at, ofront, otopleft, otopright, obottomleft, obottomright, mesh;
|
17
|
+
|
18
|
+
beforeEach(function() {
|
19
|
+
var width = document.getElementById('canvas-element').width,
|
20
|
+
height = document.getElementById('canvas-element').height;
|
21
|
+
at = { left: 0, right: width-1, top: height-1, bottom: 0,
|
22
|
+
center_x: parseInt(width/2), center_y: parseInt(height/2) };
|
23
|
+
|
24
|
+
// put some objects in the world for picking
|
25
|
+
// function mesh() { return new Jax.Mesh.Sphere({size:1.0}); }
|
26
|
+
mesh = new Jax.Mesh.Sphere();
|
27
|
+
ofront = world.addObject(new Jax.Model({position:[ 0.0, 0.0, -5], mesh:mesh}));
|
28
|
+
otopleft = world.addObject(new Jax.Model({position:[-2.5, 2.5, -5],mesh:mesh}));
|
29
|
+
otopright = world.addObject(new Jax.Model({position:[ 2.5, 2.5, -5],mesh:mesh}));
|
30
|
+
obottomleft = world.addObject(new Jax.Model({position:[-2.5,-2.5, -5],mesh:mesh}));
|
31
|
+
obottomright = world.addObject(new Jax.Model({position:[ 2.5,-2.5, -5],mesh:mesh}));
|
32
|
+
});
|
33
|
+
|
34
|
+
it("center", function() { expect(world.pick(at.center_x, at.center_y)).toEqual(ofront); });
|
35
|
+
it("top left", function() { expect(world.pick(at.left, at.top)).toEqual(otopleft); });
|
36
|
+
it("top right", function() { expect(world.pick(at.right,at.top)).toEqual(otopright); });
|
37
|
+
it("bottom left", function() { expect(world.pick(at.left, at.bottom)).toEqual(obottomleft); });
|
38
|
+
it("bottom right", function() { expect(world.pick(at.right,at.bottom)).toEqual(obottomright); });
|
39
|
+
/*
|
40
|
+
it("region: everything", function() {
|
41
|
+
var objects = world.pickRegion(at.left, at.top, at.right, at.bottom);
|
42
|
+
expect(objects).toContain(ofront);
|
43
|
+
expect(objects).toContain(otopleft);
|
44
|
+
expect(objects).toContain(otopright);
|
45
|
+
expect(objects).toContain(obottomleft);
|
46
|
+
expect(objects).toContain(obottomright);
|
47
|
+
});
|
48
|
+
|
49
|
+
it("region: top-left quadrant", function() {
|
50
|
+
var objects = world.pickRegion(at.left, at.top, at.center_x, at.center_y);
|
51
|
+
expect(objects).toContain(ofront);
|
52
|
+
expect(objects).toContain(otopleft);
|
53
|
+
expect(objects).not.toContain(otopright);
|
54
|
+
expect(objects).not.toContain(obottomleft);
|
55
|
+
expect(objects).not.toContain(obottomright);
|
56
|
+
});
|
57
|
+
|
58
|
+
it("region: top-right quadrant", function() {
|
59
|
+
var objects = world.pickRegion(at.right, at.top, at.center_x, at.center_y);
|
60
|
+
expect(objects).toContain(ofront);
|
61
|
+
expect(objects).not.toContain(otopleft);
|
62
|
+
expect(objects).toContain(otopright);
|
63
|
+
expect(objects).not.toContain(obottomleft);
|
64
|
+
expect(objects).not.toContain(obottomright);
|
65
|
+
});
|
66
|
+
|
67
|
+
it("region: bottom-left quadrant", function() {
|
68
|
+
var objects = world.pickRegion(at.left, at.bottom, at.center_x, at.center_y);
|
69
|
+
expect(objects).toContain(ofront);
|
70
|
+
expect(objects).not.toContain(otopleft);
|
71
|
+
expect(objects).not.toContain(otopright);
|
72
|
+
expect(objects).toContain(obottomleft);
|
73
|
+
expect(objects).not.toContain(obottomright);
|
74
|
+
});
|
75
|
+
|
76
|
+
it("region: bottom-right quadrant", function() {
|
77
|
+
var objects = world.pickRegion(at.right, at.bottom, at.center_x, at.center_y);
|
78
|
+
expect(objects).toContain(ofront);
|
79
|
+
expect(objects).not.toContain(otopleft);
|
80
|
+
expect(objects).not.toContain(otopright);
|
81
|
+
expect(objects).not.toContain(obottomleft);
|
82
|
+
expect(objects).toContain(obottomright);
|
83
|
+
});
|
84
|
+
*/
|
12
85
|
});
|
13
86
|
|
14
87
|
describe("with an object", function() {
|
@@ -0,0 +1,35 @@
|
|
1
|
+
describe("Preprocessor", function() {
|
2
|
+
var context;
|
3
|
+
var matr;
|
4
|
+
|
5
|
+
describe("with multiple similar vardecs", function() {
|
6
|
+
Jax.shaders['test'] = new Jax.Shader({
|
7
|
+
vertex: "shared uniform mat4 ivMatrix, mvMatrix, pMatrix, vMatrix;\n" +
|
8
|
+
"uniform mat4 imvMatrix;\n" +
|
9
|
+
"void main(void) { gl_Position = pMatrix * imvMatrix * vec4(0,0,0,1); }",
|
10
|
+
fragment: "void main(void) { }",
|
11
|
+
name: "test"
|
12
|
+
});
|
13
|
+
|
14
|
+
var TestMaterial = Jax.Class.create(Jax.Material, {
|
15
|
+
initialize: function($super) { $super({shader: "test"}); },
|
16
|
+
|
17
|
+
setUniforms: function($super, context, mesh, options, uniforms) {
|
18
|
+
$super(context, mesh, options, uniforms);
|
19
|
+
uniforms.set('imvMatrix', context.getInverseModelViewMatrix());
|
20
|
+
}
|
21
|
+
});
|
22
|
+
|
23
|
+
beforeEach(function() {
|
24
|
+
context = new Jax.Context(document.getElementById('canvas-element'));
|
25
|
+
matr = new Jax.Material();
|
26
|
+
matr.addLayer(new TestMaterial());
|
27
|
+
});
|
28
|
+
|
29
|
+
afterEach(function() { context.dispose(); });
|
30
|
+
|
31
|
+
it("should should not fail", function() {
|
32
|
+
new Jax.Mesh({material:matr}).render(context);
|
33
|
+
});
|
34
|
+
});
|
35
|
+
});
|
data/src/constants.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
JAX_VERSION: 0.0.0.
|
1
|
+
JAX_VERSION: 0.0.0.6
|
data/src/jax.js
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* Global
|
3
|
+
* Objects and functions defined here are available in the global (window) scope.
|
4
|
+
**/
|
5
|
+
|
1
6
|
/**
|
2
7
|
* Jax
|
3
8
|
* Root namespace containing all Jax data
|
@@ -29,12 +34,12 @@ Jax.default_shader = "basic";
|
|
29
34
|
//= require "jax/core"
|
30
35
|
//= require "jax/anim_frame"
|
31
36
|
//= require "jax/prototype/extensions"
|
32
|
-
//= require "jax/helper"
|
33
|
-
//= require "jax/model"
|
34
|
-
//= require "jax/controller"
|
35
|
-
//= require "jax/view_manager"
|
36
|
-
//= require "jax/route_set"
|
37
|
-
//= require "jax/view"
|
37
|
+
//= require "jax/mvc/helper"
|
38
|
+
//= require "jax/mvc/model"
|
39
|
+
//= require "jax/mvc/controller"
|
40
|
+
//= require "jax/mvc/view_manager"
|
41
|
+
//= require "jax/mvc/route_set"
|
42
|
+
//= require "jax/mvc/view"
|
38
43
|
//= require "jax/context"
|
39
44
|
//= require "jax/noise"
|
40
45
|
|
@@ -62,8 +67,10 @@ Jax.loaded = true;
|
|
62
67
|
* This is not a guaranteed number in JavaScript, just a target. Most notably,
|
63
68
|
* system performance issues can drive the framerate down regardless of the
|
64
69
|
* target refresh rate.
|
70
|
+
*
|
71
|
+
* Defaults to 16, for a target rate of 60 frames per second.
|
65
72
|
**/
|
66
|
-
Jax.render_speed =
|
73
|
+
Jax.render_speed = 16;
|
67
74
|
|
68
75
|
/**
|
69
76
|
* Jax.update_speed -> Number
|
@@ -71,8 +78,10 @@ Jax.render_speed = 15;
|
|
71
78
|
* This is not a guaranteed number in JavaScript, just a target. Most notably,
|
72
79
|
* system performance issues can drive the framerate down regardless of the
|
73
80
|
* target refresh rate.
|
81
|
+
*
|
82
|
+
* Defaults to 33, for a target rate of 30 updates per second.
|
74
83
|
**/
|
75
|
-
Jax.update_speed =
|
84
|
+
Jax.update_speed = 33;
|
76
85
|
|
77
86
|
|
78
87
|
/**
|
@@ -86,6 +95,19 @@ Jax.update_speed = 15;
|
|
86
95
|
**/
|
87
96
|
Jax.max_lights = undefined;
|
88
97
|
|
98
|
+
/**
|
99
|
+
* Jax.uptime -> Number
|
100
|
+
*
|
101
|
+
* The amount of time the Jax subsystem has been running, in seconds. This is updated
|
102
|
+
* whether any contexts are active or not. It is used for tracking update intervals
|
103
|
+
* and framerates, so that individual Jax contexts are not constantly spawning new
|
104
|
+
* Date() instances (which then have to be garbage collected).
|
105
|
+
**/
|
106
|
+
Jax.uptime = 0.0;
|
107
|
+
Jax.uptime_tracker = new Date();
|
108
|
+
|
109
|
+
/* TODO: verify : is setInterval better for updates, or should be we using requestAnimFrame? */
|
110
|
+
setInterval(function() { Jax.uptime = (new Date() - Jax.uptime_tracker) / 1000; }, 33);
|
89
111
|
|
90
112
|
//= require "jax/builtin/all.js"
|
91
113
|
|
data/src/jax/anim_frame.js
CHANGED
@@ -30,9 +30,13 @@
|
|
30
30
|
*/
|
31
31
|
|
32
32
|
|
33
|
-
|
33
|
+
/**
|
34
|
+
* Global.requestAnimFrame(callback, element) -> undefined
|
35
|
+
* - callback (Function): callback to be fired to initiate a render sequence
|
36
|
+
* - element (DOMElement): a DOM element to attach the animation state to
|
37
|
+
*
|
34
38
|
* Provides requestAnimationFrame in a cross browser way.
|
35
|
-
|
39
|
+
**/
|
36
40
|
window.requestAnimFrame = (function() {
|
37
41
|
return window.requestAnimationFrame ||
|
38
42
|
window.webkitRequestAnimationFrame ||
|
@@ -1,3 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* class Jax.Mesh.Cube < Jax.Mesh
|
3
|
+
*
|
4
|
+
* Constructs a 6-sided Cube mesh.
|
5
|
+
*
|
6
|
+
* Options:
|
7
|
+
*
|
8
|
+
* * width : the width of the cube in units. Defaults to +size+.
|
9
|
+
* * height : the height of the cube in units. Defaults to +size+.
|
10
|
+
* * depth : the depth of the cube in units. Defaults to +size+.
|
11
|
+
* * size : a value to use for any of the other options if
|
12
|
+
* they are unspecified. Defaults to 1.0.
|
13
|
+
*
|
14
|
+
* Example:
|
15
|
+
*
|
16
|
+
* new Jax.Mesh.Cube(); //=> 1x1x1
|
17
|
+
* new Jax.Mesh.Cube({size:2}); //=> 2x2x2
|
18
|
+
* new Jax.Mesh.Cube({width:2}); //=> 2x1x1
|
19
|
+
* new Jax.Mesh.Cube({width:2,depth:3}); //=> 2x1x3
|
20
|
+
*
|
21
|
+
**/
|
1
22
|
Jax.Mesh.Cube = Jax.Class.create(Jax.Mesh, {
|
2
23
|
initialize: function($super, options) {
|
3
24
|
var size = options && options.size || 1.0;
|
@@ -40,7 +61,7 @@ Jax.Mesh.Cube = Jax.Class.create(Jax.Mesh, {
|
|
40
61
|
{
|
41
62
|
var qverts = [], qcolor = [], qtex = [], qnorm = [];
|
42
63
|
this.sides[i].mesh.init(qverts, qcolor, qtex, qnorm, []);
|
43
|
-
matrix = this.sides[i].camera.
|
64
|
+
matrix = this.sides[i].camera.getTransformationMatrix();
|
44
65
|
|
45
66
|
// unfortunately quads are rendered in triangle strips; we need to translate that
|
46
67
|
// into triangles, because there's no support at this time for ending one triangle
|
@@ -1,3 +1,30 @@
|
|
1
|
+
/**
|
2
|
+
* class Jax.Mesh.Plane < Jax.Mesh
|
3
|
+
*
|
4
|
+
* Constructs a multi-polygonal flat plane treating the center of
|
5
|
+
* the plane as the origin.
|
6
|
+
*
|
7
|
+
* Options:
|
8
|
+
*
|
9
|
+
* * width : the width of the cube in units. Defaults to +size+.
|
10
|
+
* * depth : the depth of the cube in units. Defaults to +size+.
|
11
|
+
* * size : a value to use for any of the other dimensional options if
|
12
|
+
* they are unspecified. Defaults to 500.0.
|
13
|
+
* * x_segments : the number of vertices along the plane's X axis.
|
14
|
+
* Defaults to +segments+.
|
15
|
+
* * z_segments : the number of vertices along the plane's Z axis.
|
16
|
+
* Defaults to +segments+.
|
17
|
+
* * segments : a value to use for any of the other segment count options
|
18
|
+
* if they are unspecified. Defaults to 20.
|
19
|
+
*
|
20
|
+
* Examples:
|
21
|
+
*
|
22
|
+
* new Jax.Mesh.Plane();
|
23
|
+
* new Jax.Mesh.Plane({size:2});
|
24
|
+
* new Jax.Mesh.Plane({width:2});
|
25
|
+
* new Jax.Mesh.Plane({width:2,x_segments:2});
|
26
|
+
*
|
27
|
+
**/
|
1
28
|
Jax.Mesh.Plane = Jax.Class.create(Jax.Mesh, {
|
2
29
|
initialize: function($super, options) {
|
3
30
|
options = options || {};
|
@@ -5,10 +5,16 @@
|
|
5
5
|
*
|
6
6
|
* This mesh is generally used for testing purposes, or for simple, textured objects like smoke particles.
|
7
7
|
*
|
8
|
+
* Options:
|
9
|
+
*
|
10
|
+
* * width : the width of this quad in units along the X axis. Defaults to +size+.
|
11
|
+
* * height : the height of this quad in units along the Y axis. Defaults to +size+.
|
12
|
+
* * size : a value to use for both width and height. Defaults to 1.0.
|
13
|
+
*
|
8
14
|
* Examples:
|
9
15
|
*
|
10
16
|
* var quad = new Jax.Mesh.Quad({width: 2, height: 1});
|
11
|
-
* var quad = new Jax.Mesh.Quad(1.5);
|
17
|
+
* var quad = new Jax.Mesh.Quad({size:1.5});
|
12
18
|
*
|
13
19
|
**/
|
14
20
|
Jax.Mesh.Quad = (function() {
|
@@ -1,3 +1,22 @@
|
|
1
|
+
/**
|
2
|
+
* class Jax.Mesh.Sphere < Jax.Mesh
|
3
|
+
*
|
4
|
+
* A spherical mesh.
|
5
|
+
*
|
6
|
+
* Takes 3 options:
|
7
|
+
*
|
8
|
+
* * radius: the size of this sphere. Defaults to 1.
|
9
|
+
* * slices: the number of lines of longitude. The higher this value is, the smoother and more perfect the sphere will
|
10
|
+
* appear but the more hardware-intensive rendering it will be. Defaults to 30.
|
11
|
+
* * stacks: The number of lines of latitude. The higher this value is, the smoother and more perfect the sphere will
|
12
|
+
* appear but the more hardware-intensive rendering it will be. Defaults to 30.
|
13
|
+
*
|
14
|
+
* Examples:
|
15
|
+
*
|
16
|
+
* new Jax.Mesh.Sphere({radius:2.0});
|
17
|
+
* new Jax.Mesh.Sphere({slices:8, stacks:8, radius: 10.0});
|
18
|
+
*
|
19
|
+
**/
|
1
20
|
Jax.Mesh.Sphere = Jax.Class.create(Jax.Mesh, {
|
2
21
|
initialize: function($super, options) {
|
3
22
|
options = options || {};
|
@@ -43,4 +62,4 @@ Jax.Mesh.Sphere = Jax.Class.create(Jax.Mesh, {
|
|
43
62
|
}
|
44
63
|
}
|
45
64
|
}
|
46
|
-
});
|
65
|
+
});
|
@@ -1,3 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* class Jax.Mesh.Teapot < Jax.Mesh
|
3
|
+
*
|
4
|
+
* A teapot. Accepts a single +size+ attribute, used to scale the mesh, which defaults to 1.0.
|
5
|
+
*
|
6
|
+
* Examples:
|
7
|
+
*
|
8
|
+
* new Jax.Mesh.Teapot({size:10.5});
|
9
|
+
*
|
10
|
+
**/
|
1
11
|
Jax.Mesh.Teapot = (function() {
|
2
12
|
var teapot = {
|
3
13
|
"vertices" : [5.929688,4.125,0,5.387188,4.125,2.7475,5.2971,4.494141,2.70917,5.832031,4.494141,0,5.401602,4.617188,2.753633,5.945313,4.617188,0,5.614209,4.494141,2.844092,6.175781,4.494141,0,5.848437,4.125,2.94375,6.429688,4.125,0,3.899688,4.125,4.97,3.830352,4.494141,4.900664,3.910782,4.617188,4.981094,4.074414,4.494141,5.144727,4.254687,4.125,5.325,1.677188,4.125,6.4575,1.638858,4.494141,6.367412,1.68332,4.617188,6.471914,1.77378,4.494141,6.684522,1.873438,4.125,6.91875,-1.070312,4.125,7,-1.070312,4.494141,6.902344,-1.070312,4.617188,7.015625,-1.070312,4.494141,7.246094,-1.070312,4.125,7.5,-1.070312,4.125,7,-4.007656,4.125,6.4575,-3.859572,4.494141,6.367412,-1.070312,4.494141,6.902344,-3.847676,4.617188,6.471914,-1.070312,4.617188,7.015625,-3.917371,4.494141,6.684522,-1.070312,4.494141,7.246094,-4.014062,4.125,6.91875,-1.070312,4.125,7.5,-6.209063,4.125,4.97,-6.042168,4.494141,4.900664,-6.0725,4.617188,4.981094,-6.217675,4.494141,5.144727,-6.395312,4.125,5.325,-7.591093,4.125,2.7475,-7.464421,4.494141,2.70917,-7.550137,4.617188,2.753633,-7.755822,4.494141,2.844092,-7.989062,4.125,2.94375,-8.070313,4.125,0,-7.972656,4.494141,0,-8.085938,4.617188,0,-8.316406,4.494141,0,-8.570313,4.125,0,-8.070313,4.125,0,-7.527812,4.125,-2.7475,-7.437724,4.494141,-2.70917,-7.972656,4.494141,0,-7.542227,4.617188,-2.753633,-8.085938,4.617188,0,-7.754834,4.494141,-2.844092,-8.316406,4.494141,0,-7.989062,4.125,-2.94375,-8.570313,4.125,0,-6.040312,4.125,-4.97,-5.970977,4.494141,-4.900664,-6.051406,4.617188,-4.981094,-6.215039,4.494141,-5.144727,-6.395312,4.125,-5.325,-3.817812,4.125,-6.4575,-3.779482,4.494141,-6.367412,-3.823945,4.617188,-6.471914,-3.914404,4.494141,-6.684522,-4.014062,4.125,-6.91875,-1.070312,4.125,-7,-1.070312,4.494141,-6.902344,-1.070312,4.617188,-7.015625,-1.070312,4.494141,-7.246094,-1.070312,4.125,-7.5,-1.070312,4.125,-7,1.677188,4.125,-6.4575,1.638858,4.494141,-6.367412,-1.070312,4.494141,-6.902344,1.68332,4.617188,-6.471914,-1.070312,4.617188,-7.015625,1.77378,4.494141,-6.684522,-1.070312,4.494141,-7.246094,1.873438,4.125,-6.91875,-1.070312,4.125,-7.5,3.899688,4.125,-4.97,3.830352,4.494141,-4.900664,3.910782,4.617188,-4.981094,4.074414,4.494141,-5.144727,4.254687,4.125,-5.325,5.387188,4.125,-2.7475,5.2971,4.494141,-2.70917,5.401602,4.617188,-2.753633,5.614209,4.494141,-2.844092,5.848437,4.125,-2.94375,5.929688,4.125,0,5.832031,4.494141,0,5.945313,4.617188,0,6.175781,4.494141,0,6.429688,4.125,0,6.429688,4.125,0,5.848437,4.125,2.94375,6.695264,2.162109,3.304053,7.347656,2.162109,0,7.433985,0.234375,3.61836,8.148438,0.234375,0,7.956494,-1.623047,3.840674,8.714844,-1.623047,0,8.154688,-3.375,3.925,8.929688,-3.375,0,4.254687,4.125,5.325,4.906446,2.162109,5.976758,5.475,0.234375,6.545312,5.877149,-1.623047,6.947461,6.029688,-3.375,7.1,1.873438,4.125,6.91875,2.23374,2.162109,7.765576,2.548047,0.234375,8.504297,2.770362,-1.623047,9.026807,2.854688,-3.375,9.225,-1.070312,4.125,7.5,-1.070312,2.162109,8.417969,-1.070312,0.234375,9.21875,-1.070312,-1.623047,9.785156,-1.070312,-3.375,10,-1.070312,4.125,7.5,-4.014062,4.125,6.91875,-4.374365,2.162109,7.765576,-1.070312,2.162109,8.417969,-4.688672,0.234375,8.504297,-1.070312,0.234375,9.21875,-4.910986,-1.623047,9.026807,-1.070312,-1.623047,9.785156,-4.995313,-3.375,9.225,-1.070312,-3.375,10,-6.395312,4.125,5.325,-7.047071,2.162109,5.976758,-7.615624,0.234375,6.545312,-8.017773,-1.623047,6.947461,-8.170312,-3.375,7.1,-7.989062,4.125,2.94375,-8.835889,2.162109,3.304053,-9.57461,0.234375,3.61836,-10.097119,-1.623047,3.840674,-10.295313,-3.375,3.925,-8.570313,4.125,0,-9.488281,2.162109,0,-10.289063,0.234375,0,-10.855469,-1.623047,0,-11.070313,-3.375,0,-8.570313,4.125,0,-7.989062,4.125,-2.94375,-8.835889,2.162109,-3.304053,-9.488281,2.162109,0,-9.57461,0.234375,-3.61836,-10.289063,0.234375,0,-10.097119,-1.623047,-3.840674,-10.855469,-1.623047,0,-10.295313,-3.375,-3.925,-11.070313,-3.375,0,-6.395312,4.125,-5.325,-7.047071,2.162109,-5.976758,-7.615624,0.234375,-6.545312,-8.017773,-1.623047,-6.947461,-8.170312,-3.375,-7.1,-4.014062,4.125,-6.91875,-4.374365,2.162109,-7.765576,-4.688672,0.234375,-8.504297,-4.910986,-1.623047,-9.026807,-4.995313,-3.375,-9.225,-1.070312,4.125,-7.5,-1.070312,2.162109,-8.417969,-1.070312,0.234375,-9.21875,-1.070312,-1.623047,-9.785156,-1.070312,-3.375,-10,-1.070312,4.125,-7.5,1.873438,4.125,-6.91875,2.23374,2.162109,-7.765576,-1.070312,2.162109,-8.417969,2.548047,0.234375,-8.504297,-1.070312,0.234375,-9.21875,2.770362,-1.623047,-9.026807,-1.070312,-1.623047,-9.785156,2.854688,-3.375,-9.225,-1.070312,-3.375,-10,4.254687,4.125,-5.325,4.906446,2.162109,-5.976758,5.475,0.234375,-6.545312,5.877149,-1.623047,-6.947461,6.029688,-3.375,-7.1,5.848437,4.125,-2.94375,6.695264,2.162109,-3.304053,7.433985,0.234375,-3.61836,7.956494,-1.623047,-3.840674,8.154688,-3.375,-3.925,6.429688,4.125,0,7.347656,2.162109,0,8.148438,0.234375,0,8.714844,-1.623047,0,8.929688,-3.375,0,8.929688,-3.375,0,8.154688,-3.375,3.925,7.794336,-4.857422,3.77168,8.539063,-4.857422,0,7.001562,-5.953125,3.434375,7.679688,-5.953125,0,6.208789,-6.697266,3.09707,6.820313,-6.697266,0,5.848437,-7.125,2.94375,6.429688,-7.125,0,6.029688,-3.375,7.1,5.752343,-4.857422,6.822656,5.142187,-5.953125,6.2125,4.532031,-6.697266,5.602344,4.254687,-7.125,5.325,2.854688,-3.375,9.225,2.701367,-4.857422,8.864649,2.364063,-5.953125,8.071875,2.026758,-6.697266,7.279101,1.873438,-7.125,6.91875,-1.070312,-3.375,10,-1.070312,-4.857422,9.609375,-1.070312,-5.953125,8.75,-1.070312,-6.697266,7.890625,-1.070312,-7.125,7.5,-1.070312,-3.375,10,-4.995313,-3.375,9.225,-4.841992,-4.857422,8.864649,-1.070312,-4.857422,9.609375,-4.504687,-5.953125,8.071875,-1.070312,-5.953125,8.75,-4.167383,-6.697266,7.279101,-1.070312,-6.697266,7.890625,-4.014062,-7.125,6.91875,-1.070312,-7.125,7.5,-8.170312,-3.375,7.1,-7.892968,-4.857422,6.822656,-7.282812,-5.953125,6.2125,-6.672656,-6.697266,5.602344,-6.395312,-7.125,5.325,-10.295313,-3.375,3.925,-9.934961,-4.857422,3.77168,-9.142187,-5.953125,3.434375,-8.349414,-6.697266,3.09707,-7.989062,-7.125,2.94375,-11.070313,-3.375,0,-10.679688,-4.857422,0,-9.820313,-5.953125,0,-8.960938,-6.697266,0,-8.570313,-7.125,0,-11.070313,-3.375,0,-10.295313,-3.375,-3.925,-9.934961,-4.857422,-3.77168,-10.679688,-4.857422,0,-9.142187,-5.953125,-3.434375,-9.820313,-5.953125,0,-8.349414,-6.697266,-3.09707,-8.960938,-6.697266,0,-7.989062,-7.125,-2.94375,-8.570313,-7.125,0,-8.170312,-3.375,-7.1,-7.892968,-4.857422,-6.822656,-7.282812,-5.953125,-6.2125,-6.672656,-6.697266,-5.602344,-6.395312,-7.125,-5.325,-4.995313,-3.375,-9.225,-4.841992,-4.857422,-8.864649,-4.504687,-5.953125,-8.071875,-4.167383,-6.697266,-7.279101,-4.014062,-7.125,-6.91875,-1.070312,-3.375,-10,-1.070312,-4.857422,-9.609375,-1.070312,-5.953125,-8.75,-1.070312,-6.697266,-7.890625,-1.070312,-7.125,-7.5,-1.070312,-3.375,-10,2.854688,-3.375,-9.225,2.701367,-4.857422,-8.864649,-1.070312,-4.857422,-9.609375,2.364063,-5.953125,-8.071875,-1.070312,-5.953125,-8.75,2.026758,-6.697266,-7.279101,-1.070312,-6.697266,-7.890625,1.873438,-7.125,-6.91875,-1.070312,-7.125,-7.5,6.029688,-3.375,-7.1,5.752343,-4.857422,-6.822656,5.142187,-5.953125,-6.2125,4.532031,-6.697266,-5.602344,4.254687,-7.125,-5.325,8.154688,-3.375,-3.925,7.794336,-4.857422,-3.77168,7.001562,-5.953125,-3.434375,6.208789,-6.697266,-3.09707,5.848437,-7.125,-2.94375,8.929688,-3.375,0,8.539063,-4.857422,0,7.679688,-5.953125,0,6.820313,-6.697266,0,6.429688,-7.125,0,6.429688,-7.125,0,5.848437,-7.125,2.94375,5.691685,-7.400391,2.877056,6.259766,-7.400391,0,4.853868,-7.640625,2.520586,5.351563,-7.640625,0,2.783648,-7.810547,1.639761,3.107422,-7.810547,0,-1.070312,-7.875,0,4.254687,-7.125,5.325,4.134043,-7.400391,5.204355,3.489219,-7.640625,4.559531,1.895879,-7.810547,2.966191,-1.070312,-7.875,0,1.873438,-7.125,6.91875,1.806743,-7.400391,6.761997,1.450274,-7.640625,5.92418,0.569448,-7.810547,3.85396,-1.070312,-7.875,0,-1.070312,-7.125,7.5,-1.070312,-7.400391,7.330078,-1.070312,-7.640625,6.421875,-1.070312,-7.810547,4.177734,-1.070312,-7.875,0,-1.070312,-7.125,7.5,-4.014062,-7.125,6.91875,-3.947368,-7.400391,6.761997,-1.070312,-7.400391,7.330078,-3.590898,-7.640625,5.92418,-1.070312,-7.640625,6.421875,-2.710073,-7.810547,3.85396,-1.070312,-7.810547,4.177734,-1.070312,-7.875,0,-6.395312,-7.125,5.325,-6.274668,-7.400391,5.204355,-5.629844,-7.640625,4.559531,-4.036504,-7.810547,2.966191,-1.070312,-7.875,0,-7.989062,-7.125,2.94375,-7.832309,-7.400391,2.877056,-6.994492,-7.640625,2.520586,-4.924272,-7.810547,1.639761,-1.070312,-7.875,0,-8.570313,-7.125,0,-8.400391,-7.400391,0,-7.492188,-7.640625,0,-5.248047,-7.810547,0,-1.070312,-7.875,0,-8.570313,-7.125,0,-7.989062,-7.125,-2.94375,-7.832309,-7.400391,-2.877056,-8.400391,-7.400391,0,-6.994492,-7.640625,-2.520586,-7.492188,-7.640625,0,-4.924272,-7.810547,-1.639761,-5.248047,-7.810547,0,-1.070312,-7.875,0,-6.395312,-7.125,-5.325,-6.274668,-7.400391,-5.204355,-5.629844,-7.640625,-4.559531,-4.036504,-7.810547,-2.966191,-1.070312,-7.875,0,-4.014062,-7.125,-6.91875,-3.947368,-7.400391,-6.761997,-3.590898,-7.640625,-5.92418,-2.710073,-7.810547,-3.85396,-1.070312,-7.875,0,-1.070312,-7.125,-7.5,-1.070312,-7.400391,-7.330078,-1.070312,-7.640625,-6.421875,-1.070312,-7.810547,-4.177734,-1.070312,-7.875,0,-1.070312,-7.125,-7.5,1.873438,-7.125,-6.91875,1.806743,-7.400391,-6.761997,-1.070312,-7.400391,-7.330078,1.450274,-7.640625,-5.92418,-1.070312,-7.640625,-6.421875,0.569448,-7.810547,-3.85396,-1.070312,-7.810547,-4.177734,-1.070312,-7.875,0,4.254687,-7.125,-5.325,4.134043,-7.400391,-5.204355,3.489219,-7.640625,-4.559531,1.895879,-7.810547,-2.966191,-1.070312,-7.875,0,5.848437,-7.125,-2.94375,5.691685,-7.400391,-2.877056,4.853868,-7.640625,-2.520586,2.783648,-7.810547,-1.639761,-1.070312,-7.875,0,6.429688,-7.125,0,6.259766,-7.400391,0,5.351563,-7.640625,0,3.107422,-7.810547,0,-1.070312,-7.875,0,-9.070313,2.25,0,-8.992188,2.425781,0.84375,-11.47583,2.405457,0.84375,-11.40625,2.232422,0,-13.298828,2.263184,0.84375,-13.132813,2.109375,0,-14.421631,1.877014,0.84375,-14.203125,1.775391,0,-14.804688,1.125,0.84375,-14.570313,1.125,0,-8.820313,2.8125,1.125,-11.628906,2.786134,1.125,-13.664063,2.601563,1.125,-14.902344,2.100586,1.125,-15.320313,1.125,1.125,-8.648438,3.199219,0.84375,-11.781982,3.166809,0.84375,-14.029297,2.939941,0.84375,-15.383057,2.324158,0.84375,-15.835938,1.125,0.84375,-8.570313,3.375,0,-11.851563,3.339844,0,-14.195313,3.09375,0,-15.601563,2.425781,0,-16.070313,1.125,0,-8.570313,3.375,0,-8.648438,3.199219,-0.84375,-11.781982,3.166809,-0.84375,-11.851563,3.339844,0,-14.029297,2.939941,-0.84375,-14.195313,3.09375,0,-15.383057,2.324158,-0.84375,-15.601563,2.425781,0,-15.835938,1.125,-0.84375,-16.070313,1.125,0,-8.820313,2.8125,-1.125,-11.628906,2.786134,-1.125,-13.664063,2.601563,-1.125,-14.902344,2.100586,-1.125,-15.320313,1.125,-1.125,-8.992188,2.425781,-0.84375,-11.47583,2.405457,-0.84375,-13.298828,2.263184,-0.84375,-14.421631,1.877014,-0.84375,-14.804688,1.125,-0.84375,-9.070313,2.25,0,-11.40625,2.232422,0,-13.132813,2.109375,0,-14.203125,1.775391,0,-14.570313,1.125,0,-14.570313,1.125,0,-14.804688,1.125,0.84375,-14.588013,0.00705,0.84375,-14.375,0.105469,0,-13.90918,-1.275146,0.84375,-13.757813,-1.125,0,-12.724976,-2.540863,0.84375,-12.671875,-2.355469,0,-10.992188,-3.609375,0.84375,-11.070313,-3.375,0,-15.320313,1.125,1.125,-15.056641,-0.209473,1.125,-14.242188,-1.605469,1.125,-12.841797,-2.94873,1.125,-10.820313,-4.125,1.125,-15.835938,1.125,0.84375,-15.525269,-0.425995,0.84375,-14.575195,-1.935791,0.84375,-12.958618,-3.356598,0.84375,-10.648438,-4.640625,0.84375,-16.070313,1.125,0,-15.738281,-0.524414,0,-14.726563,-2.085938,0,-13.011719,-3.541992,0,-10.570313,-4.875,0,-16.070313,1.125,0,-15.835938,1.125,-0.84375,-15.525269,-0.425995,-0.84375,-15.738281,-0.524414,0,-14.575195,-1.935791,-0.84375,-14.726563,-2.085938,0,-12.958618,-3.356598,-0.84375,-13.011719,-3.541992,0,-10.648438,-4.640625,-0.84375,-10.570313,-4.875,0,-15.320313,1.125,-1.125,-15.056641,-0.209473,-1.125,-14.242188,-1.605469,-1.125,-12.841797,-2.94873,-1.125,-10.820313,-4.125,-1.125,-14.804688,1.125,-0.84375,-14.588013,0.00705,-0.84375,-13.90918,-1.275146,-0.84375,-12.724976,-2.540863,-0.84375,-10.992188,-3.609375,-0.84375,-14.570313,1.125,0,-14.375,0.105469,0,-13.757813,-1.125,0,-12.671875,-2.355469,0,-11.070313,-3.375,0,7.429688,-0.75,0,7.429688,-1.394531,1.85625,10.01123,-0.677124,1.676074,9.828125,-0.199219,0,11.101563,0.84668,1.279688,10.867188,1.125,0,11.723145,2.629761,0.883301,11.4375,2.730469,0,12.898438,4.125,0.703125,12.429688,4.125,0,7.429688,-2.8125,2.475,10.414063,-1.728516,2.234766,11.617188,0.234375,1.70625,12.351563,2.408203,1.177734,13.929688,4.125,0.9375,7.429688,-4.230469,1.85625,10.816895,-2.779907,1.676074,12.132813,-0.37793,1.279688,12.97998,2.186646,0.883301,14.960938,4.125,0.703125,7.429688,-4.875,0,11,-3.257813,0,12.367188,-0.65625,0,13.265625,2.085938,0,15.429688,4.125,0,7.429688,-4.875,0,7.429688,-4.230469,-1.85625,10.816895,-2.779907,-1.676074,11,-3.257813,0,12.132813,-0.37793,-1.279688,12.367188,-0.65625,0,12.97998,2.186646,-0.883301,13.265625,2.085938,0,14.960938,4.125,-0.703125,15.429688,4.125,0,7.429688,-2.8125,-2.475,10.414063,-1.728516,-2.234766,11.617188,0.234375,-1.70625,12.351563,2.408203,-1.177734,13.929688,4.125,-0.9375,7.429688,-1.394531,-1.85625,10.01123,-0.677124,-1.676074,11.101563,0.84668,-1.279688,11.723145,2.629761,-0.883301,12.898438,4.125,-0.703125,7.429688,-0.75,0,9.828125,-0.199219,0,10.867188,1.125,0,11.4375,2.730469,0,12.429688,4.125,0,12.429688,4.125,0,12.898438,4.125,0.703125,13.291077,4.346237,0.65918,12.789063,4.335938,0,13.525879,4.422729,0.5625,13.054688,4.40625,0,13.532898,4.350357,0.46582,13.132813,4.335938,0,13.242188,4.125,0.421875,12.929688,4.125,0,13.929688,4.125,0.9375,14.395508,4.368896,0.878906,14.5625,4.458984,0.75,14.413086,4.38208,0.621094,13.929688,4.125,0.5625,14.960938,4.125,0.703125,15.499939,4.391556,0.65918,15.599121,4.495239,0.5625,15.293274,4.413804,0.46582,14.617188,4.125,0.421875,15.429688,4.125,0,16.001953,4.401855,0,16.070313,4.511719,0,15.693359,4.428224,0,14.929688,4.125,0,15.429688,4.125,0,14.960938,4.125,-0.703125,15.499939,4.391556,-0.65918,16.001953,4.401855,0,15.599121,4.495239,-0.5625,16.070313,4.511719,0,15.293274,4.413804,-0.46582,15.693359,4.428224,0,14.617188,4.125,-0.421875,14.929688,4.125,0,13.929688,4.125,-0.9375,14.395508,4.368896,-0.878906,14.5625,4.458984,-0.75,14.413086,4.38208,-0.621094,13.929688,4.125,-0.5625,12.898438,4.125,-0.703125,13.291077,4.346237,-0.65918,13.525879,4.422729,-0.5625,13.532898,4.350357,-0.46582,13.242188,4.125,-0.421875,12.429688,4.125,0,12.789063,4.335938,0,13.054688,4.40625,0,13.132813,4.335938,0,12.929688,4.125,0,0.501414,7.628906,0.670256,0.632813,7.628906,0,-1.070312,7.875,0,0.429278,7.03125,0.639395,0.554688,7.03125,0,-0.162029,6.292969,0.38696,-0.085937,6.292969,0,-0.147812,5.625,0.3925,-0.070312,5.625,0,0.140489,7.628906,1.210801,-1.070312,7.875,0,0.084844,7.03125,1.155156,-0.370879,6.292969,0.699434,-0.360312,5.625,0.71,-0.400056,7.628906,1.571726,-1.070312,7.875,0,-0.430918,7.03125,1.49959,-0.683352,6.292969,0.908284,-0.677812,5.625,0.9225,-1.070312,7.628906,1.703125,-1.070312,7.875,0,-1.070312,7.03125,1.625,-1.070312,6.292969,0.984375,-1.070312,5.625,1,-1.740569,7.628906,1.571726,-1.070312,7.628906,1.703125,-1.070312,7.875,0,-1.709707,7.03125,1.49959,-1.070312,7.03125,1.625,-1.457273,6.292969,0.908284,-1.070312,6.292969,0.984375,-1.462812,5.625,0.9225,-1.070312,5.625,1,-2.281113,7.628906,1.210801,-1.070312,7.875,0,-2.225469,7.03125,1.155156,-1.769746,6.292969,0.699434,-1.780312,5.625,0.71,-2.642038,7.628906,0.670256,-1.070312,7.875,0,-2.569902,7.03125,0.639395,-1.978596,6.292969,0.38696,-1.992812,5.625,0.3925,-2.773438,7.628906,0,-1.070312,7.875,0,-2.695313,7.03125,0,-2.054687,6.292969,0,-2.070312,5.625,0,-2.642038,7.628906,-0.670256,-2.773438,7.628906,0,-1.070312,7.875,0,-2.569902,7.03125,-0.639395,-2.695313,7.03125,0,-1.978596,6.292969,-0.38696,-2.054687,6.292969,0,-1.992812,5.625,-0.3925,-2.070312,5.625,0,-2.281113,7.628906,-1.210801,-1.070312,7.875,0,-2.225469,7.03125,-1.155156,-1.769746,6.292969,-0.699434,-1.780312,5.625,-0.71,-1.740569,7.628906,-1.571726,-1.070312,7.875,0,-1.709707,7.03125,-1.49959,-1.457273,6.292969,-0.908284,-1.462812,5.625,-0.9225,-1.070312,7.628906,-1.703125,-1.070312,7.875,0,-1.070312,7.03125,-1.625,-1.070312,6.292969,-0.984375,-1.070312,5.625,-1,-0.400056,7.628906,-1.571726,-1.070312,7.628906,-1.703125,-1.070312,7.875,0,-0.430918,7.03125,-1.49959,-1.070312,7.03125,-1.625,-0.683352,6.292969,-0.908284,-1.070312,6.292969,-0.984375,-0.677812,5.625,-0.9225,-1.070312,5.625,-1,0.140489,7.628906,-1.210801,-1.070312,7.875,0,0.084844,7.03125,-1.155156,-0.370879,6.292969,-0.699434,-0.360312,5.625,-0.71,0.501414,7.628906,-0.670256,-1.070312,7.875,0,0.429278,7.03125,-0.639395,-0.162029,6.292969,-0.38696,-0.147812,5.625,-0.3925,0.632813,7.628906,0,-1.070312,7.875,0,0.554688,7.03125,0,-0.085937,6.292969,0,-0.070312,5.625,0,-0.070312,5.625,0,-0.147812,5.625,0.3925,1.034141,5.179688,0.895391,1.210938,5.179688,0,2.735,4.875,1.619062,3.054688,4.875,0,4.262891,4.570313,2.26914,4.710938,4.570313,0,4.925938,4.125,2.55125,5.429688,4.125,0,-0.360312,5.625,0.71,0.549375,5.179688,1.619688,1.858438,4.875,2.92875,3.034375,4.570313,4.104687,3.544688,4.125,4.615,-0.677812,5.625,0.9225,-0.174922,5.179688,2.104453,0.54875,4.875,3.805313,1.198828,4.570313,5.333203,1.480938,4.125,5.99625,-1.070312,5.625,1,-1.070312,5.179688,2.28125,-1.070312,4.875,4.125,-1.070312,4.570313,5.78125,-1.070312,4.125,6.5,-1.070312,5.625,1,-1.462812,5.625,0.9225,-1.965703,5.179688,2.104453,-1.070312,5.179688,2.28125,-2.689375,4.875,3.805313,-1.070312,4.875,4.125,-3.339453,4.570313,5.333203,-1.070312,4.570313,5.78125,-3.621562,4.125,5.99625,-1.070312,4.125,6.5,-1.780312,5.625,0.71,-2.69,5.179688,1.619688,-3.999062,4.875,2.92875,-5.174999,4.570313,4.104687,-5.685312,4.125,4.615,-1.992812,5.625,0.3925,-3.174765,5.179688,0.895391,-4.875625,4.875,1.619062,-6.403516,4.570313,2.26914,-7.066563,4.125,2.55125,-2.070312,5.625,0,-3.351562,5.179688,0,-5.195313,4.875,0,-6.851563,4.570313,0,-7.570313,4.125,0,-2.070312,5.625,0,-1.992812,5.625,-0.3925,-3.174765,5.179688,-0.895391,-3.351562,5.179688,0,-4.875625,4.875,-1.619062,-5.195313,4.875,0,-6.403516,4.570313,-2.26914,-6.851563,4.570313,0,-7.066563,4.125,-2.55125,-7.570313,4.125,0,-1.780312,5.625,-0.71,-2.69,5.179688,-1.619688,-3.999062,4.875,-2.92875,-5.174999,4.570313,-4.104687,-5.685312,4.125,-4.615,-1.462812,5.625,-0.9225,-1.965703,5.179688,-2.104453,-2.689375,4.875,-3.805313,-3.339453,4.570313,-5.333203,-3.621562,4.125,-5.99625,-1.070312,5.625,-1,-1.070312,5.179688,-2.28125,-1.070312,4.875,-4.125,-1.070312,4.570313,-5.78125,-1.070312,4.125,-6.5,-1.070312,5.625,-1,-0.677812,5.625,-0.9225,-0.174922,5.179688,-2.104453,-1.070312,5.179688,-2.28125,0.54875,4.875,-3.805313,-1.070312,4.875,-4.125,1.198828,4.570313,-5.333203,-1.070312,4.570313,-5.78125,1.480938,4.125,-5.99625,-1.070312,4.125,-6.5,-0.360312,5.625,-0.71,0.549375,5.179688,-1.619688,1.858438,4.875,-2.92875,3.034375,4.570313,-4.104687,3.544688,4.125,-4.615,-0.147812,5.625,-0.3925,1.034141,5.179688,-0.895391,2.735,4.875,-1.619062,4.262891,4.570313,-2.26914,4.925938,4.125,-2.55125,-0.070312,5.625,0,1.210938,5.179688,0,3.054688,4.875,0,4.710938,4.570313,0,5.429688,4.125,0],
|
@@ -1,3 +1,21 @@
|
|
1
|
+
/**
|
2
|
+
* class Jax.Mesh.Torus < Jax.Mesh
|
3
|
+
*
|
4
|
+
* A torus is a donut-shaped mesh.
|
5
|
+
*
|
6
|
+
* Options:
|
7
|
+
*
|
8
|
+
* * inner_radius, default: 0.6
|
9
|
+
* * outer_radius, default: 1.8
|
10
|
+
* * sides, default: 128
|
11
|
+
* * rings, default: 256
|
12
|
+
*
|
13
|
+
* Examples:
|
14
|
+
*
|
15
|
+
* new Jax.Mesh.Torus();
|
16
|
+
* new Jax.Mesh.Torus({inner_radius: 1.0, outer_radius:3.0});
|
17
|
+
*
|
18
|
+
**/
|
1
19
|
Jax.Mesh.Torus = Jax.Class.create(Jax.Mesh, {
|
2
20
|
initialize: function($super, options) {
|
3
21
|
options = options || {};
|