//
// Asura_PSP_ObjectHierarchyRenderer_Internal.h
//
// Created by KJFL - Thursday, April 08, 2004
//
// Copyright (C) 2004 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __ASURA_PSP_OBJECTHIERARCHYRENDERER_INTERNAL_H__
#define __ASURA_PSP_OBJECTHIERARCHYRENDERER_INTERNAL_H__

#include "Core/Memory/Asura_ResourceAllocator.h"


class Asura_PSP_ObjectHierarchy_Vertex_Normal
{
	public:
		
		// order of member determined by PSP GPU

		float			m_fU;							// 4	4
		float			m_fV;							// 4	8
		float			m_afNormal[3];					// 12	20
		float			m_afPosition[3];				// 12	32
};

class Asura_PSP_ObjectHierarchy_Vertex_Colour
{
	public:
		
		// order of member determined by PSP GPU

		float			m_fU;							// 4	4
		float			m_fV;							// 4	8
		u_int			m_uRGBAColour;					// 4	12
		float			m_afPosition[3];				// 12	24
};

class Asura_PSP_ObjectHierarchy_ShortVertex_Normal
{
	public:
		
		// order of member determined by PSP GPU

		u_short			m_usU;							// 2	2
		u_short			m_usV;							// 2	4
		short			m_asNormal[3];					// 6	10
		short			m_asPosition[3];				// 6	16
};

class Asura_PSP_ObjectHierarchy_ShortVertex_Colour
{
	public:
		
		// order of member determined by PSP GPU

		u_short			m_usU;							// 2	2
		u_short			m_usV;							// 2	4
		u_int			m_uRGBAColour;					// 4	8
		short			m_asPosition[3];				// 6	14
};

class Asura_PSP_ObjectHierarchy_Strip
{
	public:

		int								m_iMaterialIndex;
		u_int							m_uNumberOfTriangles;
		u_int							m_uStartVertex;
		u_int							m_uStartIndex;
	
};

class Asura_PSP_ObjectHierarchy
{
	public:
		Asura_PSP_ObjectHierarchy()
		{
			m_pxHierarchyStrips = 0;
			m_pucVertices = 0;
			m_pusIndices = 0;

			m_uNumberOfStrips = 0;
			m_uTotalNumberOfVertices = 0;
			m_uTotalNumberOfIndices = 0;

			m_bColoursReplaceNormals = false;
			m_bShortVerts = false;
		}

		~Asura_PSP_ObjectHierarchy()
		{
			Asura_ResourcePushType(ASURA_RESOURCE_OBJECT_HIERARCHY_MESH);
			{
				Asura_ResourceDeallocateArray(m_pxHierarchyStrips);
				Asura_ResourceDeallocateArray(m_pucVertices);
				Asura_ResourceDeallocateArray(m_pusIndices);
			}
			Asura_ResourcePopType();
		}

		Asura_PSP_ObjectHierarchy_Strip*		m_pxHierarchyStrips;
		unsigned char*							m_pucVertices;
		u_short*								m_pusIndices;
												
		u_int									m_uNumberOfStrips;
		u_int									m_uTotalNumberOfVertices;
		u_int									m_uTotalNumberOfIndices;

		bool									m_bColoursReplaceNormals;
		bool									m_bShortVerts;

};

#endif//__ASURA_PSP_OBJECTHIERARCHYRENDERER_INTERNAL_H__
