Mesh Preview Support (#26)

* Added OpenTK preview

* Bug fix

* Cleanup

* Initial Mesh preview support

* Mesh preview support

* Mesh preview - lighting and color
This commit is contained in:
ordigdug 2017-02-25 05:04:05 -05:00 committed by Perfare
parent b4bce77381
commit 384dd2e4e3
10 changed files with 599 additions and 95 deletions

View File

@ -14,6 +14,7 @@
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@ -26,7 +27,6 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
@ -73,6 +73,14 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>library\x64\OpenTK.dll</HintPath>
</Reference>
<Reference Include="OpenTK.GLControl, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>library\x64\OpenTK.GLControl.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Half, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
@ -210,6 +218,9 @@
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="app.config" />
<None Include="fs.glsl">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -219,6 +230,9 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="vs.glsl">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">

View File

@ -52,6 +52,7 @@
this.showExpOpt = new System.Windows.Forms.ToolStripMenuItem();
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportAll3DMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.all3DObjectssplitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportSelected3DMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exportAllAssetsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -62,7 +63,7 @@
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.sceneTreeView = new Unity_Studio.GOHierarchy();
this.sceneTreeView = new GOHierarchy();
this.treeSearch = new System.Windows.Forms.TextBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.assetListView = new System.Windows.Forms.ListView();
@ -87,6 +88,7 @@
this.FMODplayButton = new System.Windows.Forms.Button();
this.fontPreviewBox = new System.Windows.Forms.RichTextBox();
this.textPreviewBox = new System.Windows.Forms.TextBox();
this.glControl1 = new OpenTK.GLControl();
this.classPreviewPanel = new System.Windows.Forms.Panel();
this.classTextBox = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
@ -96,12 +98,12 @@
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.timer = new System.Windows.Forms.Timer(this.components);
this.timerOpenTK = new System.Windows.Forms.Timer(this.components);
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.openFolderDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.saveFolderDialog1 = new System.Windows.Forms.SaveFileDialog();
this.treeTip = new System.Windows.Forms.ToolTip(this.components);
this.all3DObjectssplitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
@ -111,6 +113,7 @@
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.progressbarPanel.SuspendLayout();
this.glControl1.SuspendLayout();
this.previewPanel.SuspendLayout();
this.FMODpanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.FMODprogressBar)).BeginInit();
@ -130,7 +133,7 @@
this.helpToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1264, 25);
this.menuStrip1.Size = new System.Drawing.Size(1264, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
@ -143,39 +146,39 @@
this.extractBundleToolStripMenuItem,
this.extractFolderToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(39, 21);
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
//
// loadFileToolStripMenuItem
//
this.loadFileToolStripMenuItem.Name = "loadFileToolStripMenuItem";
this.loadFileToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.loadFileToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.loadFileToolStripMenuItem.Text = "Load file...";
this.loadFileToolStripMenuItem.Click += new System.EventHandler(this.loadFile_Click);
//
// loadFolderToolStripMenuItem
//
this.loadFolderToolStripMenuItem.Name = "loadFolderToolStripMenuItem";
this.loadFolderToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.loadFolderToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.loadFolderToolStripMenuItem.Text = "Load folder...";
this.loadFolderToolStripMenuItem.Click += new System.EventHandler(this.loadFolder_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(165, 6);
this.toolStripMenuItem1.Size = new System.Drawing.Size(155, 6);
//
// extractBundleToolStripMenuItem
//
this.extractBundleToolStripMenuItem.Name = "extractBundleToolStripMenuItem";
this.extractBundleToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.extractBundleToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.extractBundleToolStripMenuItem.Text = "Extract bundle...";
this.extractBundleToolStripMenuItem.Click += new System.EventHandler(this.extractBundleToolStripMenuItem_Click);
//
// extractFolderToolStripMenuItem
//
this.extractFolderToolStripMenuItem.Name = "extractFolderToolStripMenuItem";
this.extractFolderToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.extractFolderToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.extractFolderToolStripMenuItem.Text = "Extract folder...";
this.extractFolderToolStripMenuItem.Click += new System.EventHandler(this.extractFolderToolStripMenuItem_Click);
//
@ -188,7 +191,7 @@
this.toolStripSeparator2,
this.exportClassStructuresMenuItem});
this.debugMenuItem.Name = "debugMenuItem";
this.debugMenuItem.Size = new System.Drawing.Size(87, 21);
this.debugMenuItem.Size = new System.Drawing.Size(80, 20);
this.debugMenuItem.Text = "Diagnostics";
this.debugMenuItem.Visible = false;
//
@ -196,14 +199,14 @@
//
this.buildClassStructuresMenuItem.CheckOnClick = true;
this.buildClassStructuresMenuItem.Name = "buildClassStructuresMenuItem";
this.buildClassStructuresMenuItem.Size = new System.Drawing.Size(224, 22);
this.buildClassStructuresMenuItem.Size = new System.Drawing.Size(208, 22);
this.buildClassStructuresMenuItem.Text = "Build class structures";
//
// dontLoadAssetsMenuItem
//
this.dontLoadAssetsMenuItem.CheckOnClick = true;
this.dontLoadAssetsMenuItem.Name = "dontLoadAssetsMenuItem";
this.dontLoadAssetsMenuItem.Size = new System.Drawing.Size(224, 22);
this.dontLoadAssetsMenuItem.Size = new System.Drawing.Size(208, 22);
this.dontLoadAssetsMenuItem.Text = "Don\'t load assets";
this.dontLoadAssetsMenuItem.CheckedChanged += new System.EventHandler(this.dontLoadAssetsMenuItem_CheckedChanged);
//
@ -211,18 +214,18 @@
//
this.dontBuildHierarchyMenuItem.CheckOnClick = true;
this.dontBuildHierarchyMenuItem.Name = "dontBuildHierarchyMenuItem";
this.dontBuildHierarchyMenuItem.Size = new System.Drawing.Size(224, 22);
this.dontBuildHierarchyMenuItem.Size = new System.Drawing.Size(208, 22);
this.dontBuildHierarchyMenuItem.Text = "Don\'t build hierarchy tree";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(221, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(205, 6);
//
// exportClassStructuresMenuItem
//
this.exportClassStructuresMenuItem.Name = "exportClassStructuresMenuItem";
this.exportClassStructuresMenuItem.Size = new System.Drawing.Size(224, 22);
this.exportClassStructuresMenuItem.Size = new System.Drawing.Size(208, 22);
this.exportClassStructuresMenuItem.Text = "Export class structures";
this.exportClassStructuresMenuItem.Click += new System.EventHandler(this.exportClassStructuresMenuItem_Click);
//
@ -236,7 +239,7 @@
this.assetGroupOptions,
this.showExpOpt});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21);
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.optionsToolStripMenuItem.Text = "Options";
//
// displayAll
@ -290,7 +293,7 @@
"Group exported assets by source file",
"Do not group exported assets"});
this.assetGroupOptions.Name = "assetGroupOptions";
this.assetGroupOptions.Size = new System.Drawing.Size(192, 25);
this.assetGroupOptions.Size = new System.Drawing.Size(192, 23);
this.assetGroupOptions.SelectedIndexChanged += new System.EventHandler(this.assetGroupOptions_SelectedIndexChanged);
//
// showExpOpt
@ -311,46 +314,53 @@
this.exportSelectedAssetsMenuItem,
this.exportFilteredAssetsMenuItem});
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.Size = new System.Drawing.Size(58, 21);
this.exportToolStripMenuItem.Size = new System.Drawing.Size(52, 20);
this.exportToolStripMenuItem.Text = "Export";
//
// exportAll3DMenuItem
//
this.exportAll3DMenuItem.Name = "exportAll3DMenuItem";
this.exportAll3DMenuItem.Size = new System.Drawing.Size(192, 22);
this.exportAll3DMenuItem.Size = new System.Drawing.Size(179, 22);
this.exportAll3DMenuItem.Text = "All 3D objects";
this.exportAll3DMenuItem.Click += new System.EventHandler(this.Export3DObjects_Click);
//
// all3DObjectssplitToolStripMenuItem
//
this.all3DObjectssplitToolStripMenuItem.Name = "all3DObjectssplitToolStripMenuItem";
this.all3DObjectssplitToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.all3DObjectssplitToolStripMenuItem.Text = "All 3D objects (split)";
this.all3DObjectssplitToolStripMenuItem.Click += new System.EventHandler(this.all3DObjectssplitToolStripMenuItem_Click);
//
// exportSelected3DMenuItem
//
this.exportSelected3DMenuItem.Name = "exportSelected3DMenuItem";
this.exportSelected3DMenuItem.Size = new System.Drawing.Size(192, 22);
this.exportSelected3DMenuItem.Size = new System.Drawing.Size(179, 22);
this.exportSelected3DMenuItem.Text = "Selected 3D objects";
this.exportSelected3DMenuItem.Click += new System.EventHandler(this.Export3DObjects_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(189, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(176, 6);
//
// exportAllAssetsMenuItem
//
this.exportAllAssetsMenuItem.Name = "exportAllAssetsMenuItem";
this.exportAllAssetsMenuItem.Size = new System.Drawing.Size(192, 22);
this.exportAllAssetsMenuItem.Size = new System.Drawing.Size(179, 22);
this.exportAllAssetsMenuItem.Text = "All assets";
this.exportAllAssetsMenuItem.Click += new System.EventHandler(this.ExportAssets_Click);
//
// exportSelectedAssetsMenuItem
//
this.exportSelectedAssetsMenuItem.Name = "exportSelectedAssetsMenuItem";
this.exportSelectedAssetsMenuItem.Size = new System.Drawing.Size(192, 22);
this.exportSelectedAssetsMenuItem.Size = new System.Drawing.Size(179, 22);
this.exportSelectedAssetsMenuItem.Text = "Selected assets";
this.exportSelectedAssetsMenuItem.Click += new System.EventHandler(this.ExportAssets_Click);
//
// exportFilteredAssetsMenuItem
//
this.exportFilteredAssetsMenuItem.Name = "exportFilteredAssetsMenuItem";
this.exportFilteredAssetsMenuItem.Size = new System.Drawing.Size(192, 22);
this.exportFilteredAssetsMenuItem.Size = new System.Drawing.Size(179, 22);
this.exportFilteredAssetsMenuItem.Text = "Filtered assets";
this.exportFilteredAssetsMenuItem.Click += new System.EventHandler(this.ExportAssets_Click);
//
@ -359,13 +369,13 @@
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.aboutToolStripMenuItem});
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.Size = new System.Drawing.Size(47, 21);
this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.helpToolStripMenuItem.Text = "Help";
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(111, 22);
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
this.aboutToolStripMenuItem.Text = "About";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
//
@ -373,7 +383,7 @@
//
this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 25);
this.splitContainer1.Location = new System.Drawing.Point(0, 24);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
@ -388,7 +398,7 @@
this.splitContainer1.Panel2.Controls.Add(this.classPreviewPanel);
this.splitContainer1.Panel2.Controls.Add(this.statusStrip1);
this.splitContainer1.Panel2MinSize = 400;
this.splitContainer1.Size = new System.Drawing.Size(1264, 605);
this.splitContainer1.Size = new System.Drawing.Size(1264, 659);
this.splitContainer1.SplitterDistance = 420;
this.splitContainer1.TabIndex = 2;
this.splitContainer1.TabStop = false;
@ -402,7 +412,7 @@
this.tabControl1.Name = "tabControl1";
this.tabControl1.Padding = new System.Drawing.Point(17, 3);
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(418, 583);
this.tabControl1.Size = new System.Drawing.Size(418, 635);
this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.tabControl1.TabIndex = 0;
this.tabControl1.Selected += new System.Windows.Forms.TabControlEventHandler(this.tabPageSelected);
@ -435,7 +445,7 @@
this.treeSearch.ForeColor = System.Drawing.SystemColors.GrayText;
this.treeSearch.Location = new System.Drawing.Point(0, 0);
this.treeSearch.Name = "treeSearch";
this.treeSearch.Size = new System.Drawing.Size(410, 21);
this.treeSearch.Size = new System.Drawing.Size(410, 20);
this.treeSearch.TabIndex = 0;
this.treeSearch.Text = " Search ";
this.treeSearch.TextChanged += new System.EventHandler(this.treeSearch_TextChanged);
@ -450,7 +460,7 @@
this.tabPage2.Controls.Add(this.listSearch);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(410, 557);
this.tabPage2.Size = new System.Drawing.Size(410, 609);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Asset List";
this.tabPage2.UseVisualStyleBackColor = true;
@ -467,9 +477,9 @@
this.assetListView.GridLines = true;
this.assetListView.HideSelection = false;
this.assetListView.LabelEdit = true;
this.assetListView.Location = new System.Drawing.Point(0, 21);
this.assetListView.Location = new System.Drawing.Point(0, 20);
this.assetListView.Name = "assetListView";
this.assetListView.Size = new System.Drawing.Size(410, 536);
this.assetListView.Size = new System.Drawing.Size(410, 589);
this.assetListView.TabIndex = 1;
this.assetListView.UseCompatibleStateImageBehavior = false;
this.assetListView.View = System.Windows.Forms.View.Details;
@ -499,7 +509,7 @@
this.listSearch.ForeColor = System.Drawing.SystemColors.GrayText;
this.listSearch.Location = new System.Drawing.Point(0, 0);
this.listSearch.Name = "listSearch";
this.listSearch.Size = new System.Drawing.Size(410, 21);
this.listSearch.Size = new System.Drawing.Size(410, 20);
this.listSearch.TabIndex = 0;
this.listSearch.Text = " Filter ";
this.listSearch.TextChanged += new System.EventHandler(this.ListSearchTextChanged);
@ -510,10 +520,10 @@
//
this.progressbarPanel.Controls.Add(this.progressBar1);
this.progressbarPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.progressbarPanel.Location = new System.Drawing.Point(0, 583);
this.progressbarPanel.Location = new System.Drawing.Point(0, 635);
this.progressbarPanel.Name = "progressbarPanel";
this.progressbarPanel.Padding = new System.Windows.Forms.Padding(1, 3, 1, 1);
this.progressbarPanel.Size = new System.Drawing.Size(418, 20);
this.progressbarPanel.Size = new System.Drawing.Size(418, 22);
this.progressbarPanel.TabIndex = 2;
//
// progressBar1
@ -521,23 +531,24 @@
this.progressBar1.Dock = System.Windows.Forms.DockStyle.Fill;
this.progressBar1.Location = new System.Drawing.Point(1, 3);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(416, 16);
this.progressBar1.Size = new System.Drawing.Size(416, 18);
this.progressBar1.Step = 1;
this.progressBar1.TabIndex = 1;
//
// previewPanel
//
this.previewPanel.BackColor = System.Drawing.SystemColors.ControlDark;
this.previewPanel.BackgroundImage = Properties.Resources.preview;
this.previewPanel.BackgroundImage = global::Unity_Studio.Properties.Resources.preview;
this.previewPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.previewPanel.Controls.Add(this.assetInfoLabel);
this.previewPanel.Controls.Add(this.FMODpanel);
this.previewPanel.Controls.Add(this.fontPreviewBox);
this.previewPanel.Controls.Add(this.textPreviewBox);
this.previewPanel.Controls.Add(this.glControl1);
this.previewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.previewPanel.Location = new System.Drawing.Point(0, 0);
this.previewPanel.Name = "previewPanel";
this.previewPanel.Size = new System.Drawing.Size(838, 581);
this.previewPanel.Size = new System.Drawing.Size(838, 635);
this.previewPanel.TabIndex = 1;
//
// assetInfoLabel
@ -545,9 +556,9 @@
this.assetInfoLabel.AutoSize = true;
this.assetInfoLabel.BackColor = System.Drawing.Color.Transparent;
this.assetInfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.assetInfoLabel.Location = new System.Drawing.Point(4, 7);
this.assetInfoLabel.Location = new System.Drawing.Point(4, 8);
this.assetInfoLabel.Name = "assetInfoLabel";
this.assetInfoLabel.Size = new System.Drawing.Size(0, 12);
this.assetInfoLabel.Size = new System.Drawing.Size(0, 13);
this.assetInfoLabel.TabIndex = 0;
//
// FMODpanel
@ -564,9 +575,9 @@
this.FMODpanel.Controls.Add(this.FMODstopButton);
this.FMODpanel.Controls.Add(this.FMODpauseButton);
this.FMODpanel.Controls.Add(this.FMODplayButton);
this.FMODpanel.Location = new System.Drawing.Point(220, 191);
this.FMODpanel.Location = new System.Drawing.Point(223, 217);
this.FMODpanel.Name = "FMODpanel";
this.FMODpanel.Size = new System.Drawing.Size(400, 185);
this.FMODpanel.Size = new System.Drawing.Size(400, 200);
this.FMODpanel.TabIndex = 2;
this.FMODpanel.Visible = false;
//
@ -574,26 +585,26 @@
//
this.FMODcopyright.AutoSize = true;
this.FMODcopyright.ForeColor = System.Drawing.SystemColors.ControlLight;
this.FMODcopyright.Location = new System.Drawing.Point(117, 173);
this.FMODcopyright.Location = new System.Drawing.Point(117, 187);
this.FMODcopyright.Name = "FMODcopyright";
this.FMODcopyright.Size = new System.Drawing.Size(341, 12);
this.FMODcopyright.Size = new System.Drawing.Size(283, 13);
this.FMODcopyright.TabIndex = 9;
this.FMODcopyright.Text = "Audio Engine supplied by FMOD by Firelight Technologies.";
//
// FMODinfoLabel
//
this.FMODinfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODinfoLabel.Location = new System.Drawing.Point(82, 50);
this.FMODinfoLabel.Location = new System.Drawing.Point(82, 54);
this.FMODinfoLabel.Name = "FMODinfoLabel";
this.FMODinfoLabel.Size = new System.Drawing.Size(176, 12);
this.FMODinfoLabel.Size = new System.Drawing.Size(176, 13);
this.FMODinfoLabel.TabIndex = 8;
//
// FMODtimerLabel
//
this.FMODtimerLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODtimerLabel.Location = new System.Drawing.Point(212, 50);
this.FMODtimerLabel.Location = new System.Drawing.Point(212, 54);
this.FMODtimerLabel.Name = "FMODtimerLabel";
this.FMODtimerLabel.Size = new System.Drawing.Size(158, 12);
this.FMODtimerLabel.Size = new System.Drawing.Size(158, 13);
this.FMODtimerLabel.TabIndex = 7;
this.FMODtimerLabel.Text = "0:00.0 / 0:00.0";
this.FMODtimerLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
@ -601,19 +612,19 @@
// FMODstatusLabel
//
this.FMODstatusLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODstatusLabel.Location = new System.Drawing.Point(26, 50);
this.FMODstatusLabel.Location = new System.Drawing.Point(26, 54);
this.FMODstatusLabel.Name = "FMODstatusLabel";
this.FMODstatusLabel.Size = new System.Drawing.Size(50, 12);
this.FMODstatusLabel.Size = new System.Drawing.Size(50, 13);
this.FMODstatusLabel.TabIndex = 6;
this.FMODstatusLabel.Text = "Stopped";
//
// FMODprogressBar
//
this.FMODprogressBar.AutoSize = false;
this.FMODprogressBar.Location = new System.Drawing.Point(29, 67);
this.FMODprogressBar.Location = new System.Drawing.Point(29, 73);
this.FMODprogressBar.Maximum = 1000;
this.FMODprogressBar.Name = "FMODprogressBar";
this.FMODprogressBar.Size = new System.Drawing.Size(348, 22);
this.FMODprogressBar.Size = new System.Drawing.Size(348, 24);
this.FMODprogressBar.TabIndex = 5;
this.FMODprogressBar.TickStyle = System.Windows.Forms.TickStyle.None;
this.FMODprogressBar.Scroll += new System.EventHandler(this.FMODprogressBar_Scroll);
@ -623,7 +634,7 @@
// FMODvolumeBar
//
this.FMODvolumeBar.LargeChange = 2;
this.FMODvolumeBar.Location = new System.Drawing.Point(273, 95);
this.FMODvolumeBar.Location = new System.Drawing.Point(273, 103);
this.FMODvolumeBar.Name = "FMODvolumeBar";
this.FMODvolumeBar.Size = new System.Drawing.Size(104, 45);
this.FMODvolumeBar.TabIndex = 4;
@ -634,9 +645,9 @@
// FMODloopButton
//
this.FMODloopButton.Appearance = System.Windows.Forms.Appearance.Button;
this.FMODloopButton.Location = new System.Drawing.Point(212, 95);
this.FMODloopButton.Location = new System.Drawing.Point(212, 103);
this.FMODloopButton.Name = "FMODloopButton";
this.FMODloopButton.Size = new System.Drawing.Size(55, 42);
this.FMODloopButton.Size = new System.Drawing.Size(55, 46);
this.FMODloopButton.TabIndex = 3;
this.FMODloopButton.Text = "Loop";
this.FMODloopButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -645,9 +656,9 @@
//
// FMODstopButton
//
this.FMODstopButton.Location = new System.Drawing.Point(151, 95);
this.FMODstopButton.Location = new System.Drawing.Point(151, 103);
this.FMODstopButton.Name = "FMODstopButton";
this.FMODstopButton.Size = new System.Drawing.Size(55, 42);
this.FMODstopButton.Size = new System.Drawing.Size(55, 46);
this.FMODstopButton.TabIndex = 2;
this.FMODstopButton.Text = "Stop";
this.FMODstopButton.UseVisualStyleBackColor = true;
@ -655,9 +666,9 @@
//
// FMODpauseButton
//
this.FMODpauseButton.Location = new System.Drawing.Point(90, 95);
this.FMODpauseButton.Location = new System.Drawing.Point(90, 103);
this.FMODpauseButton.Name = "FMODpauseButton";
this.FMODpauseButton.Size = new System.Drawing.Size(55, 42);
this.FMODpauseButton.Size = new System.Drawing.Size(55, 46);
this.FMODpauseButton.TabIndex = 1;
this.FMODpauseButton.Text = "Pause";
this.FMODpauseButton.UseVisualStyleBackColor = true;
@ -665,9 +676,9 @@
//
// FMODplayButton
//
this.FMODplayButton.Location = new System.Drawing.Point(29, 95);
this.FMODplayButton.Location = new System.Drawing.Point(29, 103);
this.FMODplayButton.Name = "FMODplayButton";
this.FMODplayButton.Size = new System.Drawing.Size(55, 42);
this.FMODplayButton.Size = new System.Drawing.Size(55, 46);
this.FMODplayButton.TabIndex = 0;
this.FMODplayButton.Text = "Play";
this.FMODplayButton.UseVisualStyleBackColor = true;
@ -681,7 +692,7 @@
this.fontPreviewBox.Name = "fontPreviewBox";
this.fontPreviewBox.ReadOnly = true;
this.fontPreviewBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.fontPreviewBox.Size = new System.Drawing.Size(838, 581);
this.fontPreviewBox.Size = new System.Drawing.Size(838, 635);
this.fontPreviewBox.TabIndex = 0;
this.fontPreviewBox.Text = resources.GetString("fontPreviewBox.Text");
this.fontPreviewBox.Visible = false;
@ -696,18 +707,30 @@
this.textPreviewBox.Name = "textPreviewBox";
this.textPreviewBox.ReadOnly = true;
this.textPreviewBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textPreviewBox.Size = new System.Drawing.Size(838, 581);
this.textPreviewBox.Size = new System.Drawing.Size(838, 635);
this.textPreviewBox.TabIndex = 2;
this.textPreviewBox.Visible = false;
this.textPreviewBox.WordWrap = false;
//
// glControl1
//
this.glControl1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.glControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.glControl1.Location = new System.Drawing.Point(0, 0);
this.glControl1.Margin = new System.Windows.Forms.Padding(6);
this.glControl1.Name = "glControl1";
this.glControl1.Size = new System.Drawing.Size(838, 635);
this.glControl1.TabIndex = 4;
this.glControl1.VSync = false;
this.glControl1.Paint += new System.Windows.Forms.PaintEventHandler(this.glControl1_Paint);
//
// classPreviewPanel
//
this.classPreviewPanel.Controls.Add(this.classTextBox);
this.classPreviewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.classPreviewPanel.Location = new System.Drawing.Point(0, 0);
this.classPreviewPanel.Name = "classPreviewPanel";
this.classPreviewPanel.Size = new System.Drawing.Size(838, 581);
this.classPreviewPanel.Size = new System.Drawing.Size(838, 635);
this.classPreviewPanel.TabIndex = 3;
this.classPreviewPanel.Visible = false;
//
@ -719,7 +742,7 @@
this.classTextBox.Name = "classTextBox";
this.classTextBox.ReadOnly = true;
this.classTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.classTextBox.Size = new System.Drawing.Size(838, 581);
this.classTextBox.Size = new System.Drawing.Size(838, 635);
this.classTextBox.TabIndex = 3;
this.classTextBox.WordWrap = false;
//
@ -727,7 +750,7 @@
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1});
this.statusStrip1.Location = new System.Drawing.Point(0, 581);
this.statusStrip1.Location = new System.Drawing.Point(0, 635);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(838, 22);
this.statusStrip1.TabIndex = 2;
@ -784,6 +807,11 @@
this.timer.Interval = 10;
this.timer.Tick += new System.EventHandler(this.timer_Tick);
//
// timerOpenTK
//
this.timerOpenTK.Interval = 1000/6;
this.timerOpenTK.Tick += new System.EventHandler(this.timerOpenTK_Tick);
//
// openFileDialog1
//
this.openFileDialog1.AddExtension = false;
@ -813,24 +841,17 @@
this.saveFolderDialog1.RestoreDirectory = true;
this.saveFolderDialog1.Title = "Browse for folder";
//
// all3DObjectssplitToolStripMenuItem
//
this.all3DObjectssplitToolStripMenuItem.Name = "all3DObjectssplitToolStripMenuItem";
this.all3DObjectssplitToolStripMenuItem.Size = new System.Drawing.Size(192, 22);
this.all3DObjectssplitToolStripMenuItem.Text = "All 3D objects (split)";
this.all3DObjectssplitToolStripMenuItem.Click += new System.EventHandler(this.all3DObjectssplitToolStripMenuItem_Click);
//
// UnityStudioForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1264, 630);
this.ClientSize = new System.Drawing.Size(1264, 683);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.menuStrip1);
this.Icon = Properties.Resources.unity;
this.Icon = global::Unity_Studio.Properties.Resources.unity;
this.KeyPreview = true;
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(620, 372);
this.MinimumSize = new System.Drawing.Size(620, 400);
this.Name = "UnityStudioForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Unity Studio";
@ -848,6 +869,7 @@
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.progressbarPanel.ResumeLayout(false);
this.glControl1.ResumeLayout(false);
this.previewPanel.ResumeLayout(false);
this.previewPanel.PerformLayout();
this.FMODpanel.ResumeLayout(false);
@ -904,6 +926,7 @@
private System.Windows.Forms.Label FMODtimerLabel;
private System.Windows.Forms.Label FMODinfoLabel;
private System.Windows.Forms.Timer timer;
private System.Windows.Forms.Timer timerOpenTK;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem displayAll;
@ -938,6 +961,7 @@
private System.Windows.Forms.ToolStripMenuItem exportClassStructuresMenuItem;
private System.Windows.Forms.Label FMODcopyright;
private System.Windows.Forms.ToolStripMenuItem all3DObjectssplitToolStripMenuItem;
private OpenTK.GLControl glControl1;
}
}

