Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Cg/oceanHLSL_Cg.vert @ 12302

Last change on this file since 12302 was 12115, checked in by wiesep, 6 years ago

Changed folder structure, deletet some unused files and cleaned up code

File size: 1.1 KB
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
10struct VS_OUTPUT {
11   float4 Pos:    POSITION;
12   float3 uvw:    TEXCOORD0;
13   float3 normal: TEXCOORD1;
14   float3 vVec:   TEXCOORD2;
15};
16
17VS_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.xz += waveSpeed * time_0_X;
34   Out.uvw.y += Out.uvw.z + noiseSpeed * time_0_X;
35   
36   //  the view vector needs to be in vertex space
37   Out.vVec = Pos.xyz - eyePosition;
38   Out.normal = normal;
39
40   return Out;
41}
Note: See TracBrowser for help on using the repository browser.