1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-11-23 19:40:57 +01:00
mp head cube color bug
touch position fix
network package issue fix
This commit is contained in:
xpeng 2022-08-29 02:53:00 +02:00
parent abc010aa20
commit b93656d29a
13 changed files with 106 additions and 125 deletions

View File

@ -24,14 +24,17 @@ Material:
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ValidKeywords:
- _EMISSION
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 2
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
RenderType: Transparent
disabledShaderPasses:
- DepthOnly
- SHADOWCASTER
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@ -102,7 +105,7 @@ Material:
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlend: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
@ -115,13 +118,13 @@ Material:
- _Smoothness: 0.6
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _SrcBlend: 5
- _Surface: 1
- _WorkflowMode: 1
- _ZWrite: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0.389, g: 0.73866874, b: 1, a: 1}
- _Color: {r: 0.38899997, g: 0.73866874, b: 1, a: 1}
- _BaseColor: {r: 0.38899997, g: 0.73866874, b: 1, a: 0.8}
- _Color: {r: 0.38899994, g: 0.73866874, b: 1, a: 0.8}
- _EmissionColor: {r: 0.055263013, g: 0.16309513, b: 0.32700002, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@ -24,14 +24,17 @@ Material:
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ValidKeywords:
- _EMISSION
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 2
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
RenderType: Transparent
disabledShaderPasses:
- DepthOnly
- SHADOWCASTER
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@ -102,7 +105,7 @@ Material:
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlend: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
@ -115,13 +118,13 @@ Material:
- _Smoothness: 0.6
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _SrcBlend: 5
- _Surface: 1
- _WorkflowMode: 1
- _ZWrite: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0.45221606, g: 0.90900004, b: 0.41567338, a: 1}
- _Color: {r: 0.45221597, g: 0.90900004, b: 0.41567335, a: 1}
- _BaseColor: {r: 0.45221597, g: 0.90900004, b: 0.41567335, a: 0.8}
- _Color: {r: 0.4522159, g: 0.90900004, b: 0.41567332, a: 0.8}
- _EmissionColor: {r: 0.08937143, g: 0.39099997, b: 0.070752375, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

View File

@ -1427,7 +1427,6 @@ GameObject:
- component: {fileID: 6918064188570338137}
- component: {fileID: 5523943268535035658}
- component: {fileID: 8812900737838453218}
- component: {fileID: 5550084698236563949}
m_Layer: 0
m_Name: XRNetwork
m_TagString: Untagged
@ -1667,7 +1666,7 @@ MonoBehaviour:
Encoder: {fileID: 8812900737838453218}
Decoder: {fileID: 0}
DecoderTexture: {fileID: 0}
maxPacketSize: 4096
maxPacketSize: 2048
timeout: 100
--- !u!114 &8812900737838453218
MonoBehaviour:
@ -1687,7 +1686,7 @@ MonoBehaviour:
onEncoded:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 5550084698236563949}
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: uNvEncoder.Examples.OutputEncodedDataToFile,
Display
m_MethodName: OnData
@ -1704,26 +1703,14 @@ MonoBehaviour:
setting:
width: 1920
height: 1080
frameRate: 24
bitRate: 196608
maxFrameSize: 8192
frameRate: 30
bitRate: 614400
maxFrameSize: 20480
format: 87
idrFrameIntervalFrame: 24
idrFrameIntervalFrame: 30
ResolutionDivider: 2
IdleTexture: {fileID: 2800000, guid: a025c23fceb7d4966b603419f551ce99, type: 3}
--- !u!114 &5550084698236563949
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 149481173429413636}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd43cfe121bf2b046995caf4e7930a8b, type: 3}
m_Name:
m_EditorClassIdentifier:
filePath: test.h264
sTexture: {fileID: 0}
--- !u!1 &149481173433458732
GameObject:
m_ObjectHideFlags: 0

View File

