public void DisplayPose() { if (TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer == null) { TDCGExplorer.TDCGExplorer.MainFormWindow.makeTSOViwer(); } fDisplayed = true; TDCG.Viewer viewer = TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer; if (posedata.scene == false) { if (TDCGExplorer.TDCGExplorer.SystemDB.forcereloadsavedata == true) { viewer.FigureList.Clear(); viewer.AddFigureFromPNGFile("default.tdcgsav.png", false); } else { if (viewer.FigureList.Count == 1 && viewer.FigureList[0].TSOList.Count > 1) { // なにもしない. } else { viewer.FigureList.Clear(); viewer.AddFigureFromPNGFile("default.tdcgsav.png", false); } } //TDCGExplorer.TDCGExplorer.FigureLoad = true; using (MemoryStream tmo = new MemoryStream(posedata.figures[0].tmo.data)) { // あらかじめFigureは全部消去する. viewer.LoadTMOFile(tmo); viewer.BackColor = Color.LightPink; } } else { // 全部ロードする. streamdata.Seek(0, SeekOrigin.Begin); viewer.AddFigureFromPNGFile(streamdata, false); //TDCGExplorer.TDCGExplorer.FigureLoad = false; viewer.BackColor = Color.Yellow; } List <float> camera = posedata.GetCamera(); Vector3 eye = new Vector3(camera[0], camera[1], camera[2]); Vector3 ypr = new Vector3(-camera[5], -camera[4], -camera[6]); Matrix m = Matrix.RotationYawPitchRoll(ypr.Y, ypr.X, ypr.Z) * Matrix.Translation(eye.X, eye.Y, eye.Z); viewer.Camera.Reset(); viewer.Camera.Translation = new Vector3(-m.M41, -m.M42, -m.M43); viewer.Camera.Angle = ypr; TDCGExplorer.TDCGExplorer.MainFormWindow.setNeedCameraReset(); }
public override void BindingStream(MemoryStream ms) { // データの複製を作る. streamdata = new MemoryStream(); ZipFileUtil.CopyStream(ms, streamdata); ms.Seek(0, SeekOrigin.Begin); Bitmap savefilebitmap = new Bitmap(ms); posestream = new PNGPOSEStream(); ms.Seek(0, SeekOrigin.Begin); posedata = posestream.LoadStream(ms); #if false TDCGExplorer.TDCGExplorer.MainFormWindow.PictureBox.Image = savefilebitmap; TDCGExplorer.TDCGExplorer.MainFormWindow.PictureBox.Width = savefilebitmap.Width; TDCGExplorer.TDCGExplorer.MainFormWindow.PictureBox.Height = savefilebitmap.Height; #else TDCGExplorer.TDCGExplorer.MainFormWindow.SetBitmap(savefilebitmap); #endif #if false TDCG.Viewer viewer = TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer; if (posedata.scene == false) { // キャラが無い時はデフォ子 if (TDCGExplorer.TDCGExplorer.FigureLoad == false) { viewer.AddFigureFromPNGFile("default.tdcgsav.png", false); TDCGExplorer.TDCGExplorer.FigureLoad = true; } using (MemoryStream tmo = new MemoryStream(posedata.figures[0].tmo.data)) { viewer.LoadTMOFile(tmo); } } else { // 全部ロードする. ms.Seek(0, SeekOrigin.Begin); viewer.AddFigureFromPNGStream(ms, false); TDCGExplorer.TDCGExplorer.FigureLoad = false; } List <float> camera = posedata.GetCamera(); Vector3 eye = new Vector3(camera[0], camera[1], camera[2]); Vector3 ypr = new Vector3(camera[5], camera[4], camera[6]); Matrix m = Matrix.RotationYawPitchRoll(ypr.Y, ypr.X, ypr.Z) * Matrix.Translation(eye.X, eye.Y, eye.Z); viewer.Camera.Reset(); viewer.Camera.Translation = new Vector3(-m.M41, -m.M42, m.M43); viewer.Camera.Angle = ypr; TDCGExplorer.TDCGExplorer.MainFormWindow.setNeedCameraReset(); #endif // データ階層ツリーを構築する. MakeTreeView(); }
public void DisplayTso() { if (fDisplayed) { return; } fDisplayed = true; // ヘビーセーブとして読み込んでみる. pngstream = new PNGHSAVStream(); savedata.Seek(0, SeekOrigin.Begin); pngstream.LoadPNGFile(savedata); // ヘビーセーブか? if (pngstream.count > 0) { // ヘビーセーブデータをロードする. foreach (PNGTsoData tso in pngstream.get) { tsoDataList.Add(tso); } } else { // tsoロード情報があるならこの時点で組み立てる. if (loadtsoinfo.Count != 0) { assembleTsoData(); } } TDCGExplorer.TDCGExplorer.SetToolTips(TextResource.RenderingNow); try { // TSOビューワをリセットする TDCGExplorer.TDCGExplorer.MainFormWindow.makeTSOViwer(); TDCGExplorer.TDCGExplorer.MainFormWindow.clearTSOViewer(); TDCG.Viewer viewer = TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer; bool firstTmoSet = true; foreach (PNGTsoData tso in tsoDataList) { using (MemoryStream stream = new MemoryStream(tso.tsodata)) { viewer.LoadTSOFile(stream); TDCGExplorer.TDCGExplorer.MainFormWindow.doInitialTmoLoad(); if (firstTmoSet) { // スライダーパラメータを設定する. TDCG.Figure figure = viewer.FigureList[0]; figure.slide_matrices.BustRatio = savefile.GetSlider(0); figure.slide_matrices.TallRatio = savefile.GetSlider(1); figure.slide_matrices.ArmRatio = savefile.GetSlider(2); figure.slide_matrices.LegRatio = savefile.GetSlider(3); figure.slide_matrices.WaistRatio = savefile.GetSlider(4); figure.slide_matrices.EyeRatio = savefile.GetSlider(5); figure.UpdateBoneMatrices(true); firstTmoSet = false; } viewer.FrameMove(); viewer.Render(); TDCGExplorer.TDCGExplorer.IncBusy(); Application.DoEvents(); TDCGExplorer.TDCGExplorer.DecBusy(); } } } catch (Exception) { } TDCGExplorer.TDCGExplorer.SetToolTips(TextResource.RenderingComplete); }