/* * private bool hasLodLowChild( Transform t ) * { * if (t.gameObject.layer == lodLowLayer) * return true; * * foreach( Transform c in t ) * { * if ( hasLodLowChild(c) ) * { * return true; * } * } * * return false; * } */ private void gatherSceneData() { nodeList = new List <SceneNode>(); objectList = new List <ObjectPackage>(); textureList = new List <TexturePackage>(); #if TRUNK materialList = new List <MaterialPackage>(); #endif iterLocation(sceneRoot.transform); Debug.Log(string.Format("{0}: Collected number nodes: {1}", this.GetType(), nodeList.Count)); Debug.Log(string.Format("{0}: Collected number objects: {1}", this.GetType(), objectList.Count)); Debug.Log(string.Format("{0}: Collected number textures: {1}", this.GetType(), textureList.Count)); #if TRUNK Debug.Log(string.Format("{0}: Collected number materials: {1}", this.GetType(), materialList.Count)); #endif // create byte arrays headerByteData = SceneDataHandler.StructureToByteArray <VpetHeader>(vpetHeader); getNodesByteArray(); getObjectsByteArray(); getTexturesByteArray(); #if TRUNK getMaterialsByteArray(); #endif Debug.Log(string.Format("{0}: HeaderByteArray size: {1}", this.GetType(), headerByteData.Length)); Debug.Log(string.Format("{0}: NodeByteArray size: {1}", this.GetType(), nodesByteData.Length)); Debug.Log(string.Format("{0}: ObjectsByteArray size: {1}", this.GetType(), objectsByteData.Length)); Debug.Log(string.Format("{0}: TexturesByteArray size: {1}", this.GetType(), texturesByteData.Length)); #if TRUNK Debug.Log(string.Format("{0}: MaterialsByteArray size: {1}", this.GetType(), materialsByteData.Length)); #endif }
private byte[] getNodesByteArrayV1100() { Byte[] nodesByteData = new byte[0]; foreach (SceneNode node in sceneDataHandler.NodeList) { byte[] nodeBinary; byte[] nodeTypeBinary; if (node.GetType() == typeof(SceneNodeGeo)) { nodeTypeBinary = BitConverter.GetBytes((int)NodeType.GEO); SceneNodeGeo nodeGeo = (SceneNodeGeo)Convert.ChangeType(node, typeof(SceneNodeGeo)); // change to V1100 geo node SceneNodeGeoV1100 nodeGeoV1100 = new SceneNodeGeoV1100(); copyProperties(nodeGeo, nodeGeoV1100); nodeGeoV1100.materialId = -1; //PrintProperties(nodeGeoV1100); nodeBinary = SceneDataHandler.StructureToByteArray <SceneNodeGeoV1100>(nodeGeoV1100); } else if (node.GetType() == typeof(SceneNodeLight)) { nodeTypeBinary = BitConverter.GetBytes((int)NodeType.LIGHT); SceneNodeLight nodeLight = (SceneNodeLight)Convert.ChangeType(node, typeof(SceneNodeLight)); nodeBinary = SceneDataHandler.StructureToByteArray <SceneNodeLight>(nodeLight); } else if (node.GetType() == typeof(SceneNodeCam)) { nodeTypeBinary = BitConverter.GetBytes((int)NodeType.CAMERA); SceneNodeCam nodeCam = (SceneNodeCam)Convert.ChangeType(node, typeof(SceneNodeCam)); nodeBinary = SceneDataHandler.StructureToByteArray <SceneNodeCam>(nodeCam); } else if (node.GetType() == typeof(SceneNodeMocap)) { nodeTypeBinary = BitConverter.GetBytes((int)NodeType.MOCAP); SceneNodeMocap nodeMocap = (SceneNodeMocap)Convert.ChangeType(node, typeof(SceneNodeMocap)); nodeBinary = SceneDataHandler.StructureToByteArray <SceneNodeMocap>(nodeMocap); } else { nodeTypeBinary = BitConverter.GetBytes((int)NodeType.GROUP); nodeBinary = SceneDataHandler.StructureToByteArray <SceneNode>(node); } // concate arrays nodesByteData = SceneDataHandler.Concat <byte>(nodesByteData, nodeTypeBinary); nodesByteData = SceneDataHandler.Concat <byte>(nodesByteData, nodeBinary); } return(nodesByteData); }
/* * private bool hasLodLowChild( Transform t ) * { * if (t.gameObject.layer == lodLowLayer) * return true; * * foreach( Transform c in t ) * { * if ( hasLodLowChild(c) ) * { * return true; * } * } * * return false; * } */ private void gatherSceneData() { nodeList = new List <SceneNode>(); objectList = new List <ObjectPackage>(); characterList = new List <CharacterPackage>(); textureList = new List <TexturePackage>(); gameObjectList = new List <GameObject>(); #if TRUNK materialList = new List <MaterialPackage>(); #endif recursiveGameObjectIdExtract(sceneRoot.transform.GetChild(0)); iterLocation(sceneRoot.transform); serverAdapter.sceneObjectRefList = new SceneObject[globalID]; recursiveIdExtract(sceneRoot.transform.GetChild(0)); Debug.Log(string.Format("{0}: Collected number nodes: {1}", this.GetType(), nodeList.Count)); Debug.Log(string.Format("{0}: Collected number objects: {1}", this.GetType(), objectList.Count)); Debug.Log(string.Format("{0}: Collected number skinned charcaters: {1}", this.GetType(), characterList.Count)); Debug.Log(string.Format("{0}: Collected number textures: {1}", this.GetType(), textureList.Count)); #if TRUNK Debug.Log(string.Format("{0}: Collected number materials: {1}", this.GetType(), materialList.Count)); #endif // create byte arrays headerByteData = SceneDataHandler.StructureToByteArray(vpetHeader); getNodesByteArray(); getObjectsByteArray(); getCharacterByteArray(); getTexturesByteArray(); #if TRUNK getMaterialsByteArray(); #endif Debug.Log(string.Format("{0}: HeaderByteArray size: {1}", this.GetType(), headerByteData.Length)); Debug.Log(string.Format("{0}: NodeByteArray size: {1}", this.GetType(), nodesByteData.Length)); Debug.Log(string.Format("{0}: ObjectsByteArray size: {1}", this.GetType(), objectsByteData.Length)); Debug.Log(string.Format("{0}: CharacterByteArray size: {1}", this.GetType(), charactersByteData.Length)); Debug.Log(string.Format("{0}: TexturesByteArray size: {1}", this.GetType(), texturesByteData.Length)); #if TRUNK Debug.Log(string.Format("{0}: MaterialsByteArray size: {1}", this.GetType(), materialsByteData.Length)); #endif }
private void getNodesByteArray() { nodesByteData = new byte[0]; foreach (SceneNode node in nodeList) { byte[] nodeBinary; byte[] nodeTypeBinary; if (node.GetType() == typeof(SceneNodeGeo)) { nodeTypeBinary = BitConverter.GetBytes((int)NodeType.GEO); SceneNodeGeo nodeGeo = (SceneNodeGeo)Convert.ChangeType(node, typeof(SceneNodeGeo)); nodeBinary = SceneDataHandler.StructureToByteArray(nodeGeo); } else if (node.GetType() == typeof(SceneNodeSkinnedGeo)) { nodeTypeBinary = BitConverter.GetBytes((int)NodeType.SKINNEDMESH); SceneNodeSkinnedGeo nodeskinnedGeo = (SceneNodeSkinnedGeo)Convert.ChangeType(node, typeof(SceneNodeSkinnedGeo)); nodeBinary = SceneDataHandler.StructureToByteArray(nodeskinnedGeo); } else if (node.GetType() == typeof(SceneNodeLight)) { nodeTypeBinary = BitConverter.GetBytes((int)NodeType.LIGHT); SceneNodeLight nodeLight = (SceneNodeLight)Convert.ChangeType(node, typeof(SceneNodeLight)); nodeBinary = SceneDataHandler.StructureToByteArray(nodeLight); } else if (node.GetType() == typeof(SceneNodeCam)) { nodeTypeBinary = BitConverter.GetBytes((int)NodeType.CAMERA); SceneNodeCam nodeCam = (SceneNodeCam)Convert.ChangeType(node, typeof(SceneNodeCam)); nodeBinary = SceneDataHandler.StructureToByteArray(nodeCam); } else { nodeTypeBinary = BitConverter.GetBytes((int)NodeType.GROUP); nodeBinary = SceneDataHandler.StructureToByteArray(node); } // concate arrays nodesByteData = SceneDataHandler.Concat <byte>(nodesByteData, nodeTypeBinary); nodesByteData = SceneDataHandler.Concat <byte>(nodesByteData, nodeBinary); } }