Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image-based lighting #7172

Merged
merged 103 commits into from
Dec 19, 2018
Merged
Show file tree
Hide file tree
Changes from 93 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
948b768
Load env map from dds and load cube maps + mipmaps.
bagnell Sep 25, 2018
692bf7b
Use custom cube for showing env map. Use shader to access lod.
bagnell Sep 26, 2018
f645625
Add IBL to models. Reowrk setup code.
bagnell Sep 27, 2018
59fb605
Functioning octahedral projection
Oct 1, 2018
6a4f965
Created octahedron map unpacking example
Oct 2, 2018
3a189e5
Fix orientation of cubemap temporarily. Add initial SH code.
bagnell Oct 2, 2018
af047fc
Pack mips with 1 pixel border
Oct 3, 2018
87f34eb
Make texture big enough
Oct 3, 2018
8c26eb9
Update spherical harmonics.
bagnell Oct 3, 2018
8a34bcc
Merge pull request #7107 from OmarShehata/ibl
bagnell Oct 4, 2018
2285282
Merge branch 'hdr' into ibl
bagnell Oct 4, 2018
487329a
Fixes after merge.
bagnell Oct 4, 2018
501450c
Fixed artifacts with octahedron projection
Oct 5, 2018
d378a3a
Merge pull request #7117 from OmarShehata/ibl
bagnell Oct 5, 2018
9c30528
Initial integration of octahedral projection.
bagnell Oct 5, 2018
9010669
Fix Octahedral sampling artifacts
Oct 8, 2018
ec89263
Experimental HDR procedural sky
Oct 8, 2018
9036674
Merge branch 'ibl' of https://github.com/OmarShehata/cesium into ibl
Oct 8, 2018
59068ef
Revert "Experimental HDR procedural sky"
Oct 8, 2018
e98524f
Store correct number for max mip level
Oct 8, 2018
d6c9894
Merge pull request #7122 from OmarShehata/ibl
bagnell Oct 8, 2018
b0b3708
Some clean up.
bagnell Oct 8, 2018
d253e7a
Revert cubemap changes to load mip levels and request WebGL 1.
bagnell Oct 8, 2018
e095567
Add doc. Fix typos.
bagnell Oct 8, 2018
eddbb9a
Reverse Z axis in cubemap
Oct 9, 2018
1a781a8
Better LOD choosing in octahedral
Oct 9, 2018
006d859
Add trilinear filtering to octahedral lod selection
Oct 9, 2018
5dca2a0
Only do bilinear filtering if texture_float_linear isn't supported
Oct 10, 2018
06080ba
Merge pull request #7126 from OmarShehata/ibl
bagnell Oct 10, 2018
ef321f8
Add CIE Clear Sky model to procedural environment
Oct 10, 2018
7562570
ACtually add the luminance
Oct 10, 2018
9eec64e
Merge pull request #7126 from OmarShehata/ibl
bagnell Oct 10, 2018
f190bea
Fix banding at lower mips
Oct 11, 2018
64faa12
Fix banding at lower mips
Oct 11, 2018
06ad9e4
Update KTX loader to load cube maps and mip map levels. Use RGBM for …
bagnell Oct 11, 2018
fb79863
Merge pull request #7142 from OmarShehata/fix-banding
bagnell Oct 11, 2018
9f67f79
Merge pull request #7126 from OmarShehata/ibl
bagnell Oct 10, 2018
cdb21d5
Update KTX loader to load cube maps and mip map levels. Use RGBM for …
bagnell Oct 11, 2018
fa73474
Merge pull request #7126 from OmarShehata/ibl
bagnell Oct 10, 2018
8da4636
Merge remote-tracking branch 'upstream/ibl' into ibl
Oct 15, 2018
14483ea
Added comment to shader
Oct 15, 2018
d521740
Fix linting errors
Oct 15, 2018
ffe83bf
Made luminance a uniform
Oct 16, 2018
ea67be3
Cleaned up luminance model
Oct 16, 2018
403cfe2
Typo with file import
Oct 17, 2018
321175b
Fix decoding for RGBM textures which is different for the tool used t…
bagnell Oct 17, 2018
8039c66
Fix loadKTX tests
Oct 17, 2018
46c2134
Use shader constants and style tweaks.
bagnell Oct 17, 2018
a89d869
Add luminance when recreating shader
Oct 17, 2018
425ee75
Temp fix for swapped +/-Y face of RGBM files.
bagnell Oct 17, 2018
b02d663
Fix mipmap padding when loading KTX files.
bagnell Oct 18, 2018
7a0c3f7
Add IBL example.
bagnell Oct 19, 2018
bbc256e
Fix specular map orientation.
bagnell Oct 19, 2018
9c93d05
Merge branch 'hdr' into ibl
bagnell Oct 19, 2018
79bc2c7
Merge pull request #7134 from OmarShehata/ibl
lilleyse Oct 22, 2018
890630c
Merge pull request #7165 from OmarShehata/ibl-tests
bagnell Oct 22, 2018
83ac2e1
Merge branch 'hdr' into ibl
bagnell Oct 23, 2018
70dfda0
Fix after merge.
bagnell Oct 23, 2018
7b99191
Add model IBL tests.
bagnell Oct 23, 2018
172a188
Add Sandcastle example image.
bagnell Oct 23, 2018
b4055af
Remove temp +Y/-Y swap
Oct 24, 2018
1c0d10e
Add octahedral map test
Oct 24, 2018
7080b92
Merge branch 'hdr' into ibl
bagnell Oct 24, 2018
7c8f53d
Add option to disable luminanceAtZenith and fix failing tests.
bagnell Oct 24, 2018
7c1541a
Merge branch 'hdr' into ibl
bagnell Oct 24, 2018
0f410d7
Add octahedral sampling test
Oct 26, 2018
30090e1
Note why we can't use scene.renderForSpecs
Oct 29, 2018
070ffa7
Fix spec name
Oct 29, 2018
78e3bf8
Refactor context render function
Oct 29, 2018
93a7b4b
Remove unnecessary clear.
bagnell Oct 30, 2018
d634e3b
Merge pull request #7183 from OmarShehata/ibl
bagnell Oct 30, 2018
409fe64
Merge branch 'hdr' into ibl
bagnell Oct 30, 2018
546efb5
Fix test after merge.
bagnell Oct 30, 2018
b01e0f0
Fix eslint errors.
bagnell Nov 1, 2018
289e388
Merge branch 'hdr' into ibl
bagnell Nov 2, 2018
58e8628
Doc typo
Nov 5, 2018
335430b
Add links to Sandcastle demo
Nov 5, 2018
e4d9ccd
Add comments to Sandcastle example
Nov 5, 2018
2d2a0d3
Remove diffuseIrradiance
Nov 5, 2018
950f102
Updated IBL docs
Nov 5, 2018
eb39ee7
Add some context
Nov 5, 2018
b34e329
Merge pull request #7231 from OmarShehata/ibl
pjcozzi Nov 5, 2018
62c1846
Fix tests.
bagnell Nov 5, 2018
80bf34e
Merge branch 'hdr' into ibl
bagnell Nov 8, 2018
8367088
Small fixes
lilleyse Nov 9, 2018
bd72208
Add a texture cache. Use the texture cache for projected textures. Ot…
bagnell Nov 13, 2018
7c1998e
Merge branch 'hdr' into ibl
bagnell Nov 13, 2018
5e1559c
Add support for batched and instanced 3D Tiles.
bagnell Nov 13, 2018
6162e47
Add default IBL options to scene.
bagnell Nov 16, 2018
a5bf4db
Merge branch 'master' into ibl
bagnell Nov 16, 2018
ae342b3
Add doc.
bagnell Nov 19, 2018
d8f8183
Merge branch 'master' into ibl
lilleyse Nov 20, 2018
4a62071
Cubemaps must have the y-axis as the up axis. Remove TODO.
bagnell Nov 20, 2018
646a3d9
Fix lighting for models in fixed coordinates.
bagnell Nov 30, 2018
aa6da4f
Change default luminance at zenith.
bagnell Nov 30, 2018
ba03cc6
Fix texture cache issue.
bagnell Dec 1, 2018
ecd4284
Merge branch 'master' into ibl
lilleyse Dec 6, 2018
401e6b5
Fix reflection vector.
bagnell Dec 18, 2018
e6543d0
Use pawns model instead of spheres.
bagnell Dec 18, 2018
60c85f7
Merge branch 'master' into ibl
bagnell Dec 18, 2018
e98e0f6
Fix tests after merge.
bagnell Dec 18, 2018
16a5761
Merge branch 'master' into ibl
bagnell Dec 19, 2018
e37e417
Update the IBL Sandcastle example iage and CHANGES.md.
bagnell Dec 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
132 changes: 132 additions & 0 deletions Apps/Sandcastle/gallery/Image-Based Lighting.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<!DOCTYPE html>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some things that would improve this demo:

  • Be able to switch between the texture environment map and the procedural environment map
  • Slider to change luminanceAtZenith. The property references this demo but the demo does't set it.
  • Is it worth also adding controls for imageBasedLightingFactor and lightColor?
  • Don't use metal rough spheres. Is there a more real-world model that can replace it and still show off the lighting well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use metal rough spheres. Is there a more real-world model that can replace it and still show off the lighting well?

