///////////////////////////////////////////////////////////////////////  
//  Global.hlsl
//
//
//	*** INTERACTIVE DATA VISUALIZATION (IDV) CONFIDENTIAL AND PROPRIETARY INFORMATION ***
//
//	This software is supplied under the terms of a license agreement or
//	nondisclosure agreement with Interactive Data Visualization, Inc. and
//  may not be copied, disclosed, or exploited except in accordance with 
//  the terms of that agreement.
//
//      Copyright (c) 2003-2010 IDV, Inc.
//      All rights reserved in all media.
//
//      IDV, Inc.
//      http://www.idvinc.com


///////////////////////////////////////////////////////////////////////  
//  Platform specifics
//
//	Account for differences among DX9, DX10, and Cg compilers 

#ifdef SPEEDTREE_OPENGL

    #define SPEEDTREE_VS_OUTPUT POSITION
	#define SPEEDTREE_PS_OUTPUT COLOR

#elif defined(SPEEDTREE_DIRECTX9)

    #define SPEEDTREE_VS_OUTPUT POSITION
    #define SPEEDTREE_PS_OUTPUT COLOR

#else // assume DirectX10

    #define SPEEDTREE_VS_OUTPUT SV_POSITION
    #define SPEEDTREE_PS_OUTPUT SV_TARGET

#endif


///////////////////////////////////////////////////////////////////////  
//  Xbox 360 mostly uses the DirectX 9 render code

#ifdef SPEEDTREE_XBOX_360
	#define SPEEDTREE_DIRECTX9
#endif


///////////////////////////////////////////////////////////////////////  
//  Semantic Bindings
//
//	Differences between NVIDIA & ATI hardware, as well as Cg and HLSL compilers
//	call for this abstract of vertex attribute semantics

#ifdef SPEEDTREE_OPENGL
	#define SPEEDTREE_ATTR0	ATTR0
	#define SPEEDTREE_ATTR1	ATTR1
	#define SPEEDTREE_ATTR2	ATTR2
	#define SPEEDTREE_ATTR3	ATTR3
	#define SPEEDTREE_ATTR4	ATTR4
	#define SPEEDTREE_ATTR5	ATTR5
	#define SPEEDTREE_ATTR6	ATTR6
	#define SPEEDTREE_ATTR7	ATTR7
	#define SPEEDTREE_ATTR8	ATTR8
	#define SPEEDTREE_ATTR9	ATTR9
	#define SPEEDTREE_ATTR10	ATTR10
	#define SPEEDTREE_ATTR11	ATTR11
	#define SPEEDTREE_ATTR12	ATTR12
	#define SPEEDTREE_ATTR13	ATTR13
	#define SPEEDTREE_ATTR14	ATTR14
	#define SPEEDTREE_ATTR15	ATTR15
#else // assume DirectX if not OpenGL
	#define SPEEDTREE_ATTR0	POSITION
	#define SPEEDTREE_ATTR1	BLENDWEIGHT
	#define SPEEDTREE_ATTR2	NORMAL
	#define SPEEDTREE_ATTR3	COLOR0
	#define SPEEDTREE_ATTR4	COLOR1
	#define SPEEDTREE_ATTR5	TANGENT
	#define SPEEDTREE_ATTR6	PSIZE
	#define SPEEDTREE_ATTR7	BLENDINDICES
	#define SPEEDTREE_ATTR8	TEXCOORD0
	#define SPEEDTREE_ATTR9	TEXCOORD1
	#define SPEEDTREE_ATTR10	TEXCOORD2
	#define SPEEDTREE_ATTR11	TEXCOORD3
	#define SPEEDTREE_ATTR12	TEXCOORD4
	#define SPEEDTREE_ATTR13	TEXCOORD5
	#define SPEEDTREE_ATTR14	TEXCOORD6
	#define SPEEDTREE_ATTR15	TEXCOORD7
#endif


///////////////////////////////////////////////////////////////////////  
//  Because the PS3 does not support run-time compilation, it is necessary to
//  specify which registers the shared global variables should be stored in.  This
//  macro handles this appropriately with PS3 is #defined and is ignored otherwise.

#ifdef SPEEDTREE_PS3
	#define LOCAL_REG(x)  : C##x
	#define GLOBAL_REG(x) : C##x
#elif defined(SPEEDTREE_OPENGL)
	#define LOCAL_REG(x)  : C##x
	#define GLOBAL_REG(x) : ENV##x
#else
	#define LOCAL_REG(x)  : register(c##x)
	#define GLOBAL_REG(x) : register(c##x)
#endif


///////////////////////////////////////////////////////////////////////  
//	Shadow #defines

#ifndef SPEEDTREE_SMOOTH_SHADOWS
	#define SPEEDTREE_SMOOTH_SHADOWS false
#endif
#ifdef SPEEDTREE_SHADOW_MAP_RES
	#ifndef SPEEDTREE_SHADOWS_ENABLED
		#define SPEEDTREE_SHADOWS_ENABLED
	#endif
#endif
#ifndef SPEEDTREE_SMOOTH_SHADOWS
	#define SPEEDTREE_SMOOTH_SHADOWS false
#endif
#define SPEEDTREE_CLIP_OFFSET 0.1f

// some experimental settings; use as a basis for your own experimentation
//#define SPEEDTREE_WIND_AFFECTS_LIGHTING
//#define SPEEDTREE_BILLBOARDS_RECEIVE_SHADOWS


///////////////////////////////////////////////////////////////////////  
//	Lighting default #defines

#ifndef SPEEDTREE_SPECULAR_LIGHTING
	#define SPEEDTREE_SPECULAR_LIGHTING false
#endif
#ifndef SPEEDTREE_TRANSMISSION_LIGHTING
	#define SPEEDTREE_TRANSMISSION_LIGHTING false
#endif
#ifndef SPEEDTREE_AMBIENT_CONTRAST
	#define SPEEDTREE_AMBIENT_CONTRAST false
#endif
#ifndef SPEEDTREE_DETAIL_TEXTURE
	#define SPEEDTREE_DETAIL_TEXTURE false
#endif
#ifndef SPEEDTREE_DETAIL_NORMAL_MAPPING
	#define SPEEDTREE_DETAIL_NORMAL_MAPPING false
#endif


