Panda3D
|
00001 // Filename: lwoDiscontinuousVertexMap.h 00002 // Created by: drose (24Apr01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef LWODISCONTINUOUSVERTEXMAP_H 00016 #define LWODISCONTINUOUSVERTEXMAP_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "lwoChunk.h" 00021 00022 #include "pta_stdfloat.h" 00023 #include "pmap.h" 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : LwoDiscontinuousVertexMap 00027 // Description : A mapping of floating-point values per integer index. 00028 // The meaning of these values is determined by the 00029 // mapping type code and/or its name. 00030 //////////////////////////////////////////////////////////////////// 00031 class LwoDiscontinuousVertexMap : public LwoChunk { 00032 public: 00033 bool has_value(int polygon_index, int vertex_index) const; 00034 PTA_stdfloat get_value(int polygon_index, int vertex_index) const; 00035 00036 IffId _map_type; 00037 int _dimension; 00038 string _name; 00039 00040 public: 00041 virtual bool read_iff(IffInputFile *in, size_t stop_at); 00042 virtual void write(ostream &out, int indent_level = 0) const; 00043 00044 private: 00045 typedef pmap<int, PTA_stdfloat> VMap; 00046 typedef pmap<int, VMap> VMad; 00047 VMad _vmad; 00048 00049 public: 00050 virtual TypeHandle get_type() const { 00051 return get_class_type(); 00052 } 00053 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00054 static TypeHandle get_class_type() { 00055 return _type_handle; 00056 } 00057 static void init_type() { 00058 LwoChunk::init_type(); 00059 register_type(_type_handle, "LwoDiscontinuousVertexMap", 00060 LwoChunk::get_class_type()); 00061 } 00062 00063 private: 00064 static TypeHandle _type_handle; 00065 }; 00066 00067 #endif 00068 00069