public static optional <OctahedronPlanetarium> load(string file_name) { optional <Material> material = WorldPlanetarium.load_material(file_name); if (!material.exists) { return(new optional <OctahedronPlanetarium>()); } Texture2D texture = (Texture2D)WorldPlanetarium.load_texture(file_name); OctahedronPlanetarium result = new OctahedronPlanetarium(texture.width); result.material = material.data; result.texture = texture; result.material.SetTexture("_MainTex", result.texture); return(result); }
public static optional <SphericalCirclePlanetarium> load(string file_name, float radius) { optional <Material> material = WorldPlanetarium.load_material(file_name); if (!material.exists) { return(new optional <SphericalCirclePlanetarium>()); } SphericalCirclePlanetarium result = new SphericalCirclePlanetarium(); result.material = material.data; result.texture = (Texture2D)WorldPlanetarium.load_texture(file_name); result.material.SetTexture("_MainTex", result.texture); result.radius_variable = radius; return(result); }
public static optional <CubePlanetarium> load(string file_name) { optional <Material> material = WorldPlanetarium.load_material(file_name); if (!material.exists) { return(new optional <CubePlanetarium>()); } int size = material.data.GetTexture(directions[0]).width; CubePlanetarium result = new CubePlanetarium(size); result.material = material.data; for (int face = 0; face < directions.Length; ++face) { Texture2D texture = (Texture2D)material.data.GetTexture(directions[face]); result.textures[face] = texture; } return(result); }