/*********************************************************************

Name:		Raytracer
Author:		Kamil Szatkowski "Netrix" (C)
Website:	http://www.netrix.org.pl/
License:	GNU GPL

*********************************************************************/
#pragma once
#include "NLib/nMath.hpp"
#include "NLib/nDataVector.hpp"

#define ATTRIBUTE_NAME_SIZE 40

struct AttributeInstance
{
	char name[ATTRIBUTE_NAME_SIZE];
	float kd,	// Diffuse coeff. - def. 1.0f
		  ks,	// Specular coeff. - def. 0.0f
		  kts,	// Specular refraction coeff. - def. 0.0f
		  ktd,	// Diffuse refraction coeff. - def. 0.0f
		  ka,	// Fresnel fraction coeff. - def. (Coeffs of reflection/refraction calculated by Fresnel formulas
		  kf;	// Ambient coeff. - def. 1.0f
	// Glossiness
	NIne::NUint32 gs,	// def. 1
				  gm;	// def. 1
	float selfLuminance;	// 
	float ft;				// def. 1.0f
	float eta;				// def. 1.0f
	NIne::NMVector3f color;	
	// val _highlight surface/light
	bool selfLumDir		: 1;	// Positive/Negative
	bool oneSheet		: 1;
	bool reflection		: 1;
	bool indirect		: 1;
	bool mirror			: 1;
	bool shadowcast		: 1;
	bool shadowfall		: 1;
	bool smoothShading	: 1;	// or flat
	// val _HeatType PassivePart
	// val _HeatLam 1.0
};


class Attributes
{
public:
	Attributes();

	bool loadAttributes(const char* szFile);
	void releaseAttributes();

	NIne::NSize_t getAttributesCount() const { return m_aAttributes.GetSize(); }
	const AttributeInstance& getAttributeInstance(NIne::NSize_t uAtrIndex) { return m_aAttributes[uAtrIndex]; }

	operator bool() { return m_bLoaded; }

private:
	bool m_bLoaded;
	NIne::NDataVector<AttributeInstance> m_aAttributes;
};
