mirror of
https://gitlab.com/Shinobi-Systems/ShinobiCE.git
synced 2025-03-09 15:40:15 +00:00
Shinobi CE officially lands on Gitlab
This commit is contained in:
commit
f1406d4eec
431 changed files with 118157 additions and 0 deletions
41
tools/ffmpegToWeb/Player/broadway/canvas/Script.js
Normal file
41
tools/ffmpegToWeb/Player/broadway/canvas/Script.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require('../utils/assert');
|
||||
|
||||
/**
|
||||
* Represents a WebGL shader script.
|
||||
*/
|
||||
|
||||
function Script() {}
|
||||
|
||||
Script.createFromElementId = function(id) {
|
||||
var script = document.getElementById(id);
|
||||
|
||||
// Didn't find an element with the specified ID, abort.
|
||||
assert(script , "Could not find shader with ID: " + id);
|
||||
|
||||
// Walk through the source element's children, building the shader source string.
|
||||
var source = "";
|
||||
var currentChild = script .firstChild;
|
||||
while(currentChild) {
|
||||
if (currentChild.nodeType == 3) {
|
||||
source += currentChild.textContent;
|
||||
}
|
||||
currentChild = currentChild.nextSibling;
|
||||
}
|
||||
|
||||
var res = new Scriptor();
|
||||
res.type = script.type;
|
||||
res.source = source;
|
||||
return res;
|
||||
};
|
||||
|
||||
Script.createFromSource = function(type, source) {
|
||||
var res = new Script();
|
||||
res.type = type;
|
||||
res.source = source;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
module.exports = Script;
|
Loading…
Add table
Add a link
Reference in a new issue