Changeset 87
- Timestamp:
- 10/16/07 00:00:19 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/OpenMeshD/OpenMesh/Core/IO/reader/PLYReader.d
r85 r87 532 532 "uint32" : 4, 533 533 "float32" : 4, 534 "float" : 4, 534 535 "float64" : 8, 536 "double" : 8, 535 537 ]; 536 538 if (type in prop_sizes) { 537 539 return prop_sizes[type]; 540 } 541 else { 542 throw new InvalidFormatError("Unknown data type: "~type); 543 } 544 } 545 546 // Some ply files contain types like 'int' or 'uchar' instead 547 // of the specific in32, uint8 types. 548 static string ply_canonical_type(string type) 549 { 550 string[string] prop_names = 551 [ 552 "int8"[] : "int8"[], 553 "char" : "int8", 554 "byte" : "int8", 555 "uint8" : "uint8", 556 "uchar" : "uint8", 557 "ubyte" : "uint8", 558 "int16" : "int16", 559 "uint16" : "uint16", 560 "int32" : "int32", 561 "int" : "int32", 562 "uint32" : "uint32", 563 "float32" : "float32", 564 "float" : "float32", 565 "float64" : "float64", 566 "double" : "float64", 567 ]; 568 if (type in prop_names) { 569 return prop_names[type].dup; 538 570 } 539 571 else { … … 656 688 } 657 689 static class ScalarProp : Prop { 658 this(string name, stringtype) {659 super( name, type);660 size = ply_format_binary_size(t ype);690 this(string _name, string _type) { 691 super(_name, ply_canonical_type(_type)); 692 size = ply_format_binary_size(this.type); 661 693 } 662 694 override boxer.Box read_prop_ascii(InputStream _in, BaseImporter _bi, ref Options _opt) … … 676 708 this(string name, string idx_t, string elem_t) { 677 709 super(name, "list"); 678 index_type = idx_t.dup; 679 elem_type = elem_t.dup; 680 elem_size = ply_format_binary_size(elem_t); 710 index_type = ply_canonical_type(idx_t); 711 elem_type = ply_canonical_type(elem_t); 712 index_size = ply_format_binary_size(index_type); 713 elem_size = ply_format_binary_size(elem_type); 681 714 } 682 715 override boxer.Box read_prop_ascii(InputStream _in, BaseImporter _bi, ref Options _opt) … … 703 736 string index_type; 704 737 string elem_type; 738 uint index_size; 705 739 uint elem_size; 706 740 }
