Skip to content

Commit

Permalink
shaders: Always use floating points for texture coordinates.
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossVR committed Mar 24, 2016
1 parent a1e13c8 commit eb7dbfc
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 42 deletions.
8 changes: 3 additions & 5 deletions res/gamedata/shaders/gl/iostructs/v_model_bump.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ layout(location = BINORMAL) in float4 v_model_B ; // BINORMAL; // (nx,ny,nz,w
layout(location = TANGENT) in float3 v_model_T ; // TANGENT; // (nx,ny,nz)
layout(location = BINORMAL) in float3 v_model_B ; // BINORMAL; // (nx,ny,nz)
#endif
#ifdef SKIN_NONE
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#elif defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in int4 v_model_tc ; // TEXCOORD0; // (u,v)
#if defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in float4 v_model_tc ; // TEXCOORD0; // (u,v)
#else
layout(location = TEXCOORD0) in int2 v_model_tc ; // TEXCOORD0; // (u,v)
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#endif
#ifdef SKIN_4
layout(location = TEXCOORD1) in float4 v_model_ind ; // (x=m-index0, y=m-index1, z=m-index2, w=m-index3)
Expand Down
8 changes: 3 additions & 5 deletions res/gamedata/shaders/gl/iostructs/v_model_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ layout(location = BINORMAL) in float4 v_model_B ; // BINORMAL; // (nx,ny,nz,w
layout(location = TANGENT) in float3 v_model_T ; // TANGENT; // (nx,ny,nz)
layout(location = BINORMAL) in float3 v_model_B ; // BINORMAL; // (nx,ny,nz)
#endif
#ifdef SKIN_NONE
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#elif defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in int4 v_model_tc ; // TEXCOORD0; // (u,v)
#if defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in float4 v_model_tc ; // TEXCOORD0; // (u,v)
#else
layout(location = TEXCOORD0) in int2 v_model_tc ; // TEXCOORD0; // (u,v)
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#endif
#ifdef SKIN_4
layout(location = TEXCOORD1) in float4 v_model_ind ; // (x=m-index0, y=m-index1, z=m-index2, w=m-index3)
Expand Down
8 changes: 3 additions & 5 deletions res/gamedata/shaders/gl/iostructs/v_model_distort.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ layout(location = BINORMAL) in float4 v_model_B ; // BINORMAL; // (nx,ny,nz,w
layout(location = TANGENT) in float3 v_model_T ; // TANGENT; // (nx,ny,nz)
layout(location = BINORMAL) in float3 v_model_B ; // BINORMAL; // (nx,ny,nz)
#endif
#ifdef SKIN_NONE
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#elif defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in int4 v_model_tc ; // TEXCOORD0; // (u,v)
#if defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in float4 v_model_tc ; // TEXCOORD0; // (u,v)
#else
layout(location = TEXCOORD0) in int2 v_model_tc ; // TEXCOORD0; // (u,v)
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#endif
#ifdef SKIN_4
layout(location = TEXCOORD1) in float4 v_model_ind ; // (x=m-index0, y=m-index1, z=m-index2, w=m-index3)
Expand Down
8 changes: 3 additions & 5 deletions res/gamedata/shaders/gl/iostructs/v_model_flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ layout(location = BINORMAL) in float4 v_model_B ; // BINORMAL; // (nx,ny,nz,w
layout(location = TANGENT) in float3 v_model_T ; // TANGENT; // (nx,ny,nz)
layout(location = BINORMAL) in float3 v_model_B ; // BINORMAL; // (nx,ny,nz)
#endif
#ifdef SKIN_NONE
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#elif defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in int4 v_model_tc ; // TEXCOORD0; // (u,v)
#if defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in float4 v_model_tc ; // TEXCOORD0; // (u,v)
#else
layout(location = TEXCOORD0) in int2 v_model_tc ; // TEXCOORD0; // (u,v)
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#endif
#ifdef SKIN_4
layout(location = TEXCOORD1) in float4 v_model_ind ; // (x=m-index0, y=m-index1, z=m-index2, w=m-index3)
Expand Down
8 changes: 3 additions & 5 deletions res/gamedata/shaders/gl/iostructs/v_model_shadow.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ layout(location = BINORMAL) in float4 v_model_B ; // BINORMAL; // (nx,ny,nz,w
layout(location = TANGENT) in float3 v_model_T ; // TANGENT; // (nx,ny,nz)
layout(location = BINORMAL) in float3 v_model_B ; // BINORMAL; // (nx,ny,nz)
#endif
#ifdef SKIN_NONE
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#elif defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in int4 v_model_tc ; // TEXCOORD0; // (u,v)
#if defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in float4 v_model_tc ; // TEXCOORD0; // (u,v)
#else
layout(location = TEXCOORD0) in int2 v_model_tc ; // TEXCOORD0; // (u,v)
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#endif
#ifdef SKIN_4
layout(location = TEXCOORD1) in float4 v_model_ind ; // (x=m-index0, y=m-index1, z=m-index2, w=m-index3)
Expand Down
8 changes: 3 additions & 5 deletions res/gamedata/shaders/gl/iostructs/v_model_shadow_aref.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ layout(location = BINORMAL) in float4 v_model_B ; // BINORMAL; // (nx,ny,nz,w
layout(location = TANGENT) in float3 v_model_T ; // TANGENT; // (nx,ny,nz)
layout(location = BINORMAL) in float3 v_model_B ; // BINORMAL; // (nx,ny,nz)
#endif
#ifdef SKIN_NONE
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#elif defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in int4 v_model_tc ; // TEXCOORD0; // (u,v)
#if defined(SKIN_2) || defined(SKIN_3)
layout(location = TEXCOORD0) in float4 v_model_tc ; // TEXCOORD0; // (u,v)
#else
layout(location = TEXCOORD0) in int2 v_model_tc ; // TEXCOORD0; // (u,v)
layout(location = TEXCOORD0) in float2 v_model_tc ; // TEXCOORD0; // (u,v)
#endif
#ifdef SKIN_4
layout(location = TEXCOORD1) in float4 v_model_ind ; // (x=m-index0, y=m-index1, z=m-index2, w=m-index3)
Expand Down
6 changes: 3 additions & 3 deletions res/gamedata/shaders/gl/iostructs/v_shadow_aref.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ out gl_PerVertex { vec4 gl_Position; };
struct a2v
{
float4 P ; // POSITION; // Object-space position
int2 tc0 ; // TEXCOORD0; // Texture coordinates
float2 tc0 ; // TEXCOORD0; // Texture coordinates
};

