示例#1
0
 public RemoteControlUnit(int x, int y)
 {
     PosX = x;
     PosY = y;
     model = new OBJModel(Game.resourcePath + "/AI/Brain_AI.obj");
     robotList = new List<Robot>();
 }
示例#2
0
 public Boundary(int x, int y, bool trans)
 {
     transparency = trans;
     this.PosX    = x;
     this.PosY    = y;
     model        = new OBJModel(Game.resourcePath + "/Boundary/Boundary.obj");
 }
示例#3
0
        //private float bodyWidth;
        //private float bodyHeight;
        //private float tracksWidth;
        //private float tracksHeight;
        //private float topWidth;
        //private float topHeight;
        //private CubeModel cube;
        //private OBJModel model;
        public AntiGravChassis()
        {
            /*
             * By far the best system, it simply flies over the
             * ground whatever its difficulties. This is the
             * only chassis that can span ravines!
             */

            //bodyWidth = 2.0f;
            //bodyHeight = 0.2f;

            //tracksWidth = 1.0f;
            //tracksHeight = 0.2f;

            //topWidth = 1.0f;
            //topHeight = 0.1f;

            //cube = new CubeModel();

            //SetHeight(0.2f);

            //material = new Material(Material.MaterialType.SHINY_STEEL);
            //cube.AssignMaterial(material);

            model = new OBJModel(Game.resourcePath + "/Anti-grav Chassis/Anti_gravity_chassis.obj");
        }
示例#4
0
        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");
        }
示例#5
0
        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");
        }
示例#6
0
 public Boundary(int x, int y, bool trans)
 {
     transparency = trans;
     this.PosX = x;
     this.PosY = y;
     model = new OBJModel(Game.resourcePath + "/Boundary/Boundary.obj");
 }
示例#7
0
        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");
        }
示例#8
0
文件: Base.cs 项目: angjminer/rawbots
        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");
        }
示例#9
0
        //private float bodyWidth;
        //private float bodyHeight;

        //private float tracksWidth;
        //private float tracksHeight;

        //private float topWidth;
        //private float topHeight;

        //private CubeModel cube;

        //private OBJModel model;

        public AntiGravChassis()
        {
            /*
             * By far the best system, it simply flies over the
             * ground whatever its difficulties. This is the
             * only chassis that can span ravines!
             */

            //bodyWidth = 2.0f;
            //bodyHeight = 0.2f;

            //tracksWidth = 1.0f;
            //tracksHeight = 0.2f;

            //topWidth = 1.0f;
            //topHeight = 0.1f;

            //cube = new CubeModel();

            //SetHeight(0.2f);

            //material = new Material(Material.MaterialType.SHINY_STEEL);
            //cube.AssignMaterial(material);

            model = new OBJModel(Game.resourcePath + "/Anti-grav Chassis/Anti_gravity_chassis.obj");
        }
示例#10
0
 public RemoteControlUnit(int x, int y)
 {
     PosX      = x;
     PosY      = y;
     model     = new OBJModel(Game.resourcePath + "/AI/Brain_AI.obj");
     robotList = new List <Robot>();
 }
示例#11
0
 static SkyBoxSphere()
 {
     xOffset = 0.0f;
     yOffset = 0.0f;
     zOffset = -20.0f;
     box     = new OBJModel(Game.resourcePath + "/skybox.obj");
     sphere  = new OBJModel(Game.resourcePath + "/sphere-colored_2.obj");
     currEnv = box;
 }
示例#12
0
 static SkyBoxSphere()
 {
     xOffset = 0.0f;
     yOffset = 0.0f;
     zOffset = -20.0f;
     box = new OBJModel(Game.resourcePath + "/skybox.obj");
     sphere = new OBJModel(Game.resourcePath + "/sphere-colored_2.obj");
     currEnv = box;
 }
