Skip to content

Commit a980fbc

Browse files
FIX: Hover Over Shader
FIX: Warnings
1 parent 8d2b070 commit a980fbc

25 files changed

+270
-85
lines changed

CAVE2/Examples/CAVESimulator/Scripts/ScreenConfigCalc.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public class ScreenConfigCalc : MonoBehaviour {
1515

1616
[SerializeField] float borderTop = 4; // mm
1717
[SerializeField] float borderBottom = 2; // mm
18-
[SerializeField] float borderLeft = 4; // mm
19-
[SerializeField] float borderRight = 2; // mm
18+
// [SerializeField] float borderLeft = 4; // mm
19+
// [SerializeField] float borderRight = 2; // mm
2020

2121
[Header("Wall Parameters")]
2222
[SerializeField] float frontDisplayToTrackingOrigin = 3240; // mm
@@ -103,8 +103,8 @@ void GenerateCAVE2() {
103103
}
104104

105105
angle = 2.0f * Mathf.Atan(displayWidthIncBorders / 2.0f / frontDisplayToTrackingOrigin);
106-
107-
float displayPixelWidth = displayWidthIncBorders - borderLeft - borderRight;
106+
107+
// float displayPixelWidth = displayWidthIncBorders - borderLeft - borderRight;
108108
float displayPixelHeight = displayHeightIncBorders - borderTop - borderBottom;
109109

110110

CAVE2/Examples/HoloLens/Scripts/HoloLensTestBuildManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ enum Mode { Simulator, Build, CAVE2Server, Remote, Playback };
6767
[SerializeField]
6868
Camera holoLensCamera;
6969

70-
[SerializeField]
71-
int currentHoloLensCameraMask;
70+
// [SerializeField]
71+
// int currentHoloLensCameraMask;
7272

7373
[SerializeField]
7474
int VRProjectionCameraMask;
@@ -120,9 +120,9 @@ private void Start()
120120
private void Update()
121121
{
122122
UpdateMode();
123-
currentHoloLensCameraMask = holoLensCamera.cullingMask;
123+
// currentHoloLensCameraMask = holoLensCamera.cullingMask;
124124

125-
if(cave2RPCManager.IsReconnecting())
125+
if (cave2RPCManager.IsReconnecting())
126126
{
127127
if (showHMDTerminal && lastShowHMDTerminalState == 0)
128128
{

CAVE2/Networking/Scripts/CAVE2NetworkManager.cs

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ public class CAVE2NetworkManager : MonoBehaviour
1212
// Custom NetMsg IDs
1313
private short ClientConnect = 1000;
1414
private short ServerAssign = 1001;
15+
private short PosUpdate = 1002;
16+
// private short CAVE2BroadcastMsg1 = 101;
17+
// private short CAVE2BroadcastMsg2 = 102;
18+
// private short CAVE2SendMsg = 200;
19+
// private short CAVE2SendMsg1 = 201;
20+
// private short CAVE2SendMsg2 = 201;
1521

1622
public enum NetMode { None, Server, Client, Display };
1723

@@ -41,9 +47,12 @@ public enum ConnectState { None, Connecting, Connected, Disconnected, Reconnecti
4147
int connID = 0;
4248

4349
Dictionary<string, ClientInfo> clientList;
50+
Dictionary<string, GameObject> gameObjectList;
4451

4552
public void Start()
4653
{
54+
gameObjectList = new Dictionary<string, GameObject>();
55+
4756
if (dontDestroyOnLoad)
4857
{
4958
DontDestroyOnLoad(gameObject);
@@ -132,6 +141,7 @@ public void StartClient()
132141
netClient.RegisterHandler(MsgType.Connect, OnClientConnected);
133142
netClient.RegisterHandler(MsgType.Disconnect, OnServerDisconnected);
134143
netClient.RegisterHandler(ServerAssign, OnServerAssignment);
144+
netClient.RegisterHandler(PosUpdate, OnServerPositionUpdate);
135145

136146
netClient.Connect(serverIP, serverListenPort);
137147
connectState = ConnectState.Connecting;
@@ -214,6 +224,134 @@ void OnClientDisconnected(NetworkMessage netmsg)
214224
Debug.Log("Client " + netmsg.conn.connectionId + " disconnected");
215225
}
216226

227+
public void BroadcastMessage(string targetObjectName, string methodName, object param, CAVE2RPCManager.MsgType channel = CAVE2RPCManager.MsgType.Reliable)
228+
{
229+
GameObject targetGameObject;
230+
if (!gameObjectList.ContainsKey(targetObjectName))
231+
{
232+
targetGameObject = GameObject.Find(targetObjectName);
233+
}
234+
else
235+
{
236+
targetGameObject = gameObjectList[targetObjectName];
237+
}
238+
239+
if (targetGameObject != null)
240+
{
241+
gameObjectList[targetObjectName] = targetGameObject;
242+
243+
// Call locally
244+
gameObjectList[targetObjectName].BroadcastMessage(methodName, param);
245+
246+
// Send to others
247+
}
248+
}
249+
250+
public void SendMessage(string targetObjectName, string methodName, object param, CAVE2RPCManager.MsgType channel = CAVE2RPCManager.MsgType.Reliable)
251+
{
252+
GameObject targetGameObject;
253+
if (!gameObjectList.ContainsKey(targetObjectName))
254+
{
255+
targetGameObject = GameObject.Find(targetObjectName);
256+
}
257+
else
258+
{
259+
targetGameObject = gameObjectList[targetObjectName];
260+
}
261+
262+
if (targetGameObject != null)
263+
{
264+
gameObjectList[targetObjectName] = targetGameObject;
265+
266+
// Call locally
267+
gameObjectList[targetObjectName].SendMessage(methodName, param);
268+
269+
// Send to others
270+
271+
}
272+
}
273+
274+
public void SendMessage(string targetObjectName, string methodName, object param, object param2, CAVE2RPCManager.MsgType channel = CAVE2RPCManager.MsgType.Reliable)
275+
{
276+
GameObject targetGameObject;
277+
if (!gameObjectList.ContainsKey(targetObjectName))
278+
{
279+
targetGameObject = GameObject.Find(targetObjectName);
280+
}
281+
else
282+
{
283+
targetGameObject = gameObjectList[targetObjectName];
284+
}
285+
286+
if (targetGameObject != null)
287+
{
288+
gameObjectList[targetObjectName] = targetGameObject;
289+
290+
// Call locally
291+
gameObjectList[targetObjectName].SendMessage(methodName, new object[] { param, param2 });
292+
293+
// Send to others
294+
295+
}
296+
}
297+
298+
public void SendMessage2(NetworkMessage netmsg)
299+
{
300+
301+
}
302+
303+
public void UpdatePosition(string targetObjectName, Vector3 position, bool isLocal = false, int channel = Channels.DefaultUnreliable)
304+
{
305+
GameObject targetGameObject;
306+
if (!gameObjectList.ContainsKey(targetObjectName))
307+
{
308+
targetGameObject = GameObject.Find(targetObjectName);
309+
}
310+
else
311+
{
312+
targetGameObject = gameObjectList[targetObjectName];
313+
}
314+
315+
if (targetGameObject != null)
316+
{
317+
gameObjectList[targetObjectName] = targetGameObject;
318+
319+
ObjPosMsg msg = new ObjPosMsg();
320+
msg.gameObjectName = targetObjectName;
321+
msg.position = position;
322+
msg.isLocal = isLocal;
323+
324+
SendToAll(PosUpdate, msg, channel);
325+
}
326+
}
327+
328+
public void OnServerPositionUpdate(NetworkMessage netmsg)
329+
{
330+
ObjPosMsg msg = netmsg.ReadMessage<ObjPosMsg>();
331+
string targetObjectName = msg.gameObjectName;
332+
333+
GameObject targetGameObject = gameObjectList[targetObjectName];
334+
335+
if (targetGameObject == null)
336+
{
337+
targetGameObject = GameObject.Find(targetObjectName);
338+
}
339+
340+
if (targetGameObject != null)
341+
{
342+
gameObjectList[targetObjectName] = targetGameObject;
343+
344+
if (msg.isLocal)
345+
{
346+
targetGameObject.transform.localPosition = msg.position;
347+
}
348+
else
349+
{
350+
targetGameObject.transform.position = msg.position;
351+
}
352+
}
353+
}
354+
217355
// Client function handlers --------------------------------------------------------------
218356
void OnClientConnected(NetworkMessage netmsg)
219357
{
@@ -266,3 +404,16 @@ public class ServerAssignmentMsg : MessageBase
266404
{
267405
public int connID;
268406
}
407+
408+
public class ObjPosMsg : MessageBase
409+
{
410+
public string gameObjectName;
411+
public Vector3 position;
412+
public bool isLocal;
413+
}
414+
415+
public class CAVE2Msg : MessageBase
416+
{
417+
public string gameObjectName;
418+
public string methodName;
419+
}
-149 KB
Binary file not shown.
-445 Bytes
Binary file not shown.

CAVE2/Scripts/Examples/CAVE2LoadSceneWandClick.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class CAVE2LoadSceneWandClick : CAVE2Interactable
1515

1616
new public void OnWandButtonDown(CAVE2.WandEvent evt)
1717
{
18-
CAVE2PlayerIdentity playerID = (CAVE2PlayerIdentity)evt.playerID;
18+
// CAVE2PlayerIdentity playerID = (CAVE2PlayerIdentity)evt.playerID;
1919
int wandID = (int)evt.wandID;
2020
CAVE2.Button button = (CAVE2.Button)evt.button;
2121

CAVE2/Scripts/Examples/GrabbableObject.cs.meta

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CAVE2/Scripts/Managers/CAVE2AdvancedTrackingSimulator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void KeyboardHeadTracking()
169169
Vector3 headRotation = CAVE2.GetCAVE2Manager().simulatorHeadRotation;
170170

171171
Vector3 wandPosition = CAVE2.GetCAVE2Manager().simulatorWandPosition;
172-
Vector3 wandRotation = CAVE2.GetCAVE2Manager().simulatorWandRotation;
172+
// Vector3 wandRotation = CAVE2.GetCAVE2Manager().simulatorWandRotation;
173173

174174
Vector3 translation = Vector3.zero;
175175
Vector3 rotation = Vector3.zero;

CAVE2/Scripts/Managers/CAVE2Manager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
public class CAVE2 : MonoBehaviour
3333
{
34-
static float CAVE2_RADIUS = 3.240f;
34+
// static float CAVE2_RADIUS = 3.240f;
3535
static float CAVE2_FLOOR_TO_BOTTOM_DISPLAY = 0.293f;
3636
static float CAVE2_DISPLAY_W_BORDER_HEIGHT = 0.581f;
3737

CAVE2/Scripts/Managers/CAVE2RPCManager.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class CAVE2RPCManager : MonoBehaviour {
5454
[SerializeField]
5555
public bool useMsgServer;
5656

57-
static short MessageID = 1104;
57+
// static short MessageID = 1104;
5858
NetworkServerSimple msgServer;
5959
NetworkMessageDelegate serverOnClientConnect;
6060
NetworkMessageDelegate serverOnClientDisconnect;
@@ -92,13 +92,13 @@ public enum MsgType { Reliable, Unreliable, StateUpdate };
9292
[SerializeField]
9393
bool debugMsg;
9494

95-
bool connected = false;
95+
// bool connected = false;
9696

97-
[SerializeField]
98-
bool autoReconnect = true;
97+
// [SerializeField]
98+
// bool autoReconnect = true;
9999

100-
[SerializeField]
101-
float autoReconnectDelay = 5;
100+
// [SerializeField]
101+
// float autoReconnectDelay = 5;
102102

103103
float autoReconnectTimer;
104104
int reconnectAttemptCount;
@@ -254,15 +254,15 @@ void UpdateNetwork()
254254
case NetworkEventType.DataEvent:
255255
NetworkReader networkReader = new NetworkReader(recBuffer);
256256

257-
byte[] readerMsgSizeData = networkReader.ReadBytes(2);
258-
short readerMsgSize = (short)((readerMsgSizeData[1] << 8) + readerMsgSizeData[0]);
257+
// byte[] readerMsgSizeData = networkReader.ReadBytes(2);
258+
// short readerMsgSize = (short)((readerMsgSizeData[1] << 8) + readerMsgSizeData[0]);
259259

260260
byte[] readerMsgTypeData = networkReader.ReadBytes(2);
261261
short readerMsgType = (short)((readerMsgTypeData[1] << 8) + readerMsgTypeData[0]);
262262

263263
string targetObjectName = networkReader.ReadString();
264264
string methodName = networkReader.ReadString();
265-
int paramCount = networkReader.ReadInt32();
265+
// int paramCount = networkReader.ReadInt32();
266266

267267
switch (readerMsgType)
268268
{
@@ -350,14 +350,14 @@ void ServerOnClientDisconnect(int clientConnectionId)
350350
void ClientOnConnect()
351351
{
352352
LogUI("Msg Client: Connected to " + serverIP);
353-
connected = true;
353+
// connected = true;
354354
reconnectAttemptCount = 0;
355355
}
356356

357357
void ClientOnDisconnect(NetworkMessage msg)
358358
{
359359
LogUI("Msg Client: Disconnected");
360-
connected = false;
360+
// connected = false;
361361
}
362362

363363
void ServerSendMsgToClients(byte[] writerData, MsgType msgType)

0 commit comments

Comments
 (0)