View File

@ -11,6 +11,8 @@ using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Drawing.Text;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using static Unity_Studio.UnityStudio;
@ -34,6 +36,27 @@ namespace Unity_Studio
private Bitmap imageTexture;
// OpenTK variables
int pgmID;
int vsID;
int fsID;
int attributeVertexPosition;
int attributeNormalDirection;
int attributeVertexColor;
int uniformViewMatrix;
int vao;
int vboPositions;
int vboNormals;
int vboColors;
int vboViewMatrix;
int eboElements;
Vector3[] vertexData;
Vector3[] normalData;
Vector4[] colorData;
Matrix4[] viewMatrixData;
int[] indiceData;
bool wireFrameView;
//asset list sorting helpers
private int firstSortColumn = -1;
private int secondSortColumn;
@ -302,6 +325,96 @@ namespace Unity_Studio
if (tabControl1.TabPages.Contains(tabPage3)) { tabControl1.TabPages.Remove(tabPage3); }
else { tabControl1.TabPages.Add(tabPage3); }
}
if (glControl1.Visible == true)
{
// --> Right
if (e.KeyCode == Keys.D)
{
if (e.Shift && e.KeyCode == Keys.D) //Move
{
viewMatrixData[0] *= Matrix4.CreateTranslation(0.1f, 0, 0);
}
else //Rotate
{
viewMatrixData[0] *= Matrix4.CreateRotationY(0.1f);
}
GL.UniformMatrix4(uniformViewMatrix, false, ref viewMatrixData[0]);
glControl1.Invalidate();
}
// <-- Left
if (e.KeyCode == Keys.A)
{
if (e.Shift && e.KeyCode == Keys.A) //Move
{
viewMatrixData[0] *= Matrix4.CreateTranslation(-0.1f, 0, 0);
}
else //Rotate
{
viewMatrixData[0] *= Matrix4.CreateRotationY(-0.1f);
}
GL.UniformMatrix4(uniformViewMatrix, false, ref viewMatrixData[0]);
glControl1.Invalidate();
}
// Up
if (e.KeyCode == Keys.W)
{
if (e.Control && e.KeyCode == Keys.W) //Toggle WireFrame
{
wireFrameView = !wireFrameView;
glControl1.Invalidate();
}
else if (e.Shift && e.KeyCode == Keys.W) //Move
{
viewMatrixData[0] *= Matrix4.CreateTranslation(0, 0.1f, 0);
}
else //Rotate
{
viewMatrixData[0] *= Matrix4.CreateRotationX(0.1f);
}
GL.UniformMatrix4(uniformViewMatrix, false, ref viewMatrixData[0]);
glControl1.Invalidate();
}
// Down
if (e.KeyCode == Keys.S)
{
if (e.Shift && e.KeyCode == Keys.S) //Move
{
viewMatrixData[0] *= Matrix4.CreateTranslation(0, -0.1f, 0);
}
else //Rotate
{
viewMatrixData[0] *= Matrix4.CreateRotationX(-0.1f);
}
GL.UniformMatrix4(uniformViewMatrix, false, ref viewMatrixData[0]);
glControl1.Invalidate();
}
// Zoom Out
if (e.KeyCode == Keys.Q)
{
viewMatrixData[0] *= Matrix4.CreateScale(0.9f);
GL.UniformMatrix4(uniformViewMatrix, false, ref viewMatrixData[0]);
glControl1.Invalidate();
}
// Zoom In
if (e.KeyCode == Keys.E)
{
viewMatrixData[0] *= Matrix4.CreateScale(1.1f);
GL.UniformMatrix4(uniformViewMatrix, false, ref viewMatrixData[0]);
glControl1.Invalidate();
}
// Toggle Timer
if (e.KeyCode == Keys.T)
{
timerOpenTK.Enabled = !timerOpenTK.Enabled;
}
}
}
private void dontLoadAssetsMenuItem_CheckedChanged(object sender, EventArgs e)
@ -576,22 +689,6 @@ namespace Unity_Studio
resizeAssetListColumns();
}
/*private void splitContainer1_Resize(object sender, EventArgs e)
{
switch (tabControl1.SelectedIndex)
{
case 1: resizeAssetListColumns(); break;
}
}
private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e)
{
switch (tabControl1.SelectedIndex)
{
case 1: resizeAssetListColumns(); break;
}
}*/
private void listSearch_Enter(object sender, EventArgs e)
{
if (listSearch.Text == " Filter ")
@ -681,6 +778,7 @@ namespace Unity_Studio
fontPreviewBox.Visible = false;
pfc.Dispose();
FMODpanel.Visible = false;
glControl1.Visible = false;
lastLoadedAsset = null;
StatusStripUpdate("");
@ -860,6 +958,84 @@ namespace Unity_Studio
break;
}
#endregion
#region Mesh
case 43: //Mesh
{
glControl1.Visible = true;
viewMatrixData = new Matrix4[] {
Matrix4.Identity
* Matrix4.CreateTranslation( 0.0f, -1.0f, 0.0f )
* Matrix4.CreateRotationY(-90.0f)};
var m_Mesh = new Mesh(asset);
if (m_Mesh.m_VertexCount > 0)
{
int count = 3;//vertex components
//skip last component in vector4
if (m_Mesh.m_Vertices.Length == m_Mesh.m_VertexCount * 4) { count = 4; }
vertexData = new Vector3[m_Mesh.m_VertexCount];
for (int v = 0; v < m_Mesh.m_VertexCount; v++)
{
vertexData[v] = new Vector3(
m_Mesh.m_Vertices[v * count],
m_Mesh.m_Vertices[v * count + 1],
m_Mesh.m_Vertices[v * count + 2]);
}
indiceData = new int[m_Mesh.m_Indices.Count];
for (int i = 0; i < m_Mesh.m_Indices.Count; i = i + 3)
{
indiceData[i] = (int)m_Mesh.m_Indices[i];
indiceData[i + 1] = (int)m_Mesh.m_Indices[i + 1];
indiceData[i + 2] = (int)m_Mesh.m_Indices[i + 2];
}
if (m_Mesh.m_Normals.Length == m_Mesh.m_VertexCount * 3) { count = 3; }
else if (m_Mesh.m_Normals.Length == m_Mesh.m_VertexCount * 4) { count = 4; }
normalData = new Vector3[m_Mesh.m_VertexCount];
for (int n = 0; n < m_Mesh.m_VertexCount; n++)
{
normalData[n] = new Vector3(
m_Mesh.m_Normals[n * count],
m_Mesh.m_Normals[n * count + 1],
m_Mesh.m_Normals[n * count + 2]);
}
if (m_Mesh.m_Colors == null || m_Mesh.m_Colors.Length == m_Mesh.m_VertexCount * 3)
{
colorData = new Vector4[m_Mesh.m_VertexCount];
for (int c = 0; c < m_Mesh.m_VertexCount; c++)
{
colorData[c] = new Vector4(
0.5f, 0.5f, 0.5f, 1.0f);
}
}
else
{
colorData = new Vector4[m_Mesh.m_VertexCount];
for (int c = 0; c < m_Mesh.m_VertexCount; c++)
{
colorData[c] = new Vector4(
m_Mesh.m_Colors[c * 4],
m_Mesh.m_Colors[c * 4 + 1],
m_Mesh.m_Colors[c * 4 + 2],
m_Mesh.m_Colors[c * 4 + 3]);
}
}
}
createVAO();
StatusStripUpdate("Using OpenGL Version: " + GL.GetString(StringName.Version)
+ " | 'T'=Start/Stop Rotation | 'WASD'=Manual Rotate | "
+ "'Shift WASD'=Move | 'Q/E'=Zoom | 'Ctl W' =Wireframe");
}
break;
#endregion
default:
{
StatusStripUpdate("Only supported export the raw file.");
@ -1479,6 +1655,197 @@ namespace Unity_Studio
UnityStudio.ProgressBarMaximumAdd = ProgressBarMaximumAdd;
}
private void timerOpenTK_Tick(object sender, EventArgs e)
{
if (glControl1.Visible == true)
{
viewMatrixData[0] *= Matrix4.CreateRotationY(-0.1f);
GL.UniformMatrix4(uniformViewMatrix, false, ref viewMatrixData[0]);
glControl1.Invalidate();
}
}
private void initOpenTK()
{
pgmID = GL.CreateProgram();
loadShader("vs.glsl", ShaderType.VertexShader, pgmID, out vsID);
loadShader("fs.glsl", ShaderType.FragmentShader, pgmID, out fsID);
GL.LinkProgram(pgmID);
GL.UseProgram(pgmID);
attributeVertexPosition = GL.GetAttribLocation(pgmID, "vertexPosition");
attributeNormalDirection = GL.GetAttribLocation(pgmID, "normalDirection");
attributeVertexColor = GL.GetAttribLocation(pgmID, "vertexColor");
uniformViewMatrix = GL.GetUniformLocation(pgmID, "viewMatrix");
}
private void loadShader(string filename, ShaderType type, int program, out int address)
{
address = GL.CreateShader(type);
using (StreamReader sr = new StreamReader(filename))
{
GL.ShaderSource(address, sr.ReadToEnd());
}
GL.CompileShader(address);
GL.AttachShader(program, address);
GL.DeleteShader(address);
}
private void createVBO(int vboAddress, Vector3[] data, int address)
{
GL.GenBuffers(1, out vboAddress);
GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress);
GL.BufferData<Vector3>(BufferTarget.ArrayBuffer,
(IntPtr)(data.Length * Vector3.SizeInBytes),
data,
BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(address, 3, VertexAttribPointerType.Float, false, 0, 0);
GL.EnableVertexAttribArray(address);
}
private void createVBO(int vboAddress, Vector4[] data, int address)
{
GL.GenBuffers(1, out vboAddress);
GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress);
GL.BufferData<Vector4>(BufferTarget.ArrayBuffer,
(IntPtr)(data.Length * Vector4.SizeInBytes),
data,
BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(address, 4, VertexAttribPointerType.Float, false, 0, 0);
GL.EnableVertexAttribArray(address);
}
private void createVBO(int vboAddress, Matrix4[] data, int address)
{
GL.GenBuffers(1, out vboAddress);
GL.UniformMatrix4(address, false, ref data[0]);
}
private void createEBO(int address, int[] data)
{
GL.GenBuffers(1, out address);
GL.BindBuffer(BufferTarget.ElementArrayBuffer, address);
GL.BufferData(BufferTarget.ElementArrayBuffer,
(IntPtr)(data.Length * sizeof(int)),
data,
BufferUsageHint.StaticDraw);
}
private void createVAO()
{
timerOpenTK.Stop();
GL.DeleteVertexArray(vao);
GL.GenVertexArrays(1, out vao);
GL.BindVertexArray(vao);
createVBO(vboPositions, vertexData, attributeVertexPosition);
createVBO(vboColors, colorData, attributeVertexColor);
createVBO(vboViewMatrix, viewMatrixData, uniformViewMatrix);
createEBO(eboElements, indiceData);
createVBO(vboNormals, normalData, attributeNormalDirection);
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
GL.BindVertexArray(0);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
glControl1_Resize(this, EventArgs.Empty);
GL.ClearColor(Color.CadetBlue);
initOpenTK();
vertexData = new Vector3[]
{
new Vector3(-0.5f, -0.5f, -0.5f),
new Vector3(0.5f, -0.5f, -0.5f),
new Vector3(0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, 0.5f, -0.5f),
new Vector3(-0.5f, -0.5f, 0.5f),
new Vector3(0.5f, -0.5f, 0.5f),
new Vector3(0.5f, 0.5f, 0.5f),
new Vector3(-0.5f, 0.5f, 0.5f)
};
indiceData = new int[]
{
//left
0,2,1,
0,3,2,
//back
1,2,6,
6,5,1,
//right
4,5,6,
6,7,4,
//top
2,3,6,
6,3,7,
//front
0,7,3,
0,4,7,
//bottom
0,1,5,
0,5,4
};
normalData = new Vector3[]
{
//left
new Vector3(-1.0f, 0.0f, 0.0f)
//back
//new Vector3(0.0f, 0.0f, -1.0f),
//right
//new Vector3(1.0f, 0.0f, 0.0f),
//top
//new Vector3(0.0f, 1.0f, 0.0f),
//front
//new Vector3(0.0f, 0.0f, 1.0f),
//bottom
//new Vector3(0.0f, -1.0f, 0.0f)
};
colorData = new Vector4[vertexData.Length];
for (int c = 0; c < vertexData.Length; c++)
{
colorData[c] = new Vector4(
0.5f, 0.5f, 0.5f, 1.0f);
};
viewMatrixData = new Matrix4[]
{
Matrix4.Identity
};
createVAO();
glControl1.Visible = false;
}
private void glControl1_Paint(object sender, PaintEventArgs e)
{
glControl1.MakeCurrent();
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.Enable(EnableCap.DepthTest);
GL.DepthFunc(DepthFunction.Less);
GL.BindVertexArray(vao);
if (wireFrameView == true)
{
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); //Wireframe
}
else
{
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
}
GL.DrawElements(BeginMode.Triangles, indiceData.Length, DrawElementsType.UnsignedInt, 0);
GL.BindVertexArray(0);
GL.Flush();
glControl1.SwapBuffers();
}
private void glControl1_Resize(object sender, EventArgs e)
{
if (glControl1.ClientSize.Height == 0)
{
glControl1.ClientSize = new System.Drawing.Size(glControl1.ClientSize.Width, 1);
}
GL.Viewport(0, 0, glControl1.ClientSize.Width, glControl1.ClientSize.Height);
}
private void resetForm()
{
/*Properties.Settings.Default["uniqueNames"] = uniqueNamesMenuItem.Checked;
@ -1509,6 +1876,7 @@ namespace Unity_Studio
assetInfoLabel.Text = null;
textPreviewBox.Visible = false;
fontPreviewBox.Visible = false;
glControl1.Visible = false;
lastSelectedItem = null;
lastLoadedAsset = null;
firstSortColumn = -1;

27
Unity Studio/fs.glsl Normal file
View File

@ -0,0 +1,27 @@
#version 140
in vec3 surfaceNormal;
in vec3 toLightVector;
in vec4 color;
out vec4 outputColor;
void main()
{
vec3 lightColor = vec3(0.5, 0.5, 0.5);
// Ambient
float ambientStrength = 0.9;
vec3 ambient = ambientStrength * lightColor;
// Diffuse
vec3 unitNormal = normalize(surfaceNormal);
vec3 unitLightVector = normalize(toLightVector);
float nDotProduct = dot(unitNormal, unitLightVector);
float brightness = clamp(nDotProduct, 0, 1); // max(nDotProduct, 0.0);
vec3 diffuse = brightness * lightColor;
// Output Color
vec4 result = color * vec4((ambient + diffuse/2), 0.0);
outputColor = result;
}

View File

@ -0,0 +1,52 @@
The Open Toolkit library license
Copyright (c) 2006 - 2014 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Third parties
OpenTK.Platform.Windows and OpenTK.Platform.X11 include portions of the Mono class library. These portions are covered by the following license:
Copyright (c) 2004 Novell, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
OpenTK.Compatibility includes portions of the Tao Framework library (Tao.OpenGl, Tao.OpenAl and Tao.Platform.Windows.SimpleOpenGlControl). These portions are covered by the following license:
Copyright <20>2003-2007 Tao Framework Team
http://www.taoframework.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
OpenTK.Half offers Half-to-Single and Single-to-Half conversions based on OpenEXR source code, which is covered by the following license:
Copyright (c) 2002, Industrial Light & Magic, a division of Lucas Digital Ltd. LLC. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Industrial Light & Magic nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

19
Unity Studio/vs.glsl Normal file
View File

@ -0,0 +1,19 @@
#version 140
in vec3 vertexPosition;
in vec3 normalDirection;
in vec4 vertexColor;
uniform mat4 viewMatrix;
out vec3 surfaceNormal;
out vec3 toLightVector;
out vec4 color;
void main()
{
vec3 lightPosition = vec3(200.0, 200.0, 200.0);
gl_Position = viewMatrix * vec4(vertexPosition, 1.0);
surfaceNormal = normalDirection;
toLightVector = lightPosition - vertexPosition;
color = vertexColor;
}