Revision 692,
1.1 KB
checked in by mattausch, 19 years ago
(diff) |
adding ogre 1.2 and dependencies
|
Line | |
---|
1 | // oceanHLSL_Cg.vert |
---|
2 | // vertex program for Ocean water simulation |
---|
3 | // 04 Aug 2005 |
---|
4 | // adapted for Ogre by nfz |
---|
5 | // original shader source from Render Monkey 1.6 Reflections Refractions.rfx |
---|
6 | // can be used in both Cg and HLSL compilers |
---|
7 | |
---|
8 | // 06 Aug 2005: moved uvw calculation from fragment program into vertex program |
---|
9 | |
---|
10 | struct VS_OUTPUT { |
---|
11 | float4 Pos: POSITION; |
---|
12 | float3 uvw: TEXCOORD0; |
---|
13 | float3 normal: TEXCOORD1; |
---|
14 | float3 vVec: TEXCOORD2; |
---|
15 | }; |
---|
16 | |
---|
17 | VS_OUTPUT main(float4 Pos: POSITION, float3 normal: NORMAL, |
---|
18 | uniform float4x4 worldViewProj_matrix, |
---|
19 | uniform float3 scale, |
---|
20 | uniform float2 waveSpeed, |
---|
21 | uniform float noiseSpeed, |
---|
22 | uniform float time_0_X, |
---|
23 | uniform float3 eyePosition |
---|
24 | |
---|
25 | ) |
---|
26 | { |
---|
27 | VS_OUTPUT Out; |
---|
28 | |
---|
29 | Out.Pos = mul(worldViewProj_matrix, Pos); |
---|
30 | |
---|
31 | // uvw is the calculated uvw coordinates based on vertex position |
---|
32 | Out.uvw = Pos.xyz * scale; |
---|
33 | Out.uvw.x += waveSpeed.x * time_0_X; |
---|
34 | Out.uvw.z += waveSpeed.y * time_0_X; |
---|
35 | Out.uvw.y += Out.uvw.z + noiseSpeed * time_0_X; |
---|
36 | |
---|
37 | // the view vector needs to be in vertex space |
---|
38 | Out.vVec = Pos.xyz - eyePosition; |
---|
39 | Out.normal = normal; |
---|
40 | |
---|
41 | return Out; |
---|
42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.