#include "utils.h"
#include "glm/ext.hpp"
//#include "scene/scenetree.h"
#include "scene/meshnode.h"
#include "iostream"

std::vector<std::string> utils::split(const std::string &line, char sep){
    std::vector<std::string> tokens;
    std::size_t start=0, end=0;
    while((end = line.find(sep,start)) != std::string::npos){
        tokens.push_back(line.substr(start,end-start));
        start=end+1;
    }
    tokens.push_back(line.substr(start));
    return tokens;
}
/*
void utils::setPosition2D(MeshNode *mnode, glm::vec2 pos){
    const glm::mat4 &tr = mnode->getTransform();
    mnode->setTransform(glm::translate(tr,glm::vec3(pos.x,pos.y,0) - glm::vec3(tr[3])));
}

void utils::resize2D(MeshNode *mnode, glm::vec2 dim, glm::vec2 new_dim){
    scale2D(mnode,glm::vec2(new_dim / dim));
}

void utils::scale2D(MeshNode* mnode, glm::vec2 ratio){
    mnode->setTransform(glm::scale(mnode->getTransform(), glm::vec3(ratio.x,ratio.y,1)));
}

void utils::rotate2D(MeshNode* mnode, glm::vec2 center, float angle){
    glm::mat4 tr = mnode->getTransform();
    //glm::vec3 pos(tr[3]);
    //tr = glm::translate(tr,pos-glm::vec3(center.x,center.y,0));
    tr = glm::rotate(mnode->getTransform(),angle,glm::vec3(0,0,1));
    //tr = glm::translate(tr,glm::vec3(center.x,center.y,0)-pos );
    mnode->setTransform(tr);
}

void setDepth2D(MeshNode* mnode, float depth){
    //Mesh* mesh; //= getMesh here
    //mesh.setDepth(depth);
}
*/
