コード例 #1
0
        public void InterpolateManualTargetingCamera(UpdateEvent evt, AimingWorkActivationStateNode weapon, [JoinAll] AimingCameraNode cameraNode)
        {
            MuzzleVisualAccessor       accessor          = new MuzzleVisualAccessor(weapon.muzzlePoint);
            CameraComponent            camera            = cameraNode.camera;
            Transform                  root              = cameraNode.cameraRootTransform.Root;
            ShaftAimingCameraComponent shaftAimingCamera = cameraNode.shaftAimingCamera;
            float t = Mathf.Clamp01(weapon.shaftAimingWorkActivationState.ActivationTimer / weapon.shaftStateConfig.ActivationToWorkingTransitionTimeSec);
            MuzzleLogicAccessor accessor2 = new MuzzleLogicAccessor(weapon.muzzlePoint, weapon.weaponInstance);

            root.SetPositionSafe(Vector3.Lerp(shaftAimingCamera.WorldInitialCameraPosition, accessor2.GetBarrelOriginWorld(), t));
            Quaternion quaternion2 = Quaternion.LookRotation(accessor.GetFireDirectionWorld(), accessor.GetUpDirectionWorld());

            weapon.weaponRotationControl.MouseRotationCumulativeHorizontalAngle = Mathf.Clamp(weapon.weaponRotationControl.MouseRotationCumulativeHorizontalAngle, -weapon.shaftAimingRotationConfig.AimingOffsetClipping, weapon.shaftAimingRotationConfig.AimingOffsetClipping);
            Vector3 eulerAngles = quaternion2.eulerAngles;

            root.SetRotationSafe(Quaternion.Slerp(shaftAimingCamera.WorldInitialCameraRotation, Quaternion.Euler(eulerAngles.x, eulerAngles.y + weapon.weaponRotationControl.MouseRotationCumulativeHorizontalAngle, eulerAngles.z), t));
            camera.FOV = Mathf.Lerp(shaftAimingCamera.InitialFOV, weapon.shaftAimingCameraConfigEffect.ActivationStateTargetFov, t);
        }
コード例 #2
0
        private void ActivatePostEffects(CameraComponent camera)
        {
            string str = QualitySettings.names[QualitySettings.GetQualityLevel()].ToLower();

            PostEffectsSet[] postEffectsSets = camera.PostEffectsSets;
            foreach (PostEffectsSet set in postEffectsSets)
            {
                if (set.qualityName != str)
                {
                    set.SetActive(false);
                }
            }
            foreach (PostEffectsSet set2 in postEffectsSets)
            {
                if (set2.qualityName == str)
                {
                    set2.SetActive(true);
                    camera.DepthTextureMode = set2.depthTextureMode;
                }
            }
        }
コード例 #3
0
        private void UpdateBoundsAndCullCharacters(ICollection <CharacterShadowNode> collector, ICollection <CharacterShadowNode> characters, CameraComponent cameraComponent, CharacterShadowCommonSettingsComponent settings)
        {
            Matrix4x4 localToWorldMatrix = settings.virtualLight.localToWorldMatrix;
            Matrix4x4 worldToLocalMatrix = settings.virtualLight.worldToLocalMatrix;

            Plane[] planes = GeometryUtility.CalculateFrustumPlanes((cameraComponent.ProjectionMatrix * cameraComponent.WorldToCameraMatrix) * localToWorldMatrix);
            int     num    = 0;
            int     maxCharactersCountInAtlas = settings.MaxCharactersCountInAtlas;

            foreach (CharacterShadowNode node in characters)
            {
                bool   flag = num < maxCharactersCountInAtlas;
                Bounds boundsInLightSpace = BoundsUtils.TransformBounds(node.characterShadowCasters.BoundsInWorldSpace, worldToLocalMatrix);
                CharacterShadowComponent         characterShadow         = node.characterShadow;
                CharacterShadowInternalComponent characterShadowInternal = node.characterShadowInternal;
                characterShadowInternal.ProjectionBoundInLightSpace = this.CalculateProjectionBoundInLightSpace(settings, boundsInLightSpace, characterShadow.offset);
                Bounds projectionBoundInLightSpace = characterShadowInternal.ProjectionBoundInLightSpace;
                projectionBoundInLightSpace.max += new Vector3(0f, 0f, characterShadow.attenuation);
                flag &= GeometryUtility.TestPlanesAABB(planes, projectionBoundInLightSpace);
                characterShadowInternal.Projector.enabled = flag;
                if (flag)
                {
                    collector.Add(node);
                }
                num++;
            }
        }