示例#13
0
文件: Base.cs 项目: angjminer/rawbots
        public Base(int x, int y)
        {
            model = new OBJModel(Game.resourcePath + "/Base/dark_khaki.obj");
            //cube = new CubeModel();

            cylinderHeight = 0.5f;
            cylinderRadius = 0.03f;
            cylinder = new CylinderModel(cylinderRadius, cylinderHeight);
            cylinder.SetColor(0.2f, 0.2f, 0.2f);

            PosX = x; PosY = y;
        }
示例#14
0
        public Base(int x, int y)
        {
            model = new OBJModel(Game.resourcePath + "/Base/dark_khaki.obj");
            //cube = new CubeModel();

            cylinderHeight = 0.5f;
            cylinderRadius = 0.03f;
            cylinder       = new CylinderModel(cylinderRadius, cylinderHeight);
            cylinder.SetColor(0.2f, 0.2f, 0.2f);

            PosX = x; PosY = y;
        }
示例#15
0
文件: Tile.cs 项目: angjminer/rawbots
        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");
        }
示例#16
0
        private void Init()
        {
            robotPart       = null;
            blockFrontLeft  = new HalfPlainBlock();
            blockFrontRight = new HalfPlainBlock();
            blockBackLeft   = new FullPlainBlock();
            blockBackMiddle = new FullPlainBlock();
            blockBackRight  = new FullPlainBlock();

            full = new OBJModel(Game.resourcePath + "/Factory/light_khaki_bldg.obj");
            half = new OBJModel(Game.resourcePath + "/Factory/light_khaki_bldg_half.obj");
        }
示例#17
0
        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");
        }
示例#18
0
 public static void ChangeEnvironment()
 {
     if (currEnv == box)
     {
         currEnv = sphere;
         zOffset = -10.0f;
     }
     else
     {
         currEnv = box;
         zOffset = -20.0f;
     }
 }
示例#19
0
 public static void ChangeEnvironment()
 {
     if (currEnv == box)
     {
         currEnv = sphere;
         zOffset = -10.0f;
     }
     else
     {
         currEnv = box;
         zOffset = -20.0f;
     }
 }
示例#20
0
 private void LoadFromExistingModel(OBJModel model)
 {
     Vertices      = model.Vertices;
     Normals       = model.Normals;
     TexCoords     = model.TexCoords;
     Faces         = model.Faces;
     FaceGroups    = model.FaceGroups;
     currFaceGroup = model.currFaceGroup;
     HasTexCoords  = model.HasTexCoords;
     HasNormals    = model.HasNormals;
     pathFileName  = model.pathFileName;
     relativePath  = model.relativePath;
     TexEnabled    = model.TexEnabled;
 }
示例#21
0
        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");
        }
示例#22
0
        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");
        }
示例#23
0
        //private CubeModel[] mcComponent;
        //private const int TORSO = 0;
        //private const int UPPER_LEG = 1;
        //private const int LOWER_LEG = 2;
        //private const int FOOT = 3;
        //private const int TOTAL_COMPONENTS = 4;
        //private OBJModel model;
        public BipodChassis()
        {
            /*
             * Slow but cheap and rugged. Can't get over
             * hills but can cope with rough ground at a pinch!
             * Best used on flat level ground.
             */

            //mcComponent = new CubeModel[TOTAL_COMPONENTS];
            //for (int i = 0; i < mcComponent.Length; i++)
            //     mcComponent[i] = new CubeModel();

            //SetHeight(1.0f);

            //material = new Material(Material.MaterialType.SHINY_STEEL);
            //for (int i = 0; i < mcComponent.Length; i++)
            //     mcComponent[i].AssignMaterial(material);

            model = new OBJModel(Game.resourcePath + "/Bipod Chassis/Bipod_chassis.obj");
        }
