void CreateImpostors() { m_impostors = new List <MyDistantObjectImpostor>(); MyDistantObjectImpostorTypeEnum lastType = MyDistantObjectImpostorTypeEnum.Blinker; for (int i = 0; i < MyDistantObjectsImpostorsConstants.MAX_NUMBER_DISTANT_OBJECTS; i++) { // assign some value because something must be assigned. later down in code we decide what impostor type will be this MyDistantObjectImpostorTypeEnum type = MyDistantObjectImpostorTypeEnum.Blinker; // First third will be blinkers if (i <= MyDistantObjectsImpostorsConstants.MAX_NUMBER_DISTANT_OBJECTS * 0.33f) { type = MyDistantObjectImpostorTypeEnum.Blinker; m_impostorProperties[(int)type].IndexStart = 0; } // Second third will be explosions if (i > MyDistantObjectsImpostorsConstants.MAX_NUMBER_DISTANT_OBJECTS * 0.33f) { type = MyDistantObjectImpostorTypeEnum.Explosion; // If this is first explosion impostor we calculate its start index if (lastType == MyDistantObjectImpostorTypeEnum.Blinker) { m_impostorProperties[(int)type].IndexStart = (MyVoxelMapImpostorsConstants.VERTEXES_PER_IMPOSTOR * i); lastType = MyDistantObjectImpostorTypeEnum.Explosion; } } // Last third will be movers if (i > MyDistantObjectsImpostorsConstants.MAX_NUMBER_DISTANT_OBJECTS * 0.66f) { type = MyDistantObjectImpostorTypeEnum.Mover; // If this is first explosion impostor we calculate its start index if (lastType == MyDistantObjectImpostorTypeEnum.Explosion) { m_impostorProperties[(int)type].IndexStart = (MyVoxelMapImpostorsConstants.VERTEXES_PER_IMPOSTOR * i); lastType = MyDistantObjectImpostorTypeEnum.Mover; } } // We calculate how many impostors of each type we have m_impostorProperties[(int)type].Count++; MyDistantObjectImpostor impostor = new MyDistantObjectImpostor(); impostor.Start(type); m_impostors.Add(impostor); } }
void CreateImpostors() { m_impostors = new List<MyDistantObjectImpostor>(); MyDistantObjectImpostorTypeEnum lastType = MyDistantObjectImpostorTypeEnum.Blinker; for (int i = 0; i < MyDistantObjectsImpostorsConstants.MAX_NUMBER_DISTANT_OBJECTS; i++) { // assign some value because something must be assigned. later down in code we decide what impostor type will be this MyDistantObjectImpostorTypeEnum type = MyDistantObjectImpostorTypeEnum.Blinker; // First third will be blinkers if (i <= MyDistantObjectsImpostorsConstants.MAX_NUMBER_DISTANT_OBJECTS * 0.33f) { type = MyDistantObjectImpostorTypeEnum.Blinker; m_impostorProperties[(int)type].IndexStart = 0; } // Second third will be explosions if (i > MyDistantObjectsImpostorsConstants.MAX_NUMBER_DISTANT_OBJECTS * 0.33f) { type = MyDistantObjectImpostorTypeEnum.Explosion; // If this is first explosion impostor we calculate its start index if (lastType == MyDistantObjectImpostorTypeEnum.Blinker) { m_impostorProperties[(int)type].IndexStart = (MyVoxelMapImpostorsConstants.VERTEXES_PER_IMPOSTOR * i); lastType = MyDistantObjectImpostorTypeEnum.Explosion; } } // Last third will be movers if (i > MyDistantObjectsImpostorsConstants.MAX_NUMBER_DISTANT_OBJECTS * 0.66f) { type = MyDistantObjectImpostorTypeEnum.Mover; // If this is first explosion impostor we calculate its start index if (lastType == MyDistantObjectImpostorTypeEnum.Explosion) { m_impostorProperties[(int)type].IndexStart = (MyVoxelMapImpostorsConstants.VERTEXES_PER_IMPOSTOR * i); lastType = MyDistantObjectImpostorTypeEnum.Mover; } } // We calculate how many impostors of each type we have m_impostorProperties[(int)type].Count++; MyDistantObjectImpostor impostor = new MyDistantObjectImpostor(); impostor.Start(type); m_impostors.Add(impostor); } }