PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl

https://bitbucket.org/lindenlab/viewer-beta/
Unknown | 47 lines | 38 code | 9 blank | 0 comment | 0 complexity | 875d467261ced1125ff58c6677d0009b MD5 | raw file
 1/** 
 2 * @file objectSkinV.glsl
 3 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
 4 * Second Life Viewer Source Code
 5 * Copyright (C) 2007, Linden Research, Inc.
 6 * 
 7 * This library is free software; you can redistribute it and/or
 8 * modify it under the terms of the GNU Lesser General Public
 9 * License as published by the Free Software Foundation;
10 * version 2.1 of the License only.
11 * 
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Lesser General Public License for more details.
16 * 
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20 * 
21 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
22 * $/LicenseInfo$
23 */
24
25
26
27ATTRIBUTE vec4 weight4;  
28
29uniform mat4 matrixPalette[32];
30
31mat4 getObjectSkinnedTransform()
32{
33	int i; 
34	
35	vec4 w = fract(weight4);
36	vec4 index = floor(weight4);
37	
38	float scale = 1.0/(w.x+w.y+w.z+w.w);
39	w *= scale;
40	
41	mat4 mat = matrixPalette[int(index.x)]*w.x;
42	mat += matrixPalette[int(index.y)]*w.y;
43	mat += matrixPalette[int(index.z)]*w.z;
44	mat += matrixPalette[int(index.w)]*w.w;
45		
46	return mat;
47}