summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
blob: 7613e50dca936c87195d4cc5bc8101737ef70dad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/** 
 * @file objectSkinV.glsl
 *
 * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
 * $License$
 */



attribute vec4 object_weight;  

uniform mat4 matrixPalette[32];

mat4 getObjectSkinnedTransform()
{
	int i; 
	
	vec4 w = fract(object_weight);
	vec4 index = floor(object_weight);
	
	float scale = 1.0/(w.x+w.y+w.z+w.w);
	w *= scale;
	
	mat4 mat = matrixPalette[int(index.x)]*w.x;
	mat += matrixPalette[int(index.y)]*w.y;
	mat += matrixPalette[int(index.z)]*w.z;
	mat += matrixPalette[int(index.w)]*w.w;
		
	return mat;
}