public void LoadHairAsset(string path_to_apx, bool reset_params = true) { // release existing instance & asset if (m_hinstance) { HairWorksIntegration.hwInstanceRelease(m_hinstance); m_hinstance = hwHInstance.NullHandle; } if (m_hasset) { HairWorksIntegration.hwAssetRelease(m_hasset); m_hasset = hwHAsset.NullHandle; } // load & create instance if (m_hasset = HairWorksIntegration.hwAssetLoadFromFile(Application.streamingAssetsPath + "/" + path_to_apx)) { m_hair_asset = path_to_apx; m_hinstance = HairWorksIntegration.hwInstanceCreate(m_hasset); if (reset_params) { HairWorksIntegration.hwAssetGetDefaultDescriptor(m_hasset, ref m_params); } } // update bone structure if (reset_params) { m_bones = null; m_skinning_matrices = null; m_skinning_matrices_ptr = IntPtr.Zero; } UpdateBones(); #if UNITY_EDITOR Update(); RepaintWindow(); #endif }
[DllImport ("HairWorksIntegration")] public static extern void hwAssetGetBoneWeights(hwHAsset aid, ref Vector4 o_weight);
public static extern void hwAssetGetBoneIndices(hwHAsset aid, ref Vector4 o_indices);
[DllImport("HairWorksIntegration")] public static extern void hwAssetGetDefaultDescriptor(hwHAsset aid, ref hwDescriptor o_desc);
[DllImport("HairWorksIntegration")] public static extern void hwAssetGetBoneWeights(hwHAsset aid, ref Vector4 o_weight);
public static string hwAssetGetBoneNameString(hwHAsset aid, int nth) { return(Marshal.PtrToStringAnsi(hwAssetGetBoneName(aid, nth))); }
[DllImport("HairWorksIntegration")] public static extern int hwAssetGetNumBones(hwHAsset aid);
[DllImport ("HairWorksIntegration")] public static extern hwHInstance hwInstanceCreate(hwHAsset aid);
private static extern IntPtr hwAssetGetBoneName(hwHAsset aid, int nth);
public static extern hwHInstance hwInstanceCreate(hwHAsset aid);
public static extern bool hwAssetReload(hwHAsset aid);
public static extern bool hwAssetRelease(hwHAsset aid);
public static extern int hwAssetGetNumBones(hwHAsset aid);
public static extern void hwAssetGetDefaultDescriptor(hwHAsset aid, ref hwDescriptor o_desc);
public static extern void hwAssetGetBoneWeights(hwHAsset aid, ref Vector4 o_weight);
[DllImport ("HairWorksIntegration")] public static extern void hwAssetGetBindPose(hwHAsset aid, int nth, ref Matrix4x4 o_bindpose);
[DllImport ("HairWorksIntegration")] public static extern void hwAssetGetDefaultDescriptor(hwHAsset aid, ref hwDescriptor o_desc);
[DllImport ("HairWorksIntegration")] public static extern bool hwAssetReload(hwHAsset aid);
[DllImport("HairWorksIntegration")] public static extern bool hwAssetReload(hwHAsset aid);
[DllImport ("HairWorksIntegration")] public static extern int hwAssetGetNumBones(hwHAsset aid);
[DllImport("HairWorksIntegration")] private static extern IntPtr hwAssetGetBoneName(hwHAsset aid, int nth);
[DllImport ("HairWorksIntegration")] private static extern IntPtr hwAssetGetBoneName(hwHAsset aid, int nth);
[DllImport("HairWorksIntegration")] public static extern void hwAssetGetBoneIndices(hwHAsset aid, ref Vector4 o_indices);
public static string hwAssetGetBoneNameString(hwHAsset aid, int nth) { return Marshal.PtrToStringAnsi(hwAssetGetBoneName(aid, nth)); }
[DllImport("HairWorksIntegration")] public static extern void hwAssetGetBindPose(hwHAsset aid, int nth, ref Matrix4x4 o_bindpose);
[DllImport ("HairWorksIntegration")] public static extern void hwAssetGetBoneIndices(hwHAsset aid, ref Vector4 o_indices);
[DllImport("HairWorksIntegration")] public static extern hwHInstance hwInstanceCreate(hwHAsset aid);
public static extern void hwAssetGetBindPose(hwHAsset aid, int nth, ref Matrix4x4 o_bindpose);