polyinfo.cpp 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 : WW3D *
  23. * *
  24. * $Archive:: /Commando/Code/ww3d2/polyinfo.cpp $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 2/07/01 12:50p $*
  31. * *
  32. * $Revision:: 3 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #include "polyinfo.h"
  38. #include "texture.h"
  39. #include "vertmaterial.h"
  40. #include "shader.h"
  41. void PolygonInfoClass::Set_Texture(TextureClass *texture)
  42. {
  43. if(texture)
  44. texture->Add_Ref();
  45. if(Texture)
  46. Texture->Release_Ref();
  47. Texture = texture;
  48. }
  49. void PolygonInfoClass::Set_Vertex_Material(VertexMaterialClass *vertexMaterial)
  50. {
  51. if(vertexMaterial)
  52. vertexMaterial->Add_Ref();
  53. if(VertexMaterial)
  54. VertexMaterial->Release_Ref();
  55. VertexMaterial = vertexMaterial;
  56. }
  57. void PolygonInfoClass::Set_Shader(ShaderClass *shader)
  58. {
  59. if(Shader)
  60. delete Shader;
  61. // todo : update for refcounted shaders
  62. Shader = new ShaderClass(* shader);
  63. }
  64. PolygonInfoClass::~PolygonInfoClass()
  65. {
  66. if(Texture)
  67. Texture->Release_Ref();
  68. if(VertexMaterial)
  69. VertexMaterial->Release_Ref();
  70. // todo : update for refcounted shaders
  71. if(Shader)
  72. delete Shader;
  73. }