1
0
forked from 0ad/0ad
0ad/binaries/data/mods/_test.minimal/shaders/instancing_base.vs
Ykkrosh 207d54e825 # Added command-line launching of mods.
Run with "-mod=official" for the default behaviour (same as specifying
nothing), and with "-mod=official -mod=antigravity -mod=starwars" to
load multiple mods (with the later-mentioned ones having a higher
priority than the earlier ones).
Added "_test.minimal" mod which can be used instead of "official" - it
provides just enough for the actor viewer to run, plus one unit skin.
Added test script for the COLLADA converter, which converts the models
and creates some actors in a "_test.collada" mod. Then the actor viewer
can be run with _test.minimal + _test.collada, to see if it's working
correctly.

This was SVN commit r4690.
2006-12-09 15:47:12 +00:00

30 lines
622 B
GLSL

// 3x4 part of the model-to-world matrix
attribute vec4 Instancing1;
attribute vec4 Instancing2;
attribute vec4 Instancing3;
// Calculate a normal that has been transformed for instancing
vec3 InstancingNormal(vec3 normal)
{
vec3 tmp;
tmp.x = dot(vec3(Instancing1), normal);
tmp.y = dot(vec3(Instancing2), normal);
tmp.z = dot(vec3(Instancing3), normal);
return tmp;
}
// Calculate position, transformed for instancing
vec4 InstancingPosition(vec4 position)
{
vec3 tmp;
tmp.x = dot(Instancing1, position);
tmp.y = dot(Instancing2, position);
tmp.z = dot(Instancing3, position);
return vec4(tmp, 1.0);
}