@@ -14,9 +14,6 @@ class ClippingContext {
14
14
15
15
this . clipIntersection = null ;
16
16
17
- this . unionOffset = 0 ;
18
- this . intersectionOffset = 0 ;
19
-
20
17
this . intersectionPlanes = [ ] ;
21
18
this . unionPlanes = [ ] ;
22
19
@@ -59,6 +56,7 @@ class ClippingContext {
59
56
update ( parentContext , clippingGroup ) {
60
57
61
58
let update = false ;
59
+ let parentChanged = false ;
62
60
63
61
if ( parentContext . version !== this . parentVersion ) {
64
62
@@ -70,21 +68,21 @@ class ClippingContext {
70
68
this . viewNormalMatrix = parentContext . viewNormalMatrix ;
71
69
this . shadowPass = parentContext . shadowPass ;
72
70
71
+ parentChanged = true ;
72
+
73
73
}
74
74
75
- if ( this . clipIntersection !== clippingGroup . clipIntersection ) {
75
+ if ( this . clipIntersection !== clippingGroup . clipIntersection || parentChanged ) {
76
76
77
77
this . clipIntersection = clippingGroup . clipIntersection ;
78
78
79
79
if ( this . clipIntersection ) {
80
80
81
- this . unionPlanes . length = parentContext . unionOffset ;
82
- this . unionOffset = parentContext . unionOffset ;
81
+ this . unionPlanes . length = parentContext . unionPlanes . length ;
83
82
84
83
} else {
85
84
86
- this . intersectionPlanes . length = parentContext . intersectionOffset ;
87
- this . intersectionOffset = parentContext . intersectionOffset ;
85
+ this . intersectionPlanes . length = parentContext . intersectionPlanes . length ;
88
86
89
87
}
90
88
@@ -95,31 +93,22 @@ class ClippingContext {
95
93
96
94
let dstClippingPlanes ;
97
95
let offset ;
98
- let dstLength ;
99
96
100
97
if ( this . clipIntersection ) {
101
98
102
99
dstClippingPlanes = this . intersectionPlanes ;
103
- offset = parentContext . intersectionOffset ;
104
-
105
- dstLength = offset + l ;
106
-
107
- this . intersectionOffset = dstLength ;
100
+ offset = parentContext . intersectionPlanes . length ;
108
101
109
102
} else {
110
103
111
104
dstClippingPlanes = this . unionPlanes ;
112
- offset = parentContext . unionOffset ;
113
-
114
- dstLength = offset + l ;
115
-
116
- this . unionOffset = dstLength ;
105
+ offset = parentContext . unionPlanes . length ;
117
106
118
107
}
119
108
120
- if ( dstClippingPlanes . length !== dstLength ) {
109
+ if ( dstClippingPlanes . length !== offset + l ) {
121
110
122
- dstClippingPlanes . length = dstLength ;
111
+ dstClippingPlanes . length = offset + l ;
123
112
124
113
for ( let i = 0 ; i < l ; i ++ ) {
125
114
0 commit comments