diff --git a/Assets/Scenes/Default.unity b/Assets/Scenes/Default.unity index 52e7f77..0b1d7f6 100644 --- a/Assets/Scenes/Default.unity +++ b/Assets/Scenes/Default.unity @@ -153,6 +153,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 941b1c44c09860d4fa2547fa7c914d55, type: 3} m_Name: m_EditorClassIdentifier: + mainCamera: {fileID: 963194227} visualStyles: - {fileID: 11400000, guid: d187fe54fb9a3e047bf4cec083877e72, type: 2} --- !u!4 &157597865 @@ -169,6 +170,122 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &567286279 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 567286283} + - component: {fileID: 567286282} + - component: {fileID: 567286281} + - component: {fileID: 567286280} + m_Layer: 0 + m_Name: View Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &567286280 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 567286279} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 1 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_Version: 2 +--- !u!81 &567286281 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 567286279} + m_Enabled: 1 +--- !u!20 &567286282 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 567286279} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 4 + far clip plane: 16384 + field of view: 70 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 128 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &567286283 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 567286279} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 963194228} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: m_ObjectHideFlags: 0 @@ -314,13 +431,13 @@ Camera: height: 1 near clip plane: 4 far clip plane: 16384 - field of view: 60 + field of view: 70 orthographic: 0 orthographic size: 5 m_Depth: -1 m_CullingMask: serializedVersion: 2 - m_Bits: 4294967295 + m_Bits: 64 m_RenderingPath: -1 m_TargetTexture: {fileID: 0} m_TargetDisplay: 0 @@ -342,7 +459,8 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 250, z: -2500} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] + m_Children: + - {fileID: 567286283} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -362,7 +480,8 @@ MonoBehaviour: m_RequiresDepthTextureOption: 2 m_RequiresOpaqueTextureOption: 2 m_CameraType: 0 - m_Cameras: [] + m_Cameras: + - {fileID: 567286282} m_RendererIndex: -1 m_VolumeLayerMask: serializedVersion: 2 diff --git a/Assets/Scripts/Bootstrap.cs b/Assets/Scripts/Bootstrap.cs index 49f0c49..7f20170 100644 --- a/Assets/Scripts/Bootstrap.cs +++ b/Assets/Scripts/Bootstrap.cs @@ -10,6 +10,9 @@ public class Bootstrap : MonoBehaviour private UniQuake uq; + [SerializeField] + private Camera mainCamera; + [SerializeField] private List visualStyles = new List(); @@ -26,7 +29,7 @@ public class Bootstrap : MonoBehaviour uq.BaseGame = MissionPack.Quake; uq.ModDirectory = mod; uq.AdditionalArguments = ParseArgs(); - uq.Camera = Camera.main; // This can be any one of four cameras for split-screen, each with its own culling layer + uq.Camera = mainCamera; // This can be any one of four cameras for split-screen, each with its own culling layer uq.SetVisualStyle(visualStyles[0]); } @@ -36,7 +39,7 @@ public class Bootstrap : MonoBehaviour uq.BaseGame = MissionPack.Hipnotic; uq.ModDirectory = mod; uq.AdditionalArguments = ParseArgs(); - uq.Camera = Camera.main; + uq.Camera = mainCamera; uq.SetVisualStyle(visualStyles[0]); } @@ -46,7 +49,7 @@ public class Bootstrap : MonoBehaviour uq.BaseGame = MissionPack.Rogue; uq.ModDirectory = mod; uq.AdditionalArguments = ParseArgs(); - uq.Camera = Camera.main; + uq.Camera = mainCamera; uq.SetVisualStyle(visualStyles[0]); } diff --git a/Assets/Scripts/Game/Entity.cs b/Assets/Scripts/Game/Entity.cs index fe9f4b9..84c9b42 100644 --- a/Assets/Scripts/Game/Entity.cs +++ b/Assets/Scripts/Game/Entity.cs @@ -28,7 +28,10 @@ public class Entity private void CreateGameObject() { - gameObject = new GameObject($"Entity_{entityNum}"); + gameObject = new GameObject($"Entity_{entityNum}") + { + layer = entityNum == 0 ? (int)Layers.View1 : (int)Layers.Game1 + }; skinnedMeshRenderer = gameObject.AddComponent(); skinnedMeshRenderer.enabled = false; diff --git a/Assets/Scripts/Game/GameState.cs b/Assets/Scripts/Game/GameState.cs index 5b44a85..53649cc 100644 --- a/Assets/Scripts/Game/GameState.cs +++ b/Assets/Scripts/Game/GameState.cs @@ -27,7 +27,7 @@ public class GameState Destroy(); Resources.UnloadUnusedAssets(); - worldGameObject = new GameObject(worldModel.Name); + worldGameObject = new GameObject(worldModel.Name) { layer = (int)Layers.Game1 }; // The first sub-model contains all of the static geometry var subModel = worldModel.GetSubModel(0); @@ -37,11 +37,11 @@ public class GameState private GameObject CreateBrushGameObject(BrushModel.SubModel subModel) { - var subModelGO = new GameObject(subModel.Name); + var subModelGO = new GameObject(subModel.Name) { layer = (int)Layers.Game1 }; foreach (var surfaceMesh in subModel.SurfaceMeshes) { - var meshGO = new GameObject(surfaceMesh.Mesh.name); + var meshGO = new GameObject(surfaceMesh.Mesh.name) { layer = (int)Layers.Game1 }; meshGO.transform.SetParent(subModelGO.transform); var mf = meshGO.AddComponent(); @@ -107,7 +107,7 @@ public class GameState return; } - var brushModelGO = new GameObject(brushModel.Name); + var brushModelGO = new GameObject(brushModel.Name) { layer = (int)Layers.Game1 }; for (int i = 0; i < brushModel.SubModelCount; ++i) { var subModelGO = CreateBrushGameObject(brushModel.GetSubModel(i)); diff --git a/Assets/Scripts/Layers.cs b/Assets/Scripts/Layers.cs new file mode 100644 index 0000000..1e3d1f3 --- /dev/null +++ b/Assets/Scripts/Layers.cs @@ -0,0 +1,13 @@ +public enum Layers +{ + Game1 = 6, + View1 = 7, +} + +public static class LayerExtensions +{ + public static int ToLayerMask(this Layers layer) + { + return 1 << (int)layer; + } +} diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 1c92a78..44c535b 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -11,8 +11,8 @@ TagManager: - - Water - UI - - - - + - Game1 + - ViewModel1 - - -