本文整理汇总了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();
}
示例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;
}
示例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;
}