Пример #1
0
        private static ColorPackage GetColorMap()
        {
            Dictionary <ObjectModel.ComponentKey, List <GeometricObject> > identities = SpiderModel.Model.GetIdentities();
            ColorPackage      _colorPackage = new ColorPackage();
            List <Coordinate> coords; List <Color4> colors;

            foreach (KeyValuePair <ObjectModel.ComponentKey, List <GeometricObject> > identity in identities)
            {
                coords = new List <Coordinate>(); colors = new List <Color4>();
                foreach (GeometricObject geobj in identity.Value)
                {
                    foreach (Coordinate coord in geobj.GetCoordinates())
                    {
                        if (coords.Contains(coord))
                        {
                            continue;
                        }
                        coords.Add(coord);
                    }
                }
                foreach (Coordinate coord in coords)
                {
                    colors.Add(compColors[identity.Key]);
                }
                _colorPackage.Insert(coords, colors);
            }

            return(_colorPackage);
        }
        private static ObjectModel GetObjectModel()
        {
            ObjectMeshLoader    meshLoader = new ObjectMeshLoader(_meshFile);
            SingularObjectModel model      = new SingularObjectModel(meshLoader.ExtractObjectMesh(ObjectMeshLoader.LoadMode.Normal));

            Color4            defaultColor = new Color4(0.17f, 0.06f, 0.03f, 1.0f);
            List <Coordinate> coords       = model.GetCoordinates();
            List <Color4>     colors       = new List <Color4>();

            foreach (Coordinate coord in coords)
            {
                colors.Add(defaultColor);
            }
            _colorPackage = new ColorPackage(coords, colors);

            return(model);
        }
Пример #3
0
        private static ObjectModel GetObjectModel()
        {
            List <Coordinate> edgeCoords = new List <Coordinate>()
            {
                new Coordinate(0.5f, 0.5f, 0.0f),
                new Coordinate(0.5f, -0.5f, 0.0f),
                new Coordinate(-0.5f, -0.5f, 0.0f),
                new Coordinate(-0.5f, 0.5f, 0.0f),
            };
            List <Polygon> polygons = new List <Polygon>()
            {
                new Triangle(), new Triangle()
            };

            polygons[0].InsertEdgeCoord(edgeCoords[0]);
            polygons[0].InsertEdgeCoord(edgeCoords[1]);
            polygons[0].InsertEdgeCoord(edgeCoords[2]);

            polygons[1].InsertEdgeCoord(edgeCoords[2]);
            polygons[1].InsertEdgeCoord(edgeCoords[3]);
            polygons[1].InsertEdgeCoord(edgeCoords[0]);

            List <GeometricObject> geobj = new List <GeometricObject>()
            {
                new GeometricObject(polygons)
            };

            SingularObjectModel model = new SingularObjectModel(geobj);

            Color4            defaultColor = new Color4(0.035f, 0.70f, 0.36f, 1.0f);
            List <Coordinate> coords       = model.GetCoordinates();
            List <Color4>     colors       = new List <Color4>();

            foreach (Coordinate coord in coords)
            {
                colors.Add(defaultColor);
            }
            _colorPackage = new ColorPackage(coords, colors);

            return(model);
        }