source: GTP/trunk/App/Demos/Illum/IBRBillboardCloudTrees/Shark3D/demo_v5x0x7_t164x31u_enterpr_kwin32/bin/res/levelutil/shader/prog/d3d9_hlsl/bloom_smooth_d3d9_hlsl_vs1x1.s3d_shadercode_run @ 2330

Revision 2330, 2.3 KB checked in by igarcia, 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    // Use fractional basis value to reduce banding:
65    float2 offsScale = tex0RcpSize * pow(2.1, iter) * 0.5;
66
67    float4 dirVec;
68    int fiter = fmod(iter, 4.0);
69    if(fiter < 2.0)
70    {
71        if(fiter < 1.0)
72            dirVec = float4(1, 0, 0, 1); // Vectors (1, 0) and (0, 1)
73        else
74            dirVec = float4(1, 1,-1, 1); // Vectors (1, 1) and (-1, 1)
75    }
76    else
77    {
78        if(fiter < 3.0)
79            dirVec = float4(2, 1,-1, 2); // Vectors (2, 1) and (-1, 2)
80        else
81            dirVec = float4(1, 2,-2, 1); // Vectors (1, 2) and (-2, 1)
82    }
83   
84    output.baseVec = dirVec * offsScale.xyxy;
85
86    return output;
87}
88
89///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.