我们创建了 Fontainebleau 演示来说明摄影photogrammetry流程和 LayeredLit 着色器的使用。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

57 行
1.3 KiB

using System;
using UnityEngine;
[ExecuteInEditMode]
public class CubemapCameraController : MonoBehaviour
{
static readonly Vector3[] k_Orientations = new[]
{
new Vector3(0, 0, 0),
new Vector3(0, 1, 0),
new Vector3(0, 2, 0),
new Vector3(0, 3, 0),
new Vector3(-1, 0, 0), // ceiling
new Vector3(1, 0, 0), // bottom
};
int m_Index;
void OnEnable()
{
m_Index = 0;
}
void Update()
{
// B + left or right arrow to switch orientation
if (Input.GetKey(KeyCode.B))
{
if (Input.GetKeyDown(KeyCode.RightArrow))
Next();
else if (Input.GetKeyDown(KeyCode.LeftArrow))
Previous();
}
}
public void Next()
{
m_Index = (m_Index + 1) % k_Orientations.Length;
SetOrientation(m_Index);
}
public void Previous()
{
m_Index = (m_Index - 1 + k_Orientations.Length) % k_Orientations.Length;
SetOrientation(m_Index);
}
// we deliberately set transform outside update to avoid conflict with other camera controllers
void SetOrientation(int index)
{
var camera = Camera.main;
if (camera != null)
{
camera.transform.rotation = Quaternion.Euler(k_Orientations[index] * 90);
}
}
}