Why not? The idea is to show how the image-based lighting changes when the metallic/roughness parameters change. I think it might be better to have a model and change those parameters, but I'm not sure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we just try to stray away from test models in general. For PBR we switched from the the sci-fi helmet to the ground vehicle for this reason. I just realized we don't have any boat models. Maybe there is a good one out there that has a good mix of metallic and roughness.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was browsing Sketchfab and this helicopter model seemed pretty good. It has smooth metallic areas which is nice. We would probably want to shrink some of the textures and apply Draco compression though.

https://sketchfab.com/models/dca5ae065c584817bf59c53a0920f785.

heli

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more suggestions for the demo

  • Do you still plan on adding IBL parameters to the Entity API? That would help simplify the code in the demo.
  • The "Use procedural image" checkbox is checked when it's using the environment map. It should be the reverse.
  • Disable the slider if not using the procedural sky. The 3D Models Coloring demo has an example of that with knockout.
  • Like in the other comment, it might be nice to add controls for imageBasedLightingFactor and lightColor to get the full sweep of lighting effects.
  • Now that I think about it, would it make sense to combine this demo into the Physically-Based materials demo? It could have a drop down using the two models. We don't have to do it, but just a thought.

<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Use image-based lighting to light a model.">
<meta name="cesium-sandcastle-labels" content="Showcases">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar">
<table><tbody>
<tr>
<td>Luminance at Zenith</td>
<td>
<input type="range" min="0.0" max="2.0" step="0.01" data-bind="value: luminanceAtZenith, valueUpdate: 'input'">
<input type="text" size="4" data-bind="value: luminanceAtZenith">
</td>
</tr>
</tbody></table>
</div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');

