envisual.c 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. /**
  2. * \defgroup Visual Visual objects
  3. * @{
  4. */
  5. //! Loads object from data, or gets it from cache. Object must be released when not used
  6. proto native vobject GetObject(string name);
  7. /*!
  8. Release object. When there are not any other references, object is stored into cache and ready to be victed if necessary.
  9. \param object Object handle
  10. \param flag If RF_RELEASE is used, the object is evicted immediatelly, if not used by anyone else
  11. */
  12. proto native void ReleaseObject(vobject object, int flag = 0);
  13. //! Returns number of frames, if the object is animation
  14. proto native int GetNumAnimFrames(vobject anim);
  15. //! Returns name of visual object
  16. proto string vtoa(vobject vobj);
  17. /**
  18. * \defgroup MeshObject Mesh object (XOB)
  19. * @{
  20. */
  21. proto int GetObjectMaterials(vobject object, string materials[]);
  22. // dynamic model creation (for dynamic aabb triggers)
  23. //proto void CreateModel(IEntity ent, vector mins, vector maxs);
  24. //proto void RemoveModel(IEntity ent);
  25. //! Dynamic MeshObject
  26. proto vobject CreateXOB(int nsurfaces, int nverts[], int numindices[], string materials[]);
  27. proto void UpdateVertsEx(notnull IEntity ent, int surf, vector verts[], float uv[]);
  28. proto void UpdateIndices(vobject obj, int surf, int indices[]);
  29. proto native void SetBone(notnull IEntity ent, int bone, vector angles, vector trans, float scale);
  30. proto native bool SetBoneMatrix(notnull IEntity ent, int bone, vector mat[4]);
  31. proto native void SetBoneGlobal(notnull IEntity ent, int bone, vector mat[4]);
  32. proto native bool GetBoneMatrix(notnull IEntity ent, int bone, vector mat[4]);
  33. proto native bool GetBoneLocalMatrix(notnull IEntity ent, int bone, vector mat[4]);
  34. proto native void SetAnimFrame(notnull IEntity ent, int slot, float frame);
  35. //! BoneMask == NULL means that all bits are set
  36. //! WARNING: Non-managed, needs manual delete call, should not be ref'd
  37. class BoneMask
  38. {
  39. int Mask[8]
  40. }
  41. enum AnimFlags
  42. {
  43. //! animation is played only once and then if freezes at the last frame. EntityEvent.ANIMEND is called
  44. ONCE,
  45. /*! defaultne zustava animace pri prehravani a AF_ONCE po skonceni na posledni frame "zamrzla", dokud neni nahrazena jinou,
  46. nebo neni kanal vynulovan. Pokud se nastavi AF_BLENDOUT, postara se engine o vyhozeni animace sam a pro preblendovani pouzije hodnotu
  47. blendout. Pokud je odchycen EOnAnimEnd a byla zmenena animace na jinou, nebo byl kanal rucne vynulovan, tak se tato
  48. funkcnost neprovede. */
  49. BLENDOUT,
  50. //! animation waits on the first frame. Frame is set by calling SetFrame()
  51. USER,
  52. //! forces animation to start from begining (including blending)
  53. RESET,
  54. /*! defaul framerate is from anim.def. If it is missing, parametr fps applies
  55. It is possible to use fps parameter even when the framerate is defined in the anim.def, is using this flag
  56. */
  57. FORCEFPS,
  58. //! EntityEvent.ANIMEND will not be called
  59. NOANIMEND,
  60. //! Animhooks will not be called
  61. NOANIMHOOKS
  62. };
  63. proto native void SetAnimSlot(notnull IEntity ent, int slot, vobject anim, float blendin, float blendout, BoneMask mask, int fps, AnimFlags flags);
  64. // changes a mask and does the blending if the blendin is set
  65. proto native void ChangeAnimSlotMask(notnull IEntity ent, int slot, float blendin, BoneMask mask);
  66. // changes animation framerate to fps param
  67. proto native void ChangeAnimSlotFPS(notnull IEntity ent, int slot, int fps);
  68. // set mask for a channel. There are 12 chanels and mask is using first for bits 0..3
  69. proto native void SetAnimMask(notnull IEntity ent, int mask);
  70. // clears chanal mask, return bits which were cleared
  71. proto native int ClearAnimMask(notnull IEntity ent, int mask);
  72. //vrati nastavene bity tech kanalu, ktere maji nastavenou animaci, nejsou na konci
  73. // a pro ktere byla nastavena vstupni maska.
  74. //Je tim mozno se dotazat na stav vice slotu najednou
  75. proto native int IsAnimSlotPlaying(notnull IEntity ent, int mask);
  76. //mask - 16bitu, pro 16 anim slotu. Maximalni hodnota je tedy 0xffff!
  77. //sets how much this morph affect object
  78. proto native bool SetMorphState(notnull IEntity ent, string morph, float value);
  79. //morph name
  80. //value 0...1
  81. //@}
  82. /**
  83. * \defgroup ParticleEffect Particle effect API
  84. * @{
  85. */
  86. enum EmitorParam
  87. {
  88. //! Vector3 R/W
  89. CONEANGLE,
  90. //! Vector3 R/W
  91. EMITOFFSET,
  92. //! Float R/W
  93. VELOCITY,
  94. //! Float R/W
  95. VELOCITY_RND,
  96. //! Float R/W
  97. AVELOCITY,
  98. //! Float R/W
  99. SIZE,
  100. //! Float R/W
  101. STRETCH,
  102. //! begin with random rotation. Bool R/W
  103. RANDOM_ANGLE,
  104. //! rotate in random direction. Bool R/W
  105. RANDOM_ROT,
  106. //! Float R/W
  107. AIR_RESISTANCE,
  108. //! Float R/W
  109. AIR_RESISTANCE_RND,
  110. //! Float R/W
  111. GRAVITY_SCALE,
  112. //! Float R/W
  113. GRAVITY_SCALE_RND,
  114. //! Float R/W
  115. BIRTH_RATE,
  116. //! Float R/W
  117. BIRTH_RATE_RND,
  118. //! Float R/W
  119. LIFETIME,
  120. //! Float R/W
  121. LIFETIME_RND,
  122. //! Bool R/W
  123. LIFETIME_BY_ANIM,
  124. //! Bool R/W
  125. ANIM_ONCE,
  126. //! Bool R/W
  127. RAND_FRAME,
  128. //! efector's total time. Float R/W
  129. EFFECT_TIME,
  130. //! should efector repeate after time up? Bool R/W
  131. REPEAT,
  132. //! current efector's time. Float R/W
  133. CURRENT_TIME,
  134. //! number of active particles. Int R
  135. ACTIVE_PARTICLES,
  136. //! Bool R/W
  137. SORT,
  138. //! Bool R/W
  139. WIND,
  140. //! Float R/W
  141. SPRING
  142. };
  143. // return total count of active particles in all emitors
  144. // internally does a sum
  145. // HasActiveParticles is better when just needing to check if there are any active
  146. proto native int GetParticleCount(notnull IEntity ent);
  147. // return if there are any active particles
  148. proto bool HasActiveParticle(notnull IEntity ent);
  149. int ParticleGetCount(IEntity ent)
  150. {
  151. return GetParticleCount(ent);
  152. }
  153. bool ParticleHasActive(IEntity ent)
  154. {
  155. return HasActiveParticle(ent);
  156. }
  157. // gets name of defined emitors in a particle effect
  158. // return number of emitors and their names in an array (max defines max. emitors to return)
  159. proto int GetParticleEmitors(notnull IEntity ent, out string emitors[], int max);
  160. // return number of emitors
  161. proto int GetParticleEmitorCount(notnull IEntity ent);
  162. // sets a parametr of the particle emitor
  163. // if the emitor == - 1, it sets the parameter for all emitors
  164. proto void SetParticleParm(notnull IEntity ent, int emitor, EmitorParam parameter, void value);
  165. //gets parameter of particle emitor
  166. proto void GetParticleParm(notnull IEntity ent, int emitor, EmitorParam parameter, out void value);
  167. //gets original parameter of particle emitor
  168. proto void GetParticleParmOriginal(notnull IEntity ent, int emitor, EmitorParam parameter, out void value);
  169. //Force-changes particle emitor position to the current one.
  170. //Used for sudden changes of particle position to avoid spreading emitted
  171. //particles between previous and the new one position
  172. proto native void ResetParticlePosition(notnull IEntity ent);
  173. //Restart particle effect to its default state. This means no
  174. //particles, timer reset and so on. Usefull for implementing
  175. //particle cache.
  176. proto native void RestartParticle(notnull IEntity ent);
  177. //@}
  178. //@}