Esempio n. 1
0
        public static void ConvertMapGeometryToGltf(ConvertMapGeometryToGltf opts)
        {
            MapGeometry mapGeometry = ReadMapGeometry(opts.MapGeometryPath); //Material Support missing
            ModelRoot   gltf        = mapGeometry.ToGLTF();

            gltf.Save(opts.OutputPath);
        }
Esempio n. 2
0
        public static void ConvertMapGeometryToGltf(ConvertMapGeometryToGltf opts)
        {
            MapGeometry mapGeometry = ReadMapGeometry(opts.MapGeometryPath);
            ModelRoot   gltf        = mapGeometry.ToGLTF();

            gltf.Save(opts.OutputPath);
        }
Esempio n. 3
0
        private static ReferenceLine CreateReferenceLine(MapLineData lineMapData, string shapeFilePath)
        {
            MapFeature[] lineFeatures = lineMapData.Features.ToArray();

            if (lineFeatures.Length > 1)
            {
                string message = new FileReaderErrorMessageBuilder(shapeFilePath)
                                 .Build(RiskeerCommonIOResources.ReferenceLineReader_File_contains_unsupported_multi_polyline);
                throw new CriticalFileReadException(message);
            }

            var        referenceLine        = new ReferenceLine();
            MapFeature referenceLineFeature = lineMapData.Features.First();

            MapGeometry[] referenceGeometries = referenceLineFeature.MapGeometries.ToArray();

            if (referenceGeometries.Length > 1)
            {
                string message = new FileReaderErrorMessageBuilder(shapeFilePath)
                                 .Build(RiskeerCommonIOResources.ReferenceLineReader_File_contains_unsupported_multi_polyline);
                throw new CriticalFileReadException(message);
            }

            MapGeometry referenceGeometry = referenceGeometries[0];

            referenceLine.SetGeometry(referenceGeometry.PointCollections.First().Select(t => new Point2D(t)).ToArray());
            return(referenceLine);
        }
