#include "MGCLStdAfx.h"

#include "mgGL/VBObyAnchorPt.h"


///デフォルトコンストラクタ.
VBObyAnchorPt::VBObyAnchorPt(mgGLSL::CoordinateType coordinateType)
:mgVBO(){
	m_coordinateType = coordinateType;
}

///copy constructor.
VBObyAnchorPt::VBObyAnchorPt(const VBObyAnchorPt& vbo)
:mgVBO(vbo){
	m_anchorPointStatic = vbo.m_anchorPointStatic;
}

///Assignment.
VBObyAnchorPt& VBObyAnchorPt::operator=(const VBObyAnchorPt& vbo)
{
	mgVBO::operator=(vbo);
	m_anchorPointStatic = vbo.m_anchorPointStatic;
	return *this;
}

VBObyAnchorPt::~VBObyAnchorPt()
{
	;
}

void VBObyAnchorPt::setStaticAttribAnchorPoint(const MGPosition& pos)
{
	m_anchorPointStatic=pos;
}

const MGPosition& VBObyAnchorPt::anchorPointStatic()const
{
	return m_anchorPointStatic;
}

void VBObyAnchorPt::execModelTypeAttrib()
{
	mgVBO::execModelTypeAttrib();
	if(!m_anchorPointStatic.is_null()){
		mgGLSLProgram* glslP=mgGLSLProgram::getCurrentGLSLProgram();
		glm::vec3 anchor = glm::vec3(m_anchorPointStatic[0],m_anchorPointStatic[1],m_anchorPointStatic[2]);
		glslP->setUniform(mgGLSLProgram::anchorPoint,anchor);
	}
}