示例#24
0
        //private CubeModel[] mcComponent;
        //private const int TORSO = 0;
        //private const int UPPER_LEG = 1;
        //private const int LOWER_LEG = 2;
        //private const int FOOT = 3;
        //private const int TOTAL_COMPONENTS = 4;

        //private OBJModel model;

        public BipodChassis()
        {
            /*
             * Slow but cheap and rugged. Can't get over
             * hills but can cope with rough ground at a pinch!
             * Best used on flat level ground.
             */

            //mcComponent = new CubeModel[TOTAL_COMPONENTS];
            //for (int i = 0; i < mcComponent.Length; i++)
            //     mcComponent[i] = new CubeModel();

            //SetHeight(1.0f);

            //material = new Material(Material.MaterialType.SHINY_STEEL);
            //for (int i = 0; i < mcComponent.Length; i++)
            //     mcComponent[i].AssignMaterial(material);

            model = new OBJModel(Game.resourcePath + "/Bipod Chassis/Bipod_chassis.obj");
        }
示例#25
0
        //private const double radius = 0.1;
        //private const double cylinder_height = 0.2;

        //private CubeModel[] tcComponent;
        //private CylinderModel[] wheelEnd;
        //private const int bottomEnd = 0;
        //private const int topEnd = 1;
        //private const int TOTAL_ENDS = 2;

        //private OBJModel model;

        public TrackedChassis()
        {
            /*
             * Considerably more manoeuvrable than
             * bipods but twice the resource units.
             */

            //wheelEnd = new CylinderModel[TOTAL_ENDS];
            //for (int i = 0; i < TOTAL_ENDS; i++)
            //    wheelEnd[i] = new CylinderModel(radius, cylinder_height);

            //tcComponent = new CubeModel[TOTAL_ENDS];
            //for (int i = 0; i < TOTAL_ENDS; i++)
            //    tcComponent[i] = new CubeModel();

            //material = new Material(Material.MaterialType.SHINY_STEEL);
            //for (int i = 0; i < TOTAL_ENDS; i++)
            //{
            //    wheelEnd[i].AssignMaterial(material);
            //    tcComponent[i].AssignMaterial(material);
            //}

            model = new OBJModel(Game.resourcePath + "/Tracked Chassis/Tracked_chassis.obj");
        }
示例#26
0
        //private const double radius = 0.1;
        //private const double cylinder_height = 0.2;
        //private CubeModel[] tcComponent;
        //private CylinderModel[] wheelEnd;
        //private const int bottomEnd = 0;
        //private const int topEnd = 1;
        //private const int TOTAL_ENDS = 2;
        //private OBJModel model;
        public TrackedChassis()
        {
            /*
             * Considerably more manoeuvrable than
             * bipods but twice the resource units.
             */

            //wheelEnd = new CylinderModel[TOTAL_ENDS];
            //for (int i = 0; i < TOTAL_ENDS; i++)
            //    wheelEnd[i] = new CylinderModel(radius, cylinder_height);

            //tcComponent = new CubeModel[TOTAL_ENDS];
            //for (int i = 0; i < TOTAL_ENDS; i++)
            //    tcComponent[i] = new CubeModel();

            //material = new Material(Material.MaterialType.SHINY_STEEL);
            //for (int i = 0; i < TOTAL_ENDS; i++)
            //{
            //    wheelEnd[i].AssignMaterial(material);
            //    tcComponent[i].AssignMaterial(material);
            //}

            model = new OBJModel(Game.resourcePath + "/Tracked Chassis/Tracked_chassis.obj");
        }
示例#27
0
        //private float cylinderRadius;
        //private float cylinderHeight;
        //private CylinderModel cylinder;

        //private float hemisphereRadius;
        //private HemisphereModel hemisphere;

        //private OBJModel model;

        public Electronics()
        {
            /*
             * This module increases weapon accuracy, giving a notional added
             * range of 3 miles to each weapon type, Advance warning of attack
             * contributes to the slightly increased resistance to damage from
             * enemy fire when this unit is fitted.
             */

            //cylinderRadius = 0.4f;
            //cylinderHeight = 0.4f;
            //cylinder = new CylinderModel(cylinderRadius, cylinderHeight);
            //cylinder.SetColor(0.5f, 0.5f, 0.5f);

            //hemisphereRadius = 0.3f;
            //hemisphere = new HemisphereModel(hemisphereRadius);
            //hemisphere.SetColor(0.8f, 0.8f, 0.8f);

            //material = new Material(Material.MaterialType.SHINY_STEEL);
            //hemisphere.AssignMaterial(material);
            //cylinder.AssignMaterial(material);

            model = new OBJModel(Game.resourcePath + "/Electronics/Electronics.obj");
        }