Esempio n. 4
0
        private void button9_Click(object sender, EventArgs e)
        {
            string MAPGEOText = Path.GetFullPath(openmapgeo.FileName);


            savegltf.Filter = "GLTF|*.gltf|GLB|*.glb";
            if (savegltf.ShowDialog() == DialogResult.OK)

            {
                string outputgltf = Path.GetFullPath(savegltf.FileName);
                try
                {
                    MapGeometry mapgeo     = new MapGeometry(MAPGEOText);
                    var         convertmap = mapgeo.ToGLTF();
                    convertmap.SaveGLB(outputgltf);
                    MessageBox.Show("Exported to GLTF/GLB.", $"Files Exported!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                catch (FileNotFoundException ex)
                {
                    MessageBox.Show("MapFile is missing. Make sure you load the correct MAPGEO file!", $"Error: Can't find .mapgeo file!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                catch (System.ArgumentException ag)
                {
                    MessageBox.Show("Make sure you load a file before exporting it!", $"Error: No file is loaded!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private static void AssertCombinedFailureMechanismSectionAssemblyResultMapData(IEnumerable <CombinedFailureMechanismSectionAssemblyResult> expectedAssemblyResults,
                                                                                       ReferenceLine referenceLine,
                                                                                       MapData mapData)
        {
            Assert.IsInstanceOf <MapLineData>(mapData);
            var assemblyResultMapData = (MapLineData)mapData;

            int expectedNrOfResults = expectedAssemblyResults.Count();
            IEnumerable <MapFeature> mapFeatures = assemblyResultMapData.Features;

            Assert.AreEqual(expectedNrOfResults, mapFeatures.Count());

            for (var i = 0; i < expectedNrOfResults; i++)
            {
                CombinedFailureMechanismSectionAssemblyResult expectedAssemblyResult = expectedAssemblyResults.ElementAt(i);
                MapFeature actualFeature = mapFeatures.ElementAt(i);

                MapGeometry mapGeometry = actualFeature.MapGeometries.Single();
                AssertEqualPointCollections(referenceLine,
                                            expectedAssemblyResult,
                                            mapGeometry);

                Assert.AreEqual(1, actualFeature.MetaData.Keys.Count);
                Assert.AreEqual(EnumDisplayNameHelper.GetDisplayName(expectedAssemblyResult.TotalResult),
                                mapFeatures.ElementAt(i).MetaData["Duidingsklasse"]);
            }
        }
Esempio n. 6
0
        static void TestMapgeo()
        {
            MapGeometry mgeo = new MapGeometry(@"C:/Users/Crauzer/Desktop/data/maps/mapgeometry/sr/base_srx.mapgeo");

            string randomMaterialName = mgeo.Models[180].Submeshes[0].Material;

            mgeo.Models.Clear();

            OBJFile object1 = new OBJFile("room155.obj");
            OBJFile object2 = new OBJFile("room156.obj");
            OBJFile object3 = new OBJFile("room157.obj");

            AddOBJ(object1, "MapGeo_Instance_0");
            AddOBJ(object2, "MapGeo_Instance_1");
            AddOBJ(object3, "MapGeo_Instance_2");

            mgeo.Write("base_srx.mapgeo.edited", 7);

            void AddOBJ(OBJFile obj, string name)
            {
                //We will add each object 2 times just for fun to see how transformation works

                (List <ushort> indices, List <MapGeometryVertex> vertices) = obj.GetMGEOData();

                Matrix4x4 transformation = Matrix4x4.CreateTranslation(new Vector3(0, 50, 100));

                MapGeometrySubmesh submesh = new MapGeometrySubmesh("", 0, (uint)indices.Count, 0, (uint)vertices.Count);
                MapGeometryModel   model1  = new MapGeometryModel(name, vertices, indices, new List <MapGeometrySubmesh>()
                {
                    submesh
                }, MapGeometryLayer.AllLayers);

                mgeo.AddModel(model1);
            }
        }
 public FirstPersonRenderer(GameSettings settings, MapGeometry map, ScreenMessage screenMessage)
 {
     _settings      = settings;
     _map           = map;
     _screenMessage = screenMessage;
     Interpreter    = new FirstPersonWorldInterpreter();
 }
Esempio n. 8
0
        private static void ConvertMapGeometryToGltf(FileConversionParameter parameter)
        {
            WadEntry    mapGeometryWadEntry = parameter.Parameter;
            MapGeometry mapGeometry         = new MapGeometry(mapGeometryWadEntry.GetDataHandle().GetDecompressedStream());
            ModelRoot   gltf = mapGeometry.ToGLTF();

            gltf.SaveGLB(Path.ChangeExtension(parameter.OutputPath, "glb"));
        }
Esempio n. 9
0
        private static void ConvertMapGeometryToGltf(FileConversionParameter parameter)
        {
            WADEntry mapGeometryWadEntry = parameter.Parameter;

            using MemoryStream stream = new MemoryStream(mapGeometryWadEntry.GetContent(true));
            MapGeometry mapGeometry = new MapGeometry(stream);
            ModelRoot   gltf        = mapGeometry.ToGLTF();

            gltf.SaveGLB(Path.ChangeExtension(parameter.OutputPath, "glb"));
        }
Esempio n. 10
0
        private World(WorldInfo info, MapData map, GameObject gameObj)
        {
            Info       = info;
            gameObject = gameObj;
            Geometry   = new MapGeometry(map);
            Entities   = new EntityManager(this, map);
            Physics    = new PhysicsSystem(this);

            timer.Start();
        }
        static void Main(string[] args)
        {
            //SimpleSkin skn = new SimpleSkin("C:/dev/proxy/kek.skn");
            //
            //OBJConverter.ConvertSKN(skn).Write("C:/dev/proxy/kek.obj");

            MapGeometry mgeo = new MapGeometry("C:/Users/Crauzer/Desktop/New Folder/e7ef6cc4fece0526.mapgeo");

            mgeo.Write("C:/Users/Crauzer/Desktop/New Folder/e7ef6cc4fece0526_write.mapgeo", 11);
            mgeo = new MapGeometry("C:/Users/Crauzer/Desktop/New Folder/e7ef6cc4fece0526_write.mapgeo");
        }
Esempio n. 12
0
        public OverheadRenderer(GameSettings settings, MapGeometry map)
        {
            _settings = settings;
            _map      = map;
            _verticesInScreenCoords = new Point[map.Vertices.Length];

            _camera.RenderScale = _settings.RenderScale;

            _settings.FollowModeChanged          += (s, e) => _camera.ViewOffset = Vector2.Zero;
            _settings.DrawAntiAliasedModeChanged += (s, e) => PickLineDrawer();
            _settings.RenderScaleChanged         += (s, e) => _camera.RenderScale = _settings.RenderScale;
            PickLineDrawer();
        }
Esempio n. 13
0
        private static void AssertEqualPointCollections(ReferenceLine referenceLine,
                                                        CombinedFailureMechanismSectionAssemblyResult sectionAssemblyResult,
                                                        MapGeometry geometry)
        {
            IEnumerable <Point2D> expectedGeometry = FailureMechanismSectionHelper.GetFailureMechanismSectionGeometry(
                referenceLine,
                sectionAssemblyResult.SectionStart,
                sectionAssemblyResult.SectionEnd).ToArray();

            CollectionAssert.IsNotEmpty(expectedGeometry);

            CollectionAssert.AreEqual(expectedGeometry, geometry.PointCollections.Single());
        }
        public void LoadMap()
        {
            using (var wad = WadReader.Read("freedoom2-udmf.wad"))
            {
                _map = new MapGeometry(MapData.LoadFrom(wad.GetTextmapStream("MAP28")));
            }

            _sectorBounds = new STRtree <int>();
            for (int sectorId = 0; sectorId < _map.Sectors.Length; sectorId++)
            {
                _sectorBounds.Insert(_map.GetSectorMinimumBoundingRectangle(sectorId), sectorId);
            }
            _sectorBounds.Build();
        }
Esempio n. 15
0
        public void CreateCombinedFailureMechanismSectionAssemblyFeatures_WithAssessmentSection_ReturnsFeatureCollection()
        {
            // Setup
            var random = new Random(21);

            var assessmentSection = new AssessmentSection(random.NextEnumValue <AssessmentSectionComposition>());

            assessmentSection.ReferenceLine.SetGeometry(new[]
            {
                new Point2D(0, 0),
                new Point2D(2, 2)
            });

            using (new AssemblyToolCalculatorFactoryConfig())
            {
                var calculatorFactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance;
                AssessmentSectionAssemblyCalculatorStub   calculator = calculatorFactory.LastCreatedAssessmentSectionAssemblyCalculator;
                CombinedFailureMechanismSectionAssembly[] failureMechanismSectionAssembly =
                {
                    CombinedFailureMechanismSectionAssemblyTestFactory.Create(assessmentSection, 20),
                    CombinedFailureMechanismSectionAssemblyTestFactory.Create(assessmentSection, 21)
                };
                calculator.CombinedFailureMechanismSectionAssemblyOutput = new CombinedFailureMechanismSectionAssemblyResultWrapper(
                    failureMechanismSectionAssembly, AssemblyMethod.BOI3A1, AssemblyMethod.BOI3B1, AssemblyMethod.BOI3C1);

                // Call
                IEnumerable <MapFeature> features = AssessmentSectionAssemblyMapDataFeaturesFactory.CreateCombinedFailureMechanismSectionAssemblyFeatures(assessmentSection);

                // Assert
                IEnumerable <CombinedFailureMechanismSectionAssemblyResult> expectedAssemblyResults =
                    AssessmentSectionAssemblyFactory.AssembleCombinedPerFailureMechanismSection(assessmentSection);
                int expectedNrOfResults = expectedAssemblyResults.Count();
                Assert.AreEqual(expectedNrOfResults, features.Count());

                for (var i = 0; i < expectedNrOfResults; i++)
                {
                    CombinedFailureMechanismSectionAssemblyResult expectedAssemblyResult = expectedAssemblyResults.ElementAt(i);
                    MapFeature actualFeature = features.ElementAt(i);

                    MapGeometry mapGeometry = actualFeature.MapGeometries.Single();
                    AssertEqualPointCollections(assessmentSection.ReferenceLine,
                                                expectedAssemblyResult,
                                                mapGeometry);

                    Assert.AreEqual(1, actualFeature.MetaData.Keys.Count);
                    Assert.AreEqual(EnumDisplayNameHelper.GetDisplayName(expectedAssemblyResult.TotalResult),
                                    features.ElementAt(i).MetaData["Duidingsklasse"]);
                }
            }
        }
Esempio n. 16
0
        static void Main(string[] args)
        {
            //Deletes existing material file.
            if (File.Exists(@"material_output\material.py"))
            {
                File.Delete(@"material_output\material.py");
            }

            string      MapMgeoPath = "MapFile/base_srx.mapgeo";
            MapGeometry MapMgeo     = new MapGeometry(MapMgeoPath);

            MapMgeo.Models.Clear();
            BildgeWaterRift(MapMgeo);
        }
Esempio n. 17
0
        private static MapFeature CreateMapFeatureForPolygonFeature(IFeature polygonFeature)
        {
            var geometries = new List <MapGeometry>();

            for (var i = 0; i < polygonFeature.Geometry.NumGeometries; i++)
            {
                var basicPolygon = (IPolygon)polygonFeature.Geometry.GetGeometryN(i);

                var mapGeometry = new MapGeometry(GetMapGeometryPointCollections(basicPolygon).ToArray());
                geometries.Add(mapGeometry);
            }

            return(new MapFeature(geometries));
        }
Esempio n. 18
0
        private static MapFeature CreateMapFeatureForLineFeature(IFeature lineFeature)
        {
            var geometries = new List <MapGeometry>();

            for (var i = 0; i < lineFeature.Geometry.NumGeometries; i++)
            {
                IGeometry polylineGeometry = lineFeature.Geometry.GetGeometryN(i);

                var mapGeometry = new MapGeometry(GetMapGeometryPointCollections(polylineGeometry.Coordinates));
                geometries.Add(mapGeometry);
            }

            return(new MapFeature(geometries));
        }
Esempio n. 19
0
        private static LineString CreateLineStringFromMapFeature(MapFeature mapFeature)
        {
            if (mapFeature.MapGeometries.Count() != 1)
            {
                throw new ArgumentException(Resources.PointShapeFileWriter_CreatePointFromMapFeature_A_feature_can_only_contain_one_geometry);
            }

            MapGeometry geometry = mapFeature.MapGeometries.First();

            IEnumerable <Point2D> mapGeometryPointCollection = geometry.PointCollections.First();

            Coordinate[] coordinates = mapGeometryPointCollection.Select(p => new Coordinate(p.X, p.Y)).ToArray();

            return(new LineString(coordinates));
        }
Esempio n. 20
0
        //Base Map
        public static void Add_Layer1(OBJFile obj, string name, string path, MapGeometry mgeo, int i, string fullpath, string mapname, string Lightmode, string Fogmode, string Alphamode)
        {
            (List <ushort> indices, List <MapGeometryVertex> vertices) = obj.GetMGEOData();
            MapGeometrySubmesh submesh = new MapGeometrySubmesh(path, 0, (uint)indices.Count, 0, (uint)vertices.Count);
            MapGeometryModel   room    = new MapGeometryModel(name, vertices, indices, new List <MapGeometrySubmesh>()
            {
                submesh
            }, MapGeometryLayer.Layer1);

            mgeo.AddModel(room);

            //Porting material file to league format
            string        ShaderPath = "MapFile/ShaderTemp/DefaultEnv_Flat_AlphaTest.py";
            List <string> materials  = new List <string>();

            materials = File.ReadAllLines(ShaderPath).ToList();


            string number   = $"{i}";
            string readfile = File.ReadLines($@"{fullpath}").Skip(12).Take(1).First();


            //Get texture name without extension
            string replace        = readfile.Replace("\\\\", " \\\\ ");
            var    gettexturename = string.Join(" ", replace.Split().Reverse().Take(1).Reverse());
            string text           = gettexturename.Replace(".dds", "");
            string texturename    = gettexturename;

            if (mapname == string.Empty)
            {
                mapname = "textures";
            }

            //Add Settings to material
            var newList  = materials.Select(s => s.Replace("Texture_Name", texturename)).ToList();
            var newList2 = newList.Select(s => s.Replace("Map_Name", mapname)).ToList();
            var newList3 = newList2.Select(s => s.Replace("Material_Name", path)).ToList();
            var newList4 = newList3.Select(s => s.Replace("NOBAKEDLIGHTINGTEMP", Lightmode)).ToList();
            var newList5 = newList4.Select(s => s.Replace("DISABLEDEPTHFOG", Fogmode)).ToList();
            var newList6 = newList5.Select(s => s.Replace("PREMULTIPLIEDALPHA", Alphamode)).ToList();

            //Sun Properties


            //Writes
            Directory.CreateDirectory("material_output");
            File.AppendAllLines(@"material_output\" + "material.py", newList6);
        }
Esempio n. 21
0
    void Awake()
    {
        if (GAME == null)
        {
            GAME = this;
            DontDestroyOnLoad(GAME);
        }
        else
        {
            Destroy(this);
        }

        TOON = GameObject.FindGameObjectWithTag("ToonManager").GetComponent <ToonPool>();
        PART = GameObject.FindGameObjectWithTag("GeometryManager").GetComponent <MapGeometry>();
        MAP  = GameObject.FindGameObjectWithTag("MapManager").GetComponent <MapManager>();
    }
Esempio n. 22
0
        public void CreateSinglePointMapFeature_WithPoint_CreatesASinglePointMapFeature()
        {
            // Setup
            var point = new Point2D(0, 0);

            // Call
            MapFeature pointMapFeature = RiskeerMapDataFeaturesFactoryHelper.CreateSinglePointMapFeature(point);

            // Assert
            MapGeometry[] mapGeometries = pointMapFeature.MapGeometries.ToArray();
            Assert.AreEqual(1, mapGeometries.Length);
            MapGeometry mapGeometry = mapGeometries.First();

            IEnumerable <Point2D>[] geometryPointCollections = mapGeometry.PointCollections.ToArray();
            Assert.AreEqual(1, geometryPointCollections.Length);
            Assert.AreSame(point, geometryPointCollections.First().First());
        }
Esempio n. 23
0
        /// <summary>
        /// Asserts whether the <see cref="MapData"/> contains the data that is representative for the <paramref name="sections"/>.
        /// </summary>
        /// <param name="sections">The sections that contain the original data.</param>
        /// <param name="mapData">The <see cref="MapData"/> that needs to be asserted.</param>
        /// <exception cref="AssertionException">Thrown when:
        /// <list type="bullet">
        /// <item><paramref name="mapData"/> is not <see cref="MapLineData"/>;</item>
        /// <item>the name of the <see cref="MapData"/> is not <c>"Vakindeling"</c>;</item>
        /// <item>the number of sections and features in <see cref="MapData"/> are not the same;</item>
        /// <item>the points of a section and the geometry of a corresponding feature are not the same.</item>
        /// </list>
        /// </exception>
        public static void AssertFailureMechanismSectionsMapData(IEnumerable <FailureMechanismSection> sections, MapData mapData)
        {
            Assert.IsInstanceOf <MapLineData>(mapData);
            Assert.AreEqual("Vakindeling", mapData.Name);

            var sectionsMapLinesData = (MapLineData)mapData;

            MapFeature[] sectionMapLinesFeatures    = sectionsMapLinesData.Features.ToArray();
            FailureMechanismSection[] sectionsArray = sections.ToArray();
            Assert.AreEqual(sectionsArray.Length, sectionMapLinesFeatures.Length);

            for (var index = 0; index < sectionsArray.Length; index++)
            {
                MapGeometry             geometry = sectionMapLinesFeatures[index].MapGeometries.First();
                FailureMechanismSection failureMechanismSection = sectionsArray[index];
                CollectionAssert.AreEquivalent(failureMechanismSection.Points, geometry.PointCollections.First());
            }
        }
Esempio n. 24
0
        /// <summary>
        /// Asserts whether the <see cref="MapData"/> contains the data that is representative for the <paramref name="foreshoreProfiles"/>.
        /// </summary>
        /// <param name="foreshoreProfiles">The foreshore profiles that contain the original data.</param>
        /// <param name="mapData">The <see cref="MapData"/> that needs to be asserted.</param>
        /// <exception cref="AssertionException">Thrown when:
        /// <list type="bullet">
        /// <item><paramref name="mapData"/> is not <see cref="MapLineData"/>;</item>
        /// <item>the name of the <see cref="MapData"/> is not <c>Voorlandprofielen</c>;</item>
        /// <item>the amount of features in <paramref name="mapData"/> is not equal to the length of the <paramref name="foreshoreProfiles"/>;</item>
        /// <item>the geometries of the features in <paramref name="mapData"/> are not equal to the expected geometry of the <paramref name="foreshoreProfiles"/>.</item>
        /// </list>
        /// </exception>
        public static void AssertForeshoreProfilesMapData(IEnumerable <ForeshoreProfile> foreshoreProfiles, MapData mapData)
        {
            Assert.IsInstanceOf <MapLineData>(mapData);
            Assert.AreEqual("Voorlandprofielen", mapData.Name);

            var foreshoreProfilesData = (MapLineData)mapData;

            ForeshoreProfile[] foreshoreProfileArray = foreshoreProfiles.ToArray();

            Assert.AreEqual(foreshoreProfileArray.Length, foreshoreProfilesData.Features.Count());

            for (var i = 0; i < foreshoreProfileArray.Length; i++)
            {
                IEnumerable <Point2D> expectedGeometry = GetWorldPoints(foreshoreProfileArray[i]);
                MapGeometry           profileDataA     = foreshoreProfilesData.Features.ElementAt(i).MapGeometries.First();
                CollectionAssert.AreEquivalent(expectedGeometry, profileDataA.PointCollections.First());
            }
        }
Esempio n. 25
0
        static void BildgeWaterRift(MapGeometry mgeo)
        {
            //Model Bulk Loading
            var fileCount    = (from file in Directory.EnumerateFiles(@"K:\Riot Games\LeagueSkins\BildgewaterRift\3dmodelsnewnew", "*.obj", System.IO.SearchOption.AllDirectories) select file).Count();
            int OBJsToCreate = fileCount + 1;

            OBJFile[] OBJs = new OBJFile[OBJsToCreate];



            for (int i = 1; i < OBJsToCreate; i++)
            {
                OBJs[i] = new OBJFile($@"K:\Riot Games\LeagueSkins\BildgewaterRift\3dmodelsnewnew\room{i}.obj");

                int j = i;
                AddModel(OBJs[i], $"MapGeo_Instance_{i}", $"Maps/KitPieces/Summoners_Rift/Materials/room{i}", mgeo, i, j);
            }
            mgeo.Write(@"K:\Riot Games\LeagueSkins\BildgewaterRift\Map11\data\maps\mapgeometry\sr\base_srx.mapgeo", 11);
        }
        public CollidingThing(
            MapGeometry map,
            int currentSectorId,
            Vector2 position,
            Vector2 direction,
            float angle,
            float radius)
        {
            _map = map;
            _possibleSectorsToEnter = new List <int>(_map.Sectors.Length);

            Position              = position;
            Direction             = direction;
            Angle                 = angle;
            CurrentSectorId       = currentSectorId;
            Radius                = radius;
            VerticalPosition      = map.Sectors[currentSectorId].Info.HeightFloor;
            _heightSourceSectorId = CurrentSectorId;
        }
        private static void AssertDikeProfiles(IEnumerable <DikeProfile> dikeProfiles, MapData mapData)
        {
            Assert.NotNull(dikeProfiles, "dikeProfiles should never be null.");

            var dikeProfilesData = (MapLineData)mapData;

            DikeProfile[] dikeProfileArray = dikeProfiles.ToArray();

            Assert.IsInstanceOf <MapLineData>(mapData);
            int dikeProfileCount = dikeProfileArray.Length;

            Assert.AreEqual(dikeProfileCount, dikeProfilesData.Features.Count());

            for (var i = 0; i < dikeProfileCount; i++)
            {
                MapGeometry profileDataA = dikeProfilesData.Features.ElementAt(i).MapGeometries.First();
                CollectionAssert.AreEquivalent(dikeProfileArray[0].DikeGeometry, profileDataA.PointCollections.First());
            }

            Assert.AreEqual("Dijkprofielen", mapData.Name);
        }
        public static IEnumerable <Tuple <string, OBJFile> > ConvertMGEOModels(MapGeometry mgeo)
        {
            foreach (MapGeometryModel model in mgeo.Models)
            {
                List <Vector3> vertices = new List <Vector3>();
                List <Vector3> normals  = new List <Vector3>();
                List <Vector2> uvs      = new List <Vector2>();

                foreach (MapGeometryVertex vertex in model.Vertices)
                {
                    vertices.Add(model.Transformation.ApplyTransformation(vertex.Position.Value));
                    normals.Add(vertex.Normal.Value);
                    if (vertex.DiffuseUV != null)
                    {
                        uvs.Add(vertex.DiffuseUV.Value);
                    }
                }

                yield return(new Tuple <string, OBJFile>(model.Name, new OBJFile(vertices, model.Indices.Select(x => (uint)x).ToList(), uvs, normals)));
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Create a new instance of <see cref="MapLineData"/> from a reference line and a traject id.
        /// </summary>
        /// <param name="referenceLine">The <see cref="ReferenceLine"/> supplying the geometry information
        /// for the new <see cref="MapLineData"/> object.</param>
        /// <param name="id">The id of the assessment section to which the reference line is associated.</param>
        /// <returns>A new instance of <see cref="MapLineData"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="referenceLine"/> or <paramref name="id"/>
        /// is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <paramref name="id"/> is empty or consists only of whitespace.</exception>
        private static MapLineData CreateMapLineData(ReferenceLine referenceLine, string id)
        {
            if (referenceLine == null)
            {
                throw new ArgumentNullException(nameof(referenceLine));
            }

            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentException(Resources.ReferenceLineWriter_CreateMapLineData_Traject_cannot_be_empty, nameof(id));
            }

            var referenceLineGeometry = new MapGeometry(
                new List <IEnumerable <Point2D> >
            {
                referenceLine.Points
            });

            var mapFeature = new MapFeature(new[]
            {
                referenceLineGeometry
            });

            mapFeature.MetaData.Add(Resources.ReferenceLineWriter_CreateMapLineData_Traject_id, id);

            return(new MapLineData(RiskeerCommonDataResources.ReferenceLine_DisplayName)
            {
                Features = new[]
                {
                    mapFeature
                }
            });
        }
Esempio n. 30
0
        public void ParameteredConstructor_WithPoints_PointsSet()
        {
            // Setup
            var list1 = new List <Point2D>
            {
                new Point2D(1.1, 2.2),
                new Point2D(3.3, 4.4),
                new Point2D(5.5, 6.6)
            };

            var list2 = new List <Point2D>
            {
                new Point2D(7.7, 8.8),
                new Point2D(9.9, 10.1),
                new Point2D(11.11, 12.12)
            };

            var list3 = new List <Point2D>
            {
                new Point2D(13.13, 14.14),
                new Point2D(15.15, 16.16),
                new Point2D(17.17, 18.18)
            };

            var geometriesList = new List <IEnumerable <Point2D> >
            {
                list1,
                list2,
                list3
            };

            // Call
            var mapGeometry = new MapGeometry(geometriesList);

            // Assert
            CollectionAssert.AreEqual(geometriesList, mapGeometry.PointCollections);
        }