Exemple #1
0
        public static List <J3D> LoadActorResource(string name)
        {
            List <J3D> models = new List <J3D>();

            if (!m_actorResources.ContainsKey(name))
            {
                return(null);
            }

            WActorResource res = m_actorResources[name];

            foreach (var model in res.Models)
            {
                string model_arc_name = res.ArchiveName;

                if (!string.IsNullOrEmpty(model.ArchiveName))
                {
                    model_arc_name = model.ArchiveName;
                    string model_arc_path = Path.Combine(WSettingsManager.GetSettings().RootDirectoryPath, "files", "res/Object/", model_arc_name + ".arc");

                    if (!File.Exists(model_arc_path))
                    {
                        continue;
                    }
                }

                string arc_and_file_path = Path.Combine(model_arc_name, model.Path);

                TSharedRef <J3D> existRef = null;//m_j3dList.Find(x => string.Compare(x.FilePath, arc_and_file_path, StringComparison.InvariantCultureIgnoreCase) == 0);
                if (existRef != null)
                {
                    existRef.ReferenceCount++;
                    models.Add(existRef.Asset);

                    continue;
                }

                J3D loaded_model = LoadModelFromResource(model, model_arc_name);

                if (loaded_model == null)
                {
                    continue;
                }

                existRef          = new TSharedRef <J3D>();
                existRef.FilePath = arc_and_file_path;
                existRef.Asset    = loaded_model;
                existRef.ReferenceCount++;

                m_j3dList.Add(existRef);

                models.Add(loaded_model);
            }

            if (models.Count > 0 && (name == "Link" || name == "Tetra" || name == "Zelda"))
            {
                models[0].SetColorWriteOverride("eyeLdamA", false);
                models[0].SetColorWriteOverride("eyeLdamB", false);
                models[0].SetColorWriteOverride("mayuLdamA", false);
                models[0].SetColorWriteOverride("mayuLdamB", false);
                models[0].SetColorWriteOverride("eyeRdamA", false);
                models[0].SetColorWriteOverride("eyeRdamB", false);
                models[0].SetColorWriteOverride("mayuRdamA", false);
                models[0].SetColorWriteOverride("mayuRdamB", false);

                models[0].SetColorWriteOverride("m_pz_eyeLdamA", false);
                models[0].SetColorWriteOverride("m_pz_eyeLdamB", false);
                models[0].SetColorWriteOverride("m_pz_eyeRdamA", false);
                models[0].SetColorWriteOverride("m_pz_eyeRdamB", false);
                models[0].SetColorWriteOverride("m_pz_mayuLdamA", false);
                models[0].SetColorWriteOverride("m_pz_mayuLdamB", false);
                models[0].SetColorWriteOverride("m_pz_mayuRdamA", false);
                models[0].SetColorWriteOverride("m_pz_mayuRdamB", false);

                foreach (var material in models[0].MAT3Tag.MaterialList)
                {
                    if (material.BlendModeIndex.SourceFactor == GXBlendModeControl.DstAlpha && material.BlendModeIndex.DestinationFactor == GXBlendModeControl.InverseDstAlpha)
                    {
                        material.BlendModeIndex.SourceFactor      = GXBlendModeControl.SrcAlpha;
                        material.BlendModeIndex.DestinationFactor = GXBlendModeControl.InverseSrcAlpha;
                    }
                }
            }

            if (models.Count > 0 && (name == "Wizzrobe"))
            {
                foreach (var material in models[0].MAT3Tag.MaterialList)
                {
                    material.ZModeIndex.UpdateEnable = true;
                }
            }

            return(models);
        }
        public static List <J3D> LoadActorResource(string name)
        {
            List <J3D> models = new List <J3D>();

            if (!m_actorResources.ContainsKey(name))
            {
                return(null);
            }

            WActorResource res = m_actorResources[name];

            foreach (var model in res.Models)
            {
                string arc_and_file_path = Path.Combine(res.ArchiveName, model.Path);

                TSharedRef <J3D> existRef = null;//m_j3dList.Find(x => string.Compare(x.FilePath, arc_and_file_path, StringComparison.InvariantCultureIgnoreCase) == 0);
                if (existRef != null)
                {
                    existRef.ReferenceCount++;
                    models.Add(existRef.Asset);

                    continue;
                }

                J3D loaded_model = LoadModelFromResource(model, res.ArchiveName);

                if (loaded_model == null)
                {
                    continue;
                }

                loaded_model.SetHardwareLight(0, m_mainLight);
                loaded_model.SetHardwareLight(1, m_secondaryLight);
                loaded_model.SetTextureOverride("ZBtoonEX", "resources/textures/ZBtoonEX.png");
                loaded_model.SetTextureOverride("ZAtoon", "resources/textures/ZAtoon.png");

                existRef          = new TSharedRef <J3D>();
                existRef.FilePath = arc_and_file_path;
                existRef.Asset    = loaded_model;
                existRef.ReferenceCount++;

                m_j3dList.Add(existRef);
                loaded_model.Tick(1 / (float)60);

                models.Add(loaded_model);
            }

            if (models.Count > 0 && (name == "Link" || name == "Tetra" || name == "Zelda"))
            {
                models[0].SetColorWriteOverride("eyeLdamA", false);
                models[0].SetColorWriteOverride("eyeLdamB", false);
                models[0].SetColorWriteOverride("mayuLdamA", false);
                models[0].SetColorWriteOverride("mayuLdamB", false);
                models[0].SetColorWriteOverride("eyeRdamA", false);
                models[0].SetColorWriteOverride("eyeRdamB", false);
                models[0].SetColorWriteOverride("mayuRdamA", false);
                models[0].SetColorWriteOverride("mayuRdamB", false);
            }

            return(models);
        }