|
1 | | -import { Vector4, Color, Frustum, Matrix4, Vector2, Vector3, floorPowerOfTwo, ColorManagement } from '@renderlayer/math'; |
| 1 | +import { Vector4, Color, Frustum, Matrix4, Vector2, Vector3, ColorManagement } from '@renderlayer/math'; |
2 | 2 | import { createCanvasElement, SRGBColorSpace, NoToneMapping, HalfFloatType, UnsignedByteType, LinearMipmapLinearFilter, DoubleSide, BackSide, FrontSide, RGBAFormat, FloatType, WebGLCoordinateSystem, DisplayP3ColorSpace, LinearDisplayP3ColorSpace, LinearSRGBColorSpace, RGBAIntegerFormat, RGIntegerFormat, RedIntegerFormat, UnsignedIntType, UnsignedShortType, UnsignedInt248Type, UnsignedShort4444Type, UnsignedShort5551Type } from '@renderlayer/shared'; |
3 | 3 | import { WebGLRenderTarget } from '@renderlayer/targets'; |
4 | 4 | import { WebGLAnimation, WebGLUniforms, WebGLExtensions, WebGLCapabilities, WebGLUtils, WebGLState, WebGLInfo, WebGLProperties, WebGLTextures, WebGLCubeMaps, WebGLCubeUVMaps, WebGLAttributes, WebGLBindingStates, WebGLGeometries, WebGLObjects, WebGLMorphtargets, WebGLClipping, WebGLPrograms, WebGLMaterials, WebGLRenderLists, WebGLRenderStates, WebGLBackground, WebGLShadowMap, WebGLUniformsGroups, WebGLBufferRenderer, WebGLIndexedBufferRenderer } from '@renderlayer/webgl'; |
@@ -745,21 +745,16 @@ class WebGLRenderer { |
745 | 745 | if (overrideMaterial !== null) { |
746 | 746 | return; |
747 | 747 | } |
748 | | - const isWebGL2 = capabilities.isWebGL2; |
749 | 748 | if (_transmissionRenderTarget === null) { |
750 | 749 | _transmissionRenderTarget = new WebGLRenderTarget(1, 1, { |
751 | 750 | generateMipmaps: true, |
752 | 751 | type: extensions.has("EXT_color_buffer_half_float") ? HalfFloatType : UnsignedByteType, |
753 | 752 | minFilter: LinearMipmapLinearFilter, |
754 | | - samples: isWebGL2 ? 4 : 0 |
| 753 | + samples: 4 |
755 | 754 | }); |
756 | 755 | } |
757 | 756 | _this.getDrawingBufferSize(_vector2); |
758 | | - if (isWebGL2) { |
759 | | - _transmissionRenderTarget.setSize(_vector2.x, _vector2.y); |
760 | | - } else { |
761 | | - _transmissionRenderTarget.setSize(floorPowerOfTwo(_vector2.x), floorPowerOfTwo(_vector2.y)); |
762 | | - } |
| 757 | + _transmissionRenderTarget.setSize(_vector2.x, _vector2.y); |
763 | 758 | const currentRenderTarget = _this.getRenderTarget(); |
764 | 759 | _this.setRenderTarget(_transmissionRenderTarget); |
765 | 760 | _this.getClearColor(_currentClearColor); |
@@ -993,7 +988,7 @@ class WebGLRenderer { |
993 | 988 | needsProgramChange = true; |
994 | 989 | } else if (materialProperties.toneMapping !== toneMapping) { |
995 | 990 | needsProgramChange = true; |
996 | | - } else if (capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount) { |
| 991 | + } else if (materialProperties.morphTargetsCount !== morphTargetsCount) { |
997 | 992 | needsProgramChange = true; |
998 | 993 | } |
999 | 994 | } else { |
@@ -1059,7 +1054,7 @@ class WebGLRenderer { |
1059 | 1054 | } |
1060 | 1055 | } |
1061 | 1056 | const morphAttributes = geometry.morphAttributes; |
1062 | | - if (morphAttributes.position !== void 0 || morphAttributes.normal !== void 0 || morphAttributes.color !== void 0 && capabilities.isWebGL2 === true) { |
| 1057 | + if (morphAttributes.position !== void 0 || morphAttributes.normal !== void 0 || morphAttributes.color !== void 0) { |
1063 | 1058 | morphtargets.update(object, geometry, program); |
1064 | 1059 | } |
1065 | 1060 | if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) { |
@@ -1100,13 +1095,9 @@ class WebGLRenderer { |
1100 | 1095 | if (material.isShaderMaterial || material.isRawShaderMaterial) { |
1101 | 1096 | const groups = material.uniformsGroups; |
1102 | 1097 | for (let i = 0, l = groups.length; i < l; i++) { |
1103 | | - if (capabilities.isWebGL2) { |
1104 | | - const group = groups[i]; |
1105 | | - uniformsGroups.update(group, program); |
1106 | | - uniformsGroups.bind(group, program); |
1107 | | - } else { |
1108 | | - console.warn("WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2."); |
1109 | | - } |
| 1098 | + const group = groups[i]; |
| 1099 | + uniformsGroups.update(group, program); |
| 1100 | + uniformsGroups.bind(group, program); |
1110 | 1101 | } |
1111 | 1102 | } |
1112 | 1103 | return program; |
@@ -1190,7 +1181,7 @@ class WebGLRenderer { |
1190 | 1181 | framebuffer = __webglFramebuffer[activeCubeFace]; |
1191 | 1182 | } |
1192 | 1183 | isCube = true; |
1193 | | - } else if (capabilities.isWebGL2 && renderTarget.samples > 0 && textures.useMultisampledRTT(renderTarget) === false) { |
| 1184 | + } else if (renderTarget.samples > 0 && textures.useMultisampledRTT(renderTarget) === false) { |
1194 | 1185 | framebuffer = properties.get(renderTarget).__webglMultisampledFramebuffer; |
1195 | 1186 | } else { |
1196 | 1187 | if (Array.isArray(__webglFramebuffer)) { |
@@ -1259,9 +1250,9 @@ class WebGLRenderer { |
1259 | 1250 | ); |
1260 | 1251 | return; |
1261 | 1252 | } |
1262 | | - const halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has("EXT_color_buffer_half_float") || capabilities.isWebGL2 && extensions.has("EXT_color_buffer_float")); |
| 1253 | + const halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has("EXT_color_buffer_half_float") || extensions.has("EXT_color_buffer_float")); |
1263 | 1254 | if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513) |
1264 | | - !(textureType === FloatType && (capabilities.isWebGL2 || extensions.has("OES_texture_float") || extensions.has("WEBGL_color_buffer_float"))) && // Chrome Mac >= 52 and Firefox |
| 1255 | + !(textureType === FloatType && true) && // Chrome Mac >= 52 and Firefox |
1265 | 1256 | !halfFloatSupportedByExt) { |
1266 | 1257 | console.error( |
1267 | 1258 | "WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type." |
|
0 commit comments