aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core/script/renderUtils.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/renderUtils.js')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderUtils.js100
1 files changed, 50 insertions, 50 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/renderUtils.js b/js/helper-classes/RDGE/src/core/script/renderUtils.js
index 2d2a5930..ed3b2cfa 100755
--- a/js/helper-classes/RDGE/src/core/script/renderUtils.js
+++ b/js/helper-classes/RDGE/src/core/script/renderUtils.js
@@ -32,43 +32,43 @@ var RDGE = RDGE || {};
32RDGE.renderUtils = RDGE.renderUtils || {}; 32RDGE.renderUtils = RDGE.renderUtils || {};
33 33
34/* 34/*
35* Creates an indexed box primitive 35* Creates an indexed box primitive
36* @return a rdge primitive 36* @return a rdge primitive
37*/ 37*/
38RDGE.renderUtils.createBox = function () { 38RDGE.renderUtils.createBox = function () {
39 var renderer = RDGE.globals.engine.getContext().renderer; 39 var renderer = RDGE.globals.engine.getContext().renderer;
40 40
41 var coords = 41 var coords =
42 [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, // front 42 [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, // front
43 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, // right 43 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, // right
44 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, // top 44 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, // top
45 -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, // left 45 -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, // left
46 -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, // bottom 46 -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, // bottom
47 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1]; // back 47 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1]; // back
48 48
49 var normals = 49 var normals =
50 [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, // front 50 [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, // front
51 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, // right 51 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, // right
52 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, // top 52 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, // top
53 -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, // left 53 -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, // left
54 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, // bottom 54 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, // bottom
55 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1]; // back 55 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1]; // back
56 56
57 var uvs = 57 var uvs =
58 [1, 1, 0, 1, 0, 0, 1, 0, // front 58 [1, 1, 0, 1, 0, 0, 1, 0, // front
59 0, 1, 0, 0, 1, 0, 1, 1, // right 59 0, 1, 0, 0, 1, 0, 1, 1, // right
60 1, 0, 1, 1, 0, 1, 0, 0, // top 60 1, 0, 1, 1, 0, 1, 0, 0, // top
61 1, 1, 0, 1, 0, 0, 1, 0, // left 61 1, 1, 0, 1, 0, 0, 1, 0, // left
62 0, 0, 1, 0, 1, 1, 0, 1, // bottom 62 0, 0, 1, 0, 1, 1, 0, 1, // bottom
63 0, 0, 1, 0, 1, 1, 0, 1]; // back 63 0, 0, 1, 0, 1, 1, 0, 1]; // back
64 64
65 var indices = 65 var indices =
66 [0, 1, 2, 0, 2, 3, // front 66 [0, 1, 2, 0, 2, 3, // front
67 4, 5, 6, 4, 6, 7, // right 67 4, 5, 6, 4, 6, 7, // right
68 8, 9, 10, 8, 10, 11, // top 68 8, 9, 10, 8, 10, 11, // top
69 12, 13, 14, 12, 14, 15, // left 69 12, 13, 14, 12, 14, 15, // left
70 16, 17, 18, 16, 18, 19, // bottom 70 16, 17, 18, 16, 18, 19, // bottom
71 20, 21, 22, 20, 22, 23]; // back 71 20, 21, 22, 20, 22, 23]; // back
72 72
73 73
74 var prim = new RDGE.rdgePrimitiveDefinition(); 74 var prim = new RDGE.rdgePrimitiveDefinition();
@@ -87,16 +87,16 @@ RDGE.renderUtils.createBox = function () {
87 87
88 prim.bufferStreams = 88 prim.bufferStreams =
89 [ 89 [
90 coords, 90 coords,
91 normals, 91 normals,
92 uvs 92 uvs
93 ]; 93 ];
94 94
95 prim.streamUsage = 95 prim.streamUsage =
96 [ 96 [
97 RDGE.rdgeConstants.BUFFER_STATIC, 97 RDGE.rdgeConstants.BUFFER_STATIC,
98 RDGE.rdgeConstants.BUFFER_STATIC, 98 RDGE.rdgeConstants.BUFFER_STATIC,
99 RDGE.rdgeConstants.BUFFER_STATIC 99 RDGE.rdgeConstants.BUFFER_STATIC
100 ]; 100 ];
101 101
102 prim.indexUsage = RDGE.rdgeConstants.BUFFER_STREAM; 102 prim.indexUsage = RDGE.rdgeConstants.BUFFER_STREAM;
@@ -191,8 +191,8 @@ RDGE.renderUtils.makeSphere = function (ctx, radius, lats, longs) {
191}; 191};
192 192
193/* 193/*
194* Creates a plane as a grid of triangles/quads, orients the plane according the the plane normal 194* Creates a plane as a grid of triangles/quads, orients the plane according the the plane normal
195* note: the center of the plane is always assumed to be the origin. 195* note: the center of the plane is always assumed to be the origin.
196*/ 196*/
197RDGE.renderUtils.createPlane = function (numCols, numRows, width, height, uTileCount, vTileCount, planeNormal) { 197RDGE.renderUtils.createPlane = function (numCols, numRows, width, height, uTileCount, vTileCount, planeNormal) {
198 var renderer = RDGE.globals.engine.getContext().renderer; 198 var renderer = RDGE.globals.engine.getContext().renderer;
@@ -263,16 +263,16 @@ RDGE.renderUtils.createPlane = function (numCols, numRows, width, height, uTileC
263 263
264 prim.bufferStreams = 264 prim.bufferStreams =
265 [ 265 [
266 coords, 266 coords,
267 normals, 267 normals,
268 uvs 268 uvs
269 ]; 269 ];
270 270
271 prim.streamUsage = 271 prim.streamUsage =
272 [ 272 [
273 RDGE.rdgeConstants.BUFFER_STATIC, 273 RDGE.rdgeConstants.BUFFER_STATIC,
274 RDGE.rdgeConstants.BUFFER_STATIC, 274 RDGE.rdgeConstants.BUFFER_STATIC,
275 RDGE.rdgeConstants.BUFFER_STATIC 275 RDGE.rdgeConstants.BUFFER_STATIC
276 ]; 276 ];
277 277
278 prim.indexUsage = RDGE.rdgeConstants.BUFFER_STREAM; 278 prim.indexUsage = RDGE.rdgeConstants.BUFFER_STREAM;
@@ -324,12 +324,12 @@ RDGE.renderUtils.createCubeVolume = function (numCols_x, numLayers_y, numRows_z,
324 324
325 prim.bufferStreams = 325 prim.bufferStreams =
326 [ 326 [
327 coords 327 coords
328 ]; 328 ];
329 329
330 prim.streamUsage = 330 prim.streamUsage =
331 [ 331 [
332 RDGE.rdgeConstants.BUFFER_DYNAMIC 332 RDGE.rdgeConstants.BUFFER_DYNAMIC
333 ]; 333 ];
334 334
335 prim.indexUsage = RDGE.rdgeConstants.BUFFER_STREAM; 335 prim.indexUsage = RDGE.rdgeConstants.BUFFER_STREAM;
@@ -349,14 +349,14 @@ RDGE.renderUtils.createScreenAlignedQuad = function () {
349 349
350 // Screen aligned quad 350 // Screen aligned quad
351 var coords = [ 351 var coords = [
352 -1.0, 1.0, 0.0, 352 -1.0, 1.0, 0.0,
353 1.0, 1.0, 0.0, 353 1.0, 1.0, 0.0,
354 -1.0, -1.0, 0.0, 354 -1.0, -1.0, 0.0,
355 355
356 -1.0, -1.0, 0.0, 356 -1.0, -1.0, 0.0,
357 1.0, 1.0, 0.0, 357 1.0, 1.0, 0.0,
358 1.0, -1.0, 0.0 358 1.0, -1.0, 0.0
359 ]; 359 ];
360 360
361 var uvs = [0.0, 0.0, 361 var uvs = [0.0, 0.0,
362 0.0, 1.0, 362 0.0, 1.0,
@@ -378,14 +378,14 @@ RDGE.renderUtils.createScreenAlignedQuad = function () {
378 378
379 prim.bufferStreams = 379 prim.bufferStreams =
380 [ 380 [
381 coords, 381 coords,
382 uvs 382 uvs
383 ]; 383 ];
384 384
385 prim.streamUsage = 385 prim.streamUsage =
386 [ 386 [
387 RDGE.rdgeConstants.BUFFER_STATIC, 387 RDGE.rdgeConstants.BUFFER_STATIC,
388 RDGE.rdgeConstants.BUFFER_STATIC 388 RDGE.rdgeConstants.BUFFER_STATIC
389 ]; 389 ];
390 390
391 prim.type = RDGE.rdgeConstants.TRIANGLES; 391 prim.type = RDGE.rdgeConstants.TRIANGLES;