CNamaSDKScene.h 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572
  1. #ifndef CNAMASDKSCENE_H
  2. #define CNAMASDKSCENE_H
  3. #include "CNamaSDK.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*
  8. * global api
  9. */
  10. /**
  11. \brief use binary shader program or not.
  12. \param enable > 0 means use binary shader program, enable <= 0 means not
  13. \return zero for failed, one for success
  14. */
  15. FUNAMA_API int fuEnableBinaryShaderProgram(int enable);
  16. /**
  17. \brief Specify directory for saving and loading binary shader program.
  18. \param path is directory path
  19. \return zero for failed, one for success
  20. */
  21. FUNAMA_API int fuSetBinaryShaderProgramDirectory(const char* path);
  22. /*
  23. * create, destroy, bind, and unbind api
  24. */
  25. /**
  26. \brief Create a new scene.
  27. \return an unsigned integer handle representing the scene.
  28. */
  29. FUNAMA_API unsigned int fuCreateScene();
  30. /**
  31. \brief Destroy the target scene.
  32. \param handle_id is the target scene handle
  33. \return zero for failed, one for success
  34. */
  35. FUNAMA_API int fuDestroyScene(unsigned int handle_id);
  36. /**
  37. \brief Set the target scene for render.
  38. \param handle_id is the target scene handle
  39. \return zero for failed, one for success
  40. */
  41. FUNAMA_API int fuSetCurrentScene(unsigned int handle_id);
  42. /**
  43. \brief Bind items to the target scene
  44. \param handle_id is the target scene handle
  45. \param p_items points to a list of item handles to be bind to the target
  46. scene
  47. \param n_items is the number of item handles in p_items
  48. \return the number of items successfully bound to the target scene
  49. */
  50. FUNAMA_API int fuBindItemsToScene(unsigned int handle_id, int* p_items,
  51. int n_items);
  52. /**
  53. \brief Unbind items from the target scene
  54. \param handle_id is the target scene handle
  55. \param p_items points to a list of item handles to be unbind from the target
  56. scene
  57. \param n_items is the number of item handles in p_items
  58. \return the number of items successfully unbound from the target scene
  59. */
  60. FUNAMA_API int fuUnbindItemsFromScene(unsigned int handle_id, int* p_items,
  61. int n_items);
  62. /**
  63. \brief Create an instance for a target scene.
  64. \param handle_id is the target scene handle
  65. \return an unsigned integer handle representing the instance.
  66. */
  67. FUNAMA_API unsigned int fuCreateInstance(unsigned int handle_id);
  68. /**
  69. \brief Destroy the target instance.
  70. \param handle_id is the target instance handle
  71. \return zero for failed, one for success
  72. */
  73. FUNAMA_API int fuDestroyInstance(unsigned int handle_id);
  74. /**
  75. \brief Bind items to the target instance
  76. \param handle_id is the target instance handle
  77. \param p_items points to a list of item handles to be bind to the target
  78. instance
  79. \param n_items is the number of item handles in p_items
  80. \return the number of items successfully bound to the instance
  81. */
  82. FUNAMA_API int fuBindItemsToInstance(unsigned int handle_id, int* p_items,
  83. int n_items);
  84. /**
  85. \brief Unbind items from the target instance
  86. \param handle_id is the target instance handle
  87. \param p_items points to a list of item handles to be unbind from the target
  88. instance
  89. \param n_items is the number of item handles in p_items
  90. \return the number of items successfully unbound from the instance
  91. */
  92. FUNAMA_API int fuUnbindItemsFromInstance(unsigned int handle_id, int* p_items,
  93. int n_items);
  94. /*
  95. * render related api
  96. */
  97. /**
  98. \brief Enable or not render for the target scene.
  99. \param handle_id is the target scene handle
  100. \param enable > 0 means render, enable <= 0 means not render
  101. \return zero for failed, one for success
  102. */
  103. FUNAMA_API int fuEnableRender(unsigned int handle_id, int enable);
  104. /*
  105. * ground reflection related api
  106. */
  107. /**
  108. \brief Enable or not render ground reflection for the target scene.
  109. \param handle_id is the target scene handle
  110. \param enable > 0 means render ground reflection, enable <= 0 means not render
  111. ground reflection \return zero for failed, one for success
  112. */
  113. FUNAMA_API int fuEnableGroundReflection(unsigned int handle_id, int enable);
  114. /*
  115. * ground reflection related parameter
  116. */
  117. /**
  118. \brief set parameters to ground reflection.
  119. \param handle_id is the target scene handle
  120. \param maxTrans > 0 means the max transparency for flip scene;
  121. \param maxDis > 0 means the distance flip scene to fade;
  122. \return zero for failed, one for success
  123. */
  124. FUNAMA_API int fuSetGroundReflectionPrameters(unsigned int handle_id,
  125. float maxTrans, float maxDis);
  126. /*
  127. * dof related api
  128. */
  129. /**
  130. \brief set dof parameters to camera.
  131. \param enable > 0 means open dof, enable <= 0 means close dof
  132. \return zero for failed, one for success
  133. */
  134. FUNAMA_API int fuEnableDof(unsigned int handle_id, int enable);
  135. /*
  136. * dof related api
  137. */
  138. /**
  139. \brief set dof parameters to camera.
  140. \param enable is a coc visual swith;
  141. \return zero for failed, one for success
  142. */
  143. FUNAMA_API int fuEnableDofDebug(unsigned int handle_id, int enable);
  144. /*
  145. * dof related api
  146. */
  147. /**
  148. \brief set dof parameters to camera.
  149. \param handle_id is the target scene handle
  150. \param focalLength,focusDistance,maxCoC,aperture is physical camera parameters;
  151. \param blurSize contain(0->smacll, 1->medium, 2->large, 3->verylarge);
  152. \return zero for failed, one for success
  153. */
  154. FUNAMA_API int fuSetDofParamters(unsigned int handle_id, float focalLength,
  155. float focusDistance, float maxCoC,
  156. float aperture, int blurSize);
  157. /*
  158. * bloom related api
  159. */
  160. /**
  161. \brief set bloom parameters to postprocess.
  162. \param enable > 0 means open dof, enable <= 0 means close bloom
  163. \return zero for failed, one for success
  164. */
  165. FUNAMA_API int fuEnableBloom(unsigned int handle_id, int enable);
  166. /*
  167. * dof related api
  168. */
  169. /**
  170. \brief set Bloom parameters to postprocess.
  171. \param handle_id is the target scene handle
  172. \param threshold_value is the height-light threshold value;
  173. \param bloom_intensity control the effect of the high-light;
  174. \return zero for failed, one for success
  175. */
  176. FUNAMA_API int fuSetBloomParamters(unsigned int handle_id, float threshold_value, float bloom_intensity);
  177. /**
  178. \brief Enable or not render camera for the target scene.
  179. \param handle_id is the target scene handle
  180. \param enable > 0 means render, enable <= 0 means not render
  181. \return zero for failed, one for success
  182. */
  183. FUNAMA_API int fuEnableRenderCamera(unsigned int handle_id, int enable);
  184. /**
  185. \brief Enable or not use pure background color for the target scene.
  186. \param handle_id is the target scene handle
  187. \param enable > 0 means use, enable <= 0 means not
  188. \return zero for failed, one for success
  189. */
  190. FUNAMA_API int fuEnableBackgroundColor(unsigned int handle_id, int enable);
  191. /**
  192. \brief Set background rgba color for the target scene.
  193. \param handle_id is the target scene handle
  194. \param r is color of R channel, from 0 to 255
  195. \param g is color of G channel, from 0 to 255
  196. \param b is color of B channel, from 0 to 255
  197. \param a is color of A channel, from 0 to 255
  198. \return zero for failed, one for success
  199. */
  200. FUNAMA_API int fuSetBackgroundColor(unsigned int handle_id, int r, int g, int b, int a);
  201. /**
  202. \brief Enable or not main light shadow for the target scene.
  203. \param handle_id is the target scene handle
  204. \param enable > 0 means use, enable <= 0 means not
  205. \return zero for failed, one for success
  206. */
  207. FUNAMA_API int fuEnableShadow(unsigned int handle_id, int enable);
  208. /**
  209. \brief Set main light shadow map size for the target scene.
  210. \param handle_id is the target scene handle
  211. \param size
  212. \return zero for failed, one for success
  213. */
  214. FUNAMA_API int fuSetShadowMapSize(unsigned int handle_id, int size);
  215. /**
  216. \brief Set main light shadow bias for the target scene.
  217. \param handle_id is the target scene handle
  218. \param uniform_bias, is 0.01 defaultly
  219. \param normal_bias, is 0.1 defaultly
  220. \return zero for failed, one for success
  221. */
  222. FUNAMA_API int fuSetShadowBias(unsigned int handle_id, float uniform_bias,
  223. float normal_bias);
  224. /**
  225. \brief Set instance main light shadow PCF level
  226. \param handle_id is the target instance handle
  227. \param level = 0, 1, 2
  228. \return zero for failed, one for success
  229. */
  230. FUNAMA_API int fuSetInstanceShadowPCFLevel(unsigned int handle_id, int level);
  231. /**
  232. \brief Set instance main light shadow map sample offset scale.
  233. \param handle_id is the target instance handle
  234. \param offset_scale is sample offset scale
  235. \return zero for failed, one for success
  236. */
  237. FUNAMA_API int fuSetInstanceShadowSampleOffset(unsigned int handle_id,
  238. int offset_scale);
  239. /**
  240. \brief Enable or not bloom for the target scene.
  241. \param handle_id is the target scene handle
  242. \param enable > 0 means use, enable <= 0 means not
  243. \return zero for failed, one for success
  244. */
  245. FUNAMA_API int fuEnableBloom(unsigned int handle_id, int enable);
  246. /**
  247. \brief Enable use or not low quality lighting for the target scene.
  248. \param handle_id is the target scene handle
  249. \param enable > 0 means use, enable <= 0 means not
  250. \return zero for failed, one for success
  251. */
  252. FUNAMA_API int fuEnableLowQualityLighting(unsigned int handle_id, int enable);
  253. /**
  254. \brief Enable use or not low resolution texture for the target scene.
  255. \param handle_id is the target scene handle
  256. \param enable > 0 means use, enable <= 0 means not
  257. \return zero for failed, one for success
  258. */
  259. FUNAMA_API int fuEnableLowResolutionTexture(unsigned int handle_id, int enable);
  260. /**
  261. \brief Enable HDR RGBA16F for the target scene.
  262. \param handle_id is the target scene handle
  263. \param enable > 0 means use HDR RGBA16F, enable <= 0 means use R11FG11FB10F
  264. \return zero for failed, one for success
  265. */
  266. FUNAMA_API int fuEnableHDRRGBA16F(unsigned int handle_id, int enable);
  267. /*
  268. * ai related api
  269. */
  270. FUNAMA_API int fuEnableFaceProcessor(unsigned int handle_id, int enable);
  271. /**
  272. \brief Turn on or off ar mode for the target scene.
  273. \param handle_id is the target scene handle
  274. \param enable > 0 means turn on , enable <= 0 means turn off
  275. \return zero for failed, one for success
  276. */
  277. FUNAMA_API int fuEnableARMode(unsigned int handle_id, int enable);
  278. /**
  279. \brief Set instance input camera buffer matrix, for transforming fuai result
  280. \param handle_id is the target instance handle
  281. \param mat the transform matrix use to transform the input
  282. cpu buffer
  283. \return zero for failed, one for success
  284. */
  285. FUNAMA_API int fuSetInstanceInputCameraBufferMatrix(unsigned int handle_id,
  286. TRANSFORM_MATRIX mat);
  287. /**
  288. \brief Set instance face id of face processor.
  289. \param handle_id is the target instance handle
  290. \param value is face id
  291. \return zero for failed, one for success
  292. */
  293. FUNAMA_API int fuSetInstanceFaceProcessorFaceId(unsigned int handle_id,
  294. int value);
  295. /**
  296. \brief Set instance face processor type.
  297. \param handle_id is the target instance handle
  298. \param type is face processor type, 1 : use inner face processor, 2 : use
  299. outer face data result \return zero for failed, one for success
  300. */
  301. FUNAMA_API int fuSetInstanceFaceProcessorType(unsigned int handle_id, int type);
  302. /**
  303. \brief Set instance face processor outer data ptr.
  304. \param handle_id is the target instance handle
  305. \param void* is pointer to FaceProcessorResult
  306. \return zero for failed, one for success
  307. */
  308. FUNAMA_API int fuSetInstanceFaceProcessorOuterResultPtr(unsigned int handle_id,
  309. void* ptr);
  310. /**
  311. \brief Set instance filter size of face processor.
  312. \param handle_id is the target instance handle
  313. \param filter_size_rotaion is filter size of head rotation
  314. \param filter_size_translation is filter size of head translation
  315. \param filter_size_eye_rotaion is filter size of eye rotation
  316. \return zero for failed, one for success
  317. */
  318. FUNAMA_API int fuSetInstanceFaceProcessorFilterSize(
  319. unsigned int handle_id, int filter_size_rotaion,
  320. int filter_size_translation, int filter_size_eye_rotation);
  321. /**
  322. \brief Reset instance filter of face processor.
  323. \param handle_id is the target instance handle
  324. \return zero for failed, one for success
  325. */
  326. FUNAMA_API int fuResetInstanceFaceProcessorFilter(unsigned int handle_id);
  327. /**
  328. \brief Set instance head rotation deltaX of face processor.
  329. \param handle_id is the target instance handle
  330. \param value is x delta rotation
  331. \return zero for failed, one for success
  332. */
  333. FUNAMA_API int fuSetInstanceHeadRotationDeltaX(unsigned int handle_id,
  334. float value);
  335. /**
  336. \brief Set instance head rotation Z Range of face processor.
  337. \param handle_id is the target instance handle
  338. \param min_angle default is -180
  339. \parma max_angle default is 180
  340. \return zero for failed, one for success
  341. */
  342. FUNAMA_API int fuSetInstanceHeadRotationZRange(unsigned int handle_id,
  343. float min_angle,
  344. float max_angle);
  345. /**
  346. \brief Set instance eye rotation deltaX of face processor.
  347. \param handle_id is the target instance handle
  348. \param value is x delta rotation
  349. \return zero for failed, one for success
  350. */
  351. FUNAMA_API int fuSetInstanceEyeRotationDeltaX(unsigned int handle_id,
  352. float value);
  353. /**
  354. \brief Enable instance rotate head or not.
  355. \param handle_id is the target instance handle
  356. \param enable > 0 means enalbe blend , enable <= 0 means not
  357. \return zero for failed, one for success
  358. */
  359. FUNAMA_API int fuEnableInstanceFaceProcessorRotateHead(unsigned int handle_id,
  360. int enable);
  361. /**
  362. \brief Open or close the human anim driver for the target instance.
  363. \param handle_id is the target instance handle
  364. \param enable > 0 means open, enable <= 0 means close
  365. \return zero for failed, one for success
  366. */
  367. FUNAMA_API int fuSetInstanceEnableHumanAnimDriver(unsigned int handle_id,
  368. int enable);
  369. /**
  370. \brief Open or close AI human processor for the target scene.
  371. \param handle_id is the target scene handle
  372. \param enable > 0 means open, enable <= 0 means close
  373. \return zero for failed, one for success
  374. */
  375. FUNAMA_API int fuEnableHumanProcessor(unsigned int handle_id, int enable);
  376. /**
  377. \brief set human processor 3D scene.
  378. \param handle_id is the target scene handle
  379. \param scene = 0 means selfie, enable > 0 means dance
  380. \return zero for failed, one for success
  381. */
  382. FUNAMA_API int fuHumanProcessorSet3DScene(unsigned int handle_id, int scene);
  383. /**
  384. \brief Open or close RiggingBVHInputProcessor for the target scene.
  385. \param handle_id is the target scene handle
  386. \param enable > 0 means open, enable <= 0 means close
  387. \return zero for failed, one for success
  388. */
  389. FUNAMA_API int fuEnableRiggingBVHInputProcessor(unsigned int handle_id,
  390. bool enable);
  391. /**
  392. \brief Open or close hand detetor for the target scene.
  393. \param handle_id is the target scene handle
  394. \param enable > 0 means open, enable <= 0 means close
  395. \return zero for failed, one for success
  396. */
  397. FUNAMA_API int fuEnableHandDetetor(unsigned int handle_id, int enable);
  398. /*
  399. * camera animation
  400. */
  401. /**
  402. \brief Enable use camera aniamtion for the target scene or not.
  403. \param handle_id is the target scene handle
  404. \param enable > 0 means use, enable <= 0 means not use
  405. \return zero for failed, one for success
  406. */
  407. FUNAMA_API int fuEnableCameraAnimation(unsigned int handle_id, int enable);
  408. /**
  409. \brief Play target camera animation for the target scene.
  410. \param handle_id is the target scene handle
  411. \param anim_handle is target animation item handle
  412. \return zero for failed, one for success
  413. */
  414. FUNAMA_API int fuPlayCameraAnimation(unsigned int handle_id, int anim_handle);
  415. /**
  416. \brief Play target camera animation once for the target scene.
  417. \param handle_id is the target scene handle
  418. \param anim_handle is target animation item handle
  419. \return zero for failed, one for success
  420. */
  421. FUNAMA_API int fuPlayCameraAnimationOnce(unsigned int handle_id,
  422. int anim_handle);
  423. /**
  424. \brief Start or continue current camera animation for the target scene.
  425. \param handle_id is the target scene handle
  426. \return zero for failed, one for success
  427. */
  428. FUNAMA_API int fuStartCameraAnimation(unsigned int handle_id);
  429. /**
  430. \brief Pause current camera animation for the target scene.
  431. \param handle_id is the target scene handle
  432. \return zero for failed, one for success
  433. */
  434. FUNAMA_API int fuPauseCameraAnimation(unsigned int handle_id);
  435. /**
  436. \brief Restart current camera animation for the target scene.
  437. \param handle_id is the target scene handle
  438. \return zero for failed, one for success
  439. */
  440. FUNAMA_API int fuResetCameraAnimation(unsigned int handle_id);
  441. /**
  442. \brief Set camera animation transition time for the target scene.
  443. \param handle_id is the target scene handle
  444. \param time is transition time, second
  445. \return zero for failed, one for success
  446. */
  447. FUNAMA_API int fuSetCameraAnimationTransitionTime(unsigned int handle_id,
  448. float time);
  449. /**
  450. \brief Enable camera aniamtion internal lerp for the target scene or not.
  451. \param handle_id is the target scene handle
  452. \param enable > 0 means enable, enable <= 0 means not
  453. \return zero for failed, one for success
  454. */
  455. FUNAMA_API int fuEnableCameraAnimationInternalLerp(unsigned int handle_id,
  456. int enable);
  457. /*
  458. * time updating releated api
  459. */
  460. /**
  461. \brief Switch to system background, pause time update for the target scene
  462. \param handle_id is the target scene handle
  463. \param enable > 0 means switch to system background, enable <= 0 means not
  464. \return zero for failed, one for success
  465. */
  466. FUNAMA_API int fuPauseTimeUpdate(unsigned int handle_id, int enable);
  467. /**
  468. \brief Enable control system time updating or not for the target scene
  469. \param handle_id is the target scene handle
  470. \param enable > 0 means control time byself, enable <= 0 means not
  471. \return zero for failed, one for success
  472. */
  473. FUNAMA_API int fuEnableControlTimeUpdate(unsigned int handle_id, int enable);
  474. /**
  475. \brief Set current time to control system time updating for the target scene
  476. \param handle_id is the target scene handle
  477. \param value is current in seconds
  478. \return zero for failed, one for success
  479. */
  480. FUNAMA_API int fuSetCurrentTime(unsigned int handle_id, float value);
  481. /*
  482. * instance related api
  483. */
  484. /**
  485. \brief Enable instance visible or not.
  486. \param handle_id is the target instance handle
  487. \param visible > 0 means visible, enable <= 0 means not
  488. \return zero for failed, one for success
  489. */
  490. FUNAMA_API int fuEnableInstanceVisible(unsigned int handle_id, int visible);
  491. /**
  492. \brief Enable instance single mesh visible or not.
  493. \param handle_id is the target instance handle
  494. \param mesh_handle is target mesh item handle
  495. \param visible > 0 means visible, enable <= 0 means not
  496. \return zero for failed, one for success
  497. */
  498. FUNAMA_API int fuEnableInstanceSingleMeshVisible(unsigned int handle_id,
  499. int mesh_handle, int visible);
  500. /**
  501. \brief Enable instance use face beauty custom order or not.
  502. \param handle_id is the target instance handle
  503. \param enable > 0 means use custom order, enable <= 0 means not
  504. \return zero for failed, one for success
  505. */
  506. FUNAMA_API int fuEnableInstanceUseFaceBeautyOrder(unsigned int handle_id,
  507. int enable);
  508. /**
  509. \brief Set instance face beauty custom order.
  510. \param handle_id is the target instance handle
  511. \param value points to an array of ints
  512. \param n specifies the number of elements in value
  513. \return zero for failed, one for success
  514. */
  515. FUNAMA_API int fuSetInstanceFaceBeautyOrder(unsigned int handle_id, int* value,
  516. int n);
  517. /**
  518. \brief Set instance body visible list.
  519. \param handle_id is the target instance handle
  520. \param value points to an array of ints
  521. \param n specifies the number of elements in value
  522. \return zero for failed, one for success
  523. */
  524. FUNAMA_API int fuSetInstanceBodyVisibleList(unsigned int handle_id, int* value,
  525. int n);
  526. /**
  527. \brief Set instance body invisible list.
  528. \param handle_id is the target instance handle
  529. \param value points to an array of ints
  530. \param n specifies the number of elements in value
  531. \return zero for failed, one for success
  532. */
  533. FUNAMA_API int fuSetInstanceBodyInvisibleList(unsigned int handle_id,
  534. int* value, int n);
  535. /**
  536. \brief Enable instance hide neck or not.
  537. \param handle_id is the target instance handle
  538. \param enable > 0 means hide neck, enable <= 0 means not
  539. \return zero for failed, one for success
  540. */
  541. FUNAMA_API int fuEnableInstanceHideNeck(unsigned int handle_id, int enable);
  542. /**
  543. \brief Reset instance head to default.
  544. \param handle_id is the target instance handle
  545. \return zero for failed, one for success
  546. */
  547. FUNAMA_API int fuResetInstanceHead(unsigned int handle_id);
  548. /**
  549. \brief Turn on or off instance facepup mode.
  550. \param handle_id is the target instance handle
  551. \param enable > 0 means turn on , enable <= 0 means turn off
  552. \return zero for failed, one for success
  553. */
  554. FUNAMA_API int fuEnableInstanceFacepupMode(unsigned int handle_id, int enable);
  555. /**
  556. \brief Set instance facepup value.
  557. \param handle_id is the target instance handle
  558. \param name is the parameter name
  559. \param value is the parameter value to be set
  560. \return zero for failed, one for success
  561. */
  562. FUNAMA_API int fuSetInstanceFacepup(unsigned int handle_id, const char* name,
  563. float value);
  564. /**
  565. \brief Set instance skeleton deformation.
  566. \param handle_id is the target instance handle
  567. \param name is the parameter name
  568. \param value is the parameter value to be set
  569. \return zero for failed, one for success
  570. */
  571. FUNAMA_API int fuSetInstanceDeformation(unsigned int handle_id,
  572. const char* name, float value);
  573. /**
  574. \brief Set instance skeleton deformation rotation.
  575. \param handle_id is the target instance handle
  576. \param name is the skeleton name
  577. \param angle_x is euler angle x
  578. \param angle_y is euler angle y
  579. \param angle_z is euler angle z
  580. \return zero for failed, one for success
  581. */
  582. FUNAMA_API int fuSetInstanceDeformationRotation(unsigned int handle_id,
  583. const char* name, float angle_x,
  584. float angle_y, float angle_z);
  585. /**
  586. \brief Set instance skeleton deformation translation.
  587. \param handle_id is the target instance handle
  588. \param name is the skeleton name
  589. \param x is the translation x
  590. \param y is the translation y
  591. \param z is the translation z
  592. \return zero for failed, one for success
  593. */
  594. FUNAMA_API int fuSetInstanceDeformationTranslation(unsigned int handle_id,
  595. const char* name, float x,
  596. float y, float z);
  597. /**
  598. \brief Set instance skeleton deformation scale.
  599. \param handle_id is the target instance handle
  600. \param name is the skeleton name
  601. \param x is the scale x
  602. \param y is the scale y
  603. \param z is the scale z
  604. \return zero for failed, one for success
  605. */
  606. FUNAMA_API int fuSetInstanceDeformationScale(unsigned int handle_id,
  607. const char* name, float x, float y,
  608. float z);
  609. /**
  610. \brief Enable instance expression blend or not.
  611. \param handle_id is the target instance handle
  612. \param enable > 0 means enalbe blend , enable <= 0 means not
  613. \return zero for failed, one for success
  614. */
  615. FUNAMA_API int fuEnableInstanceExpressionBlend(unsigned int handle_id,
  616. int enable);
  617. /**
  618. \brief Set instance blend expression array.
  619. \param handle_id is the target instance handle
  620. \param value points to an array of floats
  621. \param n specifies the number of elements in value
  622. \return zero for failed, one for success
  623. */
  624. FUNAMA_API int fuSetInstanceBlendExpression(unsigned int handle_id,
  625. float* value, int n);
  626. /**
  627. \brief Set instance blend expression weight.
  628. \param handle_id is the target instance handle
  629. \param value points to an array of floats
  630. \param n specifies the number of elements in value
  631. \return zero for failed, one for success
  632. */
  633. FUNAMA_API int fuSetInstanceExpressionWeight0(unsigned int handle_id,
  634. float* value, int n);
  635. /**
  636. \brief Set instance default expression(face processor or animation) weight.
  637. \param handle_id is the target instance handle
  638. \param value points to an array of floats
  639. \param n specifies the number of elements in value
  640. \return zero for failed, one for success
  641. */
  642. FUNAMA_API int fuSetInstanceExpressionWeight1(unsigned int handle_id,
  643. float* value, int n);
  644. /**
  645. \brief Set instance uv anim frame id array.
  646. \param handle_id is the target instance handle
  647. \param value points to an array of Ints
  648. \param n specifies the number of elements in value
  649. \return zero for failed, one for success
  650. */
  651. FUNAMA_API int fuSetInstanceUVAnimArray(unsigned int handle_id, int* value, int n);
  652. /**
  653. \brief Enable instance focus eye to camera or not.
  654. \param handle_id is the target scene handle
  655. \param enable > 0 means focus eye to camera, enable <= 0 means not
  656. \return zero for failed, one for success
  657. */
  658. FUNAMA_API int fuEnableInstanceFocusEyeToCamera(unsigned int handle_id,
  659. int enable);
  660. /**
  661. \brief Set instance focus eye to camera params
  662. \param handle_id is the target scene handle
  663. \param height_adjust is height adjust delta
  664. \param distance_adjust is distance adjust delta
  665. \param weight is weight
  666. \return zero for failed, one for success
  667. */
  668. FUNAMA_API int fuSetInstanceFocusEyeToCameraParams(unsigned int handle_id,
  669. float height_adjust,
  670. float distance_adjust,
  671. float weight);
  672. /**
  673. \brief set instance rotation delta.
  674. \param handle_id is the target instance handle
  675. \param value is rotation delta
  676. \return zero for failed, one for success
  677. */
  678. FUNAMA_API int fuSetInstanceRotDelta(unsigned int handle_id, float value);
  679. /**
  680. \brief Set instance scale delta.
  681. \param handle_id is the target instance handle
  682. \param value is scale delta
  683. \return zero for failed, one for success
  684. */
  685. FUNAMA_API int fuSetInstanceScaleDelta(unsigned int handle_id, float value);
  686. /**
  687. \brief Set instance translate delta.
  688. \param handle_id is the target instance handle
  689. \param value is translate delta
  690. \return zero for failed, one for success
  691. */
  692. FUNAMA_API int fuSetInstanceTranslateDelta(unsigned int handle_id, float value);
  693. /**
  694. \brief Set instance target rotation angle.
  695. \param handle_id is the target instance handle
  696. \param value is target rotation angle
  697. \return zero for failed, one for success
  698. */
  699. FUNAMA_API int fuSetInstanceTargetAngle(unsigned int handle_id, float value);
  700. /**
  701. \brief Set instance target xyz position.
  702. \param handle_id is the target instance handle
  703. \param x is position of x world coordinate
  704. \param y is position of y world coordinate
  705. \param z is position of z world coordinate
  706. \return zero for failed, one for success
  707. */
  708. FUNAMA_API int fuSetInstanceTargetPosition(unsigned int handle_id, float x,
  709. float y, float z);
  710. /**
  711. \brief Set instance target rotation angle gradually.
  712. \param handle_id is the target instance handle
  713. \param value is target rotation angle
  714. \param frame_count is frame count
  715. \return zero for failed, one for success
  716. */
  717. FUNAMA_API int fuSetInstanceTargetAngleGradually(unsigned int handle_id,
  718. float value, int frame_count);
  719. /**
  720. \brief Set instance target xyz position gradually.
  721. \param handle_id is the target instance handle
  722. \param x is position of x world coordinate
  723. \param y is position of y world coordinate
  724. \param z is position of z world coordinate
  725. \param frame_count is frame count
  726. \return zero for failed, one for success
  727. */
  728. FUNAMA_API int fuSetInstanceTargetPositionGradually(unsigned int handle_id,
  729. float x, float y, float z,
  730. int frame_count);
  731. /**
  732. \brief Enable instance rotation without animation translation.
  733. \param handle_id is the target instance handle
  734. \param enable > 0 rotate without animation translation
  735. \return zero for failed, one for success
  736. */
  737. FUNAMA_API int fuEnableInstanceRotateWithoutAnimationTranslation(
  738. unsigned int handle_id, int enable);
  739. /**
  740. \brief Set instance target xyz position range.
  741. \param handle_id is the target instance handle
  742. \param min_x is min position of x world coordinate
  743. \param min_y is min position of y world coordinate
  744. \param min_z is min position of z world coordinate
  745. \param max_x is max position of x world coordinate
  746. \param max_y is max position of y world coordinate
  747. \param max_z is max position of z world coordinate
  748. \return zero for failed, one for success
  749. */
  750. FUNAMA_API int fuSetInstanceTargetPositionRange(unsigned int handle_id,
  751. float min_x, float min_y,
  752. float min_z, float max_x,
  753. float max_y, float max_z);
  754. /**
  755. \brief Set instance scale center and scale ratio.
  756. \param handle_id is the target instance handle
  757. \param x is scale center position of x
  758. \param y is scale center position of y
  759. \param z is scale center position of z
  760. \param scale is scale ratio
  761. \return zero for failed, one for success
  762. */
  763. FUNAMA_API int fuSetInstanceScale(unsigned int handle_id, float scale_center_x,
  764. float scale_center_y, float scale_center_z,
  765. float scale_ratio);
  766. /**
  767. \brief Set instance color.
  768. \param handle_id is the target instance handle
  769. \param color_name is the color name
  770. \param r is color of R channel, from 0 to 255
  771. \param g is color of G channel, from 0 to 255
  772. \param b is color of B channel, from 0 to 255
  773. \return zero for failed, one for success
  774. */
  775. FUNAMA_API int fuSetInstanceColor(unsigned int handle_id,
  776. const char* color_name, int r, int g, int b);
  777. /**
  778. \brief Set instance color intensity, for old color change type.
  779. \param handle_id is the target instance handle
  780. \param color_name is the color name
  781. \param intensity, intensity
  782. \return zero for failed, one for success
  783. */
  784. FUNAMA_API int fuSetInstanceColorIntensity(unsigned int handle_id,
  785. const char* color_name,
  786. float intensity);
  787. /**
  788. \brief Set instance single face beauty color.
  789. \param handle_id is the target instance handle
  790. \param face_beauty_handle is the target face beauty item handle
  791. \param r is color of R channel, from 0 to 255
  792. \param g is color of G channel, from 0 to 255
  793. \param b is color of B channel, from 0 to 255
  794. \return zero for failed, one for success
  795. */
  796. FUNAMA_API int fuSetInstanceFacebeautyColor(unsigned int handle_id,
  797. int face_beauty_handle, int r,
  798. int g, int b);
  799. /**
  800. \brief Enable instance self collision.
  801. \param handle_id is the target instance handle
  802. \param enable > 0 means turn on , enable <= 0 means turn off
  803. \return zero for failed, one for success
  804. */
  805. FUNAMA_API int fuEnableInstanceSelfCollision(unsigned int handle_id,
  806. int enable);
  807. /*
  808. * animation releated api
  809. */
  810. /**
  811. \brief Play instance target animation.
  812. \param handle_id is the target instance handle
  813. \param anim_handle is target animation item handle
  814. \return zero for failed, one for success
  815. */
  816. FUNAMA_API int fuPlayInstanceAnimation(unsigned int handle_id, int anim_handle);
  817. /**
  818. \brief Play instance target animation once.
  819. \param handle_id is the target instance handle
  820. \param anim_handle is target animation item handle
  821. \return zero for failed, one for success
  822. */
  823. FUNAMA_API int fuPlayInstanceAnimationOnce(unsigned int handle_id,
  824. int anim_handle);
  825. /**
  826. \brief Start or continue to play instance current animation again.
  827. \param handle_id is the target instance handle
  828. \return zero for failed, one for success
  829. */
  830. FUNAMA_API int fuStartInstanceAnimation(unsigned int handle_id);
  831. /**
  832. \brief Pause instance current animation.
  833. \param handle_id is the target instance handle
  834. \return zero for failed, one for success
  835. */
  836. FUNAMA_API int fuPauseInstanceAnimation(unsigned int handle_id);
  837. /**
  838. \brief Stop instance current animation.
  839. \param handle_id is the target instance handle
  840. \return zero for failed, one for success
  841. */
  842. FUNAMA_API int fuStopInstanceAnimation(unsigned int handle_id);
  843. /**
  844. \brief Restart instance current animation.
  845. \param handle_id is the target instance handle
  846. \return zero for failed, one for success
  847. */
  848. FUNAMA_API int fuResetInstanceAnimation(unsigned int handle_id);
  849. /**
  850. \brief Set instance animation transition time.
  851. \param handle_id is the target instance handle
  852. \param time is transition time in seconds
  853. \return zero for failed, one for success
  854. */
  855. FUNAMA_API int fuSetInstanceAnimationTransitionTime(unsigned int handle_id,
  856. float time);
  857. /**
  858. \brief Turn on or off instance animation internal lerp.
  859. \param handle_id is the target instance handle
  860. \param enable > 0 means turn on , enable <= 0 means turn off
  861. \return zero for failed, one for success
  862. */
  863. FUNAMA_API int fuEnableInstanceAnimationInternalLerp(unsigned int handle_id,
  864. int enable);
  865. /*
  866. * DynamicBone releated api
  867. */
  868. /**
  869. \brief Enable DynamicBone or not.
  870. \param handle_id is the target scene handle
  871. \param enable > 0 means turn on , enable <= 0 means turn off
  872. \return zero for failed, one for success
  873. */
  874. FUNAMA_API int fuEnableDynamicBone(unsigned int handle_id, int enable);
  875. /**
  876. \brief Reset instance DynamicBone rigid body position.
  877. \param handle_id is the target instance handle
  878. \param immediate > 0 means reset DynamicBone immediate, <= 0 means delayed
  879. \return zero for failed, one for success
  880. */
  881. FUNAMA_API int fuResetInstanceDynamicBone(unsigned int handle_id,
  882. int immediate);
  883. /**
  884. \brief Refresh/rebuild instance DynamicBone, time consuming
  885. \param handle_id is the target instance handle
  886. \param immediate > 0 means reset DynamicBone immediate, <= 0 means delayed
  887. \return zero for failed, one for success
  888. */
  889. FUNAMA_API int fuRefreshInstanceDynamicBone(unsigned int handle_id,
  890. int immediate);
  891. /**
  892. \brief Enable instance model mat to bone or not
  893. \param handle_id is the target instance handle
  894. \param enable > 0 means enable , enable <= 0 means not
  895. \return zero for failed, one for success
  896. */
  897. FUNAMA_API int fuEnableInstanceModelMatToBone(unsigned int handle_id,
  898. int enable);
  899. /**
  900. \brief Open instance single mesh DynamicBone or close
  901. \param handle_id is the target instance handle
  902. \param mesh_handle is target mesh item handle
  903. \param enable > 0 means open, enable <= 0 means close
  904. \return zero for failed, one for success
  905. */
  906. FUNAMA_API int fuEnableInstanceSingleDynamicBone(unsigned int handle_id,
  907. int mesh_handle, int enable);
  908. /**
  909. \brief Enable instance DynamicBone teleport mode or not.
  910. \param handle_id is the target instance handle
  911. \param enable > 0 means turn on , enable <= 0 means turn off
  912. \return zero for failed, one for success
  913. */
  914. FUNAMA_API int fuEnableInstanceDynamicBoneTeleportMode(unsigned int handle_id,
  915. int enable);
  916. /**
  917. \brief Enable instance DynamicBone root translation speed limit mode or not.
  918. \param handle_id is the target instance handle
  919. \param enable > 0 means turn on , enable <= 0 means turn off
  920. \return zero for failed, one for success
  921. */
  922. FUNAMA_API int fuEnableInstanceDynamicBoneRootTranslationSpeedLimitMode(
  923. unsigned int handle_id, int enable);
  924. /**
  925. \brief Enable instance DynamicBone root rotation speed limit mode or not.
  926. \param handle_id is the target instance handle
  927. \param enable > 0 means turn on , enable <= 0 means turn off
  928. \return zero for failed, one for success
  929. */
  930. FUNAMA_API int fuEnableInstanceDynamicBoneRootRotationSpeedLimitMode(
  931. unsigned int handle_id, int enable);
  932. /*
  933. * MVP related api
  934. */
  935. /**
  936. \brief Use orthogonal projection or perspective projection for the target
  937. scene.
  938. \param handle_id is the target scene handle
  939. \param enable = 1 means use orthogonal projection, enable = 0 means use
  940. perspective projection
  941. \return zero for failed, one for success
  942. */
  943. FUNAMA_API int fuEnableOrthogonalProjection(unsigned int handle_id, int enable);
  944. /**
  945. \brief Set perspective projection matrix's fov for the target scene.
  946. \param handle_id is the target scene handle
  947. \param fov is the degree of angle, from 0 to 180
  948. \return zero for failed, one for success
  949. */
  950. FUNAMA_API int fuSetProjectionMatrixFov(unsigned int handle_id, float fov);
  951. /**
  952. \brief Set orthogonal projection matrix's frustum size for the target scene.
  953. \param handle_id is the target scene handle
  954. \param size is frustum size in X-coordinate
  955. \return zero for failed, one for success
  956. */
  957. FUNAMA_API int fuSetProjectionMatrixOrthoSize(unsigned int handle_id,
  958. float size);
  959. /**
  960. \brief Set projection matrix's z_near for the target scene.
  961. \param handle_id is the target scene handle
  962. \param z_near
  963. \return zero for failed, one for success
  964. */
  965. FUNAMA_API int fuSetProjectionMatrixZnear(unsigned int handle_id, float z_near);
  966. /**
  967. \brief Set projection matrix's z_far for the target scene.
  968. \param handle_id is the target scene handle
  969. \param z_far
  970. \return zero for failed, one for success
  971. */
  972. FUNAMA_API int fuSetProjectionMatrixZfar(unsigned int handle_id, float z_far);
  973. /**
  974. \brief Set view matrix for the target scene.
  975. \param handle_id is the target scene handle
  976. \param eye_x
  977. \param eye_y
  978. \param eye_z
  979. \param center_x
  980. \param center_y
  981. \param center_z
  982. \param up_x
  983. \param up_y
  984. \param up_z
  985. \return zero for failed, one for success
  986. */
  987. FUNAMA_API int fuSetViewMatrix(unsigned int handle_id, float eye_x, float eye_y,
  988. float eye_z, float center_x, float center_y,
  989. float center_z, float up_x, float up_y,
  990. float up_z);
  991. /**
  992. \brief Enable use outer MVP matrix for the target scene.
  993. \param handle_id is the target scene handle
  994. \param enable > 0 means use outer MVP matrix, enable <= 0 means not
  995. \return zero for failed, one for success
  996. */
  997. FUNAMA_API int fuEnableOuterMVPMatrix(unsigned int handle_id, int enable);
  998. /**
  999. \brief Set outer projection matrix for the target scene.
  1000. \param handle_id is the target scene handle
  1001. \param mat, 4x4 matrix
  1002. \return zero for failed, one for success
  1003. */
  1004. FUNAMA_API int fuSetOuterProjectionMatrix(unsigned int handle_id,
  1005. const float* mat);
  1006. /**
  1007. \brief Set outer view matrix for the target scene.
  1008. \param handle_id is the target scene handle
  1009. \param mat, 4x4 column major matrix
  1010. \return zero for failed, one for success
  1011. */
  1012. FUNAMA_API int fuSetOuterViewMatrix(unsigned int handle_id, const float* mat);
  1013. /**
  1014. \brief Set background params for the target scene.
  1015. \param handle_id is the target scene handle
  1016. \param bg_handle is the target background item handle
  1017. \param x_size is normalized width of background, from 0.0 to 1.0
  1018. \param y_size is normalized height of background, from 0.0 to 1.0
  1019. \param x_offset is normalized offset , form -1.0 to 1.0
  1020. \param x_offset is normalized offset , form -1.0 to 1.0
  1021. \param is_foreground, is foreground or background
  1022. \param mode, 0 is for stretch, 1 is for crop
  1023. \return zero for failed, one for success
  1024. */
  1025. FUNAMA_API int fuSetBackgroundParams(unsigned int handle_id, int bg_handle,
  1026. float x_size, float y_size, float x_offset,
  1027. float y_offset, int is_foreground,
  1028. int mode);
  1029. /**
  1030. \brief Set sprite usage, by default sprite is a normal 2d sprite
  1031. \param handle_id is the target scene handle
  1032. \param bg_handle is the target background item handle
  1033. \param is_mask, if usage==1, it's a 2d mask, if usage==2, it's a sprite clipped
  1034. by mask \return zero for failed, one for success
  1035. */
  1036. FUNAMA_API int fuSetSpriteUsage(unsigned int handle_id, int bg_handle,
  1037. int usage);
  1038. /**
  1039. \brief Update background texture with a rgba buffer
  1040. \param handle_id is the target scene handle
  1041. \param bg_handle is the target background item handle
  1042. \param value rgba buffer
  1043. \param width image width
  1044. \param height image height
  1045. \return zero for failure, non-zero for success
  1046. */
  1047. FUNAMA_API int fuUpdateBackgroundTexture(unsigned int handle_id, int bg_handle,
  1048. void* value, int width, int height);
  1049. /**
  1050. \brief Set sprite9 params for the target scene.
  1051. \param handle_id is the target scene handle
  1052. \param bg_handle is the target background item handle
  1053. \param src_offset_to_left_edge is the distance from source image left edge in
  1054. pixel \param src_offset_to_right_edge is the distance from source image right
  1055. edge in pixel \param src_offset_to_top_edge is the distance from source image
  1056. top edge in pixel \param src_offset_to_bottom_edge is the distance from source
  1057. image bottom edge in pixel \param x_size is normalized width of background,
  1058. from 0.0 to 1.0 \param y_size is normalized height of background, from 0.0
  1059. to 1.0 \param x_offset is normalized offset , form -1.0 to 1.0 \param x_offset
  1060. is normalized offset , form -1.0 to 1.0 \param is_foreground, is foreground or
  1061. background \return zero for failed, one for success
  1062. */
  1063. FUNAMA_API int fuSetSprite9Params(unsigned int handle_id, int bg_handle,
  1064. int src_offset_to_left_edge,
  1065. int src_offset_to_right_edge,
  1066. int src_offset_to_top_edge,
  1067. int src_offset_to_bottom_edge, float x_size,
  1068. float y_size, float x_offset, float y_offset,
  1069. int is_foreground);
  1070. /**
  1071. \brief Update sprite9 texture with a rgba buffer
  1072. \param handle_id is the target scene handle
  1073. \param bg_handle is the target background item handle
  1074. \param value rgba buffer
  1075. \param width image width
  1076. \param height image height
  1077. \return zero for failure, non-zero for success
  1078. */
  1079. FUNAMA_API int fuUpdateSprite9Texture(unsigned int handle_id, int bg_handle,
  1080. void* value, int width, int height);
  1081. /**
  1082. \brief Reset 2D background or foreground animation for the target scene.
  1083. \param handle_id is the target scene handle
  1084. \param bg_handle is the target background item handle
  1085. \return zero for failed, one for success
  1086. */
  1087. FUNAMA_API int fuResetBackgroundAnimation(unsigned int handle_id,
  1088. int bg_handle);
  1089. /**
  1090. \brief Enable 2D background or foreground animation Loop.
  1091. \param handle_id is the target scene handle
  1092. \param bg_handle is the target background item handle
  1093. \param enable is enable loop
  1094. \return zero for failed, one for success
  1095. */
  1096. FUNAMA_API int fuEnableBackgroundAnimationLoop(unsigned int handle_id,
  1097. int bg_handle, int enable);
  1098. /**
  1099. \brief Reset light animation for the target scene.
  1100. \param handle_id is the target scene handle
  1101. \return zero for failed, one for success
  1102. */
  1103. FUNAMA_API int fuResetLightAnimation(unsigned int handle_id);
  1104. /**
  1105. \brief Set outer model matrix for the target scene.
  1106. \param handle_id is the target scene handle
  1107. \param mat, 4x4 column major matrix
  1108. \return zero for failed, one for success
  1109. */
  1110. FUNAMA_API int fuSetOuterModelMatrix(unsigned int handle_id, const float* mat);
  1111. /*
  1112. * get api
  1113. */
  1114. /**
  1115. \brief Get projection matrix's z_near for the target scene.
  1116. \param handle_id is the target scene handle
  1117. \return z_near
  1118. */
  1119. FUNAMA_API float fuGetProjectionMatrixZnear(unsigned int handle_id);
  1120. /**
  1121. \brief Get projection matrix's z_far for the target scene.
  1122. \param handle_id is the target scene handle
  1123. \return z_far
  1124. */
  1125. FUNAMA_API int fuGetProjectionMatrixZfar(unsigned int handle_id);
  1126. /**
  1127. \brief Get camera animation frame number for the target scene.
  1128. \param handle_id is the target scene handle
  1129. \param anim_handle is the target camera animation item handle
  1130. \return frame number
  1131. */
  1132. FUNAMA_API int fuGetCameraAnimationFrameNumber(unsigned int handle_id,
  1133. int anim_handle);
  1134. /**
  1135. \brief Get camera animation progress for the target scene.
  1136. \param handle_id is the target scene handle
  1137. \param anim_handle is the target camera animation item handle
  1138. \return progress
  1139. */
  1140. FUNAMA_API float fuGetCameraAnimationProgress(unsigned int handle_id,
  1141. int anim_handle);
  1142. /**
  1143. \brief Get camera animation transition progress for the target scene.
  1144. \param handle_id is the target scene handle
  1145. \return transition progress
  1146. */
  1147. FUNAMA_API float fuGetCameraAnimationTransitionProgress(unsigned int handle_id);
  1148. /**
  1149. \brief Get instance facepup original value.
  1150. \param handle_id is the target instance handle
  1151. \param name is the parameter name
  1152. \return facepup original value
  1153. */
  1154. FUNAMA_API float fuGetInstanceFacepupOriginalValue(unsigned int handle_id,
  1155. const char* name);
  1156. /**
  1157. \brief Get instance facepup array.
  1158. \param handle_id is the target instance handle
  1159. \param ret allocated memory space as container
  1160. \param size is number of float allocated in ret
  1161. \return 1 means successful fetch, container filled with info 0 means failure
  1162. */
  1163. FUNAMA_API int fuGetInstanceFacepupArray(unsigned int handle_id, float* ret,
  1164. int size);
  1165. /**
  1166. \brief Get instance skin color index.
  1167. \param handle_id is the target instance handle
  1168. \return skin color index
  1169. */
  1170. FUNAMA_API int fuGetInstanceSkinColorIndex(unsigned int handle_id);
  1171. /**
  1172. \brief Get instance local boundingbox, six dimensional
  1173. \param handle_id is the target instance handle
  1174. \param ret allocated memory space as container
  1175. \param size is number of float allocated in ret
  1176. \return 1 means successful fetch, container filled with info 0 means failure
  1177. */
  1178. FUNAMA_API int fuGetInstanceLocalBoundingBox(unsigned int handle_id, float* ret,
  1179. int size);
  1180. /**
  1181. \brief Get instance position, three dimensional
  1182. \param handle_id is the target instance handle
  1183. \param ret allocated memory space as container
  1184. \param size is number of float allocated in ret
  1185. \return 1 means successful fetch, container filled with info 0 means failure
  1186. */
  1187. FUNAMA_API int fuGetInstancePosition(unsigned int handle_id, float* ret,
  1188. int size);
  1189. /**
  1190. \brief Get instance head center screen coordinate, two dimensional
  1191. \param handle_id is the target instance handle
  1192. \param ret allocated memory space as container
  1193. \param size is number of float allocated in ret
  1194. \return 1 means successful fetch, container filled with info 0 means failure
  1195. */
  1196. FUNAMA_API int fuGetInstanceHeadCenterScreenCoordinate(unsigned int handle_id,
  1197. float* ret, int size);
  1198. /**
  1199. \brief Get instance bone screen coordinate, two dimensional
  1200. \param handle_id is the target instance handle
  1201. \param name is the target bone name
  1202. \param ret allocated memory space as container
  1203. \param size is number of float allocated in ret
  1204. \return 1 means successful fetch, container filled with info 0 means failure
  1205. */
  1206. FUNAMA_API int fuGetInstanceBoneScreenCoordinate(unsigned int handle_id,
  1207. const char* name, float* ret,
  1208. int size);
  1209. /**
  1210. \brief Get instance Face vertex screen coordinate, two dimensional
  1211. \param handle_id is the target instance handle
  1212. \param index is the target instance handle
  1213. \param ret allocated memory space as container
  1214. \param size is number of float allocated in ret
  1215. \return 1 means successful fetch, container filled with info 0 means failure
  1216. */
  1217. FUNAMA_API int fuGetInstanceFaceVertexScreenCoordinate(unsigned int handle_id,
  1218. int index, float* ret,
  1219. int size);
  1220. /**
  1221. \brief Get instance boundingBox screen coordinate, four dimensional
  1222. \param handle_id is the target instance handle
  1223. \param ret allocated memory space as container
  1224. \param size is number of float allocated in ret
  1225. \return 1 means successful fetch, container filled with info 0 means failure
  1226. */
  1227. FUNAMA_API int fuGetInstanceBoundingBoxScreenCoordinate(unsigned int handle_id,
  1228. float* ret, int size);
  1229. /**
  1230. \brief Get instance boundingBox screen coordinate, four dimensional, with aabb
  1231. offset
  1232. \param handle_id is the target instance handle
  1233. \param ret allocated memory space as container
  1234. \param size is number of float allocated in ret
  1235. \param x_min_offset is offset of local aabb min x
  1236. \param y_min_offset is offset of local aabb min y
  1237. \param z_min_offset is offset of local aabb min z
  1238. \param x_max_offset is offset of local aabb max x
  1239. \param y_max_offset is offset of local aabb max y
  1240. \param z_max_offset is offset of local aabb max z
  1241. \return 1 means successful fetch, container filled with info 0 means failure
  1242. */
  1243. FUNAMA_API int fuGetInstanceBoundingBoxScreenCoordinateWithOffset(
  1244. unsigned int handle_id, float* ret, int size, float x_min_offset,
  1245. float y_min_offset, float z_min_offset, float x_max_offset,
  1246. float y_max_offset, float z_max_offset);
  1247. /**
  1248. \brief Get instance target animation frame number.
  1249. \param handle_id is the target instance handle
  1250. \param anim_handle is target animation item handle
  1251. \return animation frame number
  1252. */
  1253. FUNAMA_API int fuGetInstanceAnimationFrameNumber(unsigned int handle_id,
  1254. int anim_handle);
  1255. /**
  1256. \brief Get instance target animation progress
  1257. \param handle_id is the target instance handle
  1258. \param anim_handle is target animation item handle
  1259. \return animation progress
  1260. */
  1261. FUNAMA_API float fuGetInstanceAnimationProgress(unsigned int handle_id,
  1262. int anim_handle);
  1263. /**
  1264. \brief Get instance target animation transition progress
  1265. \param handle_id is the target instance handle
  1266. \param anim_handle is target animation item handle
  1267. \return animation transition progress
  1268. */
  1269. FUNAMA_API float fuGetInstanceAnimationTransitionProgress(
  1270. unsigned int handle_id, int anim_handle);
  1271. /**
  1272. \brief Set the human processor type.
  1273. \param handle_id: the target instance handle
  1274. \param human_processor_type: 0 for AI fuai, 1 for the rigging_bvhinput_processor.
  1275. \return zero for failed, one for success
  1276. */
  1277. FUNAMA_API int fuSetInstanceHumanProcessorType(unsigned int handle_id,
  1278. int human_processor_type);
  1279. /**
  1280. \brief Set the rigging retargeter follow mode.
  1281. \param handle_id is the target instance handle
  1282. \param follow_mode: follow_mode, only support
  1283. FUAIHUMAN_FOLLOW_MODE_FIX: fix the root at it's bind position.
  1284. FUAIHUMAN_FOLLOW_MODE_ALIGN: align the avatar to the real
  1285. person, but scale the root translation by the avatar leg height(root to
  1286. ground).
  1287. FUAIHUMAN_FOLLOW_MODE_STAGE: make the avatar move from the origin(foot
  1288. from the origin).
  1289. \return zero for failed, one for scuess
  1290. */
  1291. FUNAMA_API int fuSetInstanceRiggingRetargeterAvatarFollowMode(
  1292. unsigned int handle_id, FUAIHUMANFOLLOWMODE follow_mode);
  1293. /**
  1294. \brief Set the rigging retargeter translation scale under FUAIHUMAN_FOLLOW_MODE_FIX mode.
  1295. \param handle_id is the target instance handle
  1296. \param scale_x: scale of root's x. >= 0
  1297. \param scale_y: scale of root's y. >= 0
  1298. \param scale_z: scale of root's z. >= 0
  1299. \return zero for failed, one for scuess
  1300. */
  1301. FUNAMA_API int fuSetInstanceRiggingRetargeterAvatarFixModeTransScale(
  1302. unsigned int handle_id, float scale_x, float scale_y, float scale_z);
  1303. /**
  1304. \brief Set the rigging retargeter target bonemap.
  1305. \param handle_id is the target instance handle
  1306. \param bonemap_buffer_ptr: json file description of skeleton hierarchy. ref to boneMap.json
  1307. \param bonemap_buffer_size, size of data in bytes.
  1308. \param bonemap_hashcode, bonemap's hashcode.
  1309. \return zero for failed, one for scuess
  1310. */
  1311. FUNAMA_API int fuSetInstanceRiggingRetargeterAvatarBonemap(
  1312. unsigned int handle_id, const char* bonemap_buffer_ptr,
  1313. const int bonemap_buffer_size, const unsigned long long bonemap_hashcode);
  1314. /**
  1315. \brief Set the rigging retargeter retarget mapping.
  1316. \param handle_id is the target instance handle
  1317. \param mapping_buffer_ptr: json file description of the retarget mapping.
  1318. \param mapping_buffer_size, size of data in bytes.
  1319. \return zero for failed, one for scuess
  1320. */
  1321. FUNAMA_API int fuSetInstanceRiggingRetargeterRetargetMapping(
  1322. unsigned int handle_id, const char* mapping_buffer_ptr,
  1323. const int mapping_buffer_size);
  1324. /**
  1325. \brief Set the rigging retargeter use collision or not.
  1326. \param handle_id is the target instance handle
  1327. \param use_collision: use collision or not.
  1328. \return zero for failed, one for scuess
  1329. */
  1330. FUNAMA_API int fuSetInstanceRiggingRetargeterUseCollision(
  1331. unsigned int handle_id, bool use_collision);
  1332. /**
  1333. \brief Set the rigging retargeter retarget collision config.
  1334. \param handle_id is the target instance handle
  1335. \param collision_config_ptr: json file description of the collision config.
  1336. \param collision_config_size, size of data in bytes.
  1337. \return zero for failed, one for scuess
  1338. */
  1339. FUNAMA_API int fuSetInstanceRiggingRetargeterCollisionConfig(
  1340. unsigned int handle_id, const char* collision_config_ptr,
  1341. const int collision_config_size);
  1342. /**
  1343. \brief Set the rigging retargeter use euler limits or not.
  1344. \param handle_id is the target instance handle
  1345. \param use_euler_limits: use euler limits or not.
  1346. \return zero for failed, one for scuess
  1347. */
  1348. FUNAMA_API int fuSetInstanceRiggingRetargeterUseEulerLimits(
  1349. unsigned int handle_id, bool use_euler_limits);
  1350. /**
  1351. \brief Set the rigging retargeter retarget euler limit config.
  1352. \param handle_id is the target instance handle
  1353. \param euler_limit_config_ptr: json file description of the euler limit config.
  1354. \param euler_limit_config_size, size of data in bytes.
  1355. \return zero for failed, one for scuess
  1356. */
  1357. FUNAMA_API int fuSetInstanceRiggingRetargeterEulerLimitConfig(
  1358. unsigned int handle_id, const char* euler_limit_config_ptr,
  1359. const int euler_limit_config_size);
  1360. /**
  1361. \brief Set the rigging retargeter retarget final mirror type.
  1362. \param handle_id is the target instance handle
  1363. \param final_mirror_type: final mirror type. Default FUAIHUMAN_MIRROR_NONE(3).
  1364. 0:left-right mirror
  1365. 1:top-bottom mirror
  1366. 2:both mirror(rotate 180 degree)
  1367. 3:no mirror.
  1368. \return zero for failed, one for scuess
  1369. */
  1370. FUNAMA_API int fuSetInstanceRiggingRetargeterFinalMirrorType(
  1371. unsigned int handle_id, FUAIHUMANMIRRORTYPE final_mirror_type);
  1372. /**
  1373. \brief Set the rigging bvh input processor config.
  1374. \param handle_id is the target scene handle
  1375. \param bvh_buffer_ptr: bvh header buffer ptr.
  1376. \param bvh_buffer_size, bvh header buffer length.
  1377. \param mapping_buffer_ptr: json file description of the retarget mapping.
  1378. \param mapping_buffer_size, size of data in bytes.
  1379. \return zero for failed, one for scuess
  1380. */
  1381. FUNAMA_API int fuRiggingBVHInputProcessorSetConfig(
  1382. unsigned int handle_id, const char* bvh_buffer_ptr,
  1383. const int bvh_buffer_size, const char* mapping_buffer_ptr,
  1384. const int mapping_buffer_size);
  1385. /**
  1386. \brief Feed the rigging bvh input processor with one motion frame.
  1387. \param handle_id is the target scene handle
  1388. \param motion_frame_ptr: pointer to motion frame data(structure is defined by bvh header setted by fuRiggingBVHInputProcessorSetConfig).
  1389. \param motion_frame_len: length of the motion frame data.
  1390. \return zero for failed, one for scuess
  1391. */
  1392. FUNAMA_API int fuRiggingBVHInputProcessorFeedMotionFrame(
  1393. unsigned int handle_id, const float* motion_frame_ptr,
  1394. const int motion_frame_len);
  1395. #ifdef __cplusplus
  1396. }
  1397. #endif
  1398. #endif // !CNAMASDK_H