//-------------------------------------------------
// IAttributes wrapper
//-------------------------------------------------

extern "C"
{
	//! Removes all attributes
	void Irr_IAttributes_clear(IAttributes* att)
	{
		if (att)
			att->clear();	
	}

	/*

		Integer Attribute

	*/

	//! Adds an attribute as integer
	void Irr_IAttributes_addInt(IAttributes* att,const c8* attributeName, s32 value)
	{
		if (att)
			att->addInt(attributeName,value);		
	}

	//! Sets an attribute as integer value
	void Irr_IAttributes_setIntAttributeByName(IAttributes* att,const c8* attributeName, s32 value)
	{
		if (att)
			att->setAttribute(attributeName,value);
	}

	//! Gets an attribute as integer value
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	s32 Irr_IAttributes_getAttributeAsIntByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return att->getAttributeAsInt(attributeName);
		return -99999;
	}

	//! Gets an attribute as integer value
	//! \param index: Index value, must be between 0 and getAttributeCount()-1
	s32 Irr_IAttributes_getAttributeAsIntByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return att->getAttributeAsInt(index);
		else return -99999;
	}

	//! Sets an attribute as integer value
	void Irr_IAttributes_setIntAttributeByIndex(IAttributes* att,s32 index, s32 value)
	{
		if (att)
			att->setAttribute(index,value);		
	}

	/*

		Float Attribute

	*/

	//! Adds an attribute as float
	void Irr_IAttributes_addFloat(IAttributes* att,const c8* attributeName, f32 value)
	{
		if (att)
			att->addFloat(attributeName,value);		
	}

	//! Sets a attribute as float value
	void Irr_IAttributes_setFloatAttributeByName(IAttributes* att,const c8* attributeName, f32 value)
	{
		if (att)
			att->setAttribute(attributeName,value);
	}

	//! Gets an attribute as float value
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	f32 Irr_IAttributes_getAttributeAsFloatByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return att->getAttributeAsFloat(attributeName);
		else return -99999.0f;
	}

	//! Gets an attribute as float value
	//! \param index: Index value, must be between 0 and getAttributeCount()-1
	f32 Irr_IAttributes_getAttributeAsFloatByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return att->getAttributeAsFloat(index);
		else return -99999.0f;
	}

	//! Sets an attribute as float value
	void Irr_IAttributes_setFloatAttributeByIndex(IAttributes* att,s32 index, f32 value)
	{
		if (att)
			att->setAttribute(index,value);		
	}

	/*

		String Attribute

	*/

	//! Adds an attribute as string
	void Irr_IAttributes_addString(IAttributes* att,const c8* attributeName, const char* value)
	{
		if (att)
			att->addString(attributeName,value);
	}

	//! Sets an attribute value as string. 
	//! \param attributeName: Name for the attribute
	//! \param value: Value for the attribute. Set this to 0 to delete the attribute
	void Irr_IAttributes_setStringAttributeByName(IAttributes* att,const c8* attributeName, const c8* value)
	{
		if (att)
			att->setAttribute(attributeName,value);
	}

	//! Gets an attribute as string.
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute() 
	//! or 0 if attribute is not set.
	const c8* Irr_IAttributes_getAttributeAsStringByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return att->getAttributeAsString(attributeName).c_str();		
		else return 0;
	}

	//! Returns attribute value as string by index. 
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	const c8* Irr_IAttributes_getAttributeAsStringByIndex(IAttributes* att,s32 index)	
	{
		if (att)
			return att->getAttributeAsString(index).c_str();
		else return 0;
	}

	//! Sets an attribute value as string. 
	//! \param attributeName: Name for the attribute
	void Irr_IAttributes_setStringAttributeByIndex(IAttributes* att,s32 index, const c8* value)
	{
		if (att)
			att->setAttribute(index,value);
	}

	/*

		Binary Data Attribute

	*/

	//! Adds an attribute as binary data
	void Irr_IAttributes_addBinary(IAttributes* att,const c8* attributeName, void* data, s32 dataSizeInBytes)
	{
		if (att)
			att->addBinary(attributeName,data,dataSizeInBytes);
	}

	//! Sets an attribute as binary data
	void Irr_IAttributes_setBinaryAttributeByName(IAttributes* att,const c8* attributeName, void* data, s32 dataSizeInBytes )
	{
		if (att)
			att->setAttribute(attributeName,data,dataSizeInBytes);
	}

	//! Gets an attribute as binary data
	//! \param attributeName: Name of the attribute to get.
	void Irr_IAttributes_getAttributeAsBinaryDataByName(IAttributes* att,const c8* attributeName, void* outData, s32 maxSizeInBytes)
	{
		if (att)
			att->getAttributeAsBinaryData(attributeName,outData,maxSizeInBytes);
	}

	//! Gets an attribute as binary data
	//! \param index: Index value, must be between 0 and getAttributeCount()-1
	void Irr_IAttributes_getAttributeAsBinaryDataByIndex(IAttributes* att,s32 index, void* outData, s32 maxSizeInBytes)
	{
		if (att)
			att->getAttributeAsBinaryData(index,outData,maxSizeInBytes);		
	}

	//! Sets an attribute as binary data
	void Irr_IAttributes_setBinaryAttributeByIndex(IAttributes* att,s32 index, void* data, s32 dataSizeInBytes )
	{
		if (att)
			att->setAttribute(index,data,dataSizeInBytes);
	}

	/*

		Bool Attribute

	*/

	//! Adds an attribute as bool
	void Irr_IAttributes_addBool(IAttributes* att,const c8* attributeName, bool value)
	{
		if (att)
			att->addBool(attributeName,value);		
	}

	//! Sets an attribute as boolean value
	void Irr_IAttributes_setBoolAttributeByName(IAttributes* att,const c8* attributeName, bool value)
	{
		if (att)
			att->setAttribute(attributeName,value);
	}

	//! Gets an attribute as boolean value
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	bool Irr_IAttributes_getAttributeAsBoolByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return att->getAttributeAsBool(attributeName);
		else return false;
	}

    //! Gets an attribute as boolean value
	//! \param index: Index value, must be between 0 and getAttributeCount()-1
	bool Irr_IAttributes_getAttributeAsBoolByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return att->getAttributeAsBool(index);
		else return false;
	}


	//! Sets an attribute as boolean value
	void Irr_IAttributes_setBoolAttributeByIndex(IAttributes* att,s32 index, bool value)
	{
		if (att)
			att->setAttribute(index,value);
	}

	/*

		Enumeration Attribute

	*/

	//! Adds an attribute as enum
	void Irr_IAttributes_addStringEnum(IAttributes* att,const c8* attributeName, const char* enumValue, const char* const* enumerationLiterals)
	{
		if (att)
			att->addEnum(attributeName,enumValue,enumerationLiterals);
	}

	//! Adds an attribute as enum
	void Irr_IAttributes_addIntEnum(IAttributes* att,const c8* attributeName, s32 enumValue, const char* const* enumerationLiterals)
	{
		if (att)
			att->addEnum(attributeName,enumValue,enumerationLiterals);
	}

	//! Sets an attribute as enumeration
	void Irr_IAttributes_setEnumAttributeByName(IAttributes* att,const c8* attributeName, const char* enumValue, const char* const* enumerationLiterals)
	{
		if (att)
			att->setAttribute(attributeName,enumValue,enumerationLiterals);
	}

	//! Sets an attribute as enumeration
	void Irr_IAttributes_setEnumAttributeByIndex(IAttributes* att,s32 index, const char* enumValue, const char* const* enumerationLiterals)
	{
		if (att)
			att->setAttribute(index,enumValue,enumerationLiterals);
	}

	//! Gets an attribute as enumeration
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	const char* Irr_IAttributes_getAttributeAsStringEnumerationByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return att->getAttributeAsEnumeration(attributeName);
		else return 0;
	}

	//! Gets an attribute as enumeration
	//! \param attributeName: Name of the attribute to get.
	//! \param enumerationLiteralsToUse: Use these enumeration literals to get the index value instead of the set ones.
	//! This is useful when the attribute list maybe was read from an xml file, and only contains the enumeration string, but
	//! no information about its index.
	//! \return Returns value of the attribute previously set by setAttribute()
	s32 Irr_IAttributes_getAttributeAsIntEnumerationByName(IAttributes* att,const c8* attributeName, const char* const* enumerationLiteralsToUse)
	{
		if (att)
			return att->getAttributeAsEnumeration(attributeName,enumerationLiteralsToUse);
		else return -1;		
	}

	//! Gets an attribute as enumeration
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	s32 Irr_IAttributes_getAttributeAsIntEnumerationByIndex(IAttributes* att,s32 index, const char* const* enumerationLiteralsToUse)
	{
		if (att)
			return att->getAttributeAsEnumeration(index,enumerationLiteralsToUse);
		else return -1;				
	}

	//! Gets an attribute as enumeration
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	const char* Irr_IAttributes_getAttributeAsStringEnumerationByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return att->getAttributeAsEnumeration(index);
		else return 0;		
	}

	//! Gets the list of enumeration literals of an enumeration attribute 
	//! \param attributeName: Name of the attribute to get.
	void Irr_IAttributes_getAttributeEnumerationLiteralsOfEnumerationByName(IAttributes* att,const c8* attributeName, core::array<core::stringc>& outLiterals)
	{
		if (att)
			att->getAttributeEnumerationLiteralsOfEnumeration(attributeName,outLiterals);
	}

	//! Gets the list of enumeration literals of an enumeration attribute 
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	int Irr_IAttributes_getAttributeEnumerationLiteralsOfEnumerationByIndex(IAttributes* att,s32 index, stringc** outLiterals)
	{
		if (att) {
			core::array<core::stringc> out;
			att->getAttributeEnumerationLiteralsOfEnumeration(index,out);		
			int size=out.size();
		
			for (int i=0; i<size; i++) {
				*outLiterals[i]=out[i];
			}
			return size;
		} else return 0;
	}

	/*

		SColor Attribute

	*/

	//! Adds an attribute as color
	void Irr_IAttributes_addColor(IAttributes* att,const c8* attributeName, video::SColor* value)
	{
		if (att)
			att->addColor(attributeName,*value);
	}

	//! Sets a attribute as color
	void Irr_IAttributes_setColorAttributeByName(IAttributes* att,const c8* attributeName, video::SColor* color)
	{
		if (att)
			att->setAttribute(attributeName,*color);
	}

	//! Gets an attribute as color
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	// NOTE: must delete ptr
	SColor* Irr_IAttributes_getAttributeAsColorByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new SColor(att->getAttributeAsColor(attributeName));
		else return 0;		
	}

	//! Gets an attribute as color
	//! \param index: Index value, must be between 0 and getAttributeCount()-1
	// NOTE: must delete ptr
	SColor* Irr_IAttributes_getAttributeAsColorByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new SColor(att->getAttributeAsColor(index));
		else return 0;				
	}

	//! Sets an attribute as color
	void Irr_IAttributes_setColorAttributeByIndex(IAttributes* att,s32 index, video::SColor* color)
	{
		if (att)
			att->setAttribute(index,*color);			
	}

	/*

		SColorf Attribute

	*/

	//! Adds an attribute as floating point color
	void Irr_IAttributes_addColorf(IAttributes* att,const c8* attributeName, video::SColorf* value)
	{
		if (att)
			att->addColorf(attributeName,*value);		
	}

	//! Sets a attribute as floating point color
	void Irr_IAttributes_setSColorfAttributeByName(IAttributes* att,const c8* attributeName, video::SColorf* color)
	{
		if (att)
			att->setAttribute(attributeName,*color);
	}

	//! Gets an attribute as floating point color
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	// NOTE: must delete ptr
	SColorf* Irr_IAttributes_getAttributeAsColorfByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new SColorf(att->getAttributeAsColor(attributeName));
		else return 0;						
	}

	//! Gets an attribute as floating point color
	//! \param index: Index value, must be between 0 and getAttributeCount()-1
	// NOTE: must delete ptr
	SColorf* Irr_IAttributes_getAttributeAsColorfByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new SColorf(att->getAttributeAsColorf(index));
		else return 0;						
	}

	//! Sets an attribute as floating point color
	void Irr_IAttributes_setColorfAttributeByIndex(IAttributes* att,s32 index, video::SColorf* color)
	{
		if (att)
			att->setAttribute(index,*color);			
	}

	/*

		Vector3d Attribute

	*/

	//! Adds an attribute as 3d vector
	void Irr_IAttributes_addVector3df(IAttributes* att,const c8* attributeName, core::vector3df* value)
	{
		if (att)
			att->addVector3d(attributeName,*value);
	}

	//! Sets a attribute as vector
	void Irr_IAttributes_setVector3dfAttributeByName(IAttributes* att,const c8* attributeName, core::vector3df* v)
	{
		if (att)
			att->setAttribute(attributeName,*v);
	}

	//! Gets an attribute as floating point color
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	vector3df* Irr_IAttributes_getAttributeAsVector3dfByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new vector3df(att->getAttributeAsVector3d(attributeName));
		else return 0;
	}

	//! Gets an attribute as floating point color
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	vector3df* Irr_IAttributes_getAttributeAsVector3dfByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new vector3df(att->getAttributeAsVector3d(index));
		else return 0;		
	}

	//! Sets an attribute as vector
	void Irr_IAttributes_setVector3dfAttributeByIndex(IAttributes* att,s32 index, core::vector3df* v)
	{
		if (att)
			att->setAttribute(index,*v);			
	}

	/*

		Position2d Attribute

	*/

	//! Adds an attribute as position
	void Irr_IAttributes_addPosition2di(IAttributes* att,const c8* attributeName, core::position2di* value)
	{
		if (att)
			att->addPosition2d(attributeName,*value);
	}

	//! Sets a attribute as position
	void Irr_IAttributes_setPosition2diAttributeByName(IAttributes* att,const c8* attributeName, core::position2di* v)
	{
		if (att)
			att->setAttribute(attributeName,*v);
	}

	position2di* Irr_IAttributes_getAttributeAsPosition2diByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new position2di(att->getAttributeAsPosition2d(attributeName));
		else return 0;
	}

	//! Gets an attribute as position2di
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	position2di* Irr_IAttributes_getAttributeAsPosition2diByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new position2di(att->getAttributeAsPosition2d(index));
		else return 0;		
	}


	/*

		Array Attribute

	*/


	void Irr_IAttributes_addArray(IAttributes* att, const c8* attributeName, const c8** values, u32 values_count) 
	{
		if (att) {
			array<stringw> w_values(values_count);
			
			for (int i=0; i<values_count; i++) {	
				w_values[i] = values[i];
			}				
			
			att->addArray(attributeName, w_values);
		}
	}

	void Irr_IAttributes_setArrayAttributeByName(IAttributes* att, const c8* attributeName, const c8** values, u32 values_count) 
	{
		if (att) {
			array<stringw> w_values(values_count);
			
			for (int i=0; i<values_count; i++) {	
				w_values[i] = values[i];
			}				
			
			att->setAttribute(attributeName, w_values);
		}	
	}

	s32 Irr_IAttributes_getAttributeAsArray(IAttributes* att, const c8* attributeName, u32** values)
	{
		if (att) {
			
			array<const wchar_t*> to_convert;
			array<stringw> att_array = att->getAttributeAsArray(attributeName);
			
			for (int i=0; i<att_array.size(); i++) {
				to_convert.push_back(att_array[i].c_str());
			}
			*values = (u32*)to_convert.pointer();
			
			return to_convert.size();
		} else return 0;
	}

	s32 Irr_IAttributes_getAttributeAsArrayByIndex(IAttributes* att, s32 index, u32** values)
	{
		if (att) {
			
			array<const wchar_t*> to_convert;
			array<stringw> att_array = att->getAttributeAsArray(index);
			
			for (int i=0; i<att_array.size(); i++) {
				to_convert.push_back(att_array[i].c_str());
			}
			*values = (u32*)to_convert.pointer();
			
			return to_convert.size();
		} else return 0;
	}
	
	void Irr_IAttributes_setArrayAttributeByIndex(IAttributes* att, s32 index, const c8** values, u32 values_count) 
	{
		if (att) {
			array<stringw> w_values(values_count);
			
			for (int i=0; i<values_count; i++) {	
				w_values[i] = values[i];
			}				
			
			att->setAttribute(index, w_values);
		}		
	}

	/*

		Rectangle Attribute

	*/

	//! Adds an attribute as rectangle
	void Irr_IAttributes_addRect(IAttributes* att,const c8* attributeName, core::rect<s32>* value)
	{
		if (att)
			att->addRect(attributeName,*value);
	}

	//! Sets an attribute as rectangle
	void Irr_IAttributes_setRect3diAttributeByName(IAttributes* att,const c8* attributeName, core::rect<s32>* v)
	{
		if (att)
			att->setAttribute(attributeName,*v);
	}

	//! Gets an attribute as rectangle
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	core::rect<s32>* Irr_IAttributes_getAttributeAsRect(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new rect<s32>(att->getAttributeAsRect(attributeName));
		else return 0;
	}

	//! Gets an attribute as rectangle
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	core::rect<s32>* Irr_IAttributes_getAttributeAsRectByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new rect<s32>(att->getAttributeAsRect(index));
		else return 0;
	}

	//! Sets an attribute as rectangle
	void Irr_IAttributes_setRect3diAttributeByIndex(IAttributes* att,s32 index, core::rect<s32>* v)
	{
		if (att)
			att->setAttribute(index,*v);
	}

	/*

		matrix attribute

	*/ 

	//! Adds an attribute as matrix
	void Irr_IAttributes_addMatrix(IAttributes* att,const c8* attributeName, core::matrix4* v)
	{
		if (att)
			att->addMatrix(attributeName,*v);
	}

	//! Sets an attribute as matrix
	void Irr_IAttributes_setMatrixAttributeByName(IAttributes* att,const c8* attributeName, core::matrix4* v)
	{
		if (att)
			att->setAttribute(attributeName,*v);
	}

	//! Gets an attribute as a matrix4
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	core::matrix4* Irr_IAttributes_getAttributeAsMatrixByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new matrix4(att->getAttributeAsMatrix(attributeName));
		else return 0;
	}

	//! Gets an attribute as matrix
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	core::matrix4* Irr_IAttributes_getAttributeAsMatrixByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new matrix4(att->getAttributeAsMatrix(index));
		else return 0;
	}

	//! Sets an attribute as matrix
	void Irr_IAttributes_setMatrixAttributeByIndex(IAttributes* att,s32 index, core::matrix4* v)
	{
		if (att)
			att->setAttribute(index,*v);
	}

	/*
		quaternion attribute

	*/

	//! Adds an attribute as quaternion
	void Irr_IAttributes_addQuaternion(IAttributes* att,const c8* attributeName, core::quaternion* v)
	{
		if (att)
			att->addQuaternion(attributeName,*v);
	}

	//! Sets an attribute as quaternion
	void Irr_IAttributes_setQuaternionAttributeByName(IAttributes* att,const c8* attributeName, core::quaternion* v)
	{
		if (att)
			att->setAttribute(attributeName,*v);
	}

	//! Gets an attribute as a quaternion
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	core::quaternion* Irr_IAttributes_getAttributeAsQuaternionByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new quaternion(att->getAttributeAsQuaternion(attributeName));
		else return 0;
	}

	//! Gets an attribute as quaternion
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	core::quaternion* Irr_IAttributes_getAttributeAsQuaternionByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new quaternion(att->getAttributeAsQuaternion(index));
		else return 0;
	}

	//! Sets an attribute as quaternion
	void Irr_IAttributes_setQuaternionAttributeByIndex(IAttributes* att,s32 index, core::quaternion* v)
	{
		if (att)
			att->setAttribute(index,*v);			
	}

	/*

		3d bounding box

	*/

	//! Adds an attribute as axis aligned bounding box
	void Irr_IAttributes_addBox3d(IAttributes* att,const c8* attributeName, core::aabbox3df* v)
	{
		if (att)
			att->addBox3d(attributeName,*v);
	}

	//! Sets an attribute as axis aligned bounding box
	void Irr_IAttributes_setAABbox3dfAttributeByName(IAttributes* att,const c8* attributeName, core::aabbox3df* v)
	{
		if (att)
			att->setAttribute(attributeName,*v);
	}

	//! Gets an attribute as a axis aligned bounding box
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	core::aabbox3df* Irr_IAttributes_getAttributeAsBox3dByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new aabbox3df(att->getAttributeAsBox3d(attributeName));
		else return 0;
	}

	//! Gets an attribute as axis aligned bounding box
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	core::aabbox3df* Irr_IAttributes_getAttributeAsBox3dByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new aabbox3df(att->getAttributeAsBox3d(index));
		else return 0;
	}

	//! Sets an attribute as axis aligned bounding box
	void Irr_IAttributes_setAABbox3dfAttributeByIndex(IAttributes* att,s32 index, core::aabbox3df* v)
	{
		if (att)
			att->setAttribute(index,*v);
	}

	/*

		plane

	*/

	//! Adds an attribute as 3d plane
	void Irr_IAttributes_addPlane3d(IAttributes* att,const c8* attributeName, core::plane3df* v)
	{
		if (att)
			att->addPlane3d(attributeName,*v);
	}

	//! Sets an attribute as 3d plane
	void Irr_IAttributes_setPlane3dfAttributeByName(IAttributes* att,const c8* attributeName, core::plane3df* v)
	{
		if (att)
			att->setAttribute(attributeName,*v);
	}

	//! Gets an attribute as a 3d plane
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	core::plane3df* Irr_IAttributes_getAttributeAsPlane3dByName(IAttributes* att,const c8* attributeName) 
	{
		if (att)
			return new plane3df(att->getAttributeAsPlane3d(attributeName));
		else return 0;
	}

	//! Gets an attribute as 3d plane
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	core::plane3df* Irr_IAttributes_getAttributeAsPlane3dByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new plane3df(att->getAttributeAsPlane3d(index));
		else return 0;
	}

	//! Sets an attribute as 3d plane
	void Irr_IAttributes_setPlane3dfAttributeByIndex(IAttributes* att,s32 index, core::plane3df* v)
	{
		if (att)
			att->setAttribute(index,*v);
	}

	/*

		3d triangle

	*/

	//! Adds an attribute as 3d triangle
	void Irr_IAttributes_addTriangle3d(IAttributes* att,const c8* attributeName, core::triangle3df* v)
	{
		if (att)
			att->addTriangle3d(attributeName,*v);
	}
	
	//! Sets an attribute as 3d trianle
	void Irr_IAttributes_setTriangle3dfAttributeByName(IAttributes* att,const c8* attributeName, core::triangle3df* v)
	{
		if (att)
			att->setAttribute(attributeName,*v);
	}

	//! Gets an attribute as a 3d triangle
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	core::triangle3df* Irr_IAttributes_getAttributeAsTriangle3dByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new triangle3df(att->getAttributeAsTriangle3d(attributeName));
		else return 0;
	}

	//! Gets an attribute as 3d triangle
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	core::triangle3df* Irr_IAttributes_getAttributeAsTriangle3dByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new triangle3df(att->getAttributeAsTriangle3d(index));
		else return 0;
	}

	//! Sets an attribute as 3d triangle
	void Irr_IAttributes_setTriangle3dfAttributeByIndex(IAttributes* att,s32 index, core::triangle3df* v)
	{
		if (att)
			att->setAttribute(index,*v);
	}


	/*

		line 2d

	*/

	//! Adds an attribute as a 2d line
	void Irr_IAttributes_addLine2d(IAttributes* att,const c8* attributeName, core::line2df* v)
	{
		if (att)
			att->addLine2d(attributeName,*v);
	}

	//! Sets an attribute as a 2d line
	void Irr_IAttributes_setLine2dfAttributeByName(IAttributes* att,const c8* attributeName, core::line2df* v)
	{
		if (att)
			att->setAttribute(attributeName,*v);
	}

	//! Gets an attribute as a 2d line
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	core::line2df* Irr_IAttributes_getAttributeAsLine2dByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new line2df(att->getAttributeAsLine2d(attributeName));
		else return 0;
	}

	//! Gets an attribute as a 2d line
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	core::line2df* Irr_IAttributes_getAttributeAsLine2dByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new line2df(att->getAttributeAsLine2d(index));
		else return 0;
	}
	
	//! Sets an attribute as a 2d line
	void Irr_IAttributes_setLine2dfAttributeByIndex(IAttributes* att,s32 index, core::line2df* v)
	{
		if (att)
			att->setAttribute(index,*v);
	}

	/*

		line 3d

	*/

	//! Adds an attribute as a 3d line
	void Irr_IAttributes_addLine3d(IAttributes* att,const c8* attributeName, core::line3df* v) 
	{
		if (att)
			att->addLine3d(attributeName,*v);
	}

	//! Sets an attribute as a 3d line
	void Irr_IAttributes_setLine3dfAttributeByName(IAttributes* att,const c8* attributeName, core::line3df* v)
	{
		if (att)
			att->setAttribute(attributeName,*v);
	}

	//! Gets an attribute as a 3d line
	//! \param attributeName: Name of the attribute to get.
	//! \return Returns value of the attribute previously set by setAttribute()
	core::line3df* Irr_IAttributes_getAttributeAsLine3dByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return new line3df(att->getAttributeAsLine3d(attributeName));
		else return 0;
	}

	//! Gets an attribute as a 3d line
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	core::line3df* Irr_IAttributes_getAttributeAsLine3dByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return new line3df(att->getAttributeAsLine3d(index));
		else return 0;
	}

	//! Sets an attribute as a 3d line
	void Irr_IAttributes_setLin3dfAttributeByIndex(IAttributes* att,s32 index, core::line3df* v)
	{
		if (att)
			att->setAttribute(index,*v);
	}
	
	/*

		Texture Attribute

	*/

	
	//! Adds an attribute as texture reference
	void Irr_IAttributes_addTexture(IAttributes* att,const c8* attributeName, video::ITexture* texture)
	{
		if (att)
			att->addTexture(attributeName,texture);		
	}

	//! Sets an attribute as texture reference
	void Irr_IAttributes_setTextureAttributeByName(IAttributes* att,const c8* attributeName, video::ITexture* texture )
	{
		if (att)
			att->setAttribute(attributeName,texture);
	}

	//! Gets an attribute as texture reference
	//! \param attributeName: Name of the attribute to get.
	// NOTE: need to delete
	ITexture* Irr_IAttributes_getAttributeAsTextureByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return att->getAttributeAsTexture(attributeName);
	}

	//! Gets an attribute as texture reference
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	// NOTE: need to delete
	ITexture* Irr_IAttributes_getAttributeAsTextureByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return att->getAttributeAsTexture(index);
	}

	//! Sets an attribute as texture reference
	void Irr_IAttributes_setTextureAttributeByIndex(IAttributes* att,s32 index, video::ITexture* texture)
	{
		if (att)
			att->setAttribute(index,texture);			
	}

