virtual bool Start() { CInputTask::GetPtr()->AddInputEventListener(this); CCameraTask::GetPtr()->SetPosition(CVector(0, 0, 2)); m_nPolygonMode = GL_FILL; m_bHDR = true; m_fExposure = 1.0f; // ATI doesn't support rectangular textures in GLSL m_bHDRSquare = !CVideoTask::GetPtr()->IsNVIDIA(); if(CVideoTask::GetPtr()->IsNVIDIA()) { m_fb.Init(CVideoTask::GetPtr()->GetWidth(), CVideoTask::GetPtr()->GetHeight(), GL_FLOAT_RGBA16_NV); if(m_fb.IsValid()) m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRRectFrag.glsl"); } else if(CVideoTask::GetPtr()->IsATI()) { m_fb.Init(1024, 1024, GL_RGBA_FLOAT16_ATI); if(m_fb.IsValid()) m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRSquareFrag.glsl"); } else { m_fb.Init(1024, 1024, GL_RGBA16F_ARB); if(m_fb.IsValid()) m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRSquareFrag.glsl"); } return true; }
virtual bool Start() { CInputTask::GetPtr()->AddInputEventListener(this); CCameraTask::GetPtr()->SetPosition(CVector(0, 0, 25)); CCameraTask::GetPtr()->SetThrust(1.0f); m_nPolygonMode = GL_FILL; m_vLight = CVector(1000, 1000, 1000); m_vLightDirection = m_vLight / m_vLight.Magnitude(); m_nSamples = 2; // Number of sample rays to use in integral equation m_Kr = 0.0025f; // Rayleigh scattering constant m_Kr4PI = m_Kr*4.0f*PI; m_Km = 0.0015f; // Mie scattering constant m_Km4PI = m_Km*4.0f*PI; m_ESun = 15.0f; // Sun brightness constant m_g = -0.95f; // The Mie phase asymmetry factor m_fInnerRadius = 10.0f; m_fOuterRadius = 10.25f; m_fScale = 1 / (m_fOuterRadius - m_fInnerRadius); m_fWavelength[0] = 0.650f; // 650 nm for red m_fWavelength[1] = 0.570f; // 570 nm for green m_fWavelength[2] = 0.475f; // 475 nm for blue m_fWavelength4[0] = powf(m_fWavelength[0], 4.0f); m_fWavelength4[1] = powf(m_fWavelength[1], 4.0f); m_fWavelength4[2] = powf(m_fWavelength[2], 4.0f); m_fRayleighScaleDepth = 0.25f; m_fMieScaleDepth = 0.1f; m_pbOpticalDepth.MakeOpticalDepthBuffer(m_fInnerRadius, m_fOuterRadius, m_fRayleighScaleDepth, m_fMieScaleDepth); m_tOpticalDepth.Init(&m_pbOpticalDepth); m_shSkyFromSpace.Init("shaders/SkyFromSpaceVert.glsl", "shaders/SkyFromSpaceFrag.glsl"); m_shSkyFromAtmosphere.Init("shaders/SkyFromAtmosphereVert.glsl", "shaders/SkyFromAtmosphereFrag.glsl"); m_shGroundFromSpace.Init("shaders/GroundFromSpaceVert.glsl", "shaders/GroundFromSpaceFrag.glsl"); m_shGroundFromAtmosphere.Init("shaders/GroundFromAtmosphereVert.glsl", "shaders/GroundFromAtmosphereFrag.glsl"); m_fExposure = 2.0f; m_fb.Init(800, 600, GL_RGBA16F_ARB); //m_fb.Init(800, 600, GL_RGBA8); m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRFrag.glsl"); m_bHDR = true; return true; }
bool Start() { m_nPolygonMode = GL_FILL; m_vLight = Vector3f(1000, 1000, 1000); m_vLightDirection = m_vLight * (1.0f / m_vLight.magnitude()); m_nSamples = 2; // Number of sample rays to use in integral equation m_Kr = 0.0025f; // Rayleigh scattering constant m_Kr4PI = m_Kr*4.0f*M_PI; m_Km = 0.0015f; // Mie scattering constant m_Km4PI = m_Km*4.0f*M_PI; m_ESun = 15.0f; // Sun brightness constant m_g = -0.95f; // The Mie phase asymmetry factor float mFactor = 1.0f; m_fInnerRadius = 10.0f * mFactor; m_fOuterRadius = 10.25f * mFactor; m_fScale = 1 / (m_fOuterRadius - m_fInnerRadius); m_fScale *= mFactor; m_fWavelength[0] = 0.650f; // 650 nm for red m_fWavelength[1] = 0.570f; // 570 nm for green m_fWavelength[2] = 0.475f; // 475 nm for blue m_fWavelength4[0] = powf(m_fWavelength[0], 4.0f); m_fWavelength4[1] = powf(m_fWavelength[1], 4.0f); m_fWavelength4[2] = powf(m_fWavelength[2], 4.0f); m_fRayleighScaleDepth = 0.25f; m_fMieScaleDepth = 0.1f; m_shSkyFromSpace.Init("shaders/SkyFromSpaceVert.glsl", "shaders/SkyFromSpaceFrag.glsl"); m_shSkyFromAtmosphere.Init("shaders/SkyFromAtmosphereVert.glsl", "shaders/SkyFromAtmosphereFrag.glsl"); m_shGroundFromSpace.Init("shaders/GroundFromSpaceVert.glsl", "shaders/GroundFromSpaceFrag.glsl"); m_shGroundFromAtmosphere.Init("shaders/GroundFromAtmosphereVert.glsl", "shaders/GroundFromAtmosphereFrag.glsl"); m_fExposure = 2.0f; m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRFrag.glsl"); m_bHDR = false; return true; }
virtual bool Start() { CInputTask::GetPtr()->AddInputEventListener(this); CCameraTask::GetPtr()->SetPosition(CVector(0, 0, 2)); m_nPolygonMode = GL_FILL; m_cSphere.SetPosition(CVector(-15, 0, -50)); m_cSphere.SetBoundingRadius(15.0f); m_cSphere2.SetPosition(CVector(10, 0, -50)); m_cSphere2.SetBoundingRadius(20.0f); CPixelBuffer pb; pb.Init(128, 128, 128, 2, GL_LUMINANCE_ALPHA); pb.Make3DNoise(238653); m_tex.Init(&pb, false, false); m_shader.Init("shaders\\SwellVert.glsl", "shaders\\SwellFrag.glsl"); return true; }