예제 #1
0
        public static bool SpriteOrOrigin(Component component, out Vector3 worldPoint)
        {
            ContextSprite sprite;

            if (ContextSprite.FindSprite(component, out sprite))
            {
                worldPoint = sprite.transform.position;
                return(true);
            }
            worldPoint = component.transform.position;
            return(false);
        }
예제 #2
0
    public static bool Raycast(Ray ray, out ContextSprite sprite)
    {
        RaycastHit raycastHit;
        float      single;
        bool       flag = false;

        sprite = null;
        float single1 = Single.PositiveInfinity;

        foreach (ContextSprite contextSprite in ContextSprite.g.visible)
        {
            if (contextSprite.contextRequestable)
            {
                Collider collider = contextSprite.contextRequestable.collider;
                if (!collider)
                {
                    collider = contextSprite.collider;
                }
                if (collider)
                {
                    if (!collider.enabled)
                    {
                        continue;
                    }
                    else if (contextSprite.collider.Raycast(ray, out raycastHit, 5f))
                    {
                        float single2 = raycastHit.distance;
                        single2 = single2 * single2;
                        if (single2 < single1)
                        {
                            flag    = true;
                            single1 = single2;
                            sprite  = contextSprite;
                        }
                    }
                }
                if (!contextSprite.renderer.bounds.IntersectRay(ray, out single))
                {
                    continue;
                }
                single = single * single;
                if (single >= single1)
                {
                    continue;
                }
                flag    = true;
                single1 = single;
                sprite  = contextSprite;
            }
        }
        return(flag);
    }
예제 #3
0
 public static IEnumerable <ContextSprite> AllVisibleForRequestable(IContextRequestableVisibility requestable)
 {
     if (ContextSprite.g.visible.Count != 0)
     {
         UnityEngine.MonoBehaviour monoBehaviour  = requestable as UnityEngine.MonoBehaviour;
         UnityEngine.MonoBehaviour monoBehaviour1 = monoBehaviour;
         if (monoBehaviour)
         {
             return(ContextSprite.AllVisibleForRequestable(monoBehaviour1));
         }
     }
     return(ContextSprite.empty);
 }
예제 #4
0
        public static void Add(ContextSprite sprite)
        {
            HashSet <ContextSprite> contextSprites;

            ContextSprite.g.visible.Add(sprite);
            ContextSprite.g.count = ContextSprite.g.count + 1;
            if (!ContextSprite.g.requestableVisibleSprites.TryGetValue(sprite.contextRequestable, out contextSprites))
            {
                contextSprites = (ContextSprite.g.hashRecycle.Count <= 0 ? new HashSet <ContextSprite>() : ContextSprite.g.hashRecycle.Dequeue());
                ContextSprite.g.requestableVisibleSprites[sprite.contextRequestable] = contextSprites;
            }
            contextSprites.Add(sprite);
            if (ContextSprite.CalculateFadeOut(ref sprite.fade, Time.time - sprite.timeRemoved))
            {
                sprite.UpdateMaterialProperties();
            }
        }