示例#28
0
        //private float cylinderRadius;
        //private float cylinderHeight;
        //private CylinderModel cylinder;
        //private float hemisphereRadius;
        //private HemisphereModel hemisphere;
        //private OBJModel model;
        public Electronics()
        {
            /*
             * This module increases weapon accuracy, giving a notional added
             * range of 3 miles to each weapon type, Advance warning of attack
             * contributes to the slightly increased resistance to damage from
             * enemy fire when this unit is fitted.
             */

            //cylinderRadius = 0.4f;
            //cylinderHeight = 0.4f;
            //cylinder = new CylinderModel(cylinderRadius, cylinderHeight);
            //cylinder.SetColor(0.5f, 0.5f, 0.5f);

            //hemisphereRadius = 0.3f;
            //hemisphere = new HemisphereModel(hemisphereRadius);
            //hemisphere.SetColor(0.8f, 0.8f, 0.8f);

            //material = new Material(Material.MaterialType.SHINY_STEEL);
            //hemisphere.AssignMaterial(material);
            //cylinder.AssignMaterial(material);

            model = new OBJModel(Game.resourcePath + "/Electronics/Electronics.obj");
        }
示例#29
0
 public FullPlainBlock()
 {
     PosX  = PosY = 0;
     model = new OBJModel(Game.resourcePath + "/Obstacles/obstacle_full.obj");
 }
示例#30
0
 public LightRubblePile(int x, int y)
 {
     PosX  = x;
     PosY  = y;
     model = new OBJModel(Game.resourcePath + "/Floor/floor_debris_1.obj");
 }
示例#31
0
 public LightRubblePile()
 {
     PosX  = PosY = 0;
     model = new OBJModel(Game.resourcePath + "/Floor/floor_debris_1.obj");
 }
示例#32
0
 public LightPost(int x)
 {
     position = x;
     model    = new OBJModel(Game.resourcePath + "/Lightpost/Lightpost2.obj");
 }
示例#33
0
        bool transparency = false; //transparency attribute

        #endregion Fields

        #region Constructors

        public Boundary()
        {
            PosX = PosY = 0;
            model = new OBJModel(Game.resourcePath + "/Boundary/Boundary.obj");
        }
示例#34
0
 public FullSquareHoleBlock(int x, int y)
 {
     PosX = x;
     PosY = y;
     model = new OBJModel(Game.resourcePath + "/Obstacles/full_block.obj");
 }
示例#35
0
 public HalfPlainBlock()
 {
     PosX = PosY = 0;
     model = new OBJModel(Game.resourcePath + "/Obstacles/checkered_obstacle.obj");
 }
示例#36
0
 public FullSquareHoleBlock()
 {
     PosX  = PosY = 0;
     model = new OBJModel(Game.resourcePath + "/Obstacles/full_block.obj");
 }
示例#37
0
 public HalfPlainBlock(int x, int y)
 {
     PosX  = x;
     PosY  = y;
     model = new OBJModel(Game.resourcePath + "/Obstacles/checkered_obstacle.obj");
 }
示例#38
0
 public Boundary(int x, int y)
 {
     this.PosX = x;
     this.PosY = y;
     model = new OBJModel(Game.resourcePath + "/Boundary/Boundary.obj");
 }
示例#39
0
 public FloorTile(int x, int y)
 {
     PosX  = x;
     PosY  = y;
     model = new OBJModel(Game.resourcePath + "/Floor/Tile.obj");
 }
示例#40
0
 public RemoteControlUnit()
 {
     PosX = PosY = 0.0f;
     model = new OBJModel(Game.resourcePath + "/AI/Brain_AI.obj");
     robotList = new List<Robot>();
 }
示例#41
0
 public LightRubblePile(int x, int y)
 {
     PosX = x;
     PosY = y;
     model = new OBJModel(Game.resourcePath + "/Floor/floor_debris_1.obj");
 }
