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 hwInstanceGetBounds(hwHInstance iid, ref Vector3 o_min, ref Vector3 o_max);
[DllImport("HairWorksIntegration")] public static extern bool hwInstanceRelease(hwHInstance iid);
[DllImport ("HairWorksIntegration")] public static extern void hwRenderShadow(hwHInstance iid);
[DllImport ("HairWorksIntegration")] public static extern void hwInstanceUpdateSkinningDQs(hwHInstance iid, int num_bones, IntPtr dqs);
[DllImport ("HairWorksIntegration")] public static extern void hwInstanceSetTexture(hwHInstance iid, hwTextureType type, IntPtr tex);
public static extern void hwInstanceSetDescriptor(hwHInstance iid, ref hwDescriptor desc);
[DllImport("HairWorksIntegration")] public static extern void hwInstanceUpdateSkinningDQs(hwHInstance iid, int num_bones, IntPtr dqs);
[DllImport ("HairWorksIntegration")] public static extern bool hwInstanceRelease(hwHInstance iid);
public static extern void hwRenderShadow(hwHInstance iid);
public static extern void hwInstanceUpdateSkinningMatrices(hwHInstance iid, int num_bones, IntPtr matrices);
public static extern void hwInstanceUpdateSkinningDQs(hwHInstance iid, int num_bones, IntPtr dqs);
public static extern void hwInstanceSetTexture(hwHInstance iid, hwTextureType type, IntPtr tex);
[DllImport("HairWorksIntegration")] public static extern void hwInstanceSetDescriptor(hwHInstance iid, ref hwDescriptor desc);
[DllImport ("HairWorksIntegration")] public static extern void hwInstanceGetBounds(hwHInstance iid, ref Vector3 o_min, ref Vector3 o_max);
[DllImport("HairWorksIntegration")] public static extern void hwInstanceSetTexture(hwHInstance iid, hwTextureType type, IntPtr tex);
[DllImport ("HairWorksIntegration")] public static extern void hwInstanceSetDescriptor(hwHInstance iid, ref hwDescriptor desc);
[DllImport("HairWorksIntegration")] public static extern void hwRenderShadow(hwHInstance iid);
public static extern bool hwInstanceRelease(hwHInstance iid);