예제 #5
0
 public static bool FindSprite(Component component, out ContextSprite sprite)
 {
     if (component is ContextSprite)
     {
         sprite = (ContextSprite)component;
         return(true);
     }
     if (!(component is IContextRequestable))
     {
         sprite = component.GetComponentInChildren <ContextSprite>();
         return(sprite);
     }
     sprite = component.GetComponentInChildren <ContextSprite>();
     if (sprite)
     {
         if ((!sprite.contextRequestable ? sprite._contextRequestable : sprite.contextRequestable) == component)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #6
0
 private static bool CalculateFadeDim(ref double fade, float elapsed)
 {
     if (fade < 0.15)
     {
         if (ContextSprite.CalculateFadeIn(ref fade, elapsed))
         {
             if (fade > 0.15)
             {
                 fade = 0.15;
             }
             return(true);
         }
     }
     else if (fade > 0.15 && ContextSprite.CalculateFadeOut(ref fade, elapsed))
     {
         if (fade < 0.15)
         {
             fade = 0.15;
         }
         return(true);
     }
     return(false);
 }
예제 #7
0
        public static void Remove(ContextSprite sprite)
        {
            HashSet <ContextSprite> contextSprites;

            ContextSprite.g.visible.Remove(sprite);
            ContextSprite.g.count = ContextSprite.g.count - 1;
            if (ContextSprite.g.requestableVisibleSprites.TryGetValue(sprite.contextRequestable, out contextSprites))
            {
                if (contextSprites.Count != 1)
                {
                    contextSprites.Remove(sprite);
                }
                else
                {
                    contextSprites.Clear();
                    if (ContextSprite.g.hashRecycle.Count < 5)
                    {
                        ContextSprite.g.hashRecycle.Enqueue(contextSprites);
                    }
                    ContextSprite.g.requestableVisibleSprites.Remove(sprite.contextRequestable);
                }
            }
            sprite.timeRemoved = Time.time;
        }
예제 #8
0
    public void PostPreCull()
    {
        Vector3G   vector3G;
        Matrix4x4G matrix4x4G;
        Matrix4x4G matrix4x4G1;
        Vector3G   vector3G1 = new Vector3G();
        Vector3G   vector3G2;
        Vector3G   vector3G3;
        Vector3G   vector3G4;
        Vector3G   vector3G5;
        Vector3G   vector3G6 = new Vector3G();
        RaycastHit raycastHit;
        Matrix4x4G matrix4x4G2;
        PerspectiveMatrixBuilder perspectiveMatrixBuilder = new PerspectiveMatrixBuilder();
        Vector4 vector4 = new Vector4();
        PerspectiveMatrixBuilder perspectiveMatrixBuilder1 = new PerspectiveMatrixBuilder();
        Matrix4x4G  matrix4x4G3;
        Vector3G    vector3G7;
        QuaternionG quaternionG;
        Vector3G    vector3G8;
        Matrix4x4G  matrix4x4G4;
        Matrix4x4G  matrix4x4G5;
        Matrix4x4G  matrix4x4G6;
        Matrix4x4G  matrix4x4G7;
        Matrix4x4G  matrix4x4G8;
        Matrix4x4G  matrix4x4G9;
        Matrix4x4G  matrix4x4G10;
        Matrix4x4G  matrix4x4G11;

        if (CameraFX.viewModelRootTransform)
        {
            Quaternion quaternion = base.transform.localRotation;
            Vector3    vector3    = base.transform.localPosition;
            if (this.viewModel)
            {
                this.viewModel.ModifyAiming(new Ray(base.transform.parent.position, base.transform.parent.forward), ref vector3, ref quaternion);
            }
            CameraFX.viewModelRootTransform.localRotation = Quaternion.Inverse(quaternion);
            CameraFX.viewModelRootTransform.localPosition = -vector3;
        }
        this.camera.transform.ExtractLocalToWorldToLocal(out this.localToWorldMatrix, out this.worldToLocalMatrix);
        if (this.adaptiveNearPlane)
        {
            int      num       = this.camera.cullingMask & ~this.adaptiveNearPlane.ignoreLayers.@value | this.adaptiveNearPlane.forceLayers.@value;
            Vector3G vector3G9 = new Vector3G();
            this.localToWorldMatrix.MultiplyPoint(ref vector3G9, out vector3G);
            Collider[] colliderArray = Physics.OverlapSphere(vector3G.f, this.adaptiveNearPlane.minNear + this.adaptiveNearPlane.maxNear, num);
            int        num1          = -1;
            float      single        = Single.PositiveInfinity;
            double     num2          = (double)this.camera.fieldOfView;
            double     num3          = (double)this.camera.aspect;
            double     num4          = (double)this.adaptiveNearPlane.minNear;
            double     num5          = (double)(this.adaptiveNearPlane.maxNear + this.adaptiveNearPlane.threshold);
            float      single1       = this.adaptiveNearPlane.minNear;
            float      single2       = this.adaptiveNearPlane.maxNear + this.adaptiveNearPlane.threshold - single1;
            Matrix4x4G.Perspective(ref num2, ref num3, ref num4, ref num5, out matrix4x4G);
            Matrix4x4G.Inverse(ref matrix4x4G, out matrix4x4G1);
            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    vector3G1.x = ((double)i - 3.5) / 3.5;
                    vector3G1.y = ((double)j - 3.5) / 3.5;
                    vector3G1.z = 0;
                    matrix4x4G1.MultiplyPoint(ref vector3G1, out vector3G2);
                    vector3G1.z = 1;
                    matrix4x4G1.MultiplyPoint(ref vector3G1, out vector3G3);
                    vector3G2.x = -vector3G2.x;
                    vector3G2.y = -vector3G2.y;
                    vector3G2.z = -vector3G2.z;
                    vector3G3.x = -vector3G3.x;
                    vector3G3.y = -vector3G3.y;
                    vector3G3.z = -vector3G3.z;
                    this.localToWorldMatrix.MultiplyPoint(ref vector3G2, out vector3G4);
                    this.localToWorldMatrix.MultiplyPoint(ref vector3G3, out vector3G5);
                    vector3G6.x = vector3G5.x - vector3G4.x;
                    vector3G6.y = vector3G5.y - vector3G4.y;
                    vector3G6.z = vector3G5.z - vector3G4.z;
                    float single3 = (float)Math.Sqrt(vector3G6.x * vector3G6.x + vector3G6.y * vector3G6.y + vector3G6.z * vector3G6.z);
                    float single4 = single3;
                    Ray   ray     = new Ray(vector3G4.f, vector3G6.f);
                    for (int k = 0; k < (int)colliderArray.Length; k++)
                    {
                        if (colliderArray[k].Raycast(ray, out raycastHit, single4))
                        {
                            float single5 = raycastHit.distance;
                            if (single5 < single4)
                            {
                                single4 = single5;
                                float single6 = single1 + single5 / single3 * single2;
                                if (single > single6)
                                {
                                    single = single6;
                                    num1   = k;
                                }
                            }
                        }
                    }
                }
            }
            if (!float.IsInfinity(single))
            {
                single = single - this.adaptiveNearPlane.threshold;
                if (single >= this.adaptiveNearPlane.maxNear)
                {
                    this.camera.nearClipPlane = this.adaptiveNearPlane.maxNear;
                }
                else if (single > this.adaptiveNearPlane.minNear)
                {
                    this.camera.nearClipPlane = single;
                }
                else
                {
                    this.camera.nearClipPlane = this.adaptiveNearPlane.minNear;
                }
            }
            else
            {
                this.camera.nearClipPlane = this.adaptiveNearPlane.maxNear;
            }
        }
        perspectiveMatrixBuilder.fieldOfView = (double)this.camera.fieldOfView;
        perspectiveMatrixBuilder.aspectRatio = (double)this.camera.aspect;
        perspectiveMatrixBuilder.nearPlane   = (double)this.camera.nearClipPlane;
        perspectiveMatrixBuilder.farPlane    = (double)this.camera.farClipPlane;
        PerspectiveMatrixBuilder perspectiveMatrixBuilder2 = perspectiveMatrixBuilder;

        if (!this.camera.isOrthoGraphic)
        {
            if (this.viewModel)
            {
                this.viewModel.ModifyPerspective(ref perspectiveMatrixBuilder2);
            }
            if (!CameraFX.vm_projuse)
            {
                perspectiveMatrixBuilder.ToProjectionMatrix(out this.projectionMatrix);
            }
            else
            {
                perspectiveMatrixBuilder2.ToProjectionMatrix(out this.projectionMatrix);
            }
            this.camera.projectionMatrix = this.projectionMatrix.f;
            perspectiveMatrixBuilder2.ToProjectionMatrix(out matrix4x4G2);
        }
        else
        {
            this.projectionMatrix.f = this.camera.projectionMatrix;
            matrix4x4G2             = this.projectionMatrix;
        }
        vector4.y = (float)perspectiveMatrixBuilder2.nearPlane;
        vector4.z = (float)perspectiveMatrixBuilder2.farPlane;
        vector4.w = (float)(1 / perspectiveMatrixBuilder2.farPlane);
        if (CameraFX.vm_flip != CameraFX.PLATFORM_POLL.flipRequired)
        {
            vector4.x = -1f;
            perspectiveMatrixBuilder1.nearPlane   = perspectiveMatrixBuilder2.nearPlane;
            perspectiveMatrixBuilder1.farPlane    = perspectiveMatrixBuilder2.farPlane;
            perspectiveMatrixBuilder1.fieldOfView = -perspectiveMatrixBuilder2.fieldOfView;
            perspectiveMatrixBuilder1.aspectRatio = -perspectiveMatrixBuilder2.aspectRatio;
            perspectiveMatrixBuilder1.ToProjectionMatrix(out matrix4x4G3);
            Shader.SetGlobalMatrix("V_MUNITY_MATRIX_P", matrix4x4G3.f);
        }
        else
        {
            vector4.x = 1f;
            Shader.SetGlobalMatrix("V_MUNITY_MATRIX_P", matrix4x4G2.f);
        }
        Shader.SetGlobalVector("V_M_ProjectionParams", vector4);
        if (!this.recalcViewMatrix)
        {
            this.cameraToWorldMatrix.f = this.camera.cameraToWorldMatrix;
            this.worldToCameraMatrix.f = this.camera.worldToCameraMatrix;
        }
        else
        {
            this.camera.transform.ExtractWorldCoordinates(out vector3G7, out quaternionG, out vector3G8);
            vector3G8.x = 1;
            vector3G8.y = 1;
            vector3G8.z = -1;
            Matrix4x4G.TRS(ref vector3G7, ref quaternionG, ref vector3G8, out this.cameraToWorldMatrix);
            if (Matrix4x4G.Inverse(ref this.cameraToWorldMatrix, out this.worldToCameraMatrix))
            {
                this.camera.worldToCameraMatrix = this.worldToCameraMatrix.f;
            }
        }
        this.worldToCameraMatrixUnAltered = this.worldToCameraMatrix;
        this.cameraToWorldMatrixUnAltered = this.cameraToWorldMatrix;
        this.projectionMatrixUnAltered    = this.projectionMatrix;
        CameraFX.ApplyTransitionAlterations(this.camera, this, true);
        Matrix4x4G matrix4x4G12 = this.worldToCameraMatrix;
        Matrix4x4G matrix4x4G13 = matrix4x4G12;

        this.projectViewport.modelview = matrix4x4G12;
        this.projectScreen.modelview   = matrix4x4G13;
        Matrix4x4G matrix4x4G14 = this.projectionMatrix;

        matrix4x4G13 = matrix4x4G14;
        this.projectViewport.projection = matrix4x4G14;
        this.projectScreen.projection   = matrix4x4G13;
        Rect rect = this.camera.pixelRect;

        this.projectScreen.offset.x = (double)rect.x;
        this.projectScreen.offset.y = (double)rect.y;
        this.projectScreen.size.x   = (double)rect.width;
        this.projectScreen.size.y   = (double)rect.height;
        rect = this.camera.rect;
        this.projectViewport.offset.x = (double)rect.x;
        this.projectViewport.offset.y = (double)rect.y;
        this.projectViewport.size.x   = (double)rect.width;
        this.projectViewport.size.y   = (double)rect.height;
        Matrix4x4G.Mult(ref this.localToWorldMatrix, ref this.worldToCameraMatrix, out matrix4x4G7);
        Matrix4x4G.Mult(ref matrix4x4G7, ref this.projectionMatrix, out matrix4x4G4);
        Matrix4x4G.Inverse(ref matrix4x4G7, out matrix4x4G8);
        Matrix4x4G.Inverse(ref matrix4x4G4, out matrix4x4G5);
        Matrix4x4G.Inverse(ref this.localToWorldMatrix, out matrix4x4G10);
        Matrix4x4G.Transpose(ref matrix4x4G5, out matrix4x4G6);
        Matrix4x4G.Transpose(ref matrix4x4G8, out matrix4x4G9);
        Matrix4x4G.Transpose(ref matrix4x4G10, out matrix4x4G11);
        if (this.viewModel)
        {
            this.viewModel.UpdateProxies();
        }
        BoundHack.Achieve(base.transform.position);
        ContextSprite.UpdateSpriteFading(this.camera);
        PlayerClient playerClient = PlayerClient.localPlayerClient;

        if (playerClient)
        {
            playerClient.ProcessLocalPlayerPreRender();
        }
        RPOS.BeforeSceneRender_Internal(this.camera);
    }
