Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jul 7, 2022
1 parent 5338040 commit 5360d49
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 30 deletions.
26 changes: 22 additions & 4 deletions dist/4.x/twgl-full.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/4.x/twgl-full.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/4.x/twgl-full.min.js

Large diffs are not rendered by default.

24 changes: 20 additions & 4 deletions dist/4.x/twgl-full.module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* @license twgl.js 4.23.2 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
/* @license twgl.js 4.24.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
Available via the MIT license.
see: http://github.com/greggman/twgl.js for details */
/*
Expand Down Expand Up @@ -9146,6 +9146,12 @@ function isRenderbufferFormat(format) {
return renderbufferFormats[format];
}

const MAX_COLOR_ATTACHMENT_POINTS = 32; // even an 3090 only supports 8 but WebGL/OpenGL ES define constants for 32

function isColorAttachmentPoint(attachmentPoint) {
return attachmentPoint >= COLOR_ATTACHMENT0 && attachmentPoint < COLOR_ATTACHMENT0 + MAX_COLOR_ATTACHMENT_POINTS;
}

/**
* @typedef {Object} FramebufferInfo
* @property {WebGLFramebuffer} framebuffer The WebGLFramebuffer for this framebufferInfo
Expand All @@ -9159,6 +9165,9 @@ function isRenderbufferFormat(format) {
* Creates a framebuffer and attachments.
*
* This returns a {@link module:twgl.FramebufferInfo} because it needs to return the attachments as well as the framebuffer.
* It also leaves the framebuffer it just created as the currently bound `FRAMEBUFFER`.
* Note: If this is WebGL2 or if you called {@link module:twgl.addExtensionsToContext} then it will set the drawBuffers
* to `[COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, ...]` for how ever many color attachments were created.
*
* The simplest usage
*
Expand Down Expand Up @@ -9198,20 +9207,24 @@ function createFramebufferInfo(gl, attachments, width, height) {
width = width || gl.drawingBufferWidth;
height = height || gl.drawingBufferHeight;
attachments = attachments || defaultAttachments;
let colorAttachmentCount = 0;
const usedColorAttachmentsPoints = [];
const framebufferInfo = {
framebuffer: fb,
attachments: [],
width: width,
height: height,
};
attachments.forEach(function(attachmentOptions) {

attachments.forEach(function(attachmentOptions, i) {
let attachment = attachmentOptions.attachment;
const samples = attachmentOptions.samples;
const format = attachmentOptions.format;
let attachmentPoint = attachmentOptions.attachmentPoint || getAttachmentPointForFormat(format, attachmentOptions.internalFormat);
if (!attachmentPoint) {
attachmentPoint = COLOR_ATTACHMENT0 + colorAttachmentCount++;
attachmentPoint = COLOR_ATTACHMENT0 + i;
}
if (isColorAttachmentPoint(attachmentPoint)) {
usedColorAttachmentsPoints.push(attachmentPoint);
}
if (!attachment) {
if (samples !== undefined || isRenderbufferFormat(format)) {
Expand Down Expand Up @@ -9259,6 +9272,9 @@ function createFramebufferInfo(gl, attachments, width, height) {
}
framebufferInfo.attachments.push(attachment);
});
if (gl.drawBuffers) {
gl.drawBuffers(usedColorAttachmentsPoints);
}
return framebufferInfo;
}

Expand Down
26 changes: 22 additions & 4 deletions dist/4.x/twgl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/4.x/twgl.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/4.x/twgl.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

<section class="readme">
<article><h1>TWGL: A Tiny WebGL helper Library<div id="pronounce" style="font-size: xx-small;">[rhymes with wiggle]</div></h1>
<p><a href="https://travis-ci.org/greggman/twgl.js"><img src="https://travis-ci.org/greggman/twgl.js.svg?branch=master" alt="Build Status"></a></p>
<p><a href="https://github.com/greggman/twgl.js/actions/workflows/test.yml"><img src="https://github.com/greggman/twgl.js/actions/workflows/test.yml/badge.svg" alt="Build Status"></a></p>
<p>This library's sole purpose is to make using the WebGL API less verbose.</p>
<h2>TL;DR</h2>
<p>If you want to get stuff done use <a href="http://threejs.org">three.js</a>. If you want<br>
Expand Down
5 changes: 4 additions & 1 deletion docs/module-twgl.html
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,10 @@ <h4 class="name" id=".createFramebufferInfo"><span class="type-signature">(stati

<div class="description">
<p>Creates a framebuffer and attachments.</p>
<p>This returns a <a href="module-twgl.html#.FramebufferInfo"><code>module:twgl.FramebufferInfo</code></a> because it needs to return the attachments as well as the framebuffer.</p>
<p>This returns a <a href="module-twgl.html#.FramebufferInfo"><code>module:twgl.FramebufferInfo</code></a> because it needs to return the attachments as well as the framebuffer.<br>
It also leaves the framebuffer it just created as the currently bound <code>FRAMEBUFFER</code>.<br>
Note: If this is WebGL2 or if you called <a href="module-twgl.html#.addExtensionsToContext"><code>module:twgl.addExtensionsToContext</code></a> then it will set the drawBuffers<br>
to <code>[COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, ...]</code> for how ever many color attachments were created.</p>
<p>The simplest usage</p>
<pre><code>// create an RGBA/UNSIGNED_BYTE texture and DEPTH_STENCIL renderbuffer
const fbi = twgl.createFramebufferInfo(gl);
Expand Down
5 changes: 4 additions & 1 deletion docs/module-twgl_framebuffers.html
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,10 @@ <h4 class="name" id=".createFramebufferInfo"><span class="type-signature">(stati

<div class="description">
<p>Creates a framebuffer and attachments.</p>
<p>This returns a <a href="module-twgl.html#.FramebufferInfo"><code>module:twgl.FramebufferInfo</code></a> because it needs to return the attachments as well as the framebuffer.</p>
<p>This returns a <a href="module-twgl.html#.FramebufferInfo"><code>module:twgl.FramebufferInfo</code></a> because it needs to return the attachments as well as the framebuffer.<br>
It also leaves the framebuffer it just created as the currently bound <code>FRAMEBUFFER</code>.<br>
Note: If this is WebGL2 or if you called <a href="module-twgl.html#.addExtensionsToContext"><code>module:twgl.addExtensionsToContext</code></a> then it will set the drawBuffers<br>
to <code>[COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, ...]</code> for how ever many color attachments were created.</p>
<p>The simplest usage</p>
<pre><code>// create an RGBA/UNSIGNED_BYTE texture and DEPTH_STENCIL renderbuffer
const fbi = twgl.createFramebufferInfo(gl);
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!-- this file is auto-generated from README.md. Do not edited directly -->
<!--
@license twgl.js 4.23.2 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
@license twgl.js 4.24.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
Available via the MIT license.
see: http://github.com/greggman/twgl.js for details
-->
Expand Down Expand Up @@ -44,7 +44,7 @@
</div>
<div id="content">
<h1 id="twgl-a-tiny-webgl-helper-libraryrhymes-with-wiggle">TWGL: A Tiny WebGL helper Library<div id="pronounce" style="font-size: xx-small;">[rhymes with wiggle]</div></h1>
<p><a href="https://travis-ci.org/greggman/twgl.js"><img src="https://travis-ci.org/greggman/twgl.js.svg?branch=master" alt="Build Status"></a></p>
<p><a href="https://github.com/greggman/twgl.js/actions/workflows/test.yml"><img src="https://github.com/greggman/twgl.js/actions/workflows/test.yml/badge.svg" alt="Build Status"></a></p>
<p>This library&#39;s sole purpose is to make using the WebGL API less verbose.</p>
<h2 id="tldr">TL;DR</h2>
<p>If you want to get stuff done use <a href="http://threejs.org">three.js</a>. If you want
Expand Down
2 changes: 1 addition & 1 deletion npm/base/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TWGL: A Tiny WebGL helper Library<div id="pronounce" style="font-size: xx-small;">[rhymes with wiggle]</div>
=====================================================

[![Build Status](https://travis-ci.org/greggman/twgl.js.svg?branch=master)](https://travis-ci.org/greggman/twgl.js)
[![Build Status](https://github.com/greggman/twgl.js/actions/workflows/test.yml/badge.svg)](https://github.com/greggman/twgl.js/actions/workflows/test.yml)

This library's sole purpose is to make using the WebGL API less verbose.

Expand Down
26 changes: 22 additions & 4 deletions npm/base/dist/4.x/twgl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion npm/base/dist/4.x/twgl.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion npm/base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twgl-base.js",
"version": "4.23.2",
"version": "4.24.0",
"description": "A Tiny WebGL helper library",
"main": "dist/4.x/twgl.js",
"types": "dist/4.x/twgl-full.d.ts",
Expand Down

0 comments on commit 5360d49

Please sign in to comment.