コード例 #1
0
        private static SealedTransformableObject GetSealedObj()
        {
            SingularObjectModel model = new SingularObjectModel();

            model.InsertGeometricObj(new SuperquadricHyperboloid());
            return(new SealedTransformableObject(model, HierarchyPackage.SingularHierarchyPack));
        }
コード例 #2
0
        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);
        }
コード例 #4
0
        private static ObjectModel GetObjectModel()
        {
            Dictionary <ObjectModel.ComponentKey, ObjectModel> meshModels = new Dictionary <ObjectModel.ComponentKey, ObjectModel>();
            ObjectMeshLoader meshLoader;

            foreach (KeyValuePair <ObjectModel.ComponentKey, string> meshFile in _meshFiles)
            {
                meshLoader = new ObjectMeshLoader(meshFile.Value);
                meshModels.Add(meshFile.Key, new SingularObjectModel(meshLoader.ExtractObjectMesh(ObjectMeshLoader.LoadMode.Normal)));
            }

            for (int i = SpiderHiearchyPackage.HP.ComponentMap.Count - 1; i >= 0; i--)
            {
                KeyValuePair <ObjectModel.ComponentKey, List <ObjectModel.ComponentKey> > compMap = SpiderHiearchyPackage.HP.ComponentMap.ElementAt(i);
                if (compMap.Value.Count > 1)
                {
                    ObjectModel.ComponentKey parentComp;
                    if (compMap.Value.Count > 2)
                    {
                        parentComp = compMap.Value[compMap.Value.Count - 3];
                    }
                    else
                    {
                        parentComp = compMap.Value[compMap.Value.Count - 1];
                    }

                    if (meshModels[parentComp].GetStructType() != ObjectModel.StructType.Hierarchical)
                    {
                        SingularObjectModel primaryComp = meshModels[parentComp] as SingularObjectModel;
                        meshModels[parentComp] = new HierarchicalObjectModel(primaryComp);
                    }
                    (meshModels[parentComp] as HierarchicalObjectModel).InsertSubComp(compMap.Key, new TransformableObject(meshModels[compMap.Key]));
                }
            }
            return(meshModels[SpiderHiearchyPackage.body]);
        }