twgl.js 4.23.2 → 4.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/4.x/twgl-full.js +22 -4
- package/dist/4.x/twgl-full.module.js +20 -4
- package/dist/4.x/twgl.js +22 -4
- package/package.json +1 -1
package/dist/4.x/twgl-full.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @license twgl.js 4.
|
|
2
|
+
* @license twgl.js 4.24.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
|
|
3
3
|
* Available via the MIT license.
|
|
4
4
|
* see: http://github.com/greggman/twgl.js for details
|
|
5
5
|
*/
|
|
@@ -1253,6 +1253,12 @@ renderbufferFormats[STENCIL_INDEX8] = true;
|
|
|
1253
1253
|
function isRenderbufferFormat(format) {
|
|
1254
1254
|
return renderbufferFormats[format];
|
|
1255
1255
|
}
|
|
1256
|
+
|
|
1257
|
+
var MAX_COLOR_ATTACHMENT_POINTS = 32; // even an 3090 only supports 8 but WebGL/OpenGL ES define constants for 32
|
|
1258
|
+
|
|
1259
|
+
function isColorAttachmentPoint(attachmentPoint) {
|
|
1260
|
+
return attachmentPoint >= COLOR_ATTACHMENT0 && attachmentPoint < COLOR_ATTACHMENT0 + MAX_COLOR_ATTACHMENT_POINTS;
|
|
1261
|
+
}
|
|
1256
1262
|
/**
|
|
1257
1263
|
* @typedef {Object} FramebufferInfo
|
|
1258
1264
|
* @property {WebGLFramebuffer} framebuffer The WebGLFramebuffer for this framebufferInfo
|
|
@@ -1266,6 +1272,9 @@ function isRenderbufferFormat(format) {
|
|
|
1266
1272
|
* Creates a framebuffer and attachments.
|
|
1267
1273
|
*
|
|
1268
1274
|
* This returns a {@link module:twgl.FramebufferInfo} because it needs to return the attachments as well as the framebuffer.
|
|
1275
|
+
* It also leaves the framebuffer it just created as the currently bound `FRAMEBUFFER`.
|
|
1276
|
+
* Note: If this is WebGL2 or if you called {@link module:twgl.addExtensionsToContext} then it will set the drawBuffers
|
|
1277
|
+
* to `[COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, ...]` for how ever many color attachments were created.
|
|
1269
1278
|
*
|
|
1270
1279
|
* The simplest usage
|
|
1271
1280
|
*
|
|
@@ -1307,21 +1316,25 @@ function createFramebufferInfo(gl, attachments, width, height) {
|
|
|
1307
1316
|
width = width || gl.drawingBufferWidth;
|
|
1308
1317
|
height = height || gl.drawingBufferHeight;
|
|
1309
1318
|
attachments = attachments || defaultAttachments;
|
|
1310
|
-
var
|
|
1319
|
+
var usedColorAttachmentsPoints = [];
|
|
1311
1320
|
var framebufferInfo = {
|
|
1312
1321
|
framebuffer: fb,
|
|
1313
1322
|
attachments: [],
|
|
1314
1323
|
width: width,
|
|
1315
1324
|
height: height
|
|
1316
1325
|
};
|
|
1317
|
-
attachments.forEach(function (attachmentOptions) {
|
|
1326
|
+
attachments.forEach(function (attachmentOptions, i) {
|
|
1318
1327
|
var attachment = attachmentOptions.attachment;
|
|
1319
1328
|
var samples = attachmentOptions.samples;
|
|
1320
1329
|
var format = attachmentOptions.format;
|
|
1321
1330
|
var attachmentPoint = attachmentOptions.attachmentPoint || getAttachmentPointForFormat(format, attachmentOptions.internalFormat);
|
|
1322
1331
|
|
|
1323
1332
|
if (!attachmentPoint) {
|
|
1324
|
-
attachmentPoint = COLOR_ATTACHMENT0 +
|
|
1333
|
+
attachmentPoint = COLOR_ATTACHMENT0 + i;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
if (isColorAttachmentPoint(attachmentPoint)) {
|
|
1337
|
+
usedColorAttachmentsPoints.push(attachmentPoint);
|
|
1325
1338
|
}
|
|
1326
1339
|
|
|
1327
1340
|
if (!attachment) {
|
|
@@ -1365,6 +1378,11 @@ function createFramebufferInfo(gl, attachments, width, height) {
|
|
|
1365
1378
|
|
|
1366
1379
|
framebufferInfo.attachments.push(attachment);
|
|
1367
1380
|
});
|
|
1381
|
+
|
|
1382
|
+
if (gl.drawBuffers) {
|
|
1383
|
+
gl.drawBuffers(usedColorAttachmentsPoints);
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1368
1386
|
return framebufferInfo;
|
|
1369
1387
|
}
|
|
1370
1388
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @license twgl.js 4.
|
|
1
|
+
/* @license twgl.js 4.24.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
|
|
2
2
|
Available via the MIT license.
|
|
3
3
|
see: http://github.com/greggman/twgl.js for details */
|
|
4
4
|
/*
|
|
@@ -9146,6 +9146,12 @@ function isRenderbufferFormat(format) {
|
|
|
9146
9146
|
return renderbufferFormats[format];
|
|
9147
9147
|
}
|
|
9148
9148
|
|
|
9149
|
+
const MAX_COLOR_ATTACHMENT_POINTS = 32; // even an 3090 only supports 8 but WebGL/OpenGL ES define constants for 32
|
|
9150
|
+
|
|
9151
|
+
function isColorAttachmentPoint(attachmentPoint) {
|
|
9152
|
+
return attachmentPoint >= COLOR_ATTACHMENT0 && attachmentPoint < COLOR_ATTACHMENT0 + MAX_COLOR_ATTACHMENT_POINTS;
|
|
9153
|
+
}
|
|
9154
|
+
|
|
9149
9155
|
/**
|
|
9150
9156
|
* @typedef {Object} FramebufferInfo
|
|
9151
9157
|
* @property {WebGLFramebuffer} framebuffer The WebGLFramebuffer for this framebufferInfo
|
|
@@ -9159,6 +9165,9 @@ function isRenderbufferFormat(format) {
|
|
|
9159
9165
|
* Creates a framebuffer and attachments.
|
|
9160
9166
|
*
|
|
9161
9167
|
* This returns a {@link module:twgl.FramebufferInfo} because it needs to return the attachments as well as the framebuffer.
|
|
9168
|
+
* It also leaves the framebuffer it just created as the currently bound `FRAMEBUFFER`.
|
|
9169
|
+
* Note: If this is WebGL2 or if you called {@link module:twgl.addExtensionsToContext} then it will set the drawBuffers
|
|
9170
|
+
* to `[COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, ...]` for how ever many color attachments were created.
|
|
9162
9171
|
*
|
|
9163
9172
|
* The simplest usage
|
|
9164
9173
|
*
|
|
@@ -9198,20 +9207,24 @@ function createFramebufferInfo(gl, attachments, width, height) {
|
|
|
9198
9207
|
width = width || gl.drawingBufferWidth;
|
|
9199
9208
|
height = height || gl.drawingBufferHeight;
|
|
9200
9209
|
attachments = attachments || defaultAttachments;
|
|
9201
|
-
|
|
9210
|
+
const usedColorAttachmentsPoints = [];
|
|
9202
9211
|
const framebufferInfo = {
|
|
9203
9212
|
framebuffer: fb,
|
|
9204
9213
|
attachments: [],
|
|
9205
9214
|
width: width,
|
|
9206
9215
|
height: height,
|
|
9207
9216
|
};
|
|
9208
|
-
|
|
9217
|
+
|
|
9218
|
+
attachments.forEach(function(attachmentOptions, i) {
|
|
9209
9219
|
let attachment = attachmentOptions.attachment;
|
|
9210
9220
|
const samples = attachmentOptions.samples;
|
|
9211
9221
|
const format = attachmentOptions.format;
|
|
9212
9222
|
let attachmentPoint = attachmentOptions.attachmentPoint || getAttachmentPointForFormat(format, attachmentOptions.internalFormat);
|
|
9213
9223
|
if (!attachmentPoint) {
|
|
9214
|
-
attachmentPoint = COLOR_ATTACHMENT0 +
|
|
9224
|
+
attachmentPoint = COLOR_ATTACHMENT0 + i;
|
|
9225
|
+
}
|
|
9226
|
+
if (isColorAttachmentPoint(attachmentPoint)) {
|
|
9227
|
+
usedColorAttachmentsPoints.push(attachmentPoint);
|
|
9215
9228
|
}
|
|
9216
9229
|
if (!attachment) {
|
|
9217
9230
|
if (samples !== undefined || isRenderbufferFormat(format)) {
|
|
@@ -9259,6 +9272,9 @@ function createFramebufferInfo(gl, attachments, width, height) {
|
|
|
9259
9272
|
}
|
|
9260
9273
|
framebufferInfo.attachments.push(attachment);
|
|
9261
9274
|
});
|
|
9275
|
+
if (gl.drawBuffers) {
|
|
9276
|
+
gl.drawBuffers(usedColorAttachmentsPoints);
|
|
9277
|
+
}
|
|
9262
9278
|
return framebufferInfo;
|
|
9263
9279
|
}
|
|
9264
9280
|
|
package/dist/4.x/twgl.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @license twgl.js 4.
|
|
2
|
+
* @license twgl.js 4.24.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
|
|
3
3
|
* Available via the MIT license.
|
|
4
4
|
* see: http://github.com/greggman/twgl.js for details
|
|
5
5
|
*/
|
|
@@ -1253,6 +1253,12 @@ renderbufferFormats[STENCIL_INDEX8] = true;
|
|
|
1253
1253
|
function isRenderbufferFormat(format) {
|
|
1254
1254
|
return renderbufferFormats[format];
|
|
1255
1255
|
}
|
|
1256
|
+
|
|
1257
|
+
var MAX_COLOR_ATTACHMENT_POINTS = 32; // even an 3090 only supports 8 but WebGL/OpenGL ES define constants for 32
|
|
1258
|
+
|
|
1259
|
+
function isColorAttachmentPoint(attachmentPoint) {
|
|
1260
|
+
return attachmentPoint >= COLOR_ATTACHMENT0 && attachmentPoint < COLOR_ATTACHMENT0 + MAX_COLOR_ATTACHMENT_POINTS;
|
|
1261
|
+
}
|
|
1256
1262
|
/**
|
|
1257
1263
|
* @typedef {Object} FramebufferInfo
|
|
1258
1264
|
* @property {WebGLFramebuffer} framebuffer The WebGLFramebuffer for this framebufferInfo
|
|
@@ -1266,6 +1272,9 @@ function isRenderbufferFormat(format) {
|
|
|
1266
1272
|
* Creates a framebuffer and attachments.
|
|
1267
1273
|
*
|
|
1268
1274
|
* This returns a {@link module:twgl.FramebufferInfo} because it needs to return the attachments as well as the framebuffer.
|
|
1275
|
+
* It also leaves the framebuffer it just created as the currently bound `FRAMEBUFFER`.
|
|
1276
|
+
* Note: If this is WebGL2 or if you called {@link module:twgl.addExtensionsToContext} then it will set the drawBuffers
|
|
1277
|
+
* to `[COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, ...]` for how ever many color attachments were created.
|
|
1269
1278
|
*
|
|
1270
1279
|
* The simplest usage
|
|
1271
1280
|
*
|
|
@@ -1307,21 +1316,25 @@ function createFramebufferInfo(gl, attachments, width, height) {
|
|
|
1307
1316
|
width = width || gl.drawingBufferWidth;
|
|
1308
1317
|
height = height || gl.drawingBufferHeight;
|
|
1309
1318
|
attachments = attachments || defaultAttachments;
|
|
1310
|
-
var
|
|
1319
|
+
var usedColorAttachmentsPoints = [];
|
|
1311
1320
|
var framebufferInfo = {
|
|
1312
1321
|
framebuffer: fb,
|
|
1313
1322
|
attachments: [],
|
|
1314
1323
|
width: width,
|
|
1315
1324
|
height: height
|
|
1316
1325
|
};
|
|
1317
|
-
attachments.forEach(function (attachmentOptions) {
|
|
1326
|
+
attachments.forEach(function (attachmentOptions, i) {
|
|
1318
1327
|
var attachment = attachmentOptions.attachment;
|
|
1319
1328
|
var samples = attachmentOptions.samples;
|
|
1320
1329
|
var format = attachmentOptions.format;
|
|
1321
1330
|
var attachmentPoint = attachmentOptions.attachmentPoint || getAttachmentPointForFormat(format, attachmentOptions.internalFormat);
|
|
1322
1331
|
|
|
1323
1332
|
if (!attachmentPoint) {
|
|
1324
|
-
attachmentPoint = COLOR_ATTACHMENT0 +
|
|
1333
|
+
attachmentPoint = COLOR_ATTACHMENT0 + i;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
if (isColorAttachmentPoint(attachmentPoint)) {
|
|
1337
|
+
usedColorAttachmentsPoints.push(attachmentPoint);
|
|
1325
1338
|
}
|
|
1326
1339
|
|
|
1327
1340
|
if (!attachment) {
|
|
@@ -1365,6 +1378,11 @@ function createFramebufferInfo(gl, attachments, width, height) {
|
|
|
1365
1378
|
|
|
1366
1379
|
framebufferInfo.attachments.push(attachment);
|
|
1367
1380
|
});
|
|
1381
|
+
|
|
1382
|
+
if (gl.drawBuffers) {
|
|
1383
|
+
gl.drawBuffers(usedColorAttachmentsPoints);
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1368
1386
|
return framebufferInfo;
|
|
1369
1387
|
}
|
|
1370
1388
|
/**
|