当前位置: 首页>>代码示例>>C#>>正文


C# Camera.ResetAspect方法代码示例

本文整理汇总了C#中UnityEngine.Camera.ResetAspect方法的典型用法代码示例。如果您正苦于以下问题:C# Camera.ResetAspect方法的具体用法?C# Camera.ResetAspect怎么用?C# Camera.ResetAspect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Camera的用法示例。


在下文中一共展示了Camera.ResetAspect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateCamera

 protected void UpdateCamera(Camera camera, RenderTexture rt)
 {
     camera.targetTexture = rt;
     camera.ResetAspect();
     camera.ResetProjectionMatrix();
 }
开发者ID:RELO4D3D,项目名称:sdk-dist,代码行数:6,代码来源:RenderTextureResizer.cs

示例2: KIS_IconViewer

        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;
        }
开发者ID:khr15714n,项目名称:KIS,代码行数:82,代码来源:KIS_IconViewer.cs

示例3: KIS_IconViewer

        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;
        }
开发者ID:Amorymeltzer,项目名称:KIS,代码行数:68,代码来源:KIS_IconViewer.cs


注:本文中的UnityEngine.Camera.ResetAspect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。