/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Render - Type.h
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, Andrew Aye.  All Rights Reserved.
    This software is free for non-commercial use.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
      following conditions are met:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution in binary form must reproduce this copyright notice, this list of conditions and the following disclaimers in the documentation and other materials
          provided with the distribution.
    The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
    The intellectual property rights of the algorithms used reside with Andrew Aye.
    You may not use this software, in whole or in part, in support of any commercial product without the express written consent of the author.
    There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
#if !defined(_TGS_RENDER_TYPE_H_)
#pragma once

#if !defined(_TGS_PLATFORM_RENDER_H_)
#error This file should not be included directly - use the correct platform include wrapper

#include "TgS Ring 3 - Type.h"

/* == Render ============================================================================================================================================================ */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Types                                                                                                                                                          */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

    TgVEC_F32_04                                m_vCam_Position; /*« World space position of the camera */
    TgVEC_F32_04                                m_vCam_Target; /*« World space target of the camera */

                                                /* Parameters used to calculate the projection matrix */
    TgFLOAT32                                   m_fAspect_Ratio;
    TgFLOAT32                                   m_fFoV;
    TgFLOAT32                                   m_fNear, m_fFar;

/* ---- Vertex Descriptors ---------------------------------------------------------------------------------------------------------------------------------------------- */

/* Create the vertex data structures */

#define RENDER_VERTEX_LAYOUT(A,B,C,D,E,...)         C __VA_ARGS__;
#define RENDER_VERTEX_LAYOUT_END(A)             };

#include "TgS Render - Type [Vertex].h_inc"


/* ---- Context Parameters ---------------------------------------------------------------------------------------------------------------------------------------------- */

/* Camera Parameter - This is the minimal representation for use by the render module.  It is assumed to be in the current render view as established in the rendering */
/* system (perspective or orthographic). */
    STg2_RN_Camera                              m_sCamera;

                                                /* Reference Frame of the Camera */
    TgVEC_F32_04                                m_vCam_Forward; /*« World space camera forward vector */
    TgVEC_F32_04                                m_vCam_Up; /*« World space camera up vector */
    TgVEC_F32_04                                m_vCam_Right; /*« World space camera right vector */

                                                /* Reference Frame Transformations */
    TgMAT_F32_44                                m_xFrustum_W2C; /*« World to Camera (View) */
    TgMAT_F32_44                                m_xFrustum_C2S; /*« Camera to Screen (Proj) */
    TgMAT_F32_44                                m_xFrustum_W2S; /*« World to Screen */
    TgMAT_F32_44                                m_xFrustum_C2W; /*« Camera to World (Inverse View) */
    TgMAT_F32_44                                m_xFrustum_S2C; /*« Screen to Camera (Inverse Proj) */
    TgMAT_F32_44                                m_xFrustum_S2W; /*« Screen to World */

                                                /* Frustum description */
    TgVEC_F32_04                                m_vFrustum_Planes[ETgFRUSTUM_PLANE__MAX]; /*« Non-Normalized Plane Equations */
    TgVEC_F32_04                                m_vFrustum_Centroid; /*« Centre of the frustum - used for a bounding sphere */
    TgVEC_F32_04                                m_vFrustum_Min, m_vFrustum_Max; /*« Frustum bounds - used for a bounding aabb */
    TgFLOAT32                                   m_fFrustum_Radius_Squared; /*« Centre to bounds - used for bounding sphere */

    TgCHAR                                      m_szName[44];

/* ---- System Data ----------------------------------------------------------------------------------------------------------------------------------------------------- */

    TgSINT32                                    m_iIndex_In_SE_Context; /*« Index of the place holder mesh set in the context */
    TgSINT32                                    m_uiPad0;
    TgRN_MESH_SET_ID                            m_tiMesh_Set; /*« Mesh ID if the particle is a mesh object */
    TgRN_MATERIAL_ID                            m_tiMaterial;
    ETgRN_PRIMITIVE_TYPE                        m_enPrimitive;
    ETgRN_VERTEX                                m_enVertex; /*« Vertex type stored in the buffer section */
    TgSIZE                                      m_nuiVertex; /*« Number of vertices in the buffer section */
    TgSIZE                                      m_uiBuffer_Offset; /*« Offset into the particle buffer */
    TgSIZE                                      m_uiBuffer_Size; /*« Size of the memory block starting at Offset */

    TgUINT32                                    m_uiDebug_Field;
    TgSINT32                                    m_iX, m_iY;
    TgCOLOUR32                                  m_sColour;
    TgSINT32                                    m_iStart_X;

/* ====================================================================================================================================================================== */