mirror of
https://github.com/ncblakely/GiantsTools
synced 2024-11-26 15:43:09 +01:00
Compare commits
5 Commits
b85a31a572
...
e18ebaf0bf
Author | SHA1 | Date | |
---|---|---|---|
|
e18ebaf0bf | ||
|
eb04aed5ca | ||
|
eb4f555606 | ||
|
0a8271c7df | ||
|
a492d9a51e |
@ -42,7 +42,7 @@ SetCompressor /SOLID lzma
|
||||
; MUI end ------
|
||||
|
||||
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
||||
OutFile "Output\GPatch1_498_212_0.exe"
|
||||
OutFile "Output\GPatch1_498_224_0.exe"
|
||||
InstallDir "$PROGRAMFILES\Giants\"
|
||||
InstallDirRegKey HKCU "SOFTWARE\PlanetMoon\Giants" "DestDir"
|
||||
ShowInstDetails hide
|
||||
@ -69,7 +69,8 @@ Section
|
||||
|
||||
ExecWait "$INSTDIR\Redist\VC_redist.x86.exe /install /passive /norestart" $0
|
||||
${If} $0 != 0
|
||||
MessageBox MB_OK "Setup failed to install the Visual C++ Runtime. Please visit www.microsoft.com and download the latest version of the Visual C++ redistributable."
|
||||
${AndIf} $0 != 1638 ;0x666 - Newer version installed
|
||||
MessageBox MB_OK "Setup failed to install the Visual C++ Runtime. Please visit www.microsoft.com and download the latest version of the Visual C++ 2019 redistributable."
|
||||
${EndIf}
|
||||
|
||||
RMDir /r "$INSTDIR\Redist" ; Delete temporary files
|
||||
@ -96,8 +97,6 @@ Section
|
||||
Delete $INSTDIR\bin\worldlist5.bin
|
||||
Delete $INSTDIR\bin\mappack1.gzp
|
||||
Delete $INSTDIR\bin\A-GRM1.gzp
|
||||
Delete $INSTDIR\bin\GData.gbt
|
||||
Delete $INSTDIR\bin\GData.h
|
||||
|
||||
SectionEnd
|
||||
|
||||
|
@ -178,8 +178,17 @@ namespace Giants.Launcher
|
||||
|
||||
await Task.WhenAll(gameVersionInfo, launcherVersionInfo);
|
||||
|
||||
await this.updater.UpdateApplication(ApplicationType.Game, gameVersionInfo.Result);
|
||||
await this.updater.UpdateApplication(ApplicationType.Launcher, launcherVersionInfo.Result);
|
||||
if (this.updater.IsUpdateRequired(ApplicationType.Game, gameVersionInfo.Result))
|
||||
{
|
||||
this.btnPlay.Enabled = false;
|
||||
await this.updater.UpdateApplication(ApplicationType.Game, gameVersionInfo.Result);
|
||||
}
|
||||
|
||||
if (this.updater.IsUpdateRequired(ApplicationType.Launcher, launcherVersionInfo.Result))
|
||||
{
|
||||
this.btnPlay.Enabled = false;
|
||||
await this.updater.UpdateApplication(ApplicationType.Launcher, launcherVersionInfo.Result);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<VersionInfo> GetVersionInfo(string appName)
|
||||
@ -229,6 +238,8 @@ namespace Giants.Launcher
|
||||
|
||||
private void LauncherForm_DownloadCompletedCallback(object sender, AsyncCompletedEventArgs e)
|
||||
{
|
||||
this.btnPlay.Enabled = true;
|
||||
|
||||
if (e.Cancelled)
|
||||
{
|
||||
return;
|
||||
|
38
Giants.Launcher/Forms/OptionsForm.Designer.cs
generated
38
Giants.Launcher/Forms/OptionsForm.Designer.cs
generated
@ -31,9 +31,7 @@
|
||||
this.cmbRenderer = new System.Windows.Forms.ComboBox();
|
||||
this.cmbResolution = new System.Windows.Forms.ComboBox();
|
||||
this.cmbAntialiasing = new System.Windows.Forms.ComboBox();
|
||||
this.cmbAnisotropy = new System.Windows.Forms.ComboBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
@ -79,41 +77,21 @@
|
||||
this.cmbAntialiasing.Size = new System.Drawing.Size(252, 21);
|
||||
this.cmbAntialiasing.TabIndex = 2;
|
||||
//
|
||||
// cmbAnisotropy
|
||||
//
|
||||
this.cmbAnisotropy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbAnisotropy.FormattingEnabled = true;
|
||||
this.cmbAnisotropy.Location = new System.Drawing.Point(124, 112);
|
||||
this.cmbAnisotropy.Name = "cmbAnisotropy";
|
||||
this.cmbAnisotropy.Size = new System.Drawing.Size(252, 21);
|
||||
this.cmbAnisotropy.TabIndex = 3;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Controls.Add(this.label3);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Controls.Add(this.cmbAnisotropy);
|
||||
this.groupBox1.Controls.Add(this.cmbRenderer);
|
||||
this.groupBox1.Controls.Add(this.cmbResolution);
|
||||
this.groupBox1.Controls.Add(this.cmbAntialiasing);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(382, 150);
|
||||
this.groupBox1.Size = new System.Drawing.Size(382, 116);
|
||||
this.groupBox1.TabIndex = 4;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Graphics Settings";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(17, 115);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(101, 13);
|
||||
this.label4.TabIndex = 7;
|
||||
this.label4.Text = "Anisotropic Filtering:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
@ -146,7 +124,7 @@
|
||||
this.groupBox2.Controls.Add(this.cmbMode);
|
||||
this.groupBox2.Controls.Add(this.chkTripleBuffering);
|
||||
this.groupBox2.Controls.Add(this.chkVSync);
|
||||
this.groupBox2.Location = new System.Drawing.Point(12, 168);
|
||||
this.groupBox2.Location = new System.Drawing.Point(12, 138);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(118, 93);
|
||||
this.groupBox2.TabIndex = 5;
|
||||
@ -188,7 +166,7 @@
|
||||
//
|
||||
// btnOK
|
||||
//
|
||||
this.btnOK.Location = new System.Drawing.Point(238, 238);
|
||||
this.btnOK.Location = new System.Drawing.Point(238, 208);
|
||||
this.btnOK.Name = "btnOK";
|
||||
this.btnOK.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnOK.TabIndex = 6;
|
||||
@ -199,7 +177,7 @@
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(319, 238);
|
||||
this.btnCancel.Location = new System.Drawing.Point(319, 208);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancel.TabIndex = 7;
|
||||
@ -209,7 +187,7 @@
|
||||
//
|
||||
// btnResetDefaults
|
||||
//
|
||||
this.btnResetDefaults.Location = new System.Drawing.Point(300, 168);
|
||||
this.btnResetDefaults.Location = new System.Drawing.Point(300, 138);
|
||||
this.btnResetDefaults.Name = "btnResetDefaults";
|
||||
this.btnResetDefaults.Size = new System.Drawing.Size(94, 23);
|
||||
this.btnResetDefaults.TabIndex = 8;
|
||||
@ -220,7 +198,7 @@
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.chkUpdates);
|
||||
this.groupBox3.Location = new System.Drawing.Point(136, 168);
|
||||
this.groupBox3.Location = new System.Drawing.Point(136, 138);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(127, 49);
|
||||
this.groupBox3.TabIndex = 6;
|
||||
@ -244,7 +222,7 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(406, 273);
|
||||
this.ClientSize = new System.Drawing.Size(406, 239);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.btnResetDefaults);
|
||||
@ -276,9 +254,7 @@
|
||||
private System.Windows.Forms.ComboBox cmbRenderer;
|
||||
private System.Windows.Forms.ComboBox cmbResolution;
|
||||
private System.Windows.Forms.ComboBox cmbAntialiasing;
|
||||
private System.Windows.Forms.ComboBox cmbAnisotropy;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
|
@ -65,11 +65,6 @@ namespace Giants.Launcher
|
||||
if (this.cmbAntialiasing.SelectedItem == null)
|
||||
this.cmbAntialiasing.SelectedIndex = 0;
|
||||
|
||||
var anisotropyOptions = (List<KeyValuePair<string, int>>)this.cmbAnisotropy.DataSource;
|
||||
this.cmbAnisotropy.SelectedItem = anisotropyOptions.Find(o => o.Value == GameSettings.Get<int>(RegistryKeys.AnisotropicFiltering));
|
||||
if (this.cmbAnisotropy.SelectedItem == null)
|
||||
this.cmbAnisotropy.SelectedIndex = 0;
|
||||
|
||||
this.chkUpdates.Checked = GameSettings.Get<int>(RegistryKeys.NoAutoUpdate) != 1;
|
||||
}
|
||||
|
||||
@ -137,23 +132,6 @@ namespace Giants.Launcher
|
||||
anisotropyOptions.Add(new KeyValuePair<string,int>(string.Format(Resources.OptionSamples, i), i));
|
||||
}
|
||||
}
|
||||
|
||||
// Try to keep current selection when repopulating
|
||||
int? currentValue = null;
|
||||
if (this.cmbAnisotropy.SelectedValue != null)
|
||||
{
|
||||
currentValue = (int)this.cmbAnisotropy.SelectedValue;
|
||||
}
|
||||
|
||||
this.cmbAnisotropy.DataSource = anisotropyOptions;
|
||||
this.cmbAnisotropy.DisplayMember = "Key";
|
||||
this.cmbAnisotropy.ValueMember = "Value";
|
||||
|
||||
if (currentValue != null)
|
||||
this.cmbAnisotropy.SelectedValue = currentValue;
|
||||
|
||||
if (this.cmbAnisotropy.SelectedValue == null)
|
||||
this.cmbAnisotropy.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void PopulateResolution()
|
||||
@ -234,7 +212,6 @@ namespace Giants.Launcher
|
||||
}
|
||||
|
||||
GameSettings.Modify(RegistryKeys.Antialiasing, this.cmbAntialiasing.SelectedValue);
|
||||
GameSettings.Modify(RegistryKeys.AnisotropicFiltering, this.cmbAnisotropy.SelectedValue);
|
||||
bool windowed = (WindowType)this.cmbMode.SelectedIndex == WindowType.Windowed || (WindowType)this.cmbMode.SelectedIndex == WindowType.Borderless;
|
||||
GameSettings.Modify(RegistryKeys.Windowed, windowed == true ? 1 : 0);
|
||||
bool borderless = (WindowType)this.cmbMode.SelectedIndex == WindowType.Borderless;
|
||||
|
@ -117,7 +117,4 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
@ -25,14 +25,29 @@ namespace Giants.Launcher
|
||||
this.updateProgressCallback = updateProgressCallback;
|
||||
}
|
||||
|
||||
public bool IsUpdateRequired(ApplicationType applicationType, VersionInfo versionInfo)
|
||||
{
|
||||
if (this.ToVersion(versionInfo.Version) > this.appVersions[applicationType])
|
||||
{
|
||||
// Display update prompt
|
||||
string updateMsg = applicationType == ApplicationType.Game ?
|
||||
string.Format(Resources.UpdateAvailableText, this.ToVersion(versionInfo.Version).ToString()) :
|
||||
string.Format(Resources.LauncherUpdateAvailableText, this.ToVersion(versionInfo.Version).ToString());
|
||||
|
||||
if (MessageBox.Show(updateMsg, Resources.UpdateAvailableTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Task UpdateApplication(ApplicationType applicationType, VersionInfo versionInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.ToVersion(versionInfo.Version) > this.appVersions[applicationType])
|
||||
{
|
||||
this.StartApplicationUpdate(applicationType, versionInfo);
|
||||
}
|
||||
this.StartApplicationUpdate(applicationType, versionInfo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -63,16 +78,6 @@ namespace Giants.Launcher
|
||||
|
||||
private void StartApplicationUpdate(ApplicationType applicationType, VersionInfo versionInfo)
|
||||
{
|
||||
// Display update prompt
|
||||
string updateMsg = applicationType == ApplicationType.Game ?
|
||||
string.Format(Resources.UpdateAvailableText, this.ToVersion(versionInfo.Version).ToString()) :
|
||||
string.Format(Resources.LauncherUpdateAvailableText, this.ToVersion(versionInfo.Version).ToString());
|
||||
|
||||
if (MessageBox.Show(updateMsg, Resources.UpdateAvailableTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
|
||||
{
|
||||
return; // User declined update
|
||||
}
|
||||
|
||||
string patchFileName = Path.GetFileName(versionInfo.InstallerUri.AbsoluteUri);
|
||||
string localPath = Path.Combine(Path.GetTempPath(), patchFileName);
|
||||
|
||||
|
@ -790,8 +790,8 @@ namespace Giants.WebApi.Clients
|
||||
|
||||
[Newtonsoft.Json.JsonProperty("numPlayers", Required = Newtonsoft.Json.Required.Always)]
|
||||
public int NumPlayers { get; set; }
|
||||
|
||||
[Newtonsoft.Json.JsonProperty("maxPlayers", Required = Newtonsoft.Json.Required.Always)]
|
||||
|
||||
[Newtonsoft.Json.JsonProperty("maxPlayers", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
|
||||
public int MaxPlayers { get; set; }
|
||||
|
||||
[Newtonsoft.Json.JsonProperty("gameState", Required = Newtonsoft.Json.Required.Always)]
|
||||
@ -930,4 +930,4 @@ namespace Giants.WebApi.Clients
|
||||
#pragma warning restore 1573
|
||||
#pragma warning restore 472
|
||||
#pragma warning restore 114
|
||||
#pragma warning restore 108
|
||||
#pragma warning restore 108
|
@ -5,6 +5,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/[controller]")]
|
||||
public class CommunityController : ControllerBase
|
||||
{
|
||||
|
@ -12,6 +12,7 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/[controller]")]
|
||||
public class CrashReportsController : ControllerBase
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ using Microsoft.Extensions.Logging;
|
||||
namespace Giants.Web.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/[controller]")]
|
||||
public class ServersController : ControllerBase
|
||||
{
|
||||
|
@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace Giants.WebApi.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/[controller]")]
|
||||
public class VersionController : ControllerBase
|
||||
{
|
||||
|
@ -12,6 +12,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.14.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.1.1" />
|
||||
<PackageReference Include="NSwag.AspNetCore" Version="13.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -2,6 +2,7 @@ using AutoMapper;
|
||||
using Giants.Services;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -23,6 +24,11 @@ namespace Giants.Web
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddControllers();
|
||||
services.AddApiVersioning(config =>
|
||||
{
|
||||
config.DefaultApiVersion = new ApiVersion(1, 0);
|
||||
config.AssumeDefaultVersionWhenUnspecified = true;
|
||||
});
|
||||
|
||||
services.AddOpenApiDocument();
|
||||
|
||||
|
@ -17,15 +17,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Shaders", "Shaders\Shaders.
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Giants.BinTools", "Giants.BinTools\Giants.BinTools.csproj", "{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Giants.EffectCompiler", "Giants.EffectCompiler\Giants.EffectCompiler.csproj", "{F5F3D216-9787-4CFF-88DF-8259CF667F88}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Giants.EffectCompiler", "Giants.EffectCompiler\Giants.EffectCompiler.csproj", "{F5F3D216-9787-4CFF-88DF-8259CF667F88}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Giants.EffectCompiler.Tests", "Giants.EffectCompiler.Tests\Giants.EffectCompiler.Tests.csproj", "{49423BA5-4A9F-47A3-9D2D-E83936272DD0}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Giants.EffectCompiler.Tests", "Giants.EffectCompiler.Tests\Giants.EffectCompiler.Tests.csproj", "{49423BA5-4A9F-47A3-9D2D-E83936272DD0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{08011335-C6A1-417B-ACBF-09F8F0D0EA09}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imp_gbs", "Plugins\imp_gbs\imp_gbs.vcxproj", "{448F061E-AE05-4E06-84A1-C95660FD048C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Hybrid|Any CPU = Hybrid|Any CPU
|
||||
Hybrid|x64 = Hybrid|x64
|
||||
Hybrid|x86 = Hybrid|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
@ -37,6 +44,12 @@ Global
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Hybrid|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Hybrid|Any CPU.Build.0 = Release|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Hybrid|x64.ActiveCfg = Release|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Hybrid|x64.Build.0 = Release|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Hybrid|x86.ActiveCfg = Release|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Hybrid|x86.Build.0 = Release|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0CD61424-4E74-4A48-A726-729FEA32C50C}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
@ -49,6 +62,12 @@ Global
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Hybrid|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Hybrid|Any CPU.Build.0 = Release|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Hybrid|x64.ActiveCfg = Release|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Hybrid|x64.Build.0 = Release|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Hybrid|x86.ActiveCfg = Release|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Hybrid|x86.Build.0 = Release|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D426FE47-231B-41F0-AC78-293D12EF66A0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
@ -61,6 +80,12 @@ Global
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Hybrid|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Hybrid|Any CPU.Build.0 = Release|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Hybrid|x64.ActiveCfg = Release|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Hybrid|x64.Build.0 = Release|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Hybrid|x86.ActiveCfg = Release|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Hybrid|x86.Build.0 = Release|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9A284C34-8F4B-4E20-B74B-1A0AF04EDBD1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
@ -73,6 +98,12 @@ Global
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Hybrid|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Hybrid|Any CPU.Build.0 = Release|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Hybrid|x64.ActiveCfg = Release|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Hybrid|x64.Build.0 = Release|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Hybrid|x86.ActiveCfg = Release|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Hybrid|x86.Build.0 = Release|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{612FD606-F072-4A04-9054-65BC592E9D3E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
@ -85,6 +116,12 @@ Global
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Hybrid|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Hybrid|Any CPU.Build.0 = Release|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Hybrid|x64.ActiveCfg = Release|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Hybrid|x64.Build.0 = Release|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Hybrid|x86.ActiveCfg = Release|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Hybrid|x86.Build.0 = Release|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
@ -92,11 +129,19 @@ Global
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D4C21170-82D4-4D1F-81EC-036835AC1238}.Release|x86.Build.0 = Release|Any CPU
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|x64.Build.0 = Debug|x64
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Debug|x86.Build.0 = Debug|Win32
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Hybrid|Any CPU.ActiveCfg = Release|x64
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Hybrid|Any CPU.Build.0 = Release|x64
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Hybrid|x64.ActiveCfg = Release|x64
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Hybrid|x64.Build.0 = Release|x64
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Hybrid|x86.ActiveCfg = Release|Win32
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Hybrid|x86.Build.0 = Release|Win32
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Release|Any CPU.Build.0 = Release|Win32
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Release|x64.ActiveCfg = Release|x64
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Release|x64.Build.0 = Release|x64
|
||||
{9A0AF60B-3C3B-45B7-B5E1-4C9997A68EBB}.Release|x86.ActiveCfg = Release|Win32
|
||||
@ -107,6 +152,12 @@ Global
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Hybrid|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Hybrid|Any CPU.Build.0 = Release|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Hybrid|x64.ActiveCfg = Release|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Hybrid|x64.Build.0 = Release|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Hybrid|x86.ActiveCfg = Release|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Hybrid|x86.Build.0 = Release|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6286A2C7-15F0-4D87-B928-4B012F9E0FFE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
@ -119,6 +170,12 @@ Global
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Hybrid|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Hybrid|Any CPU.Build.0 = Release|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Hybrid|x64.ActiveCfg = Release|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Hybrid|x64.Build.0 = Release|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Hybrid|x86.ActiveCfg = Release|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Hybrid|x86.Build.0 = Release|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F5F3D216-9787-4CFF-88DF-8259CF667F88}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
@ -131,16 +188,43 @@ Global
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Hybrid|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Hybrid|Any CPU.Build.0 = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Hybrid|x64.ActiveCfg = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Hybrid|x64.Build.0 = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Hybrid|x86.ActiveCfg = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Hybrid|x86.Build.0 = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Release|x64.Build.0 = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{49423BA5-4A9F-47A3-9D2D-E83936272DD0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Debug|x64.Build.0 = Debug|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Hybrid|Any CPU.ActiveCfg = Hybrid|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Hybrid|Any CPU.Build.0 = Hybrid|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Hybrid|x64.ActiveCfg = Hybrid|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Hybrid|x64.Build.0 = Hybrid|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Hybrid|x86.ActiveCfg = Hybrid|Win32
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Hybrid|x86.Build.0 = Hybrid|Win32
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Release|Any CPU.Build.0 = Release|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Release|x64.ActiveCfg = Release|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Release|x64.Build.0 = Release|x64
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{448F061E-AE05-4E06-84A1-C95660FD048C} = {08011335-C6A1-417B-ACBF-09F8F0D0EA09}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5B1F49CA-E8B9-4763-8476-FC8FB7A944E6}
|
||||
EndGlobalSection
|
||||
|
BIN
Plugins/exp_gts/exp_gts.dle
Normal file
BIN
Plugins/exp_gts/exp_gts.dle
Normal file
Binary file not shown.
BIN
Plugins/gts2gbs/gts2gbs.exe
Normal file
BIN
Plugins/gts2gbs/gts2gbs.exe
Normal file
Binary file not shown.
43
Plugins/imp_gbs/DLLEntry.cpp
Normal file
43
Plugins/imp_gbs/DLLEntry.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#include "Importer.h"
|
||||
|
||||
HINSTANCE hInstance;
|
||||
int controlsInit = FALSE;
|
||||
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
|
||||
{
|
||||
hInstance = hinstDLL; // Hang on to this DLL's instance handle.
|
||||
|
||||
if (!controlsInit) {
|
||||
controlsInit = TRUE;
|
||||
//InitCustomControls(hInstance); // Initialize MAX's custom controls
|
||||
InitCommonControls(); // Initialize Win95 controls
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
__declspec( dllexport ) const TCHAR* LibDescription()
|
||||
{
|
||||
return _T("LibDescription");
|
||||
}
|
||||
|
||||
//TODO: Must change this number when adding a new class
|
||||
__declspec( dllexport ) int LibNumberClasses()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
ClassDesc *GetSceneImportDesc();
|
||||
__declspec( dllexport ) ClassDesc* LibClassDesc(int i)
|
||||
{
|
||||
switch(i) {
|
||||
case 0: return GetSceneImportDesc();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
__declspec( dllexport ) ULONG LibVersion()
|
||||
{
|
||||
return VERSION_3DSMAX;
|
||||
}
|
143
Plugins/imp_gbs/GbsData.cpp
Normal file
143
Plugins/imp_gbs/GbsData.cpp
Normal file
@ -0,0 +1,143 @@
|
||||
#include "Importer.h"
|
||||
|
||||
void GbsData::Read(FILE* file)
|
||||
{
|
||||
DWORD versionHeader;
|
||||
fread(&versionHeader, 4, 1, file);
|
||||
if (versionHeader != GBS_VERSION)
|
||||
{
|
||||
throw std::exception("File does not appear to be a GBS file.");
|
||||
}
|
||||
|
||||
fread(&optionsflags, 4, 1, file);
|
||||
fread(&naverts, 4, 1, file);
|
||||
|
||||
averts.resize(naverts);
|
||||
for (int i = 0; i < naverts; i++)
|
||||
{
|
||||
fread(&averts.at(i).x, 4, 1, file);
|
||||
fread(&averts.at(i).y, 4, 1, file);
|
||||
fread(&averts.at(i).z, 4, 1, file);
|
||||
}
|
||||
if (FlagIsSet(optionsflags, GBSFlagNormals))
|
||||
{
|
||||
fread(&nndefs, 4, 1, file);
|
||||
fread(&sizendefs, 4, 1, file);
|
||||
ndefs.resize(sizendefs);
|
||||
|
||||
for (uint i = 0; i < sizendefs; i++)
|
||||
fread(&ndefs.at(i), 2, 1, file);
|
||||
}
|
||||
|
||||
fread(&nverts, 4, 1, file);
|
||||
iverts.resize(nverts);
|
||||
for (int i = 0; i < nverts; i++)
|
||||
fread(&iverts.at(i), 2, 1, file);
|
||||
|
||||
if (FlagIsSet(optionsflags, GBSFlagNormals))
|
||||
{
|
||||
inorms.resize(nverts);
|
||||
for (int i = 0; i < nverts; i++)
|
||||
fread(&inorms.at(i), 2, 1, file);
|
||||
}
|
||||
|
||||
if (FlagIsSet(optionsflags, GBSFlagUVs))
|
||||
{
|
||||
vertuv.resize(nverts);
|
||||
for (int i = 0; i < nverts; i++)
|
||||
{
|
||||
fread(&vertuv.at(i).u, 4, 1, file);
|
||||
fread(&vertuv.at(i).v, 4, 1, file);
|
||||
vertuv.at(i).v = vertuv.at(i).v + 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (FlagIsSet(optionsflags, GBSFlagRGBs))
|
||||
{
|
||||
vertrgb.resize(nverts);
|
||||
for (int i = 0; i < nverts; i++)
|
||||
{
|
||||
fread(&vertrgb.at(i).r, 1, 1, file);
|
||||
fread(&vertrgb.at(i).g, 1, 1, file);
|
||||
fread(&vertrgb.at(i).b, 1, 1, file);
|
||||
}
|
||||
}
|
||||
|
||||
// Get number of max objects
|
||||
fread(&nmobjs, 4, 1, file);
|
||||
MaxObjs.resize(nmobjs);
|
||||
for (auto& maxObj : MaxObjs)
|
||||
{
|
||||
FileMaxObj fileMaxObj;
|
||||
fread(&fileMaxObj, sizeof(FileMaxObj), 1, file);
|
||||
|
||||
maxObj.vstart = fileMaxObj.vstart;
|
||||
maxObj.vcount = fileMaxObj.vcount;
|
||||
maxObj.nstart = fileMaxObj.nstart;
|
||||
maxObj.ncount = fileMaxObj.ncount;
|
||||
maxObj.noffset = fileMaxObj.noffset;
|
||||
maxObj.fstart = 0;
|
||||
maxObj.fcount = 0;
|
||||
maxObj.sostart = 0;
|
||||
maxObj.socount = 0;
|
||||
}
|
||||
|
||||
VerifyMaxObjs();
|
||||
|
||||
// Get number of subobjects
|
||||
fread(&nsobjs, 4, 1, file);
|
||||
|
||||
SubObjs.resize(nsobjs);
|
||||
for (int ns = 0; ns < nsobjs; ns++)
|
||||
{
|
||||
SubObject& object = SubObjs.at(ns);
|
||||
fread(&object.objname, sizeof(object.objname), 1, file);
|
||||
fread(&object.maxobjindex, 4, 1, file);
|
||||
fread(&object.totaltris, 4, 1, file);
|
||||
fread(&object.ntris, 4, 1, file);
|
||||
|
||||
assert((object.ntris - 1) / 3 == object.totaltris);
|
||||
|
||||
object.tridata.resize(object.ntris + 1);
|
||||
fread(object.tridata.data(), sizeof(unsigned short) * object.ntris, 1, file);
|
||||
|
||||
fread(&object.vstart, 4, 1, file);
|
||||
fread(&object.vcount, 4, 1, file);
|
||||
if (FlagIsSet(optionsflags, GBSFlagUVs))
|
||||
{
|
||||
fread(&object.texname, 1, 32, file);
|
||||
fread(&object.texname2, 1, 32, file);
|
||||
}
|
||||
fread(&object.falloff, 4, 1, file);
|
||||
|
||||
if (FlagIsSet(optionsflags, GBSFlagRGBs))
|
||||
fread(&object.blend, 4, 1, file);
|
||||
|
||||
fread(&object.flags, 4, 1, file);
|
||||
fread(&object.emissive, 1, 4, file);
|
||||
fread(&object.ambient, 1, 4, file);
|
||||
fread(&object.diffuse, 1, 4, file);
|
||||
fread(&object.specular, 1, 4, file);
|
||||
fread(&object.power, 4, 1, file);
|
||||
|
||||
MaxObj& maxobj = MaxObjs.at(object.maxobjindex);
|
||||
maxobj.fcount += object.totaltris;
|
||||
if (!maxobj.socount)
|
||||
{
|
||||
maxobj.sostart = ns;
|
||||
}
|
||||
maxobj.socount++;
|
||||
}
|
||||
}
|
||||
|
||||
bool GbsData::VerifyMaxObjs()
|
||||
{
|
||||
int nmcount = 0;
|
||||
for (const auto& maxObj : MaxObjs)
|
||||
{
|
||||
nmcount += maxObj.vcount;
|
||||
}
|
||||
|
||||
assert(nmcount == naverts);
|
||||
return nmcount == naverts;
|
||||
}
|
77
Plugins/imp_gbs/GbsData.h
Normal file
77
Plugins/imp_gbs/GbsData.h
Normal file
@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
#define GBS_VERSION 0xaa0100be
|
||||
#define GBSFlagNormals 0x0001
|
||||
#define GBSFlagUVs 0x0002
|
||||
#define GBSFlagRGBs 0x0004
|
||||
#define GBSFlagMaxLit (1 << 31)
|
||||
|
||||
struct FileMaxObj
|
||||
{
|
||||
int vstart;
|
||||
int vcount;
|
||||
int nstart;
|
||||
int ncount;
|
||||
int noffset;
|
||||
};
|
||||
|
||||
struct MaxObj : FileMaxObj
|
||||
{
|
||||
int fstart;
|
||||
int fcount;
|
||||
int sostart;
|
||||
int socount;
|
||||
};
|
||||
|
||||
struct SubObject
|
||||
{
|
||||
char objname[32];
|
||||
DWORD maxobjindex;
|
||||
int ntris; // count of tridata (including preceding 'count' short)
|
||||
int totaltris;
|
||||
std::vector<unsigned short> tridata; // indexed tridata, value is pointer to iverts
|
||||
int vstart;
|
||||
int vcount;
|
||||
char texname[32];
|
||||
char texname2[32];
|
||||
float falloff;
|
||||
float blend;
|
||||
DWORD flags;
|
||||
DWORD emissive;
|
||||
DWORD ambient;
|
||||
DWORD diffuse;
|
||||
DWORD specular;
|
||||
float power;
|
||||
};
|
||||
|
||||
enum TransType
|
||||
{
|
||||
TransNone,
|
||||
TransAdd,
|
||||
TransSub,
|
||||
TransBlend
|
||||
};
|
||||
|
||||
struct GbsData
|
||||
{
|
||||
public:
|
||||
void Read(FILE* file);
|
||||
|
||||
DWORD optionsflags{};
|
||||
DWORD nndefs{};
|
||||
DWORD sizendefs{};
|
||||
std::vector<WORD> ndefs;
|
||||
std::vector<USHORT> inorms;
|
||||
int naverts{};
|
||||
std::vector<Point3> averts;
|
||||
int nsobjs{};
|
||||
int nmobjs{};
|
||||
std::vector<USHORT> iverts;
|
||||
std::vector<VertRGB> vertrgb;
|
||||
int nverts{};
|
||||
std::vector<UV> vertuv;
|
||||
std::vector<MaxObj> MaxObjs;
|
||||
std::vector<SubObject> SubObjs;
|
||||
private:
|
||||
bool VerifyMaxObjs();
|
||||
};
|
409
Plugins/imp_gbs/Importer.cpp
Normal file
409
Plugins/imp_gbs/Importer.cpp
Normal file
@ -0,0 +1,409 @@
|
||||
// Importer.cpp : Defines the entry point for the DLL application.
|
||||
//
|
||||
|
||||
#include "Importer.h"
|
||||
#include "StdUtil.h"
|
||||
|
||||
class ImpGbsClassDesc :
|
||||
public ClassDesc2
|
||||
{
|
||||
public:
|
||||
int IsPublic() { return TRUE; }
|
||||
VOID* Create(BOOL Loading) { return new GbsImporter; }
|
||||
const MCHAR* ClassName() { return _M("ClassName"); }
|
||||
SClass_ID SuperClassID() { return SCENE_IMPORT_CLASS_ID; }
|
||||
Class_ID ClassID() { return GIANTSIMP_CLASSID; }
|
||||
const MCHAR* Category() { return _M(""); }
|
||||
const MCHAR* InternalName() { return _M("GiantsImp"); }
|
||||
HINSTANCE HInstance() { return hInstance; }
|
||||
};
|
||||
|
||||
static ImpGbsClassDesc g_ImportCD;
|
||||
|
||||
ClassDesc* GetSceneImportDesc()
|
||||
{
|
||||
return &g_ImportCD;
|
||||
}
|
||||
|
||||
void DisplayMessage(const char* msg)
|
||||
{
|
||||
MessageBoxA(GetActiveWindow(), msg, "GBS Import Error", MB_OK);
|
||||
}
|
||||
|
||||
int GbsImporter::ExtCount()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
const MCHAR* GbsImporter::Ext(int n)
|
||||
{
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
return _M("gbs");
|
||||
default:
|
||||
return (_M(""));
|
||||
}
|
||||
}
|
||||
|
||||
const MCHAR* GbsImporter::LongDesc()
|
||||
{
|
||||
return _M("Long Description");
|
||||
}
|
||||
|
||||
const MCHAR* GbsImporter::ShortDesc()
|
||||
{
|
||||
return _M("Giants Model");
|
||||
}
|
||||
|
||||
const MCHAR* GbsImporter::AuthorName()
|
||||
{
|
||||
return _M("Author");
|
||||
}
|
||||
|
||||
const MCHAR* GbsImporter::CopyrightMessage()
|
||||
{
|
||||
return _M("Copyright");
|
||||
}
|
||||
|
||||
const MCHAR* GbsImporter::OtherMessage1()
|
||||
{
|
||||
return _M("OtherMessage1");
|
||||
}
|
||||
|
||||
const MCHAR* GbsImporter::OtherMessage2()
|
||||
{
|
||||
return _M("OtherMessage2");
|
||||
}
|
||||
|
||||
UINT GbsImporter::Version()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK AboutDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID GbsImporter::ShowAbout(HWND hWnd)
|
||||
{
|
||||
}
|
||||
|
||||
bool GbsImporter::EvaluateTriData(unsigned short** pTriData, unsigned short* pTriIdx, unsigned short* acount, int* pV1, int* pV2, int* pV3)
|
||||
{
|
||||
unsigned short* triData = *pTriData;
|
||||
unsigned short triIdx = *pTriIdx;
|
||||
unsigned short count = *acount;
|
||||
|
||||
if (!count)
|
||||
{
|
||||
if (!(count = *triData))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
triIdx = 0;
|
||||
}
|
||||
|
||||
*pV1 = triData[triIdx + 1];
|
||||
*pV2 = triData[triIdx + 2];
|
||||
*pV3 = triData[triIdx + 3];
|
||||
triIdx += 3;
|
||||
|
||||
if (!--count)
|
||||
{
|
||||
triData += *triData * 3 + 1;
|
||||
}
|
||||
|
||||
*pTriData = triData;
|
||||
*pTriIdx = triIdx;
|
||||
*acount = count;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int GbsImporter::DoImport(const MCHAR* Name, ImpInterface* EI, Interface* I, BOOL SupressPrompts)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_gbsData = ReadGbsFile(Name);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
DisplayMessage(e.what());
|
||||
}
|
||||
|
||||
BuildMeshes(EI);
|
||||
EI->RedrawViews();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GbsData GbsImporter::ReadGbsFile(const MCHAR* Name)
|
||||
{
|
||||
FILE* file = nullptr;
|
||||
try
|
||||
{
|
||||
errno_t err = _tfopen_s(&file, Name, (_T("rb")));
|
||||
if (err != 0)
|
||||
{
|
||||
throw std::exception("Could not open input file.");
|
||||
}
|
||||
|
||||
// Read object into memory
|
||||
GbsData gbsFile;
|
||||
gbsFile.Read(file);
|
||||
|
||||
fclose(file);
|
||||
return gbsFile;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
if (file)
|
||||
fclose(file);
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
int GbsImporter::GetLocalVertex(Point3* avert, const Mesh& mesh)
|
||||
{
|
||||
for (int i = 0; i < mesh.getNumVerts(); i++)
|
||||
{
|
||||
auto& vert = mesh.verts[i];
|
||||
|
||||
if (vert.x == avert->x && vert.y == avert->y && vert.z == avert->z)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
assert(false && "Invalid vertex for object");
|
||||
return -1;
|
||||
}
|
||||
|
||||
void GbsImporter::BuildMeshes(ImpInterface* EI)
|
||||
{
|
||||
for (const auto& mobj : m_gbsData.MaxObjs)
|
||||
{
|
||||
assert(mobj.fcount > 0);
|
||||
assert(mobj.vcount > 0);
|
||||
|
||||
Mesh mesh;
|
||||
mesh.setNumVerts(mobj.vcount);
|
||||
mesh.setNumTVerts(mobj.vcount);
|
||||
mesh.setNumVertCol(mobj.vcount);
|
||||
mesh.setNumFaces(mobj.fcount);
|
||||
mesh.setNumTVFaces(mobj.fcount);
|
||||
mesh.setNumVCFaces(mobj.fcount);
|
||||
|
||||
for (int i = 0; i < mobj.vcount; i++)
|
||||
{
|
||||
int vstart = mobj.vstart;
|
||||
int index = i + vstart;
|
||||
assert(index < m_gbsData.naverts);
|
||||
|
||||
UV* uvptr = (UV*)(m_gbsData.vertuv.data() + (mobj.vstart + i));
|
||||
|
||||
Point3 point(m_gbsData.averts[index].x, m_gbsData.averts[index].y, m_gbsData.averts[index].z);
|
||||
|
||||
mesh.setVert(i, point);
|
||||
mesh.setTVert(i, UVVert(uvptr->u, uvptr->v, 0.0f));
|
||||
//mesh.setTVert(i, UVVert(uvptr->u, -uvptr->v, 0.0f));
|
||||
}
|
||||
|
||||
Mtl* topLevelMaterial = nullptr;
|
||||
const char* objName = nullptr;
|
||||
int materialLevel = 0;
|
||||
|
||||
int faceIndex = 0;
|
||||
for (int subObjIndex = mobj.sostart; subObjIndex < mobj.sostart + mobj.socount; subObjIndex++)
|
||||
{
|
||||
SubObject& obj = m_gbsData.SubObjs.at(subObjIndex);
|
||||
if (mobj.socount > 1)
|
||||
{
|
||||
// Max object consists of multiple sub objects
|
||||
if (materialLevel == 0)
|
||||
{
|
||||
// Build parent material (either MixMat or multi-mtl):
|
||||
topLevelMaterial = BuildParentMaterial(obj, mobj.socount);
|
||||
objName = obj.objname;
|
||||
}
|
||||
|
||||
// Add sub-material:
|
||||
Mtl* subMtl = BuildMaterial(obj, topLevelMaterial);
|
||||
topLevelMaterial->SetSubMtl(materialLevel, subMtl);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just one subobj, build the single material and be done with it:
|
||||
topLevelMaterial = BuildMaterial(obj, nullptr);
|
||||
objName = obj.objname;
|
||||
}
|
||||
|
||||
int v1, v2, v3;
|
||||
unsigned short tidx = -1;
|
||||
unsigned short* tptr = obj.tridata.data();
|
||||
|
||||
unsigned short count = 0;
|
||||
while (EvaluateTriData(&tptr, &tidx, &count, &v1, &v2, &v3))
|
||||
{
|
||||
assert(faceIndex < mesh.getNumFaces());
|
||||
int vstart = mobj.vstart;
|
||||
Face& face = mesh.faces[faceIndex];
|
||||
|
||||
// Map from display to animation vertices, then to a "local" index for this sub object, starting from zero:
|
||||
int remappedV0 = GetLocalVertex(&m_gbsData.averts[m_gbsData.iverts.at(v1)], mesh);
|
||||
int remappedV1 = GetLocalVertex(&m_gbsData.averts[m_gbsData.iverts.at(v2)], mesh);
|
||||
int remappedV2 = GetLocalVertex(&m_gbsData.averts[m_gbsData.iverts.at(v3)], mesh);
|
||||
|
||||
VertColor v0Col = VertColor(m_gbsData.vertrgb.at(v1).r / 255.0f, m_gbsData.vertrgb.at(v1).g / 255.0f, m_gbsData.vertrgb.at(v1).b / 255.0f);
|
||||
VertColor v1Col = VertColor(m_gbsData.vertrgb.at(v2).r / 255.0f, m_gbsData.vertrgb.at(v2).g / 255.0f, m_gbsData.vertrgb.at(v2).b / 255.0f);
|
||||
VertColor v2Col = VertColor(m_gbsData.vertrgb.at(v3).r / 255.0f, m_gbsData.vertrgb.at(v3).g / 255.0f, m_gbsData.vertrgb.at(v3).b / 255.0f);
|
||||
|
||||
mesh.vertCol[remappedV0] = v0Col;
|
||||
mesh.vertCol[remappedV1] = v1Col;
|
||||
mesh.vertCol[remappedV2] = v2Col;
|
||||
|
||||
assert(remappedV0 >= 0 && remappedV1 >= 0 && remappedV2 >= 0);
|
||||
assert(remappedV0 < mobj.vcount && remappedV1 < mobj.vcount && remappedV2 < mobj.vcount);
|
||||
assert(remappedV0 < m_gbsData.naverts && remappedV1 < m_gbsData.naverts && remappedV2 < m_gbsData.naverts);
|
||||
|
||||
face.setVerts(remappedV0, remappedV1, remappedV2);
|
||||
face.setEdgeVisFlags(EDGE_VIS, EDGE_VIS, EDGE_VIS);
|
||||
face.setMatID(materialLevel);
|
||||
|
||||
TVFace& tvFace = mesh.tvFace[faceIndex];
|
||||
tvFace.setTVerts(remappedV0, remappedV1, remappedV2);
|
||||
|
||||
TVFace& vcFace = mesh.vcFace[faceIndex];
|
||||
vcFace.setTVerts(remappedV0, remappedV1, remappedV2);
|
||||
|
||||
faceIndex++;
|
||||
}
|
||||
|
||||
materialLevel++;
|
||||
}
|
||||
|
||||
mesh.buildNormals();
|
||||
mesh.buildBoundingBox();
|
||||
mesh.InvalidateEdgeList();
|
||||
|
||||
TriObject* tri = CreateNewTriObject();
|
||||
tri->mesh = mesh;
|
||||
Matrix3 tm;
|
||||
tm.IdentityMatrix();
|
||||
|
||||
ImpNode* Node = EI->CreateNode();
|
||||
if (!Node)
|
||||
{
|
||||
throw std::exception("Could not create Node");
|
||||
}
|
||||
|
||||
Node->Reference(tri);
|
||||
Node->SetTransform(0, tm);
|
||||
EI->AddNodeToScene(Node);
|
||||
INode* iNode = Node->GetINode();
|
||||
iNode->SetMtl(topLevelMaterial);
|
||||
Node->SetName(util::to_wstring(objName).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Mtl* GbsImporter::BuildParentMaterial(SubObject& obj, int numSubMaterials)
|
||||
{
|
||||
// Check if we need to create a MixMat blend material
|
||||
// (this check is iffy, not fully certain how to identify MixMat exports but this seems close enough)
|
||||
if (obj.blend > 0.50 && (obj.flags & 0x10 || obj.flags & 0x20))
|
||||
{
|
||||
//if (bitmapTex)
|
||||
//{
|
||||
// //bitmapTex->GetUVGen()->SetUVWSource(2);
|
||||
//}
|
||||
|
||||
// Create custom MixMat material (from official 3dsmax plugin)
|
||||
Mtl* mixMatMaterial = (Mtl*)CreateInstance(SClass_ID(MATERIAL_CLASS_ID), Class_ID(MIXMAT_CLASS_ID, 0));
|
||||
mixMatMaterial->SetName(util::to_wstring(obj.objname).c_str());
|
||||
|
||||
int ns = mixMatMaterial->NumSubMtls();
|
||||
|
||||
// Set the blend value
|
||||
IParamBlock2* parameterBlock = mixMatMaterial->GetParamBlock(0);
|
||||
parameterBlock->SetValue(0, 0, obj.blend);
|
||||
|
||||
return mixMatMaterial;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Standard multi-material
|
||||
MultiMtl* multiMtl = NewDefaultMultiMtl();
|
||||
multiMtl->SetName(util::to_wstring(obj.objname).c_str());
|
||||
multiMtl->SetNumSubMtls(numSubMaterials);
|
||||
|
||||
return multiMtl;
|
||||
}
|
||||
}
|
||||
|
||||
Mtl* GbsImporter::BuildMaterial(SubObject& obj, Mtl* parentMaterial)
|
||||
{
|
||||
BitmapTex* bitmapTex = nullptr;
|
||||
|
||||
if (obj.texname && obj.texname[0])
|
||||
{
|
||||
std::wstring mapName = util::to_wstring(obj.texname).c_str();
|
||||
mapName += L".tga"; // DDS partially supported but not in use, okay to hardcode for now
|
||||
|
||||
bitmapTex = NewDefaultBitmapTex();
|
||||
bitmapTex->SetName(util::to_wstring(obj.texname).c_str());
|
||||
bitmapTex->SetMapName(mapName.c_str());
|
||||
}
|
||||
|
||||
StdMat2* stdMat = NewDefaultStdMat();
|
||||
if (FlagIsSet(obj.flags, GBSFlagMaxLit) || parentMaterial)
|
||||
{
|
||||
// This isn't quite right, not all models with blend materials have this flag set. See ripper.gbs.
|
||||
// Behavior is correct enough for now though.
|
||||
stdMat->SetWireUnits(TRUE);
|
||||
}
|
||||
|
||||
stdMat->EnableMap(ID_DI, true);
|
||||
|
||||
if (obj.flags & 0x10)
|
||||
{
|
||||
stdMat->SetTransparencyType(TRANSP_ADDITIVE);
|
||||
}
|
||||
else if (obj.flags & 0x20)
|
||||
{
|
||||
stdMat->SetTransparencyType(TRANSP_SUBTRACTIVE);
|
||||
}
|
||||
stdMat->SetShinStr(1.0f, 0);
|
||||
stdMat->SetOpacFalloff(obj.falloff, 0);
|
||||
|
||||
if (obj.emissive != 0)
|
||||
{
|
||||
Color emissive(GetRValue(obj.emissive), GetGValue(obj.emissive), GetBValue(obj.emissive));
|
||||
stdMat->SetSelfIllumColor(emissive, 0);
|
||||
}
|
||||
|
||||
if (bitmapTex)
|
||||
{
|
||||
stdMat->SetSubTexmap(ID_DI, bitmapTex);
|
||||
}
|
||||
|
||||
Color diffuse(GetRValue(obj.diffuse), GetGValue(obj.diffuse), GetBValue(obj.diffuse));
|
||||
stdMat->SetDiffuse(diffuse, 0);
|
||||
Color ambient(GetRValue(obj.ambient), GetGValue(obj.ambient), GetBValue(obj.ambient));
|
||||
stdMat->SetAmbient(ambient, 0);
|
||||
Color specular(GetRValue(obj.specular), GetGValue(obj.specular), GetBValue(obj.specular));
|
||||
stdMat->SetSpecular(specular, 0);
|
||||
stdMat->SetShininess(obj.power / 100.0f, 0);
|
||||
|
||||
stdMat->SetName(util::to_wstring(obj.objname).c_str());
|
||||
|
||||
return stdMat;
|
||||
}
|
||||
|
||||
BOOL GbsImporter::SupportsOptions(int Ext, DWORD Options)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
39
Plugins/imp_gbs/Importer.h
Normal file
39
Plugins/imp_gbs/Importer.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "GbsData.h"
|
||||
|
||||
#define GIANTSIMP_CLASSID Class_ID(0x552cac79, 0x46f2d727)
|
||||
|
||||
class GbsImporter : public SceneImport
|
||||
{
|
||||
public:
|
||||
static HWND hParams;
|
||||
|
||||
int ExtCount(); // Number of extensions supported
|
||||
const MCHAR* Ext(int n); // Extension #n (i.e. "3DS")
|
||||
const MCHAR* LongDesc(); // Long ASCII description (i.e. "Autodesk 3D Studio File")
|
||||
const MCHAR* ShortDesc(); // Short ASCII description (i.e. "3D Studio")
|
||||
const MCHAR* AuthorName(); // ASCII Author name
|
||||
const MCHAR* CopyrightMessage(); // ASCII Copyright message
|
||||
const MCHAR* OtherMessage1(); // Other message #1
|
||||
const MCHAR* OtherMessage2(); // Other message #2
|
||||
unsigned int Version(); // Version number * 100 (i.e. v3.01 = 301)
|
||||
void ShowAbout(HWND hWnd); // Show DLL's "About..." box
|
||||
int DoImport(const MCHAR *name,ImpInterface *i,Interface *gi, BOOL suppressPrompts=FALSE); // Import file
|
||||
|
||||
//Constructor/Destructor
|
||||
BOOL SupportsOptions(int Ext,DWORD Options);
|
||||
|
||||
private:
|
||||
GbsData ReadGbsFile(const MCHAR* Name);
|
||||
Mtl* BuildParentMaterial(SubObject& obj, int numSubMaterials);
|
||||
Mtl* BuildMaterial(SubObject& obj, Mtl* parentMaterial);
|
||||
int GetLocalVertex(Point3* avert, const Mesh& mesh);
|
||||
void BuildMeshes(ImpInterface* EI);
|
||||
bool EvaluateTriData(unsigned short** pTriData, unsigned short* pTriIdx, unsigned short* acount, int* pV1, int* pV2, int* pV3);
|
||||
|
||||
FILE* m_OpenFile{};
|
||||
GbsData m_gbsData;
|
||||
};
|
||||
|
||||
extern HINSTANCE hInstance;
|
22
Plugins/imp_gbs/StdUtil.h
Normal file
22
Plugins/imp_gbs/StdUtil.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <codecvt>
|
||||
|
||||
namespace util
|
||||
{
|
||||
|
||||
inline std::wstring to_wstring(const std::string_view& sourceString)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
|
||||
return converter.from_bytes(sourceString.data());
|
||||
}
|
||||
|
||||
inline std::string to_string(const std::wstring_view& sourceString)
|
||||
{
|
||||
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
||||
std::wstring_convert<convert_typeX, wchar_t> converterX;
|
||||
|
||||
return converterX.to_bytes(sourceString.data());
|
||||
}
|
||||
}
|
8
Plugins/imp_gbs/imp_gbs.def
Normal file
8
Plugins/imp_gbs/imp_gbs.def
Normal file
@ -0,0 +1,8 @@
|
||||
LIBRARY imp_gbs
|
||||
EXPORTS
|
||||
LibDescription @1
|
||||
LibNumberClasses @2
|
||||
LibClassDesc @3
|
||||
LibVersion @4
|
||||
SECTIONS
|
||||
.data READ WRITE
|
191
Plugins/imp_gbs/imp_gbs.vcxproj
Normal file
191
Plugins/imp_gbs/imp_gbs.vcxproj
Normal file
@ -0,0 +1,191 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Hybrid|x64">
|
||||
<Configuration>Hybrid</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{448F061E-AE05-4E06-84A1-C95660FD048C}</ProjectGuid>
|
||||
<RootNamespace>GiantsExp</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>imp_gbs</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Hybrid|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Hybrid|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>16.0.30427.251</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Hybrid|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Hybrid|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>$(ADSK_3DSMAX_SDK_2021)\include;$(GIANTS_SDK_PATH)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;GIANTSIMP_EXPORTS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0000</Culture>
|
||||
<ResourceOutputFileName>
|
||||
</ResourceOutputFileName>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/def:imp_gbs.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;bmm.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;vfw32.lib;mnmath.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>$(ADSK_3DSMAX_SDK_2021)\lib\x64\Release;\..\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>NotSet</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<ImportLibrary>$(OutDir)GiantsImp.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(TargetPath)" "$(ADSK_3DSMAX_x64_2021)\stdplugs\$(TargetName).dli</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>$(ADSK_3DSMAX_SDK_2021)\include;$(GIANTS_SDK_PATH)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;GIANTSIMP_EXPORTS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0000</Culture>
|
||||
<ResourceOutputFileName>
|
||||
</ResourceOutputFileName>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/def:imp_gbs.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;bmm.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;vfw32.lib;mnmath.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>$(ADSK_3DSMAX_SDK_2021)\lib\x64\Release;\..\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>NotSet</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(TargetPath)" "$(ADSK_3DSMAX_x64_2021)\stdplugs\$(TargetName).dli</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<AdditionalIncludeDirectories>$(ADSK_3DSMAX_SDK_2021)\include;$(GIANTS_SDK_PATH)\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GIANTSIMP_EXPORTS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<ResourceOutputFileName>
|
||||
</ResourceOutputFileName>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/def:imp_gbs.def %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;bmm.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;manipsys.lib;paramblk2.lib;vfw32.lib;mnmath.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(ADSK_3DSMAX_SDK_2021)\lib\x64\Release;\..\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<ImportLibrary>$(OutDir)GiantsImp.lib</ImportLibrary>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(TargetPath)" "$(ADSK_3DSMAX_x64_2021)\stdplugs\$(TargetName).dli</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DLLEntry.cpp" />
|
||||
<ClCompile Include="GbsData.cpp" />
|
||||
<ClCompile Include="Importer.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Hybrid|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="GbsData.h" />
|
||||
<ClInclude Include="Importer.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="StdUtil.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="imp_gbs.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
46
Plugins/imp_gbs/imp_gbs.vcxproj.filters
Normal file
46
Plugins/imp_gbs/imp_gbs.vcxproj.filters
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DLLEntry.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GbsData.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Importer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GbsData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Importer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StdUtil.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="imp_gbs.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
0
Plugins/imp_gbs/stdafx.cpp
Normal file
0
Plugins/imp_gbs/stdafx.cpp
Normal file
17
Plugins/imp_gbs/stdafx.h
Normal file
17
Plugins/imp_gbs/stdafx.h
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
// Windows Header Files:
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#include <windows.h>
|
||||
|
||||
// 3dsmax headers
|
||||
#include <max.h>
|
||||
#include <iparamm2.h>
|
||||
#include <stdmat.h>
|
||||
|
||||
// STL
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// Game SDK includes
|
||||
#include <DataTypes.h>
|
@ -67,6 +67,7 @@
|
||||
<ShaderType>Effect</ShaderType>
|
||||
<ShaderModel>2.0</ShaderModel>
|
||||
<EntryPointName />
|
||||
<AdditionalOptions>/Gec %(AdditionalOptions)</AdditionalOptions>
|
||||
</FxCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
@ -74,19 +75,42 @@
|
||||
<ShaderType>Effect</ShaderType>
|
||||
<ShaderModel>2.0</ShaderModel>
|
||||
<EntryPointName />
|
||||
<AdditionalOptions>/Gec %(AdditionalOptions)</AdditionalOptions>
|
||||
</FxCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="fx\LandBump.fx" />
|
||||
<FxCompile Include="fx\Ocean.fx">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/Gec %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/Gec %(AdditionalOptions)</AdditionalOptions>
|
||||
</FxCompile>
|
||||
<FxCompile Include="fx\Sky.fx">
|
||||
<CustomBuild Include="fx\LandBump.fx">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="fx\Ocean.fx">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="fx\Sky.fx">
|
||||
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
</EntryPointName>
|
||||
</FxCompile>
|
||||
<FxCompile Include="fx\Water.fx" />
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="fx\Water.fx">
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</AdditionalIncludeDirectories>
|
||||
<FileType>Document</FileType>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fxo\%(Filename).fxo</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(JUN10SDKUTILPATH)\fxc.exe" /LD /Zi /Tfx_2_0 %(FullPath) /Fo fxo\%(Filename).fxo</Command>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
@ -21,19 +21,6 @@ float4 g_TextureFactor : TextureFactor;
|
||||
int g_NumLights = 0;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
//The sizes of the various terrain UV Coordinates
|
||||
float detailScale = 1;
|
||||
float diffuseScale = 5;
|
||||
float globalScale;
|
||||
float detailMapStrength = 1;
|
||||
|
||||
float3 sunlightVector = float3(.5,.5,.8);
|
||||
|
||||
//The Colour (and brightness) of the Sunlight
|
||||
float3 lightColour = float3(2,2,2);
|
||||
//The colour (and birghtness) of the ambient light
|
||||
float3 ambientColour = float3(.1,.1,.1);
|
||||
|
||||
|
||||
texture g_LandTexture;
|
||||
texture g_LandBumpTexture;
|
||||
@ -99,11 +86,11 @@ float4 bx2(float4 x)
|
||||
return float4(2.0f * x.xyzw - 1.0f);
|
||||
}
|
||||
|
||||
|
||||
VS_OUTPUT_BUMP LandBumpVS( float4 vPos : POSITION,
|
||||
float3 vNormal : NORMAL,
|
||||
float4 vDiffuse : COLOR0,
|
||||
float4 vDiffuse2 : COLOR1)
|
||||
VS_OUTPUT_BUMP LandBumpVS(
|
||||
float4 vPos : POSITION,
|
||||
float3 vNormal : NORMAL,
|
||||
float4 vDiffuse : COLOR0,
|
||||
float4 vDiffuse2 : COLOR1)
|
||||
{
|
||||
VS_OUTPUT_BUMP Output;
|
||||
|
||||
@ -137,17 +124,9 @@ float4 LandBumpPS(VS_OUTPUT_BUMP input) : COLOR0
|
||||
|
||||
float3 normalMap;
|
||||
normalMap = saturate((float4)dot((float3)normal, (float3)normalcol)).xyz;
|
||||
#ifdef MIX_4X
|
||||
float3 texel = tex2D(g_LandTextureSampler, input.LandTextureUV).rgb * tex2D(g_LandTextureSampler, input.LandTextureUV * -0.25).rgb * 4;
|
||||
float3 finalColor = 2.0 * (normalMap * (texel) + input.LandBumpDiffuse);
|
||||
#else
|
||||
float3 finalColor = 2.0 * (normalMap * (tex2D(g_LandTextureSampler, input.LandTextureUV)) + input.LandBumpDiffuse);
|
||||
//finalColor *= tex2D(g_ShoreTextureSampler, input.ShoreTextureUV);
|
||||
#endif
|
||||
|
||||
//finalColor = (g_TextureFactor * (1 - input.LandDiffuse)) + finalColor;
|
||||
|
||||
for (int i = 0; i < MAX_LIGHTS; i++)
|
||||
for (int i = 0; i < g_NumLights; i++)
|
||||
{
|
||||
// Get light direction for this fragment
|
||||
float3 lightDir = normalize(input.WorldPos - g_LightPositions[i]); // per pixel diffuse lighting
|
||||
@ -171,135 +150,7 @@ technique LandBump
|
||||
pass P0
|
||||
{
|
||||
VertexShader = compile vs_2_0 LandBumpVS();
|
||||
PixelShader = compile ps_2_0 LandBumpPS();
|
||||
}
|
||||
}
|
||||
|
||||
VS_OUTPUT_BUMP LandNormalVS( float4 vPos : POSITION,
|
||||
float3 vNormal : NORMAL,
|
||||
float4 vDiffuse : COLOR0,
|
||||
float4 vDiffuse2 : COLOR1)
|
||||
{
|
||||
VS_OUTPUT_BUMP Output;
|
||||
|
||||
// Transform the position from object space to homogeneous projection space
|
||||
Output.Position = mul(vPos, g_mWorldViewProjection);
|
||||
|
||||
Output.LandBumpDiffuse = vDiffuse2 * .5f;
|
||||
Output.LandBumpDiffuse.a = 1.0f;
|
||||
|
||||
//Output.LandDiffuse
|
||||
Output.LandDiffuse.rgb = vDiffuse;
|
||||
Output.LandDiffuse.a = 1.0f;
|
||||
|
||||
Output.WorldPos = mul(vPos, g_World);
|
||||
|
||||
// Set dynamically generated tex coords
|
||||
Output.LandBumpTextureUV = mul(vPos, g_TexGenTransform0);
|
||||
Output.LandTextureUV = mul(vPos, g_TexGenTransform1);
|
||||
Output.ShoreTextureUV = mul(vPos, g_ShoreGen);
|
||||
|
||||
// Transform the normal from object space to world space
|
||||
Output.Normal = normalize(mul(vNormal, (float3x3)g_World)); // normal (world space)
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
||||
float4 LandNormalPS(VS_OUTPUT_BUMP input) : COLOR0
|
||||
{
|
||||
float4 Output;
|
||||
//Get Global Normal from the full terrain normal map
|
||||
float3 Normal = tex2D(g_LandBumpTextureSampler, input.LandTextureUV);
|
||||
Normal[0] -= .5;
|
||||
Normal[1] -= .5;
|
||||
Normal[2] -= .5;
|
||||
Normal = normalize(Normal);
|
||||
|
||||
|
||||
//{
|
||||
//
|
||||
// //Get Detail Normal from the detail map
|
||||
// float3 detailNormalMap = (tex2D(g_LandDetailTextureSampler, input.LandTextureUV*100/detailScale));
|
||||
// detailNormalMap[0] -= .5;
|
||||
// detailNormalMap[1] -= .5;
|
||||
// detailNormalMap[2] -= .5;
|
||||
// //Multiply Detail Normal by detailMapStrength
|
||||
// detailNormalMap[0] = mul(detailNormalMap[0], detailMapStrength);
|
||||
// detailNormalMap[1] = mul(detailNormalMap[1], detailMapStrength);
|
||||
//
|
||||
// //Normalize detail Normal
|
||||
// detailNormalMap = normalize(detailNormalMap);
|
||||
//
|
||||
// if(false)
|
||||
// {
|
||||
// //Generate the Tangent Basis for the Detail Normal Map.
|
||||
// float3x3 tangentBasis;
|
||||
//
|
||||
// tangentBasis[0] = cross(Normal, float3(1,0,0));
|
||||
// tangentBasis[1] = cross(Normal, tangentBasis[0]);
|
||||
// tangentBasis[2] = Normal;
|
||||
//
|
||||
// detailNormalMap = detailNormalMap, detailMapStrength;
|
||||
//
|
||||
// Normal = mul(detailNormalMap, tangentBasis);
|
||||
// Normal = normalize(Normal);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Normal = normalize(Normal*2+detailNormalMap*detailMapStrength);
|
||||
// }
|
||||
//}
|
||||
|
||||
float3 sv = normalize(sunlightVector);
|
||||
float3 lightLevel;
|
||||
lightLevel[0] = max(dot(Normal, sv), 0)*lightColour[0]*2;//+ambientColour[0];
|
||||
lightLevel[1] = max(dot(Normal, sv), 0)*lightColour[1]*2;//+ambientColour[1];
|
||||
lightLevel[2] = max(dot(Normal, sv), 0)*lightColour[2]*2;//+ambientColour[2];
|
||||
|
||||
return float4(tex2D(g_LandTextureSampler, input.LandTextureUV) * lightLevel, 1) + input.LandBumpDiffuse;
|
||||
|
||||
|
||||
|
||||
float4 normal = bx2(tex2D(g_LandBumpTextureSampler, input.LandBumpTextureUV));
|
||||
float4 normalcol = bx2(input.LandDiffuse);
|
||||
|
||||
float3 normalMap;
|
||||
normalMap = saturate((float4)dot((float3)normal, (float3)normalcol)).xyz;
|
||||
#ifdef MIX_4X
|
||||
float3 texel = tex2D(g_LandTextureSampler, input.LandTextureUV).rgb * tex2D(g_LandTextureSampler, input.LandTextureUV * -0.25).rgb * 4;
|
||||
float3 finalColor = 2.0 * (normalMap * (texel) + input.LandBumpDiffuse);
|
||||
#else
|
||||
float3 finalColor = 2.0 * (normalMap * (tex2D(g_LandTextureSampler, input.LandTextureUV)) + input.LandBumpDiffuse);
|
||||
//finalColor *= tex2D(g_ShoreTextureSampler, input.ShoreTextureUV);
|
||||
#endif
|
||||
|
||||
//finalColor = (g_TextureFactor * (1 - input.LandDiffuse)) + finalColor;
|
||||
|
||||
for (int i = 0; i < MAX_LIGHTS; i++)
|
||||
{
|
||||
// Get light direction for this fragment
|
||||
float3 lightDir = normalize(input.WorldPos - g_LightPositions[i]); // per pixel diffuse lighting
|
||||
|
||||
// Note: Non-uniform scaling not supported
|
||||
float diffuseLighting = saturate(dot(input.Normal, -lightDir));
|
||||
|
||||
// Introduce fall-off of light intensity
|
||||
diffuseLighting *= (g_LightRangeSquared[i] / dot(g_LightPositions[i] - input.WorldPos, g_LightPositions[i] - input.WorldPos));
|
||||
|
||||
float4 diffuseColor = diffuseLighting * g_LightDiffuseColors[i];
|
||||
|
||||
finalColor += diffuseColor;
|
||||
}
|
||||
|
||||
return float4(finalColor, 1);
|
||||
}
|
||||
|
||||
technique LandNormal
|
||||
{
|
||||
pass P0
|
||||
{
|
||||
VertexShader = compile vs_2_0 LandNormalVS();
|
||||
PixelShader = compile ps_2_0 LandNormalPS();
|
||||
PixelShader = compile ps_2_0 LandBumpPS();
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,9 +166,10 @@ struct VS_OUTPUT
|
||||
float3 WorldPos : TEXCOORD2;
|
||||
};
|
||||
|
||||
VS_OUTPUT LandscapeVS( float4 vPos : POSITION,
|
||||
float3 vNormal : NORMAL,
|
||||
float4 vDiffuse : COLOR0)
|
||||
VS_OUTPUT LandscapeVS(
|
||||
float4 vPos : POSITION,
|
||||
float3 vNormal : NORMAL,
|
||||
float4 vDiffuse : COLOR0)
|
||||
{
|
||||
VS_OUTPUT Output;
|
||||
|
||||
@ -342,7 +194,7 @@ float4 LandscapePS(VS_OUTPUT input) : COLOR0
|
||||
{
|
||||
float4 finalColor = 0;
|
||||
|
||||
for (int i = 0; i < MAX_LIGHTS; i++)
|
||||
for (int i = 0; i < g_NumLights; i++)
|
||||
{
|
||||
// Get light direction for this fragment
|
||||
float3 lightDir = normalize(input.WorldPos - g_LightPositions[i]); // per pixel diffuse lighting
|
||||
@ -358,11 +210,7 @@ float4 LandscapePS(VS_OUTPUT input) : COLOR0
|
||||
finalColor += diffuseColor;
|
||||
}
|
||||
|
||||
#ifdef MIX_4X
|
||||
float3 texel = tex2D(g_LandTextureSampler, input.TextureUV).rgb * tex2D(g_LandTextureSampler, input.TextureUV * -0.25).rgb * 4;
|
||||
#else
|
||||
float3 texel = tex2D(g_LandTextureSampler, input.TextureUV);
|
||||
#endif
|
||||
return float4(saturate((texel.xyz + input.Diffuse) + (finalColor)), 1.0f);
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,6 @@ void RenderSceneVS(
|
||||
out float2 oTexCoord0 : TEXCOORD0 )
|
||||
{
|
||||
oPosition = mul(iPosition, g_mWorldViewProjection);
|
||||
//oPosition = mul(iPosition, g_World);
|
||||
//oPosition = mul(oPosition, g_View);
|
||||
//oPosition = mul(oPosition, g_Projection);
|
||||
oColor0 = float4(1, 1, 1, 1);
|
||||
oTexCoord0 = iTexCoord0;
|
||||
}
|
||||
@ -40,12 +37,7 @@ float4 RenderScenePS(
|
||||
float4 iColor : COLOR,
|
||||
float2 iTexCoord0 : TEXCOORD0) : COLOR0
|
||||
{
|
||||
//return float4(1, 1, 1, 1);
|
||||
return tex2D(g_SkyTextureSampler, iTexCoord0);
|
||||
//oColor0 = tex2D(TextureDiffuse0Sampler, iTexCoord0);
|
||||
//float intensity = dot(oColor0.rgb, float3(0.3, 0.59, 0.11));
|
||||
//float p = smoothstep(intensityThreshold, 1.f, intensity);
|
||||
//oColor0 = oColor0 * p * colorMultiplier;
|
||||
}
|
||||
|
||||
technique RenderWithPixelShader
|
||||
|
BIN
Shaders/fxo/LandBump.fxo
Normal file
BIN
Shaders/fxo/LandBump.fxo
Normal file
Binary file not shown.
BIN
Shaders/fxo/Ocean.fxo
Normal file
BIN
Shaders/fxo/Ocean.fxo
Normal file
Binary file not shown.
BIN
Shaders/fxo/Sky.fxo
Normal file
BIN
Shaders/fxo/Sky.fxo
Normal file
Binary file not shown.
BIN
Shaders/fxo/Water.fxo
Normal file
BIN
Shaders/fxo/Water.fxo
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user