예제 #9
0
    public void PostPreCull()
    {
        Matrix4x4G projectionMatrix;
        PerspectiveMatrixBuilder builder;
        Vector4    vector2;
        Matrix4x4G matrixxg5;
        Matrix4x4G matrixxg6;
        Matrix4x4G matrixxg7;
        Matrix4x4G matrixxg8;
        Matrix4x4G matrixxg9;
        Matrix4x4G matrixxg10;
        Matrix4x4G matrixxg11;
        Matrix4x4G matrixxg12;

        if (viewModelRootTransform != null)
        {
            Quaternion localRotation = base.transform.localRotation;
            Vector3    localPosition = base.transform.localPosition;
            if (this.viewModel != null)
            {
                this.viewModel.ModifyAiming(new Ray(base.transform.parent.position, base.transform.parent.forward), ref localPosition, ref localRotation);
            }
            viewModelRootTransform.localRotation = Quaternion.Inverse(localRotation);
            viewModelRootTransform.localPosition = -localPosition;
        }
        this.camera.transform.ExtractLocalToWorldToLocal(out this.localToWorldMatrix, out this.worldToLocalMatrix);
        if (this.adaptiveNearPlane != null)
        {
            Vector3G   vectorg2;
            Matrix4x4G matrixxg;
            Matrix4x4G matrixxg2;
            int        layerMask = (this.camera.cullingMask & ~this.adaptiveNearPlane.ignoreLayers.value) | this.adaptiveNearPlane.forceLayers.value;
            Vector3G   a         = new Vector3G();
            this.localToWorldMatrix.MultiplyPoint(ref a, out vectorg2);
            Collider[] colliderArray    = Physics.OverlapSphere(vectorg2.f, this.adaptiveNearPlane.minNear + this.adaptiveNearPlane.maxNear, layerMask);
            int        num2             = -1;
            float      positiveInfinity = float.PositiveInfinity;
            double     fieldOfView      = this.camera.fieldOfView;
            double     aspect           = this.camera.aspect;
            double     minNear          = this.adaptiveNearPlane.minNear;
            double     zfar             = this.adaptiveNearPlane.maxNear + this.adaptiveNearPlane.threshold;
            float      num8             = this.adaptiveNearPlane.minNear;
            float      num9             = (this.adaptiveNearPlane.maxNear + this.adaptiveNearPlane.threshold) - num8;
            Matrix4x4G.Perspective(ref fieldOfView, ref aspect, ref minNear, ref zfar, out matrixxg);
            Matrix4x4G.Inverse(ref matrixxg, out matrixxg2);
            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    Vector3G vectorg3;
                    Vector3G vectorg4;
                    Vector3G vectorg5;
                    Vector3G vectorg6;
                    Vector3G vectorg7;
                    Vector3G vectorg8;
                    vectorg3.x = (i - 3.5) / 3.5;
                    vectorg3.y = (j - 3.5) / 3.5;
                    vectorg3.z = 0.0;
                    matrixxg2.MultiplyPoint(ref vectorg3, out vectorg4);
                    vectorg3.z = 1.0;
                    matrixxg2.MultiplyPoint(ref vectorg3, out vectorg5);
                    vectorg4.x = -vectorg4.x;
                    vectorg4.y = -vectorg4.y;
                    vectorg4.z = -vectorg4.z;
                    vectorg5.x = -vectorg5.x;
                    vectorg5.y = -vectorg5.y;
                    vectorg5.z = -vectorg5.z;
                    this.localToWorldMatrix.MultiplyPoint(ref vectorg4, out vectorg6);
                    this.localToWorldMatrix.MultiplyPoint(ref vectorg5, out vectorg7);
                    vectorg8.x = vectorg7.x - vectorg6.x;
                    vectorg8.y = vectorg7.y - vectorg6.y;
                    vectorg8.z = vectorg7.z - vectorg6.z;
                    float num12    = (float)Math.Sqrt(((vectorg8.x * vectorg8.x) + (vectorg8.y * vectorg8.y)) + (vectorg8.z * vectorg8.z));
                    float distance = num12;
                    Ray   ray      = new Ray(vectorg6.f, vectorg8.f);
                    for (int k = 0; k < colliderArray.Length; k++)
                    {
                        RaycastHit hit;
                        Collider   collider = colliderArray[k];
                        if (collider.Raycast(ray, out hit, distance))
                        {
                            float num15 = hit.distance;
                            if (num15 < distance)
                            {
                                distance = num15;
                                float num16 = num8 + ((num15 / num12) * num9);
                                if (positiveInfinity > num16)
                                {
                                    positiveInfinity = num16;
                                    num2             = k;
                                }
                            }
                        }
                    }
                }
            }
            if (float.IsInfinity(positiveInfinity))
            {
                this.camera.nearClipPlane = this.adaptiveNearPlane.maxNear;
            }
            else
            {
                positiveInfinity -= this.adaptiveNearPlane.threshold;
                if (positiveInfinity >= this.adaptiveNearPlane.maxNear)
                {
                    this.camera.nearClipPlane = this.adaptiveNearPlane.maxNear;
                }
                else if (positiveInfinity <= this.adaptiveNearPlane.minNear)
                {
                    this.camera.nearClipPlane = this.adaptiveNearPlane.minNear;
                }
                else
                {
                    this.camera.nearClipPlane = positiveInfinity;
                }
            }
        }
        builder.fieldOfView = this.camera.fieldOfView;
        builder.aspectRatio = this.camera.aspect;
        builder.nearPlane   = this.camera.nearClipPlane;
        builder.farPlane    = this.camera.farClipPlane;
        PerspectiveMatrixBuilder perspective = builder;

        if (this.camera.isOrthoGraphic)
        {
            this.projectionMatrix.f = this.camera.projectionMatrix;
            projectionMatrix        = this.projectionMatrix;
        }
        else
        {
            if (this.viewModel != null)
            {
                this.viewModel.ModifyPerspective(ref perspective);
            }
            if (vm_projuse)
            {
                perspective.ToProjectionMatrix(out this.projectionMatrix);
            }
            else
            {
                builder.ToProjectionMatrix(out this.projectionMatrix);
            }
            this.camera.projectionMatrix = this.projectionMatrix.f;
            perspective.ToProjectionMatrix(out projectionMatrix);
        }
        vector2.y = (float)perspective.nearPlane;
        vector2.z = (float)perspective.farPlane;
        vector2.w = (float)(1.0 / perspective.farPlane);
        if (vm_flip == PLATFORM_POLL.flipRequired)
        {
            vector2.x = 1f;
            Shader.SetGlobalMatrix("V_MUNITY_MATRIX_P", projectionMatrix.f);
        }
        else
        {
            PerspectiveMatrixBuilder builder3;
            Matrix4x4G matrixxg4;
            vector2.x            = -1f;
            builder3.nearPlane   = perspective.nearPlane;
            builder3.farPlane    = perspective.farPlane;
            builder3.fieldOfView = -perspective.fieldOfView;
            builder3.aspectRatio = -perspective.aspectRatio;
            builder3.ToProjectionMatrix(out matrixxg4);
            Shader.SetGlobalMatrix("V_MUNITY_MATRIX_P", matrixxg4.f);
        }
        Shader.SetGlobalVector("V_M_ProjectionParams", vector2);
        if (this.recalcViewMatrix)
        {
            Vector3G    vectorg9;
            QuaternionG ng;
            Vector3G    vectorg10;
            this.camera.transform.ExtractWorldCoordinates(out vectorg9, out ng, out vectorg10);
            vectorg10.x = 1.0;
            vectorg10.y = 1.0;
            vectorg10.z = -1.0;
            Matrix4x4G.TRS(ref vectorg9, ref ng, ref vectorg10, out this.cameraToWorldMatrix);
            if (Matrix4x4G.Inverse(ref this.cameraToWorldMatrix, out this.worldToCameraMatrix))
            {
                this.camera.worldToCameraMatrix = this.worldToCameraMatrix.f;
            }
        }
        else
        {
            this.cameraToWorldMatrix.f = this.camera.cameraToWorldMatrix;
            this.worldToCameraMatrix.f = this.camera.worldToCameraMatrix;
        }
        this.worldToCameraMatrixUnAltered = this.worldToCameraMatrix;
        this.cameraToWorldMatrixUnAltered = this.cameraToWorldMatrix;
        this.projectionMatrixUnAltered    = this.projectionMatrix;
        ApplyTransitionAlterations(this.camera, this, true);
        this.projectScreen.modelview  = this.projectViewport.modelview = this.worldToCameraMatrix;
        this.projectScreen.projection = this.projectViewport.projection = this.projectionMatrix;
        Rect pixelRect = this.camera.pixelRect;

        this.projectScreen.offset.x = pixelRect.x;
        this.projectScreen.offset.y = pixelRect.y;
        this.projectScreen.size.x   = pixelRect.width;
        this.projectScreen.size.y   = pixelRect.height;
        pixelRect = this.camera.rect;
        this.projectViewport.offset.x = pixelRect.x;
        this.projectViewport.offset.y = pixelRect.y;
        this.projectViewport.size.x   = pixelRect.width;
        this.projectViewport.size.y   = pixelRect.height;
        Matrix4x4G.Mult(ref this.localToWorldMatrix, ref this.worldToCameraMatrix, out matrixxg8);
        Matrix4x4G.Mult(ref matrixxg8, ref this.projectionMatrix, out matrixxg5);
        Matrix4x4G.Inverse(ref matrixxg8, out matrixxg9);
        Matrix4x4G.Inverse(ref matrixxg5, out matrixxg6);
        Matrix4x4G.Inverse(ref this.localToWorldMatrix, out matrixxg11);
        Matrix4x4G.Transpose(ref matrixxg6, out matrixxg7);
        Matrix4x4G.Transpose(ref matrixxg9, out matrixxg10);
        Matrix4x4G.Transpose(ref matrixxg11, out matrixxg12);
        if (this.viewModel != null)
        {
            this.viewModel.UpdateProxies();
        }
        BoundHack.Achieve(base.transform.position);
        ContextSprite.UpdateSpriteFading(this.camera);
        PlayerClient localPlayerClient = PlayerClient.localPlayerClient;

        if (localPlayerClient != null)
        {
            localPlayerClient.ProcessLocalPlayerPreRender();
        }
        RPOS.BeforeSceneRender_Internal(this.camera);
    }