示例#42
0
 public HalfPlainBlock()
 {
     PosX  = PosY = 0;
     model = new OBJModel(Game.resourcePath + "/Obstacles/checkered_obstacle.obj");
 }
示例#43
0
 private void LoadFromExistingModel(OBJModel model)
 {
     Vertices = model.Vertices;
     Normals = model.Normals;
     TexCoords = model.TexCoords;
     Faces = model.Faces;
     FaceGroups = model.FaceGroups;
     currFaceGroup = model.currFaceGroup;
     HasTexCoords = model.HasTexCoords;
     HasNormals = model.HasNormals;
     pathFileName = model.pathFileName;
     relativePath = model.relativePath;
     TexEnabled = model.TexEnabled;
 }
示例#44
0
 public FullPlainBlock(int x, int y)
 {
     PosX = x;
     PosY = y;
     model = new OBJModel(Game.resourcePath + "/Obstacles/obstacle_full.obj");
 }
示例#45
0
 public PhasersWeapon()
 {
     material = new Material(Material.MaterialType.SHINY_STEEL);
     model = new OBJModel(Game.resourcePath + "/Phasers/Phasers.obj");
 }
示例#46
0
 public FullPlainBlock()
 {
     PosX = PosY = 0;
     model = new OBJModel(Game.resourcePath + "/Obstacles/obstacle_full.obj");
 }
示例#47
0
 public CannonWeapon()
 {
     material = new Material(Material.MaterialType.SHINY_STEEL);
     model    = new OBJModel(Game.resourcePath + "/Cannon/Phasers.obj");
 }
示例#48
0
 public LightPost(int x)
 {
     position = x;
     model = new OBJModel(Game.resourcePath + "/Lightpost/Lightpost2.obj");
 }
示例#49
0
 public FullPlainBlock(int x, int y)
 {
     PosX  = x;
     PosY  = y;
     model = new OBJModel(Game.resourcePath + "/Obstacles/obstacle_full.obj");
 }
示例#50
0
        private void Init()
        {
            robotPart = null;
            blockFrontLeft = new HalfPlainBlock();
            blockFrontRight = new HalfPlainBlock();
            blockBackLeft = new FullPlainBlock();
            blockBackMiddle = new FullPlainBlock();
            blockBackRight = new FullPlainBlock();

            full = new OBJModel(Game.resourcePath + "/Factory/light_khaki_bldg.obj");
            half = new OBJModel(Game.resourcePath + "/Factory/light_khaki_bldg_half.obj");
        }
示例#51
0
 public HalfSquareHoleBlock(int x, int y)
 {
     PosX = x;
     PosY = y;
     model = new OBJModel(Game.resourcePath + "/Obstacles/stripped_half.obj");
 }
示例#52
0
 public FloorTile(int x, int y)
 {
     PosX = x;
     PosY = y;
     model = new OBJModel(Game.resourcePath + "/Floor/Tile.obj");
 }
示例#53
0
 public RemoteControlUnit()
 {
     PosX      = PosY = 0.0f;
     model     = new OBJModel(Game.resourcePath + "/AI/Brain_AI.obj");
     robotList = new List <Robot>();
 }
示例#54
0
 public FloorTile()
 {
     PosX = PosY = 0;
     model = new OBJModel(Game.resourcePath + "/Floor/Tile.obj");
 }
示例#55
0
 public FloorTile()
 {
     PosX  = PosY = 0;
     model = new OBJModel(Game.resourcePath + "/Floor/Tile.obj");
 }
