mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-24 16:48:18 -05:00
Reversed instance data bindings. Issue #309.
This commit is contained in:
parent
5ac092d036
commit
9d91d3bbbc
14 changed files with 14 additions and 23 deletions
|
@ -2,8 +2,8 @@ vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0);
|
|||
|
||||
vec3 a_position : POSITION;
|
||||
vec4 a_color0 : COLOR0;
|
||||
vec4 i_data0 : TEXCOORD3;
|
||||
vec4 i_data1 : TEXCOORD4;
|
||||
vec4 i_data0 : TEXCOORD7;
|
||||
vec4 i_data1 : TEXCOORD6;
|
||||
vec4 i_data2 : TEXCOORD5;
|
||||
vec4 i_data3 : TEXCOORD6;
|
||||
vec4 i_data4 : TEXCOORD7;
|
||||
vec4 i_data3 : TEXCOORD4;
|
||||
vec4 i_data4 : TEXCOORD3;
|
||||
|
|
|
@ -9,7 +9,7 @@ vec3 a_position : POSITION;
|
|||
vec4 a_normal : NORMAL;
|
||||
vec4 a_tangent : TANGENT;
|
||||
vec2 a_texcoord0 : TEXCOORD0;
|
||||
vec4 i_data0 : TEXCOORD4;
|
||||
vec4 i_data1 : TEXCOORD5;
|
||||
vec4 i_data2 : TEXCOORD6;
|
||||
vec4 i_data3 : TEXCOORD7;
|
||||
vec4 i_data0 : TEXCOORD7;
|
||||
vec4 i_data1 : TEXCOORD6;
|
||||
vec4 i_data2 : TEXCOORD5;
|
||||
vec4 i_data3 : TEXCOORD4;
|
||||
|
|
|
@ -8,8 +8,3 @@ vec3 a_position : POSITION;
|
|||
vec4 a_normal : NORMAL;
|
||||
vec4 a_color0 : COLOR0;
|
||||
vec2 a_texcoord0 : TEXCOORD0;
|
||||
vec4 i_data0 : TEXCOORD3;
|
||||
vec4 i_data1 : TEXCOORD4;
|
||||
vec4 i_data2 : TEXCOORD5;
|
||||
vec4 i_data3 : TEXCOORD6;
|
||||
vec4 i_data4 : TEXCOORD7;
|
||||
|
|
|
@ -11,7 +11,3 @@ vec4 a_normal : NORMAL;
|
|||
vec4 a_tangent : TANGENT;
|
||||
vec2 a_texcoord0 : TEXCOORD0;
|
||||
vec4 a_color0 : COLOR0;
|
||||
vec4 i_data0 : TEXCOORD4;
|
||||
vec4 i_data1 : TEXCOORD5;
|
||||
vec4 i_data2 : TEXCOORD6;
|
||||
vec4 i_data3 : TEXCOORD7;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vec2 a_position : POSITION;
|
||||
vec4 i_data3 : TEXCOORD7;
|
||||
vec4 i_data0 : TEXCOORD7;
|
||||
|
||||
vec3 v_texCoord : TEXCOORD0 = vec3(0.0, 0.0, 0.0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$input a_position, i_data3
|
||||
$input a_position, i_data0
|
||||
$output v_texCoord
|
||||
|
||||
/*
|
||||
|
@ -11,13 +11,13 @@ $output v_texCoord
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 eye = mul(u_view, vec4(i_data3.xyz, 1.0) ).xyz;
|
||||
vec3 eye = mul(u_view, vec4(i_data0.xyz, 1.0) ).xyz;
|
||||
vec3 up = normalize(cross(eye, vec3(1.0, 0.0, 0.0) ) );
|
||||
vec3 right = normalize(cross(up, eye));
|
||||
float size = u_particleSize;
|
||||
vec3 position = eye + size * right * a_position.x + size * up * a_position.y;
|
||||
|
||||
v_texCoord.xy = a_position;
|
||||
v_texCoord.z = i_data3.w;
|
||||
v_texCoord.z = i_data0.w;
|
||||
gl_Position = mul(u_proj, vec4(position, 1.0) );
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1600,7 +1600,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
|||
|
||||
for (uint32_t ii = 0; ii < _numInstanceData; ++ii)
|
||||
{
|
||||
uint32_t index = 8-_numInstanceData+ii;
|
||||
uint32_t index = 7-ii; // TEXCOORD7 = i_data0, TEXCOORD6 = i_data1, etc.
|
||||
|
||||
uint32_t jj;
|
||||
D3D11_INPUT_ELEMENT_DESC* curr = vertexElements;
|
||||
|
|
|
@ -1970,7 +1970,7 @@ namespace bgfx { namespace d3d9
|
|||
for (uint8_t ii = 0; ii < _numInstanceData; ++ii)
|
||||
{
|
||||
memcpy(elem, &inst, sizeof(D3DVERTEXELEMENT9) );
|
||||
elem->UsageIndex = uint8_t(8-_numInstanceData+ii);
|
||||
elem->UsageIndex = uint8_t(7-ii); // TEXCOORD7 = i_data0, TEXCOORD6 = i_data1, etc.
|
||||
elem->Offset = ii*16;
|
||||
++elem;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue