Example #1
0
static void createGPUAssets(Material& M){
	// Create textures
	std::string texMapFile = M.GetTexMapFile();
	if (!texMapFile.empty())
		M.SetTexMap(Textures::ColorTexture("../Resources/Textures/" + M.GetTexMapFile()));
	else
		M.SetTexMap(Textures::FromSolidColor(vec4(1)));

	std::string nrmMapFile = M.GetNrmMapFile();
	if (!nrmMapFile.empty())
		M.SetNrmMap(Textures::NormalTexture("../Resources/Normals/" + M.GetNrmMapFile()));

	vec4 diff(M.getDiff()), spec(M.getSpec());
	glUniform1f(M.getShinyHandle(), M.getShininess());
	glUniform1f(M.GetReflectHandle(), M.GetReflectivity());
	glUniform4f(M.getDiffHandle(), diff[0], diff[1], diff[2], diff[3]);
	glUniform4f(M.getSpecHandle(), spec[0], spec[1], spec[2], spec[3]);
}