SICALLBACK aaOcean_BeginEvaluate( ICENodeContext& in_ctxt ) { // get ocean pointer from user-data aaOcean *pOcean = (aaOcean *)(CValue::siPtrType)in_ctxt.GetUserData(); // get ICE node input port arrays CDataArrayLong PointID( in_ctxt, ID_IN_PointID); CDataArrayLong resolution( in_ctxt, ID_IN_RESOLUTION); CDataArrayLong seed( in_ctxt, ID_IN_SEED); CDataArrayFloat waveHeight( in_ctxt, ID_IN_WAVE_HEIGHT); CDataArrayFloat waveSpeed( in_ctxt, ID_IN_WAVESPEED); CDataArrayFloat chop( in_ctxt, ID_IN_CHOP); CDataArrayFloat oceanScale( in_ctxt, ID_IN_OCEAN_SCALE ); CDataArrayFloat oceanDepth( in_ctxt, ID_IN_OCEAN_DEPTH ); CDataArrayFloat windDir( in_ctxt, ID_IN_WINDDIR ); CDataArrayFloat cutoff( in_ctxt, ID_IN_CUTOFF); CDataArrayFloat velocity( in_ctxt, ID_IN_WINDVELOCITY); CDataArrayLong windAlign( in_ctxt, ID_IN_WINDALIGN ); CDataArrayFloat damp( in_ctxt, ID_IN_DAMP); CDataArrayBool enableFoam( in_ctxt, ID_IN_ENABLEFOAM); CDataArrayFloat time( in_ctxt, ID_IN_TIME); CDataArrayFloat loopTime( in_ctxt, ID_IN_REPEAT_TIME); CDataArrayFloat surfaceTension( in_ctxt, ID_IN_SURFACE_TENSION); CDataArrayFloat randWeight( in_ctxt, ID_IN_RAND_WEIGHT); pOcean->input(resolution[0], seed[0], oceanScale[0], oceanDepth[0], surfaceTension[0], velocity[0], cutoff[0], windDir[0], windAlign[0], damp[0], waveSpeed[0], waveHeight[0], chop[0], time[0], loopTime[0], enableFoam[0], randWeight[0]); return CStatus::OK; }
void main() { float newZoom = min(cameraZoom,1.0); // vec4 tex4 = texture2D(Texture4, TexCoord0.xy); // vec4 tex5 = texture2D(Texture5, TexCoord0.xy); // vec4 tex6 = texture2D(Texture6, TexCoord0.xy); vec4 tex7 = texture2D(Texture7, TexCoord0.xy); vec3 worldPosition = tex7.xyz; // vec2 tcMod = (vec2(TexCoord0.x,1.0-TexCoord0.y)*2.0-1.0 ); // tcMod.x *= bufferDim.x/(newZoom); // tcMod.y *= bufferDim.y/(newZoom); // tcMod.y -= cameraPos.z; // vec3 worldPosition = vec3(0.0,0.0,0.0); // worldPosition.x = tcMod.y + tcMod.x/2.0; // worldPosition.y = tcMod.y - tcMod.x/2.0; // worldPosition.x += cameraPos.x; // worldPosition.y += cameraPos.y; // worldPosition.z = 0.0; // float tilt = tiltAmount; // float itilt = 1.0-tiltAmount; // float baseHeight = 0.0; // vec3 worldPosition = vec3(0.0,0.0,0.0); // vec2 ssCoord = vec2(0.0); // ssCoord = vec2(TexCoord0.x,1.0-TexCoord0.y)*2.0-1.0; // ssCoord.x *= bufferDim.x/(newZoom); // ssCoord.y *= bufferDim.y/(newZoom); // ssCoord.y -= cameraPos.z*tilt*2.0; // ssCoord.y += baseHeight*tilt*2.0; // worldPosition.x = (ssCoord.y*0.5/itilt + ssCoord.x*0.5); // worldPosition.y = (ssCoord.y*0.5/itilt - ssCoord.x*0.5); // worldPosition.z = baseHeight; // worldPosition.x += cameraPos.x; // worldPosition.y += cameraPos.y; vec2 newPos = worldPosition.xy/waveSpacing; // float wm = mix( // abs( // sin( // (curTime)/500.0 + (TexCoord0.x + TexCoord0.y) * 12.0 // ) // ), // 0.25, // 1.0 // )*2.0; float waveh = (waveHeight(newPos) )*0.5+0.5; vec3 waven = (normalize( waveNormal(newPos) )+1.0)/2.0; gl_FragData[0] = vec4(waven,waveh); }