#define vry varying
#define ufm uniform
#define nmlz normalize
#if defined(NNGLD_OPT_NUM_PARALLEL_LIGHT)&&(NNGLD_OPT_NUM_PARALLEL_LIGHT>=2)
#undef NNGLD_OPT_NUM_PARALLEL_LIGHT
#define NNGLD_OPT_NUM_PARALLEL_LIGHT 1
#endif
#ifndef NNGLD_PROF_NORMALIZE_VTX_NORMAL
#define NNGLD_PROF_NORMALIZE_VTX_NORMAL (1)
#endif
#ifndef NNGLD_PROF_LIGHT_AMBIENT
#define NNGLD_PROF_LIGHT_AMBIENT (0)
#endif
#ifndef NNGLD_PROF_POINTLIGHT_DISTATTEN
#define NNGLD_PROF_POINTLIGHT_DISTATTEN (0)
#endif
#ifndef NNGLD_PROF_CALC_VTX_BINORMAL
#define NNGLD_PROF_CALC_VTX_BINORMAL (1)
#endif
#ifndef NNGLD_PROF_MAX_USER_UNIFORM
#define NNGLD_PROF_MAX_USER_UNIFORM (4)
#endif
#ifndef NNGLD_PROF_DEFAULT_FLOAT_MEDIUMP
#define NNGLD_PROF_DEFAULT_FLOAT_MEDIUMP (1)
#endif
#ifndef NNGLD_PROF_COLOR_LOWP
#define NNGLD_PROF_COLOR_LOWP (1)
#endif
#ifndef NNGLD_PROF_DIRECTION_LOWP
#define NNGLD_PROF_DIRECTION_LOWP (0)
#endif
#ifndef NNGLD_PROF_VTX_SPECULAR
#define NNGLD_PROF_VTX_SPECULAR (0)
#endif
#ifndef NNGLD_OPT_VTX_NORMAL
#define NNGLD_OPT_VTX_NORMAL (1)
#endif
#ifndef NNGLD_OPT_VTX_TANGENT
#define NNGLD_OPT_VTX_TANGENT (0)
#endif
#ifndef NNGLD_OPT_VTX_BINORMAL
#define NNGLD_OPT_VTX_BINORMAL (0)
#endif
#ifndef NNGLD_OPT_VTX_COLOR0
#define NNGLD_OPT_VTX_COLOR0 (0)
#endif
#ifndef NNGLD_OPT_VTX_COLOR1
#define NNGLD_OPT_VTX_COLOR1 (0)
#endif
#ifndef NNGLD_OPT_VTX_TEXCOORD0
#define NNGLD_OPT_VTX_TEXCOORD0 (1)
#endif
#ifndef NNGLD_OPT_VTX_TEXCOORD1
#define NNGLD_OPT_VTX_TEXCOORD1 (0)
#endif
#ifndef NNGLD_OPT_VTX_TEXCOORD2
#define NNGLD_OPT_VTX_TEXCOORD2 (0)
#endif
#ifndef NNGLD_OPT_VTX_TEXCOORD3
#define NNGLD_OPT_VTX_TEXCOORD3 (0)
#endif
#ifndef NNGLD_OPT_LIGHTING
#define NNGLD_OPT_LIGHTING (1)
#endif
#ifndef NNGLD_OPT_FRAG_LIGHTING
#define NNGLD_OPT_FRAG_LIGHTING (1)
#endif
#ifndef NNGLD_OPT_NUM_PARALLEL_LIGHT
#define NNGLD_OPT_NUM_PARALLEL_LIGHT (1)
#endif
#ifndef NNGLD_OPT_SPECULAR
#define NNGLD_OPT_SPECULAR (0)
#endif
#ifndef NNGLD_OPT_TWOSIDED_LIGHTING
#define NNGLD_OPT_TWOSIDED_LIGHTING (0)
#endif
#ifndef NNGLD_OPT_TANGENT_SPACE
#define NNGLD_OPT_TANGENT_SPACE (0)
#endif
#ifndef NNGLD_OPT_NORMALMAP_AXLY
#define NNGLD_OPT_NORMALMAP_AXLY (0)
#endif
#ifndef NNGLD_OPT_TEX_NORMAL
#define NNGLD_OPT_TEX_NORMAL (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_NORMAL
#define NNGLD_OPT_TEXCOORD_NORMAL (-1)
#endif
#ifndef NNGLD_OPT_TEX_BASE
#define NNGLD_OPT_TEX_BASE (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_BASE
#define NNGLD_OPT_TEXCOORD_BASE (-1)
#endif
#ifndef NNGLD_OPT_TEX_DECAL
#define NNGLD_OPT_TEX_DECAL (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_DECAL
#define NNGLD_OPT_TEXCOORD_DECAL (-1)
#endif
#ifndef NNGLD_OPT_TEX_DECAL2
#define NNGLD_OPT_TEX_DECAL2 (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_DECAL2
#define NNGLD_OPT_TEXCOORD_DECAL2 (-1)
#endif
#ifndef NNGLD_OPT_TEX_DECAL3
#define NNGLD_OPT_TEX_DECAL3 (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_DECAL3
#define NNGLD_OPT_TEXCOORD_DECAL3 (-1)
#endif
#ifndef NNGLD_OPT_TEX_SPECULAR
#define NNGLD_OPT_TEX_SPECULAR (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_SPECULAR
#define NNGLD_OPT_TEXCOORD_SPECULAR (-1)
#endif
#ifndef NNGLD_OPT_TEX_SHININESS
#define NNGLD_OPT_TEX_SHININESS (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_SHININESS
#define NNGLD_OPT_TEXCOORD_SHININESS (-1)
#endif
#ifndef NNGLD_OPT_TEX_DUALPARABOLOID
#define NNGLD_OPT_TEX_DUALPARABOLOID (-1)
#endif
#ifndef NNGLD_OPT_TEX_ENVMASK
#define NNGLD_OPT_TEX_ENVMASK (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_ENVMASK
#define NNGLD_OPT_TEXCOORD_ENVMASK (-1)
#endif
#ifndef NNGLD_OPT_TEX_MODULATE
#define NNGLD_OPT_TEX_MODULATE (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_MODULATE
#define NNGLD_OPT_TEXCOORD_MODULATE (-1)
#endif
#ifndef NNGLD_OPT_TEX_ADD
#define NNGLD_OPT_TEX_ADD (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_ADD
#define NNGLD_OPT_TEXCOORD_ADD (-1)
#endif
#ifndef NNGLD_OPT_TEX_OPACITY
#define NNGLD_OPT_TEX_OPACITY (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_OPACITY
#define NNGLD_OPT_TEXCOORD_OPACITY (-1)
#endif
#ifndef NNGLD_OPT_TEX_USER1
#define NNGLD_OPT_TEX_USER1 (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_USER1
#define NNGLD_OPT_TEXCOORD_USER1 (-1)
#endif
#ifndef NNGLD_OPT_TEX_USER2
#define NNGLD_OPT_TEX_USER2 (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_USER2
#define NNGLD_OPT_TEXCOORD_USER2 (-1)
#endif
#ifndef NNGLD_OPT_TEX_USER3
#define NNGLD_OPT_TEX_USER3 (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_USER3
#define NNGLD_OPT_TEXCOORD_USER3 (-1)
#endif
#ifndef NNGLD_OPT_TEX_USER4
#define NNGLD_OPT_TEX_USER4 (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_USER4
#define NNGLD_OPT_TEXCOORD_USER4 (-1)
#endif
#ifndef NNGLD_OPT_TEX_USER5
#define NNGLD_OPT_TEX_USER5 (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_USER5
#define NNGLD_OPT_TEXCOORD_USER5 (-1)
#endif
#ifndef NNGLD_OPT_TEX_USER6
#define NNGLD_OPT_TEX_USER6 (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_USER6
#define NNGLD_OPT_TEXCOORD_USER6 (-1)
#endif
#ifndef NNGLD_OPT_TEX_USER7
#define NNGLD_OPT_TEX_USER7 (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_USER7
#define NNGLD_OPT_TEXCOORD_USER7 (-1)
#endif
#ifndef NNGLD_OPT_TEX_USER8
#define NNGLD_OPT_TEX_USER8 (-1)
#endif
#ifndef NNGLD_OPT_TEXCOORD_USER8
#define NNGLD_OPT_TEXCOORD_USER8 (-1)
#endif
#ifndef NNGLD_OPT_TEX_SAMPLER2D1
#define NNGLD_OPT_TEX_SAMPLER2D1 (-1)
#endif
#ifndef NNGLD_OPT_TEX_SAMPLER2D2
#define NNGLD_OPT_TEX_SAMPLER2D2 (-1)
#endif
#ifndef NNGLD_OPT_TEX_SAMPLER3D1
#define NNGLD_OPT_TEX_SAMPLER3D1 (-1)
#endif
#ifndef NNGLD_OPT_TEX_SAMPLER3D2
#define NNGLD_OPT_TEX_SAMPLER3D2 (-1)
#endif
#ifndef NNGLD_OPT_VERTEX_BLEND
#define NNGLD_OPT_VERTEX_BLEND (0)
#endif
#ifndef NNGLD_OPT_ALPHA_TEST
#define NNGLD_OPT_ALPHA_TEST (0)
#endif
#ifndef NNGLD_USER_PROFILE
#define NNGLD_USER_PROFILE (0)
#endif
#define DFL NNGLD_OPT_FRAG_LIGHTING
#define DT_NR NNGLD_OPT_TEX_NORMAL
#define DT_B NNGLD_OPT_TEX_BASE
#define DT_D1 NNGLD_OPT_TEX_DECAL
#define DT_D2 NNGLD_OPT_TEX_DECAL2
#define DT_D3 NNGLD_OPT_TEX_DECAL3
#define DT_SP NNGLD_OPT_TEX_SPECULAR
#define DT_SN NNGLD_OPT_TEX_SHININESS
#define DT_EM NNGLD_OPT_TEX_ENVMASK
#define DT_MD NNGLD_OPT_TEX_MODULATE
#define DT_AD NNGLD_OPT_TEX_ADD
#define DT_OP NNGLD_OPT_TEX_OPACITY
#define DT_U1 NNGLD_OPT_TEX_USER1
#define DT_U2 NNGLD_OPT_TEX_USER2
#define DT_U3 NNGLD_OPT_TEX_USER3
#define DT_U4 NNGLD_OPT_TEX_USER4
#define DT_U5 NNGLD_OPT_TEX_USER5
#define DT_U6 NNGLD_OPT_TEX_USER6
#define DT_U7 NNGLD_OPT_TEX_USER7
#define DT_U8 NNGLD_OPT_TEX_USER8
#define DT_S22 NNGLD_OPT_TEX_SAMPLER2D2
#define DP1 (1)
#define DP3 (3)
#define DP31 (1)
#define DP6 (6)
#define DP61 (1)
#define DP7 (7)
#define DP71 (1)
#define DP72 (2)
#define DP8 (8)
#define DP81 (1)
#define DP9 (9)
#define DP91 (1)
#define DP92 (2)
#define DP93 (3)
#define DP94 (4)
#define DP95 (5)
#define DP96 (6)
#define DPC (12)
#define DPD (13)
#define DP_A (10)
#define DP_DN(x) (NNGLD_USER_PROFILE_DRAWOBJ==x)
#define DP_MN(x) (NNGLD_USER_PROFILE==x)
#define DP_DI(id) (DP_DN(id))
#define DP_MI(dobjid, matid) (DP_DN(dobjid)&&DP_MN(matid))
#define DP_OMI(matid) (DP_MN(matid))
#define DPU_T (DP_DI(DP1))
#define DPU_FR (DP_MI(DP3, DP31)||DP_MI(DP6, DP61)||DP_MI(DP7, DP71))
#define DPU_HA (DP_DI(DP3)||DP_DI(DP6))
#define DPU_HB (DP_DI(DP3)||DP_DI(DP6))
#define DPU_HE (DPU_HA||DPU_HB)
#define DPU_RT (DP_MI(DP9, DP91))
#define DPU_RB (DP_MI(DP9, DP92))
#define DPU_WR (DP_MI(DP9, DP94))
#define DPU_WS (DP_MI(DP9, DP93)||DP_MI(DP9, DP96))
#define DPU_WF (DP_MI(DP9, DP93)||DP_MI(DP9, DP96))
#define DPU_NR (DP_MI(DP9, DP95))
#define DPU_IC (DP_MI(DP7, DP72))
#if DP_DI(DP1)
#define DUI_T (0)
#endif
#if DP_DI(DP3)
#define DUI_FR (0)
#define DUI_HA0 (1)
#define DUI_HA1 (2)
#define DUI_HA2 (3)
#define DUI_HB0 (4)
#define DUI_HB1 (5)
#define DUI_HB2 (6)
#endif
#if DP_DI(DP6)
#define DUI_FR (0)
#define DUI_HA0 (1)
#define DUI_HA1 (2)
#define DUI_HA2 (3)
#define DUI_HB0 (4)
#define DUI_HB1 (5)
#define DUI_HB2 (6)
#endif
#if DP_DI(DP7)
#define DUI_FR (0)
#endif
#if DP_DI(DP9)
#define DUI_WRS (0)
#define DUI_WF0 (1)
#define DUI_WF1 (2)
#define DUI_WF2 (3)
#define DUI_UVS (4)
#endif
#define DPU_GR DP_DI(DPC)
#define DPU_OC (DP_DI(DP6)||DP_DI(DPD))
#if DP_OMI(DP_A)
#undef DFL
#define DFL 0
#undef NNGLD_PROF_NORMALIZE_VTX_NORMAL
#define NNGLD_PROF_NORMALIZE_VTX_NORMAL 1
#endif
#if (DT_D1!=-1)&&!(DP_DI(DPD))
#undef DT_D1
#define DT_D1 -1
#endif
#if DPU_WR
#undef DFL
#define DFL 0
#undef NNGLD_OPT_LIGHTING
#define NNGLD_OPT_LIGHTING 0
#undef NNGLD_OPT_ALPHA_TEST
#define NNGLD_OPT_ALPHA_TEST 0
#undef NNGLD_OPT_VTX_COLOR0
#define NNGLD_OPT_VTX_COLOR0 0
#endif
#if DPU_WS
#undef DFL
#define DFL 0
#undef NNGLD_OPT_LIGHTING
#define NNGLD_OPT_LIGHTING 0
#undef DPU_WF
#define DPU_WF 0
#undef NNGLD_PROF_VTX_SPECULAR
#define NNGLD_PROF_VTX_SPECULAR 0
#undef NNGLD_OPT_ALPHA_TEST
#define NNGLD_OPT_ALPHA_TEST 0
#if DT_NR!=-1
#if DT_NR==0
#define tc_wn vtc0
#define DT_WN 0
#elif DT_NR==1
#define tc_wn nnglvTexCoord1
#define DT_WN 1
#elif DT_NR==2
#define tc_wn vtc2
#define DT_WN 2
#elif DT_NR==3
#define tc_wn vtc3
#define DT_WN 3
#elif DT_NR==4
#define tc_wn vtc4
#define DT_WN 4
#elif DT_NR==5
#define tc_wn vtc5
#define DT_WN 5
#elif DT_NR==6
#define tc_wn vtc6
#define DT_WN 6
#elif DT_NR==7
#define tc_wn vtc7
#define DT_WN 7
#endif
#undef DT_NR
#define DT_NR -1
#endif
#endif
#if DPU_GR
#if DT_S22!=-1
#if DT_S22==0
#define DT_GRD 0
#elif DT_S22==1
#define DT_GRD 1
#elif DT_S22==2
#define DT_GRD 2
#elif DT_S22==3
#define DT_GRD 3
#elif DT_S22==4
#define DT_GRD 4
#elif DT_S22==5
#define DT_GRD 5
#elif DT_S22==6
#define DT_GRD 6
#elif DT_S22==7
#define DT_GRD 7
#endif
#undef DT_S22
#define DT_S22 -1
#undef NNGLD_OPT_TEXCOORD_USER2
#define NNGLD_OPT_TEXCOORD_USER2 -1
#endif
#endif
#if !defined(DT_WN)
#define DT_WN -1
#endif
#if !defined(DT_GRD)
#define DT_GRD -1
#endif
#define DV_LT (!DFL&&NNGLD_OPT_LIGHTING)
#if !defined(GL_FRAGMENT_PRECISION_HIGH)||NNGLD_PROF_DEFAULT_FLOAT_MEDIUMP
precision mediump float;
precision mediump int;
#define pvh highp
#define pv mediump
#define pvf mediump
#else
precision highp float;
precision highp int;
#define pvh highp
#define pv highp
#define pvf highp
#endif
#define puv mediump
#if NNGLD_PROF_COLOR_LOWP
#define pcol lowp
#else
#define pcol mediump
#endif
#if NNGLD_PROF_DIRECTION_LOWP
#define pdir lowp
#else
#define pdir mediump
#endif
#define NNGLD_LIGHT_NUM NNGLD_OPT_NUM_PARALLEL_LIGHT
#if (NNGLD_OPT_TEX_DUALPARABOLOID!=-1||((NNGLD_OPT_TEXCOORD_ADD==-3)||(NNGLD_OPT_TEXCOORD_BASE==-3)||(NNGLD_OPT_TEXCOORD_DECAL==-3)||(NNGLD_OPT_TEXCOORD_DECAL2==-3)||(NNGLD_OPT_TEXCOORD_DECAL3==-3)||(NNGLD_OPT_TEXCOORD_SPECULAR==-3)||(NNGLD_OPT_TEXCOORD_SHININESS==-3)||(NNGLD_OPT_TEXCOORD_MODULATE==-3)||(NNGLD_OPT_TEXCOORD_ADD==-3)||(NNGLD_OPT_TEXCOORD_OPACITY==-3)||(NNGLD_OPT_TEXCOORD_USER1==-3)||(NNGLD_OPT_TEXCOORD_USER2==-3)||(NNGLD_OPT_TEXCOORD_USER3==-3)||(NNGLD_OPT_TEXCOORD_USER4==-3)||(NNGLD_OPT_TEXCOORD_USER5==-3)||(NNGLD_OPT_TEXCOORD_USER6==-3)||(NNGLD_OPT_TEXCOORD_USER7==-3)||(NNGLD_OPT_TEXCOORD_USER8==-3)))
#define DF_DPM (1)
#else
#define DF_DPM (0)
#endif
#if NNGLD_OPT_VTX_COLOR0||DV_LT
vry pcol vec4 vfc;
#endif
#if NNGLD_OPT_SPECULAR
vry pcol vec3 vfsc;
#endif
#if NNGLD_OPT_TWOSIDED_LIGHTING
#if NNGLD_OPT_VTX_COLOR0
vry pcol vec4 vbc;
#endif
#if NNGLD_OPT_SPECULAR
vry pcol vec3 vbsc;
#endif
#endif
#if (DFL||DF_DPM||DPU_WF)||DP_DI(DP8)
vry pvf vec4 vvpf;
#define vvp vvpf.xyz
#define vf vvpf.w
#endif
#if DFL||DF_DPM
vry pdir vec3 vn;
#if NNGLD_OPT_TANGENT_SPACE
vry pdir vec3 vt;
vry pdir vec3 vb;
#endif
#endif
#define MAX_TEXCOORD_NO(n) ((DT_NR>=(n))||(DT_WN>=(n))||(DT_B>=(n))||(DT_D1>=(n))||(DT_D2>=(n))||(DT_D3>=(n))||(DT_SP>=(n))||(DT_SN>=(n))||(DT_EM>=(n))||(DT_MD>=(n))||(DT_AD>=(n))||(DT_OP>=(n))||(DT_U1>=(n))||(DT_U2>=(n))||(DT_U3>=(n))||(DT_U4>=(n))||(DT_U5>=(n))||(DT_U6>=(n))||(DT_U7>=(n))||(DT_U8>=(n)))
#if MAX_TEXCOORD_NO(0)
vry puv vec4 vtc01;
#endif
#if MAX_TEXCOORD_NO(2)
vry puv vec4 vtc23;
#endif
#if MAX_TEXCOORD_NO(4)
vry puv vec4 vtc45;
#endif
#if MAX_TEXCOORD_NO(6)
vry puv vec4 vtc67;
#endif
#define vtc0 vtc01.xy
#define nnglvTexCoord1 vtc01.zw
#define vtc2 vtc23.xy
#define vtc3 vtc23.zw
#define vtc4 vtc45.xy
#define vtc5 vtc45.zw
#define vtc6 vtc67.xy
#define vtc7 vtc67.zw
#if DP_DI(DP1)&&(NNGLD_OPT_TEX_SAMPLER2D1!=-1)
vry vec2 vuu;
#endif
#if DPU_HE&&DFL
vry vec3 vhlc;
#endif
#if DPU_RT||DPU_RB
vry vec4 vpp;
#endif
#if DPU_WR||DPU_WS||DPU_NR||DPU_GR
vry vec4 vphp;
#endif
#if DT_NR==0
#define tc_nr vtc0
#elif DT_NR==1
#define tc_nr nnglvTexCoord1
#elif DT_NR==2
#define tc_nr vtc2
#elif DT_NR==3
#define tc_nr vtc3
#elif DT_NR==4
#define tc_nr vtc4
#elif DT_NR==5
#define tc_nr vtc5
#elif DT_NR==6
#define tc_nr vtc6
#elif DT_NR==7
#define tc_nr vtc7
#endif
#if DT_B==0
#define tc_bn vtc0
#elif DT_B==1
#define tc_bn nnglvTexCoord1
#elif DT_B==2
#define tc_bn vtc2
#elif DT_B==3
#define tc_bn vtc3
#elif DT_B==4
#define tc_bn vtc4
#elif DT_B==5
#define tc_bn vtc5
#elif DT_B==6
#define tc_bn vtc6
#elif DT_B==7
#define tc_bn vtc7
#endif
#if DT_D1==0
#define tc_dc1 vtc0
#elif DT_D1==1
#define tc_dc1 nnglvTexCoord1
#elif DT_D1==2
#define tc_dc1 vtc2
#elif DT_D1==3
#define tc_dc1 vtc3
#elif DT_D1==4
#define tc_dc1 vtc4
#elif DT_D1==5
#define tc_dc1 vtc5
#elif DT_D1==6
#define tc_dc1 vtc6
#elif DT_D1==7
#define tc_dc1 vtc7
#endif
#if DT_D2==0
#define tc_dc2 vtc0
#elif DT_D2==1
#define tc_dc2 nnglvTexCoord1
#elif DT_D2==2
#define tc_dc2 vtc2
#elif DT_D2==3
#define tc_dc2 vtc3
#elif DT_D2==4
#define tc_dc2 vtc4
#elif DT_D2==5
#define tc_dc2 vtc5
#elif DT_D2==6
#define tc_dc2 vtc6
#elif DT_D2==7
#define tc_dc2 vtc7
#endif
#if DT_D3==0
#define tc_dc3 vtc0
#elif DT_D3==1
#define tc_dc3 nnglvTexCoord1
#elif DT_D3==2
#define tc_dc3 vtc2
#elif DT_D3==3
#define tc_dc3 vtc3
#elif DT_D3==4
#define tc_dc3 vtc4
#elif DT_D3==5
#define tc_dc3 vtc5
#elif DT_D3==6
#define tc_dc3 vtc6
#elif DT_D3==7
#define tc_dc3 vtc7
#endif
#if DT_SP==0
#define tc_sp vtc0
#elif DT_SP==1
#define tc_sp nnglvTexCoord1
#elif DT_SP==2
#define tc_sp vtc2
#elif DT_SP==3
#define tc_sp vtc3
#elif DT_SP==4
#define tc_sp vtc4
#elif DT_SP==5
#define tc_sp vtc5
#elif DT_SP==6
#define tc_sp vtc6
#elif DT_SP==7
#define tc_sp vtc7
#endif
#if DT_SN==0
#define tc_sn vtc0
#elif DT_SN==1
#define tc_sn nnglvTexCoord1
#elif DT_SN==2
#define tc_sn vtc2
#elif DT_SN==3
#define tc_sn vtc3
#elif DT_SN==4
#define tc_sn vtc4
#elif DT_SN==5
#define tc_sn vtc5
#elif DT_SN==6
#define tc_sn vtc6
#elif DT_SN==7
#define tc_sn vtc7
#endif
#if DT_EM==0
#define tc_em vtc0
#elif DT_EM==1
#define tc_em nnglvTexCoord1
#elif DT_EM==2
#define tc_em vtc2
#elif DT_EM==3
#define tc_em vtc3
#elif DT_EM==4
#define tc_em vtc4
#elif DT_EM==5
#define tc_em vtc5
#elif DT_EM==6
#define tc_em vtc6
#elif DT_EM==7
#define tc_em vtc7
#endif
#if DT_MD==0
#define tc_md vtc0
#elif DT_MD==1
#define tc_md nnglvTexCoord1
#elif DT_MD==2
#define tc_md vtc2
#elif DT_MD==3
#define tc_md vtc3
#elif DT_MD==4
#define tc_md vtc4
#elif DT_MD==5
#define tc_md vtc5
#elif DT_MD==6
#define tc_md vtc6
#elif DT_MD==7
#define tc_md vtc7
#endif
#if DT_AD==0
#define tc_ad vtc0
#elif DT_AD==1
#define tc_ad nnglvTexCoord1
#elif DT_AD==2
#define tc_ad vtc2
#elif DT_AD==3
#define tc_ad vtc3
#elif DT_AD==4
#define tc_ad vtc4
#elif DT_AD==5
#define tc_ad vtc5
#elif DT_AD==6
#define tc_ad vtc6
#elif DT_AD==7
#define tc_ad vtc7
#endif
#if DT_OP==0
#define tc_op vtc0
#elif DT_OP==1
#define tc_op nnglvTexCoord1
#elif DT_OP==2
#define tc_op vtc2
#elif DT_OP==3
#define tc_op vtc3
#elif DT_OP==4
#define tc_op vtc4
#elif DT_OP==5
#define tc_op vtc5
#elif DT_OP==6
#define tc_op vtc6
#elif DT_OP==7
#define tc_op vtc7
#endif
#if DT_U1==0
#define tc_us1 vtc0
#elif DT_U1==1
#define tc_us1 nnglvTexCoord1
#elif DT_U1==2
#define tc_us1 vtc2
#elif DT_U1==3
#define tc_us1 vtc3
#elif DT_U1==4
#define tc_us1 vtc4
#elif DT_U1==5
#define tc_us1 vtc5
#elif DT_U1==6
#define tc_us1 vtc6
#elif DT_U1==7
#define tc_us1 vtc7
#endif
#if DT_U2==0
#define tc_us2 vtc0
#elif DT_U2==1
#define tc_us2 nnglvTexCoord1
#elif DT_U2==2
#define tc_us2 vtc2
#elif DT_U2==3
#define tc_us2 vtc3
#elif DT_U2==4
#define tc_us2 vtc4
#elif DT_U2==5
#define tc_us2 vtc5
#elif DT_U2==6
#define tc_us2 vtc6
#elif DT_U2==7
#define tc_us2 vtc7
#endif
#if DT_U3==0
#define tc_us3 vtc0
#elif DT_U3==1
#define tc_us3 nnglvTexCoord1
#elif DT_U3==2
#define tc_us3 vtc2
#elif DT_U3==3
#define tc_us3 vtc3
#elif DT_U3==4
#define tc_us3 vtc4
#elif DT_U3==5
#define tc_us3 vtc5
#elif DT_U3==6
#define tc_us3 vtc6
#elif DT_U3==7
#define tc_us3 vtc7
#endif
#if DT_U4==0
#define tc_us4 vtc0
#elif DT_U4==1
#define tc_us4 nnglvTexCoord1
#elif DT_U4==2
#define tc_us4 vtc2
#elif DT_U4==3
#define tc_us4 vtc3
#elif DT_U4==4
#define tc_us4 vtc4
#elif DT_U4==5
#define tc_us4 vtc5
#elif DT_U4==6
#define tc_us4 vtc6
#elif DT_U4==7
#define tc_us4 vtc7
#endif
#if DT_U5==0
#define tc_us5 vtc0
#elif DT_U5==1
#define tc_us5 nnglvTexCoord1
#elif DT_U5==2
#define tc_us5 vtc2
#elif DT_U5==3
#define tc_us5 vtc3
#elif DT_U5==4
#define tc_us5 vtc4
#elif DT_U5==5
#define tc_us5 vtc5
#elif DT_U5==6
#define tc_us5 vtc6
#elif DT_U5==7
#define tc_us5 vtc7
#endif
#if DT_U6==0
#define tc_us6 vtc0
#elif DT_U6==1
#define tc_us6 nnglvTexCoord1
#elif DT_U6==2
#define tc_us6 vtc2
#elif DT_U6==3
#define tc_us6 vtc3
#elif DT_U6==4
#define tc_us6 vtc4
#elif DT_U6==5
#define tc_us6 vtc5
#elif DT_U6==6
#define tc_us6 vtc6
#elif DT_U6==7
#define tc_us6 vtc7
#endif
#if DT_U7==0
#define tc_us7 vtc0
#elif DT_U7==1
#define tc_us7 nnglvTexCoord1
#elif DT_U7==2
#define tc_us7 vtc2
#elif DT_U7==3
#define tc_us7 vtc3
#elif DT_U7==4
#define tc_us7 vtc4
#elif DT_U7==5
#define tc_us7 vtc5
#elif DT_U7==6
#define tc_us7 vtc6
#elif DT_U7==7
#define tc_us7 vtc7
#endif
#if DT_U8==0
#define tc_us8 vtc0
#elif DT_U8==1
#define tc_us8 nnglvTexCoord1
#elif DT_U8==2
#define tc_us8 vtc2
#elif DT_U8==3
#define tc_us8 vtc3
#elif DT_U8==4
#define tc_us8 vtc4
#elif DT_U8==5
#define tc_us8 vtc5
#elif DT_U8==6
#define tc_us8 vtc6
#elif DT_U8==7
#define tc_us8 vtc7
#endif
#if (NNGLD_OPT_VERTEX_BLEND==0)||(DPU_WR||DPU_WS||DPU_NR||DPU_GR)
ufm pvh mat4 nngluModelViewProjectionMatrix;
#endif
#if (NNGLD_OPT_VERTEX_BLEND>0)||(DPU_WR||DPU_WS||DPU_NR||DPU_GR)
ufm pvh mat4 nngluProjectionMatrix;
#endif
#if NNGLD_OPT_VERTEX_BLEND==0
ufm pvh mat4 nngluModelViewMatrix;
#endif
#if (NNGLD_OPT_VERTEX_BLEND==0)&&(NNGLD_OPT_VTX_NORMAL||NNGLD_OPT_TANGENT_SPACE)
ufm pv mat3 nngluNormalMatrix;
#endif
#define DMTN (8)
ufm pv mat4 nngluTextureMatrix[DMTN];
#if (NNGLD_OPT_NUM_PARALLEL_LIGHT>0)&&NNGLD_OPT_LIGHTING
ufm pdir vec3 nngluParallelLightDirection[NNGLD_OPT_NUM_PARALLEL_LIGHT];
ufm pcol vec3 nngluParallelLightDiffuse[NNGLD_OPT_NUM_PARALLEL_LIGHT];
ufm pcol vec3 nngluParallelLightAmbient[NNGLD_OPT_NUM_PARALLEL_LIGHT];
ufm pcol vec3 nngluParallelLightSpecular[NNGLD_OPT_NUM_PARALLEL_LIGHT];
#endif
ufm pcol vec4 nngluFrontMaterialDiffuse;
#if !DFL&&NNGLD_OPT_LIGHTING
ufm pcol vec3 nngluFrontMaterialAmbient;
ufm pcol vec4 nngluFrontMaterialEmissionAlphaRef;
#define sar nngluFrontMaterialEmissionAlphaRef.a
#endif
ufm pvf vec4 nngluFrontMaterialSpecularShininess;
#define sfmsp nngluFrontMaterialSpecularShininess.rgb
#define sfmsn nngluFrontMaterialSpecularShininess.a
#if NNGLD_OPT_LIGHTING||NNGLD_OPT_TANGENT_SPACE
ufm pcol vec4 nngluSceneAmbientTangent;
#define sscam nngluSceneAmbientTangent.rgb
#define stng nngluSceneAmbientTangent.a
#endif
#if NNGLD_OPT_VERTEX_BLEND>0
#define DMMI (16)
ufm pv mat4 nngluPositionMatrices[DMMI];
#endif
#if NNGLD_PROF_MAX_USER_UNIFORM>0
ufm pvf vec4 nngluUserUniform[NNGLD_PROF_MAX_USER_UNIFORM];
#endif
#if !defined(vvp)
pv vec3 vvp;
pv float vf;
#endif
attribute pv vec4 nnglaPosition;
#if NNGLD_OPT_VTX_NORMAL
attribute pdir vec3 nnglaNormal;
#endif
#if NNGLD_OPT_VTX_TANGENT
attribute pdir vec3 nnglaTangent;
#endif
#if NNGLD_OPT_VTX_BINORMAL
attribute pdir vec3 nnglaBinormal;
#endif
#if NNGLD_OPT_VTX_COLOR0
attribute pcol vec4 nnglaColor0;
#endif
#if NNGLD_OPT_VTX_COLOR1
attribute pcol vec3 nnglaColor1;
#endif
#if NNGLD_OPT_VTX_TEXCOORD0
attribute puv vec4 nnglaTexCoord0;
#endif
#if NNGLD_OPT_VTX_TEXCOORD1
attribute puv vec4 nnglaTexCoord1;
#endif
#if NNGLD_OPT_VTX_TEXCOORD2
attribute puv vec4 nnglaTexCoord2;
#endif
#if NNGLD_OPT_VTX_TEXCOORD3
attribute puv vec4 nnglaTexCoord3;
#endif
#if (NNGLD_OPT_VERTEX_BLEND>0)
attribute pv vec4 nnglaMtxIdx;
#if (NNGLD_OPT_VERTEX_BLEND>1)
attribute pvh vec4  nnglaWeight;
#endif
#endif
pv vec4 svp;
pdir vec3 sn;
#if NNGLD_OPT_TANGENT_SPACE
pdir vec3 stn;
pdir vec3 sbn;
#endif
pdir vec3 sed;
pcol vec3 sdf=vec3(.0);
pcol vec3 ssp=vec3(.0);
#if NNGLD_OPT_TWOSIDED_LIGHTING
pcol vec3 sbdf=vec3(.0);
pcol vec3 sbsp=vec3(.0);
#endif
#if NNGLD_PROF_LIGHT_AMBIENT
pcol vec3 sam=vec3(.0);
#endif
#if DPU_HA
pcol vec3 shla;
#endif
#if DPU_HB
pcol vec3 shlb;
#endif
#if NNGLD_OPT_VERTEX_BLEND>0
void fcvw(pv float mtxidx, pvh float weight){
pv int imtxidx=int(mtxidx);
vvp+=(nngluPositionMatrices[imtxidx]*svp).xyz*weight;
pdir mat3 normalmtx=mat3(nngluPositionMatrices[imtxidx]);
#if NNGLD_OPT_VTX_NORMAL
sn+=(nngluPositionMatrices[imtxidx]*vec4(nnglaNormal,.0)).rgb*weight;
#endif
#if NNGLD_OPT_TANGENT_SPACE
#if NNGLD_OPT_VTX_TANGENT
stn+=normalmtx*nnglaTangent*weight;
#else
stn+=normalmtx*vec3(stng,.0,.0)*weight;
#endif
#if NNGLD_OPT_VTX_BINORMAL
sbn+=normalmtx*nnglaBinormal*weight;
#endif
#endif
}
#endif
void ftvpn(){
svp=vec4(nnglaPosition.xyz/nnglaPosition.w,1.0);
#if NNGLD_OPT_VERTEX_BLEND==0
gl_Position=nngluModelViewProjectionMatrix*svp;
vvp=(nngluModelViewMatrix*svp).xyz;
#if NNGLD_OPT_VTX_NORMAL
sn=nngluNormalMatrix*nnglaNormal;
#else
sn=vec3(.0,.0,1.0);
#endif
#if NNGLD_OPT_TANGENT_SPACE
#if NNGLD_OPT_VTX_TANGENT
stn=nngluNormalMatrix*nnglaTangent;
#else
stn=vec3(stng,.0,.0);
#endif
#if !NNGLD_OPT_VTX_BINORMAL
sbn=cross(sn,stn*stng);
#else
sbn=nngluNormalMatrix*nnglaBinormal;
#endif
#endif
#if (NNGLD_OPT_TEX_SAMPLER2D1!=-1)&&DP_DI(DP1)
vec4 proj_pos=nngluModelViewProjectionMatrix*nnglaPosition;
vuu=proj_pos.xy/proj_pos.w*vec2(.5,-.5)+.5;
#endif
#else
vvp=vec3(.0);
sn=vec3(.0);
#if NNGLD_OPT_TANGENT_SPACE
stn=vec3(.0);
sbn=vec3(.0);
#endif
#if NNGLD_OPT_VERTEX_BLEND==1
fcvw(nnglaMtxIdx.x,1.0);
#elif NNGLD_OPT_VERTEX_BLEND==2
fcvw(nnglaMtxIdx.x,nnglaWeight.x);
fcvw(nnglaMtxIdx.y,1.0-nnglaWeight.x);
#elif NNGLD_OPT_VERTEX_BLEND==3
fcvw(nnglaMtxIdx.x,nnglaWeight.x);
fcvw(nnglaMtxIdx.y,nnglaWeight.y);
fcvw(nnglaMtxIdx.z,1.0-nnglaWeight.x-nnglaWeight.y);
#elif NNGLD_OPT_VERTEX_BLEND==4
fcvw(nnglaMtxIdx.x,nnglaWeight.x);
fcvw(nnglaMtxIdx.y,nnglaWeight.y);
fcvw(nnglaMtxIdx.z,nnglaWeight.z);
fcvw(nnglaMtxIdx.w,1.0-nnglaWeight.x-nnglaWeight.y-nnglaWeight.z);
#endif
#if NNGLD_OPT_TANGENT_SPACE&&NNGLD_PROF_CALC_VTX_BINORMAL
#if NNGLD_OPT_VTX_TANGENT
sbn=cross(sn,stn);
#else
sbn=cross(sn,vec3(1.0,.0,.0));
#endif
#endif
gl_Position=nngluProjectionMatrix*vec4(vvp,1.0);
#if (NNGLD_OPT_TEX_SAMPLER2D1!=-1)&&DP_DI(DP1)
vuu=gl_Position.xy/gl_Position.w*vec2(.5,-.5)+.5;
#endif
#endif
sed=nmlz(vvp);
#if NNGLD_PROF_NORMALIZE_VTX_NORMAL
sn=nmlz(sn);
#if NNGLD_OPT_TANGENT_SPACE
stn=nmlz(stn);
sbn=nmlz(sbn);
#endif
#elif !DFL&&(NNGLD_OPT_NUM_PARALLEL_LIGHT>0)&&NNGLD_OPT_LIGHTING
sn=nmlz(sn);
#endif
}
puv vec4 fcsmtc(){
pdir vec3 r;
puv vec2 r2;
r=reflect(sed,sn);
r.z+=1.0;
r2=nmlz( r ).xy*vec2(.5,-.5)+vec2(.5,.5);
return vec4(r2.xy,.0,1.0);
}
void fctc(){
#if DT_NR!=-1
#if 0<=NNGLD_OPT_TEXCOORD_NORMAL&&NNGLD_OPT_TEXCOORD_NORMAL<=3
tc_nr=(nngluTextureMatrix[DT_NR]*
#if NNGLD_OPT_TEXCOORD_NORMAL==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_NORMAL==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_NORMAL==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_NORMAL==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_NORMAL==-1
tc_nr=(nngluTextureMatrix[DT_NR]* fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_NORMAL==-2
tc_nr=(nngluTextureMatrix[DT_NR]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_WN!=-1
tc_wn=(nngluTextureMatrix[DT_WN]*
#if NNGLD_OPT_TEXCOORD_NORMAL==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_NORMAL==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_NORMAL==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_NORMAL==3
nnglaTexCoord3).xy;
#endif
#endif
#if DT_B!=-1
#if 0<=NNGLD_OPT_TEXCOORD_BASE&&NNGLD_OPT_TEXCOORD_BASE<=3
tc_bn=(nngluTextureMatrix[DT_B]*
#if NNGLD_OPT_TEXCOORD_BASE==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_BASE==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_BASE==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_BASE==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_BASE==-1
tc_bn=(nngluTextureMatrix[DT_B]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_BASE==-2
tc_bn=(nngluTextureMatrix[DT_B]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_D1!=-1
#if 0<=NNGLD_OPT_TEXCOORD_DECAL&&NNGLD_OPT_TEXCOORD_DECAL<=3
tc_dc1=(nngluTextureMatrix[DT_D1]*
#if NNGLD_OPT_TEXCOORD_DECAL==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_DECAL==-1
tc_dc1=(nngluTextureMatrix[DT_D1]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL==-2
tc_dc1=(nngluTextureMatrix[DT_D1]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_D2!=-1
#if 0<=NNGLD_OPT_TEXCOORD_DECAL2&&NNGLD_OPT_TEXCOORD_DECAL2<=3
tc_dc2=(nngluTextureMatrix[DT_D2]*
#if NNGLD_OPT_TEXCOORD_DECAL2==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL2==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL2==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL2==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_DECAL2==-1
tc_dc2=(nngluTextureMatrix[DT_D2]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL2==-2
tc_dc2=(nngluTextureMatrix[DT_D2]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_D3!=-1
#if 0<=NNGLD_OPT_TEXCOORD_DECAL3&&NNGLD_OPT_TEXCOORD_DECAL3<=3
tc_dc3=(nngluTextureMatrix[DT_D3]*
#if NNGLD_OPT_TEXCOORD_DECAL3==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL3==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL3==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL3==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_DECAL3==-1
tc_dc3=(nngluTextureMatrix[DT_D3]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_DECAL3==-2
tc_dc3=(nngluTextureMatrix[DT_D3]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_SP!=-1
#if 0<=NNGLD_OPT_TEXCOORD_SPECULAR&&NNGLD_OPT_TEXCOORD_SPECULAR<=3
tc_sp=(nngluTextureMatrix[DT_SP]*
#if NNGLD_OPT_TEXCOORD_SPECULAR==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_SPECULAR==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_SPECULAR==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_SPECULAR==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_SPECULAR==-1
tc_sp=(nngluTextureMatrix[DT_SP]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_SPECULAR==-2
tc_sp=(nngluTextureMatrix[DT_SP]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_SN!=-1
#if 0<=NNGLD_OPT_TEXCOORD_SHININESS&&NNGLD_OPT_TEXCOORD_SHININESS<=3
tc_sn=(nngluTextureMatrix[DT_SN]*
#if NNGLD_OPT_TEXCOORD_SHININESS==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_SHININESS==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_SHININESS==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_SHININESS==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_SHININESS==-1
tc_sn=(nngluTextureMatrix[DT_SN]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_SHININESS==-2
tc_sn=(nngluTextureMatrix[DT_SN]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_EM!=-1
#if 0<=NNGLD_OPT_TEXCOORD_ENVMASK&&NNGLD_OPT_TEXCOORD_ENVMASK<=3
tc_em=(nngluTextureMatrix[DT_EM]*
#if NNGLD_OPT_TEXCOORD_ENVMASK==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_ENVMASK==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_ENVMASK==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_ENVMASK==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_ENVMASK==-1
tc_em=(nngluTextureMatrix[DT_EM]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_ENVMASK==-2
tc_em=(nngluTextureMatrix[DT_EM]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_MD!=-1
#if 0<=NNGLD_OPT_TEXCOORD_MODULATE&&NNGLD_OPT_TEXCOORD_MODULATE<=3
tc_md=(nngluTextureMatrix[DT_MD]*
#if NNGLD_OPT_TEXCOORD_MODULATE==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_MODULATE==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_MODULATE==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_MODULATE==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_MODULATE==-1
tc_md=(nngluTextureMatrix[DT_MD]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_MODULATE==-2
tc_md=(nngluTextureMatrix[DT_MD]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_AD!=-1
#if 0<=NNGLD_OPT_TEXCOORD_ADD&&NNGLD_OPT_TEXCOORD_ADD<=3
tc_ad=(nngluTextureMatrix[DT_AD]*
#if NNGLD_OPT_TEXCOORD_ADD==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_ADD==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_ADD==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_ADD==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_ADD==-1
tc_ad=(nngluTextureMatrix[DT_AD]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_ADD==-2
tc_ad=(nngluTextureMatrix[DT_AD]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_OP!=-1
#if 0<=NNGLD_OPT_TEXCOORD_OPACITY&&NNGLD_OPT_TEXCOORD_OPACITY<=3
tc_op=(nngluTextureMatrix[DT_OP]*
#if NNGLD_OPT_TEXCOORD_OPACITY==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_OPACITY==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_OPACITY==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_OPACITY==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_OPACITY==-1
tc_op=(nngluTextureMatrix[DT_OP]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_OPACITY==-2
tc_op=(nngluTextureMatrix[DT_OP]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_U1!=-1
#if 0<=NNGLD_OPT_TEXCOORD_USER1&&NNGLD_OPT_TEXCOORD_USER1<=3
tc_us1=(nngluTextureMatrix[DT_U1]*
#if NNGLD_OPT_TEXCOORD_USER1==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_USER1==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_USER1==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_USER1==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_USER1==-1
tc_us1=(nngluTextureMatrix[DT_U1]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_USER1==-2
tc_us1=(nngluTextureMatrix[DT_U1]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_U2!=-1
#if 0<=NNGLD_OPT_TEXCOORD_USER2&&NNGLD_OPT_TEXCOORD_USER2<=3
tc_us2=(nngluTextureMatrix[DT_U2]*
#if NNGLD_OPT_TEXCOORD_USER2==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_USER2==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_USER2==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_USER2==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_USER2==-1
tc_us2=(nngluTextureMatrix[DT_U2]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_USER2==-2
tc_us2=(nngluTextureMatrix[DT_U2]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_U3!=-1
#if 0<=NNGLD_OPT_TEXCOORD_USER3&&NNGLD_OPT_TEXCOORD_USER3<=3
tc_us3=(nngluTextureMatrix[DT_U3]*
#if NNGLD_OPT_TEXCOORD_USER3==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_USER3==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_USER3==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_USER3==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_USER3==-1
tc_us3=(nngluTextureMatrix[DT_U3]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_USER3==-2
tc_us3=(nngluTextureMatrix[DT_U3]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_U4!=-1
#if 0<=NNGLD_OPT_TEXCOORD_USER4&&NNGLD_OPT_TEXCOORD_USER4<=3
tc_us4=(nngluTextureMatrix[DT_U4]*
#if NNGLD_OPT_TEXCOORD_USER4==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_USER4==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_USER4==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_USER4==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_USER4==-1
tc_us4=(nngluTextureMatrix[DT_U4]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_USER4==-2
tc_us4=(nngluTextureMatrix[DT_U4]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_U5!=-1
#if 0<=NNGLD_OPT_TEXCOORD_USER5&&NNGLD_OPT_TEXCOORD_USER5<=3
tc_us5=(nngluTextureMatrix[DT_U5]*
#if NNGLD_OPT_TEXCOORD_USER5==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_USER5==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_USER5==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_USER5==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_USER5==-1
tc_us5=(nngluTextureMatrix[DT_U5]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_USER5==-2
tc_us5=(nngluTextureMatrix[DT_U5]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_U6!=-1
#if 0<=NNGLD_OPT_TEXCOORD_USER6&&NNGLD_OPT_TEXCOORD_USER6<=3
tc_us6=(nngluTextureMatrix[DT_U6]*
#if NNGLD_OPT_TEXCOORD_USER6==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_USER6==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_USER6==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_USER6==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_USER6==-1
tc_us6=(nngluTextureMatrix[DT_U6]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_USER6==-2
tc_us6=(nngluTextureMatrix[DT_U6]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_U7!=-1
#if 0<=NNGLD_OPT_TEXCOORD_USER7&&NNGLD_OPT_TEXCOORD_USER7<=3
tc_us7=(nngluTextureMatrix[DT_U7]*
#if NNGLD_OPT_TEXCOORD_USER7==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_USER7==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_USER7==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_USER7==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_USER7==-1
tc_us7=(nngluTextureMatrix[DT_U7]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_USER7==-2
tc_us7=(nngluTextureMatrix[DT_U7]*vec4(vvp,1.0)).xy;
#endif
#endif
#if DT_U8!=-1
#if 0<=NNGLD_OPT_TEXCOORD_USER8&&NNGLD_OPT_TEXCOORD_USER8<=3
tc_us8=(nngluTextureMatrix[DT_U8]*
#if NNGLD_OPT_TEXCOORD_USER8==0
nnglaTexCoord0).xy;
#elif NNGLD_OPT_TEXCOORD_USER8==1
nnglaTexCoord1).xy;
#elif NNGLD_OPT_TEXCOORD_USER8==2
nnglaTexCoord2).xy;
#elif NNGLD_OPT_TEXCOORD_USER8==3
nnglaTexCoord3).xy;
#endif
#elif NNGLD_OPT_TEXCOORD_USER8==-1
tc_us8=(nngluTextureMatrix[DT_U8]*fcsmtc()).xy;
#elif NNGLD_OPT_TEXCOORD_USER8==-2
tc_us8=(nngluTextureMatrix[DT_U8]*vec4(vvp,1.0)).xy;
#endif
#endif
}
#if !DFL&&(NNGLD_OPT_NUM_PARALLEL_LIGHT>0)&&NNGLD_OPT_LIGHTING
void fplo(pv int parlitno){
pdir vec3 litdir=-nngluParallelLightDirection[parlitno].xyz;
#if 1
pcol float diffcnt=dot(sn,litdir)*.5+.5;
#if NNGLD_OPT_TWOSIDED_LIGHTING
pcol float backdiffcnt=-(diffcnt-1.0);
backdiffcnt=backdiffcnt*backdiffcnt;
#endif
diffcnt=diffcnt*diffcnt;
#else
pcol float diffcnt=dot(sn,litdir);
#if NNGLD_OPT_TWOSIDED_LIGHTING
pcol float backdiffcnt=clamp(-diffcnt,.0,1.0);
#endif
#endif
diffcnt=clamp(diffcnt,.0,1.0);
sdf+=nngluParallelLightDiffuse[parlitno].rgb*diffcnt;
#if NNGLD_OPT_TWOSIDED_LIGHTING
sbdf +=nngluParallelLightDiffuse[parlitno].rgb*backdiffcnt;
#endif
#if NNGLD_PROF_LIGHT_AMBIENT
sam+=nngluLightAmbient[parlitno];
#endif
#if NNGLD_OPT_SPECULAR
vec3 halfvec=nmlz(litdir-sed);
ssp+=nngluParallelLightSpecular[parlitno].rgb*pow(clamp(dot(halfvec,sn),.0,1.0),sfmsn);
#endif
}
#endif
void fcl(){
#if NNGLD_OPT_LIGHTING&&(!(DFL)&&(NNGLD_LIGHT_NUM>0))&&(NNGLD_OPT_NUM_PARALLEL_LIGHT>0)
for(pv int parlitno=0;parlitno<NNGLD_OPT_NUM_PARALLEL_LIGHT;++parlitno)fplo(parlitno);
#endif
}
void fclam(){
#if NNGLD_OPT_LIGHTING
#if DPU_HA
float intensity_a=dot(sn.xyz,nngluUserUniform[DUI_HA2].xyz);
shla=clamp(.5*(1.0+intensity_a)*nngluUserUniform[DUI_HA0].rgb+.5*(1.0-intensity_a)*nngluUserUniform[DUI_HA1].rgb,.0,1.0);
#endif
#if DPU_HB
float intensity_b=dot(sn.xyz,nngluUserUniform[DUI_HB2].xyz);
shlb=clamp(.5*(1.0+intensity_b)*nngluUserUniform[DUI_HB0].rgb+.5*(1.0-intensity_b)*nngluUserUniform[DUI_HB1].rgb,.0,1.0);
#endif
#endif
#if !DFL
#if NNGLD_OPT_LIGHTING
fcl();
sdf=
#if NNGLD_OPT_VTX_COLOR0
sdf*nnglaColor0.rgb
#else
sdf
#endif
+sscam
#if NNGLD_PROF_LIGHT_AMBIENT
+sam
#endif
#if DPU_HA
+shla
#endif
#if DPU_HB
+shlb
#endif
;
#else
sdf=nngluFrontMaterialDiffuse.rgb;
#if NNGLD_OPT_TWOSIDED_LIGHTING
sbdf=nngluFrontMaterialDiffuse.rgb;
#endif
#endif
#else
sdf=nngluFrontMaterialDiffuse.rgb;
#if NNGLD_OPT_SPECULAR
ssp=vec3(1.0);
#endif
#endif
#if NNGLD_OPT_VTX_COLOR0&&!DV_LT
sdf*=nnglaColor0.rgb;
#if NNGLD_OPT_TWOSIDED_LIGHTING
sbdf*=nnglaColor0.rgb;
#endif
#if NNGLD_OPT_SPECULAR&&NNGLD_PROF_VTX_SPECULAR
#if NNGLD_PROF_VTX_SPECULAR
vec3 l_col2=nnglaColor1.rgb;
#else
vec3 l_col2=vec3(.0);
#endif
ssp*=l_col2;
#if NNGLD_OPT_TWOSIDED_LIGHTING
sbsp*=l_col2;
#endif
#endif
#endif
}
void fcf(){
#if DP_DI(DP8)
float fogdist=abs(vvp.z);
fogdist=(fogdist-2050.0)/100.0;
vf=1.0-clamp(fogdist,.0,1.0);
#endif
}
void fsfo(){
#if DFL||DF_DPM||DPU_WF
vvp=vvp.xyz;
#endif
#if DPU_RT||DPU_RB
vpp=gl_Position;
#endif
#if (DPU_WR||DPU_WS||DPU_NR||DPU_GR)&&((DT_S22!=-1)||(DT_GRD!=-1))
#if NNGLD_OPT_VERTEX_BLEND>0
vphp=nngluProjectionMatrix*vec4(vvp,1.0);
#else
vphp=nngluProjectionMatrix*vec4(vvp,1.0);
#endif
vphp.xy*=vec2(.5,-.5);
#endif
#if NNGLD_OPT_VTX_COLOR0
vfc.rgb=sdf;
vfc.a=nngluFrontMaterialDiffuse.a*nnglaColor0.a;
#elif DV_LT
vfc.rgb=sdf;
vfc.a=1.0;
#endif
#if NNGLD_OPT_TWOSIDED_LIGHTING
vbc.rgb=sbdf;
vbc.a=vfc.a;
#endif
#if NNGLD_OPT_SPECULAR
vfsc.rgb=ssp;
#if NNGLD_OPT_TWOSIDED_LIGHTING
vbsc.rgb=sbsp;
#endif
#endif
#if DFL||DF_DPM
vn=sn;
#if NNGLD_OPT_TANGENT_SPACE
vt=stn;
vb=sbn;
#endif
#endif
#if DFL&&DPU_HE
vhlc=vec3(.0);
#if DPU_HA
vhlc+=shla;
#endif
#if DPU_HB
vhlc+=shlb;
#endif
#endif
}
void main(){
ftvpn();
fctc();
fclam();
fcf();
fsfo();
}
