util.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: /Commando/Code/Tools/max2w3d/util.h 25 10/27/00 4:11p Greg_h $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando Tools - W3D export *
  24. * *
  25. * $Archive:: /Commando/Code/Tools/max2w3d/util.h $*
  26. * *
  27. * $Author:: Greg_h $*
  28. * *
  29. * $Modtime:: 10/27/00 10:24a $*
  30. * *
  31. * $Revision:: 25 $*
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef UTIL_H
  37. #define UTIL_H
  38. #ifndef ALWAYS_H
  39. #include "always.h"
  40. #endif
  41. #include <Max.h>
  42. #include "skin.h"
  43. #include "nodelist.h"
  44. /*
  45. ** Gets rid of very small numbers in the matrix
  46. ** (sets them to zero).
  47. */
  48. Matrix3 Cleanup_Orthogonal_Matrix(Matrix3 & mat);
  49. /*
  50. ** Naming utility functions
  51. */
  52. void Set_W3D_Name(char * set_name,const char * src);
  53. void Split_Node_Name(const char * name,char * set_base,char * set_exten,int * set_exten_index);
  54. bool Append_Lod_Character(char *meshname, int lod_level, INodeListClass *origin_list);
  55. /*
  56. ** File path utility functions
  57. */
  58. void Create_Full_Path(char *full_path, const char *cwd, const char *rel_path);
  59. void Create_Relative_Path(char *rel_path, const char *cwd, const char *full_path);
  60. bool Is_Full_Path(char * path);
  61. /*
  62. ** Check if this is some kind of triangle mesh inside of MAX. We will assume
  63. ** different default export behavior depending on whether the object is a
  64. ** triangle mesh or not.
  65. */
  66. bool Is_Max_Tri_Mesh(INode * node);
  67. /*
  68. ** Origin support.
  69. */
  70. bool Is_Origin(INode *node);
  71. bool Is_Base_Origin(INode *node);
  72. INode *Find_Origin(INode *node);
  73. bool Is_Damage_Root(INode *node);
  74. /*
  75. ** Lod-Level and Damage State settings for an INode
  76. */
  77. int Get_Lod_Level(INode *node);
  78. int Get_Damage_State(INode *node);
  79. /*
  80. ** Utility function to find a named node in a hierarchy.
  81. */
  82. INode *Find_Named_Node (char *nodename, INode *root);
  83. /*
  84. ** Macros
  85. */
  86. #define SAFE_DELETE(pobject) \
  87. if (pobject) { \
  88. delete pobject; \
  89. pobject = NULL; \
  90. } \
  91. #define SAFE_DELETE_ARRAY(pobject) \
  92. if (pobject) { \
  93. delete [] pobject; \
  94. pobject = NULL; \
  95. } \
  96. #endif