示例#1
0
        public bool Load()
        {
            if (!m_isValid)
            {
                Debug.LogError("Cannot load patch at path " + this.m_assetDir);
                return false;
            }

            // TODO: add error handling for failure to load the following files
            this.m_HIM = new HIM(this.m_assetDir.Parent.FullName + "/" + this.m_name + ".HIM");
            this.m_TIL = new TIL(this.m_assetDir.Parent.FullName + "/" + this.m_name + ".TIL");
            if (this.m_ZON == null)  // load ZON if it was never passed to the patch constructor
                this.m_ZON = new ZON(this.m_assetDir.Parent.FullName + "/" + this.m_assetDir.Parent.Name + ".ZON");
            this.m_IFO = new IFO(this.m_assetDir.Parent.FullName + "/" + this.m_name + ".IFO");

            //	parent x   :       	4	  3		2	  1	   0
            // original dir: .../3ddata/maps/junon/jpt01/30_30
            // desired dir: .../3ddata/junon/LIST_CNST_JPT.ZSC
            char[] trimChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '_' };

            // TODO: use stl's to avoid this mess and be able to load luna/eldeon/oro maps
            string zscPath = m_assetDir.Parent.Name.ToLower().Trim(trimChars);
            if(zscPath.Contains("jd") || zscPath.Contains("jdt") || zscPath.Contains("jg") )
                zscPath = Utils.FixPath(m_3dDataDir + "/" + m_assetDir.Parent.Parent.Name.ToUpper() + "/LIST_CNST_" + zscPath + ".ZSC");// + m_assetDir.Parent.Name.Trim(trimChars).ToUpper() + ".ZSC");
            else
                zscPath = Utils.FixPath(m_3dDataDir + "/" + m_assetDir.Parent.Parent.Name.ToUpper() + "/LIST_" + "CNST_JPT.ZSC");// + m_assetDir.Parent.Name.Trim(trimChars).ToUpper() + ".ZSC");

            string litPath = Utils.FixPath(this.m_assetDir.Parent.FullName + "\\" + this.m_name + "\\LIGHTMAP\\BUILDINGLIGHTMAPDATA.LIT");
            groundLight = Utils.FixPath(this.m_assetDir.Parent.FullName + "\\" + this.m_name + "\\" + this.m_name + "_PLANELIGHTINGMAP.DDS");
            m_ZSC_Cnst = new ZSC(zscPath);
            m_ZSC_Deco = new ZSC(zscPath.ToLower().Replace("cnst","deco"));
            m_LIT_Cnst = new LIT(litPath);
            m_LIT_Deco = new LIT(litPath.Replace("building","object"));
            // TODO: add any new file loads here

            edgeVertexLookup = new Dictionary<string, List<int>>();

            return true;
        }
示例#2
0
        private ResourceManager()
        {
            zsc_body_male = (ZSC)loadResource("3DDATA/AVATAR/LIST_MBODY.ZSC");
            zsc_arms_male = (ZSC)loadResource("3DData/Avatar/LIST_MARMS.zsc");
            zsc_foot_male = (ZSC)loadResource("3DData/Avatar/LIST_MFOOT.zsc");
            zsc_face_male = (ZSC)loadResource("3DData/Avatar/LIST_MFACE.zsc");
            zsc_hair_male = (ZSC)loadResource("3DData/Avatar/LIST_MHAIR.zsc");
            zsc_cap_male = (ZSC)loadResource("3DData/Avatar/LIST_MCAP.zsc");

            zsc_body_female = (ZSC)loadResource("3DData/Avatar/LIST_WBODY.zsc");
            zsc_arms_female = (ZSC)loadResource("3DData/Avatar/LIST_WARMS.zsc");
            zsc_foot_female = (ZSC)loadResource("3DData/Avatar/LIST_WFOOT.zsc");
            zsc_face_female = (ZSC)loadResource("3DData/Avatar/LIST_WFACE.zsc");
            zsc_hair_female = (ZSC)loadResource("3DData/Avatar/LIST_WHAIR.zsc");
            zsc_cap_female = (ZSC)loadResource("3DData/Avatar/LIST_WCAP.zsc");

            zsc_back = (ZSC)loadResource("3DData/Avatar/LIST_BACK.zsc");
            zsc_faceItem = (ZSC)loadResource("3DData/Avatar/LIST_FACEIEM.zsc");

            zsc_weapon = (ZSC)loadResource("3DDATA/WEAPON/LIST_WEAPON.zsc");
            zsc_subweapon = (ZSC)loadResource("3DDATA/WEAPON/LIST_SUBWPN.zsc");

            stb_animation_list = (STB)loadResource("3Ddata/STB/FILE_MOTION.STB");
            stb_animation_type = (STB)loadResource("3DDATA/STB/TYPE_MOTION.STB");

            stb_weapon_list = (STB)loadResource("3DDATA/STB/LIST_WEAPON.STB");
            stb_cap_list = (STB)loadResource("3DDATA/STB/LIST_CAP.STB");
            stb_hair_list = (STB)loadResource("3DDATA/STB/LIST_HAIR.STB");

            cache = new Cache(this, CACHE_SIZE);
        }
