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

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

https://bitbucket.org/lindenlab/viewer-beta/
Unknown | 70 lines | 54 code | 16 blank | 0 comment | 0 complexity | 40251e457061d946bebcf1bbd17a3bc0 MD5 | raw file
 1/** 
 2 * @file avatarV.glsl
 3 *
 4 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
 5 * Second Life Viewer Source Code
 6 * Copyright (C) 2007, Linden Research, Inc.
 7 * 
 8 * This library is free software; you can redistribute it and/or
 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation;
11 * version 2.1 of the License only.
12 * 
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Lesser General Public License for more details.
17 * 
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 * 
22 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
23 * $/LicenseInfo$
24 */
25
26uniform mat4 projection_matrix;
27
28ATTRIBUTE vec3 position;
29ATTRIBUTE vec3 normal;
30ATTRIBUTE vec2 texcoord0;
31
32VARYING vec4 vertex_color;
33VARYING vec2 vary_texcoord0;
34
35uniform vec4 color;
36
37vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
38mat4 getSkinnedTransform();
39void calcAtmospherics(vec3 inPositionEye);
40
41void main()
42{
43	vary_texcoord0 = texcoord0;
44				
45	vec4 pos;
46	vec3 norm;
47	
48	vec4 pos_in = vec4(position.xyz, 1.0);
49
50	mat4 trans = getSkinnedTransform();
51	pos.x = dot(trans[0], pos_in);
52	pos.y = dot(trans[1], pos_in);
53	pos.z = dot(trans[2], pos_in);
54	pos.w = 1.0;
55	
56	norm.x = dot(trans[0].xyz, normal);
57	norm.y = dot(trans[1].xyz, normal);
58	norm.z = dot(trans[2].xyz, normal);
59	norm = normalize(norm);
60		
61	gl_Position = projection_matrix * pos;
62	
63	calcAtmospherics(pos.xyz);
64
65	vec4 col = calcLighting(pos.xyz, norm, color, vec4(0,0,0,0));
66	vertex_color = col; 
67
68}
69
70