Esempio n. 1
0
        //IOpsCommand
        public void Run(OpsContext context, OpsStatement statement)
        {
            string[] paths = OpsHelpers.ResolvePathToMany(statement.Arguments as string);

            foreach (string path in paths)
            {
                OpsConsole.WriteLine("Loading model from file: \"{0}\"", path);

                OpsModel model = OpsModel.FromFile(context.Device, path);

                context.AddModel(model);
            }
        }
Esempio n. 2
0
        //IOpsCommand
        public void Run(OpsContext context, OpsStatement statement)
        {
            FlattenArguments arguments = statement.Arguments as FlattenArguments;

            ArrayList models = statement.GetContent(context);

            OpsConsole.WriteLine("Flattening models into '{0}'", arguments.NewModel);


            Mesh[]             meshes;
            Matrix[]           localToWorlds;
            int[][]            adjacencies;
            ExtendedMaterial[] materials;
            EffectInstance[]   effectInstances;

            GetLists(models, out meshes, out localToWorlds, out adjacencies, out materials, out effectInstances);

            Mesh newMesh = PrtEngine.ConcatenateMeshes(
                meshes,
                MeshFlags.SystemMemory | MeshFlags.Use32Bit,
                localToWorlds,
                null,
                null,
                context.Device);

            int[] newAdj = ConcatenateAdjacency(newMesh, meshes, adjacencies);

            OpsMeshContainer newMC = new OpsMeshContainer();

            newMC.Name = arguments.NewModel;
            newMC.ReplaceMesh(newMesh);
            newMC.SetMaterials(materials);
            newMC.SetEffectInstances(effectInstances);
            newMC.SetAdjacency(newAdj);

            OpsFrame newFrame = new OpsFrame();

            newFrame.Name          = arguments.NewModel;
            newFrame.MeshContainer = newMC;

            OpsModel newModel = new OpsModel();

            newModel.Name          = arguments.NewModel;
            newModel.HierarchyRoot = newFrame;

            context.AddModel(newModel);
        }
Esempio n. 3
0
        //IOpsCommand
        public void Run(OpsContext context, OpsStatement statement)
        {
            SavexArguments arguments = statement.Arguments as SavexArguments;

            ArrayList models = statement.GetContent(context);


            if (models.Count != 1)
            {
                string errorStr = string.Format("Save requires only one model but found {0}.  Try changing/using the Src argument.", models.Count);
                throw new OpsException(errorStr);
            }

            OpsModel model = models[0] as OpsModel;

            OpsConsole.WriteLine("Saving model: {0} to path: {1}", model.Name, arguments.Filename);

            if (model.HierarchyRoot == null)
            {
                throw new OpsException("There is nothing currently in the application's context.  Must use a Load command first.");
            }

            Mesh.SaveHierarchyToFile(arguments.Filename, arguments.saveType, model.HierarchyRoot, model.AnimationMixer, null);
        }
Esempio n. 4
0
        public IActionResult Error(Error id)
        {
            var model = new OpsModel(id);

            return(View(model));
        }
Esempio n. 5
0
        public IActionResult Index()
        {
            var model = new OpsModel();

            return(View(model));
        }
Esempio n. 6
0
        //IOpsCommand
        public void Run(OpsContext context, OpsStatement statement)
        {
            FlattenArguments arguments = statement.Arguments as FlattenArguments;

            ArrayList models = statement.GetContent(context);

            OpsConsole.WriteLine( "Flattening models into '{0}'", arguments.NewModel);


            Mesh[] meshes;
            Matrix[] localToWorlds;
            int[][] adjacencies;
            ExtendedMaterial[] materials;
            EffectInstance[] effectInstances;

            GetLists( models, out meshes, out localToWorlds, out adjacencies, out materials, out effectInstances);

            Mesh newMesh = PrtEngine.ConcatenateMeshes( 
                meshes, 
                MeshFlags.SystemMemory|MeshFlags.Use32Bit,
                localToWorlds,
                null, 
                null, 
                context.Device);

            int[] newAdj = ConcatenateAdjacency( newMesh, meshes, adjacencies);

            OpsMeshContainer newMC = new OpsMeshContainer();
            newMC.Name = arguments.NewModel;
            newMC.ReplaceMesh( newMesh );
            newMC.SetMaterials( materials );
            newMC.SetEffectInstances( effectInstances );
            newMC.SetAdjacency( newAdj );

            OpsFrame newFrame = new OpsFrame();
            newFrame.Name = arguments.NewModel;
            newFrame.MeshContainer = newMC;

            OpsModel newModel = new OpsModel();
            newModel.Name = arguments.NewModel;
            newModel.HierarchyRoot = newFrame;

            context.AddModel(newModel);
        }