1 | ///////////////////////////////////////////////////////////////////////////////
|
---|
2 | //
|
---|
3 | // ## ######
|
---|
4 | // ###### ###
|
---|
5 | // ## ############### Shark 3D Engine (www.shark3d.com)
|
---|
6 | // ########## # # #
|
---|
7 | // ######## Copyright (c) 1996-2006 Spinor GmbH.
|
---|
8 | // ######### # # # All rights reserved.
|
---|
9 | // ## ##########
|
---|
10 | // ##
|
---|
11 | //
|
---|
12 | ///////////////////////////////////////////////////////////////////////////////
|
---|
13 |
|
---|
14 | @include "levelutil/shader/prog/ogl_glsl/" \
|
---|
15 | "include_stddef_ogl_glsl_vs1x0.s3d_shadercode_run"
|
---|
16 |
|
---|
17 | ///////////////////////////////////////////////////////////////////////////////
|
---|
18 |
|
---|
19 | S3D_BONE_DECL_STD(boneWgh, boneSubscr)
|
---|
20 | S3D_MATBONE_DECL_STD(matBone)
|
---|
21 |
|
---|
22 | ///////////////////////////////////////////////////////////////////////////////
|
---|
23 |
|
---|
24 |
|
---|
25 | void main(void)
|
---|
26 | {
|
---|
27 | S3D_BONE_TRANSF_STD(matBoneFinal, matBone, boneWgh, boneSubscr);
|
---|
28 | vec4 posView = matBoneFinal * gl_Vertex;
|
---|
29 | vec3 normalView = normalize((matBoneFinal * vec4(gl_Normal, 0.0)).xyz);
|
---|
30 |
|
---|
31 | gl_Position = gl_ProjectionMatrix * posView; //
|
---|
32 | gl_FogFragCoord = posView.z / posView.w;
|
---|
33 |
|
---|
34 | vec4 diffuseOut = gl_FrontMaterial.emission;
|
---|
35 | vec4 specularOut = vec4(0);
|
---|
36 |
|
---|
37 | //!!! hack to detect nvidia
|
---|
38 | #ifdef __GLSL_CG_DATA_TYPES
|
---|
39 | for(int i = 0; i < gl_MaxLights; i++)
|
---|
40 | {
|
---|
41 | s3d_ColPair result;
|
---|
42 | s3d_calcPointLightTerm(
|
---|
43 | result, posView.xyz, normalView, gl_FrontMaterial.shininess,
|
---|
44 | gl_LightSource[i], gl_FrontLightProduct[i]);
|
---|
45 | diffuseOut += result.diffuse;
|
---|
46 | specularOut += result.specular;
|
---|
47 | }
|
---|
48 | #else
|
---|
49 | s3d_ColPair result;
|
---|
50 | s3d_calcPointLightTerm(
|
---|
51 | result, posView.xyz, normalView, gl_FrontMaterial.shininess,
|
---|
52 | gl_LightSource[0], gl_FrontLightProduct[0]);
|
---|
53 | diffuseOut += result.diffuse;
|
---|
54 | specularOut += result.specular;
|
---|
55 |
|
---|
56 | s3d_calcPointLightTerm(
|
---|
57 | result, posView.xyz, normalView, gl_FrontMaterial.shininess,
|
---|
58 | gl_LightSource[1], gl_FrontLightProduct[1]);
|
---|
59 | diffuseOut += result.diffuse;
|
---|
60 | specularOut += result.specular;
|
---|
61 |
|
---|
62 | s3d_calcPointLightTerm(
|
---|
63 | result, posView.xyz, normalView, gl_FrontMaterial.shininess,
|
---|
64 | gl_LightSource[2], gl_FrontLightProduct[2]);
|
---|
65 | diffuseOut += result.diffuse;
|
---|
66 | specularOut += result.specular;
|
---|
67 |
|
---|
68 | #endif
|
---|
69 |
|
---|
70 | gl_FrontColor = diffuseOut;
|
---|
71 | gl_FrontSecondaryColor = specularOut;
|
---|
72 | gl_TexCoord[0] = gl_MultiTexCoord0;
|
---|
73 | gl_TexCoord[1] = gl_MultiTexCoord1;
|
---|
74 | }
|
---|
75 |
|
---|
76 | ///////////////////////////////////////////////////////////////////////////////
|
---|