|
| 1 | +function amfMesh (element) { |
| 2 | + let obj = {type: 'mesh'} |
| 3 | + obj.objects = [] |
| 4 | + return obj |
| 5 | +} |
| 6 | + |
| 7 | +// Note: TBD Vertices can have a color, which is used to interpolate a face color (from the 3 vertices) |
| 8 | +function amfVertices (element) { |
| 9 | + let obj = {type: 'vertices'} |
| 10 | + obj.objects = [] |
| 11 | + return obj |
| 12 | +} |
| 13 | + |
| 14 | +function amfCoordinates (element) { |
| 15 | + let obj = {type: 'coordinates'} |
| 16 | + obj.objects = [] |
| 17 | + return obj |
| 18 | +} |
| 19 | +function amfNormal (element) { |
| 20 | + let obj = {type: 'normal'} |
| 21 | + obj.objects = [] |
| 22 | + return obj |
| 23 | +} |
| 24 | +function amfX (element) { |
| 25 | + return {type: 'x', value: '0'} |
| 26 | +} |
| 27 | +function amfY (element) { |
| 28 | + return {type: 'y', value: '0'} |
| 29 | +} |
| 30 | +function amfZ (element) { |
| 31 | + return {type: 'z', value: '0'} |
| 32 | +} |
| 33 | + |
| 34 | +function amfVolume (element) { |
| 35 | + let obj = {type: 'volume'} |
| 36 | + |
| 37 | + if ('MATERIALID' in element) { obj.materialid = element.MATERIALID } |
| 38 | + |
| 39 | + obj.objects = [] |
| 40 | + return obj |
| 41 | +} |
| 42 | + |
| 43 | +function amfTriangle (element) { |
| 44 | + let obj = {type: 'triangle'} |
| 45 | + obj.objects = [] |
| 46 | + return obj |
| 47 | +} |
| 48 | +function amfV1 (element) { |
| 49 | + return {type: 'v1', value: '0'} |
| 50 | +} |
| 51 | +function amfV2 (element) { |
| 52 | + return {type: 'v2', value: '0'} |
| 53 | +} |
| 54 | +function amfV3 (element) { |
| 55 | + return {type: 'v3', value: '0'} |
| 56 | +} |
| 57 | + |
| 58 | +function amfVertex (element) { |
| 59 | + let obj = {type: 'vertex'} |
| 60 | + obj.objects = [] |
| 61 | + return obj |
| 62 | +} |
| 63 | + |
| 64 | +function amfEdge (element) { |
| 65 | + let obj = {type: 'edge'} |
| 66 | + |
| 67 | + obj.objects = [] |
| 68 | + return obj |
| 69 | +} |
| 70 | + |
| 71 | +function amfMetadata (element) { |
| 72 | + let obj = {type: 'metadata'} |
| 73 | + |
| 74 | + if ('TYPE' in element) { obj.mtype = element.TYPE } |
| 75 | + if ('ID' in element) { obj.id = element.ID } |
| 76 | + |
| 77 | + return obj |
| 78 | +} |
| 79 | + |
| 80 | +function amfMaterial (element) { |
| 81 | + let obj = {type: 'material'} |
| 82 | + |
| 83 | + if ('ID' in element) { obj.id = element.ID } |
| 84 | + |
| 85 | + obj.objects = [] |
| 86 | + return obj |
| 87 | +} |
| 88 | + |
| 89 | +function amfColor (element) { |
| 90 | + let obj = {type: 'color'} |
| 91 | + |
| 92 | + obj.objects = [] |
| 93 | + return obj |
| 94 | +} |
| 95 | +function amfR (element) { |
| 96 | + return {type: 'r', value: '1'} |
| 97 | +} |
| 98 | +function amfG (element) { |
| 99 | + return {type: 'g', value: '1'} |
| 100 | +} |
| 101 | +function amfB (element) { |
| 102 | + return {type: 'b', value: '1'} |
| 103 | +} |
| 104 | +function amfA (element) { |
| 105 | + return {type: 'a', value: '1'} |
| 106 | +} |
| 107 | + |
| 108 | +function amfMap (element) { |
| 109 | + let obj = {type: 'map'} |
| 110 | + |
| 111 | + if ('GTEXID' in element) { obj.gtexid = element.GTEXID } |
| 112 | + if ('BTEXID' in element) { obj.btexid = element.BTEXID } |
| 113 | + if ('RTEXID' in element) { obj.rtexid = element.RTEXID } |
| 114 | + |
| 115 | + obj.objects = [] |
| 116 | + return obj |
| 117 | +} |
| 118 | + |
| 119 | +function amfU1 (element) { |
| 120 | + return {type: 'u1', value: '0'} |
| 121 | +} |
| 122 | +function amfU2 (element) { |
| 123 | + return {type: 'u2', value: '0'} |
| 124 | +} |
| 125 | +function amfU3 (element) { |
| 126 | + return {type: 'u3', value: '0'} |
| 127 | +} |
| 128 | + |
| 129 | +module.exports = { |
| 130 | + amfMesh, |
| 131 | + amfVertices, |
| 132 | + amfCoordinates, |
| 133 | + amfX, |
| 134 | + amfY, |
| 135 | + amfZ, |
| 136 | + amfNormal, |
| 137 | + amfVolume, |
| 138 | + amfTriangle, |
| 139 | + amfV1, |
| 140 | + amfV2, |
| 141 | + amfV3, |
| 142 | + amfVertex, |
| 143 | + amfEdge, |
| 144 | + amfMetadata, |
| 145 | + amfMaterial, |
| 146 | + amfColor, |
| 147 | + amfR, |
| 148 | + amfG, |
| 149 | + amfB, |
| 150 | + amfA, |
| 151 | + amfMap, |
| 152 | + amfU1, |
| 153 | + amfU2, |
| 154 | + amfU3 |
| 155 | +} |
0 commit comments