                            Ishiiruka Texture Encoder
   -----------------------------------------------------------------------------

	Copyright (c) 2016 Rodolfo Bogado        rodolfoosvaldobogado@gmail.com

	Permission is hereby granted, free of charge, to any person obtaining
	a copy of this software and associated documentation files (the 
	"Software"), to	deal in the Software without restriction, including
	without limitation the rights to use, copy, modify, merge, publish,
	distribute, sublicense, and/or sell copies of the Software, and to 
	permit persons to whom the Software is furnished to do so, subject to 
	the following conditions:

	The above copyright notice and this permission notice shall be included
	in all copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
	OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
	MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
	IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
	CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
	TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
	SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
	
   -------------------------------------------------------------------------- 



Since Ishiiiruka 436 support for normal mapping and phong lighting has been added.
To Support this additional textures are required:

    Depth Texture: deviation distance from the plane.
    Values greater than 127 (byte) are above the surface.
    -Name = <TextureID>.bump.extension
    Normal Texture: normal map. Optional, 
    if not present will be calculated from the bump texture.
    -Name = <TextureID>.nrm.extension
    Specular Texture : maps how polished is the surface of the material. 
    A black (0) Texture will give as a result a opaque paper like material. 
    White (255) will give a polished metallic like surface.
    -Name = <TextureID>.spec.extension


But adding all this textures will take a huge hit in memory usage 
so I pack them in a single texture with the following format:

    Red Channel: Specular data 0-255 0=opaque 255=fully reflective specular exponent 64
    Green Channel: Normal Y component unsigned (reduced from [-1.0 1.0] to [0.0 1.0])
    Blue Channel: Bump map depth (reduced from [-1.0 1.0] to [0.0 1.0])
    Alpha Channel: Normal X component unsigned (reduced from [-1.0 1.0] to [0.0 1.0])


This file has the .mat sufix, ans also the.nrm suffix to make them compatible with old versions.

This tool will read all the required textures from the source folder 
(including color textures that are required to test for size, format compatibility)
and the output color/material texture will be stored with the same 
folder structure inside the destination folder.
Please don't set source and destination to the same folder
or your original textures will be destroyed.
The tool is still an early beta so error reports and feature request are welcome.
As a Plus the tool will automatically generate mips for textures that don't have them, 
and you even have the ability to output compressed textures.

Command Line Options

You ca also use this tool from the comman line for single file proccessing.
the parameters are really simple:
TextureEncoder.exe "source file" "destination folder" [-nomipmaps | -compress | -usebc7 | -w | -h | -frommaterial | -savecolor]
-nomipmaps: disable mipmap generation
-compress: compress to dds file, files will be resizes for maximun compatibility if the size is not a multiple of 4
-frommaterial: transform an existing material file
-savecolor: forces the generation of the color file
-usebc7: use bc7 compresion format, this format is not supported under dx9
-w?: The image will be resized if necessary, if nor -h is specified the height will be calculate to match the original texture aspect ratio.
-h?: The same as -w.