layout(location = NORMAL) in float4 v_static_Nh ; // NORMAL; // (nx,ny,nz,hemi occlusion)
layout(location = TANGENT) in float4 v_static_T ; // TANGENT; // tangent
layout(location = BINORMAL) in float4 v_static_B ; // BINORMAL; // binormal
layout(location = TEXCOORD0) in int2 v_static_tc ; // TEXCOORD0; // (u,v)
layout(location = TEXCOORD0) in float2 v_static_tc ; // TEXCOORD0; // (u,v)
#ifdef USE_LM_HEMI
layout(location = TEXCOORD1) in int2 v_static_lmh ; // TEXCOORD1; // (lmu,lmv)
layout(location = TEXCOORD1) in float2 v_static_lmh ; // TEXCOORD1; // (lmu,lmv)
#endif
layout(location = POSITION) in float4 v_static_P ; // POSITION; // (float,float,float,1)

Expand Down
4 changes: 2 additions & 2 deletions res/gamedata/shaders/gl/iostructs/v_static_bump.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ out gl_PerVertex { vec4 gl_Position; };
layout(location = NORMAL) in float4 v_static_Nh ; // NORMAL; // (nx,ny,nz,hemi occlusion)
layout(location = TANGENT) in float4 v_static_T ; // TANGENT; // tangent
layout(location = BINORMAL) in float4 v_static_B ; // BINORMAL; // binormal
layout(location = TEXCOORD0) in int2 v_static_tc ; // TEXCOORD0; // (u,v)
layout(location = TEXCOORD0) in float2 v_static_tc ; // TEXCOORD0; // (u,v)
#ifdef USE_LM_HEMI
layout(location = TEXCOORD1) in int2 v_static_lmh ; // TEXCOORD1; // (lmu,lmv)
layout(location = TEXCOORD1) in float2 v_static_lmh ; // TEXCOORD1; // (lmu,lmv)
#endif
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
layout(location = COLOR0) in float4 v_static_color ; // COLOR0; // (r,g,b,dir-occlusion) // Swizzle before use!!!
Expand Down
4 changes: 2 additions & 2 deletions res/gamedata/shaders/gl/iostructs/v_static_flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ out gl_PerVertex { vec4 gl_Position; };
layout(location = NORMAL) in float4 v_static_Nh ; // NORMAL; // (nx,ny,nz,hemi occlusion)
layout(location = TANGENT) in float4 v_static_T ; // TANGENT; // tangent
layout(location = BINORMAL) in float4 v_static_B ; // BINORMAL; // binormal
layout(location = TEXCOORD0) in int2 v_static_tc ; // TEXCOORD0; // (u,v)
layout(location = TEXCOORD0) in float2 v_static_tc ; // TEXCOORD0; // (u,v)
#ifdef USE_LM_HEMI
layout(location = TEXCOORD1) in int2 v_static_lmh ; // TEXCOORD1; // (lmu,lmv)
layout(location = TEXCOORD1) in float2 v_static_lmh ; // TEXCOORD1; // (lmu,lmv)
#endif
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
layout(location = COLOR0) in float4 v_static_color ; // COLOR0; // (r,g,b,dir-occlusion) // Swizzle before use!!!
Expand Down
10 changes: 5 additions & 5 deletions res/gamedata/shaders/gl/skin.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ struct v_model_skinned_0
float3 N ; // NORMAL; // normal // DWORD
float3 T ; // TANGENT; // tangent // DWORD
float3 B ; // BINORMAL; // binormal // DWORD
int2 tc ; // TEXCOORD0;// (u,v) // short2
float2 tc ; // TEXCOORD0;// (u,v) // short2
};
struct v_model_skinned_1 // 24 bytes
{
float4 P ; // POSITION; // (float,float,float,1) - quantized // short4
float4 N ; // NORMAL; // (nx,ny,nz,index) // DWORD
float3 T ; // TANGENT; // tangent // DWORD
float3 B ; // BINORMAL; // binormal // DWORD
int2 tc ; // TEXCOORD0;// (u,v) // short2
float2 tc ; // TEXCOORD0;// (u,v) // short2
};
struct v_model_skinned_2 // 28 bytes
{
float4 P ; // POSITION; // (float,float,float,1) - quantized // short4
float4 N ; // NORMAL; // (nx,ny,nz,weight) // DWORD
float3 T ; // TANGENT; // tangent // DWORD
float3 B ; // BINORMAL; // binormal // DWORD
int4 tc ; // TEXCOORD0; // (u,v, w=m-index0, z=m-index1) // short4
float4 tc ; // TEXCOORD0; // (u,v, w=m-index0, z=m-index1) // short4
};

