var geom = require('pex-geom');
var Vec2 = geom.Vec2;
var Geometry = geom.Geometry;
var Program = require('./Program');
var Material = require('./Material');
var Mesh = require('./Mesh');
var fs = require('fs');
var ScreenImageGLSL = fs.readFileSync(__dirname + '/ScreenImage.glsl', 'utf8');
function ScreenImage(image, x, y, w, h, screenWidth, screenHeight) {
x = x !== undefined ? x : 0;
y = y !== undefined ? y : 0;
w = w !== undefined ? w : 1;
h = h !== undefined ? h : 1;
screenWidth = screenWidth !== undefined ? screenWidth : 1;
screenHeight = screenHeight !== undefined ? screenHeight : 1;
this.image = image;
var program = new Program(ScreenImageGLSL);
var uniforms = {
screenSize: Vec2.create(screenWidth, screenHeight),
pixelPosition: Vec2.create(x, y),
pixelSize: Vec2.create(w, h),
alpha: 1
};
if (image) {
uniforms.image = image;
}
var material = new Material(program, uniforms);
var vertices = [
new Vec2(-1, 1),
new Vec2(-1, -1),
new Vec2(1, -1),
new Vec2(1, 1)
];
var texCoords = [
new Vec2(0, 1),
new Vec2(0, 0),
new Vec2(1, 0),
new Vec2(1, 1)
];
var geometry = new Geometry({
vertices: vertices,
texCoords: texCoords,
faces: true
});