source: GTP/trunk/App/Demos/Illum/Shark3D/version164x12u/IllumDemo/src/res/levelutil/shader/prog/d3d9_hlsl/bloom_smooth_d3d9_hlsl_vs1x1.s3d_shadercode @ 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
14struct VS_INPUT
15{
16    float4 posObj: POSITION;
17    float2 mainTexCoord: TEXCOORD0;
18};
19
20struct VS_OUTPUT
21{
22    float4 posScr: POSITION;
23    float fog: FOG;
24    float4 diffuse: COLOR0;
25    float2 mainTexCoord: TEXCOORD0;
26    float4 baseVec: TEXCOORD2;
27};
28
29///////////////////////////////////////////////////////////////////////////////
30
31const float4x4 matProjView;
32const float4x4 matView;
33const float4 mtrlEmissive;
34
35const float4 passInfo;
36const float4 tex0RcpSize;
37
38///////////////////////////////////////////////////////////////////////////////
39// Vertexshader
40// Profile: 1x1
41
42VS_OUTPUT main( VS_INPUT input )
43{
44    VS_OUTPUT output = (VS_OUTPUT)0;
45
46    //Transform position to clip space
47    output.posScr = mul(input.posObj, matProjView);
48
49    //Transform position to eye space -> pos
50    float4 posView = mul(input.posObj, matView);
51
52    //fog
53    output.fog = posView.z / posView.w;
54
55    //Color
56    output.diffuse = mtrlEmissive;
57
58    // Texture coordinates
59    output.mainTexCoord = input.mainTexCoord;
60
61    // Scaling offset
62    int iter = passInfo.x;
63
64    float2 offsScale = tex0RcpSize * pow(2, iter) * 0.5;
65
66    float4 dirVec;
67    int fiter = fmod(iter, 4.0);
68    if(fiter < 2.0)
69    {
70        if(fiter < 1.0)
71            dirVec = float4(1, 0, 0, 1); // Vectors (1, 0) and (0, 1)
72        else
73            dirVec = float4(1, 1,-1, 1); // Vectors (1, 1) and (-1, 1)
74    }
75    else
76    {
77        if(fiter < 3.0)
78            dirVec = float4(2, 1,-1, 2); // Vectors (2, 1) and (-1, 2)
79        else
80            dirVec = float4(1, 2,-2, 1); // Vectors (1, 2) and (-2, 1)
81    }
82   
83    output.baseVec = dirVec * offsScale.xyxy;
84
85    return output;
86}
87
88///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.