lwoDiscontinuousVertexMap.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file lwoDiscontinuousVertexMap.h
  10. * @author drose
  11. * @date 2001-04-24
  12. */
  13. #ifndef LWODISCONTINUOUSVERTEXMAP_H
  14. #define LWODISCONTINUOUSVERTEXMAP_H
  15. #include "pandatoolbase.h"
  16. #include "lwoChunk.h"
  17. #include "pta_stdfloat.h"
  18. #include "pmap.h"
  19. /**
  20. * A mapping of floating-point values per integer index. The meaning of these
  21. * values is determined by the mapping type code and/or its name.
  22. */
  23. class LwoDiscontinuousVertexMap : public LwoChunk {
  24. public:
  25. bool has_value(int polygon_index, int vertex_index) const;
  26. PTA_stdfloat get_value(int polygon_index, int vertex_index) const;
  27. IffId _map_type;
  28. int _dimension;
  29. std::string _name;
  30. public:
  31. virtual bool read_iff(IffInputFile *in, size_t stop_at);
  32. virtual void write(std::ostream &out, int indent_level = 0) const;
  33. private:
  34. typedef pmap<int, PTA_stdfloat> VMap;
  35. typedef pmap<int, VMap> VMad;
  36. VMad _vmad;
  37. public:
  38. virtual TypeHandle get_type() const {
  39. return get_class_type();
  40. }
  41. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  42. static TypeHandle get_class_type() {
  43. return _type_handle;
  44. }
  45. static void init_type() {
  46. LwoChunk::init_type();
  47. register_type(_type_handle, "LwoDiscontinuousVertexMap",
  48. LwoChunk::get_class_type());
  49. }
  50. private:
  51. static TypeHandle _type_handle;
  52. };
  53. #endif