aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/src')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/MeshManager.js82
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/box.js64
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/camera.js8
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/engine.js186
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/init_state.js312
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/jpass.js102
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/jshader.js60
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/lightmanager.js12
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/mat4.js192
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/quat.js64
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/vec2.js6
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/vec3.js18
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/vec4.js46
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/objectManager.js120
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/particle.js14
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/precompiled.js26
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderUtils.js100
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderer.js782
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/run_state.js462
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/runtime.js24
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/scenegraph.js306
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/scenegraphNodes.js462
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/shadowLight.js4
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/sockets.js130
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/utilities.js14
25 files changed, 1798 insertions, 1798 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/MeshManager.js b/js/helper-classes/RDGE/src/core/script/MeshManager.js
index 768b7213..81359fc4 100755
--- a/js/helper-classes/RDGE/src/core/script/MeshManager.js
+++ b/js/helper-classes/RDGE/src/core/script/MeshManager.js
@@ -38,16 +38,16 @@ RDGE.Model = function (name, mesh) {
38}; 38};
39 39
40/* 40/*
41 * Maintains a list of meshes to allow instancing of data 41 * Maintains a list of meshes to allow instancing of data
42 */ 42 */
43RDGE.MeshManager = function () { 43RDGE.MeshManager = function () {
44 this.contentUrl = "assets_web/mesh/"; 44 this.contentUrl = "assets_web/mesh/";
45 this.modelMap = {}; 45 this.modelMap = {};
46 this.readyList = []; // meshes that have data ready 46 this.readyList = []; // meshes that have data ready
47 this.meshesLoading = true; // indicates that no meshes have loaded or that they are still loading 47 this.meshesLoading = true; // indicates that no meshes have loaded or that they are still loading
48 this.postMeshLoadCallbackList = []; 48 this.postMeshLoadCallbackList = [];
49 this.tempSphere = null; 49 this.tempSphere = null;
50 this.requestCounter = 0; 50 this.requestCounter = 0;
51}; 51};
52 52
53/* 53/*
@@ -62,7 +62,7 @@ RDGE.MeshManager.prototype.loadMesh = function (meshStump, tempMesh) {
62 meshStump.addr = this.contentUrl + meshStump.name + "_mesh.json"; 62 meshStump.addr = this.contentUrl + meshStump.name + "_mesh.json";
63 meshStump.ctxID = RDGE.globals.engine.getContext().renderer.id; 63 meshStump.ctxID = RDGE.globals.engine.getContext().renderer.id;
64 64
65 // sets a temp mesh up in place of the final mesh to load 65 // sets a temp mesh up in place of the final mesh to load
66 if (!tempMesh) { 66 if (!tempMesh) {
67 if (this.tempSphere == null) { 67 if (this.tempSphere == null) {
68 this.tempSphere = RDGE.renderUtils.makeSphere(RDGE.globals.engine.getContext().renderer.ctx, 25, 5, 5); 68 this.tempSphere = RDGE.renderUtils.makeSphere(RDGE.globals.engine.getContext().renderer.ctx, 25, 5, 5);
@@ -71,7 +71,7 @@ RDGE.MeshManager.prototype.loadMesh = function (meshStump, tempMesh) {
71 tempMesh = this.tempSphere; 71 tempMesh = this.tempSphere;
72 } 72 }
73 73
74 // add the temp mesh to the map of loaded meshes 74 // add the temp mesh to the map of loaded meshes
75 this.modelMap[meshStump.name] = tempMesh; 75 this.modelMap[meshStump.name] = tempMesh;
76 76
77 // update the request counter - we now have one more mesh to load 77 // update the request counter - we now have one more mesh to load
@@ -86,15 +86,15 @@ RDGE.MeshManager.prototype.loadMesh = function (meshStump, tempMesh) {
86 * Deletes the passed mesh from the manager as well as all renderers 86 * Deletes the passed mesh from the manager as well as all renderers
87 */ 87 */
88RDGE.MeshManager.prototype.deleteMesh = function (name) { 88RDGE.MeshManager.prototype.deleteMesh = function (name) {
89 var model = this.modelMap[name]; 89 var model = this.modelMap[name];
90 90
91 if (model) { 91 if (model) {
92 RDGE.globals.engine.ctxMan.forEach(function (context) { 92 RDGE.globals.engine.ctxMan.forEach(function (context) {
93 context.renderer.deletePrimitive(model.primitive); 93 context.renderer.deletePrimitive(model.primitive);
94 }); 94 });
95 95
96 delete this.modelMap[name]; 96 delete this.modelMap[name];
97 } 97 }
98}; 98};
99 99
100RDGE.MeshManager.prototype.getModelByName = function (name) { 100RDGE.MeshManager.prototype.getModelByName = function (name) {
@@ -113,7 +113,7 @@ RDGE.MeshManager.prototype.getModelNames = function () {
113 113
114RDGE.MeshManager.prototype.processMeshData = function () { 114RDGE.MeshManager.prototype.processMeshData = function () {
115 var renderer = RDGE.globals.engine.getContext().renderer; 115 var renderer = RDGE.globals.engine.getContext().renderer;
116 116
117 // loop through meshes and load ready data 117 // loop through meshes and load ready data
118 for (var index in this.readyList) { 118 for (var index in this.readyList) {
119 // if item is ready load it 119 // if item is ready load it
@@ -128,7 +128,7 @@ RDGE.MeshManager.prototype.processMeshData = function () {
128 128
129 primset.vertexDefinition = 129 primset.vertexDefinition =
130 { 130 {
131 // this shows two ways to map this data to an attribute 131 // this shows two ways to map this data to an attribute
132 "vert": { 'type': RDGE.rdgeConstants.VS_ELEMENT_POS, 'bufferIndex': 0, 'bufferUsage': RDGE.rdgeConstants.BUFFER_STATIC }, 132 "vert": { 'type': RDGE.rdgeConstants.VS_ELEMENT_POS, 'bufferIndex': 0, 'bufferUsage': RDGE.rdgeConstants.BUFFER_STATIC },
133 "a_pos": { 'type': RDGE.rdgeConstants.VS_ELEMENT_POS, 'bufferIndex': 0, 'bufferUsage': RDGE.rdgeConstants.BUFFER_STATIC }, 133 "a_pos": { 'type': RDGE.rdgeConstants.VS_ELEMENT_POS, 'bufferIndex': 0, 'bufferUsage': RDGE.rdgeConstants.BUFFER_STATIC },
134 "normal": { 'type': RDGE.rdgeConstants.VS_ELEMENT_FLOAT3, 'bufferIndex': 1, 'bufferUsage': RDGE.rdgeConstants.BUFFER_STATIC }, 134 "normal": { 'type': RDGE.rdgeConstants.VS_ELEMENT_FLOAT3, 'bufferIndex': 1, 'bufferUsage': RDGE.rdgeConstants.BUFFER_STATIC },
@@ -142,25 +142,25 @@ RDGE.MeshManager.prototype.processMeshData = function () {
142 142
143 primset.bufferStreams = 143 primset.bufferStreams =
144 [ 144 [
145 model.root.data.coords, 145 model.root.data.coords,
146 model.root.data.normals, 146 model.root.data.normals,
147 model.root.data.uvs 147 model.root.data.uvs
148 ]; 148 ];
149 149
150 primset.streamUsage = 150 primset.streamUsage =
151 [ 151 [
152 RDGE.rdgeConstants.BUFFER_STATIC, 152 RDGE.rdgeConstants.BUFFER_STATIC,
153 RDGE.rdgeConstants.BUFFER_STATIC, 153 RDGE.rdgeConstants.BUFFER_STATIC,
154 RDGE.rdgeConstants.BUFFER_STATIC 154 RDGE.rdgeConstants.BUFFER_STATIC
155 ]; 155 ];
156 156
157 primset.indexUsage = RDGE.rdgeConstants.BUFFER_STREAM; 157 primset.indexUsage = RDGE.rdgeConstants.BUFFER_STREAM;
158 158
159 primset.indexBuffer = model.root.data.indices; 159 primset.indexBuffer = model.root.data.indices;
160 160
161 renderer.createPrimitive( primset ); 161 renderer.createPrimitive( primset );
162 162
163 model.root.primitive = primset; 163 model.root.primitive = primset;
164 164
165 // generate a bounding box for this mesh 165 // generate a bounding box for this mesh
166 model.root.bbox = new RDGE.box(); 166 model.root.bbox = new RDGE.box();
@@ -185,7 +185,7 @@ RDGE.MeshManager.prototype.processMeshData = function () {
185}; 185};
186 186
187RDGE.MeshManager.prototype.isReady = function () { 187RDGE.MeshManager.prototype.isReady = function () {
188 return this.readyList.length == 0; 188 return this.readyList.length == 0;
189}; 189};
190 190
191RDGE.MeshManager.prototype.addOnLoadedCallback = function (callback) { 191RDGE.MeshManager.prototype.addOnLoadedCallback = function (callback) {
@@ -201,29 +201,29 @@ RDGE.MeshManager.prototype.onLoaded = function (meshName) {
201 201
202RDGE.MeshManager.prototype.exportJSON = function () { 202RDGE.MeshManager.prototype.exportJSON = function () {
203 for (var m in this.modelMap) { 203 for (var m in this.modelMap) {
204 this.modelMap[m].primitive.built = false; 204 this.modelMap[m].primitive.built = false;
205 } 205 }
206 206
207 return JSON.stringify(this.modelMap); 207 return JSON.stringify(this.modelMap);
208}; 208};
209 209
210RDGE.MeshManager.prototype.importJSON = function (jsonMeshExport) { 210RDGE.MeshManager.prototype.importJSON = function (jsonMeshExport) {
211 try { 211 try {
212 var tempModelMap = JSON.parse(jsonMeshExport); 212 var tempModelMap = JSON.parse(jsonMeshExport);
213 213
214 for (var m in tempModelMap) {