示例#56
0
        public bool Load(string filename)
        {
            if (models.ContainsKey(filename))
            {
                OBJModel model = models[filename];
                LoadFromExistingModel(model);
                return(true);
            }

            string[] s;
            string   sLine;

//			char[] cLine = new char[256];
            char[]       separators = new char[] { ' ', '/' };
            FileStream   fs         = new FileStream(filename, FileMode.Open, FileAccess.Read);
            StreamReader sr         = new StreamReader(fs);

            string absolutePath = fs.Name;

            //char[] sep = new char[] { '\\', '/' };
            char[] sep = new char[1];
            sep[0] = Game.GetPathSeparator()[0];
            string[] splitAbsolutePath = absolutePath.Split(sep);

            for (int i = 0; i < splitAbsolutePath.Length - 1; i++)
            {
                relativePath += splitAbsolutePath[i] + sep[0];
            }

            int  ic         = sr.Read();
            uint lineNumber = 1;

            List <Material> MaterialList = null;

            while (ic != -1)
            {
                char c = (char)ic;

                if (c == 'g')
                {
                    sLine = sr.ReadLine().Remove(0, 1);

                    if (sLine.CompareTo("default") == 0)
                    {
                        //Console.WriteLine("WARNING: Default group name ignored.");
                    }
                    else
                    {
                        FaceGroup fg = new FaceGroup(sLine);
                        FaceGroups.Add(fg);
                        currFaceGroup = fg;
                    }
                }
                else if (c == 'v')
                {
                    float[] fTemp;
                    int     iNext = sr.Read();

                    if (iNext == ' ' || iNext == '\t')
                    {
                        fTemp = new float[3];
                        sLine = sr.ReadLine();
                        s     = sLine.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                        float.TryParse(s[0], out fTemp[0]);
                        float.TryParse(s[1], out fTemp[1]);
                        float.TryParse(s[2], out fTemp[2]);

                        Vertices.Add(fTemp);
                    }
                    else if (iNext == 't')
                    {
                        fTemp = new float[2];
                        sLine = sr.ReadLine();
                        s     = sLine.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                        float.TryParse(s[0], out fTemp[0]);
                        float.TryParse(s[1], out fTemp[1]);

                        TexCoords.Add(fTemp);

                        HasTexCoords = true;
                    }
                    else if (iNext == 'n')
                    {
                        fTemp = new float[3];
                        sLine = sr.ReadLine();
                        s     = sLine.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                        float.TryParse(s[0], out fTemp[0]);
                        float.TryParse(s[1], out fTemp[1]);
                        float.TryParse(s[2], out fTemp[2]);

                        Normals.Add(fTemp);

                        HasNormals = true;
                    }
                    else
                    {
                        sLine = sr.ReadLine();
                    }
                }
                else if (c == 'f')
                {
                    uint[][] iTemp = new uint[3][];
                    int      faceSize;
                    bool     isQuad = false;

                    sLine = sr.ReadLine();

                    if (HasTexCoords && HasNormals)
                    {
                        //f v/t/n v/t/n v/t/n (v/t/n)
                        s = sLine.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                        faceSize = s.Length / 3;
                        isQuad   = (faceSize == 4);

                        iTemp[0] = isQuad ? new uint[4] : new uint[3];
                        uint.TryParse(s[0], out iTemp[0][0]);
                        uint.TryParse(s[3], out iTemp[0][1]);
                        uint.TryParse(s[6], out iTemp[0][2]);

                        if (isQuad)
                        {
                            uint.TryParse(s[9], out iTemp[0][3]);
                        }

                        iTemp[1] = isQuad ? new uint[4] : new uint[3];
                        uint.TryParse(s[1], out iTemp[1][0]);
                        uint.TryParse(s[4], out iTemp[1][1]);
                        uint.TryParse(s[7], out iTemp[1][2]);

                        if (isQuad)
                        {
                            uint.TryParse(s[10], out iTemp[1][3]);
                        }

                        iTemp[2] = isQuad ? new uint[4] : new uint[3];
                        uint.TryParse(s[2], out iTemp[2][0]);
                        uint.TryParse(s[5], out iTemp[2][1]);
                        uint.TryParse(s[8], out iTemp[2][2]);

                        if (isQuad)
                        {
                            uint.TryParse(s[11], out iTemp[2][3]);
                        }

                        Assertion(iTemp[0][0] - 1, (uint)Vertices.Count, lineNumber);
                        Assertion(iTemp[0][1] - 1, (uint)Vertices.Count, lineNumber);
                        Assertion(iTemp[0][2] - 1, (uint)Vertices.Count, lineNumber);

                        if (isQuad)
                        {
                            Assertion(iTemp[0][3] - 1, (uint)Vertices.Count, lineNumber);
                        }

                        Assertion(iTemp[1][0] - 1, (uint)TexCoords.Count, lineNumber);
                        Assertion(iTemp[1][1] - 1, (uint)TexCoords.Count, lineNumber);
                        Assertion(iTemp[1][2] - 1, (uint)TexCoords.Count, lineNumber);

                        if (isQuad)
                        {
                            Assertion(iTemp[1][3] - 1, (uint)TexCoords.Count, lineNumber);
                        }

                        Assertion(iTemp[2][0] - 1, (uint)Normals.Count, lineNumber);
                        Assertion(iTemp[2][1] - 1, (uint)Normals.Count, lineNumber);
                        Assertion(iTemp[2][2] - 1, (uint)Normals.Count, lineNumber);

                        if (isQuad)
                        {
                            Assertion(iTemp[2][3] - 1, (uint)Normals.Count, lineNumber);
                        }

                        currFaceGroup.AddFace(new Face(iTemp));
                    }
                    else if (HasTexCoords && !HasNormals)
                    {
                        //f v/t v/t v/t (v/t)
                        s = sLine.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                        faceSize = s.Length / 3;
                        isQuad   = (faceSize == 4);

                        iTemp[0] = isQuad ? new uint[4] : new uint[3];
                        uint.TryParse(s[0], out iTemp[0][0]);
                        uint.TryParse(s[2], out iTemp[0][1]);
                        uint.TryParse(s[4], out iTemp[0][2]);

                        if (isQuad)
                        {
                            uint.TryParse(s[6], out iTemp[0][3]);
                        }

                        iTemp[1] = isQuad ? new uint[4] : new uint[3];
                        uint.TryParse(s[1], out iTemp[1][0]);
                        uint.TryParse(s[3], out iTemp[1][1]);
                        uint.TryParse(s[5], out iTemp[1][2]);

                        if (isQuad)
                        {
                            uint.TryParse(s[7], out iTemp[1][3]);
                        }

                        Assertion(iTemp[0][0] - 1, (uint)Vertices.Count, lineNumber);
                        Assertion(iTemp[0][1] - 1, (uint)Vertices.Count, lineNumber);
                        Assertion(iTemp[0][2] - 1, (uint)Vertices.Count, lineNumber);

                        if (isQuad)
                        {
                            Assertion(iTemp[0][3] - 1, (uint)Vertices.Count, lineNumber);
                        }

                        Assertion(iTemp[1][0] - 1, (uint)TexCoords.Count, lineNumber);
                        Assertion(iTemp[1][1] - 1, (uint)TexCoords.Count, lineNumber);
                        Assertion(iTemp[1][2] - 1, (uint)TexCoords.Count, lineNumber);

                        if (isQuad)
                        {
                            Assertion(iTemp[1][3] - 1, (uint)Vertices.Count, lineNumber);
                        }

                        currFaceGroup.AddFace(new Face(iTemp));
                    }
                    else if (!HasTexCoords && HasNormals)
                    {
                        //f v//n v//n v//n (v//n)
                        s = sLine.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                        faceSize = s.Length / 3;
                        isQuad   = (faceSize == 4);

                        iTemp[0] = isQuad ? new uint[4] : new uint[3];

                        uint.TryParse(s[0], out iTemp[0][0]);
                        uint.TryParse(s[2], out iTemp[0][1]);
                        uint.TryParse(s[4], out iTemp[0][2]);

                        if (isQuad)
                        {
                            uint.TryParse(s[6], out iTemp[0][3]);
                        }

                        iTemp[2] = isQuad ? new uint[4] : new uint[3];

                        uint.TryParse(s[1], out iTemp[2][0]);
                        uint.TryParse(s[3], out iTemp[2][1]);
                        uint.TryParse(s[5], out iTemp[2][2]);

                        if (isQuad)
                        {
                            uint.TryParse(s[7], out iTemp[2][3]);
                        }

                        Assertion(iTemp[0][0] - 1, (uint)Vertices.Count, lineNumber);
                        Assertion(iTemp[0][1] - 1, (uint)Vertices.Count, lineNumber);
                        Assertion(iTemp[0][2] - 1, (uint)Vertices.Count, lineNumber);

                        if (isQuad)
                        {
                            Assertion(iTemp[0][3] - 1, (uint)Vertices.Count, lineNumber);
                        }

                        Assertion(iTemp[2][0] - 1, (uint)Normals.Count, lineNumber);
                        Assertion(iTemp[2][1] - 1, (uint)Normals.Count, lineNumber);
                        Assertion(iTemp[2][2] - 1, (uint)Normals.Count, lineNumber);

                        if (isQuad)
                        {
                            Assertion(iTemp[2][3] - 1, (uint)Vertices.Count, lineNumber);
                        }

                        currFaceGroup.AddFace(new Face(iTemp));
                    }
                    else
                    {
                        s = sLine.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                        faceSize = s.Length / 3;
                        isQuad   = (faceSize == 4);

                        iTemp[0] = isQuad ? new uint[4] : new uint[3];
                        uint.TryParse(s[0], out iTemp[0][0]);
                        uint.TryParse(s[1], out iTemp[0][1]);
                        uint.TryParse(s[2], out iTemp[0][2]);

                        if (isQuad)
                        {
                            uint.TryParse(s[3], out iTemp[0][3]);
                        }

                        Assertion(iTemp[0][0] - 1, (uint)Vertices.Count, lineNumber);
                        Assertion(iTemp[0][1] - 1, (uint)Vertices.Count, lineNumber);
                        Assertion(iTemp[0][2] - 1, (uint)Vertices.Count, lineNumber);

                        if (isQuad)
                        {
                            Assertion(iTemp[0][3] - 1, (uint)Vertices.Count, lineNumber);
                        }

                        currFaceGroup.AddFace(new Face(iTemp));
                    }
                }
                else if (c == 'm')                 //Material Library File
                {
                    sLine        = sr.ReadLine();
                    s            = sLine.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                    MaterialList = Material.ParseMaterials(relativePath + s[1]);
                }
                else if (c == 'u')
                {
                    sr.Read();                     //'s'
                    sr.Read();                     //'e'
                    sr.Read();                     //'m'
                    sr.Read();                     //'t'
                    sr.Read();                     //'l'
                    sr.Read();                     //' '

                    sLine = sr.ReadLine();

                    s = sLine.Split(separators, StringSplitOptions.RemoveEmptyEntries);

                    if (MaterialList != null)
                    {
                        for (int i = 0; i < MaterialList.Count; i++)
                        {
                            if (MaterialList[i].matName.CompareTo(s[0]) == 0)
                            {
                                currFaceGroup.SetMaterial(MaterialList[i]);
                            }
                        }
                    }
                }
                else if (c != '\n')
                {
                    sLine = sr.ReadLine();
                }

                lineNumber++;
                ic = sr.Read();
            }

            sr.Close();
            fs.Close();

            models.Add(filename, this);

            return(true);
        }
示例#57
0
 public FullSquareHoleBlock(int x, int y)
 {
     PosX  = x;
     PosY  = y;
     model = new OBJModel(Game.resourcePath + "/Obstacles/full_block.obj");
 }
示例#58
0
 public LightRubblePile()
 {
     PosX = PosY = 0;
     model = new OBJModel(Game.resourcePath + "/Floor/floor_debris_1.obj");
 }
示例#59
0
 public HalfPlainBlock(int x, int y)
 {
     PosX = x;
     PosY = y;
     model = new OBJModel(Game.resourcePath + "/Obstacles/checkered_obstacle.obj");
 }
示例#60
0
 public HalfSquareHoleBlock(int x, int y)
 {
     PosX  = x;
     PosY  = y;
     model = new OBJModel(Game.resourcePath + "/Obstacles/stripped_half.obj");
 }