@ECHO OFF

cd .. 

REM ## DETERMINE LOCATION OF DX SHADER COMPILER

if exist "C:\Program Files (x86)\Microsoft DirectX SDK (August 2008)" (

	SET COMPILER="C:\Program Files (x86)\Microsoft DirectX SDK (August 2008)\Utilities\bin\x64\fxc.exe"

) else (


	if exist "C:\Program Files\Microsoft DirectX SDK (August 2008)" (

		SET COMPILER="C:\Program Files\Microsoft DirectX SDK (August 2008)\Utilities\bin\x86\fxc.exe"		
		
	) else (

		ECHO "August 2008 DirectX SDK must be installed, and installed to default Program Files directory"
		PAUSE
		EXIT 1
	
	)

)


if exist Shaders (

cd Shaders

ECHO .
ECHO .
ECHO ######## COMPILING ALL VERTEX SHADERS
ECHO .
ECHO .

FOR %%f IN ("*.vsh") DO %COMPILER% /T vs_2_0 /E main /O3 /Fo %%f.bin /nologo %%f

ECHO .
ECHO .
ECHO ######## COMPILING ALL PIXEL SHADERS
ECHO .
ECHO .

FOR %%f IN ("*.psh") DO %COMPILER% /T ps_2_0 /E main /O3 /Fo %%f.bin /nologo %%f

ECHO .
ECHO .

) else (

ECHO MISSING SHADERS FOLDER !

)

pause