public void LoadBillboards(string pFile) { try { this.Billboards.Clear(); DataSet dataSet = new DataSet(); dataSet.ReadXml(pFile); DataTable dataTable = dataSet.Tables[0]; if (dataTable.Rows.Count > 0) { foreach (DataRow dataRow in dataTable.Rows) { string pName = (string)dataRow[0]; int index = Convert.ToInt32(dataRow[1]); float valueX = CHelper.myToSingle((string)dataRow[2]); float valueY = CHelper.myToSingle((string)dataRow[3]); float num = CHelper.myToSingle((string)dataRow[4]); float pAngleZ = CHelper.myToSingle((string)dataRow[5]); CBillboardMesh pBillboardMesh = this.m_BillboardMeshs[index]; Vector3 position = new Vector3(valueX, valueY, num); CBillboard cBillboard = new CBillboard(this.myTerrain, pName, this.device, pBillboardMesh, position, pAngleZ); if (num == 0f) { cBillboard.Z = this.myTerrain.getZ(cBillboard.Position.X, cBillboard.Position.Y); } this.Billboards.Add(cBillboard); } } } catch { } }
public void LoadBillboardMeshs(string pBillboard3DsFile) { this.m_BillboardMeshs.Clear(); DataSet dataSet = new DataSet(); dataSet.ReadXml(pBillboard3DsFile); DataTable dataTable = dataSet.Tables[0]; if (dataTable.Rows.Count > 0) { foreach (DataRow dataRow in dataTable.Rows) { string pName = (string)dataRow[0]; string text = (string)dataRow[1]; int pcols = Convert.ToInt32(dataRow[2]); int prows = Convert.ToInt32(dataRow[3]); int pdelay = Convert.ToInt32(dataRow[4]); float pWidth = CHelper.myToSingle((string)dataRow[5]); float pHeight = CHelper.myToSingle((string)dataRow[6]); float pShiftZ = CHelper.myToSingle((string)dataRow[7]); if (File.Exists(text)) { CBillboardMesh item = new CBillboardMesh(pName, this.device, text, pcols, prows, pdelay, pWidth, pHeight, pShiftZ); this.m_BillboardMeshs.Add(item); } } } }
public void Load1Billboard(string pName, int pBillboardIndex, Vector3 pPos, float dHeading) { CBillboardMesh pBillboardMesh = this.m_BillboardMeshs[pBillboardIndex]; CBillboard cBillboard = new CBillboard(this.myTerrain, pName, this.device, pBillboardMesh, pPos, dHeading); cBillboard.Z = this.myTerrain.getZ(cBillboard.Position.X, cBillboard.Position.Y); this.Billboards.Add(cBillboard); }
public CBillboard(CTerrainMesh pTerrain, string pName, Device device, CBillboardMesh pBillboardMesh, Vector3 position, float pAngleZ) { this.visible = true; this.m_frame = 0; this.Name = pName; this.m_BillboardMesh = pBillboardMesh; this.m_frameMax = this.m_BillboardMesh.GetFrameMax(); this.myTerrain = pTerrain; this.Position = position; this.angleZ = pAngleZ; this.m_currrow = 0; }