//========================================================================
// Drawing macros etc.
//
// AUTHOR:  Gabor Nagy
// DATE:    2024-Oct-21 17:42:33
//
// Copyright (C) 1996-2026 by Gabor Nagy. All rights reserved.
//========================================================================
#ifndef _E3D_PolyGroupDraw_h
#define _E3D_PolyGroupDraw_h

#ifndef _E3D_Draw_h
#include <E3D/GL/Draw.h>
#endif

#ifndef _E3D_GLVertexArrays_h
#include <E3D/GL/VertexArrays.h>
#endif

#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
extern "C" {
#endif


//================================================================
// Create VertexArray for a PolyGroup if necessary
//================================================================
static inline void E3dPolyGroup_GLCheckVertexArray(E3dPolyGroup* PPolyGroup,  const E3dVertex* PVertices, const EIndex PNVertices, const E3dVertexSize PVertexSize)
{
	E3dPolyGroupGPUData*  LGPUData = &PPolyGroup->GPUData;
	if(LGPUData->VertexArray.Count < 1)
	{
//printf("%s() %s:%d  <<%s>>\n", __FUNCTION__, __FILE__, __LINE__, PPolyGroup->Name);fflush(stdout);
		E3dPolyGroup_GLCreateVertexArray(PPolyGroup,  PVertices,  PNVertices, PVertexSize);
	}
}


extern void  E3dPolyGroup_GLDrawConstSolid(E3dVertexGeometry* PVertexGeometry, E3dPolyGroup* PPolyGroup,  E3dGPUContext* PGPUContext, const EcRGBAf32Color* PColor);
extern void  E3dPolyGroup_GLDrawConstSolidTextured(E3dScene* PScene, const E3dModel* PModel, E3dVertexGeometry* PVertexGeometry, E3dPolyGroup* PPolyGroup,  E3dGPUContext* PGPUContext, const EBool PTransparencyOn);


#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
} // Close scope of 'extern "C"'
#endif

#endif	// _E3D_PolyGroupDraw_h