struct v_model_skinned_3 // 28 bytes
Expand All @@ -34,7 +34,7 @@ struct v_model_skinned_3 // 28 bytes
float4 N ; // NORMAL; // (nx,ny,nz,weight0) // DWORD
float4 T ; // TANGENT; // (tx,ty,tz,weight1) // DWORD
float4 B ; // BINORMAL; // (bx,by,bz,m-index2) // DWORD
int4 tc ; // TEXCOORD0; // (u,v, w=m-index0, z=m-index1) // short4
float4 tc ; // TEXCOORD0; // (u,v, w=m-index0, z=m-index1) // short4
};

struct v_model_skinned_4 // 28 bytes
Expand All @@ -43,7 +43,7 @@ struct v_model_skinned_4 // 28 bytes
float4 N ; // NORMAL; // (nx,ny,nz,weight0) // DWORD
float4 T ; // TANGENT; // (tx,ty,tz,weight1) // DWORD
float4 B ; // BINORMAL; // (bx,by,bz,weight2) // DWORD
int2 tc ; // TEXCOORD0;// (u,v) // short2
float2 tc ; // TEXCOORD0;// (u,v) // short2
float4 ind ; // TEXCOORD1;// (x=m-index0, y=m-index1, z=m-index2, w=m-index3) // DWORD
};

Expand Down

0 comments on commit eb7dbfc

Please sign in to comment.