@ -131,12 +131,6 @@ GameObject:
type: 3}
m_PrefabInstance: {fileID: 757793526}
m_PrefabAsset: {fileID: 0}
--- !u!4 &393682 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -1125379421861928946, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
type: 3}
m_PrefabInstance: {fileID: 757793526}
m_PrefabAsset: {fileID: 0}
--- !u!1 &6649868
GameObject:
m_ObjectHideFlags: 0
@ -5422,7 +5416,8 @@ GameObject:
- component: {fileID: 566188386}
- component: {fileID: 566188385}
- component: {fileID: 566188389}
- component: {fileID: 566188390}
- component: {fileID: 566188392}
- component: {fileID: 566188391}
m_Layer: 0
m_Name: NetworkManager
m_TagString: Untagged
@ -5456,18 +5451,18 @@ MonoBehaviour:
SourcePrefabToOverride: {fileID: 0}
SourceHashToOverride: 0
OverridingTargetPrefab: {fileID: 0}
TickRate: 45
TickRate: 60
ClientConnectionBufferTimeout: 10
ConnectionApproval: 0
ConnectionApproval: 1
ConnectionData:
EnableTimeResync: 0
TimeResyncInterval: 30
EnsureNetworkVariableLengthSafety: 0
EnableSceneManagement: 1
ForceSamePrefabs: 1
ForceSamePrefabs: 0
RecycleNetworkIds: 1
NetworkIdRecycleDelay: 120
RpcHashSize: 0
RpcHashSize: 1
LoadSceneTimeOut: 120
SpawnTimeout: 1
EnableNetworkLogs: 1
@ -5501,12 +5496,24 @@ MonoBehaviour:
Port: 7777
Address: 127.0.0.1
MaxClients: 2
MessageBufferSize: 20480
MessageBufferSize: 51200
PingInterval: 500
TimeoutLimit: 32
TimeoutMinimum: 5000
TimeoutMaximum: 30000
--- !u!114 &566188390
--- !u!114 &566188391
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 566188383}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dab730412f5aeef41975dbad7c8be685, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &566188392
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -5522,9 +5529,9 @@ MonoBehaviour:
- {fileID: 2079759568}
- {fileID: 1006346016}
- {fileID: 2069467403}
- {fileID: 393682}
- {fileID: 1716582342}
- {fileID: 934521997}
- {fileID: 13422700}
PlayerIOsOpposite:
- {fileID: 1390826961}
- {fileID: 1023774752}
@ -8142,17 +8149,17 @@ PrefabInstance:
- target: {fileID: 1018638153358675470, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
type: 3}
propertyPath: m_LocalScale.x
value: 31.7
value: 32.3
objectReference: {fileID: 0}
- target: {fileID: 1018638153358675470, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
type: 3}
propertyPath: m_LocalScale.y
value: 31.7
value: 32.3
objectReference: {fileID: 0}
- target: {fileID: 1018638153358675470, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
type: 3}
propertyPath: m_LocalScale.z
value: 31.7
value: 32.3
objectReference: {fileID: 0}
- target: {fileID: 1018638153358675470, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
type: 3}
@ -10060,7 +10067,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 566188390}
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: StartManager, Assembly-CSharp
m_MethodName: StartClient
m_Mode: 1
@ -11052,7 +11059,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 566188390}
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: StartManager, Assembly-CSharp
m_MethodName: StartHost
m_Mode: 1
@ -18562,7 +18569,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 566188390}
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: StartManager, Assembly-CSharp
m_MethodName: StopAll
m_Mode: 1
@ -23279,9 +23286,9 @@ MonoBehaviour:
m_HandleRect: {fileID: 802710991}
m_Direction: 0
m_MinValue: 0
m_MaxValue: 10
m_WholeNumbers: 1
m_Value: 10
m_MaxValue: 1
m_WholeNumbers: 0
m_Value: 1
m_OnValueChanged:
m_PersistentCalls:
m_Calls:
@ -24643,6 +24650,16 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 149481173512535360, guid: e2d99f1c1f1e9c54c9115c9697ecf165,
type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 149481173512535360, guid: e2d99f1c1f1e9c54c9115c9697ecf165,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 7ce3a6249153af844bf867530900838d, type: 2}
- target: {fileID: 1486532002687246983, guid: e2d99f1c1f1e9c54c9115c9697ecf165,
type: 3}
propertyPath: Locker

