示例#1
0
        public static SurfaceComponent CreateFromLDD(MeshCulling culling, ModelMesh mainModel)
        {
            SurfaceComponent modelComponent = null;

            switch (culling.Type)
            {
            case MeshCullingType.MainModel:
                modelComponent = new PartModel();
                break;

            case MeshCullingType.MaleStud:
                modelComponent = new MaleStudModel();
                break;

            case MeshCullingType.FemaleStud:
                modelComponent = new FemaleStudModel();
                break;

            case MeshCullingType.BrickTube:
                modelComponent = new BrickTubeModel();
                break;
            }

            if (modelComponent != null)
            {
                modelComponent.LoadCullingInformation(culling);
                modelComponent.Meshes.Add(new ModelMeshReference(mainModel, culling));
            }

            return(modelComponent);
        }
示例#2
0
        public static SurfaceComponent FromXml(XElement element)
        {
            SurfaceComponent component = null;
            var componentType          = element.ReadAttribute <ModelComponentType>("Type");

            switch (componentType)
            {
            case ModelComponentType.Part:
                component = new PartModel();
                break;

            case ModelComponentType.MaleStud:
                component = new MaleStudModel();
                break;

            case ModelComponentType.FemaleStud:
                component = new FemaleStudModel();
                break;

            case ModelComponentType.BrickTube:
                component = new BrickTubeModel();
                break;
            }

            if (component != null)
            {
                component.LoadFromXml(element);
            }

            return(component);
        }