Пример #1
0
        public void LoadSkyboxModelsFromFixedModelList(string rootFolder)
        {
            string[] fileNames = new[] { "vr_sky", "vr_kasumi_mae", "vr_uso_umi", "vr_back_cloud" };
            string[] extNames  = new[] { ".bmd", ".bdl" };

            foreach (var model in fileNames)
            {
                foreach (var ext in extNames)
                {
                    string fullPath = Path.Combine(rootFolder, model + ext);
                    if (File.Exists(fullPath))
                    {
                        J3D     j3dModel  = WResourceManager.LoadResource(fullPath);
                        J3DNode modelNode = new J3DNode(j3dModel, m_world, fullPath);

                        switch (model)
                        {
                        case "vr_sky": m_vrSky = modelNode; break;

                        case "vr_kasumi_mae": m_vrKasumiMae = modelNode; break;

                        case "vr_uso_umi": m_vrUsoUmi = modelNode; break;

                        case "vr_back_cloud": m_vrBackCloud = modelNode; break;
                        }
                    }
                }
            }
        }
Пример #2
0
        private void LoadRoomModels(string filePath)
        {
            // Search the bmd and bdl folders for valid model names. Then search for a matching brk and btk for those models.
            string[] modelNames  = new[] { "model", "model1", "model2", "model3" };
            string[] folderNames = new[] { "bmd", "bdl" };
            bool[]   validModels = new bool[modelNames.Length];

            CategoryDOMNode col_category = new CategoryDOMNode("Models", m_world);

            col_category.SetParent(this);

            foreach (var subFolder in folderNames)
            {
                string folderPath = Path.Combine(filePath, subFolder);
                foreach (var modelName in modelNames)
                {
                    J3D mesh = LoadModel(folderPath, modelName);
                    if (mesh != null)
                    {
                        J3DNode j3d_node = new J3DNode(mesh, m_world);
                        j3d_node.SetParent(col_category);
                    }
                }
            }
        }
Пример #3
0
        private void ImportVisualMeshToCategory(View.VisualMeshImportWindow importWindow, CategoryDOMNode category, string meshName)
        {
            List <J3DNode> meshList = category.GetChildrenOfType <J3DNode>();

            bool isBDL = true;

            J3DNode oldMeshNode = meshList.Find(x => x.Name == meshName);

            if (oldMeshNode != null)
            {
                category.Children.Remove(oldMeshNode);
                isBDL = oldMeshNode.Model.StudioType == "bdl4";
            }

            string fileExt      = Path.GetExtension(importWindow.FileName);
            string loadFilename = "";

            if (fileExt == ".bmd" || fileExt == ".bdl")
            {
                loadFilename = importWindow.FileName;
            }
            else
            {
                loadFilename = ImportVisualMesh(importWindow, isBDL);
            }

            JStudio.J3D.J3D newMesh = WResourceManager.LoadResource(loadFilename);
            newMesh.Name = meshName;
            J3DNode newNode = new J3DNode(newMesh, MainWorld, loadFilename);

            category.Children.Add(newNode);
        }
Пример #4
0
        private void ExportVisualMeshToCategory(View.VisualMeshExportWindow exportWindow, CategoryDOMNode category, string meshName)
        {
            List <J3DNode> meshList = category.GetChildrenOfType <J3DNode>();

            J3DNode meshNode = meshList.Find(x => x.Name == meshName);

            if (meshNode == null)
            {
                MessageBox.Show("No mesh in the selected slot!", "Mesh Export Error");
                return;
            }

            ExportVisualMesh(exportWindow, meshNode.Filename);
        }
Пример #5
0
        private void LoadStageModels(string filepath)
        {
            m_skybox = new WSkyboxNode(m_world);
            m_skybox.LoadSkyboxModelsFromFixedModelList(filepath);
            m_skybox.SetParent(this);

            CategoryDOMNode meshCategory = new CategoryDOMNode("Models", m_world);

            meshCategory.SetParent(this);

            string[] files = Directory.GetFiles(filepath, "*.bdl");

            foreach (string str in files)
            {
                J3D mesh = LoadModel(filepath, Path.GetFileNameWithoutExtension(str));
                if (mesh != null)
                {
                    J3DNode j3d_node = new J3DNode(mesh, m_world, str);
                    j3d_node.IsRendered = false;
                    j3d_node.SetParent(meshCategory);
                }
            }
        }