(frustum)
| 154 | }; |
| 155 | |
| 156 | function update(frustum) { |
| 157 | //>>includeStart('debug', pragmas.debug); |
| 158 | if ( |
| 159 | !defined(frustum.fov) || |
| 160 | !defined(frustum.aspectRatio) || |
| 161 | !defined(frustum.near) || |
| 162 | !defined(frustum.far) |
| 163 | ) { |
| 164 | throw new DeveloperError( |
| 165 | "fov, aspectRatio, near, or far parameters are not set.", |
| 166 | ); |
| 167 | } |
| 168 | //>>includeEnd('debug'); |
| 169 | |
| 170 | const changed = |
| 171 | frustum.fov !== frustum._fov || |
| 172 | frustum.aspectRatio !== frustum._aspectRatio || |
| 173 | frustum.near !== frustum._near || |
| 174 | frustum.far !== frustum._far || |
| 175 | frustum.xOffset !== frustum._xOffset || |
| 176 | frustum.yOffset !== frustum._yOffset; |
| 177 | |
| 178 | if (!changed) { |
| 179 | return; |
| 180 | } |
| 181 | |
| 182 | //>>includeStart('debug', pragmas.debug); |
| 183 | Check.typeOf.number.greaterThanOrEquals("fov", frustum.fov, 0.0); |
| 184 | Check.typeOf.number.lessThan("fov", frustum.fov, Math.PI); |
| 185 | |
| 186 | Check.typeOf.number.greaterThanOrEquals( |
| 187 | "aspectRatio", |
| 188 | frustum.aspectRatio, |
| 189 | 0.0, |
| 190 | ); |
| 191 | |
| 192 | Check.typeOf.number.greaterThanOrEquals("near", frustum.near, 0.0); |
| 193 | if (frustum.near > frustum.far) { |
| 194 | throw new DeveloperError("near must be less than far."); |
| 195 | } |
| 196 | //>>includeEnd('debug'); |
| 197 | |
| 198 | frustum._aspectRatio = frustum.aspectRatio; |
| 199 | frustum._fov = frustum.fov; |
| 200 | frustum._fovy = |
| 201 | frustum.aspectRatio <= 1 |
| 202 | ? frustum.fov |
| 203 | : Math.atan(Math.tan(frustum.fov * 0.5) / frustum.aspectRatio) * 2.0; |
| 204 | frustum._near = frustum.near; |
| 205 | frustum._far = frustum.far; |
| 206 | frustum._sseDenominator = 2.0 * Math.tan(0.5 * frustum._fovy); |
| 207 | frustum._xOffset = frustum.xOffset; |
| 208 | frustum._yOffset = frustum.yOffset; |
| 209 | |
| 210 | const f = frustum._offCenterFrustum; |
| 211 | |
| 212 | f.top = frustum.near * Math.tan(0.5 * frustum._fovy); |
| 213 | f.bottom = -f.top; |
no test coverage detected
searching dependent graphs…