-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make accommodations necessary for iOS 10 HLS (#2597)
* make accommodations necessary for iOS 10 HLS * add candidate ios10hls shader * use ios10hls shader automatically if needed * minor edits per discussion on PR * move isHLS into utils/material * fix isHLS issue
- Loading branch information
1 parent
727c2c7
commit bb2fa5a
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ require('./flat'); | |
require('./standard'); | ||
require('./sdf'); | ||
require('./msdf'); | ||
require('./ios10hls'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var registerShader = require('../core/shader').registerShader; | ||
|
||
/** | ||
* Custom shader for iOS 10 HTTP Live Streaming (HLS). | ||
* For more information on HLS, see https://datatracker.ietf.org/doc/draft-pantos-http-live-streaming/ | ||
*/ | ||
module.exports.Shader = registerShader('ios10hls', { | ||
schema: { | ||
src: {type: 'map', is: 'uniform'}, | ||
opacity: {type: 'number', is: 'uniform', default: 1} | ||
}, | ||
|
||
vertexShader: [ | ||
'varying vec2 vUV;', | ||
'void main(void) {', | ||
' gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);', | ||
' vUV = uv;', | ||
'}' | ||
].join('\n'), | ||
|
||
fragmentShader: [ | ||
'uniform sampler2D src;', | ||
'uniform float opacity;', | ||
'varying vec2 vUV;', | ||
'void main() {', | ||
' vec2 offset = vec2(0, 0);', | ||
' vec2 repeat = vec2(1, 1);', | ||
' vec4 color = texture2D(src, vec2(vUV.x / repeat.x + offset.x, (1.0 - vUV.y) / repeat.y + offset.y)).bgra;', | ||
' gl_FragColor = vec4(color.rgb, opacity);', | ||
'}' | ||
].join('\n') | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters