program.js
// Update the lighting data/change texture flags to properly display the selected material
Update the lighting data/change texture flags to properly display the selected material
Update the lighting data / change texture flags to properly display the selected material
function updateMaterial(material) {
	if(material == "yellowPlastic") {
		materialAmbient = vec4( 0.6, 0.6, 0.2, 1.0 );
		materialDiffuse = vec4( 1.0, 1.0, 0.0, 1.0 );
		materialSpecular = vec4( 0.7, 0.7, 0.7, 1.0 );
		materialShininess = 15.0;
		configureLight();
		renderTexture = 0;
		updateRenderTexture(renderTexture);
	}
	else if(material == "brassMetal") {
		materialAmbient = vec4( 0.35, 0.25, 0.15, 1.0 );
		materialDiffuse = vec4( 0.15, 0.05, 0.0, 1.0 );
		materialSpecular = vec4( 1.0, 0.8, 0.4, 1.0 );
		materialShininess = 5.0;
		configureLight();
		renderTexture = 0;
		updateRenderTexture(renderTexture);
	}
	else if(material == "textureMap") {
		materialAmbient = vec4( 1.0, 1.0, 1.0, 1.0 );
		materialDiffuse = vec4( 1.0, 1.0, 1.0, 1.0 );
		materialSpecular = vec4( 0.0, 0.0, 0.0, 1.0 );
		materialShininess = 0.0;
		configureLight();
		renderTexture = 1;
		updateRenderTexture(renderTexture);
	}
}
function updateMaterial ( material ) { if ( material == "yellowPlastic" ) { materialAmbient = vec4 ( 0.6 , 0.6 , 0.2 , 1.0 ) ; materialDiffuse = vec4 ( 1.0 , 1.0 , 0.0 , 1.0 ) ; materialSpecular = vec4 ( 0.7 , 0.7 , 0.7 , 1.0 ) ; materialShininess = 15.0 ; configureLight ( ) ; renderTexture = 0 ; updateRenderTexture ( renderTexture ) ; } else if ( material == "brassMetal" ) { materialAmbient = vec4 ( 0.35 , 0.25 , 0.15 , 1.0 ) ; materialDiffuse = vec4 ( 0.15 , 0.05 , 0.0 , 1.0 ) ; materialSpecular = vec4 ( 1.0 , 0.8 , 0.4 , 1.0 ) ; materialShininess = 5.0 ; configureLight ( ) ; renderTexture = 0 ; updateRenderTexture ( renderTexture ) ; } else if ( material == "textureMap" ) { materialAmbient = vec4 ( 1.0 , 1.0 , 1.0 , 1.0 ) ; materialDiffuse = vec4 ( 1.0 , 1.0 , 1.0 , 1.0 ) ; materialSpecular = vec4 ( 0.0 , 0.0 , 0.0 , 1.0 ) ; materialShininess = 0.0 ; configureLight ( ) ; renderTexture = 1 ; updateRenderTexture ( renderTexture ) ; } }
Update the lighting data/change texture flags to properly display the selected material
Update the lighting data / change texture flags to properly display the selected material