Ejemplo n.º 1
0
        private bool read_model_modifiers(string directory_path)
        {
            //if(null!=m_modifiers)
            //    return true;
            SceneModifiers tricks_store = new SceneModifiers();

            if (!read_data_to(directory_path, "bin/tricks.bin", tricks_store, tricks_i0_requiredCrc))
            {
                return(false);
            }
            m_modifiers = tricks_store;
            m_modifiers.trickLoadPostProcess();
            return(true);
        }
Ejemplo n.º 2
0
        ///
        /// \brief Will split the \arg texpath into directories, and finds the closest TextureModifiers
        /// that matches a directory
        /// \param texpath contains a full path to the texture
        /// \return texture modifier object, if any
        ///
        static TextureModifiers_Data modFromTextureName(string texpath)
        {
            RuntimeData   rd    = RuntimeData.get();
            List <string> split = texpath.Split('/').ToList();

            while (split.Count != 0)
            {
                if (split[0] == "texture_library")
                {
                    split.RemoveAt(0);
                    break;
                }

                split.RemoveAt(0);
            }

            SceneModifiers mods    = rd.m_modifiers;
            var            texmods = mods.m_texture_path_to_mod;

            // scan from the back of the texture path, until a modifier is found.
            if (texpath.Contains("shape"))
            {
                Debug.LogFormat("Mod for {0} -{1}", texpath, string.Join(",", split));
            }
            while (split.Count != 0)
            {
                TextureModifiers_Data texmod_val;
                if (texmods.TryGetValue(split[split.Count - 1].ToLower(), out texmod_val))
                {
                    return(texmod_val);
                }

                split.RemoveAt(split.Count - 1);
            }

            return(null);
        }
Ejemplo n.º 3
0
        bool read_data_to(string directory_path, string storage, SceneModifiers target, uint CRC)
        {
            BinStore bin_store = new BinStore();

            if (!bin_store.open(directory_path + storage, CRC))
            {
                Debug.Log("failure");
                Debug.LogWarning("Couldn't load " + storage + " from " + directory_path);
                Debug.LogWarning("Using piggtool, ensure that bin.pigg has been extracted to ./data/");
                return(false);
            }

            bool res = target.loadFrom(bin_store);

            bin_store.close();

            if (!res)
            {
                Debug.Log("Reading " + directory_path + " " + storage + " ... failure");
                Debug.LogWarning("Couldn't load " + directory_path + " " + storage + ": wrong file format?");
            }

            return(res);
        }