//
// Asura_PSP_CharacterRenderer_Internal.h
//
// Created by KJFL - Wednesday, March 03, 2004
//
// Copyright (C) 2004 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __ASURA_PSP_CHARACTERRENDERER_INTERNAL_H__
#define __ASURA_PSP_CHARACTERRENDERER_INTERNAL_H__

#include "Core/Memory/Asura_ResourceAllocator.h"

class Asura_PSP_SmoothSkin_Group
{
	public:
		int			m_iMaterial;
		
		u_int		m_uNumberOfVertices;

		u_int		m_uStartVertex;
	
		u_char		m_aucBoneIDs[4];
};

class Asura_PSP_SmoothSkin_Vertex_Coloured
{
	public:
		
		// order of member determined by PSP GPU
		u_char			m_aucWeight[4];		// 4	4
		u_short			m_usU;				// 2	2
		u_short			m_usV;				// 2	8
		u_int			m_uRGBAColour;		// 4	12
		short			m_asPosition[3];	// 6	18
};

class Asura_PSP_SmoothSkin_Vertex_Normal
{
	public:
		
		// order of member determined by PSP GPU
		u_char			m_aucWeight[4];		// 4	4
		u_short			m_usU;				// 2	2
		u_short			m_usV;				// 2	8
		short			m_asNormal[3];		// 6	14
		short			m_asPosition[3];	// 6	20
};

class Asura_PSP_SmoothSkin
{
	public:
		Asura_PSP_SmoothSkin()
		{
			m_pxGroups		= NULL;
			m_pxVertices	= NULL;
			m_bColoursReplaceNormals = false;
		}
		~Asura_PSP_SmoothSkin()
		{
			Asura_ResourcePushType(ASURA_RESOURCE_SKINNED_MESH);
			{
				Asura_ResourceDeallocateArray(m_pxGroups);
				if (m_bColoursReplaceNormals)
				{
					Asura_ResourceDeallocateArray(m_pxVertices);
				}
				else
				{
					Asura_ResourceDeallocateArray(m_pxVertices);
				}
			}
			Asura_ResourcePopType();
		}

		u_int							m_uNumberOfGroups;
		Asura_PSP_SmoothSkin_Group*		m_pxGroups;

		bool							m_bColoursReplaceNormals;
		size_t							m_xVertexSize;

		u_char*							m_pxVertices;
};

#endif//__ASURA_PSP_CHARACTERRENDERER_INTERNAL_H__
