ResetAspect() public method

Revert the aspect ratio to the screen's aspect ratio.

public ResetAspect ( ) : void
return void
コード例 #1
0
 static public int ResetAspect(IntPtr l)
 {
     try{
         UnityEngine.Camera self = (UnityEngine.Camera)checkSelf(l);
         self.ResetAspect();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #2
0
 static public int ResetAspect(IntPtr l)
 {
     try {
         UnityEngine.Camera self = (UnityEngine.Camera)checkSelf(l);
         self.ResetAspect();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #3
0
ファイル: KIS_IconViewer.cs プロジェクト: khr15714n/KIS
        public KIS_IconViewer(Part p, int resolution)
        {
            if (p.partInfo.name == "kerbalEVA" || p.partInfo.name == "kerbalEVAfemale")
            {
                // Icon Camera
                GameObject camGo = new GameObject("KASCamItem" + camStaticIndex);
                camGo.transform.parent = p.transform;
                camGo.transform.localPosition = Vector3.zero + new Vector3(0, 0.35f, 0.7f);
                camGo.transform.localRotation = Quaternion.identity;
                camGo.transform.Rotate(0.0f, 180f, 0.0f);
                cam = camGo.AddComponent<Camera>();
                cam.orthographic = true;
                cam.orthographicSize = 0.35f;
                cam.clearFlags = CameraClearFlags.Color;
                // Render texture
                RenderTexture tex = new RenderTexture(resolution, resolution, 8);
                this.texture = tex;

                cam.cullingMask = Camera.main.cullingMask;
                cam.farClipPlane = 1f;

                // Texture
                cam.targetTexture = tex;
                cam.ResetAspect();
            }
            else
            {
                // Instantiate part icon
                iconPrefab = UnityEngine.Object.Instantiate((UnityEngine.Object)p.partInfo.iconPrefab) as GameObject;

                // Command Seat Icon Fix (Temporary workaround until squad fix the broken shader)
                Shader fixShader = Shader.Find("KSP/Alpha/Cutoff Bumped");
                foreach (Renderer r in iconPrefab.GetComponentsInChildren<Renderer>(true))
                {
                    foreach (Material m in r.materials)
                    {
                        if (m.shader.name == "KSP/Alpha/Cutoff")
                        {
                            m.shader = fixShader;
                        }
                    }
                }

                iconPrefab.SetActive(true);

                // Icon Camera
                GameObject camGo = new GameObject("KASCamItem" + camStaticIndex);
                camGo.transform.position = new Vector3(camStaticIndex, iconPosY, 0);
                camGo.transform.rotation = Quaternion.identity;
                cam = camGo.AddComponent<Camera>();
                cam.orthographic = true;
                cam.orthographicSize = zoom;
                cam.clearFlags = CameraClearFlags.Color;
                // Render texture
                RenderTexture tex = new RenderTexture(resolution, resolution, 8);
                this.texture = tex;

                //light
                if (iconLight == null)
                {
                    GameObject lightGo = new GameObject("KASLight");
                    iconLight = lightGo.AddComponent<Light>();
                    iconLight.cullingMask = 1 << mask;
                    iconLight.type = LightType.Directional;
                    iconLight.intensity = lightIntensity;
                }

                // Layer
                cam.cullingMask = 1 << mask;
                SetLayerRecursively(iconPrefab, mask);

                // Texture
                cam.targetTexture = tex;
                cam.ResetAspect();

                // Cam index
                this.camIndex = camStaticIndex;
                camStaticIndex += 2;
                ResetPos();
            }
            iconCount += 1;
        }
コード例 #4
0
 protected void UpdateCamera(Camera camera, RenderTexture rt)
 {
     camera.targetTexture = rt;
     camera.ResetAspect();
     camera.ResetProjectionMatrix();
 }
コード例 #5
0
ファイル: KIS_IconViewer.cs プロジェクト: Amorymeltzer/KIS
        public KIS_IconViewer(Part p, int resolution)
        {
            if (p.partInfo.name == "kerbalEVA" || p.partInfo.name == "kerbalEVAfemale")
            {
                // Icon Camera
                GameObject camGo = new GameObject("KASCamItem" + camStaticIndex);
                camGo.transform.parent = p.transform;
                camGo.transform.localPosition = Vector3.zero + new Vector3(0, 0.35f, 0.7f);
                camGo.transform.localRotation = Quaternion.identity;
                camGo.transform.Rotate(0.0f, 180f, 0.0f);
                cam = camGo.AddComponent<Camera>();
                cam.orthographic = true;
                cam.orthographicSize = 0.35f;
                cam.clearFlags = CameraClearFlags.Color;
                // Render texture
                RenderTexture tex = new RenderTexture(resolution, resolution, 8);
                this.texture = tex;

                cam.cullingMask = Camera.main.cullingMask;
                cam.farClipPlane = 1f;

                // Texture
                cam.targetTexture = tex;
                cam.ResetAspect();
            }
            else
            {
                // Instantiate part icon
                iconPrefab = UnityEngine.Object.Instantiate((UnityEngine.Object)p.partInfo.iconPrefab) as GameObject;
                iconPrefab.SetActive(true);

                // Icon Camera
                GameObject camGo = new GameObject("KASCamItem" + camStaticIndex);
                camGo.transform.position = new Vector3(camStaticIndex, iconPosY, 0);
                camGo.transform.rotation = Quaternion.identity;
                cam = camGo.AddComponent<Camera>();
                cam.orthographic = true;
                cam.orthographicSize = zoom;
                cam.clearFlags = CameraClearFlags.Color;
                // Render texture
                RenderTexture tex = new RenderTexture(resolution, resolution, 8);
                this.texture = tex;

                //light
                if (iconLight == null)
                {
                    GameObject lightGo = new GameObject("KASLight");
                    iconLight = lightGo.AddComponent<Light>();
                    iconLight.cullingMask = 1 << mask;
                    iconLight.type = LightType.Directional;
                    iconLight.intensity = lightIntensity;
                }

                // Layer
                cam.cullingMask = 1 << mask;
                SetLayerRecursively(iconPrefab, mask);

                // Texture
                cam.targetTexture = tex;
                cam.ResetAspect();

                // Cam index
                this.camIndex = camStaticIndex;
                camStaticIndex += 2;
                ResetPos();
            }
            iconCount += 1;
        }