public void Draw(TagIdent item) { if (objectInstances.ContainsKey(item)) { //IRenderable @object = objects[item] as IRenderable; //@object.Render( new[] { program, systemProgram } ); } else { var data = Halo2.GetReferenceObject(item); //objects[item] = new ScenarioObject( (ModelBlock)data ); } }
private void LoadInstances(List <IH2ObjectInstance> instances, List <IH2ObjectPalette> objectPalette) { var join = (from instance in instances join palette in objectPalette on(int) instance.PaletteIndex equals objectPalette.IndexOf(palette) into gj from items in gj.DefaultIfEmpty() select new { instance, Object = items.ObjectReference }).ToArray(); foreach (var item in join) { Add(item.Object.Ident, new ScenarioObject( Halo2.GetReferenceObject <ModelBlock>(Halo2.GetReferenceObject <ObjectBlock>(item.Object).model)) { WorldMatrix = item.instance.WorldMatrix } ); } }
private void LoadNetgameEquipment(List <ScenarioNetgameEquipmentBlock> list) { foreach (var item in list.Where(x => !TagIdent.IsNull(x.itemVehicleCollection.Ident) && (x.itemVehicleCollection.Class.ToString() == "vehc" || x.itemVehicleCollection.Class.ToString() == "itmc"))) { try { Add(item.itemVehicleCollection.Ident, new ScenarioObject(Halo2.GetReferenceObject <ModelBlock>( Halo2.GetReferenceObject <ObjectBlock>( item.itemVehicleCollection.Class.ToString() == "itmc" ? Halo2.GetReferenceObject <ItemCollectionBlock>(item.itemVehicleCollection).itemPermutations.First().item : Halo2.GetReferenceObject <VehicleCollectionBlock>(item.itemVehicleCollection).vehiclePermutations.First().vehicle).model)) { WorldMatrix = item.WorldMatrix } ); } catch (NullReferenceException) { } } }
public void Add(TagIdent item) { var data = Halo2.GetReferenceObject(item); //objects[item] = new ScenarioObject( (ModelBlock)data ); }