var environmentMapURL = '../../SampleData/EnvironmentMap/kiara_6_afternoon_2k_ibl.ktx';
var modelURL = '../../SampleData/models/Spheres/MetalRoughSpheres.glb';

// This environment map was processed using Google's Filament project. To process your own:
// 1 - Download the Filament release (https://github.com/google/filament/releases).
// 2 - Run `cmgen --type=ktx --deploy=/path/to/output /path/to/image.hdr`. Other formats are also supported. Run `cmgen --help` for all options.
// 3 - Take the generated coefficients and the KTX file and load them in CesiumJS as shown below.

var L00 = new Cesium.Cartesian3( 0.170455150831422, 0.163151083190219, 0.196966760289763);
var L1_1 = new Cesium.Cartesian3(-0.066550267689383, -0.022088055746048, 0.078835009246127);
var L10 = new Cesium.Cartesian3( 0.038364097478591, 0.045714300098753, 0.063498904606215);
var L11 = new Cesium.Cartesian3(-0.014365363312810, -0.026490613715151, -0.050189404066020);
var L2_2 = new Cesium.Cartesian3(-0.051532786917890, -0.050777795729986, -0.056449044453032);
var L2_1 = new Cesium.Cartesian3( 0.043454596136534, 0.046672590104157, 0.057530107646610);
var L20 = new Cesium.Cartesian3(-0.001640466274110, 0.001286638231156, 0.007228908989616);
var L21 = new Cesium.Cartesian3(-0.042260855700641, -0.046394335094707, -0.057562936365585);
var L22 = new Cesium.Cartesian3(-0.004953478914091, -0.000479681664876, 0.008508150106928);
var coefficients = [L00, L1_1, L10, L11, L2_2, L2_1, L20, L21, L22];

