#include "Material.h"

Material::Material(const wchar_t* fileName)
: _fileName(fileName), _diffuseTexture(0), _specularTexture(0), _ambientTexture(0), _normalMap(0)
{
    _diffuse[0]  = 1.0f;    _diffuse[1]  = 1.0f;    _diffuse[2]  =  1.0f;   _diffuse[3]  =  1.0f;
    _specular[0] = 1.0f;    _specular[1] = 1.0f;    _specular[2] =  1.0f;   _specular[3] =  1.0f;
    _ambient[0]  = 1.0f;    _ambient[1]  = 1.0f;    _ambient[2]  =  1.0f;   _ambient[3]  =  1.0f;
}

Material::~Material()
{
}

const wchar_t* Material::getFileName()
{
    if (_fileName.empty())
        return 0;
    else
        return _fileName.c_str();
}

void Material::setFileName(const wchar_t* fileName)
{
    _fileName = fileName;
}

void* Material::getResourceHandle()
{
    return _resourceHandle;
}

void Material::setResourceHandle(void* resourceHandle)
{
    _resourceHandle = resourceHandle;
}

float* Material::getDiffuse()
{
    return &_diffuse[0];
}

float* Material::getSpecular()
{
    return &_specular[0];
}

float* Material::getAmbient()
{
    return &_ambient[0];
}

void Material::setDiffuse(float r, float g, float b, float a)
{
    _diffuse[0] = r; _diffuse[1] = g; _diffuse[2] = b; _diffuse[3] = a;
}

void Material::setSpecular(float r, float g, float b, float a)
{
    _specular[0] = r; _specular[1] = g; _specular[2] = b; _specular[3] = a;
}

void Material::setAmbient(float r, float g, float b, float a)
{
    _ambient[0] = r; _ambient[1] = g; _ambient[2] = b; _ambient[3] = a;
}

Texture** Material::ppGetDiffuseTexture()
{
    return &_diffuseTexture;
}

Texture* Material::getDiffuseTexture()
{
    return _diffuseTexture;
}

void Material::setDiffuseTexture(Texture* texture)
{
    _diffuseTexture = texture;
}

Texture** Material::ppGetSpecularTexture()
{
    return &_specularTexture;
}

Texture* Material::getSpecularTexture()
{
    return _specularTexture;
}

void Material::setSpecularTexture(Texture* texture)
{
    _specularTexture = texture;
}

Texture** Material::ppGetAmbientTexture()
{
    return &_ambientTexture;
}

Texture*  Material::getAmbientTexture()
{
    return _ambientTexture;
}

void Material::setAmbientTexture(Texture* texture)
{
    _ambientTexture = texture;
}

Texture** Material::ppGetNormalMap()
{
    return &_normalMap;
}

Texture* Material::getNormalMap()
{
    return _normalMap;
}

void Material::setNormalMap(Texture* texture)
{
    _normalMap = texture;
}