Game Development Community

turn on and off pixelSpecular for all material

by Yadhi Aditya P · in Torque 3D Professional · 02/03/2010 (7:45 am) · 2 replies

How to toogle on and off all pixelSpecular setting on all object material?
I can turn off the "pixelSpecular" only one material at a time using this script,

samplematerial.pixelSpecular[0] = true;
samplematerial.reload();

and to turn this off

samplematerial.pixelSpecular[0] = false;
samplematerial.reload();

This only change one material property.
What I want is to turn off all material on my mission inculding the player material.

#1
02/03/2010 (9:07 am)
There's a pref variable for that:
$pref::Video::disablePixSpecular

There's also another one for disabling normal mapping if you need it:
$pref::Video::disableNormalmapping
#2
02/04/2010 (10:46 pm)
Yay Thank you, I don't know T3D already pref for that.

I manage to get it working, add this in game/core/script optionDlg.cs

OptSpecularToggle.setStateOn(!$pref::Video::disablePixSpecular);
OptNormalToggle.setstateOn(!$pref::Video::disableNormalmapping);

function OptSpecularToggle::onAction(%this)
{
   echo("===========1111111111111111111======");
   %checked = %this.getValue();
    echo("checked" SPC %checked);   
   $pref::Video::disablePixSpecular = %checked;
   echo("pref::Video::disablePixSpecular" SPC $pref::Video::disablePixSpecular);
    recalcFeaturesFromPrefs();
	reInitMaterials();
	echo("===========0000000000000000======");	
}

function OptNormalToggle::onAction(%this)
{
   echo("===========1111111111111111111======");
   %checked = %this.getValue();
    echo("checked" SPC %checked);   
   $pref::Video::disableNormalmapping = %checked;
   echo("pref::Video::disableNormalmapping" SPC $pref::Video::disableNormalmapping);
    recalcFeaturesFromPrefs();
	reInitMaterials();
	echo("===========0000000000000000======");	
}

Create a gui check box that has the same name with the function