Exemple #1
0
        private void parseScene()
        {
            // Create content file
            content = new Format4();
            lights  = new LightsConfig();
            if (options.tags.Length > 0)
            {
                tags = new TagsFormat();
                foreach (string tag in options.tags)
                {
                    tags.tags.Add(tag, new List <string>());
                }
                checkTags = true;
            }
            // Create base scene
            Scene3JS scene = new Scene3JS();

            scene.name   = SceneManager.GetActiveScene().name;
            scene.matrix = Utils.getMatrixAsArray(Matrix4x4.identity);
            // Checking if we have fog
            if (RenderSettings.fog)
            {
                Fog3JS fog = new Fog3JS();
                fog.color = Utils.getIntColor(RenderSettings.fogColor);
                switch (RenderSettings.fogMode)
                {
                case FogMode.Linear:
                    LinearFog3JS linearFog = new LinearFog3JS(fog);
                    linearFog.near = RenderSettings.fogStartDistance;
                    linearFog.far  = RenderSettings.fogEndDistance;
                    scene.fog      = linearFog;
                    break;

                case FogMode.Exponential:
                case FogMode.ExponentialSquared:
                    ExpFog3JS expFog = new ExpFog3JS(fog);
                    expFog.density = RenderSettings.fogDensity;
                    scene.fog      = expFog;
                    break;
                }
            }
            scene.children.Add(createAmbientLight());
            content.@object = scene;
            // Enumerate through all the objects
            GameObject[] rootObjects = SceneManager.GetActiveScene().GetRootGameObjects();
            foreach (GameObject gameObject in rootObjects)
            {
                Object3JS obj = parseGameObject(gameObject);
                if (obj != null)
                {
                    scene.children.Add(obj);
                }
            }
            updateProgressWithMessage("Writing JSON file");
        }
        /// <summary>Get new subtable in this format by 
        /// <c>EncodingTableEntry</c>.
        /// This method is virtual so that
        /// the corresponding validator class can override this and
        /// return an object of its subclass of the subtable.
        /// </summary>
        virtual public Subtable GetSubtable(EncodingTableEntry ete)
        {
            Subtable st = null;

            // identify the format of the table
            ushort format = 0xffff;
            
            try
            {
                format = m_bufTable.GetUshort(ete.offset);
            }
            catch
            {
            }

            switch(format)
            {
                case 0:  st = new Format0 (ete, m_bufTable); break;
                case 2:  st = new Format2 (ete, m_bufTable); break;
                case 4:  st = new Format4 (ete, m_bufTable); break;
                case 6:  st = new Format6 (ete, m_bufTable); break;
                case 8:  st = new Format8 (ete, m_bufTable); break;
                case 10: st = new Format10(ete, m_bufTable); break;
                case 12: st = new Format12(ete, m_bufTable); break;
                case 14: st = new Format14(ete, m_bufTable); break;
            }

            return st;
        }
Exemple #3
0
        public void Read(TTFReader r, uint tableStart)
        {
            r.ReadInt(out this.version);
            r.ReadInt(out this.numTables);

            this.encodingRecords = new List <EncodingRecord>();
            for (int i = 0; i < this.numTables; ++i)
            {
                EncodingRecord er = new EncodingRecord();
                er.Read(r);
                this.encodingRecords.Add(er);
            }

            foreach (EncodingRecord rc in this.encodingRecords)
            {
                r.SetPosition(tableStart + rc.subtableOffset);

                ushort format = r.ReadUInt16();

                if (format == 0)
                {
                    if (this.format0 == null)
                    {
                        this.format0 = new List <Format0>();
                    }

                    Format0 f0 = new Format0();
                    f0.Read(r);
                    this.format0.Add(f0);
                }
                else if (format == 2)
                {
                    if (this.format2 == null)
                    {
                        this.format2 = new List <Format2>();
                    }

                    Format2 f2 = new Format2();
                    f2.Read(r);
                    this.format2.Add(f2);
                }
                else if (format == 4)
                {
                    if (this.format4 == null)
                    {
                        this.format4 = new List <Format4>();
                    }

                    Format4 f4 = new Format4();
                    f4.Read(r);
                    this.format4.Add(f4);
                }
                else if (format == 6)
                {
                    if (this.format6 == null)
                    {
                        this.format6 = new List <Format6>();
                    }

                    Format6 f6 = new Format6();
                    f6.Read(r);
                    this.format6.Add(f6);
                }
                else if (format == 8)
                {
                    if (this.format8 == null)
                    {
                        this.format8 = new List <Format8>();
                    }

                    Format8 f8 = new Format8();
                    f8.Read(r);
                    this.format8.Add(f8);
                }
                else if (format == 10)
                {
                    if (this.format10 == null)
                    {
                        this.format10 = new List <Format10>();
                    }

                    Format10 f10 = new Format10();
                    f10.Read(r);
                    this.format10.Add(f10);
                }
                else if (format == 12)
                {
                    if (this.format12 == null)
                    {
                        this.format12 = new List <Format12>();
                    }

                    Format12 f12 = new Format12();
                    f12.Read(r);
                    this.format12.Add(f12);
                }
                else if (format == 13)
                {
                    if (this.format13 == null)
                    {
                        this.format13 = new List <Format13>();
                    }

                    Format13 f13 = new Format13();
                    f13.Read(r);
                    this.format13.Add(f13);
                }
                else if (format == 14)
                {
                    if (this.format14 == null)
                    {
                        this.format14 = new List <Format14>();
                    }

                    Format14 f14 = new Format14();
                    f14.Read(r);
                    this.format14.Add(f14);
                }
            }
        }