#include "floatlayer.h"
#include "openglstate.h"
#include "GL/glew.h"
#include "m3derror.h"

namespace M3D {

FloatLayer::FloatLayer()
 : MaterialLayer()
{
}


FloatLayer::~FloatLayer()
{
}
void FloatLayer::set_layer(OpenGLState *state)
{
	int programID = state->get_current_program();
	GLint location = glGetUniformLocation ( programID, (_layer_name_ + "Float").c_str() );
	if(location==-1)/*THROW("Unable to find " + (_layer_name_ + "Float") + " in shader program")*/;
	else glUniform1f ( location, _value_ );
}

void FloatLayer::load( const std::string & base_dir, M3DML_BLOCK_TYPE block_type, const M3DML_Layer * layer, EngineInterface * engine )
{
	_layer_type_ = block_type;
	_value_ = layer->float_block->data;
	set_layer_type();
}

}

