public override void SendObject(string id, SceneObject sceneObject, string dagPath, NodeType nodeType, params object[] args) { bool onlyToClientsWithoutPhysics = false; if (args.Length > 0) { onlyToClientsWithoutPhysics = (bool)args[0]; } if (sceneObject.GetType() == typeof(SceneObject)) { if (nodeType == NodeType.LIGHT) { if (sceneObject.IsLight) { Light light = sceneObject.SourceLight; // color sendMessageQueue.Add("client " + id + "|" + "c" + "|" + dagPath + "|" + light.color.r + "|" + light.color.g + "|" + light.color.b); //intensity sendMessageQueue.Add("client " + id + "|" + "i" + "|" + dagPath + "|" + light.intensity); // cone sendMessageQueue.Add("client " + id + "|" + "a" + "|" + dagPath + "|" + light.spotAngle); // range sendMessageQueue.Add("client " + id + "|" + "d" + "|" + dagPath + "|" + light.range); } } else if (nodeType == NodeType.CAMERA) { } else if (nodeType == NodeType.GEO) // send mesh i.e. { } else // send transform { Transform obj = sceneObject.transform; string physicString = ""; if (onlyToClientsWithoutPhysics) { physicString = "|physics"; } // translate sendMessageQueue.Add("client " + id + "|" + "t" + "|" + dagPath + "|" + obj.localPosition.x + "|" + obj.localPosition.y + "|" + obj.localPosition.z + physicString); // rotate sendMessageQueue.Add("client " + id + "|" + "r" + "|" + dagPath + "|" + obj.localRotation.x + "|" + obj.localRotation.y + "|" + obj.localRotation.z + "|" + obj.localRotation.w + physicString); // scale sendMessageQueue.Add("client " + id + "|" + "s" + "|" + dagPath + "|" + obj.localScale.x + "|" + obj.localScale.y + "|" + obj.localScale.z); } } else //light, camera if ( sobj.GetType() == typeof(SceneObjectLight) ) { } }
public override void SendObject(string id, SceneObject sceneObject, string dagPath, NodeType nodeType, params object[] args) { // HACK check missing '/' upstream dagPath = "/" + dagPath; if (sceneObject.GetType() == typeof(SceneObject)) { if (nodeType == NodeType.LIGHT) { if (sceneObject.IsLight) { Light light = sceneObject.SourceLight; sendMessageQueue.Add(String.Format(lightIntensityColorTemplate, dagPath, ((LightTypeKatana)(light.type)).ToString(), light.intensity / VPETSettings.Instance.lightIntensityFactor, light.color.r + " " + light.color.g + " " + light.color.b, sceneObject.exposure, light.spotAngle)); } } else if (nodeType == NodeType.CAMERA) { } else // send transform { if (sceneObject.IsLight) // do transform for lights to katana differently { Transform obj = sceneObject.transform; Vector3 pos = obj.localPosition; Quaternion rot = obj.localRotation; Vector3 scl = obj.localScale; Quaternion rotY180 = Quaternion.AngleAxis(180, Vector3.up); rot = rot * rotY180; float angle = 0; Vector3 axis = Vector3.zero; rot.ToAngleAxis(out angle, out axis); sendMessageQueue.Add(String.Format(lightTransRotTemplate, dagPath, (-pos.x + " " + pos.y + " " + pos.z), (angle + " " + axis.x + " " + -axis.y + " " + -axis.z), (scl.x + " " + scl.y + " " + scl.z))); } else if (sceneObject.transform.GetComponent <CameraObject>() != null) // do camera different too --> in fact is the same as for lights?? { Transform obj = sceneObject.transform; Vector3 pos = obj.localPosition; Quaternion rot = obj.localRotation; Vector3 scl = obj.localScale; Quaternion rotY180 = Quaternion.AngleAxis(180, Vector3.up); rot = rot * rotY180; float angle = 0; Vector3 axis = Vector3.zero; rot.ToAngleAxis(out angle, out axis); sendMessageQueue.Add(String.Format(camTransRotTemplate, dagPath, (-pos.x + " " + pos.y + " " + pos.z), (angle + " " + axis.x + " " + -axis.y + " " + -axis.z), (scl.x + " " + scl.y + " " + scl.z))); } else { Transform obj = sceneObject.transform; Vector3 pos = obj.localPosition; Quaternion rot = obj.localRotation; Vector3 scl = obj.localScale; float angle = 0; Vector3 axis = Vector3.zero; rot.ToAngleAxis(out angle, out axis); sendMessageQueue.Add(String.Format(objTemplateQuat, dagPath, (-pos.x + " " + pos.y + " " + pos.z), (angle + " " + axis.x + " " + -axis.y + " " + -axis.z), (scl.x + " " + scl.y + " " + scl.z))); } } } else //light, camera if ( sobj.GetType() == typeof(SceneObject) ) { } }