diff options
author | Valerio Virgillito | 2012-07-09 14:16:17 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-09 14:18:36 -0700 |
commit | 1bbba17e8605434356de0a477710d6a0136986fc (patch) | |
tree | 7cdc80226b776c6fb2250e250acdbcd53fdb1ddd | |
parent | dc5b7a479a185dda8e9a09f4bbe26bd290641624 (diff) | |
parent | ab80aa9c7da912db384ec48c656f84fd673b5253 (diff) | |
download | ninja-1bbba17e8605434356de0a477710d6a0136986fc.tar.gz |
Merge branch 'Taper' of https://github.com/ericmueller/ninja-internal
Conflicts:
js/lib/geom/circle.js
js/lib/rdge/materials/linear-gradient-material.js
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
31 files changed, 1526 insertions, 876 deletions
diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl index fe3ff722..2d5c4494 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl | |||
@@ -59,7 +59,8 @@ void main() | |||
59 | const float pi = 3.14159; | 59 | const float pi = 3.14159; |
60 | float angle = time; | 60 | float angle = time; |
61 | 61 | ||
62 | v_uv = texcoord; | 62 | v_uv.x = texcoord.x; |
63 | v_uv.y = texcoord.y; | ||
63 | 64 | ||
64 | float x = 2.0*pi*texcoord.x/u_waveWidth; | 65 | float x = 2.0*pi*texcoord.x/u_waveWidth; |
65 | float y = 2.0*pi*texcoord.y; | 66 | float y = 2.0*pi*texcoord.y; |
diff --git a/assets/shaders/Pulse.frag.glsl b/assets/shaders/Pulse.frag.glsl index 9aeb05c9..b717d359 100644 --- a/assets/shaders/Pulse.frag.glsl +++ b/assets/shaders/Pulse.frag.glsl | |||
@@ -22,6 +22,7 @@ void main(void) | |||
22 | float cLength = length(cPos); | 22 | float cLength = length(cPos); |
23 | 23 | ||
24 | vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-time*10.0)/25.0; | 24 | vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-time*10.0)/25.0; |
25 | uv.y = 1.0 - uv.y; | ||
25 | vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength; | 26 | vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength; |
26 | 27 | ||
27 | gl_FragColor = vec4(col,1.0); | 28 | gl_FragColor = vec4(col,1.0); |
diff --git a/assets/shaders/test_fshader_full.glsl b/assets/shaders/test_fshader_full.glsl index ae7d45b2..345a93f2 100755 --- a/assets/shaders/test_fshader_full.glsl +++ b/assets/shaders/test_fshader_full.glsl | |||
@@ -62,7 +62,7 @@ varying vec3 vEyePos; | |||
62 | 62 | ||
63 | void main() | 63 | void main() |
64 | { | 64 | { |
65 | vec4 colMapTexel = vec4(texture2D(colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0); | 65 | vec4 colMapTexel = vec4(texture2D(colMap, vec2(vNormal.w, 1.0 - vECPos.w)).rgb, 1.0); |
66 | 66 | ||
67 | // normal mapping | 67 | // normal mapping |
68 | vec3 normal = normalize(vNormal.xyz); | 68 | vec3 normal = normalize(vNormal.xyz); |
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index 26f33a64..2b76161f 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js | |||
@@ -466,6 +466,7 @@ World.prototype.updateObject = function (obj) { | |||
466 | if (prims.length != materialNodes.length) | 466 | if (prims.length != materialNodes.length) |
467 | throw new Error("inconsistent material and primitive counts"); | 467 | throw new Error("inconsistent material and primitive counts"); |
468 | var nPrims = prims.length; | 468 | var nPrims = prims.length; |
469 | var iPrim = 0; | ||
469 | var ctrTrNode; | 470 | var ctrTrNode; |
470 | if (nPrims > 0) | 471 | if (nPrims > 0) |
471 | { | 472 | { |
@@ -483,8 +484,12 @@ World.prototype.updateObject = function (obj) { | |||
483 | ); | 484 | ); |
484 | ctrTrNode.meshes = []; | 485 | ctrTrNode.meshes = []; |
485 | 486 | ||
486 | ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[0]); | ||
487 | ctrTrNode.attachMaterial(materialNodes[0]); | 487 | ctrTrNode.attachMaterial(materialNodes[0]); |
488 | while ((iPrim < nPrims) && (materialNodes[iPrim] == materialNodes[0])) | ||
489 | { | ||
490 | ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[iPrim]); | ||
491 | iPrim++; | ||
492 | } | ||
488 | } | 493 | } |
489 | 494 | ||
490 | // delete all of the child nodes | 495 | // delete all of the child nodes |
@@ -505,16 +510,18 @@ World.prototype.updateObject = function (obj) { | |||
505 | } | 510 | } |
506 | ctrTrNode.children = []; | 511 | ctrTrNode.children = []; |
507 | 512 | ||
508 | for (var i = 1; i < nPrims; i++) | 513 | while (iPrim < nPrims) |
509 | { | 514 | { |
510 | // get the next primitive | ||
511 | childTrNode = RDGE.createTransformNode("objNode_" + this._nodeCounter++); | 515 | childTrNode = RDGE.createTransformNode("objNode_" + this._nodeCounter++); |
512 | ctrTrNode.insertAsChild(childTrNode); | 516 | ctrTrNode.insertAsChild(childTrNode); |
517 | var matNode = materialNodes[iPrim]; | ||
518 | childTrNode.attachMaterial(matNode); | ||
513 | 519 | ||
514 | // attach the instanced box goe | 520 | while ((iPrim < nPrims) && (materialNodes[iPrim] == matNode)) |
515 | var prim = prims[i]; | 521 | { |
516 | childTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prim); | 522 | childTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[iPrim]); |
517 | childTrNode.attachMaterial(materialNodes[i]); | 523 | iPrim++; |
524 | } | ||
518 | } | 525 | } |
519 | 526 | ||
520 | // send a notification that the tree has changed | 527 | // send a notification that the tree has changed |
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js index 12781ab8..2cd5a21f 100755 --- a/js/lib/geom/circle.js +++ b/js/lib/geom/circle.js | |||
@@ -42,49 +42,49 @@ var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; | |||
42 | /////////////////////////////////////////////////////////////////////// | 42 | /////////////////////////////////////////////////////////////////////// |
43 | exports.Circle = Object.create(GeomObj, { | 43 | exports.Circle = Object.create(GeomObj, { |
44 | 44 | ||
45 | /////////////////////////////////////////////////////////////////////// | 45 | /////////////////////////////////////////////////////////////////////// |
46 | // Instance variables | 46 | // Instance variables |
47 | /////////////////////////////////////////////////////////////////////// | 47 | /////////////////////////////////////////////////////////////////////// |
48 | _width: { value : 2.0, writable: true }, | 48 | _width: { value : 2.0, writable: true }, |
49 | _height: { value : 2.0, writable: true }, | 49 | _height: { value : 2.0, writable: true }, |
50 | _xOffset: { value : 0, writable: true }, | 50 | _xOffset: { value : 0, writable: true }, |
51 | _yOffset: { value : 0, writable: true }, | 51 | _yOffset: { value : 0, writable: true }, |
52 | 52 | ||
53 | _radius: { value : 2.0, writable: true }, | 53 | _radius: { value : 2.0, writable: true }, |
54 | _strokeWidth: { value : 0.25, writable: true }, | 54 | _strokeWidth: { value : 0.25, writable: true }, |
55 | _innerRadius: { value : 0, writable: true }, | 55 | _innerRadius: { value : 0, writable: true }, |
56 | _ovalHeight: { value : 4.0, writable: true }, | 56 | _ovalHeight: { value : 4.0, writable: true }, |
57 | _strokeStyle: { value : "Solid", writable: true }, | 57 | _strokeStyle: { value : "Solid", writable: true }, |
58 | _aspectRatio: { value : 1.0, writable: true }, | 58 | _aspectRatio: { value : 1.0, writable: true }, |
59 | 59 | ||
60 | init: { | 60 | init: { |
61 | value: function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle) { | 61 | value: function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle) { |
62 | if(arguments.length > 0) { | 62 | if(arguments.length > 0) { |
63 | this._width = width; | 63 | this._width = width; |
64 | this._height = height; | 64 | this._height = height; |
65 | this._xOffset = xOffset; | 65 | this._xOffset = xOffset; |
66 | this._yOffset = yOffset; | 66 | this._yOffset = yOffset; |
67 | this._ovalHeight = 2.0 * this._radius; | 67 | this._ovalHeight = 2.0 * this._radius; |
68 | 68 | ||
69 | this._strokeWidth = strokeSize; | 69 | this._strokeWidth = strokeSize; |
70 | this._innerRadius = innerRadius; | 70 | this._innerRadius = innerRadius; |
71 | this._strokeColor = strokeColor; | 71 | this._strokeColor = strokeColor; |
72 | this._fillColor = fillColor; | 72 | this._fillColor = fillColor; |
73 | 73 | ||
74 | this._strokeStyle = strokeStyle; | 74 | this._strokeStyle = strokeStyle; |
75 | 75 | ||
76 | this._matrix = Matrix.I(4); | 76 | this._matrix = Matrix.I(4); |
77 | //this._matrix[12] = xOffset; | 77 | //this._matrix[12] = xOffset; |
78 | //this._matrix[13] = yOffset; | 78 | //this._matrix[13] = yOffset; |
79 | } | 79 | } |
80 | 80 | ||
81 | this.m_world = world; | 81 | this.m_world = world; |
82 | 82 | ||
83 | if(strokeMaterial) { | 83 | if(strokeMaterial) { |
84 | this._strokeMaterial = strokeMaterial.dup(); | 84 | this._strokeMaterial = strokeMaterial.dup(); |
85 | } else { | 85 | } else { |
86 | this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); | 86 | this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); |
87 | } | 87 | } |
88 | 88 | ||
89 | if(strokeColor) { | 89 | if(strokeColor) { |
90 | if(this._strokeMaterial.hasProperty("color")) { | 90 | if(this._strokeMaterial.hasProperty("color")) { |
@@ -94,135 +94,135 @@ exports.Circle = Object.create(GeomObj, { | |||
94 | } | 94 | } |
95 | } |