浏览代码

update manifest, add camera control modes: dolly, free, cubemap

/feature-ME-dolly
etienne cella 4 年前
当前提交
bc52b643
共有 5 个文件被更改,包括 119 次插入24 次删除
  1. 19
      Assets/ClusterDisplay/Scripts/CubemapCameraController.cs
  2. 50
      Assets/Resources/VirtualCameraManager.prefab
  3. 16
      Packages/manifest.json
  4. 47
      Assets/ClusterDisplay/Scripts/CameraControlMode.cs
  5. 11
      Assets/ClusterDisplay/Scripts/CameraControlMode.cs.meta

19
Assets/ClusterDisplay/Scripts/CubemapCameraController.cs


using System;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
[ExecuteInEditMode]
public class CubemapCameraController : MonoBehaviour

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;

{
// 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();
}
Next();
}
public void Next()

}
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)
{

camera.transform.rotation = Quaternion.Euler(k_Orientations[index] * 90);
HDCamera hdCam = HDCamera.GetOrCreate(camera);
hdCam.Reset();
hdCam.volumetricHistoryIsValid = false;
hdCam.colorPyramidHistoryIsValid = false;
}
}
}

50
Assets/Resources/VirtualCameraManager.prefab


- component: {fileID: 3027554877427853615}
- component: {fileID: 4863388624406166532}
- component: {fileID: -4684115642597914423}
- component: {fileID: 6906833011552454493}
- component: {fileID: 3596820138936092922}
- component: {fileID: 4361789376570048865}
m_Layer: 0
m_Name: VirtualCameraManager
m_TagString: MainCamera

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3027554877427853619}
m_LocalRotation: {x: -0.2058242, y: 0.53439623, z: -0.13606744, w: -0.80841994}
m_LocalPosition: {x: 7.1058645, y: 4.024516, z: -5.1810875}
m_LocalRotation: {x: -0.01870693, y: 0.7540966, z: 0.021499574, w: 0.65614486}
m_LocalPosition: {x: -43.276688, y: 9.296043, z: -41.466377}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}

height: 1
near clip plane: 0.1
far clip plane: 5000
field of view: 40
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1

m_Script: {fileID: 11500000, guid: 2ef4e595ebdfdbc409b50a52171f91f7, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &6906833011552454493
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3027554877427853619}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 618b0e3f6c65dd247a4a016150006c57, type: 3}
m_Name:
m_EditorClassIdentifier:
m_LookSpeedController: 120
m_LookSpeedMouse: 10
m_MoveSpeed: 10
m_MoveSpeedIncrement: 2.5
m_Turbo: 10
--- !u!114 &3596820138936092922
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3027554877427853619}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5e0d67f9bc76ad74a97e3919a6db523c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &4361789376570048865
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3027554877427853619}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebfc7132d2bda31469c48564c7233efe, type: 3}
m_Name:
m_EditorClassIdentifier:

16
Packages/manifest.json


"com.unity.2d.sprite": "1.0.0",
"com.unity.animation.rigging": "0.2.3-preview",
"com.unity.cinemachine": "2.6.0-preview.2",
"com.unity.cluster-display.graphics": "file:../../ClusterDisplayExample/com.unity.cluster-display.graphics",
"com.unity.cluster-display.sync": "file:../../ClusterDisplayExample/ClusterDisplay/source/com.unity.cluster-display.sync",
"com.unity.cluster-display.utils": "file:../../ClusterDisplayExample/ClusterDisplay/source/com.unity.cluster-display.utils",
"com.unity.cluster-display.graphics": "file:../../Packages/ClusterDisplay/source/com.unity.cluster-display.graphics",
"com.unity.cluster-display.sync": "file:../../Packages/ClusterDisplay/source/com.unity.cluster-display.sync",
"com.unity.cluster-display.utils": "file:../../Packages/ClusterDisplay/source/com.unity.cluster-display.utils",
"com.unity.collab-proxy": "1.2.16",
"com.unity.editorcoroutines": "0.0.2-preview.1",
"com.unity.ide.rider": "1.1.1",

"com.unity.quicksearch": "1.4.1",
"com.unity.render-pipelines.core": "file:../../ClusterDisplayExample/ScriptableRenderPipeline/com.unity.render-pipelines.core",
"com.unity.render-pipelines.high-definition": "file:../../ClusterDisplayExample/ScriptableRenderPipeline/com.unity.render-pipelines.high-definition",
"com.unity.render-pipelines.high-definition-config": "file:../../ClusterDisplayExample/ScriptableRenderPipeline/com.unity.render-pipelines.high-definition-config",
"com.unity.shadergraph": "file:../../ClusterDisplayExample/ScriptableRenderPipeline/com.unity.shadergraph",
"com.unity.render-pipelines.core": "file:../../Packages/ScriptableRenderPipeline/com.unity.render-pipelines.core",
"com.unity.render-pipelines.high-definition": "file:../../Packages/ScriptableRenderPipeline/com.unity.render-pipelines.high-definition",
"com.unity.render-pipelines.high-definition-config": "file:../../Packages/ScriptableRenderPipeline/com.unity.render-pipelines.high-definition-config",
"com.unity.shadergraph": "file:../../Packages/ScriptableRenderPipeline/com.unity.shadergraph",
"com.unity.visualeffectgraph": "file:../../ClusterDisplayExample/ScriptableRenderPipeline/com.unity.visualeffectgraph",
"com.unity.visualeffectgraph": "file:../../Packages/ScriptableRenderPipeline/com.unity.visualeffectgraph",
"li.lightingtools.lightmapswitcher": "file:../LocalPackages/LightingTools.LightmapSwitcher",
"li.lightingtools.lightprobesvolumes": "file:../LocalPackages/LightingTools.LightProbesVolumes",
"net.peeweek.gameplay-ingredients": "file:../LocalPackages/net.peeweek.gameplay-ingredients",

47
Assets/ClusterDisplay/Scripts/CameraControlMode.cs


using System;
using System.Collections.Generic;
using Cinemachine;
using UnityEngine;
using UnityEngine.Rendering;
[RequireComponent(typeof(CinemachineBrain))]
[RequireComponent(typeof(FreeCamera))]
[RequireComponent(typeof(CubemapCameraController))]
public class CameraControlMode : MonoBehaviour
{
List<MonoBehaviour> m_CameraControllers = new List<MonoBehaviour>();
int m_Index = 0;
void Awake()
{
m_CameraControllers.Add(GetComponent<CinemachineBrain>());
m_CameraControllers.Add(GetComponent<FreeCamera>());
m_CameraControllers.Add(GetComponent<CubemapCameraController>());
}
void OnEnable()
{
m_Index = 0;
SetController(m_Index);
}
void OnDestroy()
{
m_CameraControllers.Clear();
}
void Update()
{
if (Input.GetKeyDown(KeyCode.C))
{
m_Index = (m_Index + 1) % m_CameraControllers.Count;
SetController(m_Index);
}
}
void SetController(int index)
{
for (var i = 0; i != m_CameraControllers.Count; ++i)
m_CameraControllers[i].enabled = i == index;
}
}

11
Assets/ClusterDisplay/Scripts/CameraControlMode.cs.meta


fileFormatVersion: 2
guid: ebfc7132d2bda31469c48564c7233efe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存