public void MakeLightWaveScene()
        {
            Reset();

            LWScene scene = LWSceneParser.Load("res/Scenes/boxi3.lws");

            Debug.WriteLine(scene.Objects.Count + " objects");
            Debug.WriteLine(scene.Lights.Count + " lights");
            Debug.WriteLine(scene.Cameras.Count + " cameras");

            Material wood         = materialManager["wood"];
            var      loadedModels = new Dictionary <string, RenderStack.LightWave.LWModel>();

            foreach (var @object in scene.Objects)
            {
                try
                {
                    string  name    = "res/Objects/" + @object.Name.Split('/').Last();
                    LWModel lwModel = null;
                    if (loadedModels.ContainsKey(name))
                    {
                        lwModel = loadedModels[name];
                    }
                    else
                    {
                        loadedModels[name] = lwModel = RenderStack.LightWave.LWModelParser.Load(name);
                    }

                    foreach (var layer in lwModel.Layers.Values)
                    {
                        var mesh  = new GeometryMesh(layer.Geometry, NormalStyle.CornerNormals);
                        var model = new Model(layer.Name, mesh, wood, Motion(@object, 0.0f));
                        AddModel(model);
                    }

                    Debug.WriteLine("\tObject '" + @object.Name + "' " + @object.Bones.Count + " bones @ ");
                }
                catch (System.Exception)
                {
                }
            }
            foreach (var item in scene.Cameras)
            {
                Debug.WriteLine("\tCamera '" + item.Name + "'");
            }
            foreach (var item in scene.Lights)
            {
                Debug.WriteLine("\tLight '" + item.Name + "'");
            }

            AddCameras();
            camera.Frame.LocalToParent.Set(
                Motion(scene.Cameras.First(), 0.0f)
                );
            AddCameraUserControls();
        }
Esempio n. 2
0
        public void InserOrUpdateDetail_LW(XmlNode receiveXml, string swbh, string swlx, IDbTransaction tran)
        {
            string   json    = Newtonsoft.Json.JsonConvert.SerializeXmlNode(receiveXml);
            LWModel  lwModel = JsonConvert.DeserializeObject <LWModel>(json);
            B_OA_ILW lw      = lwModel.JBXX;

            lw.YWBH = swbh;
            lw.Condition.Add("YWBH =" + lw.YWBH);
            if (Utility.Database.QueryObject(lw, tran) == null)
            {
                Utility.Database.Insert(lw, tran);
                _logger.InfoFormat("成功插入收文数据!");
            }
            else
            {
                // lw.Condition.Add("YWBH =" + lw.YWBH);
                Utility.Database.Update(lw, tran);
                _logger.InfoFormat("成功修改收文数据!");
            }
        }