mirror of
https://github.com/xiaopeng12138/MaiDXR.git
synced 2024-11-24 03:50:10 +01:00
fix some mp issues
but found more issues
This commit is contained in:
parent
c7c8f404f2
commit
34a762c06b
@ -1427,6 +1427,7 @@ GameObject:
|
|||||||
- component: {fileID: 6918064188570338137}
|
- component: {fileID: 6918064188570338137}
|
||||||
- component: {fileID: 5523943268535035658}
|
- component: {fileID: 5523943268535035658}
|
||||||
- component: {fileID: 8812900737838453218}
|
- component: {fileID: 8812900737838453218}
|
||||||
|
- component: {fileID: 5550084698236563949}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: XRNetwork
|
m_Name: XRNetwork
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -1681,11 +1682,25 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
texture: {fileID: 0}
|
texture: {fileID: 0}
|
||||||
|
window: {fileID: 0}
|
||||||
encoder:
|
encoder:
|
||||||
onEncoded:
|
onEncoded:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls:
|
||||||
outputError: 0
|
- m_Target: {fileID: 5550084698236563949}
|
||||||
|
m_TargetAssemblyTypeName: uNvEncoder.Examples.OutputEncodedDataToFile,
|
||||||
|
Display
|
||||||
|
m_MethodName: OnData
|
||||||
|
m_Mode: 0
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
outputError: 1
|
||||||
setting:
|
setting:
|
||||||
width: 1920
|
width: 1920
|
||||||
height: 1080
|
height: 1080
|
||||||
@ -1695,6 +1710,20 @@ MonoBehaviour:
|
|||||||
format: 87
|
format: 87
|
||||||
idrFrameIntervalFrame: 24
|
idrFrameIntervalFrame: 24
|
||||||
ResolutionDivider: 2
|
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
|
||||||
--- !u!1 &149481173433458732
|
--- !u!1 &149481173433458732
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1755,7 +1784,7 @@ Camera:
|
|||||||
y: 0
|
y: 0
|
||||||
width: 1
|
width: 1
|
||||||
height: 1
|
height: 1
|
||||||
near clip plane: 0.01
|
near clip plane: 0.1
|
||||||
far clip plane: 10
|
far clip plane: 10
|
||||||
field of view: 60
|
field of view: 60
|
||||||
orthographic: 0
|
orthographic: 0
|
||||||
@ -1763,7 +1792,7 @@ Camera:
|
|||||||
m_Depth: 0
|
m_Depth: 0
|
||||||
m_CullingMask:
|
m_CullingMask:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 503
|
m_Bits: 2147483647
|
||||||
m_RenderingPath: -1
|
m_RenderingPath: -1
|
||||||
m_TargetTexture: {fileID: 0}
|
m_TargetTexture: {fileID: 0}
|
||||||
m_TargetDisplay: 0
|
m_TargetDisplay: 0
|
||||||
|
@ -247,8 +247,8 @@ GameObject:
|
|||||||
- component: {fileID: 13422702}
|
- component: {fileID: 13422702}
|
||||||
- component: {fileID: 13422701}
|
- component: {fileID: 13422701}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Display P1 BG
|
m_Name: BG
|
||||||
m_TagString: DisplayP1
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 1
|
m_StaticEditorFlags: 1
|
||||||
@ -288,7 +288,7 @@ MeshRenderer:
|
|||||||
m_RenderingLayerMask: 1
|
m_RenderingLayerMask: 1
|
||||||
m_RendererPriority: 0
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 2100000, guid: fa661e697a9d4dd4aa3938d314e10626, type: 2}
|
- {fileID: 2100000, guid: 69d936cecc5357c40841d907893b9874, type: 2}
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
firstSubMesh: 0
|
firstSubMesh: 0
|
||||||
subMeshCount: 0
|
subMeshCount: 0
|
||||||
@ -8139,6 +8139,36 @@ PrefabInstance:
|
|||||||
propertyPath: m_StaticEditorFlags
|
propertyPath: m_StaticEditorFlags
|
||||||
value: 2147483647
|
value: 2147483647
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1018638153358675470, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalScale.x
|
||||||
|
value: 31.7
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1018638153358675470, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalScale.y
|
||||||
|
value: 31.7
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1018638153358675470, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalScale.z
|
||||||
|
value: 31.7
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1018638153358675470, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 1.191
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1018638153358675470, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0.02
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1018638153358675470, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_ConstrainProportionsScale
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1597228139911881735, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
- target: {fileID: 1597228139911881735, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_Enabled
|
propertyPath: m_Enabled
|
||||||
@ -8197,7 +8227,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 1995990277796536632, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
- target: {fileID: 1995990277796536632, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_StaticEditorFlags
|
propertyPath: m_StaticEditorFlags
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2009740602367058978, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
- target: {fileID: 2009740602367058978, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
type: 3}
|
type: 3}
|
||||||
@ -8589,6 +8619,11 @@ PrefabInstance:
|
|||||||
propertyPath: m_LightProbeUsage
|
propertyPath: m_LightProbeUsage
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4484653850034527598, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_RenderingLayerMask
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4484653850034527598, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
- target: {fileID: 4484653850034527598, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_Materials.Array.data[0]
|
propertyPath: m_Materials.Array.data[0]
|
||||||
@ -9022,7 +9057,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 8110296352969589220, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
- target: {fileID: 8110296352969589220, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_StaticEditorFlags
|
propertyPath: m_StaticEditorFlags
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8123848027915441045, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
- target: {fileID: 8123848027915441045, guid: 4cbf0dbca1ca1a5499c4b7806ab6aac5,
|
||||||
type: 3}
|
type: 3}
|
||||||
@ -12785,6 +12820,12 @@ CanvasRenderer:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1125575213}
|
m_GameObject: {fileID: 1125575213}
|
||||||
m_CullTransparentMesh: 1
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!4 &1137462979 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 149481173433458735, guid: e2d99f1c1f1e9c54c9115c9697ecf165,
|
||||||
|
type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 2035566383}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1 &1139038999
|
--- !u!1 &1139038999
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -22554,7 +22595,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
NVRCameraObj: {fileID: 357334431}
|
NVRCameraObj: {fileID: 357334431}
|
||||||
NVRCamera: {fileID: 357334434}
|
NVRCamera: {fileID: 357334434}
|
||||||
NVRCameraTargetFP: {fileID: 0}
|
NVRCameraTargetFP: {fileID: 1137462979}
|
||||||
NVRCameraTargetTP: {fileID: 1585482469}
|
NVRCameraTargetTP: {fileID: 1585482469}
|
||||||
CameraSmooth: {fileID: 357334436}
|
CameraSmooth: {fileID: 357334436}
|
||||||
--- !u!1 &1883867033
|
--- !u!1 &1883867033
|
||||||
@ -25157,7 +25198,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
searchTiming_: 0
|
searchTiming_: 0
|
||||||
type_: 0
|
type_: 0
|
||||||
altTabWindow_: 0
|
altTabWindow_: 1
|
||||||
createChildWindows_: 0
|
createChildWindows_: 0
|
||||||
childWindowPrefab: {fileID: 0}
|
childWindowPrefab: {fileID: 0}
|
||||||
childWindowZDistance: 0.02
|
childWindowZDistance: 0.02
|
||||||
@ -25165,7 +25206,7 @@ MonoBehaviour:
|
|||||||
desktopIndex_: 0
|
desktopIndex_: 0
|
||||||
captureMode: 1
|
captureMode: 1
|
||||||
capturePriority: 0
|
capturePriority: 0
|
||||||
captureRequestTiming: 1
|
captureRequestTiming: 0
|
||||||
captureFrameRate: 90
|
captureFrameRate: 90
|
||||||
drawCursor: 0
|
drawCursor: 0
|
||||||
updateTitle: 1
|
updateTitle: 1
|
||||||
|
@ -38,6 +38,7 @@ public class NoneVRSettingManager : MonoBehaviour
|
|||||||
|
|
||||||
public void GetNVRMode()
|
public void GetNVRMode()
|
||||||
{
|
{
|
||||||
|
if (Dropdown == null) return;
|
||||||
if (JsonConfig.HasKey("NVRMode"))
|
if (JsonConfig.HasKey("NVRMode"))
|
||||||
Dropdown.value = JsonConfig.GetInt("NVRMode");
|
Dropdown.value = JsonConfig.GetInt("NVRMode");
|
||||||
SetNVRMode();
|
SetNVRMode();
|
||||||
@ -73,6 +74,8 @@ public class NoneVRSettingManager : MonoBehaviour
|
|||||||
|
|
||||||
public void SetNVRMode()
|
public void SetNVRMode()
|
||||||
{
|
{
|
||||||
|
if (NVRCameraObj == null || NVRCamera == null || CameraSmooth == null || NVRCameraTargetFP == null || NVRCameraTargetTP == null)
|
||||||
|
return;
|
||||||
switch (Dropdown.value)
|
switch (Dropdown.value)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -71,7 +71,7 @@ public class StartManager : MonoBehaviour
|
|||||||
StartHostButton.interactable = false;
|
StartHostButton.interactable = false;
|
||||||
Debug.Log("Start Host Success");
|
Debug.Log("Start Host Success");
|
||||||
}
|
}
|
||||||
else if (NetworkManager.Singleton.IsClient)
|
else if (NetworkManager.Singleton.IsConnectedClient)
|
||||||
{
|
{
|
||||||
foreach (var IO in PlayerIOs)
|
foreach (var IO in PlayerIOs)
|
||||||
IO.position = new Vector3(Player2Anchor.position.x, IO.position.y, IO.position.z);
|
IO.position = new Vector3(Player2Anchor.position.x, IO.position.y, IO.position.z);
|
||||||
@ -88,12 +88,10 @@ public class StartManager : MonoBehaviour
|
|||||||
public void StartHost()
|
public void StartHost()
|
||||||
{
|
{
|
||||||
Debug.Log("Start Host");
|
Debug.Log("Start Host");
|
||||||
if (NetworkManager.Singleton.IsClient)
|
NetworkManager.Singleton.Shutdown();
|
||||||
{
|
//PlayerSettingManager.SetTarget(XRLocal);
|
||||||
NetworkManager.Singleton.Shutdown();
|
//XRLocal.SetActive(true);
|
||||||
PlayerSettingManager.SetTarget(XRLocal);
|
|
||||||
XRLocal.SetActive(true);
|
|
||||||
}
|
|
||||||
if (!NetworkManager.Singleton.StartHost())
|
if (!NetworkManager.Singleton.StartHost())
|
||||||
{
|
{
|
||||||
Debug.Log("Start Host Failed");
|
Debug.Log("Start Host Failed");
|
||||||
@ -103,12 +101,10 @@ public class StartManager : MonoBehaviour
|
|||||||
public void StartClient()
|
public void StartClient()
|
||||||
{
|
{
|
||||||
Debug.Log("Start Client");
|
Debug.Log("Start Client");
|
||||||
if (NetworkManager.Singleton.IsHost)
|
NetworkManager.Singleton.Shutdown();
|
||||||
{
|
//PlayerSettingManager.SetTarget(XRLocal);
|
||||||
NetworkManager.Singleton.Shutdown();
|
//XRLocal.SetActive(true);
|
||||||
PlayerSettingManager.SetTarget(XRLocal);
|
|
||||||
XRLocal.SetActive(true);
|
|
||||||
}
|
|
||||||
if (!NetworkManager.Singleton.StartClient())
|
if (!NetworkManager.Singleton.StartClient())
|
||||||
{
|
{
|
||||||
Debug.Log("Start Client Failed");
|
Debug.Log("Start Client Failed");
|
||||||
@ -118,7 +114,7 @@ public class StartManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
public void StopAll()
|
public void StopAll()
|
||||||
{
|
{
|
||||||
if (NetworkManager.Singleton.IsClient || NetworkManager.Singleton.IsHost)
|
if (NetworkManager.Singleton.IsClient || NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsConnectedClient)
|
||||||
NetworkManager.Singleton.Shutdown();
|
NetworkManager.Singleton.Shutdown();
|
||||||
PlayerSettingManager.SetTarget(XRLocal);
|
PlayerSettingManager.SetTarget(XRLocal);
|
||||||
XRLocal.SetActive(true);
|
XRLocal.SetActive(true);
|
||||||
|
@ -25,8 +25,9 @@ public class DisplaySync : NetworkBehaviour
|
|||||||
|
|
||||||
var DisplayP1 = GameObject.FindGameObjectWithTag("DisplayP1");
|
var DisplayP1 = GameObject.FindGameObjectWithTag("DisplayP1");
|
||||||
var DisplayP2 = GameObject.FindGameObjectWithTag("DisplayP2");
|
var DisplayP2 = GameObject.FindGameObjectWithTag("DisplayP2");
|
||||||
|
if (DisplayP1 == null)
|
||||||
|
Debug.LogError("DisplayP1 is not found");
|
||||||
|
|
||||||
Encoder.texture = DisplayP1.GetComponent<UwcWindowTexture>();
|
|
||||||
Decoder = DisplayP2.GetComponent<uNvPipeDecoder>();
|
Decoder = DisplayP2.GetComponent<uNvPipeDecoder>();
|
||||||
DecoderTexture = DisplayP2.GetComponent<uNvPipeDecodedTexture>();
|
DecoderTexture = DisplayP2.GetComponent<uNvPipeDecodedTexture>();
|
||||||
Decoder.enabled = false;
|
Decoder.enabled = false;
|
||||||
@ -37,6 +38,8 @@ public class DisplaySync : NetworkBehaviour
|
|||||||
|
|
||||||
if (IsOwner)
|
if (IsOwner)
|
||||||
{
|
{
|
||||||
|
Encoder.texture = DisplayP1.GetComponent<Renderer>();
|
||||||
|
Encoder.window = DisplayP1.GetComponent<UwcWindowTexture>();
|
||||||
Debug.Log("Add Listener");
|
Debug.Log("Add Listener");
|
||||||
Encoder.encoder.onEncoded.AddListener(OnEncoded);
|
Encoder.encoder.onEncoded.AddListener(OnEncoded);
|
||||||
}
|
}
|
||||||
|
50
Assets/Scripts/Networks/Display/OutputEncodedDataToFile.cs
Normal file
50
Assets/Scripts/Networks/Display/OutputEncodedDataToFile.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Unity.Netcode;
|
||||||
|
namespace uNvEncoder.Examples
|
||||||
|
{
|
||||||
|
|
||||||
|
public class OutputEncodedDataToFile : NetworkBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
string filePath = "test.h264";
|
||||||
|
|
||||||
|
FileStream fileStream_;
|
||||||
|
BinaryWriter binaryWriter_;
|
||||||
|
|
||||||
|
public override void OnNetworkSpawn()
|
||||||
|
{
|
||||||
|
if (!IsOwner) return;
|
||||||
|
fileStream_ = new FileStream(filePath, FileMode.Create, FileAccess.Write);
|
||||||
|
binaryWriter_ = new BinaryWriter(fileStream_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnApplicationQuit()
|
||||||
|
{
|
||||||
|
if (fileStream_ != null)
|
||||||
|
{
|
||||||
|
fileStream_.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (binaryWriter_ != null)
|
||||||
|
{
|
||||||
|
binaryWriter_.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnData(System.IntPtr ptr, int size)
|
||||||
|
{
|
||||||
|
if (!enabled) return;
|
||||||
|
|
||||||
|
if (ptr == System.IntPtr.Zero) return;
|
||||||
|
|
||||||
|
var bytes = new byte[size];
|
||||||
|
Marshal.Copy(ptr, bytes, 0, size);
|
||||||
|
if (bytes == null)
|
||||||
|
return;
|
||||||
|
binaryWriter_.Write(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bd43cfe121bf2b046995caf4e7930a8b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -7,7 +7,8 @@ using Newtonsoft.Json.Linq;
|
|||||||
public class WindowEncoder : NetworkBehaviour
|
public class WindowEncoder : NetworkBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public UwcWindowTexture texture = null;
|
public Renderer texture = null;
|
||||||
|
public UwcWindowTexture window = null;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public uNvEncoder.Encoder encoder = null;
|
public uNvEncoder.Encoder encoder = null;
|
||||||
@ -26,7 +27,8 @@ public class WindowEncoder : NetworkBehaviour
|
|||||||
public int idrFrameIntervalFrame = 24;
|
public int idrFrameIntervalFrame = 24;
|
||||||
int idrFrameCounter_ = 0;
|
int idrFrameCounter_ = 0;
|
||||||
public int ResolutionDivider = 2;
|
public int ResolutionDivider = 2;
|
||||||
Texture2D sTexture;
|
public Texture2D IdleTexture = null;
|
||||||
|
public Texture2D sTexture;
|
||||||
|
|
||||||
public override void OnNetworkSpawn()
|
public override void OnNetworkSpawn()
|
||||||
{
|
{
|
||||||
@ -65,26 +67,32 @@ public class WindowEncoder : NetworkBehaviour
|
|||||||
RenderTexture rt;
|
RenderTexture rt;
|
||||||
void Resize()
|
void Resize()
|
||||||
{
|
{
|
||||||
Graphics.Blit(texture.window.texture, rt);
|
if (texture.material.mainTexture == null)
|
||||||
|
Graphics.Blit(IdleTexture, rt);
|
||||||
|
else
|
||||||
|
Graphics.Blit(texture.material.mainTexture, rt);
|
||||||
sTexture.ReadPixels(new Rect(0,0,setting.width, setting.height),0,0);
|
sTexture.ReadPixels(new Rect(0,0,setting.width, setting.height),0,0);
|
||||||
sTexture.Apply();
|
sTexture.Apply();
|
||||||
}
|
}
|
||||||
IEnumerator EncodeLoop()
|
IEnumerator EncodeLoop()
|
||||||
{
|
{
|
||||||
|
Debug.Log("EncodeLoop");
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (texture.window != null) break;
|
if (texture.material.mainTexture != null) break;
|
||||||
|
Debug.Log("Wait for texture");
|
||||||
yield return new WaitForEndOfFrame();
|
yield return new WaitForEndOfFrame();
|
||||||
}
|
}
|
||||||
|
Debug.Log("EncodeLoop SetSetting");
|
||||||
setting.width = texture.window.width / ResolutionDivider;
|
|
||||||
setting.height = texture.window.height / ResolutionDivider;
|
setting.width = window.window.width / ResolutionDivider;
|
||||||
|
setting.height = window.window.height / ResolutionDivider;
|
||||||
encoder.Create(setting);
|
encoder.Create(setting);
|
||||||
|
|
||||||
rt = new RenderTexture(setting.width, setting.height, 24);
|
rt = new RenderTexture(setting.width, setting.height, 24);
|
||||||
sTexture = new Texture2D(setting.width, setting.height, TextureFormat.BGRA32, false);
|
sTexture = new Texture2D(setting.width, setting.height, TextureFormat.BGRA32, false);
|
||||||
RenderTexture.active = rt;
|
RenderTexture.active = rt;
|
||||||
|
Debug.Log("EncodeLoop Start");
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (setting.frameRate < 60)
|
if (setting.frameRate < 60)
|
||||||
|
@ -200,8 +200,24 @@ PlayerSettings:
|
|||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: -6018045015233401694, guid: 3999ab811e936714280a476b3a032d86, type: 2}
|
- {fileID: 0}
|
||||||
- {fileID: 6536100391545742739, guid: 55d1ec7a4296de343b6d3bb6f9a19731, type: 2}
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
wsaTransparentSwapchain: 0
|
wsaTransparentSwapchain: 0
|
||||||
m_HolographicPauseOnTrackingLoss: 1
|
m_HolographicPauseOnTrackingLoss: 1
|
||||||
@ -580,6 +596,9 @@ PlayerSettings:
|
|||||||
- m_BuildTarget: AndroidPlayer
|
- m_BuildTarget: AndroidPlayer
|
||||||
m_APIs: 0b00000008000000
|
m_APIs: 0b00000008000000
|
||||||
m_Automatic: 0
|
m_Automatic: 0
|
||||||
|
- m_BuildTarget: WindowsStandaloneSupport
|
||||||
|
m_APIs: 02000000
|
||||||
|
m_Automatic: 0
|
||||||
m_BuildTargetVRSettings: []
|
m_BuildTargetVRSettings: []
|
||||||
openGLRequireES31: 0
|
openGLRequireES31: 0
|
||||||
openGLRequireES31AEP: 0
|
openGLRequireES31AEP: 0
|
||||||
|
Loading…
Reference in New Issue
Block a user