// ----------------------------------------------------------

	//! Returns amount of attributes in this collection of attributes.
	u32 Irr_IAttributes_getAttributeCount(IAttributes* att)
	{
		if (att)
			return att->getAttributeCount();
		else return -1;
	}

	//! Returns attribute name by index. 
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	const c8* Irr_IAttributes_getAttributeName(IAttributes* att,s32 index)
	{
		if (att)
			return att->getAttributeName(index);
		else return 0;
	}

	//! Returns the type of an attribute
	//! \param attributeName: Name for the attribute
	s32 Irr_IAttributes_getAttributeTypeByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return (s32)att->getAttributeType(attributeName);
		else return -1;
	}

	//! Returns attribute type by index. 
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	s32 Irr_IAttributes_getAttributeTypeByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return (s32)att->getAttributeType(index);
		else return -1;
	}

	//! Returns if an attribute with a name exists
	bool Irr_IAttributes_existsAttribute(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return att->existsAttribute(attributeName);
		else return false;
	}

	//! Returns attribute index from name, -1 if not found
	s32 Irr_IAttributes_findAttribute(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return att->findAttribute(attributeName);
		else return -1;
		
	}

	//! Reads attributes from a xml file.
	//! \param readCurrentElementOnly: If set to true, reading only works if current element has the name 'attributes'.
	//! IF set to false, the first appearing list attributes are read.
	bool Irr_IAttributes_read(IAttributes* att,irr::io::IXMLReader* reader, bool readCurrentElementOnly=false,  const wchar_t* elementName=0)
	{
		if (att)
			return att->read(reader, readCurrentElementOnly, elementName);
		else return false;
	}

	//! Write these attributes into a xml file
	bool Irr_IAttributes_write(IAttributes* att,io::IXMLWriter* writer, bool writeXMLHeader=false, const wchar_t* elementName=0)
	{
		if (att)
			return att->write(writer, writeXMLHeader, elementName);
		else return false;
	}
	
	bool Irr_IAttributes_drop(IAttributes* unk)
	{
		if (unk)
			return unk->drop();
		else return 0;
	}
	
	const c8* Irr_IAttributes_getDebugName(IAttributes* unk)
	{
		if (unk)
			return unk->getDebugName();
		else return "";
	}
	
	void Irr_IAttributes_grab(IAttributes* unk)
	{
		if (unk)
			unk->grab();
	}

	/*

		User Pointer Attribute

	*/

	//! Adds an attribute as user pointner
	void Irr_IAttributes_addUserPointer(IAttributes* att,const c8* attributeName, void* userPointer)
	{
		if (att)
			att->addUserPointer(attributeName,userPointer);
	}

	//! Sets an attribute as user pointer
	void Irr_IAttributes_setUserPointerAttributeByName(IAttributes* att,const c8* attributeName, void* userPointer)
	{
		if (att)
			att->setAttribute(attributeName,userPointer);
	}

	//! Gets an attribute as user pointer
	//! \param attributeName: Name of the attribute to get.
	void* Irr_IAttributes_getAttributeAsUserPointerByName(IAttributes* att,const c8* attributeName)
	{
		if (att)
			return att->getAttributeAsUserPointer(attributeName);
		else return 0;
	}

	//! Gets an attribute as user pointer
	//! \param index: Index value, must be between 0 and getAttributeCount()-1.
	void* Irr_IAttributes_getAttributeAsUserPointerByIndex(IAttributes* att,s32 index)
	{
		if (att)
			return att->getAttributeAsUserPointer(index);
		else return 0;
	}

	//! Sets an attribute as user pointer
	void Irr_IAttributes_setUserPointerAttributeByIndex(IAttributes* att,s32 index, void* userPointer)
	{
		if (att)
			att->setAttribute(index,userPointer);
	}
	
}



