//! //! none //! public void sceneReceiverResource() { print("Trying to load scene."); OnProgress(0.1f, "Init Scene Receiver.."); SceneObjectKatana sceneObjectKatana = new SceneObjectKatana(); bool success = false; if (VPETSettings.Instance.doLoadTextures) { print("textu"); byte[] byteStreamTextures = loadBinary("textu"); print("byteStreamTextures size: " + byteStreamTextures.Length); success = sceneObjectKatana.parseTexture(byteStreamTextures); print("Texture Count: " + sceneObjectKatana.rawTextureList.Count); OnProgress(0.33f, "..Received Texture.."); } print("objec"); byte[] byteStreamObjects = loadBinary("objec"); print("byteStreamObjects size: " + byteStreamObjects.Length); success = sceneObjectKatana.parseObject(byteStreamObjects); print("Object Count: " + sceneObjectKatana.rawVertexList.Count); OnProgress(0.80f, "..Received Objects.."); print("nodes"); byte[] byteStreamNodes = loadBinary("nodes"); print("byteStreamNodess size: " + byteStreamNodes.Length); success = sceneObjectKatana.parseNode(byteStreamNodes); print("Node count: " + sceneObjectKatana.rawNodeList.Count); OnProgress(0.9f, "..Received Nodes.."); if (success) { receiveObjectQueue.Add(sceneObjectKatana); } print("done load scene"); OnProgress(1.0f, "..Building Scene.."); }
//! //! receiver function, receiving the initial scene from the katana server (executed in separate thread) //! public void sceneReceiver() { //create NetMQ context NetMQContext ctx = NetMQContext.Create(); print("Trying to receive scene."); OnProgress(0.1f, "Init Scene Receiver.."); NetMQ.Sockets.RequestSocket sceneReceiver = ctx.CreateRequestSocket(); sceneReceiver.Connect("tcp://" + VPETSettings.Instance.serverIP + ":5565"); print("Server set up."); SceneObjectKatana sceneObjectKatana = new SceneObjectKatana(); bool success = false; if (VPETSettings.Instance.doLoadTextures) { print("textu"); sceneReceiver.Send("textu"); byte[] byteStreamTextures = sceneReceiver.Receive() as byte[]; print("byteStreamTextures size: " + byteStreamTextures.Length); success = sceneObjectKatana.parseTexture(byteStreamTextures); print("Texture Count: " + sceneObjectKatana.rawTextureList.Count); if (doWriteScene) { writeBinary(byteStreamTextures, "textu"); } OnProgress(0.33f, "..Received Texture.."); } print("objec"); sceneReceiver.Send("objec"); byte[] byteStreamObjects = sceneReceiver.Receive() as byte[]; print("byteStreamObjects size: " + byteStreamObjects.Length); success = sceneObjectKatana.parseObject(byteStreamObjects); print("Object Count: " + sceneObjectKatana.rawVertexList.Count); if (doWriteScene) { writeBinary(byteStreamObjects, "objec"); } OnProgress(0.80f, "..Received Objects.."); print("nodes"); sceneReceiver.Send("nodes"); byte[] byteStreamNodes = sceneReceiver.Receive() as byte[]; print("byteStreamNodess size: " + byteStreamNodes.Length); success = sceneObjectKatana.parseNode(byteStreamNodes); print("Node count: " + sceneObjectKatana.rawNodeList.Count); if (doWriteScene) { writeBinary(byteStreamNodes, "nodes"); } OnProgress(0.9f, "..Received Nodes.."); if (success) { receiveObjectQueue.Add(sceneObjectKatana); } sceneReceiver.Disconnect("tcp://" + VPETSettings.Instance.serverIP + ":5565"); sceneReceiver.Close(); print("done receive scene"); OnProgress(1.0f, "..Building Scene.."); }