示例#3
0
    private Bounds LoadPart(BodyPartType bodyPart, ZSC.DummyType dummy, string zmsPath, string texPath)
    {
        zmsPath = Utils.FixPath(zmsPath);
        texPath = Utils.FixPath (texPath).Replace ("dds", "png");

        // Cached load of ZMS and texture
        ResourceManager rm = ResourceManager.Instance;
        ZMS zms = (ZMS)rm.cachedLoad(zmsPath);
        Texture2D tex = (Texture2D)rm.cachedLoad(texPath);

        // Create material
        string shader = "VertexLit";
        if (bodyPart == BodyPartType.BACK)
            shader = "Transparent/Cutout/VertexLit";

        Material mat = new Material(Shader.Find(shader));

        mat.SetTexture("_MainTex", tex);
        mat.SetColor("_Emission", new Color(0.15f, 0.15f, 0.15f));

        GameObject modelObject = new GameObject();

        switch ( bodyPart )
        {
            case BodyPartType.FACE:
            case BodyPartType.HAIR:
                modelObject.transform.parent = Utils.findChild(skeleton, "b1_head");
                break;
            case BodyPartType.CAP:  // TODO: figure out how to fix issue of hair coming out of cap
                modelObject.transform.parent = Utils.findChild(skeleton, "p_06");
                break;
            case BodyPartType.BACK:
                modelObject.transform.parent = Utils.findChild(skeleton, "p_03");
                break;
            case BodyPartType.WEAPON:
                if(charModel.weapon == WeaponType.DSW || charModel.weapon == WeaponType.KATAR )
                    modelObject.transform.parent = Utils.findChild(skeleton, dummy == ZSC.DummyType.RightHand? "p_00" : "p_01");
                else
                    modelObject.transform.parent = Utils.findChild(skeleton, "p_00");
                break;
            case BodyPartType.SUBWEAPON:
                modelObject.transform.parent = Utils.findChild(skeleton, "p_02");
                break;
            default:
                modelObject.transform.parent = skeleton.transform.parent.transform;
                break;
        }

        modelObject.transform.localPosition = Vector3.zero;
        modelObject.transform.localRotation = Quaternion.identity;
        modelObject.transform.localScale = Vector3.one;
        modelObject.name = bodyPart.ToString ();
        Mesh mesh = zms.getMesh();
        if (zms.support.bones)
        {
            SkinnedMeshRenderer renderer = modelObject.AddComponent<SkinnedMeshRenderer>();

            mesh.bindposes = bindPoses.bindPoses;
            renderer.sharedMesh = mesh;
            renderer.material = mat;
            renderer.bones = bindPoses.boneTransforms;
        }
        else
        {
            modelObject.AddComponent<MeshFilter>().mesh = mesh;
            MeshRenderer renderer = modelObject.AddComponent<MeshRenderer>();
            renderer.material = mat;
        }

        return mesh.bounds;
    }