Exemplo n.º 1
0
    public Carro(string path,Interior interior)
    {
        car=load3ds(path);
        car.ComputeNormals();
        colores=new color_typeF[]{new color_typeF(0.5f,1.0f,0f),new color_typeF(1f,1f,0.4f),new color_typeF(1f,0.5f,1f),new color_typeF(0.5f,0.5f,1f),new color_typeF(0.7f,0f,0f)};
        InitMyMaterial();
        inter=interior;
        actList=new ArrayList();

        //	this.actList.Add("capo");
        //	this.actList.Add("maletero");

        this.Recompile();
    }
Exemplo n.º 2
0
    public Carro(string path, Interior interior)
    {
        car = load3ds(path);
        car.ComputeNormals();
        colores = new color_typeF[] { new color_typeF(0.5f, 1.0f, 0f), new color_typeF(1f, 1f, 0.4f), new color_typeF(1f, 0.5f, 1f), new color_typeF(0.5f, 0.5f, 1f), new color_typeF(0.7f, 0f, 0f) };
        InitMyMaterial();
        inter   = interior;
        actList = new ArrayList();

        //	this.actList.Add("capo");
        //	this.actList.Add("maletero");


        this.Recompile();
    }
Exemplo n.º 3
0
    private _3dsLoader load3ds(string path)
    {
        XmlTextReader doc  = new XmlTextReader(Application.StartupPath + "\\" + "Models\\" + "models.xml");
        string        id   = "";
        _3dsLoader    temp = null;
        string        name = "";

        int[]   rot     = null;
        float[] trans   = null;
        float[] scl     = null;
        bool    notdone = true;

        while (doc.Read() && notdone)
        {
            switch (doc.NodeType)
            {
            case XmlNodeType.Element:
                switch (doc.Name)
                {
                case "model":
                    if (doc.GetAttribute("id") != path)
                    {
                        doc.Skip();
                    }
                    else
                    {
                        id = doc.GetAttribute("id");
                    }
                    break;

                case "name":
                    name = (string)(doc.GetAttribute("id"));
                    break;

                case "rot":
                    rot    = new int[3];
                    rot[0] = Int32.Parse(doc.GetAttribute("x"));
                    rot[1] = Int32.Parse(doc.GetAttribute("y"));
                    rot[2] = Int32.Parse(doc.GetAttribute("z"));
                    break;

                case "trans":
                    trans    = new float[3];
                    trans[0] = Single.Parse(doc.GetAttribute("x"));
                    trans[1] = Single.Parse(doc.GetAttribute("y"));
                    trans[2] = Single.Parse(doc.GetAttribute("z"));
                    break;

                case "scl":
                    scl    = new float[3];
                    scl[0] = Single.Parse(doc.GetAttribute("x"));
                    scl[1] = Single.Parse(doc.GetAttribute("y"));
                    scl[2] = Single.Parse(doc.GetAttribute("z"));
                    break;
                }
                break;

            case XmlNodeType.EndElement:
                switch (doc.Name)
                {
                case "model":
                    temp   = new _3dsLoader(id, name, rot, trans, scl);
                    center = new Point3D(trans[0], trans[1], trans[2]);
                    temp.Load3DS(Application.StartupPath + "\\" + "Models\\" + temp.ID);
                    notdone = false;
                    return(temp);
                }
                break;
            }
        }
        return(null);
    }
Exemplo n.º 4
0
    private _3dsLoader load3ds(string path)
    {
        XmlTextReader doc = new XmlTextReader(Application.StartupPath + "\\" + "Models\\" + "models.xml");
        string id = "";
        _3dsLoader temp = null;
        string name = "";
        int[] rot = null;
        float[] trans = null;
        float[] scl = null;
        bool notdone=true;
        while (doc.Read() && notdone)
        {
            switch (doc.NodeType)
            {
                case XmlNodeType.Element:
                switch (doc.Name)
                {
                    case "model":
                        if(doc.GetAttribute("id")!=path)
                            doc.Skip();
                        else
                            id = doc.GetAttribute("id");
                        break;

                    case "name":
                        name = (string)(doc.GetAttribute("id"));
                        break;
                    case "rot":
                        rot = new int[3];
                        rot[0] = Int32.Parse(doc.GetAttribute("x"));
                        rot[1] = Int32.Parse(doc.GetAttribute("y"));
                        rot[2] = Int32.Parse(doc.GetAttribute("z"));
                        break;
                    case "trans":
                        trans = new float[3];
                        trans[0] = Single.Parse(doc.GetAttribute("x"));
                        trans[1] = Single.Parse(doc.GetAttribute("y"));
                        trans[2] = Single.Parse(doc.GetAttribute("z"));
                        break;
                    case "scl":
                        scl = new float[3];
                        scl[0] = Single.Parse(doc.GetAttribute("x"));
                        scl[1] = Single.Parse(doc.GetAttribute("y"));
                        scl[2] = Single.Parse(doc.GetAttribute("z"));
                        break;
                }
                    break;

                case XmlNodeType.EndElement:
                switch (doc.Name)
                {
                    case "model":
                        temp = new _3dsLoader(id, name, rot, trans, scl);
                        center=new Point3D(trans[0],trans[1],trans[2]);
                        temp.Load3DS(Application.StartupPath + "\\" + "Models\\" + temp.ID);
                        notdone=false;
                        return temp;

                }
                    break;
            }

        }
        return null;
    }
Exemplo n.º 5
0
 public Sofa()
 {
     sof=this.load3ds("sofa.3ds");
     sof.ComputeNormals();
     this.Recompile();
 }
Exemplo n.º 6
0
 public Mata()
 {
     mat = this.load3ds("a3dplnt2.3ds");
     mat.ComputeNormals();
     this.Recompile();
 }
 public Sofa()
 {
     sof = this.load3ds("sofa.3ds");
     sof.ComputeNormals();
     this.Recompile();
 }
Exemplo n.º 8
0
 public Mata()
 {
     mat=this.load3ds("a3dplnt2.3ds");
     mat.ComputeNormals();
     this.Recompile();
 }