using GameApp.Entities;
using GameApp.Helper;
using OpenGL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameApp
{
    public class StaticShader : ShaderProgram
    {
        const string VERTEX_FILE = "./shaders/vertexShader.txt";
        const string FRAGMENT_FILE = "./shaders/fragmentShader.txt";

        int _loc_transformationMatrix;
        int _loc_projectionMatrix;
        int _loc_viewMatrix;

        public StaticShader() : base(VERTEX_FILE, FRAGMENT_FILE)
        {
        }

        protected override void bindAttributes()
        {
            // base.bindAttribute(0, "_position");
            // base.bindAttribute(1, "_textureCoords");
        }

        protected override void getAllUniformLocations()
        {
            _loc_transformationMatrix  = base.getUniformLocation("_transformationMatrix");
            _loc_projectionMatrix = base.getUniformLocation("_projectionMatrix");
            _loc_viewMatrix = base.getUniformLocation("_viewMatrix");
        }

        public void loadTransformationMatrix(Matrix4x4 matrix)
        {
            base.loadMatrix(_loc_transformationMatrix, matrix);
        }

        public void loadProjectionMatrix(Matrix4x4 matrix)
        {
            base.loadMatrix(_loc_projectionMatrix, matrix);
        }

        public void loadViewMatrix(Camera camera)
        {
            Matrix4x4 viewMatrix = Maths.createViewMatrix(camera);
            base.loadMatrix(_loc_viewMatrix, viewMatrix);
        }
    }
}
