Esempio n. 1
0
        public bool OnImport(string filename)
        {
            try
            {
                Model.LoadModel(Data.Buffer, Node.FileIndex);
                Model model = new Model(Node.FileIndex);
                model.Light(64, 768, -50, -10, -50, true);
                model_viewer.SelectedModel = model;
            }
            catch (Exception)
            {
                return false;
            }

            return true;
        }
Esempio n. 2
0
        public void PluginSelected()
        {
            if (!initialized)
            {
                initialized = true;
                Rasterizer.LoadTextures(Cache);
                Rasterizer.ApplyBrightness(0.59999999999999998D);
                Rasterizer.ResetTextures();
            }

            model_viewer.UpdateBuffer();

            try
            {
                Model.LoadModel(Data.Buffer, Node.FileIndex);
                Model model = new Model(Node.FileIndex);
                model.Light(64, 768, -50, -10, -50, true);
                model_viewer.SelectedModel = model;
            }
            catch (Exception)
            {
                model_viewer.SelectedModel = null;
            }
        }
Esempio n. 3
0
        /*public ObjectDefinition method580()
        {
            int i = -1;
            if (anInt774 != -1)
            {
                VarBit varBit = VarBit.cache[anInt774];
                int j = varBit.anInt648;
                int k = varBit.anInt649;
                int l = varBit.anInt650;
                int i1 = client.anIntArray1232[l - k];
                i = clientInstance.variousSettings[j] >> k & i1;
            }
            else
                if (anInt749 != -1)
                    i = clientInstance.variousSettings[anInt749];
            if (i < 0 || i >= childrenIDs.Length || childrenIDs[i] == -1)
                return null;
            else
                return forID(childrenIDs[i]);
        }*/
        private Model method581(int object_type, int k, int l)
        {
            Model model = null;
            long l1;
            if (anIntArray776 == null)
            {
                if (object_type != 10)
                    return null;
                l1 = (long)((ID << 6) + l) + ((long)(k + 1) << 32);
                if (ModelIndexes == null)
                    return null;
                bool flag1 = MirrorAlongX ^ (l > 3);
                int k1 = ModelIndexes.Length;
                for (int i2 = 0; i2 < k1; i2++)
                {
                    int l2 = ModelIndexes[i2];
                    if (flag1)
                        l2 += 0x10000;
                    model = null;// (Model)mruNodes1.insertFromCache(l2);
                    if (model == null)
                    {
                        model = Model.LoadModel(LoadedCache, l2 & 0xffff);
                        if (model == null)
                            return null;
                        if (flag1)
                            model.method477();
                        //mruNodes1.removeFromCache(model, l2);
                    }
                    if (k1 > 1)
                        aModelArray741s[i2] = model;
                }

                if (k1 > 1)
                    model = new Model(k1, aModelArray741s);
            }
            else
            {
                int i1 = -1;
                for (int j1 = 0; j1 < anIntArray776.Length; j1++)
                {
                    if (anIntArray776[j1] != object_type)
                        continue;
                    i1 = j1;
                    break;
                }

                if (i1 == -1)
                    return null;
                l1 = (long)((ID << 6) + (i1 << 3) + l) + ((long)(k + 1) << 32);
                Model model_2 = null;// (Model)mruNodes2.insertFromCache(l1);
                if (model_2 != null)
                    return model_2;
                int j2 = ModelIndexes[i1];
                bool flag3 = MirrorAlongX ^ (l > 3);
                if (flag3)
                    j2 += 0x10000;
                model = null;// (Model)mruNodes1.insertFromCache(j2);
                if (model == null)
                {
                    model = Model.LoadModel(LoadedCache, j2 & 0xffff);
                    if (model == null)
                        return null;
                    if (flag3)
                        model.method477();
                    //mruNodes1.removeFromCache(model, j2);
                }
            }
            bool flag;
            flag = ScaleX != 128 || ScaleY != 128 || ScaleZ != 128;
            bool flag2;
            flag2 = TranslationX != 0 || TranslationY != 0 || TranslationZ != 0;
            Model model_3 = new Model(ModelRecolorIndexes == null, k == -1, l == 0 && k == -1 && !flag && !flag2, model);
            if (k != -1)
            {
                model_3.method469();
                model_3.method470(k);
                model_3.anIntArrayArray1658 = null;
                model_3.anIntArrayArray1657 = null;
            }
            while (l-- > 0)
                model_3.method473();
            if (ModelRecolorIndexes != null)
            {
                for (int k2 = 0; k2 < ModelRecolorIndexes.Length; k2++)
                    model_3.SetColor(ModelRecolorIndexes[k2], ModelRecolorColors[k2]);

            }
            if (flag)
                model_3.Scale(ScaleX, ScaleZ, ScaleY);
            if (flag2)
                model_3.Translate(TranslationX, TranslationY, TranslationZ);
            model_3.Light(64 + LightIntensity, 768 + LightDistance * 5, -50, -10, -50, !FlatShading);
            if (anInt760 == 1)
                model_3.anInt1654 = model_3.modelHeight;
            //mruNodes2.removeFromCache(model_3, l1);
            return model_3;
        }