var height = 5.0;
var hpr = new Cesium.HeadingPitchRoll(0.0, 0.0, 0.0);
var origin = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr);

var model = viewer.scene.primitives.add(Cesium.Model.fromGltf({
url : modelURL,
modelMatrix : modelMatrix,
minimumPixelSize : 128
}));

model.readyPromise.then(function(model) {
var camera = viewer.camera;

// Zoom to model
var controller = viewer.scene.screenSpaceCameraController;
var r = 2.0 * Math.max(model.boundingSphere.radius, camera.frustum.near);
controller.minimumZoomDistance = r * 0.5;

var center = Cesium.Matrix4.multiplyByPoint(model.modelMatrix, model.boundingSphere.center, new Cesium.Cartesian3());
var heading = Cesium.Math.toRadians(230.0);
var pitch = Cesium.Math.toRadians(-20.0);
camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, r * 2.0));
camera.lookAtTransform(Cesium.Matrix4.IDENTITY);

model.sphericalHarmonicCoefficients = coefficients;
model.specularEnvironmentMaps = environmentMapURL;

// The viewModel tracks the state of our mini application.
var viewModel = {
luminanceAtZenith : model.luminanceAtZenith
};
// Convert the viewModel members into knockout observables.
Cesium.knockout.track(viewModel);

// Bind the viewModel to the DOM elements of the UI that call for it.
var toolbar = document.getElementById('toolbar');
Cesium.knockout.applyBindings(viewModel, toolbar);

function subscribeParameter(name) {
Cesium.knockout.getObservable(viewModel, name).subscribe(
function(newValue) {
model[name] = newValue;
}
);
}

subscribeParameter('luminanceAtZenith');

