//	GGVR_GPU_Definitions.h
//
//	© 2026 by Jeff Weeks
//	See TermsOfUse.txt

#ifndef GGVR_GPU_Definitions_h
#define GGVR_GPU_Definitions_h

#include <simd/simd.h>

typedef struct
{
	//	In Curved-Space Pool Hall,
	//		the "game space" is the table space.
	//
	//	In Curved Spaces VR,
	//		the "game space" is the space of the central fundamental cell,
	//		which is centered at the point where the player's head
	//		was when they opened the manifold.

	//	For unmodified curved-space rendering, it would be enough
	//	to know the gameSpaceToEyeSpace matrix for each eye.
	//	But if we want to apply the azimuthalEquidistantMap()
	//	we need to know the gameSpaceToBridgeOfNoseSpace and
	//	bridgeOfNoseSpaceToClipSpace matrices separately.
	
	simd_float4x4	gameSpaceToBridgeOfNoseSpace;		//	the "view matrix"

	//	bridgeOfNoseSpaceToClipSpace maps the bridge-of-nose space
	//	to eye space and then applies the appropriate projection matrices.
	simd_float4x4	bridgeOfNoseSpaceToClipSpace[2];	//	the "projection matrices"

} GGVRViewProjection;


// MARK: -
// MARK: Euclidean headset-based messages

enum
{
	MessageVertexAttributeTexCoords	= 0
};

//	For the GPU vertex function
enum
{
	MessageBufferIndexVertexAttributes	= 0,
	MessageBufferIndexUniforms			= 1
};

//	For the GPU fragment function
enum
{
	BufferIndexOpacity = 0
};

//	A GPU fragment function typically uses
//	only one texture and one texture sampler at a time.
//	Additional TextureIndexes would be needed
//	only if the fragment function wanted
//	to combine two or more textures at render time.
enum
{
	MessageTextureIndex	= 0
};
enum
{
	MessageSamplerIndex	= 0
};

typedef struct
{
	//	Maps from message coordinates to eye coordinates
	//	and then projects into clip space.
	simd_float4x4	modelViewProjection[2];
	
	float	width,	//	in meters
			height;	//	in meters

} MessageUniforms;

//	For the Stereoscopic Vision Test,
//	which gets used only in psychology experiments.
//
enum	//	For the GPU vertex function
{
	SVTVertexAttributes	= 0,
	SVTViewProjection	= 1
};
enum	//	For the GPU fragment function
{
	SVTColor = 0
};

#endif /* GGVR_GPU_Definitions_h */
