private void GenerateStaticAsteroidPreviews(int sizeInPixels, DirectoryInfo directoryInfo) { var directoryGuiHelpers = Directory.CreateDirectory(Path.Combine(directoryInfo.FullName, "GuiHelpers")); int index = 1; foreach (MyMwcObjectBuilder_StaticAsteroid_TypesEnum enumValue in MyGuiAsteroidHelpers.MyMwcStaticAsteroidTypesEnumValues) { Debug.WriteLine(string.Format("Exporting Static Asteroid Preview {0}/{1} ..", index++, MyGuiAsteroidHelpers.MyMwcStaticAsteroidTypesEnumValues.Count)); var modelEnum = MyStaticAsteroid.GetModelsFromType(enumValue).LOD0; var model = MyModels.GetModelOnlyData(modelEnum); model.SetDrawTechnique(MyMeshDrawTechnique.MESH); string assetName = Path.GetFileName(MyModels.GetModelAssetName(modelEnum)); assetName = assetName.Substring(assetName.Length - 5, 5) == "_LOD0" ? assetName.Substring(0, assetName.Length - 5) : assetName; var result = RenderModelPreview(model, sizeInPixels, sizeInPixels); string fileName = Path.Combine(directoryGuiHelpers.FullName, string.Format("{0}.dds", assetName)); if (File.Exists(fileName)) { File.Delete(fileName); } //TODO //MyDDSFile.DDSToFile(fileName, true, result, false); } }
MyEntity addStaticAsteroid(StringBuilder hudLabel, MyMwcObjectBuilder_StaticAsteroid_TypesEnum staticEnum, ref Vector3 currentPosition, Vector3 forward, MyMeshDrawTechnique? drawTechnique = null, MyMwcVoxelMaterialsEnum? material = null) { MyStaticAsteroid staticAsteroid = new MyStaticAsteroid(); MyMwcObjectBuilder_StaticAsteroid objectBuilder = new MyMwcObjectBuilder_StaticAsteroid(staticEnum, material); staticAsteroid.Init(hudLabel.ToString(), objectBuilder, Matrix.Identity); return addEntity(staticAsteroid, ref currentPosition, forward); }
public static bool UpdateStaticAsteroidScript(MyStaticAsteroid staticAsteroid) { if (MyHud.ContainsTextForEntity(staticAsteroid)) { if (m_outpostReached == false) { if (Vector3.Distance(MySession.PlayerShip.GetPosition(), staticAsteroid.GetPosition()) < REMOVE_FROM_HUD_POSSIBLE_OUTPOST_DISTANCE) { MyHud.RemoveText(staticAsteroid); } } else { MyHud.RemoveText(staticAsteroid); } } return(true); }
public static bool UpdateStaticAsteroidScript(MyStaticAsteroid staticAsteroid) { if (MyHud.ContainsTextForEntity(staticAsteroid)) { if (m_outpostReached == false) { if (Vector3.Distance(MySession.PlayerShip.GetPosition(), staticAsteroid.GetPosition()) < REMOVE_FROM_HUD_POSSIBLE_OUTPOST_DISTANCE) { MyHud.RemoveText(staticAsteroid); } } else { MyHud.RemoveText(staticAsteroid); } } return true; }