Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
igorseabra4 committed Aug 30, 2022
1 parent dac4901 commit 9f507eb
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,49 @@
using IndustrialPark.Models;
using SharpDX;
using System.Collections.Generic;
using System.ComponentModel;
using static IndustrialPark.ArchiveEditorFunctions;

namespace IndustrialPark
{
public class DynaPointer : RenderableRotatableDynaBase
public class DynaPointer : RenderableDynaBase, IRotatableAsset
{
private const string dynaCategoryName = "pointer";
public override string TypeString => dynaCategoryName;
private const string dynaCategoryName1 = "DYNA Placement";

protected float _yaw;
[Category(dynaCategoryName1)]
public AssetSingle Yaw
{
get => _yaw;
set { _yaw = value; CreateTransformMatrix(); }
}

protected float _pitch;
[Category(dynaCategoryName1)]
public AssetSingle Pitch
{
get => _pitch;
set { _pitch = value; CreateTransformMatrix(); }
}

protected float _roll;
[Category(dynaCategoryName1)]
public AssetSingle Roll
{
get => _roll;
set { _roll = value; CreateTransformMatrix(); }
}

public override void CreateTransformMatrix()
{
world = Matrix.RotationYawPitchRoll(
MathUtil.DegreesToRadians(_yaw),
MathUtil.DegreesToRadians(_pitch),
MathUtil.DegreesToRadians(_roll)) * Matrix.Translation(_position);
CreateBoundingBox();
}

public override string TypeString => "pointer";

protected override short constVersion => 1;

Expand Down
14 changes: 13 additions & 1 deletion IndustrialPark/Assets/Models/AssetRenderWareModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public virtual void Setup(SharpRenderer renderer)

public RenderWareModelFile GetRenderWareModelFile() => model;

[Category("Model Data"), Description("If IsNativeData is true, you cannot use the Export function.")]
[Browsable(false)]
public bool IsNativeData => model != null && model.isNativeData;

[Browsable(false)]
Expand All @@ -70,6 +70,7 @@ public string[] Textures

foreach (RWSection rws in ModelAsRWSections)
if (rws is Clump_0010 clump)
{
foreach (Geometry_000F geo in clump.geometryList.geometryList)
if (geo.materialList != null)
if (geo.materialList.materialList != null)
Expand All @@ -78,6 +79,17 @@ public string[] Textures
if (mat.texture.diffuseTextureName != null)
if (!names.Contains(mat.texture.diffuseTextureName.stringString))
names.Add(mat.texture.diffuseTextureName.stringString);
}
else if (rws is World_000B world)
{
if (world.materialList != null)
if (world.materialList.materialList != null)
foreach (Material_0007 mat in world.materialList.materialList)
if (mat.texture != null)
if (mat.texture.diffuseTextureName != null)
if (!names.Contains(mat.texture.diffuseTextureName.stringString))
names.Add(mat.texture.diffuseTextureName.stringString);
}

return names.ToArray();
}
Expand Down
6 changes: 3 additions & 3 deletions IndustrialPark/Assets/Shared/EntityAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ public virtual AssetSingle PositionZ
set { _position.Z = value; CreateTransformMatrix(); }
}

protected AssetSingle _yaw;
protected float _yaw;
[Category(categoryName)]
public AssetSingle Yaw
{
get => MathUtil.RadiansToDegrees(_yaw);
set { _yaw = MathUtil.DegreesToRadians(value); CreateTransformMatrix(); }
}

protected AssetSingle _pitch;
protected float _pitch;
[Category(categoryName)]
public AssetSingle Pitch
{
get => MathUtil.RadiansToDegrees(_pitch);
set { _pitch = MathUtil.DegreesToRadians(value); CreateTransformMatrix(); }
}

protected AssetSingle _roll;
protected float _roll;
[Category(categoryName)]
public AssetSingle Roll
{
Expand Down
2 changes: 1 addition & 1 deletion IndustrialPark/MainForm/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ private void SetAssetViewToolStripMenuItems(IEnumerable<AssetType> assetTypes)
names.Add(assetType, text);
}

foreach (var entry in names.OrderBy(f => f.Value.ToString()))
foreach (var entry in names.OrderBy(f => f.Value))
{
var field = assetViewTypes[entry.Key].GetField("dontRender");
var dontRender = (bool)field.GetValue(null);
Expand Down
1 change: 0 additions & 1 deletion IndustrialPark/SharpDX/TextureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public static ShaderResourceView GetTextureFromDictionary(uint assetID)
foreach (string s in Textures.Keys)
if (Functions.BKDRHash(s) == assetID)
return Textures[s];

return SharpRenderer.whiteDefault;
}

Expand Down

0 comments on commit 9f507eb

Please sign in to comment.