LightGlareSave.cpp 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. ** Command & Conquer Renegade(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. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Max2W3D *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/max2w3d/LightGlareSave.cpp $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 8/06/00 11:21a $*
  31. * *
  32. * $Revision:: 2 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #include "LightGlareSave.h"
  38. #include "w3d_file.h"
  39. #include "util.h"
  40. #include "w3dappdata.h"
  41. #include "errclass.h"
  42. LightGlareSaveClass::LightGlareSaveClass
  43. (
  44. char * mesh_name,
  45. char * container_name,
  46. INode * inode,
  47. Matrix3 & exportspace,
  48. TimeValue curtime,
  49. Progress_Meter_Class & meter
  50. )
  51. {
  52. //////////////////////////////////////////////////////////////////////
  53. // Init the glare info
  54. //////////////////////////////////////////////////////////////////////
  55. memset(&GlareData,0,sizeof(GlareData));
  56. //////////////////////////////////////////////////////////////////////
  57. // Get the position of the pivot point relative to the given
  58. // export coordinate system.
  59. //////////////////////////////////////////////////////////////////////
  60. // Transform the mesh into the desired coordinate system
  61. Matrix3 node_matrix = inode->GetObjectTM(curtime);
  62. Matrix3 offset_matrix = node_matrix * Inverse(exportspace);
  63. GlareData.Position.X = offset_matrix.GetTrans().x;
  64. GlareData.Position.Y = offset_matrix.GetTrans().y;
  65. GlareData.Position.Z = offset_matrix.GetTrans().z;
  66. }
  67. int LightGlareSaveClass::Write_To_File(ChunkSaveClass & csave)
  68. {
  69. csave.Begin_Chunk(W3D_CHUNK_LIGHTGLARE);
  70. csave.Begin_Chunk(W3D_CHUNK_LIGHTGLARE_INFO);
  71. csave.Write(&GlareData,sizeof(GlareData));
  72. csave.End_Chunk();
  73. csave.End_Chunk();
  74. return 0;
  75. }