예제 #10
0
        public static void Step(Camera camera)
        {
            float              single;
            RaycastHit         raycastHit;
            bool               flag;
            ContextSprite      contextSprite = null;
            ContextStatusFlags contextStatusFlag;
            bool               flag1;

            if (ContextSprite.g.count > 0)
            {
                single = Time.deltaTime;
                if (single <= 0f)
                {
                    return;
                }
                int num = 525313;
                if (!RPOS.hideSprites)
                {
Label2:
                    foreach (ContextSprite contextSprite in ContextSprite.g.visible)
                    {
                        if (!contextSprite.requestableHasStatus)
                        {
                            flag = false;
                        }
                        else
                        {
                            contextStatusFlag = contextSprite.requestableStatus.ContextStatusPoll() & (ContextStatusFlags.SpriteFlag0 | ContextStatusFlags.SpriteFlag1);
                            if ((int)contextStatusFlag != 0)
                            {
                                if (contextStatusFlag != ContextStatusFlags.SpriteFlag0)
                                {
                                    goto Label1;
                                }
                                flag = true;
                                goto Label0;
                            }
Label3:
                            flag = false;
Label0:
                        }
                        Vector3 vector3  = contextSprite.transform.position;
                        Ray     ray      = camera.ScreenPointToRay(camera.WorldToScreenPoint(vector3));
                        Vector3 vector31 = ray.direction;
                        Vector3 vector32 = ray.origin;
                        float   single1  = vector3.x * vector31.x + vector3.y * vector31.y + vector3.z * vector31.z - (vector32.x * vector31.x + vector32.y * vector31.y + vector32.z * vector31.z);
                        if (single1 <= 0f || ContextSprite.g.PhysRaycast(ref ray, out raycastHit, single1, num) && !contextSprite.IsSeeThrough(ref raycastHit))
                        {
                            flag1 = ContextSprite.CalculateFadeOut(ref contextSprite.fade, single);
                        }
                        else
                        {
                            flag1 = (!flag ? ContextSprite.CalculateFadeIn(ref contextSprite.fade, single) : ContextSprite.CalculateFadeDim(ref contextSprite.fade, single));
                        }
                        if (!flag1)
                        {
                            continue;
                        }
                        contextSprite.UpdateMaterialProperties();
                    }
                }
                else
                {
                    foreach (ContextSprite contextSprite1 in ContextSprite.g.visible)
                    {
                        if (!ContextSprite.CalculateFadeOut(ref contextSprite1.fade, single))
                        {
                            continue;
                        }
                        contextSprite1.UpdateMaterialProperties();
                    }
                }
            }
            return;

            if (contextStatusFlag == ContextStatusFlags.SpriteFlag1)
            {
                if (ContextSprite.CalculateFadeOut(ref contextSprite.fade, single))
                {
                    contextSprite.UpdateMaterialProperties();
                }
                goto Label2;
            }
            else if (contextStatusFlag == (ContextStatusFlags.SpriteFlag0 | ContextStatusFlags.SpriteFlag1))
            {
                if (ContextSprite.CalculateFadeIn(ref contextSprite.fade, single))
                {
                    contextSprite.UpdateMaterialProperties();
                }
                goto Label2;
            }
            else
            {
                goto Label3;
            }
        }