Example #1
0
 public void LoadModels(string pFile)
 {
     try
     {
         this.Models.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]);
                 CModelMesh pCModelMesh = this.ModelMeshs[index];
                 Vector3    position    = new Vector3(valueX, valueY, num);
                 CModel     cModel      = new CModel(pName, this.device, pCModelMesh, position, pAngleZ);
                 if (num == 0f)
                 {
                     cModel.Z = this.myTerrain.getZ(cModel.X, cModel.Y);
                 }
                 this.Models.Add(cModel);
             }
         }
     }
     catch
     {
     }
 }
Example #2
0
        public void Load1Model(string pName, int pModelIndex, Vector3 pPos, float dHeading)
        {
            CModelMesh pCModelMesh = this.m_ModelMeshs[pModelIndex];
            CModel     cModel      = new CModel(pName, this.device, pCModelMesh, pPos, dHeading);

            cModel.Z = this.myTerrain.getZ(cModel.X, cModel.Y);
            this.Models.Add(cModel);
        }
Example #3
0
 public CModel(string pName, Device device, CModelMesh pCModelMesh, Vector3 position, float pAngleZ)
 {
     this.visible     = true;
     this.Name        = pName;
     this.m_ModelMesh = pCModelMesh;
     this.m_device    = device;
     this.Position    = position;
     this.angleZ      = pAngleZ;
 }
Example #4
0
        public void LoadModelMeshs(string pModel3DsFile)
        {
            DataSet dataSet = new DataSet();

            dataSet.ReadXml(pModel3DsFile);
            DataTable dataTable = dataSet.Tables[0];
            string    pName     = "";
            string    text      = "";
            float     valueX    = 0f;
            float     valueY    = 0f;
            float     valueZ    = 0f;
            float     pScale    = 1f;
            float     pShiftX   = 0f;
            float     pShiftY   = 0f;
            float     pShiftZ   = 0f;
            int       pAutoTurn = 0;

            if (dataTable.Rows.Count > 0)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    if (dataRow.ItemArray.GetUpperBound(0) == 9)
                    {
                        pName     = (string)dataRow[0];
                        text      = (string)dataRow[1];
                        valueX    = Geometry.DegreeToRadian(CHelper.myToSingle((string)dataRow[2]));
                        valueY    = Geometry.DegreeToRadian(CHelper.myToSingle((string)dataRow[3]));
                        valueZ    = Geometry.DegreeToRadian(CHelper.myToSingle((string)dataRow[4]));
                        pScale    = CHelper.myToSingle((string)dataRow[5]);
                        pShiftX   = CHelper.myToSingle((string)dataRow[6]);
                        pShiftY   = CHelper.myToSingle((string)dataRow[7]);
                        pShiftZ   = CHelper.myToSingle((string)dataRow[8]);
                        pAutoTurn = Convert.ToInt32(dataRow[9]);
                    }
                    else if (dataRow.ItemArray.GetUpperBound(0) == 7)
                    {
                        pName     = (string)dataRow[0];
                        text      = (string)dataRow[1];
                        valueX    = Geometry.DegreeToRadian(CHelper.myToSingle((string)dataRow[2]));
                        valueY    = Geometry.DegreeToRadian(CHelper.myToSingle((string)dataRow[3]));
                        valueZ    = Geometry.DegreeToRadian(CHelper.myToSingle((string)dataRow[4]));
                        pScale    = CHelper.myToSingle((string)dataRow[5]);
                        pShiftX   = 0f;
                        pShiftY   = 0f;
                        pShiftZ   = CHelper.myToSingle((string)dataRow[6]);
                        pAutoTurn = Convert.ToInt32(dataRow[7]);
                    }
                    Vector3 pAngle = new Vector3(valueX, valueY, valueZ);
                    if (File.Exists(text))
                    {
                        CModelMesh item = new CModelMesh(this.device, text, pName, pAngle, pScale, pShiftX, pShiftY, pShiftZ, pAutoTurn);
                        this.m_ModelMeshs.Add(item);
                    }
                }
            }
        }
Example #5
0
        public void Load1ModelMesh(string mMeshFile, string mName, float mDegreeX, float mDegreeY, float mDegreeZ, float mScale, float mShiftX, float mShiftY, float mShiftZ, int mAutoTurn)
        {
            float      valueX = Geometry.DegreeToRadian(mDegreeX);
            float      valueY = Geometry.DegreeToRadian(mDegreeY);
            float      valueZ = Geometry.DegreeToRadian(mDegreeZ);
            Vector3    pAngle = new Vector3(valueX, valueY, valueZ);
            CModelMesh item   = new CModelMesh(this.device, mMeshFile, mName, pAngle, mScale, mShiftX, mShiftY, mShiftZ, mAutoTurn);

            this.m_ModelMeshs.Clear();
            this.m_ModelMeshs.Add(item);
        }