VeMeshGeometryNode.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #region License information
  2. // ----------------------------------------------------------------------------
  3. //
  4. // libeq2 - A library for analyzing the Everquest II File Format
  5. // Blaz (blaz@blazlabs.com)
  6. //
  7. // This program is free software; you can redistribute it and/or
  8. // modify it under the terms of the GNU General Public License
  9. // as published by the Free Software Foundation; either version 2
  10. // of the License, or (at your option) any later version.
  11. //
  12. // This program is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. // GNU General Public License for more details.
  16. //
  17. // You should have received a copy of the GNU General Public License
  18. // along with this program; if not, write to the Free Software
  19. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  20. //
  21. // ( The full text of the license can be found in the License.txt file )
  22. //
  23. // ----------------------------------------------------------------------------
  24. #endregion
  25. #region Using directives
  26. using System;
  27. using System.IO;
  28. using System.Collections.Generic;
  29. using System.Diagnostics;
  30. using Everquest2.Util;
  31. #endregion
  32. namespace Everquest2.Visualization
  33. {
  34. public class VeMeshGeometryNode : VeGeometryNode
  35. {
  36. public VeMeshGeometryNode()
  37. {
  38. }
  39. /// <summary>
  40. /// Special constructor used when deserializing the instance of the class.
  41. /// </summary>
  42. /// <param name="reader">Reader used to read the instance data.</param>
  43. protected VeMeshGeometryNode(Util.Eq2Reader reader, Util.StreamingContext context) : base(reader, context)
  44. {
  45. byte classVersion = context.ClassVersions[typeof(VeMeshGeometryNode)];
  46. if (classVersion == 0 || classVersion > 7)
  47. {
  48. throw new Util.DeserializationException("VeMeshGeometryNode version " + classVersion + " not supported");
  49. }
  50. lodCount = reader.ReadUInt32();
  51. Debug.Assert(lodCount <= 10/*Configuration.GetValue<uint>("cl_max_lods")*/);
  52. extraLodCount = 0;
  53. bool trigger = false;
  54. if ( WidgetID == 2720558016 )
  55. {
  56. int bleh = 0;
  57. trigger = true;
  58. }
  59. renderMeshNames = new string[lodCount][];
  60. for (uint i = 0; i < lodCount; ++i)
  61. {
  62. uint renderMeshNameCount;
  63. if (classVersion >= 5)
  64. {
  65. renderMeshNameCount = reader.ReadUInt32();
  66. }
  67. else
  68. {
  69. renderMeshNameCount = 1;
  70. }
  71. renderMeshNames[i] = new string[renderMeshNameCount];
  72. for (uint j = 0; j < renderMeshNameCount; ++j)
  73. {
  74. renderMeshNames[i][j] = reader.ReadString(2);
  75. if (renderMeshNames[i][j].Contains("qey_terrain_harbor_geo11_l0"))
  76. {
  77. int test = 0;
  78. }
  79. }
  80. }
  81. bool shaderPaletteIsInline = false;
  82. if (classVersion >= 6) shaderPaletteIsInline = reader.ReadBoolean();
  83. shaderPaletteNames = new string[lodCount];
  84. shaderPalettes = new VeShaderPalette[lodCount];
  85. for (uint i = 0; i < lodCount; ++i)
  86. {
  87. shaderPaletteNames[i] = reader.ReadString(2);
  88. if (shaderPaletteIsInline)
  89. {
  90. shaderPalettes[i] = (VeShaderPalette)reader.ReadObject();
  91. }
  92. }
  93. collisionMeshName = reader.ReadString(2);
  94. if (classVersion == 2) legacyNavigationMeshName = reader.ReadString(2);
  95. if (classVersion < 4)
  96. {
  97. shadowMeshNames = new string[lodCount];
  98. for (uint i = 0; i < lodCount; ++i)
  99. {
  100. shadowMeshNames[i] = reader.ReadString(2);
  101. }
  102. occluderMeshName = reader.ReadString(2);
  103. }
  104. lodDistances = new float[lodCount];
  105. for (uint i = 0; i < lodCount; ++i)
  106. {
  107. lodDistances[i] = reader.ReadSingle();
  108. }
  109. if (classVersion >= 7)
  110. {
  111. byte unk1 = reader.ReadByte();
  112. }
  113. }
  114. public uint lodCount;
  115. public uint extraLodCount;
  116. public string[][] renderMeshNames;
  117. public string[] shaderPaletteNames;
  118. public VeShaderPalette[] shaderPalettes;
  119. public string collisionMeshName;
  120. public string legacyNavigationMeshName;
  121. public string[] shadowMeshNames;
  122. public string occluderMeshName;
  123. public float[] lodDistances;
  124. }
  125. }