Skip to content

Commit

Permalink
feat: [クラスラッパー]Xファイルから3Dモデルを読み込めるように
Browse files Browse the repository at this point in the history
  • Loading branch information
automatic9045 committed Dec 15, 2023
1 parent 4a31842 commit ff9fd05
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Libs/BveTypes/ClassWrappers/Public/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace BveTypes.ClassWrappers
{
/// <summary>
/// SlimDX で表示するための 2D および 3D モデルを表します。
/// Direct3D9 から表示可能な 3D モデルを表します。
/// </summary>
public class Model : ClassWrapperBase
{
Expand All @@ -22,6 +22,8 @@ private static void Initialize(BveTypeSet bveTypes)
{
ClassMemberSet members = bveTypes.GetClassInfoOf<Model>();

FromXFileMethod = members.GetSourceMethodOf(nameof(FromXFile));

MeshGetMethod = members.GetSourcePropertyGetterOf(nameof(Mesh));
MeshSetMethod = members.GetSourcePropertySetterOf(nameof(Mesh));

Expand All @@ -47,6 +49,15 @@ protected Model(object src) : base(src)
[CreateClassWrapperFromSource]
public static Model FromSource(object src) => src is null ? null : new Model(src);

private static FastMethod FromXFileMethod;
/// <summary>
/// 指定した X ファイルからモデルを読み込みます。
/// </summary>
/// <param name="filePath">X ファイルのパス。</param>
/// <returns>読み込まれたモデルを表す <see cref="Model"/>。</returns>
public static Model FromXFile(string filePath)
=> FromSource(FromXFileMethod.Invoke(null, new object[] { filePath }));

private static FastMethod MeshGetMethod;
private static FastMethod MeshSetMethod;
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Libs/BveTypes/WrapTypes/5.8.7554.391.xml
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@
<Setter Original="a"/>
</Property>

<Method Wrapper="FromXFile" WrapperParams="System.String" Original="a" IsWrapperStatic="true" IsOriginalStatic="true"/>
<Method Wrapper="Draw" WrapperParams="atsex:Direct3DProvider; System.Boolean" Original="a"/>
</Class>

Expand Down
1 change: 1 addition & 0 deletions Libs/BveTypes/WrapTypes/6.0.7554.619.xml
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@
<Setter Original="a"/>
</Property>

<Method Wrapper="FromXFile" WrapperParams="System.String" Original="a" IsWrapperStatic="true" IsOriginalStatic="true"/>
<Method Wrapper="Draw" WrapperParams="atsex:Direct3DProvider; System.Boolean" Original="a"/>
</Class>

Expand Down

0 comments on commit ff9fd05

Please sign in to comment.