|
#version 400
|
|
|
|
|
|
|
|
|
|
#define SAMPLER_BINDING(x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define float2 vec2
|
|
#define float3 vec3
|
|
#define float4 vec4
|
|
#define uint2 uvec2
|
|
#define uint3 uvec3
|
|
#define uint4 uvec4
|
|
#define int2 ivec2
|
|
#define int3 ivec3
|
|
#define int4 ivec4
|
|
#define frac fract
|
|
#define lerp mix
|
|
struct Light {
|
|
int4 color;
|
|
float4 cosatt;
|
|
float4 distatt;
|
|
float4 pos;
|
|
float4 dir;
|
|
};
|
|
layout(std140) uniform VSBlock {
|
|
float4 cpnmtx[6];
|
|
float4 cproj[4];
|
|
int4 cmtrl[4];
|
|
Light clights[8];
|
|
float4 ctexmtx[24];
|
|
float4 ctrmtx[64];
|
|
float4 cnmtx[32];
|
|
float4 cpostmtx[64];
|
|
float4 cpixelcenter;
|
|
};
|
|
struct VS_OUTPUT {
|
|
float4 pos;
|
|
float4 colors_0;
|
|
float4 colors_1;
|
|
float3 tex0;
|
|
float4 clipPos;
|
|
float3 Normal;
|
|
float3 WorldPos;
|
|
float clipDist0;
|
|
float clipDist1;
|
|
};
|
|
in float4 rawpos; // ATTR0,
|
|
in float4 color0; // ATTR5,
|
|
in float2 tex0; // ATTR8,
|
|
out VertexData {
|
|
centroid float4 pos;
|
|
centroid float4 colors_0;
|
|
centroid float4 colors_1;
|
|
centroid float3 tex0;
|
|
centroid float4 clipPos;
|
|
centroid float3 Normal;
|
|
centroid float3 WorldPos;
|
|
centroid float clipDist0;
|
|
centroid float clipDist1;
|
|
} vs;
|
|
void main()
|
|
{
|
|
VS_OUTPUT o;
|
|
float4 pos = float4(dot(cpnmtx[0], rawpos), dot(cpnmtx[1], rawpos), dot(cpnmtx[2], rawpos), 1.0);
|
|
float3 _norm0 = float3(0.0, 0.0, 0.0);
|
|
o.pos = float4(dot(cproj[0], pos), dot(cproj[1], pos), dot(cproj[2], pos), dot(cproj[3], pos));
|
|
int4 lacc;
|
|
float3 ldir, h, cosAttn, distAttn;
|
|
float dist, dist2, attn;
|
|
{
|
|
int4 mat = int4(round(color0 * 255.0));
|
|
lacc = int4(255, 255, 255, 255);
|
|
lacc.w = 255;
|
|
lacc = clamp(lacc, 0, 255);
|
|
o.colors_0 = float4((mat * (lacc + (lacc >> 7))) >> 8) / 255.0;
|
|
}
|
|
o.colors_1 = o.colors_0;
|
|
float4 coord = float4(0.0, 0.0, 1.0, 1.0);
|
|
{
|
|
coord = float4(0.0, 0.0, 1.0, 1.0);
|
|
coord = float4(tex0.x, tex0.y, 1.0, 1.0);
|
|
coord.z = 1.0;
|
|
o.tex0.xyz = float3(dot(coord, ctexmtx[0]), dot(coord, ctexmtx[1]), 1);
|
|
float4 P0 = cpostmtx[61];
|
|
float4 P1 = cpostmtx[62];
|
|
float4 P2 = cpostmtx[63];
|
|
o.tex0.xyz = float3(dot(P0.xyz, o.tex0.xyz) + P0.w, dot(P1.xyz, o.tex0.xyz) + P1.w, dot(P2.xyz, o.tex0.xyz) + P2.w);
|
|
if(o.tex0.z == 0.0f)
|
|
o.tex0.xy = clamp(o.tex0.xy / 2.0f, float2(-1.0f,-1.0f), float2(1.0f,1.0f));
|
|
}
|
|
o.clipPos = o.pos;
|
|
o.Normal = _norm0;
|
|
o.WorldPos = pos.xyz;
|
|
o.colors_0 = color0;
|
|
float clipDepth = o.pos.z * (1.0 - 1e-7);
|
|
o.clipDist0 = clipDepth + o.pos.w;
|
|
o.clipDist1 = -clipDepth;
|
|
o.pos.z = o.pos.w * cpixelcenter.w - o.pos.z * cpixelcenter.z;
|
|
o.pos.z = o.pos.z * 2.0 - o.pos.w;
|
|
o.pos.xy = o.pos.xy - o.pos.w * cpixelcenter.xy;
|
|
vs.pos = o.pos;
|
|
vs.colors_0 = o.colors_0;
|
|
vs.colors_1 = o.colors_1;
|
|
vs.tex0 = o.tex0;
|
|
vs.clipPos = o.clipPos;
|
|
vs.Normal = o.Normal;
|
|
vs.WorldPos = o.WorldPos;
|
|
vs.clipDist0 = o.clipDist0;
|
|
vs.clipDist1 = o.clipDist1;
|
|
gl_ClipDistance[0] = o.clipDist0;
|
|
gl_ClipDistance[1] = o.clipDist1;
|
|
gl_Position = o.pos;
|
|
}
|
|
ERROR: 0:64: 'centroid', 'sample' and 'patch' must be directly followed by 'in', 'out' or 'varying'
|
|
ERROR: 0:114: Use of undeclared identifier 'vs'
|
|
ERROR: 0:115: Use of undeclared identifier 'vs'
|
|
ERROR: 0:116: Use of undeclared identifier 'vs'
|
|
ERROR: 0:117: Use of undeclared identifier 'vs'
|
|
ERROR: 0:118: Use of undeclared identifier 'vs'
|
|
ERROR: 0:119: Use of undeclared identifier 'vs'
|
|
ERROR: 0:120: Use of undeclared identifier 'vs'
|
|
ERROR: 0:121: Use of undeclared identifier 'vs'
|
|
ERROR: 0:122: Use of undeclared identifier 'vs'
|