1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0031465: Data Exchange, RWObj_Reader - skip duplicating smooth groups

RWObj_Reader::pushSmoothGroup() now ignores smooth groups statements pointing to the same group.
This commit is contained in:
kgv 2020-03-26 13:48:09 +03:00 committed by bugmaster
parent 7f24b768c3
commit 85b147584e
2 changed files with 720 additions and 0 deletions

View File

@ -704,6 +704,14 @@ void RWObj_Reader::pushSmoothGroup (const char* theSmoothGroupIndex)
{
aNewSmoothGroup.Clear();
}
if (myActiveSubMesh.SmoothGroup.IsEqual (aNewSmoothGroup))
{
// Ignore duplicated statements to workaround some weird OBJ files.
// Note that smooth groups are handled in different manner than groups and objects,
// which always flushed even with equal names.
return;
}
if (addMesh (myActiveSubMesh, RWObj_SubMeshReason_NewSmoothGroup))
{
myPackedIndices.Clear(); // vertices might be duplicated after this point...

View File

@ -0,0 +1,712 @@
puts "========"
puts "0031465: Data Exchange, RWObj_Reader - skip duplicating smooth groups"
puts "========"
# define OBJ file with duplicated smooth groups
set sm_obj {
g sphere
v 0.34 0.06 -0.94
v 0.46 0.00 -0.89
v 0.24 0.00 -0.97
v 0.30 0.17 -0.94
v 0.00 0.00 -1.00
v 0.22 0.26 -0.94
v 0.12 0.32 -0.94
v 0.60 0.22 -0.77
v 0.66 0.00 -0.75
v 0.82 0.00 -0.57
v 0.00 0.34 -0.94
v 0.49 0.41 -0.77
v -0.12 0.32 -0.94
v 0.32 0.56 -0.77
v -0.22 0.26 -0.94
v 0.85 0.15 -0.50
v 0.94 0.00 -0.35
v 0.11 0.63 -0.77
v -0.30 0.17 -0.94
v 0.75 0.43 -0.50
v -0.11 0.63 -0.77
v -0.34 0.06 -0.94
v 0.56 0.66 -0.50
v -0.32 0.56 -0.77
v -0.34 -0.06 -0.94
v 0.00 0.00 -1.00
v 0.30 0.81 -0.50
v -0.49 0.41 -0.77
v 0.93 0.34 -0.17
v 0.99 0.00 -0.12
v 0.99 0.00 0.12
v -0.30 -0.17 -0.94
v 0.00 0.87 -0.50
v -0.60 0.22 -0.77
v 0.75 0.63 -0.17
v -0.22 -0.26 -0.94
v -0.30 0.81 -0.50
v -0.64 0.00 -0.77
v 0.49 0.85 -0.17
v -0.12 -0.32 -0.94
v -0.56 0.66 -0.50
v 0.97 0.17 0.17
v 0.94 0.00 0.35
v -0.60 -0.22 -0.77
v 0.17 0.97 -0.17
v 0.00 -0.34 -0.94
v -0.75 0.43 -0.50
v 0.85 0.49 0.17
v -0.49 -0.41 -0.77
v -0.17 0.97 -0.17
v 0.12 -0.32 -0.94
v -0.85 0.15 -0.50
v 0.63 0.75 0.17
v -0.32 -0.56 -0.77
v -0.49 0.85 -0.17
v 0.22 -0.26 -0.94
v -0.85 -0.15 -0.50
v 0.34 0.93 0.17
v -0.11 -0.63 -0.77
v -0.75 0.63 -0.17
v 0.81 0.30 0.50
v 0.82 0.00 0.57
v 0.30 -0.17 -0.94
v 0.24 0.00 -0.97
v -0.75 -0.43 -0.50
v 0.00 0.98 0.17
v 0.11 -0.63 -0.77
v -0.93 0.34 -0.17
v 0.66 0.56 0.50
v 0.34 -0.06 -0.94
v 0.46 0.00 -0.89
v -0.56 -0.66 -0.50
v -0.34 0.93 0.17
v 0.32 -0.56 -0.77
v -0.98 0.00 -0.17
v 0.43 0.75 0.50
v -0.30 -0.81 -0.50
v -0.63 0.75 0.17
v 0.63 0.11 0.77
v 0.66 0.00 0.75
v 0.46 0.00 0.89
v 0.49 -0.41 -0.77
v -0.93 -0.34 -0.17
v 0.15 0.85 0.50
v 0.00 -0.87 -0.50
v -0.85 0.49 0.17
v 0.56 0.32 0.77
v 0.60 -0.22 -0.77
v 0.66 0.00 -0.75
v 0.82 0.00 -0.57
v -0.75 -0.63 -0.17
v -0.15 0.85 0.50
v 0.30 -0.81 -0.50
v -0.97 0.17 0.17
v 0.41 0.49 0.77
v -0.49 -0.85 -0.17
v -0.43 0.75 0.50
v 0.56 -0.66 -0.50
v -0.97 -0.17 0.17
v 0.22 0.60 0.77
v -0.17 -0.97 -0.17
v -0.66 0.56 0.50
v 0.32 0.12 0.94
v 0.24 0.00 0.97
v 0.75 -0.43 -0.50
v -0.85 -0.49 0.17
v 0.00 0.64 0.77
v 0.17 -0.97 -0.17
v -0.81 0.30 0.50
v 0.26 0.22 0.94
v 0.00 0.00 1.00
v 0.85 -0.15 -0.50
v 0.94 0.00 -0.35
v -0.63 -0.75 0.17
v -0.22 0.60 0.77
v 0.49 -0.85 -0.17
v -0.87 0.00 0.50
v 0.17 0.30 0.94
v -0.34 -0.93 0.17
v -0.41 0.49 0.77
v 0.75 -0.63 -0.17
v -0.81 -0.30 0.50
v 0.06 0.34 0.94
v 0.00 -0.98 0.17
v -0.56 0.32 0.77
v 0.93 -0.34 -0.17
v 0.99 0.00 -0.12
v 0.99 0.00 0.12
v -0.66 -0.56 0.50
v -0.06 0.34 0.94
v 0.34 -0.93 0.17
v -0.63 0.11 0.77
v -0.43 -0.75 0.50
v -0.17 0.30 0.94
v 0.63 -0.75 0.17
v -0.63 -0.11 0.77
v -0.15 -0.85 0.50
v -0.26 0.22 0.94
v 0.85 -0.49 0.17
v -0.56 -0.32 0.77
v 0.15 -0.85 0.50
v -0.32 0.12 0.94
v 0.97 -0.17 0.17
v 0.94 0.00 0.35
v -0.41 -0.49 0.77
v 0.43 -0.75 0.50
v -0.34 0.00 0.94
v 0.00 0.00 1.00
v -0.22 -0.60 0.77
v 0.66 -0.56 0.50
v -0.32 -0.12 0.94
v 0.00 -0.64 0.77
v 0.81 -0.30 0.50
v 0.82 0.00 0.57
v -0.26 -0.22 0.94
v 0.22 -0.60 0.77
v -0.17 -0.30 0.94
v 0.41 -0.49 0.77
v -0.06 -0.34 0.94
v 0.56 -0.32 0.77
v 0.06 -0.34 0.94
v 0.63 -0.11 0.77
v 0.66 0.00 0.75
v 0.46 0.00 0.89
v 0.17 -0.30 0.94
v 0.26 -0.22 0.94
v 0.24 0.00 0.97
v 0.32 -0.12 0.94
s 1
f 1 2 3
s 1
f 4 3 5
s 1
f 4 1 3
s 1
f 4 2 1
s 1
f 6 4 5
s 1
f 7 6 5
s 1
f 8 9 2
s 1
f 8 10 9
s 1
f 8 2 4
s 1
f 11 7 5
s 1
f 12 4 6
s 1
f 12 8 4
s 1
f 13 11 5
s 1
f 14 6 7
s 1
f 14 12 6
s 1
f 15 13 5
s 1
f 16 17 10
s 1
f 18 14 7
s 1
f 18 7 11
s 1
f 19 15 5
s 1
f 20 16 10
s 1
f 20 10 8
s 1
f 20 8 12
s 1
f 20 17 16
s 1
f 21 11 13
s 1
f 21 18 11
s 1
f 22 19 5
s 1
f 23 12 14
s 1
f 23 20 12
s 1
f 24 13 15
s 1
f 24 21 13
s 1
f 25 5 26
s 1
f 25 22 5
s 1
f 27 14 18
s 1
f 27 23 14
s 1
f 28 24 15
s 1
f 28 15 19
s 1
f 29 30 17
s 1
f 29 31 30
s 1
f 32 25 26
s 1
f 33 27 18
s 1
f 33 18 21
s 1
f 34 19 22
s 1
f 34 28 19
s 1
f 35 20 23
s 1
f 35 17 20
s 1
f 35 29 17
s 1
f 36 32 26
s 1
f 37 33 21
s 1
f 37 21 24
s 1
f 38 22 25
s 1
f 38 34 22
s 1
f 39 23 27
s 1
f 39 35 23
s 1
f 40 36 26
s 2
f 41 37 24
s 2
f 41 24 28
s 2
f 42 43 31
s 2
f 44 25 32
s 2
f 44 38 25
s 2
f 45 27 33
s 2
f 45 39 27
s 2
f 46 40 26
s 2
f 47 28 34
s 2
f 47 41 28
s 2
f 48 43 42
s 2
f 48 29 35
s 2
f 48 42 31
s 2
f 48 31 29
s 2
f 49 32 36
s 2
f 49 44 32
s 2
f 50 33 37
s 2
f 50 45 33
s 2
f 51 46 26
s 2
f 52 34 38
s 2
f 52 47 34
s 2
f 53 35 39
s 2
f 53 48 35
s 2
f 54 36 40
s 2
f 54 49 36
s 2
f 55 50 37
s 2
f 55 37 41
s 2
f 56 51 26
s 2
f 57 38 44
s 2
f 57 52 38
s 2
f 58 53 39
s 2
f 58 39 45
s 2
f 59 54 40
s 2
f 59 40 46
s 2
f 60 41 47
s 2
f 60 55 41
s 2
f 61 62 43
s 2
f 63 26 64
s 2
f 63 56 26
s 2
f 65 57 44
s 2
f 65 44 49
s 2
f 66 45 50
s 2
f 66 58 45
s 2
f 67 46 51
s 2
f 67 59 46
s 2
f 68 60 47
s 2
f 68 47 52
s 2
f 69 43 48
s 2
f 69 61 43
s 2
f 69 48 53
s 2
f 70 63 64
s 2
f 70 71 63
s 2
f 70 64 71
s 2
f 72 65 49
s 2
f 72 49 54
s 2
f 73 66 50
s 2
f 73 50 55
s 2
f 74 67 51
s 2
f 74 51 56
s 2
f 75 68 52
s 2
f 75 52 57
s 2
f 76 69 53
s 2
f 76 53 58
s 2
f 77 72 54
s 2
f 77 54 59
s 2
f 78 55 60
s 2
f 78 73 55
s 2
f 79 80 62
s 2
f 79 81 80
s 2
f 82 56 63
s 2
f 82 74 56
s 2
f 83 75 57
s 2
f 83 57 65
s 2
f 84 58 66
s 2
f 84 76 58
s 2
f 85 77 59
s 2
f 85 59 67
s 2
f 86 78 60
s 2
f 86 60 68
s 2
f 87 61 69
s 2
f 87 79 62
s 2
f 87 81 79
s 2
f 87 62 61
s 2
f 88 63 71
s 2
f 88 71 89
s 2
f 88 89 90
s 2
f 88 82 63
s 2
f 91 65 72
s 2
f 91 83 65
s 2
f 92 84 66
s 2
f 92 66 73
s 2
f 93 85 67
s 2
f 93 67 74
s 2
f 94 86 68
s 2
f 94 68 75
s 2
f 95 69 76
s 2
f 95 87 69
s 2
f 96 91 72
s 2
f 96 72 77
s 2
f 97 73 78
s 2
f 97 92 73
s 2
f 98 74 82
s 2
f 98 93 74
s 2
f 99 94 75
s 2
f 99 75 83
s 3
f 100 76 84
s 3
f 100 95 76
s 3
f 101 96 77
s 3
f 101 77 85
s 3
f 102 78 86
s 3
f 102 97 78
s 3
f 103 104 81
s 3
f 105 88 90
s 3
f 105 82 88
s 3
f 105 98 82
s 3
f 106 83 91
s 3
f 106 99 83
s 3
f 107 84 92
s 3
f 107 100 84
s 3
f 108 101 85
s 3
f 108 85 93
s 3
f 109 102 86
s 3
f 109 86 94
s 3
f 110 111 104
s 3
f 110 103 81
s 3
f 110 104 103
s 3
f 110 81 87
s 3
f 110 87 95
s 3
f 112 105 90
s 3
f 112 90 113
s 3
f 112 113 105
s 3
f 114 106 91
s 3
f 114 91 96
s 3
f 115 107 92
s 3
f 115 92 97
s 3
f 116 108 93
s 3
f 116 93 98
s 3
f 117 109 94
s 3
f 117 94 99
s 3
f 118 95 100
s 3
f 118 110 95
s 3
f 118 111 110
s 3
f 119 114 96
s 3
f 119 96 101
s 3
f 120 97 102
s 3
f 120 115 97
s 3
f 121 98 105
s 3
f 121 105 113
s 3
f 121 116 98
s 3
f 122 99 106
s 3
f 122 117 99
s 3
f 123 118 100
s 3
f 123 111 118
s 3
f 123 100 107
s 3
f 124 101 108
s 3
f 124 119 101
s 3
f 125 120 102
s 3
f 125 102 109
s 3
f 126 121 113
s 3
f 126 113 127
s 3
f 126 127 128
s 3
f 129 122 106
s 3
f 129 106 114
s 3
f 130 111 123
s 3
f 130 123 107
f 130 107 115
f 131 124 108
f 131 108 116
f 132 109 117
f 132 125 109
f 133 114 119
f 133 129 114
f 134 115 120
f 134 130 115
f 134 111 130
f 135 116 121
f 135 131 116
f 136 132 117
f 136 117 122
f 137 119 124
f 137 133 119
f 138 120 125
f 138 134 120
f 138 111 134
f 139 121 126
f 139 135 121
f 139 126 128
f 140 122 129
f 140 136 122
f 141 137 124
f 141 124 131
f 142 111 138
f 142 125 132
f 142 138 125
f 143 128 144
f 143 144 139
f 143 139 128
f 145 140 129
f 145 129 133
f 146 141 131
f 146 131 135
f 147 148 111
f 147 142 132
f 147 132 136
f 147 111 142
f 149 133 137
f 149 145 133
f 150 135 139
f 150 139 144
f 150 146 135
f 151 136 140
f 151 148 147
f 151 147 136
f 152 149 137
f 152 137 141
f 153 144 154
f 153 150 144
f 155 140 145
f 155 151 140
f 155 148 151
f 156 152 141
f 156 141 146
f 157 148 155
f 157 145 149
f 157 155 145
f 158 156 146
f 158 146 150
f 159 148 157
f 159 157 149
f 159 149 152
f 160 158 150
f 160 150 153
f 160 153 154
f 161 152 156
f 161 148 159
f 161 159 152
f 162 154 163
f 162 163 164
f 162 160 154
f 162 164 160
f 165 156 158
f 165 148 161
f 165 161 156
f 166 158 160
f 166 167 148
f 166 165 158
f 166 160 164
f 166 148 165
f 168 164 167
f 168 166 164
f 168 167 166
}
set fd [open ${imagedir}/${casename}.obj w]
fconfigure $fd -translation lf
puts $fd $sm_obj
close $fd
ReadObj D ${imagedir}/${casename}.obj
XGetOneShape s D
checknbshapes s -face 3 -compound 2
checktrinfo s -tri 306 -nod 205