View File

@ -110,7 +110,7 @@ public class PlayerSettingManager : MonoBehaviour
void GetHapticAmplitude()
{
if (PlayerConfig.HasKey("HapticAmplitude"))
HapticManagers[0].amplitude = (float)PlayerConfig.GetDouble("HapticAmplitude") * 10;
HapticManagers[0].amplitude = (float)PlayerConfig.GetDouble("HapticAmplitude");
SetHapticAmplitude(HapticManagers[0].amplitude);
}
@ -157,7 +157,6 @@ public class PlayerSettingManager : MonoBehaviour
}
public void SetHapticAmplitude(float amplitude)
{
amplitude /= 10;
foreach (var controller in HapticManagers)
{
controller.amplitude = amplitude;

View File

@ -1,38 +0,0 @@
using UnityEngine;
using System;
public class TouchPanelManager : MonoBehaviour
{
int Area;
private int _insideColliderCount = 0;
public static event Action touchDidChange;
void Start()
{
Area = (int)Enum.Parse(typeof(TouchArea), gameObject.name);
}
private void OnTriggerEnter(Collider other)
{
_insideColliderCount += 1;
SerialManager.ChangeTouch(true, (int)Area, true);
touchDidChange?.Invoke();
}
private void OnTriggerExit(Collider other)
{
_insideColliderCount -= 1;
_insideColliderCount = Mathf.Max(0, _insideColliderCount);
if (_insideColliderCount == 0)
{
SerialManager.ChangeTouch(true, (int)Area, false);
touchDidChange?.Invoke();
}
}
enum TouchArea
{
A1 = 0, A2 = 1, A3 = 2, A4 = 3, A5 = 4,
A6 = 8, A7 = 9, A8 = 10, B1 = 11, B2 = 12,
B3 = 16, B4 = 17, B5 = 18, B6 = 19, B7 = 20,
B8 = 24, C1 = 25, C2 = 26, D1 = 27, D2 = 28,
D3 = 32, D4 = 33, D5 = 34, D6 = 35, D7 = 36,
D8 = 40, E1 = 41, E2 = 42, E3 = 43, E4 = 44,
E5 = 48, E6 = 49, E7 = 50, E8 = 51,
}
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 4fbbc702560270e4793d7baae40fe658
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 418804c802e05824097212b78e2e382e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
using UnityEngine;
using Unity.Netcode;
public class DebugButton : MonoBehaviour
{
private void OnGUI() {
GUILayout.BeginArea(new Rect(10, 10, 100, 300));
//if (!NetworkManager.Singleton.IsClient && !NetworkManager.Singleton.IsServer) {
if (GUILayout.Button("Host")) GetComponent<StartManager>().StartHost();
if (GUILayout.Button("Client")) GetComponent<StartManager>().StartClient();
if (GUILayout.Button("Stop")) GetComponent<StartManager>().StopAll();
//}
GUILayout.EndArea();
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 05f97a2d35cbcb14aaa9a05b5bce285d
guid: dab730412f5aeef41975dbad7c8be685
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -21,6 +21,7 @@ public class DisplaySync : NetworkBehaviour
bool isInitialized = false;
public override void OnNetworkSpawn()
{
Debug.Log("DisplaySync.OnNetworkSpawn");
NetworkManager.Singleton.OnClientDisconnectCallback += OnClientDisconnectedCallback;
var DisplayP1 = GameObject.FindGameObjectWithTag("DisplayP1");

View File

@ -18,13 +18,13 @@ public class WindowEncoder : NetworkBehaviour
{
width = 1920,
height = 1080,
frameRate = 24,
frameRate = 30,
format = uNvEncoder.Format.B8G8R8A8_UNORM,
bitRate = 196608,
maxFrameSize = 8192,
bitRate = 1228800,
maxFrameSize = 40960,
};
public int idrFrameIntervalFrame = 24;
public int idrFrameIntervalFrame = 30;
int idrFrameCounter_ = 0;
public int ResolutionDivider = 2;
public Texture2D IdleTexture = null;
@ -87,6 +87,7 @@ public class WindowEncoder : NetworkBehaviour
setting.width = window.window.width / ResolutionDivider;
setting.height = window.window.height / ResolutionDivider;
idrFrameIntervalFrame = setting.frameRate;
encoder.Create(setting);
rt = new RenderTexture(setting.width, setting.height, 24);

View File

@ -2,6 +2,7 @@ using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem.XR;
using UnityEngine.XR.Interaction.Toolkit;
using Unity.XR.CoreUtils;
public class NetworkPlayer : NetworkBehaviour
{
@ -21,6 +22,8 @@ public class NetworkPlayer : NetworkBehaviour
if (!IsOwner)
{
var clientXROrigin = GetComponent<XROrigin>();
var clientLocomotion = GetComponent<LocomotionSystem>();
var clientMoveProvider = GetComponent<ActionBasedContinuousMoveProvider>();
var clientTurnProvider = GetComponent<ActionBasedContinuousTurnProvider>();
var clientControllers = GetComponentsInChildren<ActionBasedController>();
@ -30,13 +33,18 @@ public class NetworkPlayer : NetworkBehaviour
var clientCamera = GetComponentInChildren<Camera>();
var clientAudioListener = GetComponentInChildren<AudioListener>();
var clientLIV = GetComponent<LIV.SDK.Unity.LIV>();
var clientWindowEncoder = GetComponent<WindowEncoder>();
//var clientOVRManager = gameObject.transform.Find("OVRManager").gameObject;
clientXROrigin.enabled = false;
clientLocomotion.enabled = false;
clientCamera.enabled = false;
clientAudioListener.enabled = false;
clientMoveProvider.enabled = false;
clientTurnProvider.enabled = false;
clientHead.enabled = false;
clientLIV.enabled = false;
clientWindowEncoder.enabled = false;
foreach (var ray in clientRays)
{
ray.RaySwitch = false;
@ -55,16 +63,16 @@ public class NetworkPlayer : NetworkBehaviour
}
private void SetMaterials()
{
var HeadMat = transform.Find("Camera Offset").Find("Main Camera").Find("HeadCube").gameObject.GetComponent<Renderer>().material;
var HeadRenderer = transform.Find("Camera Offset").Find("Main Camera").Find("HeadCube").gameObject.GetComponent<Renderer>();
var LHandMat = transform.Find("Camera Offset").Find("LeftHand Controller").Find("LHand").GetComponent<Renderer>().material;
var RHandMat = transform.Find("Camera Offset").Find("RightHand Controller").Find("RHand").GetComponent<Renderer>().material;
if (IsOwnedByServer)
{
HeadMat = MaterialP1;
HeadRenderer.material = MaterialP1;
}
else
{
HeadMat = MaterialP2;
HeadRenderer.material = MaterialP2;
float LH, LS, LV; float RH, RS, RV;
Color.RGBToHSV(LHandMat.color, out LH, out LS, out LV);
Color.RGBToHSV(RHandMat.color, out RH, out RS, out RV);
@ -79,8 +87,7 @@ public class NetworkPlayer : NetworkBehaviour
{
if (IsHost)
{
transform.position = new Vector3(Player1Position.x, transform.position.y, transform.position.z + Player1Position.y);
transform.position = new Vector3(Player1Position.x, transform.position.y, transform.position.z + Player1Position.y);
}
else
{