Ejemplo n.º 1
0
        static StackObject *RectangleContainsScreenPoint_9(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Camera cam = (UnityEngine.Camera) typeof(UnityEngine.Camera).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Vector2 screenPoint = (UnityEngine.Vector2) typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.RectTransform rect = (UnityEngine.RectTransform) typeof(UnityEngine.RectTransform).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = UnityEngine.RectTransformUtility.RectangleContainsScreenPoint(rect, screenPoint, cam);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
        static int _m_ScreenPointToRay_xlua_st_(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



            try {
                {
                    UnityEngine.Camera  cam = (UnityEngine.Camera)translator.GetObject(L, 1, typeof(UnityEngine.Camera));
                    UnityEngine.Vector2 screenPos; translator.Get(L, 2, out screenPos);

                    UnityEngine.Ray __cl_gen_ret = UnityEngine.RectTransformUtility.ScreenPointToRay(cam, screenPos);
                    translator.PushUnityEngineRay(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Ejemplo n.º 3
0
        public async void Awake()
        {
            var handle = Addressables.LoadAssetAsync <UnityEngine.GameObject>("Main Camera");
            await handle.Task;
            var go = UnityEngine.GameObject.Instantiate(handle.Result);

            this.Camera = go.GetComponent <UnityEngine.Camera>();
            this.Camera.transform.SetParent(this.GameObject.transform, false);
            //this.Camera.depth = 11;
            //this.Camera.nearClipPlane = 0.01f;
            ////移除UI层
            //this.Camera.cullingMask &= ~(1 << 5);
            ////移除Hidden显示层
            //this.Camera.cullingMask &= ~(1 << 9);

            //添加音频监听组件
            AddComponent <AudioListenerComponent>();
            //添加物理射线碰撞组件
            AddComponent <PhysicsRaycasterComponent>();
            //添加HighlightingSystem组件
            //AddComponent<HighlightingComponent, string>("Default");
        }
Ejemplo n.º 4
0
        /** 初期化。
         */
        public void Initialize()
        {
            //カメラ取得。
            this.mycamera = this.GetComponent <UnityEngine.Camera>();

            //マテリアル読み込み。
            this.material_bloom_firstdownsampling = new UnityEngine.Material(UnityEngine.Resources.Load <UnityEngine.Material>(Config.MATERIAL_NAME_FIRSTDOWNSAMPLING));
            this.material_bloom_downsampling      = new UnityEngine.Material(UnityEngine.Resources.Load <UnityEngine.Material>(Config.MATERIAL_NAME_DOWNSAMPLING));
            this.material_bloom_upsampling        = new UnityEngine.Material(UnityEngine.Resources.Load <UnityEngine.Material>(Config.MATERIAL_NAME_UPSAMPLING));
            this.material_bloom_lastupsampling    = new UnityEngine.Material(UnityEngine.Resources.Load <UnityEngine.Material>(Config.MATERIAL_NAME_LASTUPSAMPLING));

            //閾値。
            this.threshold = Config.DEFAULT_THRESHOLD;

            //加算強度。
            this.intensity = Config.DEFAULT_INTENSITY;

            //レンダーテクスチャ。
            int t_downsampling_count = 3;

            this.work_rendertexture = new UnityEngine.RenderTexture[t_downsampling_count];
        }
Ejemplo n.º 5
0
        /** Calc
         */
        public void Calc(UnityEngine.Camera a_look_camera, UnityEngine.Transform a_look_transform)
        {
            //worldToCameraMatrix
            this.raw_camera.worldToCameraMatrix = a_look_camera.worldToCameraMatrix * this.matrix;

            //projectionMatrix
            {
                UnityEngine.Matrix4x4 t_mirror_camera_matrix = this.raw_camera.worldToCameraMatrix;
                UnityEngine.Vector4   t_mirror_clip_plane;
                {
                    UnityEngine.Vector3 t_pos             = -this.plane_normal * this.plane_distance;
                    UnityEngine.Vector3 t_mirror_position = t_mirror_camera_matrix.MultiplyPoint(t_pos);
                    UnityEngine.Vector3 t_mirror_normal   = t_mirror_camera_matrix.MultiplyVector(this.plane_normal).normalized;
                    t_mirror_clip_plane = new UnityEngine.Vector4(t_mirror_normal.x, t_mirror_normal.y, t_mirror_normal.z, -UnityEngine.Vector3.Dot(t_mirror_position, t_mirror_normal));
                }
                this.raw_camera.projectionMatrix = a_look_camera.CalculateObliqueMatrix(t_mirror_clip_plane);
            }

            //position
            {
                this.raw_camera.transform.position = this.matrix.MultiplyPoint(a_look_transform.position);
            }

            //rotation
            {
                UnityEngine.Vector3 t_up      = this.matrix_rotate.MultiplyPoint(a_look_transform.up).normalized;
                UnityEngine.Vector3 t_forward = this.matrix_rotate.MultiplyPoint(a_look_transform.forward).normalized;
                UnityEngine.Vector3 t_right   = UnityEngine.Vector3.Cross(t_up, t_forward);

                UnityEngine.Matrix4x4 t_matrix = new UnityEngine.Matrix4x4(
                    new UnityEngine.Vector4(t_right.x, t_right.y, t_right.z, 0.0f),
                    new UnityEngine.Vector4(t_up.x, t_up.y, t_up.z, 0.0f),
                    new UnityEngine.Vector4(t_forward.x, t_forward.y, t_forward.z, 0.0f),
                    new UnityEngine.Vector4(0.0f, 0.0f, 0.0f, 1.0f)
                    );

                this.raw_camera.transform.rotation = t_matrix.rotation;
            }
        }
Ejemplo n.º 6
0
        static int _m_CreateCamera_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    string _name        = LuaAPI.lua_tostring(L, 1);
                    int    _cullingMask = LuaAPI.xlua_tointeger(L, 2);

                    UnityEngine.Camera gen_ret = FairyGUI.StageCamera.CreateCamera(_name, _cullingMask);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Ejemplo n.º 7
0
        static int _m_CloneCamera(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            CameraControl __cl_gen_to_be_invoked = (CameraControl)translator.FastGetCSObj(L, 1);


            try {
                {
                    UnityEngine.Camera cam = (UnityEngine.Camera)translator.GetObject(L, 2, typeof(UnityEngine.Camera));

                    __cl_gen_to_be_invoked.CloneCamera(cam);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Ejemplo n.º 8
0
        static StackObject *SetReplacementShader_13(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.String @replacementTag = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Shader @shader = (UnityEngine.Shader) typeof(UnityEngine.Shader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.Camera instance_of_this_method = (UnityEngine.Camera) typeof(UnityEngine.Camera).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.SetReplacementShader(@shader, @replacementTag);

            return(__ret);
        }
Ejemplo n.º 9
0
        /** 初期化。
         */
        public void Initialize()
        {
            //カメラ取得。
            this.mycamera = this.GetComponent <UnityEngine.Camera>();

            //マテリアル読み込み。
            this.material_blur_x = new UnityEngine.Material(UnityEngine.Resources.Load <UnityEngine.Material>(Config.MATERIAL_NAME_BLURX));
            this.material_blur_y = new UnityEngine.Material(UnityEngine.Resources.Load <UnityEngine.Material>(Config.MATERIAL_NAME_BLURY));

            //比率。
            this.rate_blend = 1.0f;

            //レンダーテクスチャ。
            this.work_rendertexture = null;

                        #if (UNITY_EDITOR)
            {
                float[] t_table      = new float[8];
                float   t_total      = 0.0f;
                float   t_dispersion = 1.0f;
                for (int ii = 0; ii < t_table.Length; ii++)
                {
                    t_table[ii] = UnityEngine.Mathf.Exp(-0.5f * ((float)(ii * ii)) / t_dispersion);
                    t_total    += t_table[ii] * 2;
                }

                float t_check = 0.0f;

                for (int ii = 0; ii < t_table.Length; ii++)
                {
                    t_table[ii] /= t_total;
                    t_check     += t_table[ii];
                    Tool.Log("Blur", "param = " + (t_table[ii] * 10000).ToString());
                }

                Tool.Log("Blur", "0.5f check = " + t_check.ToString());
            }
                        #endif
        }
        static int _m_GetRenderCamera(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                FairyGUI.Container gen_to_be_invoked = (FairyGUI.Container)translator.FastGetCSObj(L, 1);



                {
                    UnityEngine.Camera gen_ret = gen_to_be_invoked.GetRenderCamera(  );
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Ejemplo n.º 11
0
        static int _m_WorldToScreenPoint_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.Camera  _cam = (UnityEngine.Camera)translator.GetObject(L, 1, typeof(UnityEngine.Camera));
                    UnityEngine.Vector3 _worldPoint; translator.Get(L, 2, out _worldPoint);

                    var gen_ret = UnityEngine.RectTransformUtility.WorldToScreenPoint(_cam, _worldPoint);
                    translator.PushUnityEngineVector2(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Ejemplo n.º 12
0
        /** 正射影カメラオブジェクト作成。
         */
        public static UnityEngine.GameObject CreateOrthographicCameraObject(string a_name, UnityEngine.Transform a_parent_transform, float a_depth)
        {
            UnityEngine.GameObject t_gameobject = new UnityEngine.GameObject(a_name);

            //parent
            t_gameobject.GetComponent <UnityEngine.Transform>().SetParent(a_parent_transform);

            //camera
            UnityEngine.Camera t_camera = t_gameobject.AddComponent <UnityEngine.Camera>();
            {
                //Reset
                t_camera.Reset();

                //Depth
                t_camera.depth = a_depth;

                //Clear Flags
                t_camera.clearFlags = UnityEngine.CameraClearFlags.Nothing;

                //Culling Mask(LayerMask.GetMask(null))
                t_camera.cullingMask = 0;

                //Projection
                t_camera.orthographic = true;

                //Size
                t_camera.orthographicSize = 1.0f;

                //Clipping Planes
                t_camera.nearClipPlane = 0.0f;
                t_camera.farClipPlane  = 1000.0f;

                //Viewport Rect
                t_camera.rect = new UnityEngine.Rect(0.0f, 0.0f, 1.0f, 1.0f);
            }

            return(t_gameobject);
        }
Ejemplo n.º 13
0
            public void Apply(UnityEngine.Camera camera, Mode mode = Mode.Auto)
            {
                var nearClipPlane = 0f;
                var farClipPlane  = 0f;
                var orthographic  = false;

                if (mode == Mode.Auto)
                {
                    nearClipPlane = (this.orthographic == true ? this.orthographicNearClipPlane : this.perspectiveNearClipPlane);
                    farClipPlane  = (this.orthographic == true ? this.orthographicFarClipPlane : this.perspectiveFarClipPlane);
                    orthographic  = this.orthographic;
                }
                else if (mode == Mode.Orthographic)
                {
                    nearClipPlane = this.orthographicNearClipPlane;
                    farClipPlane  = this.orthographicFarClipPlane;
                    orthographic  = true;
                }
                else if (mode == Mode.Perspective)
                {
                    nearClipPlane = this.perspectiveNearClipPlane;
                    farClipPlane  = this.perspectiveFarClipPlane;
                    orthographic  = false;
                }

                camera.orthographic        = orthographic;
                camera.fieldOfView         = this.fieldOfView;
                camera.orthographicSize    = this.orthographicSize;
                camera.nearClipPlane       = nearClipPlane;
                camera.farClipPlane        = farClipPlane;
                camera.useOcclusionCulling = this.useOcclusionCulling;
                                #if UNITY_5_6_OR_NEWER
                camera.allowHDR  = this.hdr;
                camera.allowMSAA = this.msaa;
                                #else
                camera.hdr = this.hdr;
                                #endif
            }
Ejemplo n.º 14
0
        static int _m_ScreenPointToLocalPoint_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.Transform _rect = (UnityEngine.Transform)translator.GetObject(L, 1, typeof(UnityEngine.Transform));
                    UnityEngine.Vector3   _screenPos; translator.Get(L, 2, out _screenPos);
                    UnityEngine.Camera    _cam = (UnityEngine.Camera)translator.GetObject(L, 3, typeof(UnityEngine.Camera));

                    UnityEngine.Vector2 gen_ret = PackSystem.MiddleTier.ScreenPointToLocalPoint(_rect, _screenPos, _cam);
                    translator.PushUnityEngineVector2(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Ejemplo n.º 15
0
        static int _m_CacheRaycastHit_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.Camera     _camera = (UnityEngine.Camera)translator.GetObject(L, 1, typeof(UnityEngine.Camera));
                    UnityEngine.RaycastHit _hit; translator.Get(L, 2, out _hit);

                    FairyGUI.HitTestContext.CacheRaycastHit(_camera, ref _hit);
                    translator.Push(L, _hit);
                    translator.Update(L, 2, _hit);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Ejemplo n.º 16
0
        static int _m_GetRaycastHitFromCache_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.Camera     _camera = (UnityEngine.Camera)translator.GetObject(L, 1, typeof(UnityEngine.Camera));
                    UnityEngine.RaycastHit _hit;

                    bool gen_ret = FairyGUI.HitTestContext.GetRaycastHitFromCache(_camera, out _hit);
                    LuaAPI.lua_pushboolean(L, gen_ret);
                    translator.Push(L, _hit);



                    return(2);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Ejemplo n.º 17
0
        static StackObject *IsRaycastLocationValid_5(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Camera eventCamera = (UnityEngine.Camera) typeof(UnityEngine.Camera).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Vector2 sp = (UnityEngine.Vector2) typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.UI.Mask instance_of_this_method;
            instance_of_this_method = (UnityEngine.UI.Mask) typeof(UnityEngine.UI.Mask).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.IsRaycastLocationValid(sp, eventCamera);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
Ejemplo n.º 18
0
        static StackObject *HitTest_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Camera camera = (UnityEngine.Camera) typeof(UnityEngine.Camera).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Vector3 screenPosition = (UnityEngine.Vector3) typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.GUIElement instance_of_this_method;
            instance_of_this_method = (UnityEngine.GUIElement) typeof(UnityEngine.GUIElement).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.HitTest(screenPosition, camera);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Copys all relevant values of the given camera to the current camera sample.
        /// </summary>
        /// <param name="camera">The camera to copy.</param>
        /// <param name="convertTransformToUsd">
        ///   If true, converts the transform matrix from left handed(Unity) to right handed(USD). If
        ///   you're unsure about this parameter, it should be left to the default value of true.
        /// </param>
        public void CopyFromCamera(UnityEngine.Camera camera, bool convertTransformToUsd = true)
        {
            // GfCamera is a gold mine of camera math.
            pxr.GfCamera c = new pxr.GfCamera();

            // Setup focalLength & apertures.
            if (camera.orthographic)
            {
                projection = ProjectionType.Orthographic;
                // USD Orthographic size is 2x the Unity size (Unity uses half aperture for ortho size).
                c.SetOrthographicFromAspectRatioAndSize(camera.aspect,
                                                        camera.orthographicSize * 2,
                                                        pxr.GfCamera.FOVDirection.FOVVertical);
            }
            else
            {
                projection = ProjectionType.Perspective;
                c.SetPerspectiveFromAspectRatioAndFieldOfView(camera.aspect,
                                                              camera.fieldOfView,
                                                              pxr.GfCamera.FOVDirection.FOVVertical);
            }

            clippingRange      = new UnityEngine.Vector2(camera.nearClipPlane, camera.farClipPlane);
            focalLength        = c.GetFocalLength();
            horizontalAperture = c.GetHorizontalAperture();
            verticalAperture   = c.GetVerticalAperture();

            var tr = camera.transform;

            transform = UnityEngine.Matrix4x4.TRS(tr.localPosition,
                                                  tr.localRotation,
                                                  tr.localScale);
            if (convertTransformToUsd)
            {
                ConvertTransform();
            }
        }
        static int _m_GetScreenRect(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.GUIElement __cl_gen_to_be_invoked = (UnityEngine.GUIElement)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 1)
                {
                    UnityEngine.Rect __cl_gen_ret = __cl_gen_to_be_invoked.GetScreenRect(  );
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 2 && translator.Assignable <UnityEngine.Camera>(L, 2))
                {
                    UnityEngine.Camera camera = (UnityEngine.Camera)translator.GetObject(L, 2, typeof(UnityEngine.Camera));

                    UnityEngine.Rect __cl_gen_ret = __cl_gen_to_be_invoked.GetScreenRect(camera);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.GUIElement.GetScreenRect!"));
        }
Ejemplo n.º 21
0
        static int _m_CalculateFrustumPlanes_xlua_st_(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 1 && translator.Assignable <UnityEngine.Camera>(L, 1))
                {
                    UnityEngine.Camera camera = (UnityEngine.Camera)translator.GetObject(L, 1, typeof(UnityEngine.Camera));

                    UnityEngine.Plane[] __cl_gen_ret = UnityEngine.GeometryUtility.CalculateFrustumPlanes(camera);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 1 && translator.Assignable <UnityEngine.Matrix4x4>(L, 1))
                {
                    UnityEngine.Matrix4x4 worldToProjectionMatrix; translator.Get(L, 1, out worldToProjectionMatrix);

                    UnityEngine.Plane[] __cl_gen_ret = UnityEngine.GeometryUtility.CalculateFrustumPlanes(worldToProjectionMatrix);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.GeometryUtility.CalculateFrustumPlanes!"));
        }
Ejemplo n.º 22
0
        private void DrawDebugPanel(UnityEngine.Camera camera)
        {
            int fixtures = 0;

            for (int i = 0; i < World.BodyList.Count; i++)
            {
                fixtures += World.BodyList[i].FixtureList.Count;
            }

            int x = 0;
            int y = 0;

            Vector3 in0 = camera.ScreenToWorldPoint(new Vector3(camera.pixelWidth - 210f, camera.pixelHeight - 120f, 0f));

            //PerformancePanelBounds.x = in0.x / 3f;
            //PerformancePanelBounds.y = (in0.y - 120f) / 3f;

            UnityEngine.GUI.BeginGroup(new UnityEngine.Rect(in0.x, in0.y, 210f, 120f), UnityEngine.GUI.skin.box);

            DrawString(x, y, "Objects:" +
                       "\n- Bodies: " + World.BodyList.Count +
                       "\n- Fixtures: " + fixtures +
                       "\n- Contacts: " + World.ContactList.Count +
                       "\n- Joints: " + World.JointList.Count +
                       "\n- Controllers: " + World.ControllerList.Count +
                       "\n- Proxies: " + World.ProxyCount);

            DrawString(x + 110, y, "Update time:" +
                       "\n- Body: " + World.SolveUpdateTime +
                       "\n- Contact: " + World.ContactsUpdateTime +
                       "\n- CCD: " + World.ContinuousPhysicsTime +
                       "\n- Joint: " + World.Island.JointUpdateTime +
                       "\n- Controller: " + World.ControllersUpdateTime +
                       "\n- Total: " + World.UpdateTime);

            UnityEngine.GUI.EndGroup();
        }
Ejemplo n.º 23
0
        static int _m_ScreenPointToLocalPointInRectangle_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.RectTransform rect = (UnityEngine.RectTransform)translator.GetObject(L, 1, typeof(UnityEngine.RectTransform));
                    float x = (float)LuaAPI.lua_tonumber(L, 2);
                    float y = (float)LuaAPI.lua_tonumber(L, 3);
                    UnityEngine.Camera cam = (UnityEngine.Camera)translator.GetObject(L, 4, typeof(UnityEngine.Camera));

                    UnityEngine.Vector2 __cl_gen_ret = ZhuYuU3d.LuaCallCsFun.ScreenPointToLocalPointInRectangle(rect, x, y, cam);
                    translator.PushUnityEngineVector2(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Ejemplo n.º 24
0
        /** constructor
         */
        public LayerList(UnityEngine.Transform a_transform_root)
        {
            //レイヤーリスト。
            this.list = new LayerItem[Config.MAX_LAYER];
            for (int ii = 0; ii < this.list.Length; ii++)
            {
                this.list[ii] = new LayerItem();

                //描画順序。
                float t_gl_depth = Config.CAMERADEPTH_START + ii * Config.CAMERADEPTH_STEP + Config.CAMERADEPTH_OFFSET_GL;
                float t_ui_depth = Config.CAMERADEPTH_START + ii * Config.CAMERADEPTH_STEP + Config.CAMERADEPTH_OFFSET_UI;

                //カメラ。GL描画。
                UnityEngine.GameObject t_gameobject_camera_gl = Fee.Instantiate.Instantiate.CreateOrthographicCameraObject("Camera_" + ii.ToString() + "_GL", a_transform_root, t_gl_depth);
                UnityEngine.Camera     t_camera_gl            = t_gameobject_camera_gl.GetComponent <UnityEngine.Camera>();

                //カメラ。UI描画。
                UnityEngine.GameObject t_gameobject_camera_ui = Fee.Instantiate.Instantiate.CreateOrthographicCameraObject("Camera_" + ii.ToString() + "_UI", a_transform_root, t_ui_depth);
                UnityEngine.Camera     t_camera_ui            = t_gameobject_camera_ui.GetComponent <UnityEngine.Camera>();
                t_camera_ui.cullingMask = (1 << UnityEngine.LayerMask.NameToLayer("UI"));

                //キャンバス作成。
                UnityEngine.GameObject t_gameobject_canvas = Fee.Instantiate.Instantiate.CreateCameraCanvas("Canvas_" + ii.ToString(), a_transform_root, t_camera_ui);

                //GL描画設定。
                this.list[ii].camera_gl_monobehaviour = t_gameobject_camera_gl.AddComponent <Camera_GL_MonoBehaviour>();
                this.list[ii].camera_gl_monobehaviour.Initialize(ii, t_camera_gl, t_gl_depth);

                //UIカメラ。
                this.list[ii].camera_ui_monobehaviour = t_gameobject_camera_ui.AddComponent <Camera_UI_MonoBehaviour>();
                this.list[ii].camera_ui_monobehaviour.Initialize(ii, t_camera_ui, t_ui_depth);

                //キャンバス設定。
                this.list[ii].canvas_transform = t_gameobject_canvas.GetComponent <UnityEngine.Transform>();
            }
        }
        static int _m_IsRaycastLocationValid(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.ICanvasRaycastFilter __cl_gen_to_be_invoked = (UnityEngine.ICanvasRaycastFilter)translator.FastGetCSObj(L, 1);


            try {
                {
                    UnityEngine.Vector2 sp; translator.Get(L, 2, out sp);
                    UnityEngine.Camera  eventCamera = (UnityEngine.Camera)translator.GetObject(L, 3, typeof(UnityEngine.Camera));

                    bool __cl_gen_ret = __cl_gen_to_be_invoked.IsRaycastLocationValid(sp, eventCamera);
                    LuaAPI.lua_pushboolean(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
        static StackObject *Raycast_24(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Camera @eventCamera = (UnityEngine.Camera) typeof(UnityEngine.Camera).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Vector2 @sp = (UnityEngine.Vector2) typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.UI.Graphic instance_of_this_method = (UnityEngine.UI.Graphic) typeof(UnityEngine.UI.Graphic).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Raycast(@sp, @eventCamera);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
Ejemplo n.º 27
0
 public UnityGraphics(UnityEngine.GameObject bootstrapGameObject) : base()
 {
     this.isDrawing   = false;
     this.unityCamera = InitializeUnityCamera(bootstrapGameObject);
 }
Ejemplo n.º 28
0
 /** プレーンリストを更新。
  */
 public void UpdatePlaneList(UnityEngine.Camera a_camera)
 {
     this.plane_list = UnityEngine.GeometryUtility.CalculateFrustumPlanes(a_camera);
 }
Ejemplo n.º 29
0
        /** ミラー。作成。
         */
        public MirrorObject_MonoBehaviour CreateMirror(Fee.Mirror.RenderTextureSizeType a_size_type, UnityEngine.GameObject a_mirror_object, UnityEngine.Camera a_look_camera, string a_name)
        {
            if (a_mirror_object != null)
            {
                MirrorCamera_MonoBehaviour t_mirror_camera = MirrorCamera_MonoBehaviour.Create(a_size_type, a_name);

                //ミラーマテリアル。設定。
                UnityEngine.Renderer t_renderer = a_mirror_object.GetComponent <UnityEngine.Renderer>();
                if (t_renderer != null)
                {
                    UnityEngine.Shader t_shader = UnityEngine.Shader.Find(Config.SHADER_NAME_MIRROR);
                    if (t_shader != null)
                    {
                        t_renderer.material = new UnityEngine.Material(t_shader);
                        t_renderer.material.SetTexture("texture_mirror", t_mirror_camera.GetRenderTexture());
                    }
                    else
                    {
                        Tool.Assert(false);
                    }
                }
                else
                {
                    Tool.Assert(false);
                }

                //ミラーオブジェクト。設定。
                MirrorObject_MonoBehaviour t_mirror_object = a_mirror_object.AddComponent <MirrorObject_MonoBehaviour>();
                {
                    t_mirror_object.mirror_camera  = t_mirror_camera;
                    t_mirror_object.look_camera    = a_look_camera;
                    t_mirror_object.look_transform = a_look_camera.GetComponent <UnityEngine.Transform>();
                    t_mirror_object.enabled        = false;
                }

                return(t_mirror_object);
            }
            else
            {
                Tool.Assert(false);
            }

            return(null);
        }
Ejemplo n.º 30
0
 public CameraResolution(UnityEngine.Camera camera)
 {
     this.width  = camera.pixelWidth;
     this.height = camera.pixelHeight;
 }