1
0
mirror of synced 2025-01-19 01:14:08 +01:00

Fix assimp issues and emitter saving

This commit is contained in:
KillzXGaming 2019-05-02 14:31:09 -04:00
parent bb73c85ae0
commit 8674b462b8
12 changed files with 229 additions and 107 deletions

Binary file not shown.

View File

@ -567,7 +567,7 @@ namespace FirstPlugin
child.Write(writer, header);
}
using (writer.TemporarySeek(_emitterPos, SeekOrigin.Begin))
using (writer.TemporarySeek(_emitterPos + BinaryDataOffset +16 + 64, SeekOrigin.Begin))
{
((Emitter)BinaryData).Write(writer, header);
}
@ -1006,26 +1006,24 @@ namespace FirstPlugin
writer.Write(Color0Array[i].R);
writer.Write(Color0Array[i].G);
writer.Write(Color0Array[i].B);
writer.Seek(4);
writer.Seek(4, SeekOrigin.Current);
}
for (int i = 0; i < 8; i++)
{
writer.Write(Color0Array[i].A);
writer.Seek(12);
int alpha = Utils.FloatToIntClamp(Color0Array[i].A);
writer.Seek(12, SeekOrigin.Current);
}
for (int i = 0; i < 8; i++)
{
writer.Write(Color1Array[i].R);
writer.Write(Color1Array[i].G);
writer.Write(Color1Array[i].B);
writer.Seek(4);
writer.Seek(4, SeekOrigin.Current);
}
for (int i = 0; i < 8; i++)
{
writer.Write(Color1Array[i].A);
writer.Seek(12);
writer.Seek(12, SeekOrigin.Current);
}
}

View File

@ -84,6 +84,8 @@ namespace FirstPlugin.Forms
}
public void SaveEntry()
{
if (paramEntry != null)
{
paramEntry.ParamType = (ParamType)typeCB.SelectedItem;
@ -150,7 +152,7 @@ namespace FirstPlugin.Forms
float.TryParse(values[1], out y);
float.TryParse(values[2], out z);
float.TryParse(values[3], out w);
paramEntry.Value = new Vector4F(x,y,z,w);
paramEntry.Value = new Vector4F(x, y, z, w);
}
break;
case ParamType.Uint:
@ -166,12 +168,115 @@ namespace FirstPlugin.Forms
break;
}
}
else
{
paramEntryV2.ParamType = (AampV2Library.ParamType)typeCB.SelectedItem;
if (nameTB.Enabled)
paramEntryV2.HashString = nameTB.Text;
switch (paramEntryV2.ParamType)
{
case AampV2Library.ParamType.Boolean:
bool value = false;
bool.TryParse(dataTB.Text, out value);
paramEntryV2.Value = value;
break;
case AampV2Library.ParamType.Float:
float valueF = 0;
float.TryParse(dataTB.Text, out valueF);
paramEntryV2.Value = valueF;
break;
case AampV2Library.ParamType.Int:
int valueInt = 0;
int.TryParse(dataTB.Text, out valueInt);
paramEntryV2.Value = valueInt;
break;
case AampV2Library.ParamType.Vector2F:
var values2F = dataTB.Text.Split(' ');
if (values2F.Length != 2)
{
}
else
{
float x, y;
float.TryParse(values2F[0], out x);
float.TryParse(values2F[1], out y);
paramEntryV2.Value = new Vector2F(x, y);
}
break;
case AampV2Library.ParamType.Vector3F:
var values3F = dataTB.Text.Split(' ');
if (values3F.Length != 3)
{
}
else
{
float x, y, z;
float.TryParse(values3F[0], out x);
float.TryParse(values3F[1], out y);
float.TryParse(values3F[2], out z);
paramEntryV2.Value = new Vector3F(x, y, z);
}
break;
case AampV2Library.ParamType.Vector4F:
case AampV2Library.ParamType.Color4F:
var values = dataTB.Text.Split(' ');
if (values.Length != 4)
{
}
else
{
float x, y, z, w;
float.TryParse(values[0], out x);
float.TryParse(values[1], out y);
float.TryParse(values[2], out z);
float.TryParse(values[3], out w);
paramEntryV2.Value = new Vector4F(x, y, z, w);
}
break;
case AampV2Library.ParamType.Uint:
uint valueUInt = 0;
uint.TryParse(dataTB.Text, out valueUInt);
paramEntryV2.Value = valueUInt;
break;
case AampV2Library.ParamType.String64:
case AampV2Library.ParamType.String32:
case AampV2Library.ParamType.String256:
case AampV2Library.ParamType.StringRef:
paramEntryV2.Value = dataTB.Text;
break;
}
}
}
private void dataTB_TextChanged(object sender, EventArgs e)
{
if (paramEntry != null)
{
switch (paramEntry.ParamType)
{
case ParamType.Color4F:
UpdatePictureboxColor();
break;
}
}
else
{
switch (paramEntryV2.ParamType)
{
case AampV2Library.ParamType.Color4F:
UpdatePictureboxColor();
break;
}
}
}
private void UpdatePictureboxColor()
{
var values = dataTB.Text.Split(' ');
if (values.Length == 4)
{
@ -184,8 +289,6 @@ namespace FirstPlugin.Forms
pictureBox1.BackColor = System.Drawing.Color.FromArgb(
FloatToIntClamp(w), FloatToIntClamp(x), FloatToIntClamp(y), FloatToIntClamp(z));
}
break;
}
}
public static int FloatToIntClamp(float r)
@ -201,6 +304,8 @@ namespace FirstPlugin.Forms
}
private void pictureBox1_Click(object sender, EventArgs e)
{
if (paramEntry != null)
{
if (paramEntry.ParamType == ParamType.Color4F)
{
@ -218,5 +323,24 @@ namespace FirstPlugin.Forms
}
}
}
else
{
if (paramEntryV2.ParamType == AampV2Library.ParamType.Color4F)
{
ColorDialog dlg = new ColorDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
paramEntryV2.Value = new Vector4F(
dlg.Color.R / 255.0f,
dlg.Color.G / 255.0f,
dlg.Color.B / 255.0f,
dlg.Color.A / 255.0f);
var vec4 = (Vector4F)paramEntryV2.Value;
dataTB.Text = $"{vec4.X} {vec4.Y} {vec4.Z} {vec4.W}";
}
}
}
}
}
}

View File

@ -38,7 +38,7 @@
<ItemGroup>
<Reference Include="AssimpNet, Version=4.1.0.0, Culture=neutral, PublicKeyToken=0d51b391f59f42a6, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>.\AssimpNet.dll</HintPath>
<HintPath>..\Toolbox\Lib\AssimpNet.dll</HintPath>
</Reference>
<Reference Include="Be.Windows.Forms.HexBox">
<HintPath>..\Toolbox\Lib\Be.Windows.Forms.HexBox.dll</HintPath>

Binary file not shown.

Binary file not shown.

Binary file not shown.