aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-09 14:35:44 -0700
committerValerio Virgillito2012-07-09 14:35:44 -0700
commit84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch)
tree3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /assets
parentc0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff)
parent40c6eb2c06b34f65a74d59ef9687251952858bab (diff)
downloadninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts: js/components/gradientpicker.reel/gradientpicker.js js/components/tools-properties/text-properties.reel/text-properties.js js/document/views/base.js js/document/views/design.js js/helper-classes/3D/StageLine.js js/helper-classes/3D/draw-utils.js js/lib/drawing/world.js js/lib/geom/circle.js js/lib/geom/line.js js/lib/geom/rectangle.js js/lib/geom/shape-primitive.js js/lib/rdge/materials/bump-metal-material.js js/lib/rdge/materials/flag-material.js js/lib/rdge/materials/fly-material.js js/lib/rdge/materials/julia-material.js js/lib/rdge/materials/keleidoscope-material.js js/lib/rdge/materials/mandel-material.js js/lib/rdge/materials/material.js js/lib/rdge/materials/plasma-material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/radial-gradient-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/water-material.js js/panels/Materials/materials-library-panel.reel/materials-library-panel.html js/panels/Materials/materials-library-panel.reel/materials-library-panel.js js/panels/Materials/materials-popup.reel/materials-popup.html js/panels/Materials/materials-popup.reel/materials-popup.js js/tools/LineTool.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'assets')
-rw-r--r--assets/canvas-runtime.js4052
-rwxr-xr-xassets/shaders/Basic.vert.glsl6
-rw-r--r--assets/shaders/BasicTex.frag.glsl2
-rw-r--r--assets/shaders/Cloud.frag.glsl10
-rw-r--r--assets/shaders/Cloud.vert.glsl28
-rw-r--r--assets/shaders/Flag.vert.glsl22
-rw-r--r--assets/shaders/Taper.vert.glsl152
-rw-r--r--assets/shaders/TwistVert.frag.glsl8
-rw-r--r--assets/shaders/TwistVert.vert.glsl84
-rwxr-xr-xassets/shaders/linearGradient.frag.glsl68
-rwxr-xr-xassets/shaders/linearGradient.vert.glsl30
-rw-r--r--assets/shaders/radialGradient.frag.glsl70
-rw-r--r--assets/shaders/radialGradient.vert.glsl8
-rwxr-xr-xassets/shaders/test_fshader.glsl58
-rwxr-xr-xassets/shaders/test_fshader_full.glsl28
-rwxr-xr-xassets/shaders/test_vshader.glsl62
-rwxr-xr-xassets/shaders/ub_fshader.glsl432
-rwxr-xr-xassets/shaders/ub_vshader.glsl232
18 files changed, 2676 insertions, 2676 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index ce392f34..42d90333 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -36,42 +36,42 @@ var NinjaCvsRt = NinjaCvsRt || {};
36window.addEventListener('load', loadCanvasData, false); 36window.addEventListener('load', loadCanvasData, false);
37//Load data function (on document loaded) 37//Load data function (on document loaded)
38function loadCanvasData (e) { 38function loadCanvasData (e) {
39 //Cleaning up events 39 //Cleaning up events
40 window.removeEventListener('load', loadCanvasData, false); 40 window.removeEventListener('load', loadCanvasData, false);
41 //Getting tag with data, MUST contain attribute 41 //Getting tag with data, MUST contain attribute
42 var xhr, tag = document.querySelectorAll(['script[data-ninja-canvas-lib]'])[0]; 42 var xhr, tag = document.querySelectorAll(['script[data-ninja-canvas-lib]'])[0];
43 //Checking for data to be external file 43 //Checking for data to be external file
44 if (tag.getAttribute('data-ninja-canvas-json') !== null) { 44 if (tag.getAttribute('data-ninja-canvas-json') !== null) {
45 //Loading JSON data 45 //Loading JSON data
46 xhr = new XMLHttpRequest(); 46 xhr = new XMLHttpRequest();
47 xhr.open("GET", tag.getAttribute('data-ninja-canvas-json'), false); 47 xhr.open("GET", tag.getAttribute('data-ninja-canvas-json'), false);
48 xhr.send(); 48 xhr.send();
49 //Checking for data 49 //Checking for data
50 if (xhr.readyState === 4) { 50 if (xhr.readyState === 4) {
51 //Calling method to initialize all webGL/canvas(es) 51 //Calling method to initialize all webGL/canvas(es)
52 NinjaCvsRt.initWebGl(document.body, tag.getAttribute('data-ninja-canvas-libpath'), xhr.response); 52 NinjaCvsRt.initWebGl(document.body, tag.getAttribute('data-ninja-canvas-libpath'), xhr.response);
53 } else { 53 } else {
54 //TODO: Add error for users 54 //TODO: Add error for users
55 } 55 }
56 } else {//Data in document itself 56 } else {//Data in document itself
57 //Calling method to initialize all webGL/canvas(es) 57 //Calling method to initialize all webGL/canvas(es)
58 NinjaCvsRt.initWebGl(document.body, tag.getAttribute('data-ninja-canvas-libpath'), document.querySelectorAll(['script[data-ninja-canvas]'])[0].innerHTML); 58 NinjaCvsRt.initWebGl(document.body, tag.getAttribute('data-ninja-canvas-libpath'), document.querySelectorAll(['script[data-ninja-canvas]'])[0].innerHTML);
59 } 59 }
60} 60}
61 61
62/////////////////////////////////////////////////////////////////////// 62///////////////////////////////////////////////////////////////////////
63//Loading webGL/canvas data 63//Loading webGL/canvas data
64NinjaCvsRt.initWebGl = function (rootElement, directory, data) { 64NinjaCvsRt.initWebGl = function (rootElement, directory, data) {
65 var cvsDataMngr, ninjaWebGlData = JSON.parse((data.replace('(', '')).replace(')', '')); 65 var cvsDataMngr, ninjaWebGlData = JSON.parse((data.replace('(', '')).replace(')', ''));
66 if (ninjaWebGlData && ninjaWebGlData.data) { 66 if (ninjaWebGlData && ninjaWebGlData.data) {
67 for (var n=0; ninjaWebGlData.data[n]; n++) { 67 for (var n=0; ninjaWebGlData.data[n]; n++) {
68 ninjaWebGlData.data[n] = unescape(ninjaWebGlData.data[n]); 68 ninjaWebGlData.data[n] = unescape(ninjaWebGlData.data[n]);
69 } 69 }
70 } 70 }
71 //Creating data manager 71 //Creating data manager
72 cvsDataMngr = Object.create(NinjaCvsRt.CanvasDataManager, {}); 72 cvsDataMngr = Object.create(NinjaCvsRt.CanvasDataManager, {});
73 //Loading data to canvas(es) 73 //Loading data to canvas(es)
74 cvsDataMngr.loadGLData(rootElement, ninjaWebGlData.data, directory); 74 cvsDataMngr.loadGLData(rootElement, ninjaWebGlData.data, directory);
75}; 75};
76 76
77/////////////////////////////////////////////////////////////////////// 77///////////////////////////////////////////////////////////////////////
@@ -80,64 +80,64 @@ NinjaCvsRt.initWebGl = function (rootElement, directory, data) {
80/////////////////////////////////////////////////////////////////////// 80///////////////////////////////////////////////////////////////////////
81NinjaCvsRt.CanvasDataManager = Object.create(Object.prototype, { 81NinjaCvsRt.CanvasDataManager = Object.create(Object.prototype, {
82 82
83 loadGLData: { 83 loadGLData: {
84 value: function(root, valueArray, assetPath) { 84 value: function(root, valueArray, assetPath) {
85 if (assetPath) 85 if (assetPath)
86 this._assetPath = assetPath.slice(); 86 this._assetPath = assetPath.slice();
87 87
88 var value = valueArray; 88 var value = valueArray;
89 var nWorlds = value.length; 89 var nWorlds = value.length;
90 for (var i=0; i<nWorlds; i++) 90 for (var i=0; i<nWorlds; i++)
91 { 91 {
92 var importStr = value[i]; 92 var importStr = value[i];
93 93
94 // there should be some version information in 94 // there should be some version information in
95 // the form of 'v0.0;' Pull that off. (the trailing ';' should 95 // the form of 'v0.0;' Pull that off. (the trailing ';' should
96 // be in the first 24 characters). 96 // be in the first 24 characters).
97 var index = importStr.indexOf( ';' ); 97 var index = importStr.indexOf( ';' );
98 if ((importStr[0] === 'v') && (index < 24)) 98 if ((importStr[0] === 'v') && (index < 24))
99 { 99 {
100 // JSON format. pull off the version info 100 // JSON format. pull off the version info
101 importStr = importStr.substr( index+1 ); 101 importStr = importStr.substr( index+1 );
102 102
103 var jObj = JSON.parse( importStr ); 103 var jObj = JSON.parse( importStr );
104 var id = jObj.id; 104 var id = jObj.id;
105 if (id) 105 if (id)
106 { 106 {
107 var canvas = this.findCanvasWithID( id, root ); 107 var canvas = this.findCanvasWithID( id, root );
108 if (canvas) 108 if (canvas)
109 { 109 {
110// new NinjaCvsRt.GLRuntime( canvas, jObj, assetPath ); 110// new NinjaCvsRt.GLRuntime( canvas, jObj, assetPath );
111 var glRt = Object.create(NinjaCvsRt.GLRuntime, {}); 111 var glRt = Object.create(NinjaCvsRt.GLRuntime, {});
112 glRt.renderWorld(canvas, jObj, this._assetPath); 112 glRt.renderWorld(canvas, jObj, this._assetPath);
113 } 113 }
114 else 114 else
115 { 115 {
116 console.log( "***** COULD NOT FIND CANVAS WITH ID " + id + " *****" ); 116 console.log( "***** COULD NOT FIND CANVAS WITH ID " + id + " *****" );
117 } 117 }
118 } 118 }
119 } 119 }
120 } 120 }
121 } 121 }
122 }, 122 },
123 123
124 findCanvasWithID: { 124 findCanvasWithID: {
125 value: function(id, elt) { 125 value: function(id, elt) {
126 var cid = elt.getAttribute( "data-RDGE-id" ); 126 var cid = elt.getAttribute( "data-RDGE-id" );
127 if (cid == id) return elt; 127 if (cid == id) return elt;
128 128
129 if (elt.children) 129 if (elt.children)
130 { 130 {
131 var nKids = elt.children.length; 131 var nKids = elt.children.length;
132 for (var i=0; i<nKids; i++) 132 for (var i=0; i<nKids; i++)
133 { 133 {
134 var child = elt.children[i]; 134 var child = elt.children[i];
135 var foundElt = this.findCanvasWithID( id, child ); 135 var foundElt = this.findCanvasWithID( id, child );
136 if (foundElt) return foundElt; 136 if (foundElt) return foundElt;
137 } 137 }
138 } 138 }
139 } 139 }
140 } 140 }
141}); 141});
142 142
143/////////////////////////////////////////////////////////////////////// 143///////////////////////////////////////////////////////////////////////
@@ -145,267 +145,267 @@ NinjaCvsRt.CanvasDataManager = Object.create(Object.prototype, {
145// Manages runtime fora WebGL canvas 145// Manages runtime fora WebGL canvas
146/////////////////////////////////////////////////////////////////////// 146///////////////////////////////////////////////////////////////////////
147NinjaCvsRt.GLRuntime = Object.create(Object.prototype, { 147NinjaCvsRt.GLRuntime = Object.create(Object.prototype, {
148 /////////////////////////////////////////////////////////////////////// 148 ///////////////////////////////////////////////////////////////////////
149 // Instance variables 149 // Instance variables
150 /////////////////////////////////////////////////////////////////////// 150 ///////////////////////////////////////////////////////////////////////
151 _canvas: { value: null, writable: true }, 151 _canvas: { value: null, writable: true },
152 _context : { value: null, writable: true }, 152 _context : { value: null, writable: true },
153 //this._importStr = importStr; 153 //this._importStr = importStr;
154 _jObj: { value: null, writable: true }, 154 _jObj: { value: null, writable: true },
155 155
156 _renderer: { value: null, writable: true },