Sandcastle.addToggleButton('Use procedural image', true, function(checked) {
if (checked) {
model.sphericalHarmonicCoefficients = coefficients;
model.specularEnvironmentMaps = environmentMapURL;
} else {
model.sphericalHarmonicCoefficients = undefined;
model.specularEnvironmentMaps = undefined;
}
});
}).otherwise(function(error){
window.alert(error);
});
//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== 'undefined') {
startup(Cesium);
} else if (typeof require === 'function') {
require(['Cesium'], startup);
}
</script>
</body>
</html>
Binary file added Apps/Sandcastle/gallery/Image-Based Lighting.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 36 additions & 14 deletions Source/Core/loadKTX.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ define([
'./defined',
'./PixelFormat',
'./Resource',
'./RuntimeError'
'./RuntimeError',
'./WebGLConstants'
], function(
when,
Check,
CompressedTextureBuffer,
defined,
PixelFormat,
Resource,
RuntimeError) {
RuntimeError,
WebGLConstants) {
'use strict';

/**
Expand Down Expand Up @@ -93,14 +95,16 @@ define([

var fileIdentifier = [0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A];
var endiannessTest = 0x04030201;
var faceOrder = ['positiveX', 'negativeX', 'positiveY', 'negativeY', 'positiveZ', 'negativeZ'];

var sizeOfUint32 = 4;

function parseKTX(data) {
var byteBuffer = new Uint8Array(data);

var isKTX = true;
for (var i = 0; i < fileIdentifier.length; ++i) {
var i;
for (i = 0; i < fileIdentifier.length; ++i) {
if (fileIdentifier[i] !== byteBuffer[i]) {
isKTX = false;
break;
Expand Down Expand Up @@ -170,9 +174,9 @@ define([

// Some tools use a sized internal format.
// See table 2: https://www.opengl.org/sdk/docs/man/html/glTexImage2D.xhtml
if (glInternalFormat === 0x8051) { // GL_RGB8
if (glInternalFormat === WebGLConstants.RGB8) {
glInternalFormat = PixelFormat.RGB;
} else if (glInternalFormat === 0x8058) { // GL_RGBA8
} else if (glInternalFormat === WebGLConstants.RGBA8) {
glInternalFormat = PixelFormat.RGBA;
}

Expand All @@ -190,6 +194,8 @@ define([
if (glFormat !== 0) {
throw new RuntimeError('glFormat must be zero when the texture is compressed.');
}
} else if (glType !== WebGLConstants.UNSIGNED_BYTE) {
throw new RuntimeError('Only unsigned byte buffers are supported.');
} else if (glBaseInternalFormat !== glFormat) {
throw new RuntimeError('The base internal format must be the same as the format for uncompressed textures.');
}
Expand All @@ -201,19 +207,35 @@ define([
if (numberOfArrayElements !== 0) {
throw new RuntimeError('Texture arrays are unsupported.');
}
if (numberOfFaces !== 1) {
throw new RuntimeError('Cubemaps are unsupported.');

var offset = texture.byteOffset;
var mipmaps = new Array(numberOfMipmapLevels);
for (i = 0; i < numberOfMipmapLevels; ++i) {
var level = mipmaps[i] = {};
for (var j = 0; j < numberOfFaces; ++j) {
var width = pixelWidth >> i;
var height = pixelHeight >> i;
var levelSize = PixelFormat.isCompressedFormat(glInternalFormat) ?
PixelFormat.compressedTextureSizeInBytes(glInternalFormat, width, height) :
PixelFormat.textureSizeInBytes(glInternalFormat, glType, width, height);
var levelBuffer = new Uint8Array(texture.buffer, offset, levelSize);
level[faceOrder[j]] = new CompressedTextureBuffer(glInternalFormat, width, height, levelBuffer);
offset += levelSize;
}
offset += 3 - ((offset + 3) % 4) + 4;
}

// Only use the level 0 mipmap
if (numberOfMipmapLevels > 1) {
var levelSize = PixelFormat.isCompressedFormat(glInternalFormat) ?
PixelFormat.compressedTextureSizeInBytes(glInternalFormat, pixelWidth, pixelHeight) :
PixelFormat.textureSizeInBytes(glInternalFormat, pixelWidth, pixelHeight);
texture = new Uint8Array(texture.buffer, texture.byteOffset, levelSize);
var result = mipmaps;
if (numberOfFaces === 1) {
for (i = 0; i < numberOfMipmapLevels; ++i) {
result[i] = result[i][faceOrder[0]];
}
}
if (numberOfMipmapLevels === 1) {
result = result[0];
}

return new CompressedTextureBuffer(glInternalFormat, pixelWidth, pixelHeight, texture);
return result;
}

return loadKTX;
Expand Down
76 changes: 76 additions & 0 deletions Source/Renderer/AutomaticUniforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,82 @@ define([
}
}),

/**
* An automatic GLSL uniform containing the specular environment map atlas used within the scene.
*
* @alias czm_specularEnvironmentMaps
* @namespace
* @glslUniform
*
* @example
* // GLSL declaration
* uniform sampler2D czm_specularEnvironmentMaps;
*/
czm_specularEnvironmentMaps : new AutomaticUniform({
size : 1,
datatype : WebGLConstants.SAMPLER_2D,
getValue : function(uniformState) {
return uniformState.specularEnvironmentMaps;
}
}),

/**
* An automatic GLSL uniform containing the size of the specular environment map atlas used within the scene.
*
* @alias czm_specularEnvironmentMapSize
* @namespace
* @glslUniform
*
* @example
* // GLSL declaration
* uniform vec2 czm_specularEnvironmentMapSize;
*/
czm_specularEnvironmentMapSize : new AutomaticUniform({
size : 1,
datatype : WebGLConstants.FLOAT_VEC2,
getValue : function(uniformState) {
return uniformState.specularEnvironmentMaps.dimensions;
}
}),

/**
* An automatic GLSL uniform containing the maximum level-of-detail of the specular environment map atlas used within the scene.
*
* @alias czm_specularEnvironmentMapsMaximumLOD
* @namespace
* @glslUniform
*
* @example
* // GLSL declaration
* uniform float czm_specularEnvironmentMapsMaximumLOD;
*/
czm_specularEnvironmentMapsMaximumLOD : new AutomaticUniform({
size : 1,
datatype : WebGLConstants.FLOAT,
getValue : function(uniformState) {
return uniformState.specularEnvironmentMapsMaximumLOD;
}
}),

/**
* An automatic GLSL uniform containing the spherical harmonic coefficients used within the scene.
*
* @alias czm_sphericalHarmonicCoefficients
* @namespace
* @glslUniform
*
* @example
* // GLSL declaration
* uniform vec3[9] czm_sphericalHarmonicCoefficients;
*/
czm_sphericalHarmonicCoefficients : new AutomaticUniform({
size : 9,
datatype : WebGLConstants.FLOAT_VEC3,
getValue : function(uniformState) {
return uniformState.sphericalHarmonicCoefficients;
}
}),

/**
* An automatic GLSL uniform representing a 3x3 rotation matrix that transforms
* from True Equator Mean Equinox (TEME) axes to the pseudo-fixed axes at the current scene time.
Expand Down
9 changes: 9 additions & 0 deletions Source/Renderer/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ define([
'./ShaderCache',
'./ShaderProgram',
'./Texture',
'./TextureCache',
'./UniformState',
'./VertexArray'
], function(
Expand Down Expand Up @@ -60,6 +61,7 @@ define([
ShaderCache,
ShaderProgram,
Texture,
TextureCache,
UniformState,
VertexArray) {
'use strict';
Expand Down Expand Up @@ -234,6 +236,7 @@ define([
this._throwOnWebGLError = false;

this._shaderCache = new ShaderCache(this);
this._textureCache = new TextureCache();

var gl = glContext;

Expand Down Expand Up @@ -469,6 +472,11 @@ define([
return this._shaderCache;
}
},
textureCache : {
get : function() {
return this._textureCache;
}
},
uniformState : {
get : function() {
return this._us;
Expand Down Expand Up @@ -1288,6 +1296,7 @@ define([
}

this._shaderCache = this._shaderCache.destroy();
this._textureCache = this._textureCache.destroy();
this._defaultTexture = this._defaultTexture && this._defaultTexture.destroy();
this._defaultCubeMap = this._defaultCubeMap && this._defaultCubeMap.destroy();

Expand Down
4 changes: 4 additions & 0 deletions Source/Renderer/CubeMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ define([
function createFace(target, sourceFace, preMultiplyAlpha, flipY) {
// TODO: gl.pixelStorei(gl._UNPACK_ALIGNMENT, 4);
var arrayBufferView = sourceFace.arrayBufferView;
if (!defined(arrayBufferView)) {
arrayBufferView = sourceFace.bufferView;
}

if (arrayBufferView) {
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
Expand Down
5 changes: 5 additions & 0 deletions Source/Renderer/ShaderSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ define([
result += '#define OUTPUT_DECLARATION\n\n';
}

// Define a constant for the OES_texture_float_linear extension since WebGL does not.
if (context.textureFloatLinear) {
result += '#define OES_texture_float_linear\n\n';
}

// append built-ins
if (shaderSource.includeBuiltIns) {
result += getBuiltinsAndAutomaticUniforms(combinedSources);
Expand Down
Loading