示例#1
0
        private bool SectionObject(string[] tokens)
        {
            switch (tokens[0].ToLower())
            {
            case "visible":     current.visible = int.Parse(tokens[1]);  return(true);

            case "locking":     current.locking = int.Parse(tokens[1]);  return(true);

            case "shading":     current.shading = int.Parse(tokens[1]);  return(true);

            case "facet":       current.facet = float.Parse(tokens[1]);  return(true);

            case "color":       current.color = Color3.Parse(tokens, 1);  return(true);

            case "color_type":  current.color_type = int.Parse(tokens[1]);  return(true);

            case "vertex":      ParseVertex(tokens);                            return(true);

            case "face":        ParseFace(tokens);                              return(true);

            case "}":                                                           return(false);

            //default:            Error(tokens);                                  return false;
            default:                                                            return(true);
            }
        }
示例#2
0
        private bool SectionScene(string[] tokens)
        {
            scene = new MqoScene();

            switch (tokens[0].ToLower())
            {
            case "pos":         scene.pos = Point3.Parse(tokens, 1);  return(true);

            case "lookat":      scene.lookat = Point3.Parse(tokens, 1);  return(true);

            case "head":        scene.head = float.Parse(tokens[1]);  return(true);

            case "pich":        scene.pich = float.Parse(tokens[1]);  return(true);

            case "ortho":       scene.ortho = float.Parse(tokens[1]);  return(true);

            case "zoom2":       scene.zoom2 = float.Parse(tokens[1]);  return(true);

            case "amb":         scene.amb = Color3.Parse(tokens, 1);  return(true);

            case "}":                                                           return(false);

            //default:            Error(tokens);                                  return false;
            default:                                                            return(true);
            }
        }
示例#3
0
        bool SectionMaterial(string[] tokens)
        {
            if (tokens[0] == "}")
            {
                return(false);
            }

            StringBuilder sb = new StringBuilder();

            foreach (string i in tokens)
            {
                sb.Append(' ').Append(i);
            }

            string      line = sb.ToString().Trim();
            MqoMaterial m    = new MqoMaterial(tokens[0].Trim('"'));

            tokens = SplitString(line);
            mqo.materials.Add(m);

            for (int i = 1; i < tokens.Length; ++i)
            {
                string t = tokens[i];

                if (t.StartsWith("shader("))
                {
                    m.shader = int.Parse(SplitParam(t)[1]);
                }
                else if (t.StartsWith("col("))
                {
                    m.col = Color3.Parse(SplitParam(t), 1);
                }
                else if (t.StartsWith("dif("))
                {
                    m.dif = float.Parse(SplitParam(t)[1]);
                }
                else if (t.StartsWith("amb("))
                {
                    m.amb = float.Parse(SplitParam(t)[1]);
                }
                else if (t.StartsWith("emi("))
                {
                    m.emi = float.Parse(SplitParam(t)[1]);
                }
                else if (t.StartsWith("spc("))
                {
                    m.spc = float.Parse(SplitParam(t)[1]);
                }
                else if (t.StartsWith("power("))
                {
                    m.power = float.Parse(SplitParam(t)[1]);
                }
                else if (t.StartsWith("tex("))
                {
                    m.tex = t.Substring(3).Trim('(', ')', '"');
                }
            }
            return(true);
        }
示例#4
0
        bool SectionObject(string[] tokens)
        {
            switch (tokens[0])
            {
            case "uid": obj.id = int.Parse(tokens[1]); break;

            case "visible": obj.visible = int.Parse(tokens[1]); break;

            case "locking": obj.locking = int.Parse(tokens[1]); break;

            case "shading": obj.shading = int.Parse(tokens[1]); break;

            case "facet": obj.facet = float.Parse(tokens[1]); break;

            case "color": obj.color = Color3.Parse(tokens, 1); break;

            case "color_type": obj.color_type = int.Parse(tokens[1]); break;

            case "vertex":
            {
                if (tokens[2] != "{")
                {
                    Error(tokens);
                }

                obj.vertices = new List <UVertex>(int.Parse(tokens[1]));
                DoRead(SectionVertex);
            }
            break;

            case "vertexattr":
            {
                if (tokens[1] != "{")
                {
                    Error(tokens);
                }

                DoRead(SectionVertexAttr);
            }
            break;

            case "face":
            {
                if (tokens[2] != "{")
                {
                    Error(tokens);
                }

                obj.faces = new List <MqoFace>(int.Parse(tokens[1]));
                DoRead(SectionFace);
            }
            break;

            case "}":
                return(false);
            }
            return(true);
        }
示例#5
0
        bool SectionScene(string[] tokens)
        {
            MqoScene scene = new MqoScene();

            mqo.scene = scene;

            switch (tokens[0])
            {
            case "pos": scene.pos = Point3.Parse(tokens, 1); break;

            case "lookat": scene.lookat = Point3.Parse(tokens, 1); break;

            case "head": scene.head = float.Parse(tokens[1]); break;

            case "pich": scene.pich = float.Parse(tokens[1]); break;

            case "ortho": scene.ortho = float.Parse(tokens[1]); break;

            case "zoom2": scene.zoom2 = float.Parse(tokens[1]); break;

            case "amb": scene.amb = Color3.Parse(tokens, 1); break;

            case "dirlights":
            {
                // dirlights 1 {
                // ...
                // }
                if (tokens[2] != "{")
                {
                    Error(tokens);
                }

                DoRead(SectionDirlights);
            }
            break;

            case "}":
                return(false);
            }
            return(true);
        }