var glu = require('pex-glu');
var color = require('pex-color');
var sys = require('pex-sys');
var Context = glu.Context;
var Material = glu.Material;
var Program = glu.Program;
var Color = color.Color;
var merge = require('merge');
var fs = require('fs');
var Platform = sys.Platform;
var TexturedCubeMapGLSL = fs.readFileSync(__dirname + '/TexturedCubeMap.glsl', 'utf8');
function TexturedCubeMap(uniforms) {
this.gl = Context.currentContext;
if (Platform.isBrowser) {
this.lodExt = this.gl.getExtension('EXT_shader_texture_lod');
if (this.lodExt) {
TexturedCubeMapGLSL = '#define LOD_ENABLED 1\n' + TexturedCubeMapGLSL;
TexturedCubeMapGLSL = '#define WEBGL 1\n' + TexturedCubeMapGLSL;
TexturedCubeMapGLSL = '#define textureCubeLod textureCubeLodEXT\n' + TexturedCubeMapGLSL;
}
}
else {
TexturedCubeMapGLSL = '#define LOD_ENABLED 1\n' + TexturedCubeMapGLSL;
}
var program = new Program(TexturedCubeMapGLSL);
var defaults = {
lod: -1
};
uniforms = merge(defaults, uniforms);
Material.call(this, program, uniforms);
}
TexturedCubeMap.prototype = Object.create(Material.prototype);
module.exports = TexturedCubeMap;