private double cylinderRadius; //antenna #endregion Fields #region Constructors public Base() { /* * By far the best system, it simply flies over the * ground whatever its difficulties. This is the * only chassis that can span ravines! */ //cube = new CubeModel(); cylinderHeight = 0.5f; cylinderRadius = 0.03f; cylinder = new CylinderModel(cylinderRadius, cylinderHeight); cylinder.SetColor(0.2f, 0.2f, 0.2f); PosX = 0; PosY = 0; material = new Material(Material.MaterialType.SILK); cylinder.AssignMaterial(material); material = new Material(Material.MaterialType.CONCRETE); //cube.AssignMaterial(material); model = new OBJModel(Game.resourcePath + "/Base/dark_khaki.obj"); }
public MissilesWeapon() { inCylinderRadius = 0.1f; inCylinderHeight = 1.0f; inCylinder = new CylinderModel(inCylinderRadius, inCylinderHeight); inCylinder.SetColor(0.4f, 0.5f, 0.6f); outCylinderRadius = 0.15f; outCylinderHeight = 0.3f; outCylinder = new CylinderModel(outCylinderRadius, outCylinderHeight); outCylinder.SetColor(0.0f, 0.7f, 0.6f); middleBox = new CubeModel(); middleBox.SetColor(0.1f, 0.3f, 0.3f); frame = new CubeModel(); frame.SetColor(0.1f, 1.0f, 0.0f); SetHeight(0.75f); material = new Material(Material.MaterialType.SHINY_STEEL); inCylinder.AssignMaterial(material); outCylinder.AssignMaterial(material); middleBox.AssignMaterial(material); frame.AssignMaterial(material); model = new OBJModel(Game.resourcePath + "/Missile/Missile.obj"); }
public Tile() { PosX = PosY = 0; plane = new Plane(); plane.SetRenderMode(RenderMode.SOLID); material = new Material(Material.MaterialType.DIFFUSE_GRAY); plane.AssignMaterial(material); model = new OBJModel(Game.resourcePath + "/Floor/Tile.obj"); }
public HeavyRubblePile() { PosX = PosY = 0; cube = new CubeModel(); cube.SetColor(0.64f, 0.64f, 0.67f); hemiM = new HemisphereModel(1.0f); hemiM.LatitudinalSlices = 10; hemiM.LongitudinalSlices = 10; cube.SetColor(0.64f, 0.64f, 0.67f); material = new Material(Material.MaterialType.ROCK_DIFFUSE); cube.AssignMaterial(material); hemiM.AssignMaterial(material); }
public NuclearWeapon() { radius = 1.0f; height = 1.0f; /* slices = 8, stacks = 1 */ mcComponent = new CylinderModel(radius, height); mcComponent.setSlices(8); mcComponent.setStacks(1); material = new Material(Material.MaterialType.SHINY_STEEL); mcComponent.AssignMaterial(material); model = new OBJModel(Game.resourcePath + "/Nuclear/Nuclear.obj"); }
public void AssignMaterial(Material material) { this.material = material; }
public PhasersWeapon() { material = new Material(Material.MaterialType.SHINY_STEEL); model = new OBJModel(Game.resourcePath + "/Phasers/Phasers.obj"); }
public void SetMaterial(Material m) { mat = m; }
public static List<Material> ParseMaterials(string filename) { List<Material> MaterialList = new List<Material>(); String fileName = filename; FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs); string sLine; char[] seperators = new char[] { ' ', '/' }; string[] s; float[] fTemp; string absolutePath = fs.Name; char[] sep = new char[1]; sep[0] = Game.GetPathSeparator()[0]; string[] splitAbsolutePath = absolutePath.Split(sep); string relativepath = ""; for (int i = 0; i < splitAbsolutePath.Length - 1; i++) relativepath += splitAbsolutePath[i] + sep[0]; int ic = sr.Read(); uint lineNumber = 1; Material currMaterial = null; while (ic != -1) { char c = (char)ic; if (c == 'n') //New Material { sLine = sr.ReadLine(); s = sLine.Split(seperators, StringSplitOptions.RemoveEmptyEntries); currMaterial = new Material(); //matName = s[1]; currMaterial.setName(s[1]); MaterialList.Add(currMaterial); } else if (c == 'N') { int iNext = sr.Read(); if (iNext == 's') { sLine = sr.ReadLine(); s = sLine.Split(seperators, StringSplitOptions.RemoveEmptyEntries); fTemp = new float[s.Length]; float.TryParse(s[0], out fTemp[0]); currMaterial.setShine((fTemp[0]/100.0f)*128.0f); } else { sLine = sr.ReadLine(); } } else if (c == 'i') { sLine = sr.ReadLine(); Console.WriteLine("WARNING: Material File " + filename + " Illumination Parameter Not Supported on Line " + lineNumber); } else if (c == 'T') { sLine = sr.ReadLine(); Console.WriteLine("WARNING: Material File " + filename + " Transmission Filter Parameter Not Supported on Line " + lineNumber); } else if (c == 'K') { int iNext = sr.Read(); if (iNext == 'd') { sLine = sr.ReadLine(); s = sLine.Split(seperators, StringSplitOptions.RemoveEmptyEntries); fTemp = new float[s.Length]; float.TryParse(s[0], out fTemp[0]); float.TryParse(s[1], out fTemp[1]); float.TryParse(s[2], out fTemp[2]); if (s.Length == 4) float.TryParse(s[3], out fTemp[3]); //setDiffuse(fTemp[0], fTemp[1], fTemp[2], fTemp.Length == 4 ? fTemp[3] : 1.0f); currMaterial.setDiffuse(fTemp[0], fTemp[1], fTemp[2], fTemp.Length == 4 ? fTemp[3] : 1.0f); } else if (iNext == 'a') { sLine = sr.ReadLine(); s = sLine.Split(seperators, StringSplitOptions.RemoveEmptyEntries); fTemp = new float[s.Length]; float.TryParse(s[0], out fTemp[0]); float.TryParse(s[1], out fTemp[1]); float.TryParse(s[2], out fTemp[2]); if (s.Length == 4) float.TryParse(s[3], out fTemp[3]); //setAmbient(fTemp[0], fTemp[1], fTemp[2], fTemp.Length == 4 ? fTemp[3] : 1.0f); currMaterial.setAmbient(fTemp[0], fTemp[1], fTemp[2], fTemp.Length == 4 ? fTemp[3] : 1.0f); } else if (iNext == 's') { sLine = sr.ReadLine(); s = sLine.Split(seperators, StringSplitOptions.RemoveEmptyEntries); fTemp = new float[s.Length]; float.TryParse(s[0], out fTemp[0]); float.TryParse(s[1], out fTemp[1]); float.TryParse(s[2], out fTemp[2]); if (s.Length == 4) float.TryParse(s[3], out fTemp[3]); //setSpecular(fTemp[0], fTemp[1], fTemp[2], fTemp.Length == 4 ? fTemp[3] : 1.0f); currMaterial.setSpecular(fTemp[0], fTemp[1], fTemp[2], fTemp.Length == 4 ? fTemp[3] : 1.0f); } } else if (c == 'm') //Texture file { sr.Read(); //'a' sr.Read(); //'p' sr.Read(); //'_' sr.Read(); //'K' int iNext = sr.Read(); if (iNext == 'd' || iNext == 'a' || iNext == 's') { Console.WriteLine("WARNING: Material File " + filename + " Texture and Material Parameter Not Supported on Line " + lineNumber); sr.Read(); string texFileName = sr.ReadLine(); //texture = new Texture(relativePath + texFileName); currMaterial.setTexture(Texture.AcquireTexture(relativepath + texFileName)); } } else if (c != '\n') { sLine = sr.ReadLine(); } lineNumber++; ic = sr.Read(); } sr.Close(); fs.Close(); return MaterialList; }