/** * Kepler - Core **/ import {vector2, vector3, matrix4 } from './math.js'; import sampler2D from './sampler2D.js'; import samplerCube from './samplerCube.js'; class uniform_template{ name; value; prepared = false; } /** * Shader Object * this class takes care of the shader management for you */ class shader { program; uniform_templates = new Array(); uniforms = new Array(); attributes = new Array(); url; samplerId = 0; libraryContent = false; librarys = new Array(); pragmas = new Array(); rawShader; programInfo; compiled = false; blend = 0; /** * set viewport * @param {(viewport)} viewport **/ setViewport( viewport ){ this.viewport = viewport; this.gl = viewport.gl; } createFromFile( url ) { this.url = url; var shaderText = kepler.resources.loadTextFileSynchronous(url); var splitShader = shaderText.split("// #keplerEngine - Split"); this.vertexShaderText = splitShader[0]; this.fragmentShaderText = splitShader[1]; //add pragma's for(var c = 0; c= 0) { s = s.substring(i + prefix.length); } else { return ''; } if (suffix) { i = s.indexOf(suffix); if (i >= 0) { s = s.substring(0, i); } else { return ''; } } return s; }; /** * Chech if object is array * @param {(obj)} object. **/ function isArray(obj) { return obj.constructor == Array; } /** * add string to string at a particular index * @param {(String)} src. * @param {(int)} index. * @param {(String)} str. **/ function insertAt(src, index, str) { return src.substr(0, index) + str + src.substr(index) } var ttt= 0; var samplerId = 0;