source: GTP/trunk/App/Demos/Illum/Shark3D/version164x12u/IllumDemo/bin/res/levelutil/shader/prog/d3d9_hlsl/gtp_envmapSimple_d3d9_hlsl_vs1x1.s3d_shadercode_run @ 2196

Revision 2196, 2.2 KB checked in by szirmay, 17 years ago (diff)
Line 
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 \
15    <levelutil/shader/prog/d3d9_hlsl/include_stddef_d3d9_hlsl.s3d_shadercode_run>
16
17///////////////////////////////////////////////////////////////////////////////
18
19struct VS_INPUT
20{
21    float4 posObj: POSITION;
22    S3D_BONE_DECL_STD(boneWgh, boneSubscr)
23    float2 tex0:TEXCOORD0;
24   float3 normal:NORMAL;
25};
26
27struct VS_OUTPUT
28{
29    float4 posScr : POSITION;
30    float3 eye    : TEXCOORD0;
31    float3 normal : TEXCOORD1;
32    float3 posView: TEXCOORD2;   
33};
34
35///////////////////////////////////////////////////////////////////////////////
36
37const float4x4 matProj;
38const float4x4 matProjView;
39const float4x4 matView;
40const float4x4 matViewInvTrans;
41S3D_MATBONE_DECL_STD(matBone)
42
43
44///////////////////////////////////////////////////////////////////////////////
45// Vertexshader
46// Profile: 1x1
47float4 last_Center;
48float4x4 worldMat;
49float4x4 worldMatIT;
50
51VS_OUTPUT main(VS_INPUT input)
52{
53    VS_OUTPUT output = (VS_OUTPUT)0;
54
55    float4x4 matBoneFinal;
56    S3D_BONE_TRANSF_STD(matBoneFinal, matBone, input.boneWgh, input.boneSubscr);
57    // Transform vectors by matBoneFinal
58    float4 posView = mul(input.posObj, matBoneFinal);
59   
60    output.posScr = mul(posView, matProj);
61   
62    // vector from vertex to the eye in view-space
63    //output.eye = mul(input.posObj, matView);   
64    //output.normal = mul(input.normal, matViewInvTrans);
65    //output.posView = mul(float4(input.posObj.xyz, 0), matView);
66
67    output.normal = mul(mul(input.normal, matViewInvTrans), worldMatIT);
68    output.eye = mul(posView, worldMatIT).xyz;
69    output.posView = mul(posView, worldMat);
70    output.posView -= last_Center;   
71
72    return output;
73}
74
75///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.