mirror of
https://github.com/storytold/LiveScan3D.git
synced 2026-10-09 00:09:58 +00:00
Added LiveScanPlayer, as well as some bug fixes and improvements.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace LiveScanPlayer
|
||||
{
|
||||
class FrameFileReader
|
||||
{
|
||||
BinaryReader binaryReader;
|
||||
int currentFrameIdx = 0;
|
||||
string filename;
|
||||
|
||||
public FrameFileReader(string filename)
|
||||
{
|
||||
this.filename = filename;
|
||||
binaryReader = new BinaryReader(File.Open(this.filename, FileMode.Open));
|
||||
}
|
||||
|
||||
~FrameFileReader()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public int frameIdx
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentFrameIdx;
|
||||
}
|
||||
set
|
||||
{
|
||||
JumpToFrame(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
binaryReader.Dispose();
|
||||
}
|
||||
|
||||
public void ReadFrame(List<float> vertices, List<byte> colors)
|
||||
{
|
||||
if (binaryReader.BaseStream.Position == binaryReader.BaseStream.Length)
|
||||
Rewind();
|
||||
|
||||
string[] lineParts = ReadLine().Split(' ');
|
||||
int nPoints = Int32.Parse(lineParts[1]);
|
||||
lineParts = ReadLine().Split(' ');
|
||||
int frameTimestamp = Int32.Parse(lineParts[1]);
|
||||
|
||||
Console.WriteLine((frameTimestamp / 1000).ToString());
|
||||
|
||||
short[] tempVertices = new short[3 * nPoints];
|
||||
byte[] tempColors = new byte[4 * nPoints];
|
||||
|
||||
int bytesPerVertexPoint = 3 * sizeof(short);
|
||||
int bytesPerColorPoint = 4 * sizeof(byte);
|
||||
int bytesPerPoint = bytesPerVertexPoint + bytesPerColorPoint;
|
||||
|
||||
byte[] frameData = binaryReader.ReadBytes(bytesPerPoint * nPoints);
|
||||
|
||||
if (frameData.Length < bytesPerPoint * nPoints)
|
||||
{
|
||||
Rewind();
|
||||
ReadFrame(vertices, colors);
|
||||
return;
|
||||
}
|
||||
|
||||
int vertexDataSize = nPoints * bytesPerVertexPoint;
|
||||
int colorDataSize = nPoints * bytesPerColorPoint;
|
||||
Buffer.BlockCopy(frameData, 0, tempVertices, 0, vertexDataSize);
|
||||
Buffer.BlockCopy(frameData, vertexDataSize, tempColors, 0, colorDataSize);
|
||||
|
||||
for (int i = 0; i < nPoints; i++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
vertices.Add(tempVertices[3 * i + j] / 1000.0f);
|
||||
colors.Add(tempColors[4 * i + j]);
|
||||
}
|
||||
}
|
||||
|
||||
binaryReader.ReadByte();
|
||||
|
||||
currentFrameIdx++;
|
||||
}
|
||||
|
||||
public void JumpToFrame(int frameIdx)
|
||||
{
|
||||
Rewind();
|
||||
for (int i = 0; i < frameIdx; i++)
|
||||
{
|
||||
List<float> vertices = new List<float>();
|
||||
List<byte> colors = new List<byte>();
|
||||
ReadFrame(vertices, colors);
|
||||
}
|
||||
}
|
||||
|
||||
public string ReadLine()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
byte buffer = binaryReader.ReadByte();
|
||||
|
||||
while (buffer != '\n')
|
||||
{
|
||||
builder.Append((char)buffer);
|
||||
buffer = binaryReader.ReadByte();
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
public void Rewind()
|
||||
{
|
||||
currentFrameIdx = 0;
|
||||
binaryReader.BaseStream.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E52AB19C-F67D-4932-90BD-CC549C1FEC8B}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LiveScanPlayer</RootNamespace>
|
||||
<AssemblyName>LiveScanPlayer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\bin\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PlayerWindowForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PlayerWindowForm.Designer.cs">
|
||||
<DependentUpon>PlayerWindowForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FrameFileReader.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="PlayerWindowForm.resx">
|
||||
<DependentUpon>PlayerWindowForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LiveScanServer\LiveScanServer.csproj">
|
||||
<Project>{78422b2c-0ef1-4a28-a40e-2a7c4a9204b1}</Project>
|
||||
<Name>LiveScanServer</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
namespace LiveScanPlayer
|
||||
{
|
||||
partial class PlayerWindowForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btSelect = new System.Windows.Forms.Button();
|
||||
this.btStart = new System.Windows.Forms.Button();
|
||||
this.btShow = new System.Windows.Forms.Button();
|
||||
this.updateWorker = new System.ComponentModel.BackgroundWorker();
|
||||
this.OpenGLWorker = new System.ComponentModel.BackgroundWorker();
|
||||
this.btRewind = new System.Windows.Forms.Button();
|
||||
this.btRemove = new System.Windows.Forms.Button();
|
||||
this.lFrameFilesListView = new System.Windows.Forms.ListView();
|
||||
this.chSaveFrames = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btSelect
|
||||
//
|
||||
this.btSelect.Location = new System.Drawing.Point(12, 41);
|
||||
this.btSelect.Name = "btSelect";
|
||||
this.btSelect.Size = new System.Drawing.Size(75, 23);
|
||||
this.btSelect.TabIndex = 0;
|
||||
this.btSelect.Text = "Select files";
|
||||
this.btSelect.UseVisualStyleBackColor = true;
|
||||
this.btSelect.Click += new System.EventHandler(this.btSelect_Click);
|
||||
//
|
||||
// btStart
|
||||
//
|
||||
this.btStart.Location = new System.Drawing.Point(12, 12);
|
||||
this.btStart.Name = "btStart";
|
||||
this.btStart.Size = new System.Drawing.Size(75, 23);
|
||||
this.btStart.TabIndex = 1;
|
||||
this.btStart.Text = "Start player";
|
||||
this.btStart.UseVisualStyleBackColor = true;
|
||||
this.btStart.Click += new System.EventHandler(this.btStart_Click);
|
||||
//
|
||||
// btShow
|
||||
//
|
||||
this.btShow.Location = new System.Drawing.Point(12, 128);
|
||||
this.btShow.Name = "btShow";
|
||||
this.btShow.Size = new System.Drawing.Size(75, 23);
|
||||
this.btShow.TabIndex = 2;
|
||||
this.btShow.Text = "Show live";
|
||||
this.btShow.UseVisualStyleBackColor = true;
|
||||
this.btShow.Click += new System.EventHandler(this.btShow_Click);
|
||||
//
|
||||
// updateWorker
|
||||
//
|
||||
this.updateWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.updateWorker_DoWork);
|
||||
//
|
||||
// OpenGLWorker
|
||||
//
|
||||
this.OpenGLWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.OpenGLWorker_DoWork);
|
||||
//
|
||||
// btRewind
|
||||
//
|
||||
this.btRewind.Location = new System.Drawing.Point(12, 99);
|
||||
this.btRewind.Name = "btRewind";
|
||||
this.btRewind.Size = new System.Drawing.Size(75, 23);
|
||||
this.btRewind.TabIndex = 5;
|
||||
this.btRewind.Text = "Rewind";
|
||||
this.btRewind.UseVisualStyleBackColor = true;
|
||||
this.btRewind.Click += new System.EventHandler(this.btRewind_Click);
|
||||
//
|
||||
// btRemove
|
||||
//
|
||||
this.btRemove.Location = new System.Drawing.Point(12, 70);
|
||||
this.btRemove.Name = "btRemove";
|
||||
this.btRemove.Size = new System.Drawing.Size(75, 23);
|
||||
this.btRemove.TabIndex = 6;
|
||||
this.btRemove.Text = "Remove file";
|
||||
this.btRemove.UseVisualStyleBackColor = true;
|
||||
this.btRemove.Click += new System.EventHandler(this.btRemove_Click);
|
||||
//
|
||||
// lFrameFilesListView
|
||||
//
|
||||
this.lFrameFilesListView.LabelEdit = true;
|
||||
this.lFrameFilesListView.Location = new System.Drawing.Point(93, 12);
|
||||
this.lFrameFilesListView.MultiSelect = false;
|
||||
this.lFrameFilesListView.Name = "lFrameFilesListView";
|
||||
this.lFrameFilesListView.Size = new System.Drawing.Size(422, 97);
|
||||
this.lFrameFilesListView.TabIndex = 7;
|
||||
this.lFrameFilesListView.UseCompatibleStateImageBehavior = false;
|
||||
this.lFrameFilesListView.View = System.Windows.Forms.View.Details;
|
||||
this.lFrameFilesListView.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.lFrameFilesListView_AfterLabelEdit);
|
||||
this.lFrameFilesListView.DoubleClick += new System.EventHandler(this.lFrameFilesListView_DoubleClick);
|
||||
//
|
||||
// chSaveFrames
|
||||
//
|
||||
this.chSaveFrames.AutoSize = true;
|
||||
this.chSaveFrames.Location = new System.Drawing.Point(435, 128);
|
||||
this.chSaveFrames.Name = "chSaveFrames";
|
||||
this.chSaveFrames.Size = new System.Drawing.Size(83, 17);
|
||||
this.chSaveFrames.TabIndex = 8;
|
||||
this.chSaveFrames.Text = "save frames";
|
||||
this.chSaveFrames.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PlayerWindowForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(527, 166);
|
||||
this.Controls.Add(this.chSaveFrames);
|
||||
this.Controls.Add(this.lFrameFilesListView);
|
||||
this.Controls.Add(this.btRemove);
|
||||
this.Controls.Add(this.btRewind);
|
||||
this.Controls.Add(this.btShow);
|
||||
this.Controls.Add(this.btStart);
|
||||
this.Controls.Add(this.btSelect);
|
||||
this.Name = "PlayerWindowForm";
|
||||
this.Text = "LiveScanPlayer";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PlayerWindowForm_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btSelect;
|
||||
private System.Windows.Forms.Button btStart;
|
||||
private System.Windows.Forms.Button btShow;
|
||||
private System.ComponentModel.BackgroundWorker updateWorker;
|
||||
private System.ComponentModel.BackgroundWorker OpenGLWorker;
|
||||
private System.Windows.Forms.Button btRewind;
|
||||
private System.Windows.Forms.Button btRemove;
|
||||
private System.Windows.Forms.ListView lFrameFilesListView;
|
||||
private System.Windows.Forms.CheckBox chSaveFrames;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
using KinectServer;
|
||||
|
||||
namespace LiveScanPlayer
|
||||
{
|
||||
public partial class PlayerWindowForm : Form
|
||||
{
|
||||
BindingList<FrameFileReader> lFrameFiles = new BindingList<FrameFileReader>();
|
||||
bool bPlayerRunning = false;
|
||||
|
||||
List<float> lAllVertices = new List<float>();
|
||||
List<byte> lAllColors = new List<byte>();
|
||||
|
||||
TransferServer oTransferServer = new TransferServer();
|
||||
|
||||
AutoResetEvent eUpdateWorkerFinished = new AutoResetEvent(false);
|
||||
|
||||
public PlayerWindowForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
oTransferServer.lVertices = lAllVertices;
|
||||
oTransferServer.lColors = lAllColors;
|
||||
|
||||
lFrameFilesListView.Columns.Add("Current frame", 75);
|
||||
lFrameFilesListView.Columns.Add("Filename", 300);
|
||||
}
|
||||
|
||||
private void PlayerWindowForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
bPlayerRunning = false;
|
||||
oTransferServer.StopServer();
|
||||
}
|
||||
|
||||
private void btSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.Multiselect = true;
|
||||
dialog.ShowDialog();
|
||||
|
||||
lock (lFrameFiles)
|
||||
{
|
||||
for (int i = 0; i < dialog.FileNames.Length; i++)
|
||||
{
|
||||
lFrameFiles.Add(new FrameFileReader(dialog.FileNames[i]));
|
||||
|
||||
var item = new ListViewItem(new [] { "0", dialog.FileNames[i]});
|
||||
lFrameFilesListView.Items.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btStart_Click(object sender, EventArgs e)
|
||||
{
|
||||
bPlayerRunning = !bPlayerRunning;
|
||||
|
||||
if (bPlayerRunning)
|
||||
{
|
||||
oTransferServer.StartServer();
|
||||
updateWorker.RunWorkerAsync();
|
||||
btStart.Text = "Stop player";
|
||||
}
|
||||
else
|
||||
{
|
||||
oTransferServer.StopServer();
|
||||
btStart.Text = "Start player";
|
||||
eUpdateWorkerFinished.WaitOne();
|
||||
}
|
||||
}
|
||||
|
||||
private void btRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lFrameFilesListView.SelectedIndices.Count == 0)
|
||||
return;
|
||||
|
||||
lock (lFrameFiles)
|
||||
{
|
||||
int idx = lFrameFilesListView.SelectedIndices[0];
|
||||
lFrameFilesListView.Items.RemoveAt(idx);
|
||||
lFrameFiles[idx].Dispose();
|
||||
lFrameFiles.RemoveAt(idx);
|
||||
}
|
||||
}
|
||||
|
||||
private void btRewind_Click(object sender, EventArgs e)
|
||||
{
|
||||
lock (lFrameFiles)
|
||||
{
|
||||
for (int i = 0; i < lFrameFiles.Count; i++)
|
||||
{
|
||||
lFrameFiles[i].Rewind();
|
||||
lFrameFilesListView.Items[i].Text = "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btShow_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!OpenGLWorker.IsBusy)
|
||||
OpenGLWorker.RunWorkerAsync();
|
||||
}
|
||||
|
||||
private void updateWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
int curFrameIdx = 0;
|
||||
string outDir = "outPlayer\\";
|
||||
DirectoryInfo di = Directory.CreateDirectory(outDir);
|
||||
|
||||
while (bPlayerRunning)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
|
||||
List<float> tempAllVertices = new List<float>();
|
||||
List<byte> tempAllColors = new List<byte>();
|
||||
|
||||
lock (lFrameFiles)
|
||||
{
|
||||
for (int i = 0; i < lFrameFiles.Count; i++)
|
||||
{
|
||||
List<float> vertices = new List<float>();
|
||||
List<byte> colors = new List<byte>();
|
||||
lFrameFiles[i].ReadFrame(vertices, colors);
|
||||
|
||||
tempAllVertices.AddRange(vertices);
|
||||
tempAllColors.AddRange(colors);
|
||||
}
|
||||
}
|
||||
|
||||
Thread frameIdxUpdate = new Thread(() => this.Invoke((MethodInvoker)delegate { this.UpdateDisplayedFrameIndices(); }));
|
||||
frameIdxUpdate.Start();
|
||||
|
||||
lock (lAllVertices)
|
||||
{
|
||||
lAllVertices.Clear();
|
||||
lAllColors.Clear();
|
||||
lAllVertices.AddRange(tempAllVertices);
|
||||
lAllColors.AddRange(tempAllColors);
|
||||
}
|
||||
|
||||
if (chSaveFrames.Checked)
|
||||
SaveCurrentFrameToFile(outDir, curFrameIdx);
|
||||
|
||||
|
||||
curFrameIdx++;
|
||||
}
|
||||
|
||||
eUpdateWorkerFinished.Set();
|
||||
}
|
||||
|
||||
private void OpenGLWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
OpenGLWindow openGLWindow = new OpenGLWindow();
|
||||
|
||||
openGLWindow.vertices = lAllVertices;
|
||||
openGLWindow.colors = lAllColors;
|
||||
|
||||
openGLWindow.Run();
|
||||
}
|
||||
|
||||
private void lFrameFilesListView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
lFrameFilesListView.SelectedItems[0].BeginEdit();
|
||||
}
|
||||
|
||||
private void lFrameFilesListView_AfterLabelEdit(object sender, LabelEditEventArgs e)
|
||||
{
|
||||
int fileIdx = lFrameFilesListView.SelectedIndices[0];
|
||||
int frameIdx;
|
||||
bool res = Int32.TryParse(e.Label, out frameIdx);
|
||||
|
||||
if (!res)
|
||||
{
|
||||
e.CancelEdit = true;
|
||||
return;
|
||||
}
|
||||
|
||||
lock (lFrameFiles)
|
||||
{
|
||||
lFrameFiles[fileIdx].JumpToFrame(frameIdx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void UpdateDisplayedFrameIndices()
|
||||
{
|
||||
lock (lFrameFiles)
|
||||
{
|
||||
for (int i = 0; i < lFrameFiles.Count; i++)
|
||||
{
|
||||
lFrameFilesListView.Items[i].SubItems[0].Text = lFrameFiles[i].frameIdx.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveCurrentFrameToFile(string outDir, int frameIdx)
|
||||
{
|
||||
List<float> lVertices = new List<float>();
|
||||
List<byte> lColors = new List<byte>();
|
||||
|
||||
lock (lAllVertices)
|
||||
{
|
||||
lVertices.AddRange(lAllVertices);
|
||||
lColors.AddRange(lAllColors);
|
||||
}
|
||||
string outputFilename = outDir + frameIdx.ToString().PadLeft(5, '0') + ".ply";
|
||||
Utils.saveToPly(outputFilename, lVertices, lColors, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="updateWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>133, 17</value>
|
||||
</metadata>
|
||||
<metadata name="OpenGLWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>263, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LiveScanPlayer
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new PlayerWindowForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("LiveScanPlayer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LiveScanPlayer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("b435173f-8157-41c6-b94f-3cc1feb6153e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LiveScanPlayer.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LiveScanPlayer.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LiveScanPlayer.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
Reference in New Issue
Block a user