aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/src')
-rw-r--r--js/helper-classes/RDGE/src/core/script/MeshManager.js242
-rw-r--r--js/helper-classes/RDGE/src/core/script/RenderInitProcs.js263
-rw-r--r--js/helper-classes/RDGE/src/core/script/RenderProcs.js536
-rw-r--r--js/helper-classes/RDGE/src/core/script/ScreenQuad.js31
-rw-r--r--js/helper-classes/RDGE/src/core/script/ShaderManager.js96
-rw-r--r--js/helper-classes/RDGE/src/core/script/TextureManager.js6
-rw-r--r--js/helper-classes/RDGE/src/core/script/animation.js322
-rw-r--r--js/helper-classes/RDGE/src/core/script/box.js143
-rw-r--r--js/helper-classes/RDGE/src/core/script/camera.js251
-rw-r--r--js/helper-classes/RDGE/src/core/script/engine.js482
-rw-r--r--js/helper-classes/RDGE/src/core/script/fx/blur.js196
-rw-r--r--js/helper-classes/RDGE/src/core/script/fx/ssao.js116
-rw-r--r--js/helper-classes/RDGE/src/core/script/init_state.js342
-rw-r--r--js/helper-classes/RDGE/src/core/script/input.js117
-rw-r--r--js/helper-classes/RDGE/src/core/script/jpass.js710
-rw-r--r--js/helper-classes/RDGE/src/core/script/jshader.js750
-rw-r--r--js/helper-classes/RDGE/src/core/script/lightmanager.js97
-rw-r--r--js/helper-classes/RDGE/src/core/script/math/mat4.js754
-rw-r--r--js/helper-classes/RDGE/src/core/script/math/quat.js225
-rw-r--r--js/helper-classes/RDGE/src/core/script/math/vec2.js191
-rw-r--r--js/helper-classes/RDGE/src/core/script/math/vec3.js351
-rw-r--r--js/helper-classes/RDGE/src/core/script/math/vec4.js258
-rw-r--r--js/helper-classes/RDGE/src/core/script/objectManager.js72
-rw-r--r--js/helper-classes/RDGE/src/core/script/particle.js842
-rw-r--r--js/helper-classes/RDGE/src/core/script/precompiled.js69
-rw-r--r--js/helper-classes/RDGE/src/core/script/renderUtils.js386
-rw-r--r--js/helper-classes/RDGE/src/core/script/rendercontext.js268
-rw-r--r--js/helper-classes/RDGE/src/core/script/renderer.js1696
-rw-r--r--js/helper-classes/RDGE/src/core/script/run_state.js456
-rw-r--r--js/helper-classes/RDGE/src/core/script/runtime.js237
-rw-r--r--js/helper-classes/RDGE/src/core/script/scenegraph.js1123
-rw-r--r--js/helper-classes/RDGE/src/core/script/scenegraphNodes.js649
-rw-r--r--js/helper-classes/RDGE/src/core/script/shadowLight.js54
-rw-r--r--js/helper-classes/RDGE/src/core/script/sockets.js166
-rw-r--r--js/helper-classes/RDGE/src/core/script/ubershader.js159
-rw-r--r--js/helper-classes/RDGE/src/core/script/util/dbgpanel.js237
-rw-r--r--js/helper-classes/RDGE/src/core/script/util/fpsTracker.js51
-rw-r--r--js/helper-classes/RDGE/src/core/script/util/statTracker.js338
-rw-r--r--js/helper-classes/RDGE/src/core/script/utilities.js245
39 files changed, 13527 insertions, 0 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/MeshManager.js b/js/helper-classes/RDGE/src/core/script/MeshManager.js
new file mode 100644
index 00000000..43813078
--- /dev/null
+++ b/js/helper-classes/RDGE/src/core/script/MeshManager.js
@@ -0,0 +1,242 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7function Model(name, mesh)
8{
9 this.name = name;
10 this.mesh = mesh;
11 this.camera = null;
12}
13
14/*
15 * Maintains a list of meshes to allow instancing of data
16 */
17function MeshManager() {
18 this.contentUrl = "assets_web/mesh/";
19 this.modelMap = {};
20 this.readyList = []; // meshes that have data ready
21 this.meshesLoading = true; // indicates that no meshes have loaded or that they are still loading
22 this.postMeshLoadCallbackList = [];
23 this.tempSphere = null;
24 this.requestCounter = 0;
25}
26
27/*
28 * Pass the scene meshNode stump, loads temp object while real mesh is downloading
29 */
30MeshManager.prototype.loadMesh = function (meshStump, tempMesh)
31{
32 // if it exists already, return the mesh requested
33 if ( this.modelMap[meshStump.name] !== undefined )
34 return this.modelMap[meshStump.name];
35
36 meshStump.ready = false;
37 meshStump.addr = this.contentUrl + meshStump.name + "_mesh.json";
38 meshStump.ctxID = g_Engine.getContext().renderer.id;
39
40 // sets a temp mesh up in place of the final mesh to load
41 if (!tempMesh)
42 {
43 if (this.tempSphere == null)
44 {
45 this.tempSphere = makeSphere(g_Engine.getContext().renderer.ctx, 25, 5, 5);
46 }
47
48 tempMesh = this.tempSphere;
49 }
50
51 // add the temp mesh to the map of loaded meshes
52 this.modelMap[meshStump.name] = tempMesh;
53
54 // update the request counter - we now have one more mesh to load
55 this.requestCounter++;
56
57 requestMesh(meshStump);
58
59 return null;
60};
61
62/*
63 * Deletes the passed mesh from the manager as well as all renderers
64 */
65MeshManager.prototype.deleteMesh = function (name)
66{
67 var model = this.modelMap[name];
68
69 if (model)
70 {
71 g_Engine.ctxMan.forEach(function(context)
72 {
73 context.renderer.deletePrimitive(model.primitive);
74 });
75
76 delete this.modelMap[name];
77 }
78};
79
80MeshManager.prototype.getModelByName = function (name)
81{
82 return this.modelMap[name];
83};
84
85MeshManager.prototype.getModelNames = function ()
86{
87 var names = [];
88 for (var index in this.modelMap) {
89 names.push(this.modelList[index].name);
90 }
91
92 return names;
93};
94
95
96MeshManager.prototype.processMeshData = function () {
97 var renderer = g_Engine.getContext().renderer;
98
99 // loop through meshes and load ready data
100 for (var index in this.readyList) {
101 // if item is ready load it
102 if (this.readyList[index] && this.readyList[index].ready && renderer.id === this.readyList[index].ctxID) {
103
104
105 // pop the item
106 var model = this.readyList[index];
107 this.readyList.splice(index, 1);
108
109 var primset = new rdgePrimitiveDefinition();
110
111 primset.vertexDefinition =
112 {
113 // this shows two ways to map this data to an attribute
114 "vert":{'type':rdgeConstants.VS_ELEMENT_POS, 'bufferIndex':0, 'bufferUsage': rdgeConstants.BUFFER_STATIC},
115 "a_pos":{'type':rdgeConstants.VS_ELEMENT_POS, 'bufferIndex':0, 'bufferUsage': rdgeConstants.BUFFER_STATIC},
116 "normal":{'type':rdgeConstants.VS_ELEMENT_FLOAT3, 'bufferIndex':1, 'bufferUsage': rdgeConstants.BUFFER_STATIC},
117 "a_norm":{'type':rdgeConstants.VS_ELEMENT_FLOAT3, 'bufferIndex':1, 'bufferUsage': rdgeConstants.BUFFER_STATIC},
118 "a_normal":{'type':rdgeConstants.VS_ELEMENT_FLOAT3, 'bufferIndex':1, 'bufferUsage': rdgeConstants.BUFFER_STATIC},
119 "texcoord":{'type':rdgeConstants.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': rdgeConstants.BUFFER_STATIC},
120 "a_texcoord":{'type':rdgeConstants.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': rdgeConstants.BUFFER_STATIC},
121 "a_texcoords":{'type':rdgeConstants.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': rdgeConstants.BUFFER_STATIC},
122 "a_uv":{'type':rdgeConstants.VS_ELEMENT_FLOAT2, 'bufferIndex':2, 'bufferUsage': rdgeConstants.BUFFER_STATIC}
123 };
124
125 primset.bufferStreams =
126 [
127 model.root.data.coords,
128 model.root.data.normals,
129 model.root.data.uvs
130 ];
131
132 primset.streamUsage =
133 [
134 rdgeConstants.BUFFER_STATIC,
135 rdgeConstants.BUFFER_STATIC,
136 rdgeConstants.BUFFER_STATIC
137 ];
138
139 primset.indexUsage = rdgeConstants.BUFFER_STREAM;
140
141 primset.indexBuffer = model.root.data.indices;
142
143 renderer.createPrimitive( primset );
144
145 model.root.primitive = primset;
146
147 // generate a bounding box for this mesh
148 model.root.bbox = new box();
149
150 var numCoords = model.root.data.coords.length; var idx = 0;