コード例 #1
0
        public void updateNonCameraSpecificUniforms(Material oceanMaterial)
        {
            m_manager.GetSkyNode().SetOceanUniforms(oceanMaterial);

            if (underwaterMode)
            {
                m_manager.GetSkyNode().UpdatePostProcessMaterial(underwaterMaterial);
            }

            planetOpacity = 1f - m_manager.parentCelestialBody.pqsController.surfaceMaterial.GetFloat("_PlanetOpacity");
            m_oceanMaterial.SetFloat("_PlanetOpacity", planetOpacity);

            m_oceanMaterial.SetInt("_ZwriteVariable", (planetOpacity == 1) ? 1 : 0);              //if planetOpacity!=1, ie fading out the sea, disable scattering on it and enable the projector scattering, for the projector scattering to work need to disable zwrite
        }
コード例 #2
0
ファイル: OceanNode.cs プロジェクト: RCrockford/Scatterer
        public virtual void UpdateNode()
        {
            bool oceanDraw = !MapView.MapIsEnabled && !m_manager.m_skyNode.inScaledSpace && (planetOpacity > 0f);

            foreach (MeshRenderer _mr in waterMeshRenderers)
            {
                _mr.enabled = oceanDraw;
            }

            isUnderwater = ((Scatterer.Instance.nearCamera.transform.position - m_manager.parentLocalTransform.position).magnitude - (float)m_manager.m_radius) < 0f;

            underwaterProjector.projector.enabled = isUnderwater;

            if (underwaterMode ^ isUnderwater)
            {
                toggleUnderwaterMode();
            }

            if (!ReferenceEquals(causticsShadowMaskModulator, null))
            {
                causticsShadowMaskModulator.isEnabled = oceanDraw && (m_manager.GetSkyNode().trueAlt < 6000f);
                causticsShadowMaskModulator.UpdateCaustics();
            }
        }