WebGL 2.0
Added WebGL 2.0 initial support, which is enabled by default on platforms which support WebGL 2.0 (stats: http://webglstats.com/webgl2)
Engine is fully backwards compatible to WebGL 1.0, although some cases with custom shaders might get affected due to new keywords being added and some keywords been renamed in GLSL 3.0. Shaders that are changed using shader chunks will auto-rename methods to ensure backwards-compatibility between both WebGL versions.
Renamed built-in functions:
texture2D, textureCube > texture
texture2DProj > textureProj
Standarized extensions as built-in functions:
dFdx, dFdy, fwidth
Standarized extensions as built-in functions with renaming:
texture2DLodEXT, textureCubeLodEXT > textureLod
texture2DProjLodEXT > textureProjLod
texture2DGradEXT, textureCubeGradEXT > textureGrad
texture2DProjGradEXT > textureProjGrad
List of new GLSL 3.0 keywords that if you used as variable names might lead to compilation errors:
layout, centroid, flat, smooth, switch, case, default, mat2x2, mat2x3, mat2x4, mat3x2, mat3x3,
mat3x4, mat4x2, mat4x3, mat4x4, uint, uvec2, uvec3, uvec4, sampler3D, sampler2DShadow,
samplerCubeShadow, sampler2DArray, sampler2DArrayShadow, isampler2D, isampler3D, isamplerCube,
isampler2DArray, usampler2D, usampler3D, usamplerCube, usampler2DArray, coherent, volatile,
restrict, readonly, writeonly, resource, atomic_uint, noperspective, patch, sample, subroutine,
common, partition, active, asm, class, union, enum, typedef, template, this, goto, inline,
noinline, public, static, extern, external, interface, long, short, double, half, fixed,
unsigned, superp, input, output, hvec2, hvec3, hvec4, dvec2, dvec3, dvec4, fvec2, fvec3, fvec4,
sampler3DRect, filter, image1D, image2D, image3D, imageCube, iimage1D, iimage2D, iimage3D,
iimageCube, uimage1D, uimage2D, uimage3D, uimageCube, image1DArray, image2DArray,
iimage1DArray, iimage2DArray, uimage1DArray, uimage2DArray, imageBuffer, iimageBuffer,
uimageBuffer, sampler1D, sampler1DShadow, sampler1DArray, sampler1DArrayShadow, isampler1D,
isampler1DArray, usampler1D, usampler1DArray, sampler2DRect, sampler2DRectShadow,
isampler2DRect, usampler2DRect, samplerBuffer, isamplerBuffer, usamplerBuffer, sampler2DMS,
isampler2DMS, usampler2DMS, sampler2DMSArray, isampler2DMSArray, usampler2DMSArray, sizeof,
cast, namespace, using, sinh, cosh, tanh, asinh, acosh, atanh, trunc, round, roundEven, modf,
isnan, isinf, floatBitsToInt, floatBitsToUint, intBitsToFloat, uintBitsToFloat, packSnorm2x16,
unpackSnorm2x16, packUnorm2x16, unpackUnorm2x16, packHalf2x16, unpackHalf2x16, outerProduct,
transpose, determinant, inverse, textureSize, texelFetch, texelFetchOffset, textureOffset,
textureProjOffset, textureLodOffset, textureGardOffset, textureProjLodOffset,
textureProjGradOffset
Change Log:
- Added
preferWebGl2
option to Application arguments to enforce WebGL 1.0 context over WebGL 2.0 - Added
autoRender
andrenderNextFrame
toApplication
to allow disabling auto rendering and providing auto-disable toggle (renderNextFrame
) so it can be set to true to render next frame once - Added WebGL 2.0 new texture formats
- Pass
asset.file
as third parameter to assetshandler.load
so custom handlers can get file object information within handlers implementation (thanks for PR #693 by @aidinabedi) Vec2
,Vec3
,Vec4
,Color
,Mat3
,Mat4
,Quat
now accept arays of values as constructor argument (thanks for PR #846 by @aidinabedi)- Added
pc.OrientedBox
which is same aspc.BoundingBox
but with rotation - Added
pc.BoundingBox.intersectsBoundingSphere(sphere)
method to check if bounding box intersects with bounding sphere - Added
pc.BoundingSphere.intersectsBoundingSphere(sphere)
method to check if bounding sphere intersects with another bounding sphere - Added to
/extras/camera
orbit-camera input files for mouse & touch, as well as easing to orbit-camera motion - Added workaround for WebVR to work in Firefox Nightly
- Added documentation to
events.once
method - Added shader chunks ensuring backwards compatibility between WebGL 2.0 and 1.0
- Improved reference for texture options
- Improved reference for
Application.setCanvasResolution
- More features, fixes and improvements to ongoing 2D API
- [FIX] orbit-camera to find shortest path on the yaw axis
- [FIX] clamp particles emitter state texture to prevent particles warping
- [FIX] typo in
rollOffFactor
for positional audio - [FIX] clear reference to material when destroying mesh, used to prevent GC'ing mesh instance
- [FIX] auto attribute collection for shader chunks
- [FIX] stencil properties construction
- [FIX] shadows update respecting more
shadowUpdateMode
- [FIX] profiler rendering stats
- [FIX] static light for meshes with more than 65,535 indices
- [FIX] runtime lightmap blending
- [FIX] static lights certain behaviours
- [FIX] ambient was added to runtime lightmaps when there was static lightmap available
- [FIX] depth render target was always rendering with screen resolution
- [FIX] receiveShadow was not respected in some scenarios for shader generation
- [FIX] multi-changes to material could lead to shader of a material not being update